RdStationInterpolatorStarShape.cc
Go to the documentation of this file.
2 #include <fwk/CentralConfig.h>
3 #include <fwk/VModule.h>
4 
5 #include <rdet/RDetector.h>
6 #include <rdet/Station.h>
7 #include <utl/CoordinateSystem.h>
8 #include <utl/Point.h>
9 #include <evt/RadioSimulation.h>
10 #include <utl/TimeStamp.h>
11 #include <utl/TimeInterval.h>
12 #include <utl/UTCDateTime.h>
13 #include <utl/Trace.h>
14 #include <utl/AugerUnits.h>
15 #include <utl/RadioGeometryUtilities.h>
16 #include <evt/Event.h>
17 #include <evt/ShowerSimData.h>
18 #include <revt/REvent.h>
19 #include <revt/EventTrigger.h>
20 #include <revt/Station.h>
21 #include <revt/Header.h>
22 #include <revt/StationTriggerData.h>
23 #include <revt/StationSimData.h>
24 #include <utl/StringCompare.h>
25 #include <cmath>
26 #include <algorithm>
27 #include <set>
28 
29 #include <utl/FFTDataContainer.h>
30 #include <string>
31 #include <evt/SimRadioPulse.h>
32 #include <utl/MathConstants.h>
33 #include <complex>
34 #include <map>
35 #include <vector>
36 #include <iomanip>
37 #include <fstream>
38 #include <math.h>
39 #include <boost/utility.hpp>
40 #include <TRandom2.h>
41 #include <boost/algorithm/string.hpp>
42 #include <stdlib.h>
43 #include <rdet/Channel.h>
44 
45 #define OUT(x) if ((x) <= fInfoLevel) cerr << " "
46 using namespace std;
47 using namespace evt;
48 using namespace det;
49 using namespace utl;
50 using namespace revt;
51 using namespace fwk;
52 
54 
56  fMaximumDistance(5.*meter), // not yet used since not yet tested, up to which distance the interpolation works properly
57  fTracePaddingAtFront(2000.*nanosecond),
58  fMinimumTraceLength(12000.*nanosecond),
59  fEventRate(0.0001*hertz),
60  fEventTimeOffset(0.0),
61  fUseRateTiming(false),
62  fIncludedStationIds(vector<int>()),
63  fExcludedStationIds(vector<int>()),
64  fInfoLevel(-1)
65  {
66  }
67 
68  RdStationInterpolatorStarShape::~RdStationInterpolatorStarShape()
69  {
70  }
71 
73  {
74  // Read in the configurations of the xml file
75  OUT(eFinal)<<"RdStationInterpolatorStarShape::Init()"<<endl;
76  string tmpstring;
77  Branch topBranch = CentralConfig::GetInstance()->GetTopBranch("RdStationInterpolatorStarShape");
78  topBranch.GetChild("MaximumAllowedDistance").GetData(fMaximumDistance);
79  topBranch.GetChild("TracePaddingAtFront").GetData(fTracePaddingAtFront);
80  topBranch.GetChild("MinimumTraceLength").GetData(fMinimumTraceLength);
81  topBranch.GetChild("SimEventRate").GetData(fEventRate);
82  topBranch.GetChild("FirstEventTime").GetData(fFirstEventTime);
83  topBranch.GetChild("UseRateTiming").GetData(tmpstring);
84  fUseRateTiming = utl::StringEquivalent(tmpstring,"yes");
85  topBranch.GetChild("IncludedStationIds").GetData(fIncludedStationIds);
86  topBranch.GetChild("ExcludedStationIds").GetData(fExcludedStationIds);
87  topBranch.GetChild("InfoLevel").GetData(fInfoLevel);
88 
89  ostringstream info;
90  if (fUseRateTiming) {
91  info << "\n Ignoring event times provided by simulations! Using rate timing instead.\n"
92  << " First event date " << UTCDateTime(fFirstEventTime) << "\n"
93  << " Events have a rate of " << fEventRate/hertz << " Hz\n";
94  }
95  info << "\n Padding time series data at front by "
97  << " ns and at end to a total length of at least "
99  << " ns."
100  << endl;
101  OUT(eFinal) <<info.str() << endl;
102 
103  return eSuccess;
104  }//Init
105 
106  fwk::VModule::ResultFlag RdStationInterpolatorStarShape::Run(evt::Event& theevent)
107  {
108  OUT(eIntermediate) <<"RdStationInterpolatorStarShape::Run" << endl;
109 
110  evt::ShowerSimData& simshow = theevent.GetSimShower();
111  evt::RadioSimulation& rsim = simshow.GetRadioSimulation();
112 
114  BuildSimShower(simshow,corsys);
115  Detector& Det = Detector::GetInstance();
116  TimeStamp eventtime = rsim.GetEventTime();
117 
118  // overwrite event time if fUseRateTiming is activated
119  if (fUseRateTiming)
120  eventtime = fFirstEventTime+fEventTimeOffset;
121 
122  // check if the event time has an uninitialized (illegal) value
123  if (eventtime == TimeStamp(0,0)) {
124  WARNING("RdStationInterpolatorStarShape: Event time of RadioSimulation is not available. Aborting ...");
125  return eFailure;
126  }
127 
128  Det.Update(eventtime);
129  const rdet::RDetector& RadioDet = Det.GetRDetector();
130 
131  if(!theevent.HasREvent())
132  theevent.MakeREvent();
133 
134  revt::REvent& therev = theevent.GetREvent();
135 
136  if (!rsim.GoToFirstSimRadioPulse()) {
137  WARNING("RdStationInterpolatorStarShape: No SimRadioPulse in RadioSimulation. Aborting ...");
138  return eFailure;
139  }
140 
141  therev.GetHeader().SetId(rsim.GetEventNumber());
142  therev.GetHeader().SetRunNumber(rsim.GetRunNumber());
143  therev.GetHeader().SetTime(eventtime);
144  simshow.MakeTimeStamp(eventtime);
145 
146  // Add trigger information to the event, by default events are assumed as externally triggered
147  therev.MakeTrigger();
148  therev.GetTrigger().SetExternalTrigger(true);
149 
150  // determine the spacings in radius in the shower plane and in azimuth
151  vector<SimPulseEntry> simPulses;
152  set<double> radiusValues;
153  set<double> azimuthValues;
154  set<double> altitudeValues;
155  bool ok = true;
156  do {
157  const SimRadioPulse& srpulse = rsim.GetNextSimRadioPulse(ok);
158  // leave the loop if there were no further SimRadioPulses
159  if (!ok)
160  break;
161 
162  // register simPulses
163  double radius = RadioGeometryUtilities::GetDistanceToAxis(simshow.GetDirection(), simshow.GetPosition(),
164  srpulse.GetLocation());
165 
166  double azimuth = (srpulse.GetLocation()-simshow.GetPosition()).GetPhi(corsys);
167 
168  double altitude = srpulse.GetLocation().GetZ(corsys);
169 
170  simPulses.push_back(SimPulseEntry(radius, azimuth, &srpulse));
171  radiusValues.insert(long(radius*1000+0.5)/1000.); // store rounded radius value
172  azimuthValues.insert(long(azimuth*1000+0.5)/1000.); // store rounded azimuth value
173  altitudeValues.insert(long(altitude*1000+0.5)/1000.); // store rounded altitude value
174 
175  } while (ok); //do
176 
177  // check that we actually have a star-shape and count rings and rays
178  if (radiusValues.size()*azimuthValues.size() != simPulses.size()) {
179  WARNING("RdStationInterpolatorStarShape: Simulation does not have star shape. Aborting ...");
180  return eFailure;
181  }
182 
183  // output some info
184  std::cout << "\nSimulation has " << radiusValues.size() << " rings, " << azimuthValues.size()
185  << " angle bins and spans heights from " << (*altitudeValues.begin()) / meter
186  << " m to " << (*altitudeValues.rbegin()) / meter << " m above core.\n\n" << endl;
187 
188  //fixme TH: should check for maximum height difference and abort if too big
189 
190  // sort the list of simpulses in rings with increasing azimuths
191  sort(simPulses.begin(), simPulses.end());
192 
193  // now loop over radio stations and interpolate them from the sim-pulses
194  for (rdet::RDetector::StationIterator rdIt = RadioDet.StationsBegin(); rdIt != RadioDet.StationsEnd(); ++rdIt)
195  {
196  utl::Point Position = rdIt->GetPosition();
197  int statID = rdIt->GetId();
198 
199  OUT(eObscure) << "Station " << statID;
200 
201  // if station id is listed in fExcludedStationIds, skip this simulated radio pulse (it will not be re-used for the second-closest antenna station!)
202  if (not fExcludedStationIds.empty())
203  if ( find(fExcludedStationIds.begin(), fExcludedStationIds.end(), statID) != fExcludedStationIds.end() ) {
204  OUT(eObscure) << " -> not associated as it is in the exclude list." << endl;
205  continue;
206  }
207 
208  // if there is a list of fIncludedStationIds skip this simulated radio pulse if station id is not in the list
209  if (not fIncludedStationIds.empty())
210  if ( find(fIncludedStationIds.begin(), fIncludedStationIds.end(), statID) == fIncludedStationIds.end() ) {
211  OUT(eObscure) <<" -> station not associated as it is not in the include list." << endl;
212  continue;
213  }
214 
215  //find the nearest neighbors of simulated pulses to the station (station ID, timeseries)
216  double stationRadius = RadioGeometryUtilities::GetDistanceToAxis(simshow.GetDirection(), simshow.GetPosition(),
217  Position);
218 
219  double stationAzimuth = (Position-simshow.GetPosition()).GetPhi(corsys);
220 
221  double stationAltitude = (Position.GetZ(corsys));
222 
223  OUT(eObscure) << " associated at radius " << stationRadius/meter
224  << " m with azimuth " << stationAzimuth/deg
225  << " degree at altitude " << stationAltitude / meter
226  << " m\n";
227 
228  // special treatment if station is inside innermost ring or outside outermost ring
229  if (stationRadius >= (*radiusValues.rbegin())) {
230 // cout << "Station is outside outermost ring, skip it.\n";
231  continue;
232  }
233  else if (stationRadius <= (*radiusValues.begin())) {
234  cout << "\nStation " << statID << " is in innermost ring, skip it.\n\n";
235  continue;
236  //fixme TH: devise scheme to interpolate in innermost ring
237  }
238 
239  // find the four adjacent sim radio pulses
240  long indexHighHigh = distance(radiusValues.begin(),radiusValues.upper_bound(stationRadius))*azimuthValues.size()+distance(azimuthValues.begin(),azimuthValues.upper_bound(stationAzimuth));
241  long indexHighLow = indexHighHigh-1;
242  // check if we have to apply a special treatment because of wraparound for periodic azimuth values
243  if (indexHighHigh >= long(simPulses.size()) ||
244  fabs(simPulses.at(indexHighHigh).fDistanceFromShowerAxis-simPulses.at(indexHighLow).fDistanceFromShowerAxis)/simPulses.at(indexHighHigh).fDistanceFromShowerAxis > 1.0e-3)
245  {
246  indexHighHigh -= azimuthValues.size();
247  }
248  long indexLowHigh = indexHighHigh-azimuthValues.size();
249  long indexLowLow = indexHighLow-azimuthValues.size();
250 
251 /*
252  std::cout << "radius " << simPulses.at(indexLowLow).fDistanceFromShowerAxis << " azimuth " << simPulses.at(indexLowLow).fObserverAzimuthAngle << " number " << indexLowLow << "\n";
253  std::cout << "radius " << simPulses.at(indexLowHigh).fDistanceFromShowerAxis << " azimuth " << simPulses.at(indexLowHigh).fObserverAzimuthAngle << " number " << indexLowHigh << "\n";
254  std::cout << "radius " << simPulses.at(indexHighLow).fDistanceFromShowerAxis << " azimuth " << simPulses.at(indexHighLow).fObserverAzimuthAngle << " number " << indexHighLow << "\n";
255  std::cout << "radius " << simPulses.at(indexHighHigh).fDistanceFromShowerAxis << " azimuth " << simPulses.at(indexHighHigh).fObserverAzimuthAngle << " number " << indexHighHigh << "\n";
256 */
257 
258  //get the design frequencies from the channels of the station and check if they are the same for all channels
259  double designLowerFreq = 0.0;
260  double designLowerFreqFirstCh = 0.;
261  double designUpperFreq = 0.0;
262  double designUpperFreqFirstCh = 0.;
263  for(rdet::Station::ChannelIterator cIt = rdIt->ChannelsBegin(); cIt!= rdIt->ChannelsEnd(); ++cIt){
264  const rdet::Channel& cDetChannel = RadioDet.GetStation(rdIt->GetId()).GetChannel(cIt->GetId());
265  designLowerFreq = cDetChannel.GetDesignLowerFreq();
266  designUpperFreq = cDetChannel.GetDesignUpperFreq();
267  if (cIt == rdIt->ChannelsBegin()) {
268  designLowerFreqFirstCh = designLowerFreq;
269  designUpperFreqFirstCh = designUpperFreq;
270  }
271  if(designLowerFreq != designLowerFreqFirstCh || designUpperFreq != designUpperFreqFirstCh) {
272  WARNING("RdStationInterpolatorStarShape: design frequency different for different channels");
273  return eFailure;
274  }
275  }
276 
277 /*
278  // do not limit interpolation to design frequency band
279  designLowerFreqFirstCh=0.;
280  designUpperFreqFirstCh=1.e12;
281 */
282 
283  // now interpolate between the four positions
284  const double starttime1 = simPulses.at(indexLowLow).fRadioPulse->GetStartTime();
285  const double radius1 = simPulses.at(indexLowLow).fDistanceFromShowerAxis;
286  const double azimuth1 = simPulses.at(indexLowLow).fObserverAzimuthAngle;
287  const double binning1 = simPulses.at(indexLowLow).fRadioPulse->GetEfieldTimeSeries().GetBinning();
288  // padding of zeroes to end of timeseries
289  StationFFTDataContainer simFFTDataContainer1;
290  simFFTDataContainer1.GetTimeSeries() = PadTimeSeries(*simPulses.at(indexLowLow).fRadioPulse);
291 
292  const double starttime2 = simPulses.at(indexHighLow).fRadioPulse->GetStartTime();;
293  const double radius2 = simPulses.at(indexHighLow).fDistanceFromShowerAxis;
294  const double binning2 = simPulses.at(indexHighLow).fRadioPulse->GetEfieldTimeSeries().GetBinning();
295  StationFFTDataContainer simFFTDataContainer2;
296  simFFTDataContainer2.GetTimeSeries() = PadTimeSeries(*simPulses.at(indexHighLow).fRadioPulse);
297 
298  const double starttime3 = simPulses.at(indexLowHigh).fRadioPulse->GetStartTime();;
299  const double azimuth2 = simPulses.at(indexLowHigh).fObserverAzimuthAngle;
300  const double binning3 = simPulses.at(indexLowHigh).fRadioPulse->GetEfieldTimeSeries().GetBinning();
301  StationFFTDataContainer simFFTDataContainer3;
302  simFFTDataContainer3.GetTimeSeries() = PadTimeSeries(*simPulses.at(indexLowHigh).fRadioPulse);
303 
304  const double starttime4 = simPulses.at(indexHighHigh).fRadioPulse->GetStartTime();;
305  const double binning4 = simPulses.at(indexHighHigh).fRadioPulse->GetEfieldTimeSeries().GetBinning();
306  StationFFTDataContainer simFFTDataContainer4;
307  simFFTDataContainer4.GetTimeSeries() = PadTimeSeries(*simPulses.at(indexHighHigh).fRadioPulse);
308 
309  // check for same binning of timeseries. Must have the same binning
310  if ( (fabs(binning2 - binning1)/binning1 > 1.e-4)
311  || (fabs(binning3 - binning1)/binning1 > 1.e-4)
312  || (fabs(binning4 - binning1)/binning1 > 1.e-4) )
313  {
314  WARNING("RdStationInterpolatorStarShape: simtimeseries don't have the same binning. Aborting ...");
315  return eFailure;
316  }
317 
318  if ( simFFTDataContainer1.GetNyquistZone() != 1 || simFFTDataContainer2.GetNyquistZone() != 1 ) {
319  WARNING("RdStationInterpolatorStarShape: simtimeseries not in first Nyquist zone.");
320  return eFailure;
321  }
322 
323  if ( simFFTDataContainer1.GetConstFrequencySpectrum().GetSize() != simFFTDataContainer2.GetConstFrequencySpectrum().GetSize() ) {
324  WARNING("RdStationInterpolatorStarshape: simtimeseries don't have the same length.");
325  return eFailure;
326  }
327 
328  // for each of the azimuth bins interpolate linearly between the two rings
329  const revt::StationFFTDataContainer InterFFTDataContainerLeft = Interpolate(simFFTDataContainer1, simFFTDataContainer2, radius1, radius2, stationRadius, designLowerFreqFirstCh, designUpperFreqFirstCh);
330  const double starttimeLeft = starttime1*(radius2-stationRadius)/(radius2-radius1)+starttime2*(stationRadius-radius1)/(radius2-radius1);
331  const revt::StationFFTDataContainer InterFFTDataContainerRight = Interpolate(simFFTDataContainer3, simFFTDataContainer4, radius1, radius2, stationRadius, designLowerFreqFirstCh, designUpperFreqFirstCh);
332  const double starttimeRight = starttime3*(radius2-stationRadius)/(radius2-radius1)+starttime4*(stationRadius-radius1)/(radius2-radius1);
333 
334  // now interpolate the resulting spectra in azimuth
335  const revt::StationFFTDataContainer InterFFTDataContainer = Interpolate(InterFFTDataContainerLeft, InterFFTDataContainerRight, azimuth1, azimuth2, stationAzimuth, designLowerFreqFirstCh, designUpperFreqFirstCh);
336  const double InterStartTime = starttimeLeft*(azimuth2-stationAzimuth)/(azimuth2-azimuth1)+starttimeRight*(stationAzimuth-azimuth1)/(azimuth2-azimuth1);
337  const revt::StationTimeSeries InterTimeSeries = InterFFTDataContainer.GetConstTimeSeries();
338 
339  //fill SimRadioPulse into the associated station
340 
341  therev.MakeStation(statID); // Create a new Station, already checks if the station exists
342  revt::Station& Stat = therev.GetStation(statID);
343 
344  // create data structures
345  Stat.MakeGPSData(); // should check before if exists?
346  Stat.MakeTriggerData(); // should check before if exists?
347  Stat.MakeSimData(); // should check before if exists?
348 
349  revt::StationTimeSeries& StatTimeSeries = Stat.GetStationTimeSeries() ; // reference to the Station time series
350 
351  // check if there is data already and throw a warning
352  if(StatTimeSeries.GetSize() != 0)
353  {
354  WARNING( "RDStationInterpolator: StatTimeSeries not empty!" );
355  StatTimeSeries.ClearTrace();
356  }
357 
358  // fill the simtimeseries into the Station TimeSeries
359  StatTimeSeries.SetBinning(binning1);
360 
361  long numpaddedsamples = static_cast<long>(fTracePaddingAtFront/binning1+0.5);
362 
363  // interpolate and set start time
364  Stat.SetRawTraceStartTime(therev.GetHeader().GetTime() + TimeInterval(InterStartTime - numpaddedsamples*binning1));
365 
366  // fill with the interpolated trace
367  for (revt::StationTimeSeries::ConstIterator iter=InterTimeSeries.Begin(); iter!=InterTimeSeries.End(); ++iter)
368  {
369  StatTimeSeries.PushBack(*iter);
370  }
371 
372  }// for (rdet::RDetector::StationIterator...)
373 
374  return eSuccess;
375  } // Run
376 
377  fwk::VModule::ResultFlag RdStationInterpolatorStarShape::Finish()
378  {
379  OUT(eIntermediate)<<"RdStationInterpolatorStarShape::Finish()"<<endl;
380  return eSuccess;
381  } // Finish
382 
383 
384 
386 
387  revt::StationTimeSeries RdStationInterpolatorStarShape::PadTimeSeries(const SimRadioPulse& simtimeseries)
388  {
389  revt::StationTimeSeries PaddedTimeSeries;
390 
391  Vector3D V3DZero;
392  V3DZero = 0.0, 0.0, 0.0;
393 
394  double padbinning = simtimeseries.GetBinning();
395  PaddedTimeSeries.SetBinning(padbinning);
396 
397  long numpaddedsamples = static_cast<long>(fTracePaddingAtFront/padbinning+0.5);
398 
399  for (long i=0; i<numpaddedsamples; ++i)
400  PaddedTimeSeries.PushBack(V3DZero);
401 
402  for (revt::StationTimeSeries::ConstIterator iter=(simtimeseries.GetEfieldTimeSeries()).Begin(); iter!=(simtimeseries.GetEfieldTimeSeries()).End(); ++iter)
403  PaddedTimeSeries.PushBack(*iter);
404 
405  // now pad the station trace at the end up to the given minimum trace length
406  while (fMinimumTraceLength - PaddedTimeSeries.GetSize()*padbinning > 1.e-6)
407  PaddedTimeSeries.PushBack(V3DZero);
408 
409  // if number of samples is uneven after padding, pad one more sample (otherwise it will again be clipped at the next FFT)
410  if (PaddedTimeSeries.GetSize()/2*2 != PaddedTimeSeries.GetSize())
411  PaddedTimeSeries.PushBack(V3DZero);
412 
413  return PaddedTimeSeries;
414  }
415 
416 
418 
419  revt::StationFFTDataContainer RdStationInterpolatorStarShape::Interpolate( const revt::StationFFTDataContainer& simData1, const revt::StationFFTDataContainer& simData2, double x1, double x2, double x, double designlowerfreq, double designupperfreq)
420  {
421  const double specbinning1 = (simData1.GetConstFrequencySpectrum()).GetBinning();
422 
423  const StationFrequencySpectrum::SizeType size1 = (simData1.GetConstFrequencySpectrum()).GetSize();
424  const StationFrequencySpectrum& freq1 = (simData1.GetConstFrequencySpectrum());
425 
426  // unused const StationFrequencySpectrum::SizeType size2 = (simData2.GetConstFrequencySpectrum()).GetSize();
427  const StationFrequencySpectrum& freq2 = (simData2.GetConstFrequencySpectrum());
428 
429  TraceV3C V_interspectrum;
430  V_interspectrum.SetBinning(specbinning1);
431  Vector3C element;
432 
433  Vector3D phaseElement1;
434  Vector3D phaseElement2;
435  Vector3D phaseElementInter;
436 
437  Vector3D jumps1;
438  jumps1 = 0.0,0.0,0.0;
439  Vector3D jumps2;
440  jumps2 = 0.0,0.0,0.0;
441 
442  for(StationFrequencySpectrum::SizeType i=0 ; i < size1 ; i++)
443  {
444  for(unsigned int j = 0; j < 3; j++) // loop over x,y and z component
445  {
446  if( i >= designlowerfreq/specbinning1 && i <= designupperfreq/specbinning1 ) {
447  // linearly interpolate amplitudes
448  double interamplitude = (abs(freq1[i][j])*(x2-x)/(x2-x1) + abs(freq2[i][j])*(x-x1)/(x2-x1));
449 
450  // unwrap phases of initial signals
451  if(i > 1) {
452 
453  if( arg(freq1[i][j]) < arg(freq1[i-1][j]) && jumps1[j] >= 0 )
454  {
455  if( fabs(arg(freq1[i][j])-arg(freq1[i-1][j])) > fabs(arg(freq1[i][j]) + utl::kPi - arg(freq1[i-1][j])) )
456  {
457  ++jumps1[j];
458  }
459  }
460  else {
461  if( fabs(arg(freq1[i][j])-arg(freq1[i-1][j])) > fabs(arg(freq1[i][j]) - utl::kPi - arg(freq1[i-1][j])) )
462  {
463  --jumps1[j];
464  }
465  }
466 
467  if( arg(freq2[i][j]) < arg(freq2[i-1][j]) && jumps2[j] >= 0 )
468  {
469  if( fabs(arg(freq2[i][j])-arg(freq2[i-1][j])) > fabs(arg(freq2[i][j]) + utl::kPi - arg(freq2[i-1][j])) )
470  {
471  ++jumps2[j];
472  }
473  }
474  else {
475  if( fabs(arg(freq2[i][j])-arg(freq2[i-1][j])) > fabs(arg(freq2[i][j]) - utl::kPi - arg(freq2[i-1][j])) )
476  {
477  --jumps2[j];
478  }
479  }
480 
481  }
482 
483  phaseElement1[j] = arg(freq1[i][j]) + jumps1[j]*2*utl::kPi;
484  phaseElement2[j] = arg(freq2[i][j]) + jumps2[j]*2*utl::kPi;
485 
486  // interpolate phases
487  phaseElementInter[j] = (phaseElement1[j]*(x2-x)/(x2-x1) + phaseElement2[j]*(x-x1)/(x2-x1));
488 
489  // interpolated spectrum
490  element[j]=polar(interamplitude,phaseElementInter[j]);
491  }
492  else{
493  element[j] = 0.0;
494  }
495  }
496 
497  V_interspectrum.PushBack(element);
498  }
499 
500  revt::StationFFTDataContainer interpolatedFFTDataContainer;
501  interpolatedFFTDataContainer.GetFrequencySpectrum() = V_interspectrum;
502 
503  return interpolatedFFTDataContainer;
504  } //Interpolate
505 
506 
508 
509  void RdStationInterpolatorStarShape::BuildSimShower(evt::ShowerSimData& theshower,const utl::CoordinateSystemPtr& coord) {
510  // This function will build a Sim shower with correct data
511  // Inspired by the EventGenerator Module
512 
513  if (!theshower.HasPosition())
514  theshower.MakeGeometry(Point(0, 0, 0, coord));
515 
516  }
517 
518 } // nameSpace
Branch GetTopBranch() const
Definition: Branch.cc:63
boost::transform_iterator< InternalStationFunctor, InternalStationIterator, const Station & > StationIterator
StationIterator returns a pointer to a station.
Definition: RDetector.h:61
void Update(const utl::TimeStamp &time, const bool invData=true, const bool invComp=true, const bool forceRadio=false)
Update detector: deletes currently constructed stations and sets new time.
Definition: Detector.cc:179
#define OUT(x)
double GetBinning() const
Get the sampling time scale.
Definition: SimRadioPulse.h:34
Point object.
Definition: Point.h:32
Report success to RunController.
Definition: VModule.h:62
double GetDesignUpperFreq() const
Get design value of the freq-band.
int GetEventNumber() const
Get the event number of the RadioSimulation.
Interface class to access to the Radio part of an event.
Definition: REvent.h:42
StationIterator StationsEnd() const
End of the collection of pointers to commissioned stations.
Definition: RDetector.h:68
unsigned int GetNyquistZone() const
get the Nyquist zone
void MakeSimData()
Make station simulated data object.
double Interpolate(const double dx, const double dy, const double x)
Data structure for simulated Radio pulses.
Definition: SimRadioPulse.h:29
utl::TimeStamp GetTime() const
Definition: REvent/Header.h:17
StationIterator StationsBegin() const
Beginning of the collection of pointers to commissioned stations.
Definition: RDetector.h:64
double GetDesignLowerFreq() const
Get design value of the freq-band.
EventTrigger & GetTrigger()
Get the object with central trigger data, throw if n.a.
Definition: REvent.h:229
Data structure for a radio simulation (including several SimRadioPulses)
double GetBinning() const
size of one slot
Definition: Trace.h:138
const double meter
Definition: GalacticUnits.h:29
utl::Point GetLocation() const
Definition: SimRadioPulse.h:51
void Init()
Initialise the registry.
revt::REvent & GetREvent()
bool ok(bool okay)
Definition: testlib.cc:89
Detector description interface for Channel-related data.
revt::StationTimeSeries PadTimeSeries(const evt::SimRadioPulse &simtimeseries)
padding of zeros to the end of the simtimeseries
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Definition: Branch.cc:211
bool HasREvent() const
Station & GetStation(const int stationId)
retrieve station by id throw utl::NonExistentComponentException if n.a.
Definition: REvent.h:190
StationTimeSeries & GetStationTimeSeries()
retrieve Station Time Series (write access, only use this if you intend to change the data) ...
bool StringEquivalent(const std::string &a, const std::string &b, Predicate p)
Utility to compare strings for equivalence. It takes a predicate to determine the equivalence of indi...
Definition: StringCompare.h:38
std::vector< T >::const_iterator ConstIterator
Definition: Trace.h:60
A TimeStamp holds GPS second and nanosecond for some event.
Definition: TimeStamp.h:110
void SetTime(const utl::TimeStamp &time)
Version of the AERAEvent used by the DAQ software.
Definition: REvent/Header.h:27
bool HasPosition() const
Check initialization of shower geometry.
Detector description interface for RDetector-related data.
Definition: RDetector.h:46
void MakeGPSData()
Make GPS data object.
constexpr double deg
Definition: AugerUnits.h:140
void MakeTriggerData()
Make trigger data object.
Iterator Begin()
Definition: Trace.h:75
void SetExternalTrigger(const bool trig)
Set if Event was externally triggered.
Interface class to access Shower Simulated parameters.
Definition: ShowerSimData.h:49
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Class representing a document branch.
Definition: Branch.h:107
class to hold data at the radio Station level.
void SetRawTraceStartTime(const utl::TimeStamp &time)
Set absolute start time of the station-level trace as originally provided in raw data, for reconstructions use eTraceStartTime in StationRecData!
revt::StationFFTDataContainer Interpolate(const revt::StationFFTDataContainer &simData1, const revt::StationFFTDataContainer &simData2, double x1, double x2, double x, double designlowerfreq, double designupperfreq)
interpolation between two pulses
const utl::Vector & GetDirection() const
Get the direction of the shower axis. This is the true direction of shower movement.
C< F > & GetFrequencySpectrum()
read out the frequency spectrum (write access)
std::vector< T >::size_type SizeType
Definition: Trace.h:58
void MakeTrigger()
Create the central trigger object.
Definition: REvent.cc:174
constexpr double kPi
Definition: MathConstants.h:24
RadioSimulation & GetRadioSimulation()
Get the radio simulation data.
constexpr double nanosecond
Definition: AugerUnits.h:143
double abs(const SVector< n, T > &v)
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
get local coordinate system anchored at the core position
const utl::Point & GetPosition() const
Get the position of the shower core.
Header & GetHeader()
access to REvent Header
Definition: REvent.h:239
Top of the hierarchy of the detector description interface.
Definition: Detector.h:81
ShowerSimData & GetSimShower()
C< T > & GetTimeSeries()
read out the time series (write access)
SizeType GetSize() const
Definition: Trace.h:156
#define WARNING(message)
Macro for logging warning messages.
Definition: ErrorLogger.h:163
void GetData(bool &b) const
Overloads of the GetData member template function.
Definition: Branch.cc:644
constexpr double hertz
Definition: AugerUnits.h:153
boost::indirect_iterator< InternalChannelIterator, const Channel & > ChannelIterator
ChannelIterator returns a pointer to a Channel.
void SetBinning(const double binning)
Definition: Trace.h:139
const SimRadioPulse & GetNextSimRadioPulse(bool &ok)
const utl::TimeStamp & GetEventTime() const
Get the event time of the RadioSimulation.
Template class for a data container that offers and takes both time series and corresponding frequenc...
A TimeInterval is used to represent time elapsed between two events.
Definition: TimeInterval.h:43
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
bool GoToFirstSimRadioPulse()
Jump to the first SimRadioPulse, returns false if the vector is empty.
Template class for a FADC data or calibrated data container. Use the typedefs (TraceD, TraceI, etc.) defined in Trace-fwd.h.
Definition: Trace-fwd.h:19
void MakeGeometry(const utl::Point &pointOnShowerAxis)
initialize the shower geometry. Pos is a point on the shower axis, but not necessarily the core ...
void SetId(const int id)
Definition: REvent/Header.h:28
Report failure to RunController, causing RunController to terminate execution.
Definition: VModule.h:64
void MakeTimeStamp(const utl::TimeStamp &ts)
Make the TimeStamp of the shower.
int GetRunNumber() const
Get the run number of the RadioSimulation.
void SetRunNumber(const int run)
Definition: REvent/Header.h:32
const rdet::RDetector & GetRDetector() const
Definition: Detector.cc:143
double GetZ(const CoordinateSystemPtr &coordinateSystem) const
Definition: BasicVector.h:212
void PushBack(const T &value)
Insert a single value at the end.
Definition: Trace.h:119
Iterator End()
Definition: Trace.h:76
const Station & GetStation(const int stationId) const
Get station by Station Id.
Definition: RDetector.cc:141
const utl::TraceV3D & GetEfieldTimeSeries() const
Get the Trace of the simulated electric field.
Definition: SimRadioPulse.h:44
void MakeStation(const int stationId)
make a station with specifying Id, throw if invalid stationId
Definition: REvent.cc:94
void BuildSimShower(evt::ShowerSimData &theshower, const utl::CoordinateSystemPtr &coord)
BuildSimShower---------------------------------------------------------------------------------------...

, generated on Tue Sep 26 2023.