FdAxisFinder.cc
Go to the documentation of this file.
1 
9 #include <fwk/CentralConfig.h>
10 #include <fwk/CoordinateSystemRegistry.h>
11 
12 #include <utl/Reader.h>
13 #include <utl/ErrorLogger.h>
14 #include <utl/UTMPoint.h>
15 
16 #include <evt/Event.h>
17 #include <evt/ShowerRecData.h>
18 #include <evt/ShowerFRecData.h>
19 
20 #include <fevt/Telescope.h>
21 #include <fevt/Eye.h>
22 #include <fevt/FEvent.h>
23 #include <fevt/Pixel.h>
24 #include <fevt/PixelRecData.h>
25 #include <fevt/EyeRecData.h>
26 #include <fevt/EyeHeader.h>
27 #include <fevt/TelescopeRecData.h>
28 #include <fevt/FdComponentSelector.h>
29 
30 #include <det/Detector.h>
31 
32 #include <fdet/Eye.h>
33 #include <fdet/Channel.h>
34 #include <fdet/Pixel.h>
35 #include <fdet/FDetector.h>
36 #include <fdet/FTimeFitModel.h>
37 
38 #include <utl/MathConstants.h>
39 #include <utl/PhysicalConstants.h>
40 #include <utl/Transformation.h>
41 
42 //========================================================
43 // added for fitting the axis fixing the core to the clf
44 
45 #include <utl/ReferenceEllipsoid.h>
46 #include <fwk/LocalCoordinateSystem.h>
47 #include <evt/ShowerRecData.h>
48 
49 //========================================
50 // sd part for identifying Celeste or Ramiro station
51 // in order to identify CLF and XLF events.
52 
53 #include <evt/ShowerSRecData.h>
54 #include <sevt/SEvent.h>
55 #include <sevt/Station.h>
56 #include <sevt/StationTriggerData.h>
57 #include <sevt/StationRecData.h>
58 #include <sevt/EventTrigger.h>
59 #include <sdet/SDetector.h>
60 #include <sdet/Station.h>
61 
62 //========
63 // to extract the GPS time of the event
64 
65 #include <evt/Header.h>
66 
67 //==================
68 
69 
70 
71 #include <TMinuit.h>
72 
73 #include "FdAxisFinder.h"
74 
75 using namespace std;
76 using namespace fwk;
77 using namespace utl;
78 using namespace fevt;
79 using namespace evt;
80 using namespace FdAxisFinderOG;
81 
82 
83 fevt::Eye * FdAxisFinder::fCurEye =0;
84 double FdAxisFinder::fChi2 =0;
85 unsigned int FdAxisFinder::fNDof=0;
86 
88 
89 int FdAxisFinder::fDebuging;
90 
91 //------------------------------------
92 // For reconstructing lasers
93 double FdAxisFinder::fRp =0;
94 bool FdAxisFinder::fIsCeleste = false;
95 bool FdAxisFinder::fIsRamiro = false;
96 //------------------------------------
97 
98 
100 
101  Branch topB =
102  CentralConfig::GetInstance()->GetTopBranch("FdAxisFinder");
103 
104  if (!topB) {
105  ERROR("Could not find branch FdAxisFinder");
106  return eFailure;
107  }
108 
109  topB.GetChild("ForDebug").GetData(fDebuging);
110  topB.GetChild("tolerance").GetData(fTolerance);
111  topB.GetChild("minPixels").GetData(fMinPixels);
112  topB.GetChild("sigmasLimit").GetData(fSigmasLimit);
113  topB.GetChild("SelectAndRecLasers").GetData(fSelectAndRecLasers);
114 
115  int timeFitModelSwitch;
116  topB.GetChild("TimeFitModel").GetData(timeFitModelSwitch);
117 
118  fdet::FTimeFitModel& timeFitModel = fdet::FTimeFitModel::GetInstance();
119  switch (timeFitModelSwitch) {
120  case 0:
122  break;
123  case 1:
125  break;
126  default:
127  ERROR("Invalid input parameter for TimeFitModel");
128  return eFailure;
129  }
130 
131  fMinimumTimeExtension = 500 * ns;
132  fIsBlob = false;
133 
134  // info output
135  ostringstream info;
136  info << "Parameters:\n"
137  " tolerance: " << fTolerance / degree <<" deg.\n"
138  " min no. pixels: " << fMinPixels << "\n"
139  " t_i deviation limit: " << fSigmasLimit <<" sigmas";
140  INFO(info);
141 
142  return eSuccess;
143 }
144 
145 
147 FdAxisFinder::Run(evt::Event& event)
148 {
149  if (fSelectAndRecLasers && !CheckForLasers(event))
150  return eContinueLoop;
151 
152  fMinuitFailed = false;
153  fIsBlob = false;
154  if (!event.HasFEvent())
155  return eSuccess;
156 
157  fevt::FEvent& fevent = event.GetFEvent();
159 
160  unsigned int neyes = 0; // number of eyes with enough pixels
161  for (eyeiter = fevent.EyesBegin(ComponentSelector::eHasData);
162  eyeiter != fevent.EyesEnd(ComponentSelector::eHasData);
163  ++eyeiter){
164 
165  fevt::Eye& eye = *eyeiter;
166 
167  if (!eye.HasRecData())
168  continue;
169  fevt::EyeRecData& eyerecdata = eye.GetRecData();
170 
171  fSDP = eyerecdata.GetSDP();
172 
173  fCurEye = &eye; // acrobacy for TMinuit
174 
175  this->FillPoints(eye);
176 
177  // this->FillPoints(eye) is needed for virtual eyes which by definition have no SDP!
178  if (!fSDP.GetMag2()) {
179  WARNING("This eye has no valid SDP!");
180  continue;
181  }
182 
183  // skip virtual eyes
184  if (det::Detector::GetInstance().GetFDetector().GetEye(eye).IsVirtual())
185  continue;
186 
187  if(eyerecdata.GetNTimeFitPixels() < fMinPixels)
188  continue;
189  if(fIsBlob== true) {
190  cout <<" All pixels in this Eye were triggered within "<< fMinimumTimeExtension<<" ns\n";
191  cout <<" This event may be a Blob in the mirror \n";
192  }
193 
194 
195  AxisFirstGuess(eye);
196  //on the basis of time difference from calculated using first guess in function, remove outliers
197  RemoveOutliers(eye);
198 
199  if (fSelectAndRecLasers)
200  FindAxisLaser(eye);
201  else
202  FindAxis(eye);
203 
204  // Now we use the fitted Axis
205  // to check whether we need to readmit
206  // any pixel that was rejected when
207  // using the axis first guess.
208 
209  unsigned int nopixels = eyerecdata.GetNTimeFitPixels();
210  while ( ReadmitPixel(eye)) {
211  if (fSelectAndRecLasers)
212  FindAxisLaser(eye);
213  else
214  FindAxis(eye); // Fits again the axis
215 
216  if (fDebuging){
217  cout<<"\n";
218  cout <<eyerecdata.GetNTimeFitPixels()-nopixels<<" pixels were re-admitted.\n";
219  cout<<"\n";
220  }
221  }
222 
223  //rejecting pixels, one by one, if they are more than
224  //fSigmasLimit away
225  while ( RejectPixel(eye)) {
226  if (fSelectAndRecLasers)
227  FindAxisLaser(eye);
228  else
229  FindAxis(eye); // Fits again the axis
230 
231 
232  }
233 
234  //--------------------------------------
235  // Defining the range for chi0 [-180,180]
236  // for down goin events chi0 [0,180]
237  // for up goin events chi0 [-180,0]
238  if ( abs (fChi0) > kPi ) {
239  fChi0 -= int ( fChi0 / (2* kPi) )* 2*kPi;
240  if ( fChi0 < 0 ) fChi0 += 2* kPi;
241  if ( fChi0 > kPi ) fChi0 -= 2*kPi;
242  }
243 
244  //-----------------------------------------
245 
246  //--------------------------------------------
247  eyerecdata.SetChiZero(fChi0,fChi0Error);
248  eyerecdata.SetTZero(fT0,fT0Error);
249  eyerecdata.SetRp(fRp,fRpError);
250  eyerecdata.SetTimeFitChiSquare(fChi2,fNDof);
251 
252  // correlation coefficiens
253 
254  double rRpT0 = fCovariance[2][1]/fRpError/fT0Error;
255  double rRpChi0 = fCovariance[2][0]/fRpError/fChi0Error;
256  double rChi0T0 = fCovariance[0][1]/fChi0Error/fT0Error;
257 
258  eyerecdata.SetTimeFitCorrelations(rRpT0,rRpChi0,rChi0T0);
259 
260  //--------------------------------------------
261  // Also fill the TelescopeRecData with the same values
262  // since this module isn't able to deal with compound eyes
263  // that consist of telescopes at multiple different positions
264 
265  for (fevt::Eye::TelescopeIterator telIt = eye.TelescopesBegin(ComponentSelector::eHasData);
266  telIt != eye.TelescopesEnd(ComponentSelector::eHasData); ++telIt)
267  {
268  if (!telIt->HasRecData())
269  telIt->MakeRecData();
270  fevt::TelescopeRecData& telRecData = telIt->GetRecData();
271  telRecData.SetChiZero(fChi0,fChi0Error);
272  telRecData.SetTZero(fT0,fT0Error);
273  telRecData.SetRp(fRp,fRpError);
274  telRecData.SetTimeFitChiSquare(fChi2,fNDof);
275  telRecData.SetTimeFitCorrelations(rRpT0,rRpChi0,rChi0T0);
276  }
277 
278  //--------------------------------------------
279  // calculate axis parameters.
280 
281  CoordinateSystemPtr eyeCS =
282  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetEyeCoordinateSystem();
283 
284  Vector sdp = eyerecdata.GetSDP();
285  //if (sdp.GetPhi(eyeCS) < 0 ) sdp *=-1;
286 
287  Vector vertical(0,0,1,eyeCS);
288  Vector horizontalInSDP = cross(sdp, vertical); // horizontal
289  horizontalInSDP.Normalize();
290 
291  Transformation rot (Transformation::Rotation(-fChi0, sdp, eyeCS));
292 
293  Vector axis (rot* horizontalInSDP); // apply rotation
294  axis.Normalize();
295 
296  CoordinateSystemPtr siteCS =
297  det::Detector::GetInstance().GetSiteCoordinateSystem();
298 
299  {
300  ostringstream info;
301  info << "Axis(Theta,Phi)(siteCS): " << axis.GetTheta(siteCS)/degree
302  << "," << axis.GetPhi(siteCS)/degree << " deg" <<endl;
303  INFO(info);
304  }
305 
306  Vector core_eye_vec = fRp / sin( kPi - fChi0) * horizontalInSDP;
307 
308  Point eyeposition =
309  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetPosition();
310 
311  Point core = eyeposition + core_eye_vec;
312 
313  if (fDebuging == 1){
314  cout << "Core (x,y)(eyeCS) " << core.GetX(eyeCS)<<","
315  << core.GetY(eyeCS)<< " [m]" << endl;
316 
317  cout << "Core (x,y)(siteCS) " << core.GetX(siteCS)<<","
318  << core.GetY(siteCS)<< " [m]" << endl;
319  }
320 
321  if (!eyerecdata.HasFRecShower())
322  eyerecdata.MakeFRecShower();
323 
324  ShowerFRecData& recshower = eyerecdata.GetFRecShower();
325  recshower.SetAxis(axis);
326  recshower.SetCorePosition(core);
327  recshower.SetCoreTime(fCurEye->GetHeader().GetTimeStamp() -
328  TimeInterval(1000*100*ns), fRp, fChi0, fT0);
329 
330  ++neyes;
331 
332  {
333  ostringstream info;
334  info << "T_0=" << fT0/ns << " +/- " << fT0Error/ns << " ns, "
335  << "Chi_O=" << fChi0/degree << " +/- " << fChi0Error/degree << " deg, "
336  << "Rp " << fRp/meter << " +/- " << fRpError/meter << " m";
337  INFO(info);
338  }
339 
340  }// for eyeiter
341 
342  if (!neyes)
343  return eContinueLoop; //no eyes worth reconstructing, next event
344 
345  return eSuccess;
346 }
347 
348 
349 void
350 FdAxisFinder::FindAxis(fevt::Eye& /*eye*/)
351 {
352  const int npar = 3; // number of parameters
353 
354  TMinuit theMinuit(npar); // 3 parameter fit
355 
356  theMinuit.SetPrintLevel(-1); // minuit verbosity
357  theMinuit.SetFCN(FdAxisFinder::MinuitFitFunc);
358 
359  double arglist[npar]; // arguments to pass to the Minuit interpreter
360  int ierflag = 0;
361 
362  arglist[0] = 1; // [up]
363  arglist[1] = 1; // unused
364  theMinuit.mnexcm("SET ERR", arglist, 1, ierflag);
365 
366  if (ierflag)
367  ERROR("Minuit SET ERR failed");
368 
369  static double vstart[npar]; // inital point
370  static double step[npar]; // step size
371 
372  // something better has to be found for starting points
373  vstart[0] = fChi0First;
374  vstart[1] = fT0First;
375  vstart[2] = fRpFirst;
376 
377  step[0] = 0.001;
378  step[1] = 10;
379  step[2] = 10;
380 
381  theMinuit.mnparm(0, "Chi0", vstart[0], step[0], 0, 0, ierflag);
382  theMinuit.mnparm(1, "T0", vstart[1], step[1], 0, 0, ierflag);
383  theMinuit.mnparm(2, "Rp", vstart[2], step[2], 0, 0, ierflag);
384 
385  arglist[0] = 3000; // [maxcalls]
386  arglist[1] = 1; // [tolerance]
387  theMinuit.mnexcm("MIGRAD", arglist, 2, ierflag);
388 
389  if (ierflag) {
390  ERROR("Minuit MIGRAD failed");
391  fMinuitFailed = true;
392  }
393 
394  theMinuit.mnexcm("HESSE", arglist, 2, ierflag);
395 
396  // Check the status of the covariance matrix
397  // if bad use MINOS
398  double fmin, fedm, errdef; // unused dummies
399  int npari, nparx; //unused dummies
400  int istat = 0;
401  theMinuit.mnstat(fmin, fedm, errdef, npari, nparx, istat);
402  if (istat < 3) { // no accurate covariance matrix
403  theMinuit.mnexcm("MINOS", arglist, 2, ierflag);
404  theMinuit.mnstat(fmin, fedm, errdef, npari, nparx, istat);
405  if (istat < 3)
406  WARNING("Neither HESSE nor MINOS found accurate covariance matrix");
407  }
408  theMinuit.GetParameter(0, fChi0, fChi0Error);
409  theMinuit.GetParameter(1, fT0, fT0Error);
410  theMinuit.GetParameter(2, fRp, fRpError);
411  theMinuit.mnemat(&fCovariance[0][0], 3);
412 
413  if (fDebuging == 1) {
414  cout << "TO " << fT0 << " +/- " << fT0Error << "\n"
415  "ChiO " << fChi0/degree << " +/- " << fChi0Error/degree << "\n"
416  "Rp " << fRp << " +/- " << fRpError << endl;
417  }
418 
419  fChi2 = theMinuit.fAmin;
420 }
421 
422 
423 void
424 FdAxisFinder::FillPoints(fevt::Eye& eye)
425 {
426  double min_t_i = 10e6;
427  double max_t_i = 0;
428 
429  fevt::EyeRecData& recdata = eye.GetRecData();
430 
431  const fdet::Eye& deteye =
432  det::Detector::GetInstance().GetFDetector().GetEye(eye);
433 
434  // do all calculation in the eye reference system
436 
437  //------------------------------
438  //all pixels used for SDP are converted into timeFit pixels
439  //if they are within fTolerance.
440  for (fevt::EyeRecData::PixelIterator pixeliter = recdata.SDPPixelsBegin();
441  pixeliter != recdata.SDPPixelsEnd(); ++pixeliter) {
442 
443  fevt::Pixel& evtpixel = *pixeliter;
444  const fdet::Pixel& detpixel =
445  det::Detector::GetInstance().GetFDetector().GetPixel(evtpixel);
446  const double AngleWithSDP = fabs(kPi/2 - Angle(fSDP, detpixel.GetDirection()));
447 
448  if (AngleWithSDP < fTolerance)
449  recdata.AddTimeFitPixel(*pixeliter);
450 
451  }
452  //-------------------------------
453 
454  //--------------------------------------------
455  //This loop will fill the information
456  //for timing fit (t_i, t_i_error and chi_i).
457  //The loop is over all pixels with pulse
458  for (fevt::EyeRecData::PixelIterator pixeliter = recdata.PulsedPixelsBegin();
459  pixeliter != recdata.PulsedPixelsEnd(); ++pixeliter) {
460 
461  fevt::Pixel& evtpixel = *pixeliter;
462  const fdet::Pixel& detpixel =
463  det::Detector::GetInstance().GetFDetector().GetPixel(evtpixel);
464  const fdet::Channel& detChannel =
465  det::Detector::GetInstance().GetFDetector().GetChannel(evtpixel);
466 
467  double timebinsize = detChannel.GetFADCBinSize();
468 
469  // time correction for different eyes
470  int telid = evtpixel.GetTelescopeId();
471  unsigned int timeoffset = eye.GetTelescope(telid).GetTimeOffset();
472  double t_i = evtpixel.GetRecData().GetCentroid() ;
473  t_i *= timebinsize; // convert to nanosecond
474  t_i += timeoffset; // add offset
475  const double t_i_Err = timebinsize * evtpixel.GetRecData().GetCentroidError();
476 
477  if (fDebuging == 1)
478  cout << "PixId: " << evtpixel.GetId() << " t_i " << t_i << " ti err " << t_i_Err << '\n';
479 
480  // SDP is 0 for virtual eye, fill times nevertheless, but no chi
481  if (fSDP.GetMag2()) {
482  //Estimating horizontal Eye-Core direction
483  Vector pixeldir = detpixel.GetDirection();
484  pixeldir.TransformTo(CS);
485  Vector vertical(0,0,1, CS, Vector::kCartesian);
486  Vector horizontalWithinSDP = Cross(fSDP, vertical);
487  horizontalWithinSDP /= horizontalWithinSDP.GetMag();
488  // subtract component parallel to sdp
489  Vector chi_i_vector = pixeldir - (fSDP * pixeldir) * fSDP;
490  chi_i_vector.TransformTo(CS);
491  // Estimating chi_i
492  chi_i_vector /= chi_i_vector.GetMag();
493  const double chi_i = Angle(chi_i_vector, horizontalWithinSDP);
494 
495  evtpixel.GetRecData().SetChi_i(chi_i);
496 
497  } else
498  evtpixel.GetRecData().SetChi_i(0);
499 
500  evtpixel.GetRecData().SetT_i(t_i, t_i_Err);
501 
502  if (t_i < min_t_i)
503  min_t_i = t_i;
504  if (t_i > max_t_i)
505  max_t_i = t_i;
506 
507  } // for pixels with pulse
508 
509  if (abs(max_t_i - min_t_i) < fMinimumTimeExtension)
510  fIsBlob = true;
511 }
512 
513 
514 void
515 FdAxisFinder::MinuitFitFunc(int& /*npar*/, double* /*gin*/, double& f,
516  double *par, int /*iflag*/)
517 {
518  fevt::EyeRecData& recdata = fCurEye->GetRecData();
519 
520  double chisq = 0;
521  unsigned int ndof = 0;
522 
523  const double& chi_0 = par[0];
524  const double& t_0 = par[1];
525  const double& r_p = par[2];
526 
527  const fdet::FTimeFitModel& timeFitModel = fdet::FTimeFitModel::GetInstance();
528  CoordinateSystemPtr eyeCS =
529  det::Detector::GetInstance().GetFDetector().GetEye(*fCurEye).GetEyeCoordinateSystem();
530  const double sdpTheta = fSDP.GetTheta(eyeCS);
531  const int eyeID = fCurEye->GetId();
532 
533  for (EyeRecData::PixelIterator iter = recdata.TimeFitPixelsBegin();
534  iter != recdata.TimeFitPixelsEnd(); ++iter) {
535 
536  const PixelRecData& pixrec = iter->GetRecData();
537  const int telID = iter->GetTelescopeId();
538 
539  const double t_i = pixrec.GetT_i().GetNanoSecond();
540  const double t_i_Err = pixrec.GetT_iError().GetInterval();
541  const double chi_i = pixrec.GetChi_i();
542 
543  const double t_expected = timeFitModel.GetTimeAtAperture(t_0, r_p, chi_0, chi_i, sdpTheta, eyeID, telID);
544  const double tmp = t_i - t_expected;
545 
546  chisq += tmp*tmp / (t_i_Err * t_i_Err);
547  ++ndof;
548  }
549 
550  f = chisq;
551 
552  fNDof = ndof -3;
553 }
554 
555 
556 void
557 FdAxisFinder::MinuitFitFuncLaser(int& /*npar*/, double* /*gin*/, double& f,
558  double *par, int /*iflag*/)
559 {
560  fevt::EyeRecData& recdata = fCurEye->GetRecData();
561 
562  double chisq = 0;
563  unsigned int ndof = 0;
564 
565  const double& chi_0 = par[0];
566  const double& t_0 = par[1];
567  double& r_p = fRp; //initializing Rp
568 
569  //===========================================================
570  //Estimating Rp from the SDP and chi_0 and using the CLF
571  // location as core.
572 
574  det::Detector::GetInstance().GetSiteCoordinateSystem();
575 
576  const ReferenceEllipsoid& e = ReferenceEllipsoid::GetWGS84();
577  //UTMPoint UTMclf(6095769.0,469378.0,1412.0,19,'H',e);
578 
579  //--------------------------------
580  Point eyeposition =
581  det::Detector::GetInstance().GetFDetector().GetEye(*fCurEye).GetPosition();
582  UTMPoint UTMeye(eyeposition, e);
583  Point ThisEye = UTMeye.GetPoint(CS);
584  //------------------------
585 
588 
589  Point clf(0,0,0, clfCs);
590  const UTMPoint UTMclf(clf, e);
591  clf = UTMclf.GetPoint(CS);
592 
593  Point xlf(0,0,0, xlfCs);
594  const UTMPoint UTMxlf(xlf, e);
595  xlf = UTMxlf.GetPoint(CS);
596 
598 
599  Point LaserFacility;
600  if (fIsCeleste)
601  LaserFacility = clf;
602  if (fIsRamiro)
603  LaserFacility = xlf;
604 
605  Vector vertical_eye(0,0,1, EyeCS);
606  Vector eye_LaserFacility = LaserFacility - ThisEye;
607 
608  //----------------------------
609 
610  Vector horizontalInSDP = Cross(fSDP, vertical_eye);
611  horizontalInSDP /= horizontalInSDP.GetR(EyeCS);
612 
613  Transformation rot1(Transformation::Rotation(-chi_0, fSDP, EyeCS));
614  Vector LaserOrientation1(rot1 * horizontalInSDP);
615  LaserOrientation1 /= LaserOrientation1.GetR(EyeCS);
616 
617  //---------------------------
618  Vector newSDP = Cross(eye_LaserFacility, LaserOrientation1);
619 
620  if (abs(newSDP.GetTheta(EyeCS) - fSDP.GetTheta(EyeCS)) < kPi/2)
621  fSDP = newSDP;
622  else
623  fSDP = -newSDP;
624 
625  horizontalInSDP = Cross(fSDP, vertical_eye);
626  horizontalInSDP /= horizontalInSDP.GetR(EyeCS);
627 
628  Transformation rot2(Transformation::Rotation(-chi_0, fSDP, EyeCS));
629  Vector LaserOrientation(rot2 * horizontalInSDP);
630  LaserOrientation /= LaserOrientation.GetR(EyeCS);
631 
632  const double beta = Angle(eye_LaserFacility, LaserOrientation);
633 
634  r_p = eye_LaserFacility.GetR(EyeCS) * sin(beta);
635 
636  //=====================================
637 
638  const fdet::FTimeFitModel& timeFitModel = fdet::FTimeFitModel::GetInstance();
639  CoordinateSystemPtr eyeCS =
640  det::Detector::GetInstance().GetFDetector().GetEye(*fCurEye).GetEyeCoordinateSystem();
641  double sdpTheta = fSDP.GetTheta(eyeCS);
642  int eyeID = fCurEye->GetId();
643 
644  for (EyeRecData::PixelIterator iter = recdata.TimeFitPixelsBegin();
645  iter != recdata.TimeFitPixelsEnd(); ++iter) {
646 
647  const PixelRecData& pixrec = iter->GetRecData();
648  const int telID = iter->GetTelescopeId();
649 
650  const double t_i = pixrec.GetT_i().GetNanoSecond();
651  const double t_i_Err = pixrec.GetT_iError().GetInterval();
652  const double chi_i = pixrec.GetChi_i();
653 
654  const double t_expected = timeFitModel.GetTimeAtAperture(t_0, r_p, chi_0, chi_i, sdpTheta, eyeID, telID);
655  const double tmp = t_i - t_expected;
656 
657  chisq += tmp*tmp / (t_i_Err * t_i_Err);
658  ++ndof;
659  }// for iter
660 
661  f = chisq;
662 
663  fNDof = ndof - 2;
664 }
665 
666 
668 FdAxisFinder::Finish()
669 {
670  return eSuccess;
671 }
672 
673 
675 void
676 FdAxisFinder::RemoveOutliers(fevt::Eye& eye)
677 {
678  if (!eye.HasRecData())
679  return;
680  CoordinateSystemPtr eyeCS =
681  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetEyeCoordinateSystem();
682  const fdet::FTimeFitModel& timeFitModel = fdet::FTimeFitModel::GetInstance();
683  int eyeID = eye.GetId();
684  double sdpTheta = fSDP.GetTheta(eyeCS);
685 
686  EyeRecData& recdata = eye.GetRecData();
688 
689  for (iter = recdata.TimeFitPixelsBegin();
690  iter != recdata.TimeFitPixelsEnd(); ) {
691 
692  const fevt::Pixel& pixrec = *iter;
693  const int telID = pixrec.GetTelescopeId();
694 
695  const double t_i = pixrec.GetRecData().GetT_i().GetNanoSecond();
696  const double chi_i = pixrec.GetRecData().GetChi_i();
697  const double t_i_Err = pixrec.GetRecData().GetT_iError().GetInterval();
698 
699  const double t_expected = timeFitModel.GetTimeAtAperture(fT0First, fRpFirst, fChi0First, chi_i, sdpTheta, eyeID, telID);
700 
701  const double tmp = t_i - t_expected;
702  const double time_residue = tmp / (t_i_Err) ;
703  if (fabs(time_residue) > 10 && recdata.GetNTimeFitPixels() > 3)
704  iter = recdata.RemoveTimeFitPixel(iter);
705  else
706  ++iter;
707 
708  }
709 }
710 
711 
722 void
723 FdAxisFinder::AxisFirstGuess(fevt::Eye& eye)
724 {
725  double m[3][4] = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } };
726  int npoint = 0;
727 
728  const fevt::EyeRecData& recdata = eye.GetRecData();
729 
730  //calculate chimed
731  double chimin = kPi;
732  double chimax = 0.;
734  iter != recdata.TimeFitPixelsEnd(); ++iter) {
735 
736  const Pixel& pixel = *iter;
737  const PixelRecData& pixrec = pixel.GetRecData();
738  if (pixrec.GetChi_i() < chimin)
739  chimin = pixrec.GetChi_i();
740  if (pixrec.GetChi_i() > chimax)
741  chimax = pixrec.GetChi_i();
742 
743  ++npoint;
744  }
745  const double chimed = 0.5 * (chimin + chimax);
746 
748  iter != recdata.TimeFitPixelsEnd(); ++iter) {
749 
750  const Pixel& pixel = *iter;
751  const PixelRecData& pixrec = pixel.GetRecData();
752 
753  const double t_i = pixrec.GetT_i().GetNanoSecond();
754  const double t_i_Err = pixrec.GetT_iError().GetInterval();
755  const double x = pixrec.GetChi_i() - chimed;
756  //const double chi_i_Err = 0;
757  const double weight = sqrt(pixrec.GetTotalCharge())/(t_i_Err*t_i_Err);
758 
759  //initial matrix
760  m[0][0] += weight;
761  m[0][1] += weight*x;
762  m[0][2] += weight*x*x*0.5;
763  m[0][3] += weight*t_i;
764  m[1][0] = m[0][1];
765  m[1][1] += weight*x*x;
766  m[1][2] += 0.5*weight*x*x*x;
767  m[1][3] += weight*t_i*x;
768  m[2][0] = m[1][1];
769  m[2][1] += weight*x*x*x;
770  m[2][2] += 0.5*weight*x*x*x*x;
771  m[2][3] += weight*t_i*x*x;
772  }
773 
774  //Gauss method
775  for (int k = 0; k < 2; ++k)
776  for (int i = k+1; i < 3; ++i) {
777  const double temp = m[i][k]/m[k][k];
778  for (int j = 0; j < 4; ++j)
779  m[i][j] -= temp * m[k][j];
780  }
781 
782  //evaluate parameters
783  const double a2 = m[2][3]/m[2][2];
784  const double a1 = (m[1][3] - m[1][2]*a2)/m[1][1];
785  const double a0 = (m[0][3] - m[0][1]*a1 - m[0][2]*a2)/m[0][0];
786  fChi0First = chimed + 2*atan(-a2/a1);
787  fRpFirst = -2*kSpeedOfLight*a1*a1*a1/(a1*a1+a2*a2);
788  fT0First = a0 - 2*a2*a1*a1/(a1*a1+a2*a2);
789 
790  if (fDebuging == 1)
791  cout << "First Guess: Chi0 "<< fChi0First/degree << " Rp "
792  << fRpFirst << " T0 " << fT0First << endl;
793 }
794 
795 
802 bool
803 FdAxisFinder::ReadmitPixel(fevt::Eye& eye)
804 {
805  int ReadmittedPixels = 0;
806  CoordinateSystemPtr eyeCS =
807  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetEyeCoordinateSystem();
808  const fdet::FTimeFitModel& timeFitModel = fdet::FTimeFitModel::GetInstance();
809  int eyeID = eye.GetId();
810  double sdpTheta = fSDP.GetTheta(eyeCS);
811 
812  EyeRecData& recdata = eye.GetRecData();
813 
814  // iterate over pixels with a pulse
815  for (EyeRecData::PixelIterator pixeliter = recdata.PulsedPixelsBegin();
816  pixeliter != recdata.PulsedPixelsEnd(); ++pixeliter) {
817 
818  fevt::Pixel& evtpixel = *pixeliter;
819 
820  const unsigned int pixel_id = evtpixel.GetId();
821  //-----------------------------
822  // Checking whether this pixel was already
823  // selected for Axis Time fitting.
824  bool timefit_pixel = false;
826  iter != recdata.TimeFitPixelsEnd(); ++iter)
827  if (pixel_id == iter->GetId()) {
828  timefit_pixel = true;
829  break;
830  }
831  //-------------------------------------
832  if (timefit_pixel)
833  continue;
834 
835  PixelRecData& pixrec = evtpixel.GetRecData();
836  const double t_i = pixrec.GetT_i().GetNanoSecond();
837  const double chi_i = pixrec.GetChi_i();
838  const double t_i_Err = pixrec.GetT_iError().GetInterval();
839 
840  const int telID = evtpixel.GetTelescopeId();
841 
842  double t_expected = timeFitModel.GetTimeAtAperture(fT0, fRp, fChi0, chi_i, sdpTheta, eyeID, telID);
843  double tmp = t_i - t_expected;
844  double time_residue = tmp / (t_i_Err);
845 
846  const fdet::Pixel& detpixel =
847  det::Detector::GetInstance().GetFDetector().GetPixel(evtpixel);
848  const double AngleWithSDP = fabs(kPi/2 - Angle(fSDP, detpixel.GetDirection()));
849 
850  //-------------------------------------
851  // If the the pixel wasn't selected for timing fitting,
852  // and has small time residue and is close to the SDP. The pixel
853  // is added for timing fit.
854  if ( fabs(time_residue) < 13 && AngleWithSDP < fTolerance) {
855  recdata.AddTimeFitPixel(evtpixel);
856  ReadmittedPixels++;
857  if (fDebuging == 1)
858  cout << "readmitting pixel " << evtpixel.GetId() << " for the Timing Fit\n";
859  }
860 
861  }
862  return ReadmittedPixels > 0;
863 }
864 
865 
871 bool
872 FdAxisFinder::RejectPixel(fevt::Eye& eye)
873 {
874  int RejectedPixels = 0;
875  double residue_max = 0;
876  int residue_max_pixid = -1;
877  int residue_max_telid = -1;
878 
879  CoordinateSystemPtr eyeCS =
880  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetEyeCoordinateSystem();
881  const fdet::FTimeFitModel& timeFitModel = fdet::FTimeFitModel::GetInstance();
882  int eyeID = eye.GetId();
883  double sdpTheta = fSDP.GetTheta(eyeCS);
884 
885  EyeRecData& eyerecdata = eye.GetRecData();
886 
887  //-------------------------------------------
888  // Loop to Get the pixel that has the
889  // biggest timing chisq
890  for (EyeRecData::PixelIterator iter = eyerecdata.TimeFitPixelsBegin();
891  iter != eyerecdata.TimeFitPixelsEnd(); ++iter) {
892 
893  const fevt::Pixel& evtpixel = *iter;
894  // Estimating the contribution of each pixel to the
895  // time chisq (chisq_i).
896  // loading the pixel information
897  const int telid = evtpixel.GetTelescopeId();
898  const double t_i = evtpixel.GetRecData().GetT_i().GetNanoSecond();
899  const double t_i_Err = evtpixel.GetRecData().GetT_iError().GetInterval();
900  const double chi_i = evtpixel.GetRecData().GetChi_i();
901 
902  const double t_expected =
903  timeFitModel.GetTimeAtAperture(fT0,fRp,fChi0,chi_i,sdpTheta,eyeID,telid);
904 
905  const double temp = t_i - t_expected;
906  const double time_residue = temp / t_i_Err;
907  if (fDebuging == 1)
908  cout << "time chisq_i: " << (temp * temp ) / (t_i_Err * t_i_Err) << " pixelid " << evtpixel.GetId()
909  << " delta t: " << temp << " ti error: " << t_i_Err << " N Sigmas away: " << time_residue << "\n";
910 
911  if ( fabs(time_residue) > residue_max) {
912  residue_max = fabs(time_residue);
913  residue_max_pixid = evtpixel.GetId();
914  residue_max_telid = telid;
915  }
916  }
917  //----End find pixel with biggest time chisq
918 
919  //---------------------------------------------
920  //Rejecting the pixel that may have bad pulse centroid
921  //----------------------------------------------
922  // if the pixel with the biggest contribution to the
923  // time chisq is more than fSigmasLimit away it will be removed.
924  // If there are only 3 pixels or less, no pixel is removed.
925  //-----------------------------------------------------
926 
927 
928  if (residue_max > fSigmasLimit && eyerecdata.GetNTimeFitPixels() > 3) {
929 
930  for (EyeRecData::PixelIterator iter = eyerecdata.TimeFitPixelsBegin();
931  iter != eyerecdata.TimeFitPixelsEnd(); ) {
932 
933  const fevt::Pixel& evtpixel = *iter;
934  // loading the pixel information
935  const int telid = evtpixel.GetTelescopeId();
936  const int pixid = evtpixel.GetId();
937  if (telid == residue_max_telid && pixid == residue_max_pixid) {
938  iter = eyerecdata.RemoveTimeFitPixel(iter);
939  RejectedPixels++;
940  break;
941  } else
942  ++iter;
943  }
944  }
945 
946  return RejectedPixels > 0;
947 }
948 
949 
950 void
951 FdAxisFinder::FindAxisLaser(fevt::Eye& eye)
952 {
953  const int npar = 2; // number of parameters
954 
955  TMinuit theMinuit(npar); // 2 parameter fit
956 
957  theMinuit.SetPrintLevel(-1); // minuit verbosity
958  theMinuit.SetFCN(FdAxisFinder::MinuitFitFuncLaser);
959 
960  double arglist[npar]; // arguments to pass to the Minuit interpreter
961  int ierflag = 0;
962 
963  arglist[0] = 1; // [up]
964  arglist[1] = 1; // unused
965  theMinuit.mnexcm("SET ERR", arglist, 1, ierflag);
966 
967  if (ierflag)
968  ERROR("Minuit SET ERR failed");
969 
970  static double vstart[npar]; // inital point
971  static double step[npar]; // step size
972 
973  // something better has to be found for starting points
974  vstart[0] = fChi0First;
975  vstart[1] = fT0First;
976 
977  step[0] = 0.001;
978  step[1] = 10;
979 
980  theMinuit.mnparm(0, "Chi0", vstart[0], step[0], 0, 0, ierflag);
981  theMinuit.mnparm(1, "T0", vstart[1], step[1], 0, 0, ierflag);
982 
983  arglist[0] = 3000; // [maxcalls]
984  arglist[1] = 1; // [tolerance]
985  theMinuit.mnexcm("MIGRAD", arglist, 2, ierflag);
986 
987  if (ierflag) {
988  ERROR("Minuit MIGRAD failed");
989  fMinuitFailed = true;
990  }
991  theMinuit.GetParameter(0, fChi0, fChi0Error);
992  theMinuit.GetParameter(1, fT0, fT0Error);
993 
994  //=========================================
995  //Estimating Rp using the SDP and fChi0
996 
997  //===========================================================
998  //Estimating Rp from the SDP and chi_0 and using the CLF
999  // location as core.
1000 
1001  CoordinateSystemPtr CS =
1002  det::Detector::GetInstance().GetSiteCoordinateSystem();
1003 
1004  const ReferenceEllipsoid &e = ReferenceEllipsoid::GetWGS84();
1005  //UTMPoint UTMclf(6095769.0,469378.0,1412.0,19,'H',e);
1006 
1007  //--------------------------------
1008  Point eyeposition =
1009  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetPosition();
1010  UTMPoint UTMeye(eyeposition, e);
1011  Point ThisEye = UTMeye.GetPoint(CS);
1012  //------------------------
1013 
1016 
1017  Point clf(0,0,0, clfCs);
1018  const UTMPoint UTMclf(clf, e);
1019  clf = UTMclf.GetPoint(CS);
1020 
1021  Point xlf(0,0,0, xlfCs);
1022  const UTMPoint UTMxlf(xlf, e);
1023  xlf = UTMxlf.GetPoint(CS);
1024 
1026 
1027  Point LaserFacility;
1028  if (fIsCeleste)
1029  LaserFacility = clf;
1030  if (fIsRamiro)
1031  LaserFacility = xlf;
1032 
1033  Vector vertical_eye(0,0,1, EyeCS);
1034  Vector eye_LaserFacility = LaserFacility - ThisEye;
1035 
1036  //----------------------------
1037 
1038  Vector horizontalInSDP = cross(fSDP,vertical_eye);
1039  horizontalInSDP /= horizontalInSDP.GetR(EyeCS);
1040  Transformation rot1 (Transformation::Rotation(-fChi0,fSDP, EyeCS));
1041  Vector LaserOrientation1 (rot1* horizontalInSDP);
1042  LaserOrientation1 /= LaserOrientation1.GetR(EyeCS);
1043 
1044  //---------------------------
1045  Vector newSDP = cross(eye_LaserFacility,LaserOrientation1);
1046 
1047  if (abs(newSDP.GetTheta(EyeCS) - fSDP.GetTheta(EyeCS)) < kPi/2)
1048  fSDP = newSDP;
1049  else
1050  fSDP = -newSDP;
1051 
1052  horizontalInSDP = cross(fSDP,vertical_eye);
1053  horizontalInSDP /= horizontalInSDP.GetR(EyeCS);
1054 
1055  Transformation rot2 (Transformation::Rotation(-fChi0,fSDP, EyeCS));
1056  Vector LaserOrientation (rot2* horizontalInSDP);
1057  LaserOrientation /= LaserOrientation.GetR(EyeCS);
1058 
1059  double beta = Angle(eye_LaserFacility, LaserOrientation);
1060 
1061  fRp = eye_LaserFacility.GetR(EyeCS) * sin(beta);
1062 
1063  //=====================================
1064 
1065  if (fDebuging == 1) {
1066  cout << "TO " << fT0 << " +/- " << fT0Error << "\n"
1067  "ChiO " << fChi0/degree << " +/- " << fChi0Error/degree << "\n"
1068  "Rp " << fRp << " +/- " << fRpError << endl;
1069  }
1070 
1071  fChi2 = theMinuit.fAmin;
1072 }
1073 
1074 
1075 bool
1076 FdAxisFinder::CheckForLasers(evt::Event& event)
1077 {
1078  bool ItIsLaser = false;
1079 
1080  //=====================================
1081  // Check the GPSNanoSecond
1082  // (0.5 Seconds is CLF)
1083  // (0.7 Seconds is XLF)
1084  const evt::Header& header = event.GetHeader();
1085  const TimeStamp time = header.GetTime();
1086  long int GPSNano = time.GetGPSNanoSecond();
1087  int MaxDiff = 500000;
1088  bool IsCLFLaser = false;
1089  bool IsXLFLaser = false;
1090 
1091  // hybrid lasers for SD/FD time synchronization
1092  if (fSelectAndRecLasers == 1) {
1093  if (fabs(GPSNano - 500000000) < MaxDiff)
1094  IsCLFLaser = true;
1095  if (fabs(GPSNano - 700000000) < MaxDiff)
1096  IsXLFLaser = true;
1097 
1098  if (IsCLFLaser || IsXLFLaser)
1099  ItIsLaser = true;
1100  else
1101  return ItIsLaser;
1102  }
1103 
1104  // vertical lasers for aerosol measurements
1105  if (fSelectAndRecLasers == 2) {
1106  if (fabs(GPSNano - 250000000) < MaxDiff) {
1107  IsCLFLaser = true;
1108  fIsCeleste = true;
1109  ItIsLaser = true;
1110  return ItIsLaser;
1111  } else if (fabs(GPSNano - 350000000) < MaxDiff) {
1112  IsXLFLaser = true;
1113  fIsRamiro = true;
1114  ItIsLaser = true;
1115  return ItIsLaser;
1116  } else {
1117  ItIsLaser = false;
1118  return ItIsLaser;
1119  }
1120  }
1121  //=======================================================
1122  //======================================================================
1123  // Check whether the CLF or the XLF have trigered Celeste or Ramiro stations
1124 
1125  if (!event.HasSEvent()) {
1126  cout << " don't have SEvent" << endl;
1127  return false;
1128  }
1129  sevt::SEvent& sevent = event.GetSEvent();
1131 
1132  fIsCeleste = false;
1133  fIsRamiro = false;
1134 
1135  for (sditer = sevent.StationsBegin(); sditer != sevent.StationsEnd(); ++sditer) {
1136  sevt::Station& station = *sditer;
1137 
1138  if (!sditer->HasRecData())
1139  sditer->MakeRecData();
1140 
1141  if (!sditer->HasRecData())
1142  continue;
1143 
1144  if (station.IsCandidate() && station.GetId() == 203)
1145  fIsCeleste = true;
1146  if (station.IsCandidate() && station.GetId() == 805)
1147  fIsRamiro = true;
1148  }
1149 
1150  cout << "\n"
1151  "==============================================\n"
1152  "\n"
1153  "\n";
1154  if (fIsCeleste && IsCLFLaser) {
1155  cout << " This is a CLF event\n";
1156  ItIsLaser = true;
1157  }
1158  if (fIsRamiro && IsXLFLaser) {
1159  cout << " This is a XLF event\n";
1160  ItIsLaser = true;
1161  }
1162  if (!(fIsCeleste && IsCLFLaser) && !(fIsRamiro && IsXLFLaser)) {
1163  cout << " This is NOT a hybrid laser event\n"
1164  " (skipping event)\n";
1165  ItIsLaser = false;
1166  }
1167  cout << "\n"
1168  "\n"
1169  "==============================================\n"
1170  "\n"
1171  "\n";
1172 
1173  //-------------------
1174  return ItIsLaser;
1175 }
AxialVector cross(const Vector &l, const Vector &r)
vector cross product
Definition: OperationsAV.h:32
Telescope & GetTelescope(const unsigned int telescopeId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Retrieve Telescope by Id, throw exception if not existent.
Definition: FEvent/Eye.cc:57
Branch GetTopBranch() const
Definition: Branch.cc:63
AxialVector Cross(const Vector &l, const Vector &r)
Definition: OperationsAV.h:25
unsigned int GetId() const
Definition: FEvent/Eye.h:54
PixelIterator RemoveTimeFitPixel(PixelIterator it)
Remove a pixel from the list of Time Fit pixels.
Definition: EyeRecData.h:180
const utl::Vector & GetDirection() const
pointing direction of this pixel
double GetChi_i() const
Definition: PixelRecData.h:117
void SetChiZero(const double chiZero, const double error)
Definition: EyeRecData.h:237
StationIterator StationsEnd()
End of all stations.
Definition: SEvent.h:59
int GetId() const
Get the station Id.
void Normalize()
Definition: Vector.h:64
const double degree
Point object.
Definition: Point.h:32
void SetModel(const Model m)
Definition: FTimeFitModel.h:32
double Angle(const double theta1, const double phi1, const double theta2, const double phi2)
Description of the electronic channel for the 480 channels of the crate.
double GetPhi(const CoordinateSystemPtr &coordinateSystem) const
azimuth (phi) angle in spherical and cylindrical coordinates
Definition: BasicVector.h:254
unsigned int GetTimeOffset() const
Time offset of this Telescope compared to fevt::Header::GetTime [ns].
bool HasRecData() const
Definition: FEvent/Eye.h:116
Fluorescence Detector Eye Event.
Definition: FEvent/Eye.h:29
PixelIterator PulsedPixelsEnd()
Definition: EyeRecData.h:121
bool HasFEvent() const
double GetR(const CoordinateSystemPtr &coordinateSystem) const
radius r in spherical coordinates coordinates (distance to origin)
Definition: BasicVector.h:257
Interface class to access to the SD part of an event.
Definition: SEvent.h:39
double GetTheta(const CoordinateSystemPtr &coordinateSystem) const
zenith (theta) angle in spherical coordinates
Definition: BasicVector.h:248
Class to hold and convert a point in geodetic coordinates.
Definition: UTMPoint.h:40
fRp(t.GetRp())
double GetCentroidError() const
Definition: PixelRecData.h:79
void SetCorePosition(const utl::Point &core)
EyeIterator EyesEnd(const ComponentSelector::Status status)
Definition: FEvent.h:66
const double meter
Definition: GalacticUnits.h:29
void SetTimeFitCorrelations(double rRpT0, double rRpChi0, double rChi0T0)
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
void SetT_i(const double t_i, const double error)
Definition: PixelRecData.h:119
void SetTimeFitCorrelations(const double rRpT0, const double rRpChi0, const double rChi0T0)
Definition: EyeRecData.h:243
void SetRp(const double rp, const double error)
Definition: EyeRecData.h:239
const unsigned int npar
Definition: UnivRec.h:75
void Init()
Initialise the registry.
Detector description interface for Eye-related data.
Definition: FDetector/Eye.h:45
boost::filter_iterator< ComponentSelector, AllEyeIterator > EyeIterator
selective Eye iterators
Definition: FEvent.h:55
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Definition: Branch.cc:211
PixelIterator PulsedPixelsBegin()
Definition: EyeRecData.h:119
double GetMag() const
Definition: Vector.h:58
bool IsCandidate() const
Check if the station is a candidate.
A TimeStamp holds GPS second and nanosecond for some event.
Definition: TimeStamp.h:110
boost::indirect_iterator< ConstInternalPixelIterator, const Pixel & > ConstPixelIterator
Const iterator over pixels used in reconstruction.
Definition: EyeRecData.h:117
const utl::TimeStamp & GetTime() const
Definition: Event/Header.h:33
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
unsigned int GetId() const
Definition: FEvent/Pixel.h:31
Class representing a document branch.
Definition: Branch.h:107
class to hold data at Station level
void MakeFRecShower()
Allocate reconstructed shower info.
Definition: EyeRecData.cc:58
Reference ellipsoids for UTM transformations.
PixelIterator SDPPixelsBegin()
Definition: EyeRecData.h:139
Fluorescence Detector Pixel event.
Definition: FEvent/Pixel.h:28
double GetX(const CoordinateSystemPtr &coordinateSystem) const
Definition: BasicVector.h:206
void SetCoreTime(const utl::TimeStamp &coreTime, const utl::TimeInterval &coreTimeErr)
const double ns
utl::CoordinateSystemPtr GetEyeCoordinateSystem() const
Returns the Eye Coordinate system.
TelescopeIterator TelescopesEnd()
first available tel of status eHasData (DEPRECATED)
Definition: FEvent/Eye.cc:230
utl::TimeInterval GetT_i() const
Definition: PixelRecData.h:124
constexpr double kPi
Definition: MathConstants.h:24
void SetAxis(const utl::Vector &axis)
double abs(const SVector< n, T > &v)
Active transformations of geometrical objects.
bool HasFRecShower() const
Check if reconstructed shower info has been allocated.
Definition: EyeRecData.h:330
evt::ShowerFRecData & GetFRecShower()
Reconstructed shower info for this eye.
Definition: EyeRecData.h:323
EyeIterator EyesBegin(const ComponentSelector::Status status)
Definition: FEvent.h:58
void SetChiZero(const double chiZero, const double error)
void SetTimeFitChiSquare(const double tfitChi2, const unsigned int ndof)
Definition: EyeRecData.h:232
Telescope-specific shower reconstruction data.
boost::filter_iterator< ComponentSelector, AllTelescopeIterator > TelescopeIterator
selective Telescope iterators
Definition: FEvent/Eye.h:72
#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
fRpError(t.GetRpError())
Top of Fluorescence Detector event hierarchy.
Definition: FEvent.h:33
Eye-specific shower reconstruction data.
Definition: EyeRecData.h:65
TelescopeIterator TelescopesBegin()
first available tel of status eHasData (DEPRECATED)
Definition: FEvent/Eye.cc:207
double GetInterval() const
Get the time interval as a double (in Auger base units)
Definition: TimeInterval.h:69
const utl::AxialVector & GetSDP() const
Definition: EyeRecData.h:75
unsigned int GetTelescopeId() const
Definition: FEvent/Pixel.h:32
void MakeRecData()
Make station reconstructed data object.
unsigned int GetNTimeFitPixels() const
Get number of Time Fit pixels.
Definition: EyeRecData.h:184
boost::indirect_iterator< InternalPixelIterator, fevt::Pixel & > PixelIterator
Iterator over pixels used in reconstruction.
Definition: EyeRecData.h:113
double GetY(const CoordinateSystemPtr &coordinateSystem) const
Definition: BasicVector.h:209
constexpr double kSpeedOfLight
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
fSDP(t.GetSDP())
double GetFADCBinSize() const
double GetGPSNanoSecond() const
GPS nanosecond.
Definition: TimeStamp.h:127
void SetTZero(const double tzero, const double error)
StationIterator StationsBegin()
Beginning of all stations.
Definition: SEvent.h:57
double GetTotalCharge() const
integrated pulse charge
Definition: PixelRecData.h:68
Description of a pixel.
void SetTimeFitChiSquare(const double tfitChi2, const unsigned int ndof)
PixelIterator TimeFitPixelsEnd()
Definition: EyeRecData.h:171
Vector object.
Definition: Vector.h:30
Interface class to access to Fluorescence reconstruction of a Shower.
void SetRp(const double rp, const double error)
utl::TimeInterval GetT_iError() const
Definition: PixelRecData.h:125
boost::indirect_iterator< InternalStationIterator, Station & > StationIterator
Iterator over all stations.
Definition: SEvent.h:52
utl::CoordinateSystemPtr Get(const std::string &id)
Get a well-known Coordinate System.
double GetTimeAtAperture(const double t0, const double rp, const double chi0, const double chi_i, const double thetaSDP, const int eye, const int tel) const
void SetTZero(const double tzero, const double error)
Definition: EyeRecData.h:235
PixelIterator SDPPixelsEnd()
Definition: EyeRecData.h:143
void AddTimeFitPixel(fevt::Pixel &pixel)
add a pixel to the list of Time Fit pixels
Definition: EyeRecData.h:177
double GetNanoSecond() const
Get integer number of nanoseconds past seconds boundary.
Definition: TimeInterval.cc:25
double GetCentroid() const
Definition: PixelRecData.h:78
static Policy::type Create(const utl::Point &theOrigin)
Create the standard local coordinate system for a Point.
PixelIterator TimeFitPixelsBegin()
Definition: EyeRecData.h:167
Point GetPoint(const CoordinateSystemPtr &theCS=CoordinateSystemPtr()) const
Get a cartesian point from an UTMPoint.
Definition: UTMPoint.cc:45
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165
constexpr double m
Definition: AugerUnits.h:121
Fluorescence Detector Pixel Reconstructed Data.
Definition: PixelRecData.h:27
bool HasSEvent() const
void SetChi_i(const double chi_i)
Definition: PixelRecData.h:114
PixelRecData & GetRecData()
Definition: FEvent/Pixel.h:40
Global event header.
Definition: Event/Header.h:27
fevt::EyeRecData & GetRecData()
Reconstructed data for this eye.
Definition: FEvent/Eye.cc:130

, generated on Tue Sep 26 2023.