RdBeamFormer.cc
Go to the documentation of this file.
1 
9 #include "RdBeamFormer.h"
10 
11 #include <evt/Event.h>
12 #include <evt/ShowerRecData.h>
13 #include <evt/ShowerRRecData.h>
14 #include <evt/ShowerSimData.h>
15 #include <evt/BeamQuantities.h>
16 #include <revt/REvent.h>
17 #include <revt/Header.h>
18 #include <revt/Station.h>
19 #include <revt/Channel.h>
20 #include <revt/StationRecData.h>
21 
22 #include <det/Detector.h>
23 #include <rdet/RDetector.h>
24 
25 #include <utl/Trace.h>
26 #include <utl/TraceAlgorithm.h>
27 #include <utl/ErrorLogger.h>
28 #include <utl/Reader.h>
29 #include <utl/config.h>
30 #include <utl/AugerUnits.h>
31 #include <utl/PhysicalConstants.h>
32 #include <utl/Triple.h>
33 #include <utl/FFTDataContainerAlgorithm.h>
34 #include <utl/TimeStamp.h>
35 #include <utl/UTCDateTime.h>
36 #include <utl/UTMPoint.h>
37 #include <utl/CoordinateSystem.h>
38 #include <utl/CoordinateSystemPtr.h>
39 #include <utl/ReferenceEllipsoid.h>
40 #include <utl/RadioGeometryUtilities.h>
41 
42 /*
43 This headers should be uncommented if the footprint estimation fuctionality is used
44 
45 #include <atm/AerosolDB.h>
46 #include <atm/AerosolZone.h>
47 #include <atm/ProfileResult.h>
48 #include <atm/USStdADBProfileModel.h>
49 #include <atm/MonthlyAvgDBProfileModel.h>
50 #include "ReadMolecularHL.h"
51 */
52 
53 #include <fwk/CentralConfig.h>
54 #include <fwk/LocalCoordinateSystem.h>
55 #include <fwk/MagneticFieldModel.h>
56 
57 #include <sstream>
58 #include <vector>
59 #include <algorithm>
60 #include <cmath>
61 
62 using namespace std;
63 using namespace revt;
64 using namespace utl;
65 using namespace fwk;
66 using namespace det;
67 
68 /*
69 Should be uncommented if the footprint estimation fuctionality is used
70 
71 using namespace atm;
72 using namespace ReadMolecularHLNS;
73 */
74 
75 //Just an abbreviation of repeated code from UserModule.cc skeleton
76 #define PRINT(...) {stringstream msg; msg << __VA_ARGS__; INFO(msg.str());}
77 
78 #define SSTR( x ) dynamic_cast< std::ostringstream & >(( std::ostringstream() << std::dec << x ) ).str()
79 
80 namespace RdBeamFormer {
81 
82  RdBeamFormer::RdBeamFormer() : fNumCalls(0)
83  {
84  }
85 
86  RdBeamFormer::~RdBeamFormer()
87  {
88  }
89 
92  {
93  INFO("RdBeamFormer::Init()");
94 
95  //read in the configurations of the xml file
96  Branch conf = CentralConfig::GetInstance()->GetTopBranch("RdBeamFormer");
97 
98  conf.GetChild("startBin").GetData(startbin);
99  conf.GetChild("stopBin").GetData(stopbin);
100  conf.GetChild("offsetFactor").GetData(offsetfactor);
101 
102  conf.GetChild("waveModel").GetData(waveModelConf);
103 
104  if (waveModelConf == "ePlane")
106  else if (waveModelConf == "eSpherical")
108  else if (waveModelConf == "eConical")
110  else if (waveModelConf == "eHyperbolic")
112 
113  std::string confstring;
114  const Branch txtOut = conf.GetChild("asciiOutput");
115  if (txtOut) {
116  txtOut.GetChild("outputFileName").GetData(outfile);
117  txtOut.GetChild("outputGridType").GetData(confstring);
118  if (confstring == "ePolar")
119  gridtype = polar;
120  else if (confstring == "eCarthesian")
122  else
123  gridtype = none;
124  } else {
125  gridtype = none; outfile = "";
126  }
127 
128  return eSuccess;
129  }
130 
131  double RdBeamFormer::shiftTraces(std::vector<revt::StationFFTDataContainer>& stationData, int& nStat, double& binning,
132  int& start, int& stop, evt::Event& event) {
133  const evt::ShowerRRecData& rrec= event.GetRecShower().GetRRecShower();
134  const utl::CoordinateSystemPtr referenceCS = det::Detector::GetInstance().GetReferenceCoordinateSystem();
137  Point skyPos=rrec.GetCorePosition()+rrec.GetAxis();
138  waveModel->setSkyPos (skyPos);
139 
140  static FFTDataContainerAlgorithm fft;
141 
142  std::vector<int> start_bins;
143  std::vector<int> stop_bins;
144  std::vector<double> shifts;
145 
146  const rdet::RDetector& rDetector = det::Detector::GetInstance().GetRDetector();
147 
148  REvent& rEvent = event.GetREvent();
149 
151  binning = it->GetConstStationTimeSeries().GetBinning();
152  double offset = (stop - start) * binning * offsetfactor;
153 
154  //desired precision for binning comparison
155  double eps = 1e-14;
156 
157  //loop over the stations which were not rejected and calculate the shifts
158  for (it = rEvent.CandidateStationsBegin(); it != rEvent.CandidateStationsEnd(); ++it) {
159  Station& station = *it;
160  if (station.IsSaturated()) //skip saturated stations
161  continue;
162 
163  static double old_binning = it->GetConstStationTimeSeries().GetBinning();
164  double new_binning = it->GetConstStationTimeSeries().GetBinning();
165  if (abs(new_binning - old_binning) >= eps) {
166  ERROR ("Traces have different binning!");
167  return eFailure;
168  }
169 
170  //will be used to ensure that all traces have the same start and stop bins
171  start_bins.push_back(it->GetConstStationTimeSeries().GetStart());
172  stop_bins.push_back(it->GetConstStationTimeSeries().GetStop());
173 
174  const StationRecData& sRec = it->GetRecData();
175 
176  double traceStartTime = 0.;
177  if (sRec.HasParameter(eTraceStartTime))
178  traceStartTime = sRec.GetParameter(eTraceStartTime);
179  else {
180  ERROR ("Parameter eTraceStartTime is not set!");
181  return eFailure;
182  }
183 
184  double signalTime = 0.;
185  if (sRec.HasParameter(eSignalTime))
186  signalTime = sRec.GetParameter(eSignalTime);
187  else {
188  ERROR ("Parameter eSignalTime is not set!");
189  return eFailure;
190  }
191 
192  const Point pos = rDetector.GetStation(*it).GetPosition();
193  double shift = waveModel->delay(pos, rrec);
194  shift=shift-traceStartTime;
195  shifts.push_back(-shift + offset);
196  }
197 
198  //now we will find minimum and maximum shifts to be used later
199  std::vector<double>::iterator min_shift_iter;
200  std::vector<double>::iterator max_shift_iter;
201 
202  min_shift_iter = std::min_element(shifts.begin(), shifts.end());
203  max_shift_iter = std::max_element(shifts.begin(), shifts.end());
204 
205  int min_pos = min_shift_iter - shifts.begin();
206  int max_pos = max_shift_iter - shifts.begin();
207 
208  double min_shift = *min_shift_iter;
209  double max_shift = *max_shift_iter;
210  //cout<<"min_shift= "<<min_shift<<" max_shift= "<<max_shift<<"\n";
211 
212  //ensure that all traces have the same start and stop bins
213  int max_start = *std::max_element(start_bins.begin(), start_bins.end());
214  start = max_start;
215  int min_stop = *std::min_element(stop_bins.begin(), stop_bins.end());
216  stop = min_stop;
217  //cout<<"max_start= "<<max_start<<" min_stop= "<<min_stop<<"\n";
218 
219  /*
220  Uncomment this part if you want to write to a file traces before and after shifting
221 
222  std::string trace_before = "trace_before_shift";
223  static std::string trace_name_before = trace_before + "_";
224  std::string trace_after = "trace_after_shift";
225  static std::string trace_name_after = trace_after + "_";
226 
227  int eventId = event.GetREvent().GetHeader().GetId();
228  std::string stringId = SSTR(eventId);
229  //cout<<"eventId= "<<eventId<<"\n";
230  static int Id = -1;
231  //cout<<"oldId= "<<oldId<<"\n";
232  if (eventId != Id) {
233  //cout<<"eventId= "<<eventId<<"\n";
234  Id = eventId;
235  //cout<<"oldId= "<<oldId<<"\n";
236  std::string buffer = SSTR(Id) + "_";
237  trace_name_before.replace(trace_before.size()+1,buffer.size(),buffer);
238  trace_name_after.replace(trace_after.size()+1,buffer.size(),buffer);
239  }
240 
241  if (waveModelConf == "eSpherical") {
242  const utl::Triple polarCoords = rrec.GetAxis().GetSphericalCoordinates(coreCS);
243  double r = polarCoords.get<0>()/km;
244  static double R = -1;
245  //cout<<"oldR= "<<oldR<<" oldR-r= "<<oldR - r<<"\n";
246  if (abs(r - R) >= eps) {
247  //cout<<"r= "<<r<<"\n";
248  R = r;
249  //cout<<"oldR= "<<oldR<<"\n";
250  std::string buffer = SSTR(R);
251  trace_name_before.replace(trace_before.size()+stringId.size()+2,buffer.size()+10,buffer);
252  trace_name_after.replace(trace_after.size()+stringId.size()+2,buffer.size()+10,buffer);
253  }
254  }
255  else if (waveModelConf == "eConical") {
256  double Rho = rrec.GetParameter(eRho)/degree;
257  //cout<<"eRho= "<<Rho<<"\n";
258  static double old_Rho = -1;
259  //cout<<"oldRho= "<<oldRho<<"\n";
260  if (abs(Rho - old_Rho) >= eps) {
261  //cout<<"eRho= "<<Rho<<"\n";
262  old_Rho = Rho;
263  //cout<<"oldRho= "<<oldRho<<"\n";
264  std::string buffer = SSTR(old_Rho);
265  trace_name_before.replace(trace_before.size()+stringId.size()+2,buffer.size()+10,buffer);
266  trace_name_after.replace(trace_after.size()+stringId.size()+2,buffer.size()+10,buffer);
267  }
268  }
269  else if (waveModelConf == "eHyperbolic") {
270  double Rho = rrec.GetParameter(eRho)/degree;
271  double b = rrec.GetParameter(eB)/ns;
272  //double b = 3*ns;
273  //cout<<"eRho= "<<Rho<<"\n";
274  static double old_Rho = -1;
275  static double old_b = -1;
276  //cout<<"oldRho= "<<oldRho<<"\n";
277  if (abs(Rho - old_Rho) >= eps || abs(b - old_b) >= eps) {
278  //cout<<"eRho= "<<Rho<<"\n";
279  old_Rho = Rho;
280  old_b = b;
281  //cout<<"oldRho= "<<oldRho<<"\n";
282  std::string buffer1 = SSTR(old_Rho);
283  std::string buffer2 = SSTR(old_b);
284  std::string buffer = buffer1 + "_" + buffer2;
285  trace_name_before.replace(trace_before.size()+stringId.size()+2,buffer.size()+10,buffer);
286  trace_name_after.replace(trace_after.size()+stringId.size()+2,buffer.size()+10,buffer);
287  }
288  }
289 
290  std::string trace1 = trace_name_before + ".txt";
291  std::string trace2 = trace_name_after + ".txt";
292 
293  ofstream fout1;
294  fout1.open(trace1.c_str(), ios::out|ios::app);
295 
296  ofstream fout2;
297  fout2.open(trace2.c_str(), ios::out|ios::app);
298  */
299 
300  //loop over the stations which were not rejected and perform the shifts
301  int i = 0;
302  for (it = rEvent.CandidateStationsBegin(); it != rEvent.CandidateStationsEnd(); ++it) {
303  Station& station = *it;
304  if (station.IsSaturated()) //skip saturated stations
305  continue;
306 
307  stationData[i] = it->GetFFTDataContainer();
308 
309  const StationRecData& sRec = it->GetRecData();
310 
311  double traceStartTime = sRec.GetParameter(eTraceStartTime);
312 
313  /*
314  Uncomment this part if you want to write to a file traces before and after shifting
315 
316  const StationTimeSeries& ts1 = stationData[i].GetTimeSeries();
317  StationTimeSeries::ConstIterator iter1 = ts1.Begin() + start;
318  for (int j = 0; j < (stop-start); ++j) {
319  fout1<<(j+start)*binning<<" "<<iter1->GetMag()<<"\n";
320  iter1++;
321  }
322 
323  fout1<<"\n";
324  fout1<<"\n";
325  */
326 
327  //if all shifts have the same sign then we can shift only relatively to the smallest shift, which stays untouched
328  if (min_shift >= 0 && max_shift >=0) {
329  fft.ShiftTimeSeries(stationData[i], shifts[i] - min_shift);
330  //cout<<"shifts[i]= "<<shifts[i]<<" shifts[i]+offset= "<<shifts[i] + offset
331  //<<" shifts[i]-min_shift= "<<shifts[i] - min_shift<<"\n";
332  }
333  else if (min_shift < 0 && max_shift < 0) {
334  fft.ShiftTimeSeries(stationData[i], shifts[i]- max_shift);
335  //cout<<"shifts[i]= "<<shifts[i]<<" shifts[i]+offset= "<<shifts[i] + offset
336  //<<" shifts[i]-max_shift= "<<shifts[i] - max_shift<<"\n";
337  }
338  else if (min_shift <= 0 && max_shift >= 0) {
339  fft.ShiftTimeSeries(stationData[i], shifts[i]);
340  //cout<<"shifts[i]= "<<shifts[i]<<" shifts[i]+offset= "<<shifts[i] + offset<<"\n";
341  }
342 
343  //}
344  ++i;
345  }
346 
347  //if after shifting there is no minimum required overlap (in our case it is 100 bins) for all stations,
348  //then we need to drop the most distant station. This is done iteratively untill the condition is fulfilled.
349  if (min_shift >= 0 && max_shift >=0) {
350  //cout<<"start= "<<start<<" stop= "<<stop<<"\n";
351  start = (max_shift - min_shift)/binning + 1;
352  //cout<<"start= "<<start<<" stop= "<<stop<<"\n";
353  if (start < max_start)
354  start = max_start;
355  //cout<<"start= "<<start<<" stop= "<<stop<<"\n";
356  while (stop - start < 100) {
357  shifts.erase(shifts.begin() + max_pos);
358  stationData.erase(stationData.begin() + max_pos);
359 
360  min_shift_iter = std::min_element(shifts.begin(), shifts.end());
361  max_shift_iter = std::max_element(shifts.begin(), shifts.end());
362 
363  min_pos = min_shift_iter - shifts.begin();
364  max_pos = max_shift_iter - shifts.begin();
365 
366  min_shift = *min_shift_iter;
367  max_shift = *max_shift_iter;
368 
369  //cout<<"min_shift= "<<min_shift<<" max_shift= "<<max_shift<<"\n";
370 
371  start = (max_shift - min_shift)/binning + 1;
372  //cout<<"start= "<<start<<" stop= "<<stop<<"\n";
373 
374  if (start < max_start)
375  start = max_start;
376  //cout<<"start= "<<start<<" stop= "<<stop<<"\n";
377 
378  --nStat;
379  }
380  }
381  else if (min_shift < 0 && max_shift < 0) {
382  //cout<<"start= "<<start<<" stop= "<<stop<<"\n";
383  stop = min_stop - (max_shift - min_shift)/binning;
384  //cout<<"start= "<<start<<" stop= "<<stop<<"\n";
385  if (stop > min_stop)
386  stop = min_stop;
387  //cout<<"start= "<<start<<" stop= "<<stop<<"\n";
388  while (stop - start < 100) {
389  shifts.erase(shifts.begin() + min_pos);
390  stationData.erase(stationData.begin() + min_pos);
391 
392  min_shift_iter = std::min_element(shifts.begin(), shifts.end());
393  max_shift_iter = std::max_element(shifts.begin(), shifts.end());
394 
395  min_pos = min_shift_iter - shifts.begin();
396  max_pos = max_shift_iter - shifts.begin();
397 
398  min_shift = *min_shift_iter;
399  max_shift = *max_shift_iter;
400 
401  //cout<<"min_shift= "<<min_shift<<" max_shift= "<<max_shift<<"\n";
402 
403  stop = min_stop - (max_shift - min_shift)/binning;
404  //cout<<"start= "<<start<<" stop= "<<stop<<"\n";
405 
406  if (stop > min_stop)
407  stop = min_stop;
408  //cout<<"start= "<<start<<" stop= "<<stop<<"\n";
409 
410  --nStat;
411  }
412  }
413  else if (min_shift <= 0 && max_shift >= 0) {
414  //cout<<"start= "<<start<<" stop= "<<stop<<"\n";
415  start = max_shift/binning + 1;
416  stop = min_stop - abs(min_shift)/binning;
417  //cout<<"start= "<<start<<" stop= "<<stop<<"\n";
418  while (stop - start < 100) {
419  if (abs(max_shift) - abs(min_shift) > 0) {
420  shifts.erase(shifts.begin() + max_pos);
421  stationData.erase(stationData.begin() + max_pos);
422 
423  min_shift_iter = std::min_element(shifts.begin(), shifts.end());
424  max_shift_iter = std::max_element(shifts.begin(), shifts.end());
425 
426  min_pos = min_shift_iter - shifts.begin();
427  max_pos = max_shift_iter - shifts.begin();
428 
429  min_shift = *min_shift_iter;
430  max_shift = *max_shift_iter;
431 
432  //cout<<"min_shift= "<<min_shift<<" max_shift= "<<max_shift<<"\n";
433 
434  start = max_shift/binning + 1;
435  stop = min_stop - abs(min_shift)/binning;
436  //cout<<"start= "<<start<<" stop= "<<stop<<"\n";
437 
438  if (start < max_start)
439  start = max_start;
440  if (stop > min_stop)
441  stop = min_stop;
442  //cout<<"start= "<<start<<" stop= "<<stop<<"\n";
443 
444  --nStat;
445  }
446  else {
447  shifts.erase(shifts.begin() + min_pos);
448  stationData.erase(stationData.begin() + min_pos);
449 
450  min_shift_iter = std::min_element(shifts.begin(), shifts.end());
451  max_shift_iter = std::max_element(shifts.begin(), shifts.end());
452 
453  min_pos = min_shift_iter - shifts.begin();
454  max_pos = max_shift_iter - shifts.begin();
455 
456  min_shift = *min_shift_iter;
457  max_shift = *max_shift_iter;
458 
459  //cout<<"min_shift= "<<min_shift<<" max_shift= "<<max_shift<<"\n";
460 
461  start = max_shift/binning + 1;
462  stop = min_stop - abs(min_shift)/binning;
463  //cout<<"start= "<<start<<" stop= "<<stop<<"\n";
464 
465  if (start < max_start)
466  start = max_start;
467  if (stop > min_stop)
468  stop = min_stop;
469  //cout<<"start= "<<start<<" stop= "<<stop<<"\n";
470 
471  --nStat;
472  }
473  }
474  }
475 
476  /*
477  Uncomment this part if you want to write to a file traces before and after shifting
478 
479  for (int i = 0; i < nStat; ++i) {
480 
481  const StationTimeSeries& ts2 = stationData[i].GetTimeSeries();
482  StationTimeSeries::ConstIterator iter2 = ts2.Begin() + start;
483  for (int k = 0; k < (stop-start); ++k) {
484  fout2<<(k+start)*binning<<" "<<iter2->GetMag()<<"\n";
485  iter2++;
486  }
487 
488  fout2<<"\n";
489  fout2<<"\n";
490  }
491 
492  fout1.close();
493  fout2.close();
494  */
495 
496  return offset - start*binning;
497  }
498 
499  inline void RdBeamFormer::efieldproduct (const StationTimeSeries& in1, const StationTimeSeries& in2,
500  TraceD& out, int start, int stop) {
501  StationTimeSeries::ConstIterator it1 = in1.Begin() + start;
502  StationTimeSeries::ConstIterator it2 = in2.Begin() + start;
503  int n = it1->GetSize(); //should be 3
504  //cout<<n<<"\n";
505 
506  for (int i = 0; i < (stop-start); ++i) {
507  double prod = 0.0;
508  for (int j = 0; j < n; ++j) {
509  prod += it1->At(j) * it2->At(j);
510  }
511  out[i] = prod;
512  ++it1;
513  ++it2;
514  }
515  }
516 
517  TraceD RdBeamFormer::crosscorr (std::vector<revt::StationFFTDataContainer>& stationData, int nStat,
518  double binning, int start, int stop) {
519  TraceD sum(stop-start, binning);
520  TraceD addend(stop-start, binning);
521  TraceD res(stop-start, binning);
522 
523  double pair_of_Stat = nStat*(nStat-1)/2;
524 
525  for (int i=0; i < nStat; ++i) {
526  for (int j=i+1; j < nStat; ++j) {
527  efieldproduct (stationData[i].GetTimeSeries(),stationData[j].GetTimeSeries(), addend, start, stop);
528  sum += addend;
529  }
530  }
531 
532  /*
533  In case you want to have a square root from the trace
534  for (int i = 0; i < (stop-start); ++i) {
535  if (sum[i]>0)
536  res[i]=sqrt(sum[i]);
537  else
538  res[i]=-sqrt(abs(sum[i]));
539  }
540  return res*(1.0/pair_of_Stat);
541  */
542 
543  return sum*(1.0/pair_of_Stat);
544  }
545 
546  inline void RdBeamFormer::efieldtopower (const StationTimeSeries& in, TraceD& out, int start, int stop) {
547  StationTimeSeries::ConstIterator it = in.Begin() + start;
548  for (int i = 0; i < (stop-start); ++i) {
549  out[i] = it->GetMag2();
550  ++it;
551  }
552  }
553 
554  TraceD RdBeamFormer::powertrace (std::vector<revt::StationFFTDataContainer>& stationData,
555  int nStat, double binning, int start, int stop) {
556  TraceD sum(stop-start, binning);
557  TraceD addend(stop-start, binning);
558  TraceD res(stop-start, binning);
559 
560  for (int i = 0; i<nStat; ++i) {
561  const StationTimeSeries& ts = stationData[i].GetTimeSeries();
562  efieldtopower (ts, addend, start, stop);
563  sum += addend;
564  }
565 
566  /*
567  In case you want to have a square root from the trace
568 
569  for (int i = 0; i < (stop-start); ++i)
570  res[i]=sqrt((sum[i]));
571  return res*(1.0/nStat);
572  */
573 
574  return sum*(1.0/nStat);
575  }
576 
577  TraceD RdBeamFormer::xtrace (TraceD ccTrace, TraceD ccNormal, TraceD pwNormal) {
578  TraceD result(ccTrace);
579  TraceD::ConstIterator itCC = ccNormal.Begin();
580  TraceD::ConstIterator itPW = pwNormal.Begin();
581  for (TraceD::Iterator it = result.Begin(); it != result.End(); ++it) {
582  (*it) *= abs ( (*itCC) / (*itPW) );
583  ++itCC;
584  ++itPW;
585  }
586  return result;
587  }
588 
589  evt::BeamPeak RdBeamFormer::findPeak (const TraceD& trace, const double timeOffset) {
590  TraceD::ConstIterator max = max_element(trace.Begin(), trace.End());
591  const double maxval = *max;
592  const int maxi = (max - trace.Begin());
593  const double maxtime = maxi * trace.GetBinning();
594 
595  //cout<<"maxval= "<<maxval<<" maxi= "<<maxi<<" maxtime= "<<maxtime<<"\n";
596 
597  int start;
598  int stop;
599 
600  //devide the trace in two parts and check which of them contains the maximum value
601  if (maxi > (trace.GetStart() + trace.GetStop())/2) {
602  start = trace.GetStart() + 1;
603  stop = (trace.GetStart() + trace.GetStop())/2 - (trace.GetStop() - trace.GetStart())*0.05;
604  //cout<<start<<" "<<stop<<"\n";
605  }
606  else {
607  start = (trace.GetStart() + trace.GetStop())/2 + (trace.GetStop() - trace.GetStart())*0.05;
608  stop = trace.GetStop() - 1;
609  //cout<<start<<" "<<stop<<"\n";
610  }
611 
612  //calculate RMS and mean value for the part of the trace which doesn`t contain the maximum value
613  static TraceAlgorithm algo;
614  const double rms = algo.RootMeanSquare ( trace, start, stop);
615  const double mean = algo.Mean ( trace, start, stop);
616  const double snr = maxval/rms;
617 
618  //cout<<"mean= "<<mean*V/m<<" rms= "<<rms*V/m<<" SNR= "<<snr*V/m<<"\n";
619 
620  return evt::BeamPeak ( maxval, maxtime, rms, snr);
621  }
622 
624  RdBeamFormer::Run(evt::Event& event)
625  {
626  DEBUGLOG("RdBeamFormer::Run()");
627 
628  //check if there is a radio event at all
629  if (!event.HasREvent()) {
630  WARNING("No radio event found!");
631  return eContinueLoop;
632  }
633 
634  REvent& rEvent = event.GetREvent();
635  //PRINT ("Radio event found with " << rEvent.GetNumberOfStations() << " stations!");
636 
637  const Header& rHeader = rEvent.GetHeader();
638  PRINT ("Header ID: " << rHeader.GetId() << " and timestamp: " << rHeader.GetTime());
639 
640  if (!event.HasRecShower() || !event.GetRecShower().HasRRecShower()) {
641  WARNING("No RecShower or RRecShower found!");
642  return eContinueLoop;
643  }
644 
645  //calculate number of not rejected stations to be used for beam-forming
646  int n = 0;
647  for (REvent::CandidateStationIterator it = rEvent.CandidateStationsBegin(); it != rEvent.CandidateStationsEnd(); ++it) {
648  Station& station = *it;
649  if (station.IsSaturated()) //skip saturated stations
650  continue;
651  ++n;
652  }
653 
654  //cout<<"Number of candidate stations is: "<<n<<"\n";
655 
656  //check if there is enough stations to perform beam-forming (minimum number of stations can be discussed and changed of course...)
657  if (n < 2) {
658  WARNING ("Not enough stations found to perform beam-forming!");
659  return eContinueLoop;
660  }
661 
662  /*
663  This part contains an attempt to estimate the shower footprint based on our analitical models for the radio emission
664  from the extensive air-showers. This means estimating the signal power for every antenna station position and rejecting
665  that stations which are below the estimated noise power for this position. All calculations are based on these documents:
666  http://dx.doi.org/10.1016/j.astropartphys.2014.05.001
667  http://dx.doi.org/10.1088/1475-7516/2015/05/018
668  GAP-2014-073
669 
670  evt::ShowerRRecData& rrec= event.GetRecShower().GetRRecShower();
671  const utl::Point corePos = rrec.GetCorePosition();
672  //get the core position in UTM coordinates
673  utl::UTMPoint corePosUTM (corePos, utl::ReferenceEllipsoid::eWGS84);
674  coreCS = fwk::LocalCoordinateSystem::Create(corePos);
675  //get x and y components of the core position in the core coordinate system and z component in UTM coordinate system
676  double corePosX = corePos.GetX(coreCS)/m;
677  double corePosY = corePos.GetY(coreCS)/m;
678  double corePosZ = corePosUTM.GetHeight()/m;
679 
680  //cout<<"corePosX= "<<corePosX<<" corePosY= "<<corePosY<<" corePosZ= "<<corePosZ<<endl;
681 
682  const utl::Triple polarCoords = rrec.GetAxis().GetSphericalCoordinates(coreCS);
683  double theta = polarCoords.get<1>();
684  double cosTheta = cos(theta);
685 
686  //cout<<"theta= "<<polarCoords.get<1>()/degree<<" cosTheta= "<<cosTheta<<endl;
687 
688  evt::ShowerSimData& MCShower = event.GetSimShower();
689  double mcEnergy = MCShower.GetEnergy()/eV;
690  double xMax = MCShower.GetGHParameters().GetXMax()/(g/cm2);
691  double distanceToXMax = MCShower.GetDistanceOfShowerMaximum();
692  const Atmosphere& theAtm = det::Detector::GetInstance().GetAtmosphere();
693  ProfileResult depthVsHeight = theAtm.EvaluateDepthVsHeight();
694  //calculate the vertical column density of the whole atmosphere by converting it from the height
695  double xMaxAtm = depthVsHeight.Y(corePosZ)/(g/cm2);
696  //calculate the distance to the shower maximum from the observer in g/cm2 not taking into account the curvature of the Earth
697  double distanceXMax = xMaxAtm/cosTheta - xMax;
698 
699  //cout<<"mcEnergy= "<<mcEnergy<<" xMax= "<<xMax<<" distanceToXMax= "<<distanceToXMax/km<<" xMaxAtm= "<<xMaxAtm<<" distanceXMax= "<<distanceXMax<<endl;
700 
701  //calculate the magnetic field vector at the site of the shower
702  Vector showerAxis (rrec.GetAxis());
703  Vector magneticField = fwk::MagneticFieldModel::GetMagneticFieldVector(corePos, rHeader.GetTime());
704  utl::RadioGeometryUtilities transformation = utl::RadioGeometryUtilities(showerAxis, coreCS, magneticField);
705 
706  //loop over the not rejected stations, calculate the expected signal power and reject that stations which are below the expected noise power
707  for (REvent::CandidateStationIterator it = rEvent.CandidateStationsBegin(); it != rEvent.CandidateStationsEnd(); ++it) {
708  Station& station = *it;
709  if (station.IsSaturated()) // skip saturated stations
710  continue;
711  StationRecData& sRec = station.GetRecData();
712  const rdet::RDetector& rDetector = det::Detector::GetInstance().GetRDetector();
713  const Point stationPos = rDetector.GetStation(*it).GetPosition();
714  double stationPosX = stationPos.GetX(coreCS)/m;
715  double stationPosY = stationPos.GetY(coreCS)/m;
716  double stationPosZ = stationPos.GetZ(coreCS)/m;
717 
718  //transform staion positions to the shower plane
719  double stationPosX_VxB = 0.;
720  double stationPosY_VxB = 0.;
721  double stationPosZ_VxB = 0.;
722  transformation.GetVectorInShowerPlaneVxB(stationPosX_VxB, stationPosY_VxB, stationPosZ_VxB, stationPos);
723  stationPosX_VxB = stationPosX_VxB/m;
724  stationPosY_VxB = stationPosY_VxB/m;
725  stationPosZ_VxB = stationPosZ_VxB/m;
726 
727  //cout<<"Station "<<it->GetId()<<" stationPosX= "<<stationPosX<<" stationPosY= "<<stationPosY<<" stationPosZ= "<<stationPosZ<<endl;
728  //cout<<"Station "<<it->GetId()<<" stationPosX_VxB= "<<stationPosX_VxB<<" stationPosY_VxB= "<<stationPosY_VxB<<" stationPosZ_VxB= "<<stationPosZ_VxB<<endl;
729 
730  double c0 = 0.;
731  double c1 = 0.;
732  double c2 = 0.;
733  if (theta/degree <= 55) {
734  c0 = 0.41;
735  }
736  else if (theta/degree > 55 && theta/degree <= 60) {
737  c0 = 0.71;
738  }
739  else if (theta/degree > 60) {
740  c0 = 0.71;
741  }
742 
743  if (theta/degree <= 10) {
744  c1 = 8.0;
745  c2 = -21.2;
746  }
747  else if (theta/degree > 10 && theta/degree <= 20) {
748  c1 = 10.0;
749  c2 = -23.1;
750  }
751  else if (theta/degree > 20 && theta/degree <= 30) {
752  c1 = 12.0;
753  c2 = -25.5;
754  }
755  else if (theta/degree > 30 && theta/degree <= 40) {
756  c1 = 20.0;
757  c2 = -32.0;
758  }
759  else if (theta/degree > 40 && theta/degree <= 50) {
760  c1 = 25.1;
761  c2 = -34.5;
762  }
763  else if (theta/degree > 50 && theta/degree <= 60) {
764  c1 = 27.3;
765  c2 = -9.8;
766  }
767  else if (theta/degree > 60) {
768  c1 = 27.3;
769  c2 = -9.8;
770  }
771 
772  long double function1 = pow(10,-52.8)*pow(mcEnergy,2);
773  long double function2 = 37.7 - 0.006*distanceXMax + 5.5*pow(10,-4)*pow(distanceXMax,2) - 3.7*pow(10,-7)*pow(distanceXMax,3);
774  long double function3 = 26.9 - 0.041*distanceXMax + 2*pow(10,-4)*pow(distanceXMax,2);
775 
776  long double totalPower = function1*(exp(-(pow((stationPosX_VxB - corePosX - c1),2) + pow((stationPosY_VxB - corePosY),2))/pow(function2,2)) -
777  c0*exp(-(pow((stationPosX_VxB - corePosX - c2),2) + pow((stationPosY_VxB - corePosY),2))/pow(function3,2)))*(joule/m2);
778  double noisePower = sRec.GetParameter(revt::eNoiseEnergyDensityMag)/(eV/m2);
779 
780  //cout<<"function1= "<<function1<<" function2= "<<function2<<" "<<pow((stationPosX_VxB - corePosX - c1),2) + pow((stationPosY_VxB - corePosY),2)<<" function3= "<<function3<<" "<<pow((stationPosX_VxB - corePosX - c2),2) + pow((stationPosY_VxB - corePosY),2)<<" totalPower= "<<totalPower/(eV/m2)<<" noisePower= "<<noisePower<<endl;
781 
782  if (totalPower < noisePower) {
783  station.SetRejected(revt::eManuallyRejected);
784  --n;
785  }
786  }
787 
788  //cout<<"Number of station is: "<<n<<endl;
789 
790  //check if there is still enough stations to perform beam-forming
791  if (n < 2) {
792  WARNING ("Not enough stations found to perform beam-forming!");
793  return eContinueLoop;
794  }
795  */
796 
797  std::vector<StationFFTDataContainer> stationData(n);
798  double binning;
799  int start, stop;
800  double timeOffset = shiftTraces(stationData, n, binning, start, stop, event);
801 
802  //cout<<"Number of station is: "<<n<<endl;
803 
804  //check if there is still enough stations to perform beam-forming
805  if (n < 2) {
806  WARNING ("Not enough stations found to perform beam-forming!");
807  return eContinueLoop;
808  }
809 
810  TraceD cc = crosscorr (stationData, n, binning, start, stop);
811  TraceD power = powertrace (stationData, n, binning, start, stop);
812 
813  evt::BeamPeak ccPeak = findPeak (cc, timeOffset);
814  evt::BeamPeak pwPeak = findPeak (power, timeOffset);
815 
816  TraceD x = xtrace(cc, cc-ccPeak.GetOffset(), power-pwPeak.GetOffset());
817  evt::BeamPeak xPeak = findPeak (x, timeOffset);
818 
819  WriteASCII (cc, power, x, ccPeak, pwPeak, xPeak, event);
820 
821  /*
822  Uncomment this part if you want to write to the files maximum beam-forming values of the scanned region
823  and other respective information of the set of events you want to analyze. There are two options:
824  finding the maximum based on the absolut values of the beam-forming traces or alternatively on their SNRs
825 
826  //get the core position
827  evt::ShowerRRecData& rrec= event.GetRecShower().GetRRecShower();
828  const utl::Point corePos = rrec.GetCorePosition();
829 
830  //calculate the magnetic field vector at the site of the shower
831  Vector showerAxis (rrec.GetAxis());
832  Vector magneticField = fwk::MagneticFieldModel::GetMagneticFieldVector(corePos, rHeader.GetTime());
833 
834  static double MCEnergy = MCShower.GetEnergy();
835  static double distanceShowerMax = MCShower.GetDistanceOfShowerMaximum();
836  static double XMax = MCShower.GetGHParameters().GetXMax();
837  static double cosGeomagneticAngle = (showerAxis*magneticField)/(sqrt(showerAxis*showerAxis)*sqrt(magneticField*magneticField));
838  static double sinGeomagneticAngle = sqrt(1 - cosGeomagneticAngle*cosGeomagneticAngle);
839  //cout<<"MCEnergy= "<<MCEnergy<<" sinGeomagneticAngle= "<<sinGeomagneticAngle
840  //<<" MCEnergy/sinGeomagneticAngle= "<<MCEnergy*sinGeomagneticAngle
841  //<<" distanceShowerMax= "<<distanceShowerMax/km<<"\n";
842 
843  static std::string cc_max_values = "cc_max_values.txt";
844  static std::string pw_max_values = "pw_max_values.txt";
845  static std::string x_max_values = "x_max_values.txt";
846 
847  static std::string cc_max_snr_values = "cc_max_snr_values.txt";
848  static std::string pw_max_snr_values = "pw_max_snr_values.txt";
849  static std::string x_max_snr_values = "x_max_snr_values.txt";
850 
851  ofstream fout3;
852  fout3.open(cc_max_values.c_str(), ios::out|ios::app);
853 
854  ofstream fout4;
855  fout4.open(pw_max_values.c_str(), ios::out|ios::app);
856 
857  ofstream fout5;
858  fout5.open(x_max_values.c_str(), ios::out|ios::app);
859 
860  ofstream fout6;
861  fout6.open(cc_max_snr_values.c_str(), ios::out|ios::app);
862 
863  ofstream fout7;
864  fout7.open(pw_max_snr_values.c_str(), ios::out|ios::app);
865 
866  ofstream fout8;
867  fout8.open(x_max_snr_values.c_str(), ios::out|ios::app);
868 
869 
870  static std::vector<double> max_cc;
871  static std::vector<double> max_pw;
872  static std::vector<double> max_x;
873  static std::vector<double> max_th;
874  static std::vector<double> max_phi;
875  static std::vector<double> max_r;
876  static std::vector<double> max_rho;
877  static std::vector<double> max_b;
878  static std::vector<double> max_cc_snr;
879  static std::vector<double> max_pw_snr;
880  static std::vector<double> max_x_snr;
881 
882  if (waveModelConf == "eSpherical") {
883  int eventId = event.GetREvent().GetHeader().GetId();
884  static int previousId = eventId;
885  if (eventId == previousId) {
886  max_cc.push_back(ccPeak.GetHeight());
887  max_pw.push_back(pwPeak.GetHeight());
888  max_x.push_back(xPeak.GetHeight());
889  max_cc_snr.push_back(ccPeak.GetOffset());
890  max_pw_snr.push_back(pwPeak.GetOffset());
891  max_x_snr.push_back(xPeak.GetOffset());
892  max_th.push_back(polarCoords.get<1>()/degree);
893  max_phi.push_back(polarCoords.get<2>()/degree);
894  max_r.push_back(polarCoords.get<0>()/km);
895  }
896  else {
897  //information about current event is written to the files when the analysis switches to the next event.
898  //To get the last event you are interested in recordered to the file you need to include one more event after it to your set of events.
899  vector <double>::iterator cc_max_iter;
900  cc_max_iter = std::max_element(max_cc.begin(), max_cc.end());
901  int pos = cc_max_iter - max_cc.begin();
902 
903  vector <double>::iterator cc_max_snr_iter;
904  cc_max_snr_iter = std::max_element(max_cc_snr.begin(), max_cc_snr.end());
905  int pos_snr = cc_max_snr_iter - max_cc_snr.begin();
906 
907  fout3<<previousId<<" "<<max_cc[pos]<<" "<<max_cc_snr[pos]<<" "<<max_th[pos]<<" "<<max_phi[pos]<<" "<<MCEnergy<<" "
908  <<MCEnergy*sinGeomagneticAngle<<" "<<distanceShowerMax/km<<" "<<XMax/(g/cm2)<<" "<<max_r[pos]<<"\n";
909  fout4<<previousId<<" "<<max_pw[pos]<<" "<<max_pw_snr[pos]<<" "<<max_th[pos]<<" "<<max_phi[pos]<<" "<<MCEnergy<<" "
910  <<MCEnergy*sinGeomagneticAngle<<" "<<distanceShowerMax/km<<" "<<XMax/(g/cm2)<<" "<<max_r[pos]<<"\n";
911  fout5<<previousId<<" "<<max_x[pos]<<" "<<max_x_snr[pos]<<" "<<max_th[pos]<<" "<<max_phi[pos]<<" "<<MCEnergy<<" "
912  <<MCEnergy*sinGeomagneticAngle<<" "<<distanceShowerMax/km<<" "<<XMax/(g/cm2)<<" "<<max_r[pos]<<"\n";
913 
914  fout6<<previousId<<" "<<max_cc[pos_snr]<<" "<<max_cc_snr[pos_snr]<<" "<<max_th[pos_snr]<<" "
915  <<max_phi[pos_snr]<<" "<<MCEnergy<<" "<<MCEnergy*sinGeomagneticAngle<<" "<<distanceShowerMax/km<<" "
916  <<XMax/(g/cm2)<<" "<<max_r[pos_snr]<<"\n";
917  fout7<<previousId<<" "<<max_pw[pos_snr]<<" "<<max_pw_snr[pos_snr]<<" "<<max_th[pos_snr]<<" "
918  <<max_phi[pos_snr]<<" "<<MCEnergy<<" "<<MCEnergy*sinGeomagneticAngle<<" "<<distanceShowerMax/km<<" "
919  <<XMax/(g/cm2)<<" "<<max_r[pos_snr]<<"\n";
920  fout8<<previousId<<" "<<max_x[pos_snr]<<" "<<max_x_snr[pos_snr]<<" "<<max_th[pos_snr]<<" "
921  <<max_phi[pos_snr]<<" "<<MCEnergy<<" "<<MCEnergy*sinGeomagneticAngle<<" "<<distanceShowerMax/km<<" "
922  <<XMax/(g/cm2)<<" "<<max_r[pos_snr]<<"\n";
923 
924  previousId = eventId;
925  MCEnergy = MCShower.GetEnergy();
926  distanceShowerMax = MCShower.GetDistanceOfShowerMaximum();
927  XMax = MCShower.GetGHParameters().GetXMax();
928  cosGeomagneticAngle = (showerAxis*magneticField)/(sqrt(showerAxis*showerAxis)*sqrt(magneticField*magneticField));
929  sinGeomagneticAngle = sqrt(1 - cosGeomagneticAngle*cosGeomagneticAngle);
930 
931  max_cc.clear();
932  max_pw.clear();
933  max_x.clear();
934  max_cc_snr.clear();
935  max_pw_snr.clear();
936  max_x_snr.clear();
937  max_th.clear();
938  max_phi.clear();
939  max_r.clear();
940 
941  max_cc.push_back(ccPeak.GetHeight());
942  max_pw.push_back(pwPeak.GetHeight());
943  max_x.push_back(xPeak.GetHeight());
944  max_cc_snr.push_back(ccPeak.GetOffset());
945  max_pw_snr.push_back(pwPeak.GetOffset());
946  max_x_snr.push_back(xPeak.GetOffset());
947  max_th.push_back(polarCoords.get<1>()/degree);
948  max_phi.push_back(polarCoords.get<2>()/degree);
949  max_r.push_back(polarCoords.get<0>()/km);
950  }
951  }
952  else if (waveModelConf == "eConical") {
953  int eventId = event.GetREvent().GetHeader().GetId();
954  static int previousId = eventId;
955  if (eventId == previousId) {
956  max_cc.push_back(ccPeak.GetHeight());
957  max_pw.push_back(pwPeak.GetHeight());
958  max_x.push_back(xPeak.GetHeight());
959  max_cc_snr.push_back(ccPeak.GetOffset());
960  max_pw_snr.push_back(pwPeak.GetOffset());
961  max_x_snr.push_back(xPeak.GetOffset());
962  max_th.push_back(polarCoords.get<1>()/degree);
963  max_phi.push_back(polarCoords.get<2>()/degree);
964  max_rho.push_back(rrec.GetParameter(eRho)/degree);
965  }
966  else {
967  //information about current event is written to the files when the analysis switches to the next event.
968  //To get the last event you are interested in recordered to the file you need to include one more event after it to your set of events.
969  vector <double>::iterator cc_max_iter;
970  cc_max_iter = std::max_element(max_cc.begin(), max_cc.end());
971  int pos = cc_max_iter - max_cc.begin();
972 
973  vector <double>::iterator cc_max_snr_iter;
974  cc_max_snr_iter = std::max_element(max_cc_snr.begin(), max_cc_snr.end());
975  int pos_snr = cc_max_snr_iter - max_cc_snr.begin();
976 
977  fout3<<previousId<<" "<<max_cc[pos]<<" "<<max_cc_snr[pos]<<" "<<max_th[pos]<<" "<<max_phi[pos]<<" "<<MCEnergy<<" "
978  <<MCEnergy*sinGeomagneticAngle<<" "<<distanceShowerMax/km<<" "<<XMax/(g/cm2)<<" "<<max_rho[pos]<<"\n";
979  fout4<<previousId<<" "<<max_pw[pos]<<" "<<max_pw_snr[pos]<<" "<<max_th[pos]<<" "<<max_phi[pos]<<" "<<MCEnergy<<" "
980  <<MCEnergy*sinGeomagneticAngle<<" "<<distanceShowerMax/km<<" "<<XMax/(g/cm2)<<" "<<max_rho[pos]<<"\n";
981  fout5<<previousId<<" "<<max_x[pos]<<" "<<max_x_snr[pos]<<" "<<max_th[pos]<<" "<<max_phi[pos]<<" "<<MCEnergy<<" "
982  <<MCEnergy*sinGeomagneticAngle<<" "<<distanceShowerMax/km<<" "<<XMax/(g/cm2)<<" "<<max_rho[pos]<<"\n";
983 
984  fout6<<previousId<<" "<<max_cc[pos_snr]<<" "<<max_cc_snr[pos_snr]<<" "<<max_th[pos_snr]<<" "
985  <<max_phi[pos_snr]<<" "<<MCEnergy<<" "<<MCEnergy*sinGeomagneticAngle<<" "<<distanceShowerMax/km<<" "
986  <<XMax/(g/cm2)<<" "<<max_rho[pos_snr]<<"\n";
987  fout7<<previousId<<" "<<max_pw[pos_snr]<<" "<<max_pw_snr[pos_snr]<<" "<<max_th[pos_snr]<<" "
988  <<max_phi[pos_snr]<<" "<<MCEnergy<<" "<<MCEnergy*sinGeomagneticAngle<<" "<<distanceShowerMax/km<<" "
989  <<XMax/(g/cm2)<<" "<<max_rho[pos_snr]<<"\n";
990  fout8<<previousId<<" "<<max_x[pos_snr]<<" "<<max_x_snr[pos_snr]<<" "<<max_th[pos_snr]<<" "
991  <<max_phi[pos_snr]<<" "<<MCEnergy<<" "<<MCEnergy*sinGeomagneticAngle<<" "<<distanceShowerMax/km<<" "
992  <<XMax/(g/cm2)<<" "<<max_rho[pos_snr]<<"\n";
993 
994  previousId = eventId;
995  MCEnergy = MCShower.GetEnergy();
996  distanceShowerMax = MCShower.GetDistanceOfShowerMaximum();
997  XMax = MCShower.GetGHParameters().GetXMax();
998  cosGeomagneticAngle = (showerAxis*magneticField)/(sqrt(showerAxis*showerAxis)*sqrt(magneticField*magneticField));
999  sinGeomagneticAngle = sqrt(1 - cosGeomagneticAngle*cosGeomagneticAngle);
1000 
1001  max_cc.clear();
1002  max_pw.clear();
1003  max_x.clear();
1004  max_cc_snr.clear();
1005  max_pw_snr.clear();
1006  max_x_snr.clear();
1007  max_th.clear();
1008  max_phi.clear();
1009  max_rho.clear();
1010 
1011  max_cc.push_back(ccPeak.GetHeight());
1012  max_pw.push_back(pwPeak.GetHeight());
1013  max_x.push_back(xPeak.GetHeight());
1014  max_cc_snr.push_back(ccPeak.GetOffset());
1015  max_pw_snr.push_back(pwPeak.GetOffset());
1016  max_x_snr.push_back(xPeak.GetOffset());
1017  max_th.push_back(polarCoords.get<1>()/degree);
1018  max_phi.push_back(polarCoords.get<2>()/degree);
1019  max_rho.push_back(rrec.GetParameter(eRho)/degree);
1020  }
1021  }
1022  else if (waveModelConf == "eHyperbolic") {
1023  int eventId = event.GetREvent().GetHeader().GetId();
1024  static int previousId = eventId;
1025  if (eventId == previousId) {
1026  max_cc.push_back(ccPeak.GetHeight());
1027  max_pw.push_back(pwPeak.GetHeight());
1028  max_x.push_back(xPeak.GetHeight());
1029  max_cc_snr.push_back(ccPeak.GetOffset());
1030  max_pw_snr.push_back(pwPeak.GetOffset());
1031  max_x_snr.push_back(xPeak.GetOffset());
1032  max_th.push_back(polarCoords.get<1>()/degree);
1033  max_phi.push_back(polarCoords.get<2>()/degree);
1034  max_rho.push_back(rrec.GetParameter(eRho)/degree);
1035  max_b.push_back(rrec.GetParameter(eB)/ns);
1036  }
1037  else {
1038  //information about current event is written to the files when the analysis switches to the next event.
1039  //To get the last event you are interested in recordered to the file you need to include one more event after it to your set of events.
1040  vector <double>::iterator cc_max_iter;
1041  cc_max_iter = std::max_element(max_cc.begin(), max_cc.end());
1042  int pos = cc_max_iter - max_cc.begin();
1043 
1044  vector <double>::iterator cc_max_snr_iter;
1045  cc_max_snr_iter = std::max_element(max_cc_snr.begin(), max_cc_snr.end());
1046  int pos_snr = cc_max_snr_iter - max_cc_snr.begin();
1047 
1048  fout3<<previousId<<" "<<max_cc[pos]<<" "<<max_cc_snr[pos]<<" "<<max_th[pos]<<" "<<max_phi[pos]<<" "
1049  <<MCEnergy<<" "<<MCEnergy*sinGeomagneticAngle<<" "<<distanceShowerMax/km<<" "<<XMax/(g/cm2)<<" "
1050  <<max_rho[pos]<<" "<<max_b[pos]<<"\n";
1051  fout4<<previousId<<" "<<max_pw[pos]<<" "<<max_pw_snr[pos]<<" "<<max_th[pos]<<" "<<max_phi[pos]<<" "
1052  <<MCEnergy<<" "<<MCEnergy*sinGeomagneticAngle<<" "<<distanceShowerMax/km<<" "<<XMax/(g/cm2)<<" "
1053  <<max_rho[pos]<<" "<<max_b[pos]<<"\n";
1054  fout5<<previousId<<" "<<max_x[pos]<<" "<<max_x_snr[pos]<<" "<<max_th[pos]<<" "<<max_phi[pos]<<" "
1055  <<MCEnergy<<" "<<MCEnergy*sinGeomagneticAngle<<" "<<distanceShowerMax/km<<" "<<XMax/(g/cm2)<<" "
1056  <<max_rho[pos]<<" "<<max_b[pos]<<"\n";
1057 
1058  fout6<<previousId<<" "<<max_cc[pos_snr]<<" "<<max_cc_snr[pos_snr]<<" "<<max_th[pos_snr]<<" "
1059  <<max_phi[pos_snr]<<" "<<MCEnergy<<" "<<MCEnergy*sinGeomagneticAngle<<" "<<distanceShowerMax/km<<" "
1060  <<XMax/(g/cm2)<<" "<<max_rho[pos_snr]<<" "<<max_b[pos_snr]<<"\n";
1061  fout7<<previousId<<" "<<max_pw[pos_snr]<<" "<<max_pw_snr[pos_snr]<<" "<<max_th[pos_snr]<<" "
1062  <<max_phi[pos_snr]<<" "<<MCEnergy<<" "<<MCEnergy*sinGeomagneticAngle<<" "<<distanceShowerMax/km<<" "
1063  <<XMax/(g/cm2)<<" "<<max_rho[pos_snr]<<" "<<max_b[pos_snr]<<"\n";
1064  fout8<<previousId<<" "<<max_x[pos_snr]<<" "<<max_x_snr[pos_snr]<<" "<<max_th[pos_snr]<<" "
1065  <<max_phi[pos_snr]<<" "<<MCEnergy<<" "<<MCEnergy*sinGeomagneticAngle<<" "<<distanceShowerMax/km<<" "
1066  <<XMax/(g/cm2)<<" "<<max_rho[pos_snr]<<" "<<max_b[pos_snr]<<"\n";
1067 
1068  previousId = eventId;
1069  MCEnergy = MCShower.GetEnergy();
1070  distanceShowerMax = MCShower.GetDistanceOfShowerMaximum();
1071  XMax = MCShower.GetGHParameters().GetXMax();
1072  cosGeomagneticAngle = (showerAxis*magneticField)/(sqrt(showerAxis*showerAxis)*sqrt(magneticField*magneticField));
1073  sinGeomagneticAngle = sqrt(1 - cosGeomagneticAngle*cosGeomagneticAngle);
1074 
1075  max_cc.clear();
1076  max_pw.clear();
1077  max_x.clear();
1078  max_cc_snr.clear();
1079  max_pw_snr.clear();
1080  max_x_snr.clear();
1081  max_th.clear();
1082  max_phi.clear();
1083  max_rho.clear();
1084  max_b.clear();
1085 
1086  max_cc.push_back(ccPeak.GetHeight());
1087  max_pw.push_back(pwPeak.GetHeight());
1088  max_x.push_back(xPeak.GetHeight());
1089  max_cc_snr.push_back(ccPeak.GetOffset());
1090  max_pw_snr.push_back(pwPeak.GetOffset());
1091  max_x_snr.push_back(xPeak.GetOffset());
1092  max_th.push_back(polarCoords.get<1>()/degree);
1093  max_phi.push_back(polarCoords.get<2>()/degree);
1094  max_rho.push_back(rrec.GetParameter(eRho)/degree);
1095  max_b.push_back(rrec.GetParameter(eB)/ns);
1096  }
1097  }
1098 
1099  fout3.close();
1100  fout4.close();
1101  fout5.close();
1102  fout6.close();
1103  fout7.close();
1104  fout8.close();
1105  */
1106 
1107  /*
1108  This functionality is not finished yet...
1109 
1110  if (rrec.HasCurrentBeamMap()) {
1111  DEBUGLOG ("filling BeamQuantities into map");
1112 
1113  evt::BeamQuantities quants (rrec.GetAxis().GetTheta(coreCS) ,
1114  rrec.GetAxis().GetPhi(coreCS) ,
1115  waveModel->curvature(rrec.GetAxis(),coreCS),
1116  waveModel->coneAngle(rrec.GetAxis(),coreCS),
1117  ccPeak, pwPeak, xPeak);
1118 
1119  evt::BeamMap map = rrec.GetCurrentBeamMap();
1120  map.AddQuantities(quants);
1121  }
1122  if (!rrec.HasBeamResultQuantities()
1123  || (rrec.GetBeamResultQuantities().GetCCPeak().GetHeight() / rrec.GetBeamResultQuantities().GetCCPeak().GetRMS()
1124  < ccPeak.GetHeight() / ccPeak.GetRMS() )) {
1125  evt::BeamQuantities resultQuants (showerAxis.GetTheta(coreCS) ,
1126  showerAxis.GetPhi(coreCS) ,
1127  waveModel->curvature(rrec.GetAxis(),coreCS),
1128  waveModel->coneAngle(rrec.GetAxis(),coreCS),
1129  ccPeak, pwPeak, xPeak);
1130  rrec.SetBeamResultQuantities(resultQuants);
1131  }
1132  */
1133 
1134  return eSuccess;
1135  }
1136 
1138  RdBeamFormer::Finish()
1139  {
1140  INFO("RdBeamFormer::Finish()");
1141 
1142  delete (waveModel);
1143 
1144  return eSuccess;
1145  }
1146 
1147  void RdBeamFormer::WriteASCII (const TraceD& cc, const TraceD& power, const TraceD& x,
1148  const evt::BeamPeak& ccPeak, const evt::BeamPeak& pwPeak, const evt::BeamPeak& xPeak,
1149  const evt::Event& event) const {
1150  fNumCalls++;
1151 
1152  double eps = 1e-14; //desired precision for variables comparision
1153 
1154  static std::string outfile_name = outfile + "_";
1155 
1156  //write to a new file if analysis switches to the next event
1157  const evt::ShowerRRecData& rrec= event.GetRecShower().GetRRecShower();
1158  int eventId = event.GetREvent().GetHeader().GetId();
1159  std::string stringId = SSTR(eventId);
1160  //cout<<"eventId= "<<eventId<<"\n";
1161  static int oldId = -1;
1162  //cout<<"oldId= "<<oldId<<"\n";
1163  if (eventId != oldId) {
1164  //cout<<"eventId= "<<eventId<<"\n";
1165  oldId = eventId;
1166  //cout<<"oldId= "<<oldId<<"\n";
1167  std::string buffer = SSTR(oldId) + "_";
1168  outfile_name.replace(outfile.size()+1,buffer.size(),buffer);
1169  }
1170 
1171  //write to a new file if the respective wavefront parameter switches to the next step
1172  if (waveModelConf == "eSpherical") {
1173  const utl::Triple polarCoords = rrec.GetAxis().GetSphericalCoordinates(coreCS);
1174  double r = polarCoords.get<0>()/km;
1175  static double oldR = -1;
1176  //cout<<"oldR= "<<oldR<<" oldR-r= "<<oldR - r<<"\n";
1177  if (abs(r - oldR) >= eps) {
1178  //cout<<"r= "<<r<<"\n";
1179  oldR = r;
1180  //cout<<"oldR= "<<oldR<<"\n";
1181  std::string buffer = SSTR(oldR);
1182  outfile_name.replace(outfile.size()+stringId.size()+2,buffer.size()+10,buffer);
1183  }
1184  }
1185  else if (waveModelConf == "eConical") {
1186  double Rho = rrec.GetParameter(eRho)/degree;
1187  //cout<<"eRho= "<<Rho<<"\n";
1188  static double oldRho = -1;
1189  //cout<<"oldRho= "<<oldRho<<"\n";
1190  if (abs(Rho - oldRho) >= eps) {
1191  //cout<<"eRho= "<<Rho<<"\n";
1192  oldRho = Rho;
1193  //cout<<"oldRho= "<<oldRho<<"\n";
1194  std::string buffer = SSTR(oldRho);
1195  outfile_name.replace(outfile.size()+stringId.size()+2,buffer.size()+10,buffer);
1196  }
1197  }
1198  else if (waveModelConf == "eHyperbolic") {
1199  double Rho = rrec.GetParameter(eRho)/degree;
1200  double b = rrec.GetParameter(eB)/ns;
1201  //double b = 3*ns;
1202  //cout<<"eRho= "<<Rho<<"\n";
1203  static double old_Rho = -1;
1204  static double old_b = -1;
1205  //cout<<"oldRho= "<<oldRho<<"\n";
1206  if (abs(b - old_b) >= eps) { // abs(Rho - old_Rho) >= eps ||
1207  //cout<<"eRho= "<<Rho<<"\n";
1208  old_Rho = Rho;
1209  old_b = b;
1210  //cout<<"oldRho= "<<oldRho<<"\n";
1211  std::string buffer1 = SSTR(old_Rho);
1212  std::string buffer2 = SSTR(old_b);
1213  std::string buffer = buffer1 + "_" + buffer2;
1214  outfile_name.replace(outfile.size()+stringId.size()+2,buffer.size()+10,buffer);
1215  }
1216  }
1217 
1218  /*
1219  Uncomment this part if you want to write to the files the whole beam-forming traces as well
1220 
1221  WriteTrace(cc, ccPeak, "cc_"+outfile_name+".txt", rrec);
1222  WriteTrace(power, pwPeak, "pw_"+outfile_name+".txt", rrec);
1223  WriteTrace(x, xPeak, "x_"+outfile_name+".txt", rrec);
1224  */
1225 
1226  WritePeak(ccPeak, "cc_max_"+outfile_name+".txt", rrec);
1227  WritePeak(pwPeak, "pw_max_"+outfile_name+".txt", rrec);
1228  WritePeak(xPeak, "x_max_"+outfile_name+".txt", rrec);
1229  }
1230 
1231  void RdBeamFormer::WriteTrace(const TraceD& trace, const evt::BeamPeak &Peak,
1232  const string& filename, const evt::ShowerRRecData& rrec) const {
1233  ofstream fout;
1234  fout.open(filename.c_str(),ios::out|ios::app);
1235 
1236  if (gridtype == polar) {
1237  if (waveModelConf == "ePlane" || waveModelConf == "eSpherical") {
1238  const utl::Triple polarCoords = rrec.GetAxis().GetSphericalCoordinates(coreCS);
1239  for (StationTimeSeries::SizeType i = 0; i < trace.GetSize(); ++i) {
1240  fout<<polarCoords.get<0>()/km<<" "<<polarCoords.get<1>()/degree<<" "<<polarCoords.get<2>()/degree<<" "
1241  <<trace[i]<<" "<<trace.GetBinning()*(i+startbin+1)/nanosecond<<" "
1242  <<Peak.GetHeight()<<" "<<Peak.GetTime()<<" "<<Peak.GetOffset()<<"\n";
1243  }
1244  fout<<endl;
1245  fout<<endl;
1246  }
1247  else if (waveModelConf == "eConical") {
1248  const utl::Triple polarCoords = rrec.GetAxis().GetSphericalCoordinates(coreCS);
1249  for (StationTimeSeries::SizeType i = 0; i < trace.GetSize(); ++i) {
1250  fout<<rrec.GetParameter(eRho)/degree<<" "<<polarCoords.get<0>()/km<<" "<<polarCoords.get<1>()/degree<<" "
1251  <<polarCoords.get<2>()/degree<<" "<<trace[i]<<" "<<trace.GetBinning()*(i+startbin+1)/nanosecond<<" "
1252  <<Peak.GetHeight()<<" "<<Peak.GetTime()<<" "<<Peak.GetOffset()<<"\n";
1253  }
1254  fout<<endl;
1255  fout<<endl;
1256  }
1257  else if (waveModelConf == "eHyperbolic") {
1258  const utl::Triple polarCoords = rrec.GetAxis().GetSphericalCoordinates(coreCS);
1259  for (StationTimeSeries::SizeType i = 0; i < trace.GetSize(); ++i) {
1260  fout<<rrec.GetParameter(eB)/ns<<" "<<rrec.GetParameter(eRho)/degree<<" "
1261  <<polarCoords.get<0>()/km<<" "<<polarCoords.get<1>()/degree<<" "<<polarCoords.get<2>()/degree<<" "
1262  <<trace[i]<<" "<<trace.GetBinning()*(i+startbin+1)/nanosecond<<" "
1263  <<Peak.GetHeight()<<" "<<Peak.GetTime()<<" "<<Peak.GetOffset()<<"\n";
1264  }
1265  fout<<endl;
1266  fout<<endl;
1267  }
1268  }
1269  else if (gridtype == carthesian) {
1270  if (waveModelConf == "ePlane" || waveModelConf == "eSpherical") {
1271  const utl::Triple xyz = rrec.GetAxis().GetCoordinates(coreCS);
1272  for (StationTimeSeries::SizeType i = 0; i < trace.GetSize(); ++i) {
1273  fout<<xyz.get<0>()/km<<" "<<xyz.get<1>()/km<<" "<<xyz.get<2>()/km<<" "
1274  <<trace[i]<<" "<<trace.GetBinning()*(i+startbin+1)/nanosecond<<" "
1275  <<Peak.GetHeight()<<" "<<Peak.GetTime()<<" "<<Peak.GetOffset()<<"\n";
1276  }
1277  fout<<endl;
1278  fout<<endl;
1279  }
1280  else if (waveModelConf == "eConical") {
1281  const utl::Triple xyz = rrec.GetAxis().GetCoordinates(coreCS);
1282  for (StationTimeSeries::SizeType i = 0; i < trace.GetSize(); ++i) {
1283  fout<<rrec.GetParameter(eRho)/degree<<" "<<xyz.get<0>()/km<<" "<<xyz.get<1>()/km<<" "<<xyz.get<2>()/km<<" "
1284  <<trace[i]<<" "<<trace.GetBinning()*(i+startbin+1)/nanosecond<<" "
1285  <<Peak.GetHeight()<<" "<<Peak.GetTime()<<" "<<Peak.GetOffset()<<"\n";
1286  }
1287  fout<<endl;
1288  fout<<endl;
1289  }
1290  else if (waveModelConf == "eHyperbolic") {
1291  const utl::Triple xyz = rrec.GetAxis().GetCoordinates(coreCS);
1292  for (StationTimeSeries::SizeType i = 0; i < trace.GetSize(); ++i) {
1293  fout<<rrec.GetParameter(eB)/ns<<" "<<rrec.GetParameter(eRho)/degree<<" "
1294  <<xyz.get<0>()/km<<" "<<xyz.get<1>()/km<<" "<<xyz.get<2>()/km<<" "
1295  <<trace[i]<<" "<<trace.GetBinning()*(i+startbin+1)/nanosecond<<" "
1296  <<Peak.GetHeight()<<" "<<Peak.GetTime()<<" "<<Peak.GetOffset()<<"\n";
1297  }
1298  fout<<endl;
1299  fout<<endl;
1300  }
1301  }
1302 
1303  fout.close();
1304  }
1305 
1306  void RdBeamFormer::WritePeak(const evt::BeamPeak& Peak, const string& filename, const evt::ShowerRRecData& rrec) const {
1307  int stepsPhi = 6; //have the same purpose as fNumcalls. You have to change it manually accordingly to the number of steps in phi set in .xml.
1308  //It always equals stepsPhi+1 if stepsPhi is not equal to 360, otherwise it should be 360.
1309  ofstream fout;
1310  fout.open(filename.c_str(),ios::out|ios::app);
1311 
1312  if (gridtype == polar) {
1313  if (waveModelConf == "ePlane" || waveModelConf == "eSpherical") {
1314  const utl::Triple polarCoords = rrec.GetAxis().GetSphericalCoordinates(coreCS);
1315  fout<<polarCoords.get<0>()/km<<" "<<polarCoords.get<1>()/degree<<" "<<polarCoords.get<2>()/degree<<" "
1316  <<Peak.GetHeight()<<" "<<Peak.GetTime()<<" "<<Peak.GetOffset()<<"\n";
1317  if ((fNumCalls % stepsPhi) == 0)
1318  fout<<"\n";
1319  }
1320  else if (waveModelConf == "eConical") {
1321  const utl::Triple polarCoords = rrec.GetAxis().GetSphericalCoordinates(coreCS);
1322  fout<<rrec.GetParameter(eRho)/degree<<" "<<polarCoords.get<0>()/km<<" "<<polarCoords.get<1>()/degree<<" "
1323  <<polarCoords.get<2>()/degree<<" "<<Peak.GetHeight()<<" "<<Peak.GetTime()<<" "<<Peak.GetOffset()<<"\n";
1324  if ((fNumCalls % stepsPhi) == 0)
1325  fout<<"\n";
1326  }
1327  else if (waveModelConf == "eHyperbolic") {
1328  const utl::Triple polarCoords = rrec.GetAxis().GetSphericalCoordinates(coreCS);
1329  fout<<rrec.GetParameter(eB)/ns<<" "<<rrec.GetParameter(eRho)/degree<<" "<<polarCoords.get<0>()/km<<" "
1330  <<polarCoords.get<1>()/degree<<" "<<polarCoords.get<2>()/degree<<" "<<Peak.GetHeight()<<" "
1331  <<Peak.GetTime()<<" "<<Peak.GetOffset()<<"\n";
1332  if ((fNumCalls % stepsPhi) == 0)
1333  fout<<"\n";
1334  }
1335  }
1336  else if (gridtype == carthesian) {
1337  if (waveModelConf == "ePlane" || waveModelConf == "eSpherical") {
1338  const utl::Triple xyz = rrec.GetAxis().GetCoordinates(coreCS);
1339  fout<<xyz.get<0>()/km<<" "<<xyz.get<1>()/km<<" "<<xyz.get<2>()/km<<" "<<Peak.GetHeight()<<" "
1340  <<Peak.GetTime()<<" "<<Peak.GetOffset()<<"\n";
1341  if ((fNumCalls % stepsPhi) == 0)
1342  fout<<"\n";
1343  }
1344  else if (waveModelConf == "eConical") {
1345  const utl::Triple xyz = rrec.GetAxis().GetCoordinates(coreCS);
1346  fout<<rrec.GetParameter(eRho)/degree<<" "<<xyz.get<0>()/km<<" "<<xyz.get<1>()/km<<" "<<xyz.get<2>()/km<<" "
1347  <<Peak.GetHeight()<<" "<<Peak.GetTime()<<" "<<Peak.GetOffset()<<"\n";
1348  if ((fNumCalls % stepsPhi) == 0)
1349  fout<<"\n";
1350  }
1351  else if (waveModelConf == "eHyperbolic") {
1352  const utl::Triple xyz = rrec.GetAxis().GetCoordinates(coreCS);
1353  fout<<rrec.GetParameter(eB)/ns<<" "<<rrec.GetParameter(eRho)/degree<<" "<<xyz.get<0>()/km<<" "<<xyz.get<1>()/km<<" "
1354  <<xyz.get<2>()/km<<" "<<Peak.GetHeight()<<" "<<Peak.GetTime()<<" "<<Peak.GetOffset()<<"\n";
1355  if ((fNumCalls % stepsPhi) == 0)
1356  fout<<"\n";
1357  }
1358  }
1359 
1360  fout.close();
1361  }
1362 }
1363 
1364 #undef PRINT
Branch GetTopBranch() const
Definition: Branch.cc:63
Class to access station level reconstructed data.
utl::Vector GetAxis() const
Returns vector of the shower axis.
const double degree
Point object.
Definition: Point.h:32
boost::filter_iterator< CandidateStationFilter, AllStationIterator > CandidateStationIterator
Iterator over all CandidateStations (i.e., HasSignal, HasNoSignal)
Definition: REvent.h:141
Report success to RunController.
Definition: VModule.h:62
SizeType GetStop() const
Get valid data stop bin.
Definition: Trace.h:148
bool HasRecShower() const
CandidateStationIterator CandidateStationsEnd()
Definition: REvent.h:146
Interface class to access to the Radio part of an event.
Definition: REvent.h:42
static double Mean(const Trace< T > &trace, const unsigned int bin1, const unsigned int bin2)
Evaluate the mean of trace between bin1 and bin2.
Skip remaining modules in the current loop and continue with next iteration of the loop...
Definition: VModule.h:68
evt::BeamPeak findPeak(const utl::TraceD &trace, const double timeOffset)
Interface class to access to the RD Reconstruction of a Shower.
utl::TimeStamp GetTime() const
Definition: REvent/Header.h:17
double GetBinning() const
size of one slot
Definition: Trace.h:138
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
void Init()
Initialise the registry.
vector< t2list > out
output of the algorithm: a list of clusters
Definition: XbAlgo.cc:32
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Definition: Branch.cc:211
bool HasREvent() const
const phoenix::function< PowerToImpl > power
Definition: UnitGrammar.h:47
std::vector< T >::const_iterator ConstIterator
Definition: Trace.h:60
Detector description interface for RDetector-related data.
Definition: RDetector.h:46
Iterator Begin()
Definition: Trace.h:75
utl::TraceD powertrace(std::vector< revt::StationFFTDataContainer > &stationData, int nStat, double binning, int start, int stop)
void setOrigin(utl::Point origin)
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
#define max(a, b)
Class representing a document branch.
Definition: Branch.h:107
boost::tuple< double, double, double > Triple
Coordinate triple for easy getting or setting of coordinates.
Definition: Triple.h:15
class to hold data at the radio Station level.
algorithms to manipulate traces
virtual double delay(const utl::Point antennaPos, const evt::ShowerRRecData &rrec) const =0
void setSkyPos(utl::Point skyPos)
std::vector< T >::size_type SizeType
Definition: Trace.h:58
const double ns
constexpr double nanosecond
Definition: AugerUnits.h:143
#define DEBUGLOG(message)
Macro for logging debugging messages.
Definition: ErrorLogger.h:157
double abs(const SVector< n, T > &v)
const Data result[]
static void ShiftTimeSeries(FFTDataContainer< C, T, F > &container, const TimeInterval &shift)
shifts the time series of the FFTDataContainer in time
Header & GetHeader()
access to REvent Header
Definition: REvent.h:239
bool IsSaturated() const
CandidateStationIterator CandidateStationsBegin()
Definition: REvent.h:144
const double km
void efieldproduct(const revt::StationTimeSeries &in1, const revt::StationTimeSeries &in2, utl::TraceD &out, int start, int stop)
Algorithms working on FFTDataContainer objects.
SizeType GetSize() const
Definition: Trace.h:156
#define WARNING(message)
Macro for logging warning messages.
Definition: ErrorLogger.h:163
double eps
void GetData(bool &b) const
Overloads of the GetData member template function.
Definition: Branch.cc:644
static double RootMeanSquare(const Trace< T > &trace, const unsigned int bin1, const unsigned int bin2)
Evaluate the RootMeanSquare of trace between bin1 and bin2.
#define SSTR(x)
Definition: RdBeamFormer.cc:78
utl::TraceD crosscorr(std::vector< revt::StationFFTDataContainer > &stationData, int nStat, double binning, int start, int stop)
utl::TraceD xtrace(utl::TraceD ccTrace, utl::TraceD ccNormal, utl::TraceD pwNormal)
void efieldtopower(const revt::StationTimeSeries &in, utl::TraceD &out, int start, int stop)
double GetParameter(const Parameter i) const
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
bool HasParameter(const Parameter i) const
void WriteASCII(const utl::TraceD &cc, const utl::TraceD &power, const utl::TraceD &x, const evt::BeamPeak &ccPeak, const evt::BeamPeak &pwPeak, const evt::BeamPeak &xPeak, const evt::Event &event) const
const StationFFTDataContainer & GetFFTDataContainer() const
retrieve Station FFTDataContainer (read access)
Header file holding the RD Event Trigger class definition (based on SD)
Definition: REvent/Header.h:14
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
SizeType GetStart() const
Get valid data start bin.
Definition: Trace.h:142
void WritePeak(const evt::BeamPeak &Peak, const std::string &filename, const evt::ShowerRRecData &rrec) const
Report failure to RunController, causing RunController to terminate execution.
Definition: VModule.h:64
utl::Point GetCorePosition() const
returns pointer of the position vector of the core in the reference coor system
double GetParameter(const Parameter i) const
enum gridtype_t gridtype
Definition: RdBeamFormer.h:90
char * filename
Definition: dump1090.h:266
#define PRINT(...)
Definition: RdBeamFormer.cc:76
utl::Point GetPosition() const
Tank position in Site Cartesian Coordinates.
static Policy::type Create(const utl::Point &theOrigin)
Create the standard local coordinate system for a Point.
Iterator End()
Definition: Trace.h:76
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165
const Station & GetStation(const int stationId) const
Get station by Station Id.
Definition: RDetector.cc:141
double shiftTraces(std::vector< revt::StationFFTDataContainer > &stationData, int &nStat, double &binning, int &start, int &stop, evt::Event &event)
int GetId() const
Definition: REvent/Header.h:21
std::vector< double >::iterator Iterator
Definition: Trace.h:59
utl::CoordinateSystemPtr coreCS
Definition: RdBeamFormer.h:97

, generated on Tue Sep 26 2023.