HybridGeometryFinderOG/HybridGeometryFinder.cc
Go to the documentation of this file.
1 
9 #include <iostream>
10 #include <fstream>
11 #include <iomanip>
12 #include <algorithm>
13 
14 #include <fwk/CentralConfig.h>
15 #include <fwk/CoordinateSystemRegistry.h>
16 #include <fwk/LocalCoordinateSystem.h>
17 
18 #include <utl/Reader.h>
19 #include <utl/ErrorLogger.h>
20 #include <utl/MathConstants.h>
21 #include <utl/PhysicalConstants.h>
22 #include <utl/Transformation.h>
23 #include <utl/TimeStamp.h>
24 #include <utl/Point.h>
25 #include <utl/UTMPoint.h>
26 #include <utl/ReferenceEllipsoid.h>
27 #include <utl/Math.h>
28 
29 #include <evt/Event.h>
30 #include <evt/ShowerFRecData.h>
31 #include <evt/ShowerRecData.h>
32 #include <evt/ShowerSRecData.h>
33 
34 #include <fevt/FEvent.h>
35 #include <fevt/Eye.h>
36 #include <fevt/Telescope.h>
37 #include <fevt/Pixel.h>
38 #include <fevt/PixelRecData.h>
39 #include <fevt/EyeRecData.h>
40 #include <fevt/TelescopeRecData.h>
41 #include <fevt/EyeHeader.h>
42 
43 #include <det/Detector.h>
44 
45 #include <fdet/FDetector.h>
46 #include <fdet/Eye.h>
47 #include <fdet/Telescope.h>
48 #include <fdet/Channel.h>
49 #include <fdet/Pixel.h>
50 #include <fdet/FTimeFitModel.h>
51 
52 
53 #include <sevt/SEvent.h>
54 #include <sevt/Station.h>
55 #include <sevt/StationTriggerData.h>
56 #include <sevt/StationRecData.h>
57 #include <sevt/EventTrigger.h>
58 
59 #include <sdet/SDetector.h>
60 #include <sdet/Station.h>
61 
62 #include "HybridGeometryFinder.h"
63 
64 //debug
65 #include <TCanvas.h>
66 #include <TF1.h>
67 #include <TGraph.h>
68 #include <TFile.h>
69 #include <TMinuit.h>
70 
71 using namespace std;
72 using namespace fwk;
73 using namespace utl;
74 using namespace fevt;
75 using namespace evt;
76 using namespace HybridGeometryFinderOG;
77 using namespace sevt;
78 
79 
80 fevt::Eye* HybridGeometryFinder::fCurEye = 0;
81 evt::Event* HybridGeometryFinder::fCurEvent = 0;
82 
83 double HybridGeometryFinder::fDistanceStationSDP = 2000.;
84 double HybridGeometryFinder::fVerticalCurvature = 0.;
85 int HybridGeometryFinder::fHotStationId = 1;
86 int HybridGeometryFinder::fround = 1;
87 int HybridGeometryFinder::fTriggeredStations = 1;
88 double HybridGeometryFinder::fSdHybridOffset = 0;
89 double HybridGeometryFinder::fStationAxisDistance = 9999.9;
90 double HybridGeometryFinder::fsignal_max = 0;
91 double HybridGeometryFinder::fsignal_max_pre = 0;
92 
93 
94 int HybridGeometryFinder::fHybridCore = 0;
95 int HybridGeometryFinder::fDebuging = 0;
96 double HybridGeometryFinder::fChi2TimeFit =0;
97 int HybridGeometryFinder::fNDofTimeFit =0;
98 double HybridGeometryFinder::fNsCorrection=0;
99 int HybridGeometryFinder::fCeleste =0;
101 
102 //FS (June 2007): check for Minuit convergence
103 bool HybridGeometryFinder::fFoundAxis=false;
104 
105 
107 
108  CentralConfig* cc = CentralConfig::GetInstance();
109 
110  Branch topB =
111  cc->GetTopBranch("HybridGeometryFinder");
112 
113 
114  topB.GetChild("ForDebug").GetData(fDebuging);
115  topB.GetChild("DistanceStationSDP").GetData(fDistanceStationSDP);
116  topB.GetChild("VerticalCurvature").GetData(fVerticalCurvature);
117  topB.GetChild("tolerance").GetData(fTolerance);
118  topB.GetChild("sigmasLimit").GetData(fSigmasLimit);
119  topB.GetChild("UseNthStation").GetData(fUseNthStation);
120  if ( fUseNthStation == 0 ) fOptimize = true;
121  else fOptimize = false;
122 
123  int timeFitModelSwitch;
124  topB.GetChild("TimeFitModel").GetData(timeFitModelSwitch);
125 
126  fdet::FTimeFitModel& timeFitModel = fdet::FTimeFitModel::GetInstance();
127  switch (timeFitModelSwitch)
128  {
129  case 0:
131  break;
132  case 1:
134  break;
135  default:
136  ERROR("Invalid input parameter for TimeFitModel");
137  return eFailure;
138  }
139 
140  // info output
141  ostringstream info;
142  info << " Version: "
143  << GetVersionInfo(VModule::eRevisionNumber) << "\n"
144  << " Parameters:\n"
145  << "\ttank distance to sdp: " << fDistanceStationSDP/m << " m\n"
146  << "\t vertical curvature: " << fVerticalCurvature*m << " m^(-1) "
147  << "\ttime fit uses " << timeFitModel.GetModelName() << "\n";
148  INFO(info);
149 
150  return eSuccess;
151 }
152 
153 
154 VModule::ResultFlag HybridGeometryFinder::Run(evt::Event& event){
155 
156  INFO("HybridGeometryFinder::Run()");
157 
158  if (!event.HasSEvent())
159  return eSuccess;
160 
161  if (!event.HasFEvent())
162  return eContinueLoop;
163 
164  //sevt::SEvent& sevent = event.GetSEvent();
165 
166  fevt::FEvent& fevent = event.GetFEvent();
167 
169 
170 
171  for (eyeiter = fevent.EyesBegin(ComponentSelector::eHasData);
172  eyeiter != fevent.EyesEnd(ComponentSelector::eHasData);
173  ++eyeiter){
174 
175 
176  fevt::Eye& eye = *eyeiter;
177 
178  // skip virtual eyes
179  if (det::Detector::GetInstance().GetFDetector().GetEye(eye).IsVirtual())
180  continue;
181 
182  CoordinateSystemPtr eyeCS =
183  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetEyeCoordinateSystem();
184 
185  if (!eye.HasRecData())
186  continue;
187  fevt::EyeRecData& eyerecdata = eye.GetRecData();
188 
189  if (eyerecdata.GetNPulsedPixels() < 3) {
190  cout << "This eye "<<eye.GetId()<<" has only "<<
191  eyerecdata.GetNPulsedPixels()<<" pixels with pulse \n";
192  continue;
193  }
194 
195  if (!eyerecdata.GetSDP().GetMag2()) {
196  WARNING("This eye has no SDP!");
197  continue;
198  }
199 
200  bool FirstGoodSt = false;
201  int nHybridStations = 0;
202  int UseStation = 0;
203  fSDP = eyerecdata.GetSDP();
204  fChi0 = eyerecdata.GetChiZero();
205  fT0 = eyerecdata.GetTZero();
206  fRp = eyerecdata.GetRp();
207 
208  //-------------------------------
209  // If reconstructing lasers a correction of +180 ns
210  // is required to apply to the FD time.
211  // The time for the light propagation from the
212  // CLF to Celeste is approximately ~180 ns.
213 
214  fNsCorrection = 0;
215  if (fCeleste == 1)
216  fNsCorrection = 180;
217  //--------------------------------------
218 
219 
220  fCurEye = &eye; // acrobacy for TMinuit
221  fCurEvent = &event; // acrobacy for TMinuit
222 
223 
224  cout<<"Calling FindAxisHybrid (fHybridCore = 1)"<<"\n";
225  //-----------------------------------------
226  // This procedure will find the shower axis
227  // minimizing the station-core distance.
228  // (considering the station with the greater signal).
229  // this step will help to avoid
230  // finding a local minimum.
231  fsignal_max = 90000000.0;
232  fround = 1;
233  fHybridCore = 1;
234  if(this->FindAxisHybrid(eye))
235  fFoundAxis=true;
236 
237  cout<<"Calling FindAxisHybrid (fHybridCore = 0)"<<"\n";
238 
239 
240 
241  //---------------------------------------------------
242  // This procedure will find the shower axis
243  // using the SD/FD times. The first guess
244  // parameters are taking from the previous step.
245  fHybridCore = 0;
246  if(this->FindAxisHybrid(eye))
247  fFoundAxis=true;
248 
249 
250 
251  // If the hybrid reconstruction failed try changing the
252  // Chi0 first guess. Sometimes nearby inclined showers are
253  // confused with upgoing showers. Reseting the first guess
254  // helps correcting it.
255 
256  if ( (fChi0 <= 0. || fChi0 > kPi ) && fStationAxisDistance > fDistanceStationSDP) {
257  fChi0 = 90 * degree;
258  fRp = 2000.;
259  fHybridCore = 1;
260  if(this->FindAxisHybrid(eye))
261  fFoundAxis=true;
262 
263  fHybridCore = 0;
264  if(this->FindAxisHybrid(eye))
265  fFoundAxis=true;
266  }
267 
268 
269 
270  //------------------------------------
271  // Checking whether the station used for the hybrid
272  // reconstruction is the right one to use
273 
274 
275  cout<<"\n";
276  cout<<"The total number of potential good stations is: "<<fTriggeredStations<<"\n";
277  cout<<"(stations within "<<fDistanceStationSDP<<"m from the SDP)"<<"\n";
278  cout<<"\n";
279 
280  //---------------------------------------
281  //Checking whether the tank used for the
282  //hybrid reconstruction gives a sencible
283  //hybrid reconstruction.
284 
285  //The sd/fd offset (after the minization) has to
286  //be smaller than 200ns.
287  //The distance from the station to the SDP has
288  //to be smaller than fDistanceStationSDPm.
289  //The normilized time fit chisq has to be smaller than 50.
290 
291  // If any of these conditions is not satisfied, the program
292  // will try the hybrid reconstruction with the next hottest
293  // tank (if available).
294  //----------------------------------------------------
295 
296  if (fTriggeredStations != 0) {
297  cout<<"\n";
298  cout<<"Tank with greatest signal: "<<fHotStationId<<"\n";
299  cout<<" fSdHybridOffset "<<fSdHybridOffset<<"\n";
300  cout<<" fStationAxisDistance "<<fStationAxisDistance<<"\n";
301  cout<<" TimeFitChiSquare/dof "<<fChi2TimeFit<<" / "<<fNDofTimeFit<<"\n";
302  cout<<"\n";
303  } else {
304  cout<<"\n";
305  cout<<" There is not any station close to the \n";
306  cout<<" SDP projection on the ground. Let's try \n";
307  cout<<" another eye if available. Otherwise \n";
308  cout<<" hybrid geometry finder has finished with this event \n";
309  cout<<"\n";
310  continue;
311  }
312 
313  if ( fNDofTimeFit == 0 ) continue; //This eye do not have enough information
314  // continue with other eye.
315 
316 
317  bool GoodHybrid = true;
318  if ( fabs(fSdHybridOffset) > 200. || //Cheking if the tested
319  fStationAxisDistance > fDistanceStationSDP || //station makes a hybrid
320  fChi2TimeFit/fNDofTimeFit > 50. ) //event
321  GoodHybrid = false;
322  else
323  {
324  nHybridStations++;
325  }
326 
327 
328  if ( nHybridStations == 0 && fround == fTriggeredStations ) {
329  cout<<" This event doesn't have any station consistent"<<" \n";
330  cout<<" with the FD time and geometry."<<" \n";
331  cout<<" from Eye: "<<eye.GetId()<<"\n";
332  cout<<"\n";
333  cout<<"No tank ( last tank tested "<<fHotStationId
334  <<") was consistent with the FD geometry and timing "<<"\n";
335  cout<<" fSdHybridOffset "<<fSdHybridOffset<<"\n";
336  cout<<" fStationAxisDistance "<<fStationAxisDistance<<"\n";
337  cout<<" TimeFitChiSquare/dof "<<fChi2TimeFit<<"/"<<fNDofTimeFit<<"\n";
338  cout<<" This was the trial number: "<<fround - 1<<"\n";
339  continue;
340  }
341  fsignal_max = fsignal_max_pre;
342 
343  //--------------------------------
344  // Forcing to reconstruct with the first
345  // and second hot station and choose the
346  // station that produces the smaller time
347  // time fit chisqr.
348  if ( fOptimize) {
349  if ( GoodHybrid ) {
350  fChi0_test[0] = fChi0;
351  fChi0Error_test[0] = fChi0Error;
352  fT0_test[0] = fT0;
353  fT0Error_test[0] = fT0Error;
354  fRp_test[0] =fRp ;
355  fRpError_test[0] = fRpError;
356  fChi2TimeFit_test[0] = fChi2TimeFit;
357  fNDofTimeFit_test[0] = fNDofTimeFit;
358  fHotStationId_test[0] = fHotStationId;
359  fround_test[0] = fround;
360  for ( int i = 0; i < 3; i++)
361  for ( int j = 0; j < 3; j++)
362  fCovariance_test1[i][j] = fCovariance[i][j];
363 
364  fUseNthStation = 2;
365  }
366  else {
367  fChi2TimeFit_test[0] = -999.0;
368  fUseNthStation = 1;
369  }
370  }
371 
372  //-------------------------------
373 
374  //-------------------------------------------------
375  // the following if statement is to force the reconstruction
376  // with the fUseNthStation hottest station (if any available)
377 
378  if (fround < fUseNthStation )
379  GoodHybrid = false;
380  //-----------------------------------------------
381 
382  if ( fUseNthStation > 1 && !fOptimize ) {
383  cout<<"\n";
384  cout<<"This hybrid reconstruction is forced to use the "<<fUseNthStation<<"the hottest station (if available)"<<"\n";
385  }
386 
387  if ( fUseNthStation > 1 && fOptimize ) {
388  cout<<"\n";
389  cout<<"Now checking the second hot station (if available)"<<"\n";
390  }
391 
392 
393  //Cheking if other stations can make a hybrid event
394  while ( !GoodHybrid && fTriggeredStations > fround )
395  {
396  fround++;
397  if( fDebuging == 1) {
398  cout << "\n";
399  cout << "The tank with greatest signal ("<<fHotStationId<<") "<<"\n";
400  cout << "the hybrid reconstruction: "<<"\n";
401  cout << " fSdHybridOffset "<<fSdHybridOffset<<"\n";
402  cout << " fStationAxisDistance "<<fStationAxisDistance<<"\n";
403  cout << " TimeFitChiSquare/dof "<<fChi2TimeFit<<" / "<<fNDofTimeFit<<"\n";
404  cout << "We will try the "<<"\n";
405  cout << "reconstruction with the next tank with the greatest \n";
406  cout << "signal. This is the trial number: "<<fround<<"\n";
407  }
408  //-----------------------------------------
409  // This procedure will find the shower axis
410  // minimizing the station-core distance.
411  // (considering the station with the greater signal).
412  // this step will help to avoid
413  // finding a local minimum.
414  fHybridCore = 1;
415  cout<<"Calling FindAxisHybrid (fHybridCore = 1)"<<" round:" <<fround<<"\n";
416  // fround tells FindAxisHybrid whether to use the hottest
417  // or the second , or the third (etc) hottest tank.
418  if(this->FindAxisHybrid(eye))
419  fFoundAxis=true;
420 
421 
422  //---------------------------------------------------
423  // This procedure will find the shower axis
424  // using the SD/FD times. The first guess
425  // parameters are taking from the previous step.
426 
427  fHybridCore = 0;
428  cout<<"Calling FindAxisHybrid (fHybridCore = 0)"<<" round:"<<fround<<"\n";
429  if(this->FindAxisHybrid(eye))
430  fFoundAxis=true;
431 
432 
433  // If the hybrid reconstruction failed try changing the
434  // Chi0 first guess. Sometimes near by inclined showers are
435  // confused with upgoing showers. Reseting the first guess
436  // helps correcting it.
437 
438  if ( (fChi0 <= 0. || fChi0 > kPi ) && fStationAxisDistance > fDistanceStationSDP) {
439  fChi0 = 90 * degree;
440  fRp = 2000.;
441  fHybridCore = 1;
442  if(this->FindAxisHybrid(eye))
443  fFoundAxis=true;
444  fHybridCore = 0;
445  if(this->FindAxisHybrid(eye))
446  fFoundAxis=true;
447  }
448 
449  //----------------------------
450 
451  if ( fabs(fSdHybridOffset) > 200 ||
452  fStationAxisDistance > fDistanceStationSDP ||
453  fChi2TimeFit/fNDofTimeFit > 50 ) {
454  cout<<" Station "<<fHotStationId<<" is not consistent \n";
455  cout<<" with the FD event \n";
456  fsignal_max = fsignal_max_pre;
457  }
458  else {
459  cout<<"The tank with greatest signal ("<<fHotStationId<<") "<<"\n";
460  cout<<"the hybrid reconstruction: "<<"\n";
461  cout<<" fSdHybridOffset "<<fSdHybridOffset<<"\n";
462  cout<<" fStationAxisDistance "<<fStationAxisDistance<<"\n";
463  cout<<" TimeFitChiSquare/dof "<<fChi2TimeFit<<" / "<<fNDofTimeFit<<"\n";
464  cout<<"\n";
465  nHybridStations++;
466  if (fround < fUseNthStation ) {
467  cout<<" this is a good station ("<<fHotStationId <<"), but we will force the \n";
468  cout<<" reconstruction using the "<<fUseNthStation<<"th hottest station. \n";
469 
470  fsignal_max = fsignal_max_pre;
471  continue;
472  }
473  else {
474  GoodHybrid = true;
475  break;
476  }
477  }
478  if ( !GoodHybrid && fround == fTriggeredStations ) {
479  cout<<" This event doesn't have any station consistent"<<" \n";
480  cout<<" with the FD time and geometry."<<" \n";
481  cout<<"\n";
482  cout<<"No tank ( last tank tested "<<fHotStationId
483  <<") was consistent with the FD geometry and timing "<<"\n";
484  cout<<" fSdHybridOffset "<<fSdHybridOffset<<"\n";
485  cout<<" fStationAxisDistance "<<fStationAxisDistance<<"\n";
486  cout<<" TimeFitChiSquare/dof "<<fChi2TimeFit<<"/"<<fNDofTimeFit<<"\n";
487  cout<<"This was the trial number: "<<fround - 1<<"\n";
488  break;
489  }
490  }
491 
492 
493  //=====================================
494  if ( fOptimize) {
495 
496  if ( GoodHybrid ) {
497  fChi0_test[1] = fChi0;
498  fChi0Error_test[1] = fChi0Error;
499  fT0_test[1] = fT0;
500  fT0Error_test[1] = fT0Error;
501  fRp_test[1] = fRp;
502  fRpError_test[1] = fRpError;
503  fChi2TimeFit_test[1] = fChi2TimeFit;
504  fNDofTimeFit_test[1] = fNDofTimeFit;
505  fHotStationId_test[1] = fHotStationId;
506  fround_test[1] = fround;
507  for ( int i = 0; i < 3; i++)
508  for ( int j = 0; j < 3; j++)
509  fCovariance_test2[i][j] = fCovariance[i][j];
510 
511  }
512  else {
513  fChi2TimeFit_test[1] = -999.0;
514  }
515  }
516 
517  //------------------------------------
518  // Selecting which station to use
519  if ( nHybridStations == 0 ) continue;
520 
521  if (nHybridStations == 1)
522  if ( fChi2TimeFit_test[0] > 0. ) FirstGoodSt = true;
523 
524  if (nHybridStations == 2) {
525  if ( ( fChi2TimeFit_test[0]/fNDofTimeFit_test[0] <
526  (fChi2TimeFit_test[1]/fNDofTimeFit_test[1]) + 1.0 ) )
527  FirstGoodSt = true;
528  }
529 
530 
531  if (FirstGoodSt)
532  UseStation = 0;
533  else
534  UseStation = 1;
535 
536 
537  //-------------------------------------------------------------------------------
538  if ( fOptimize ) {
539 
540  fChi0 = fChi0_test[UseStation];
541  fChi0Error = fChi0Error_test[UseStation];
542  fT0 = fT0_test[UseStation];
543  fT0Error = fT0Error_test[UseStation];
544  fRp = fRp_test[UseStation];
545  fRpError = fRpError_test[UseStation];
546  fChi2TimeFit = fChi2TimeFit_test[UseStation];
547  fNDofTimeFit = fNDofTimeFit_test[UseStation];
548  fHotStationId = fHotStationId_test[UseStation];
549  fround = fround_test[UseStation];
550  for ( int i = 0; i < 3; i++)
551  {
552  for ( int j = 0; j < 3; j++)
553  {
554  if ( UseStation == 0 )
555  fCovariance[i][j] = fCovariance_test1[i][j];
556  else
557  fCovariance[i][j] = fCovariance_test2[i][j];
558  }
559  }
560 
561 
562 
563  if ( nHybridStations == 2 &&
564  fabs( fChi0_test[1]-fChi0_test[0] ) > 1.0 * degree &&
565  fabs( fChi2TimeFit_test[0] - fChi2TimeFit_test[1] ) < 0.5 ) {
566  cout<<" There are two ambigous geometries (similar time fit chisqr) \n";
567  cout<<" with a difference greater than 1.0 deg. \n";
568  cout<<" The profile reconstruction may help two identify \n";
569  cout<<" the correct geometry. This event should be \n";
570  cout<<" FLAGGED for further quality check. \n";
571  }
572 
573  }
574 
575 
576  //---------------------------------------
577  // Readmitting pixels according to the hybrid geometry
578  // and then rejecting outliers one by one
579  while( ReadmitPixel(eye) )
580  if(this->FindAxisHybrid(eye)) fFoundAxis=true;
581 
582 
583  while ( RejectPixel(eye) )
584  if(this->FindAxisHybrid(eye)) fFoundAxis=true;
585  //-----------------------------------------------------
586 
587 
588  if(!fFoundAxis) {
589  cerr << " FATAL ERROR in HybridGeometryFinder::FindAxisHybrid Minuit MIGRAD failed (Eye: "<<eye.GetId()<<"), try other Eye if available"<<endl;
590  continue;
591  }
592 
593  cout<<" number of pixels remaining "<<eyerecdata.GetNTimeFitPixels()<<"\n"; cout<<"\n";
594 
595  //--------------------------------------
596  // Defining the range for chi0 [-180,180]
597  // for down goin events chi0 [0,180]
598  // for up goin events chi0 [-180,0]
599  if ( abs (fChi0) > kPi ) {
600  fChi0 -= int ( fChi0 / (2* kPi) )* 2*kPi;
601  if ( fChi0 < 0 ) fChi0 += 2* kPi;
602  if ( fChi0 > kPi ) fChi0 -= 2*kPi;
603  }
604 
605  // catch some very rare crashs
606  if (fChi0 == 0 && fRp == 0 && fT0 == 0)
607  continue;
608 
609  //-----------------------------------------
610 
611  eyerecdata.SetChiZero(fChi0,fChi0Error);
612  eyerecdata.SetTZero(fT0,fT0Error);
613  eyerecdata.SetRp(fRp,fRpError);
614  eyerecdata.SetTimeFitChiSquare(fChi2TimeFit, fNDofTimeFit);
615 
616  cout<<"Timing-Chisqr / dof "<<fChi2TimeFit<<" / "<<fNDofTimeFit<<"\n";
617  cout<<"\n";
618  cout << " Chi0=" << fChi0/deg << " (" << fChi0Error/deg << ") deg "
619  << " Rp=" << fRp/m << " (" << fRpError/m << ") m "
620  << " T0=" << fT0/ns << " (" << fT0Error/ns << ") ns ";
621  cout<<"\n";
622 
623  ostringstream info;
624  info << " Chi0=" << fChi0/deg << " (" << fChi0Error/deg << ") deg "
625  << " Rp=" << fRp/m << " (" << fRpError/m << ") m "
626  << " T0=" << fT0/ns << " (" << fT0Error/ns << ") ns ";
627  INFO(info);
628  // correlation coefficiens
629 
630  const double rRpT0 = fCovariance[2][1]/fRpError/fT0Error;
631  const double rRpChi0 = fCovariance[2][0]/fRpError/fChi0Error;
632  const double rChi0T0 = fCovariance[0][1]/fChi0Error/fT0Error;
633 
634  eyerecdata.SetTimeFitCorrelations(rRpT0, rRpChi0, rChi0T0);
635 
636  //--------------------------------------------
637  // Also fill the TelescopeRecData with the same values
638  // since this module isn't able to deal with compound eyes
639  // that consist of telescopes at multiple different positions
640 
641  for (fevt::Eye::TelescopeIterator telIt = eye.TelescopesBegin(ComponentSelector::eHasData);
642  telIt != eye.TelescopesEnd(ComponentSelector::eHasData); ++telIt)
643  {
644  if (!telIt->HasRecData())
645  telIt->MakeRecData();
646  fevt::TelescopeRecData& telRecData = telIt->GetRecData();
647  telRecData.SetChiZero(fChi0, fChi0Error);
648  telRecData.SetTZero(fT0, fT0Error);
649  telRecData.SetRp(fRp, fRpError);
650  telRecData.SetTimeFitChiSquare(fChi2TimeFit, fNDofTimeFit);
651  telRecData.SetTimeFitCorrelations(rRpT0, rRpChi0, rChi0T0);
652  }
653 
654  //==========================================
655  // calculate from chi0, Rp the axis parameters.
656  Vector sdp = eyerecdata.GetSDP();
657  Vector vertical2(0,0,1,eyeCS);
658  Vector horizontalInSDP = cross(sdp,vertical2); // horizontal
659  horizontalInSDP.Normalize();
660  Transformation rot (Transformation::Rotation(-fChi0,sdp, eyeCS));
661  Vector axis (rot* horizontalInSDP); // apply rotation
662  axis.Normalize();
663  CoordinateSystemPtr siteCS =
664  det::Detector::GetInstance().GetSiteCoordinateSystem();
665  Vector core_eye_vec = fRp / sin( kPi - fChi0) * horizontalInSDP;
666  const Point& eyeposition =
667  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetPosition();
668  Point core = eyeposition + core_eye_vec;
669  //Setting the Axis parameters
670  if (!event.HasRecShower()) event.MakeRecShower();
671  ShowerRecData& recshower = event.GetRecShower();
672  recshower.SetAxis(axis);
673  recshower.SetCorePosition(core);
674  if (!eyerecdata.HasFRecShower())
675  eyerecdata.MakeFRecShower();
676  eyerecdata.GetFRecShower().SetAxis(axis);
677  eyerecdata.GetFRecShower().SetCorePosition(core);
678  eyerecdata.GetFRecShower().SetCoreTime(fCurEye->GetHeader().GetTimeStamp()-
679  TimeInterval(1000*100*ns),
680  fRp, fChi0, fT0);
681  eyerecdata.GetFRecShower().SetSDTimeResidual(fSdHybridOffset);
682  eyerecdata.GetFRecShower().AddStationId(fHotStationId);
683 
684  }// for eyeiter
685 
686 
687  return eSuccess;
688 }
689 
690 
691 bool
692 HybridGeometryFinder::FindAxisHybrid(fevt::Eye& /*eye*/)
693 {
694  const int npar = 3; // number of parameters
695 
696  TMinuit theMinuit(npar); // 3 parameter fit
697 
698  theMinuit.SetPrintLevel(-1); // minuit verbosity
699 
700  theMinuit.SetFCN(HybridGeometryFinder::MinuitFitFuncHybrid);
701 
702  double arglist[npar]; // arguments to pass to the Minuit interpreter
703  int ierflag =0;
704 
705  arglist[0]=1; // [up]
706  arglist[1]=1; // unused
707  theMinuit.mnexcm("SET ERR", arglist,1,ierflag);
708 
709  if (ierflag) ERROR ("Minuit SET ERR failed");
710 
711  static double vstart[npar]; // inital point
712  static double step[npar]; // step size
713 
714 
715 
716  vstart[0] = fChi0 ;
717  vstart[1] = fT0;
718  vstart[2] = fRp ;
719 
720  step[0]=0.001;
721  step[1]=10;
722  step[2]=10;
723 
724  theMinuit.mnparm(0,"Chi0",vstart[0], step[0],0,0,ierflag);
725  theMinuit.mnparm(1,"T0", vstart[1], step[1],0,0,ierflag);
726  theMinuit.mnparm(2,"Rp", vstart[2], step[2],0,0,ierflag);
727 
728 
729  //init function
730  arglist[0] = 1;
731  theMinuit.mnexcm("CALI", arglist, 1, ierflag);
732 
733  arglist[0]=1500; // [maxcalls]
734  arglist[1]=0.01; // [tolerance]
735  theMinuit.mnexcm("MIGRAD", arglist ,2,ierflag);
736 
737  if (ierflag) {
738  ERROR ("Minuit MIGRAD failed");
739  return false;
740  }
741 
742  theMinuit.mnexcm("HESSE", arglist, 2, ierflag);
743 
744  // Check the status of the covariance matrix
745  // if bad use MINOS
746  double fmin, fedm, errdef; // unused dummies
747  int npari, nparx; //unused dummies
748  int istat = 0;
749  theMinuit.mnstat(fmin, fedm, errdef, npari, nparx, istat);
750  if (istat < 3) { // no accurate covariance matrix
751  theMinuit.mnexcm("MINOS", arglist, 2, ierflag);
752  theMinuit.mnstat(fmin, fedm, errdef, npari, nparx, istat);
753  if (istat < 3)
754  WARNING("Neither HESSE nor MINOS found accurate covariance matrix");
755  }
756 
757  theMinuit.GetParameter(0,fChi0,fChi0Error);
758  theMinuit.GetParameter(1,fT0,fT0Error);
759  theMinuit.GetParameter(2,fRp,fRpError);
760  theMinuit.mnemat(&fCovariance[0][0],3);
761 
762  return true;
763 }
764 
765 
766 void
767 HybridGeometryFinder::MinuitFitFuncHybrid(int& /*npar*/, double* const /*gin*/,
768  double& value, double* const par,
769  const int iflag)
770 {
771  fevt::EyeRecData& recdata = fCurEye->GetRecData();
772 
773  double chisq =0;
774  double& chi_0 = par[0];
775  double& t_0 = par[1] ;
776  double& r_p = par[2] ;
777 
778  double sum_charge = 0;
779  double chisq_time = 0;
780  double chisq_hybrid = 0;
781 
782  const fdet::FTimeFitModel& timeFitModel = fdet::FTimeFitModel::GetInstance();
783 
784  static vector<double> t_i;
785  static vector<double> t_i_Err;
786  static vector<double> chi_i;
787  static vector<int> telID;
788  //static vector<double> charge; not used
789  static int eyeID;
790  static CoordinateSystemPtr eyeCS;
791  static Point eyeposition;
792  static Vector horizontalWithinSDP;
793 
794  if (iflag == 1) { // fnc init
795  t_i.clear();
796  t_i_Err.clear();
797  chi_i.clear();
798  telID.clear();
799 
800  eyeID = fCurEye->GetId();
801  eyeCS = det::Detector::GetInstance().GetFDetector().GetEye(*fCurEye).GetEyeCoordinateSystem();
802 
803  //get pixel data
804  for (EyeRecData::ConstPixelIterator pixelIter= recdata.TimeFitPixelsBegin();
805  pixelIter!=recdata.TimeFitPixelsEnd(); ++pixelIter){
806  const PixelRecData& pixrec = pixelIter->GetRecData();
807  telID.push_back(pixelIter->GetTelescopeId());
808 
809  t_i.push_back(pixrec.GetT_i().GetNanoSecond());
810  t_i_Err.push_back(pixrec.GetT_iError().GetInterval());
811  chi_i.push_back( pixrec.GetChi_i());
812  // charge.push_back(pixrec.GetTotalCharge());
813 
814 
815  }
816 
817  const Vector vertical(0,0,1,eyeCS,Vector::kCartesian);
818  horizontalWithinSDP = cross(fSDP, vertical);
819  horizontalWithinSDP /= horizontalWithinSDP.GetMag();
820 
821  eyeposition=det::Detector::GetInstance().GetFDetector().GetEye(*fCurEye).GetPosition();
822  }
823 
824  const double sdpTheta = fSDP.GetTheta(eyeCS);
825  for(unsigned int pix=0; pix<t_i.size(); ++pix){
826  const double t_expected = timeFitModel.GetTimeAtAperture(t_0, r_p, chi_0, chi_i[pix], sdpTheta, eyeID, telID[pix]);
827  const double tmp = t_i[pix] - t_expected;
828  // NOT weighting with the pixel charge
829  const double chargeOne = 1.0;
830  chisq_time += tmp*tmp *chargeOne / (t_i_Err[pix] * t_i_Err[pix]);
831  sum_charge +=chargeOne;
832  }
833  chisq_time /= sum_charge;
834 
835  static vector<Point> stationpos;
836  static vector<int> stationId;
837  static vector<double> station_d_to_SDP;
838  static vector<double> stNanosecond;
839  static vector<double> stSignal;
840 
841  if (iflag == 1) { // fnc init
842 
843  stationpos.clear();
844  stationId.clear();
845  station_d_to_SDP.clear();
846  stNanosecond.clear();
847  stSignal.clear();
848 
849  sevt::SEvent& sevent = fCurEvent->GetSEvent();
850  for(SEvent::StationIterator sditer= sevent.StationsBegin();
851  sditer != sevent.StationsEnd(); ++sditer){
852  if (!sditer->HasRecData())
853  continue;
854  sevt::Station& station= *sditer;
855  if (!station.IsCandidate() && !station.IsSilent() )
856  continue;
857  const sdet::Station& detstation = det::Detector::GetInstance().GetSDetector().GetStation(station);
858  if(detstation.IsDense())
859  continue;
860 
861  //Estimating distance to the SDP
862  const Vector eye_station = detstation.GetPosition() - eyeposition;
863  double angle = Angle(eye_station,fSDP);
864  double distToSDP= abs(eye_station.GetMag() * cos(angle));
865 
867  // Checking if the nanoseconds correspond to the same second in
868  // in the SD and FD times
869  int SDSecond = station.GetRecData().GetSignalStartTime().GetGPSSecond();
870  int FDSecond = fCurEye->GetHeader().GetTimeStamp().GetGPSSecond();
871  if ( SDSecond > FDSecond ) nanosecond += 1000000000;
872  if ( SDSecond < FDSecond ) nanosecond -= 1000000000;
873  double signal = station.GetRecData().GetTotalSignal();
874 
875  stationpos.push_back(detstation.GetPosition());
876  stationId.push_back(station.GetId());
877  station_d_to_SDP.push_back(distToSDP);
878  stNanosecond.push_back(nanosecond);
879  stSignal.push_back(signal);
880 
881  }
882  }
883 
884  double signal_max = 0;
885  int hotStationIter = 0;
886  int NofStations = 0;
887  fTriggeredStations = 0;
888 
889  for(unsigned int statIt=0; statIt<stationpos.size(); ++statIt){
890 
891  if (station_d_to_SDP[statIt] < fDistanceStationSDP)
892  fTriggeredStations++;
893  else
894  continue;
895 
896  if (fround == 1) {
897  if (stSignal[statIt] > signal_max ) {
898  signal_max = stSignal[statIt];
899  hotStationIter = statIt;
900  NofStations++;
901  fsignal_max = stSignal[statIt];
902  fsignal_max_pre = signal_max;
903  fHotStationId = stationId[statIt];
904  }
905  }
906  else {
907  if (stSignal[statIt] > signal_max && stSignal[statIt] < fsignal_max){
908  signal_max = stSignal[statIt];
909  fsignal_max_pre = signal_max;
910  hotStationIter = statIt;
911  NofStations++;
912  fHotStationId = stationId[statIt];
913  }
914  }
915  }//for stations
916 
917 
918  //get shower axis
919  Transformation rot(Transformation::Rotation(-chi_0, fSDP, eyeCS));
920  Vector axis(rot* horizontalWithinSDP);
921  axis /= axis.GetMag();
922 
923 
924  const double nx = axis.GetX(eyeCS);
925  const double ny = axis.GetY(eyeCS);
926  const double nz = axis.GetZ(eyeCS);
927 
928  const Vector core = horizontalWithinSDP*( r_p/ sin(kPi-chi_0));
929  const double tcore = t_0 + r_p/(kSpeedOfLight * tan(kPi - chi_0));
930  const Point PointCore = eyeposition + core;
931 
932  int stations_used = 0;
933  if (NofStations > 0 ) {
934  const double x_hot = stationpos[hotStationIter].GetX(eyeCS);
935 
936  //---------------------------------
937  UTMPoint UTMposHot(stationpos[hotStationIter], ReferenceEllipsoid::GetWGS84());
938 
939  double sum_total = 0;
940  for(unsigned int stiter=0; stiter<stationId.size(); ++stiter){
941 
942  //--------------------------------------
943  // This statement is to consider the
944  // stations around the hottest station
945  // in the hybrid chisq.
946 
947  // 500 means that only the hottest station
948  // will be used for the hybrid reconstruction.
949  const Vector distance_to_hot= stationpos[stiter]- stationpos[hotStationIter];
950 
951  if ( distance_to_hot.GetMag() > 500 )
952  continue;
953 
954  const Vector st_core= stationpos[stiter] - PointCore;
955  const Vector sh_axis ( nx, ny, nz, eyeCS, Vector::kCartesian);
956  const double sh_axis_VS_st_core_angle = Angle(st_core,sh_axis);
957  const double delta_d = st_core.GetMag() * std::cos(sh_axis_VS_st_core_angle);
958 
959  //Estimating station distance to the Axis
960  fStationAxisDistance = st_core.GetMag() * std::sin(sh_axis_VS_st_core_angle);
961 
962  double station_to_axis = st_core.GetMag() * std::sin(sh_axis_VS_st_core_angle);
963  double exp_t_st = tcore - delta_d/kSpeedOfLight;
964 
965  // time delay due to the shower front curvature
966  const double d2 = station_to_axis * station_to_axis;
967  const double curvature = fVerticalCurvature*sh_axis.GetCosTheta(eyeCS);
968  const double timeDelay = curvature * d2 / (2*kSpeedOfLight);
969  exp_t_st += timeDelay;
970 
971  // Get event TimeStamp
972 
973  utl::TimeStamp time2 = fCurEye->GetHeader().GetTimeStamp();
974  // double(time2.GetGPSNanoSecond()) gives the time at the end of the FD FADC trace.
975  // by substracting 1000 *100 ns we get the start time of the FD FADC trace.
976  // exp_t_st, is the expected trigger time of the station.
977  // This time is currently relative to the start of the FD FADC trace. We'll add 'time2.GetGPSNanoSecond()'
978  // (the eye trigger time' to get the absolute time and compare with the observed station time.
979  double eye_trigger_time = double(time2.GetGPSNanoSecond());
980 
981  //-------------------------
982  eye_trigger_time -= 1000 *100;
983  exp_t_st += eye_trigger_time;
984 
985  double SD_Time = stNanosecond[stiter]; //nanosecond;
986  double FD_Time = exp_t_st + fNsCorrection;
987  double chi_hybrid = SD_Time - FD_Time;
988  double hybrid_error = 100;
989 
990  if (fHybridCore == 1) {
991  //Minimizing the hot_station-core distance (first step)
992  const double x_st=stationpos[stiter].GetX(eyeCS);
993  if (abs(x_hot -x_st) < 1 ) {
994  chisq_hybrid += st_core.GetMag()* st_core.GetMag()/(10*10);
995  sum_total++;
996  stations_used++;
997  break;
998  }
999  }
1000  else {
1001  //------------------------------------------------
1002  //Minimizind the SD/FD time offset (second step).
1003  // A different weight is given to different stations.
1004  // The weight is proportional to the inverse of the
1005  // distance from the station to the core.
1006 
1007  const double hybrid_weight = (1/station_to_axis) * (1/station_to_axis);
1008  chisq_hybrid += chi_hybrid * chi_hybrid * hybrid_weight / (hybrid_error*hybrid_error);
1009  sum_total += hybrid_weight;
1010  stations_used++;
1011  fSdHybridOffset = chi_hybrid;
1012  }
1013  }
1014  chisq_hybrid /= sum_total;
1015  }
1016  else {
1017  chisq_hybrid = 0;
1018  }
1019 
1020  if( fDebuging == 1)
1021  cout<<"chisq time: "<<chisq_time<<" chisq hybrid: "<<chisq_hybrid<<" \n";
1022  //================================= SD (vitor) (end)
1023 
1024  chisq = 0;
1025  // Normalized hybrid chisq times the number of stations.
1026  chisq_hybrid *= stations_used;
1027  // Normalized timing chisq times the number of pixels.
1028  chisq_time *= recdata.GetNTimeFitPixels();
1029 
1030  //Total chisq.
1031  chisq += chisq_time;
1032 
1033  chisq += chisq_hybrid;
1034  if( fDebuging == 1)
1035  cout<<"chisq time (TOTAL): "
1036  <<chisq_time<<" chisq hybrid: "
1037  <<chisq_hybrid<<" total: "
1038  <<chisq<<" \n";
1039 
1040  // Minuit needs the Total (not the reduced) chisq to estimate the errors
1041  // correctly
1042  value = chisq;
1043 
1044  fChi2TimeFit = chisq_time;
1045  fNDofTimeFit = recdata.GetNTimeFitPixels()-3;
1046 
1047 }
1048 
1049 
1056 bool
1057 HybridGeometryFinder::ReadmitPixel(fevt::Eye& eye)
1058 {
1059 
1060  int ReadmittedPixels = 0;
1061  CoordinateSystemPtr eyeCS =
1062  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetEyeCoordinateSystem();
1063  const fdet::FTimeFitModel& timeFitModel = fdet::FTimeFitModel::GetInstance();
1064  int eyeID = eye.GetId();
1065  double sdpTheta = fSDP.GetTheta(eyeCS);
1066 
1067  EyeRecData& recdata = eye.GetRecData();
1068 
1069  // iterate over pixels with a pulse
1070  for (EyeRecData::PixelIterator pixeliter = recdata.PulsedPixelsBegin();
1071  pixeliter != recdata.PulsedPixelsEnd(); ++pixeliter) {
1072 
1073  fevt::Pixel& evtpixel = *pixeliter;
1074 
1075  const unsigned int pixel_id = evtpixel.GetId();
1076  //-----------------------------
1077  // Checking whether this pixel was already
1078  // selected for Axis Time fitting.
1079  bool timefit_pixel = false;
1080  for (EyeRecData::ConstPixelIterator iter = recdata.TimeFitPixelsBegin();
1081  iter != recdata.TimeFitPixelsEnd(); ++iter)
1082  if (pixel_id == iter->GetId()) {
1083  timefit_pixel = true;
1084  break;
1085  }
1086  //-------------------------------------
1087  if (timefit_pixel)
1088  continue;
1089 
1090 
1091 
1092  PixelRecData& pixrec = evtpixel.GetRecData();
1093  const double t_i = pixrec.GetT_i().GetNanoSecond();
1094  const double chi_i = pixrec.GetChi_i();
1095  const double t_i_Err = pixrec.GetT_iError().GetInterval();
1096 
1097  const int telID = evtpixel.GetTelescopeId();
1098 
1099  double t_expected = timeFitModel.GetTimeAtAperture(fT0, fRp, fChi0, chi_i, sdpTheta, eyeID, telID);
1100  double tmp = t_i - t_expected;
1101  double time_residue = tmp / (t_i_Err) ;
1102 
1103  const fdet::Pixel& detpixel =
1104  det::Detector::GetInstance().GetFDetector().GetPixel(evtpixel);
1105  const double AngleWithSDP = fabs(kPi/2 - Angle(fSDP, detpixel.GetDirection()));
1106 
1107 
1108  //-------------------------------------
1109  // If the the pixel wasn't selected for timing fitting,
1110  // and has small time residue and is close to the SDP. The pixel
1111  // is added for timing fit.
1112 
1113  if ( fabs(time_residue) < 13 && AngleWithSDP < fTolerance) {
1114  recdata.AddTimeFitPixel(evtpixel);
1115  ReadmittedPixels++;
1116  cout << "readmitting pixel " << evtpixel.GetId() << " for the Timing Fit\n";
1117  }
1118 
1119  }
1120  return ReadmittedPixels > 0;
1121 }
1122 
1123 
1130 bool
1131 HybridGeometryFinder::RejectPixel(fevt::Eye& eye)
1132 {
1133  int RejectedPixels = 0;
1134  double residue_max = 0;
1135  int residue_max_pixid = -1;
1136  int residue_max_telid = -1;
1137 
1138  CoordinateSystemPtr eyeCS =
1139  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetEyeCoordinateSystem();
1140  const fdet::FTimeFitModel& timeFitModel = fdet::FTimeFitModel::GetInstance();
1141  int eyeID = eye.GetId();
1142  double sdpTheta = fSDP.GetTheta(eyeCS);
1143 
1144  EyeRecData& eyerecdata = eye.GetRecData();
1145 
1146  //-------------------------------------------
1147  // Loop to Get the pixel that has the
1148  // biggest timing chisq
1149  for (EyeRecData::PixelIterator iter = eyerecdata.TimeFitPixelsBegin();
1150  iter != eyerecdata.TimeFitPixelsEnd(); ++iter) {
1151 
1152  const fevt::Pixel& evtpixel = *iter;
1153  // Estimating the contribution of each pixel to the
1154  // time chisq (chisq_i).
1155  // loading the pixel information
1156  const int telid = evtpixel.GetTelescopeId();
1157  const double t_i = evtpixel.GetRecData().GetT_i().GetNanoSecond();
1158  const double t_i_Err = evtpixel.GetRecData().GetT_iError().GetInterval();
1159  const double chi_i = evtpixel.GetRecData().GetChi_i();
1160 
1161 
1162  const double t_expected =
1163  timeFitModel.GetTimeAtAperture(fT0,fRp,fChi0,chi_i,sdpTheta,eyeID,telid);
1164 
1165  const double temp = t_i - t_expected ;
1166  const double time_residue = temp / t_i_Err;
1167  if (fDebuging == 1)
1168  cout << "time chisq_i: " << (temp * temp ) / (t_i_Err * t_i_Err) << " pixelid " << evtpixel.GetId()
1169  << " delta t: " << temp << " ti error: " << t_i_Err << " N Sigmas away: " << time_residue << "\n";
1170 
1171  if ( fabs(time_residue) > residue_max) {
1172  residue_max = fabs (time_residue);
1173  residue_max_pixid = evtpixel.GetId();
1174  residue_max_telid = telid;
1175  }
1176  }
1177  //----End find pixel with biggest time chisq
1178 
1179 
1180  //---------------------------------------------
1181  //Rejecting the pixel that may have bad pulse centroid
1182  //----------------------------------------------
1183  // if the pixel with the biggest contribution to the
1184  // time chisq is more than fSigmasLimit away it will be removed.
1185  // If there are only 3 pixels or less, no pixel is removed.
1186  //-----------------------------------------------------
1187 
1188 
1189  if (residue_max > fSigmasLimit && eyerecdata.GetNTimeFitPixels() > 3) {
1190 
1191  for (EyeRecData::PixelIterator iter = eyerecdata.TimeFitPixelsBegin();
1192  iter != eyerecdata.TimeFitPixelsEnd(); ) {
1193 
1194  const fevt::Pixel& evtpixel = *iter;
1195  // loading the pixel information
1196  const int telid = evtpixel.GetTelescopeId();
1197  const int pixid = evtpixel.GetId();
1198  if (telid == residue_max_telid && pixid == residue_max_pixid) {
1199  iter = eyerecdata.RemoveTimeFitPixel(iter);
1200  RejectedPixels++;
1201  break;
1202  } else
1203  ++iter;
1204  }
1205  }
1206 
1207  if (RejectedPixels>0)
1208  return true;
1209  else
1210  return false;
1211 }
1212 
1213 
1214 VModule::ResultFlag HybridGeometryFinder::Finish(){
1215  return eSuccess;
1216 }
1217 
1218 
1219 // Configure (x)emacs for this file ...
1220 // Local Variables:
1221 // mode:c++
1222 // compile-command: "make -C .. HybridGeometryFinderOG/HybridGeometryFinder.o -k"
1223 // End:
AxialVector cross(const Vector &l, const Vector &r)
vector cross product
Definition: OperationsAV.h:32
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)
Detector description interface for Station-related data.
bool HasRecData() const
Definition: FEvent/Eye.h:116
Fluorescence Detector Eye Event.
Definition: FEvent/Eye.h:29
PixelIterator PulsedPixelsEnd()
Definition: EyeRecData.h:121
Interface class to access Shower Reconstructed parameters.
Definition: ShowerRecData.h:33
bool HasRecShower() const
bool HasFEvent() const
Interface class to access to the SD part of an event.
Definition: SEvent.h:39
void SetSDTimeResidual(const double time)
double GetChiZero() const
Definition: EyeRecData.h:85
Class to hold and convert a point in geodetic coordinates.
Definition: UTMPoint.h:40
void SetAxis(const utl::Vector &axis)
fRp(t.GetRp())
double GetCosTheta(const CoordinateSystemPtr &coordinateSystem) const
cos of zenith (theta) angle
Definition: BasicVector.h:251
void SetCorePosition(const utl::Point &core)
EyeIterator EyesEnd(const ComponentSelector::Status status)
Definition: FEvent.h:66
sevt::StationRecData & GetRecData()
Get station level reconstructed data.
void SetTimeFitCorrelations(double rRpT0, double rRpChi0, double rChi0T0)
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
std::string GetModelName() const
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.
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 IsSilent() const
Check if the station is silent.
double GetMag2() const
Definition: AxialVector.h:59
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
utl::Point GetPosition() const
Tank position.
constexpr double deg
Definition: AugerUnits.h:140
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
utl::TimeStamp GetSignalStartTime() const
Start time of the signal.
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
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
constexpr double nanosecond
Definition: AugerUnits.h:143
void SetAxis(const utl::Vector &axis)
double abs(const SVector< n, T > &v)
double GetTotalSignal() const
Total integrated signal in VEM unit, averaged over pmts.
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
unsigned int GetNPulsedPixels() const
Get number of pulsed pixels.
Definition: EyeRecData.h:137
#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
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
unsigned long GetGPSSecond() const
GPS second.
Definition: TimeStamp.h:124
fSDP(t.GetSDP())
double GetGPSNanoSecond() const
GPS nanosecond.
Definition: TimeStamp.h:127
void SetTZero(const double tzero, const double error)
double GetRp() const
Definition: EyeRecData.h:87
StationIterator StationsBegin()
Beginning of all stations.
Definition: SEvent.h:57
Description of a pixel.
void SetTimeFitChiSquare(const double tfitChi2, const unsigned int ndof)
PixelIterator TimeFitPixelsEnd()
Definition: EyeRecData.h:171
bool IsDense() const
Tells whether the station belongs to set of hypothetical &quot;dense&quot; stations.
Vector object.
Definition: Vector.h:30
void SetRp(const double rp, const double error)
utl::TimeInterval GetT_iError() const
Definition: PixelRecData.h:125
Main configuration utility.
Definition: CentralConfig.h:51
void SetCorePosition(const utl::Point &core)
boost::indirect_iterator< InternalStationIterator, Station & > StationIterator
Iterator over all stations.
Definition: SEvent.h:52
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
double GetTZero() const
Definition: EyeRecData.h:83
void SetTZero(const double tzero, const double error)
Definition: EyeRecData.h:235
void AddTimeFitPixel(fevt::Pixel &pixel)
add a pixel to the list of Time Fit pixels
Definition: EyeRecData.h:177
double GetZ(const CoordinateSystemPtr &coordinateSystem) const
Definition: BasicVector.h:212
double GetNanoSecond() const
Get integer number of nanoseconds past seconds boundary.
Definition: TimeInterval.cc:25
PixelIterator TimeFitPixelsBegin()
Definition: EyeRecData.h:167
#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
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)
PixelRecData & GetRecData()
Definition: FEvent/Pixel.h:40
void AddStationId(const unsigned short int id)
add a station id to the list of used hybrid stations
fevt::EyeRecData & GetRecData()
Reconstructed data for this eye.
Definition: FEvent/Eye.cc:130

, generated on Tue Sep 26 2023.