StereoGeometryFinder.cc
Go to the documentation of this file.
1 
11 #include "StereoGeometryFinder.h"
12 
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/TabulatedFunctionErrors.h>
25 #include <utl/Point.h>
26 #include <utl/UTMPoint.h>
27 #include <utl/ReferenceEllipsoid.h>
28 
29 #include <evt/Event.h>
30 #include <evt/ShowerFRecData.h>
31 #include <evt/ShowerRecData.h>
32 #include <evt/ShowerSRecData.h>
33 
34 
35 
36 #include <fevt/FEvent.h>
37 #include <fevt/Eye.h>
38 #include <fevt/Telescope.h>
39 #include <fevt/Pixel.h>
40 #include <fevt/PixelRecData.h>
41 #include <fevt/EyeRecData.h>
42 #include <fevt/TelescopeRecData.h>
43 #include <fevt/EyeHeader.h>
44 
45 #include <det/Detector.h>
46 
47 #include <fdet/FDetector.h>
48 #include <fdet/Eye.h>
49 #include <fdet/Telescope.h>
50 #include <fdet/Channel.h>
51 #include <fdet/Pixel.h>
52 
53 
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 
60 #include <sdet/SDetector.h>
61 #include <sdet/Station.h>
62 
63 
64 #include <TMinuit.h>
65 
66 #include <algorithm>
67 #include <iostream>
68 #include <fstream>
69 #include <iomanip>
70 
71 
72 
73 using namespace std;
74 using namespace fwk;
75 using namespace utl;
76 using namespace fevt;
77 using namespace evt;
78 using namespace StereoGeometryFinderOG;
79 using namespace sevt;
80 
81 evt::Event* StereoGeometryFinder::fCurEvent = 0;
82 
84 
85 std::set<int> StereoGeometryFinder::fExcludeEye;
86 std::set<int> StereoGeometryFinder::fExcludeSDPEye;
87 
88 int StereoGeometryFinder::fDebugging = 0;
89 
90 double StereoGeometryFinder::fChi2SDP = 0;
91 int StereoGeometryFinder::fNDofSDP = 0;
92 
93 double StereoGeometryFinder::fChi2TimeFit = 0;
94 int StereoGeometryFinder::fNDofTimeFit = 0;
95 
96 int StereoGeometryFinder::fStereoHybrid = 0;
97 int StereoGeometryFinder::fHotStationId = 0;
98 double StereoGeometryFinder::fCelesteDelay = 0;
99 
100 
103 {
104  CentralConfig* cc = CentralConfig::GetInstance();
105 
106  Branch topB = cc->GetTopBranch("StereoGeometryFinder");
107 
108  topB.GetChild("forDebug").GetData(fDebugging);
109 
110  vector<int> exclEyes;
111  topB.GetChild("excludeEyes").GetData(exclEyes);
112  fExcludeEye.clear();
113  for (unsigned int i = 0; i < exclEyes.size(); ++i)
114  fExcludeEye.insert(exclEyes[i]);
115 
116  vector<int> exclSDPEyes;
117  topB.GetChild("excludeSDPEyes").GetData(exclSDPEyes);
118  fExcludeSDPEye.clear();
119  for (unsigned int i = 0; i < exclSDPEyes.size(); ++i)
120  fExcludeSDPEye.insert(exclSDPEyes[i]);
121 
122  topB.GetChild("stereoHybrid").GetData(fStereoHybrid);
123 
124  topB.GetChild("celesteDelay").GetData(fCelesteDelay);
125 
126  return eSuccess;
127 }
128 
129 
131 StereoGeometryFinder::Run(evt::Event& event)
132 {
133  if (!event.HasFEvent())
134  return eContinueLoop;
135 
136  fCurEvent = &event; // acrobacy for TMinuit
137  fevt::FEvent& fevent = event.GetFEvent();
138 
140 
141  //Counting the number of Eyes with more than 4 good pixels
142  unsigned int numEyes = 0;
143 
144  for (eyeIter = fevent.EyesBegin(ComponentSelector::eHasData);
145  eyeIter != fevent.EyesEnd(ComponentSelector::eHasData);
146  ++eyeIter) {
147 
148  fevt::Eye& eye = *eyeIter;
149  if (!eye.HasRecData())
150  eye.MakeRecData();
151 
152  EyeRecData& eyeRecData = eye.GetRecData();
153  if (eyeRecData.GetNSDPPixels() <= 4)
154  continue;
155 
156  if (fStereoHybrid == 1) {
157  const std::vector<unsigned short int> SdList = eyeRecData.GetFRecShower().GetStationIds();
158  fHotStationId = SdList[0];
159  }
160 
161  ++numEyes;
162  }
163 
164 
165  if (numEyes < 2 ) {
166  cout<<"\n";
167  INFO("It is not a stereo event. The stereo reconstruction will not do anything");
168  cout<<"\n";
169  return eSuccess;
170  }
171 
172 
173  //------------------------------------------------
174  // FindAxisStereo: It is a Multi-Eye geometry reconstruction
175  // routine. Find the best Shower axis that fits better the
176  // SDP fit and time Fit of all mirrors.
177  cout<<"Calling FindAxisStereo"<<"\n";
178  FindAxisStereo(event);
179 
180  if ( fStereoHybrid == 1 ) {
181 
182  if (event.HasSEvent()) {
183 
184  cout<<"Trying to include the Hybrid Fit in the stereo reconstruction \n";
185  FindAxisStereoHybrid(event);
186  }
187  else {
188  cout<<"There isn't any station involved with this event \n";
189  cout<<"the reconstruction is purely stereo \n";
190  }
191 
192  }
193 
194  // Calculate axis and core parameters.
195  for (eyeIter = fevent.EyesBegin(ComponentSelector::eHasData);
196  eyeIter != fevent.EyesEnd(ComponentSelector::eHasData);
197  ++eyeIter) {
198 
199  fevt::Eye& eye = *eyeIter;
200  fevt::EyeRecData& eyeRecData = eye.GetRecData();
201 
202  //Checking that the Eye has enough pixels
203  if (eyeRecData.GetNSDPPixels() <= 3)
204  continue;
205 
206  CoordinateSystemPtr eyeCS =
207  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetEyeCoordinateSystem();
208 
209  fChi0 = eyeRecData.GetChiZero();
210  fRp = eyeRecData.GetRp();
211  fT0 = eyeRecData.GetTZero();
212 
213 
214  Vector sdp = eyeRecData.GetSDP();
215  Vector EyeVertical(0,0,1,eyeCS);
216  Vector horizontalInSDP = cross(sdp,EyeVertical); // horizontal
217  horizontalInSDP.Normalize();
218 
219 
220  Transformation rot(Transformation::Rotation(-fChi0, sdp, eyeCS));
221  Vector axis(rot * horizontalInSDP); // apply rotation
222  axis.Normalize();
223 
224  Vector coreEyeVec = fRp / sin( kPi - fChi0) * horizontalInSDP;
225  Point eyePosition =
226  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetPosition();
227  Point core = eyePosition + coreEyeVec;
228 
229  if (!event.HasRecShower())
230  event.MakeRecShower();
231  ShowerRecData& recshower = event.GetRecShower();
232  recshower.SetAxis(axis);
233  recshower.SetCorePosition(core);
234 
235  if (!eyeRecData.HasFRecShower())
236  eyeRecData.MakeFRecShower();
237  eyeRecData.GetFRecShower().SetAxis(axis);
238  eyeRecData.GetFRecShower().SetCorePosition(core);
239  eyeRecData.GetFRecShower().SetCoreTime(eye.GetHeader().GetTimeStamp()-
240  TimeInterval(1000*100*ns),
241  fRp, fChi0, fT0);
242  //--------------------------------------------
243  // Also fill the TelescopeRecData with the same values
244  // since this module isn't able to deal with compound eyes
245  // that consist of telescopes at multiple different positions
246  for (fevt::Eye::TelescopeIterator telIt = eye.TelescopesBegin(ComponentSelector::eHasData);
247  telIt != eye.TelescopesEnd(ComponentSelector::eHasData); ++telIt)
248  {
249  if (!telIt->HasRecData())
250  telIt->MakeRecData();
251  fevt::TelescopeRecData& telRecData = telIt->GetRecData();
252  telRecData.SetSDP(eyeRecData.GetSDP());
253  telRecData.SetSDPThetaError(eyeRecData.GetSDPThetaError());
254  telRecData.SetSDPPhiError(eyeRecData.GetSDPPhiError());
255  telRecData.SetSDPCorrThetaPhi(eyeRecData.GetSDPCorrThetaPhi());
256  telRecData.SetSDPFitChiSquare(eyeRecData.GetSDPFitChiSquare(),
257  eyeRecData.GetSDPFitNDof());
258 
259  telRecData.SetChiZero(eyeRecData.GetChiZero(), eyeRecData.GetChiZeroError());
260  telRecData.SetTZero(eyeRecData.GetTZero(), eyeRecData.GetTZeroError());
261  telRecData.SetRp(eyeRecData.GetRp(), eyeRecData.GetRpError());
262  telRecData.SetTimeFitChiSquare(eyeRecData.GetTimeFitChiSquare(),
263  eyeRecData.GetTimeFitNDof());
264  telRecData.SetTimeFitCorrelations(eyeRecData.GetRpTZeroCorrelation(),
265  eyeRecData.GetRpChi0Correlation(),
266  eyeRecData.GetChi0TZeroCorrelation());
267  }
268 
269  } // end for eyes
270  return eSuccess;
271 }
272 
273 
274 void
275 StereoGeometryFinder::FindAxisStereo(evt::Event& event)
276 {
277  fevt::FEvent& fevent = event.GetFEvent();
279 
280  const fdet::FDetector& fdetector = det::Detector::GetInstance().GetFDetector();
281  const unsigned int nEyes = fdetector.GetLastEyeId();
282 
284  det::Detector::GetInstance().GetSiteCoordinateSystem();
285 
286  const ReferenceEllipsoid& e = ReferenceEllipsoid::GetWGS84();
287 
288  vector<Vector> sdp(nEyes);
289  vector<Vector> horizontal(nEyes);
290  vector<Vector> EyeToCore(nEyes);
291  vector<Point> eyePosition(nEyes);
292  vector<double> coreDistance(nEyes);
293  vector<double> EndFADCTrace(nEyes);
294  vector<Point> core(nEyes);
295  int count = 0;
296 
297  // Loading To from the first Eye.
298  for (fevt::FEvent::EyeIterator eyeIter = fevent.EyesBegin(ComponentSelector::eHasData);
299  eyeIter != fevent.EyesEnd(ComponentSelector::eHasData);
300  ++eyeIter) {
301 
302  fevt::Eye& eye = *eyeIter;
303  fevt::EyeRecData& eyerec = eye.GetRecData();
304 
305  //Checking that the Eye has enough pixels
306  if (eyerec.GetNSDPPixels() <= 3)
307  continue;
308 
309  CoordinateSystemPtr eyeCS =
310  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetEyeCoordinateSystem();
311 
312  fTZero = eyerec.GetTZero();
313  fChi0 = eyerec.GetChiZero();
314  fRp = eyerec.GetRp();
315  Vector sdp = eyerec.GetSDP();
316  Vector EyeVertical(0,0,1,eyeCS);
317  Vector horizontalInSDP = cross(sdp,EyeVertical); // horizontal
318 
319  Transformation rot(Transformation::Rotation(-fChi0, sdp, eyeCS));
320  Vector axis(rot * horizontalInSDP); // apply rotation
321  axis.Normalize();
322  Vector coreEyeVec = fRp / sin( kPi - fChi0) * horizontalInSDP;
323 
324  if (coreEyeVec.GetMag() > 100000 )
325  coreEyeVec = 5000 * horizontalInSDP;
326 
327  Point eyePosition =
328  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetPosition();
329  Point core = eyePosition + coreEyeVec;
331  det::Detector::GetInstance().GetSiteCoordinateSystem();
332 
333  //vertical distance from the core at 1400m altitute.
334  UTMPoint UTMCore(core,e);
335  double deltaH = UTMCore.GetHeight() - 1400;
336  Vector AxisPointingUp = axis;
337  if ( cos( axis.GetTheta(eyeCS) ) < 0 )
338  AxisPointingUp *= -1;
339  //distance along the shower axis
340  double deltaLength = deltaH /cos(AxisPointingUp.GetTheta(eyeCS));
341 
342  Point PointCore1400 = core - deltaLength * AxisPointingUp;
343  UTMPoint UTMCore1400(PointCore1400,e);
344 
346 
347  fNorthing = UTMCore1400.GetNorthing(); //first guest
348  fEasting = UTMCore1400.GetEasting();; //first guest
349  fAxisTheta = axis.GetTheta(core1CS); //First guess
350  fAxisPhi = axis.GetPhi(core1CS);
351 
352  break;
353  }
354 
355  //-------------------------------------
356  const int npar = 5; // number of parameters
357 
358 
359  TMinuit theMinuit(npar); // 5 parameter fit
360 
361  theMinuit.SetPrintLevel(-1); // minuit verbosity
362 
363  theMinuit.SetFCN(StereoGeometryFinder::MinuitFitFuncStereo);
364 
365  double arglist[npar]; // arguments to pass to the Minuit interpreter
366  int ierflag =0;
367 
368  arglist[0]=1; // [up]
369  arglist[1]=1; // unused
370  theMinuit.mnexcm("SET ERR", arglist,1,ierflag);
371 
372  if (ierflag)
373  ERROR("Minuit SET ERR failed");
374 
375  static double vstart[npar]; // inital point
376  static double step[npar]; // step size
377 
378  // To is relative to the first Eye.
379 
380  // stereoAxis should point up.
381  vstart[0] = fNorthing; //Northing
382  vstart[1] = fEasting; //Easting
383  vstart[2] = fAxisTheta;//axis Theta
384  vstart[3] = fAxisPhi; // axis Phi
385  vstart[4] = fTZero; //T0 (from FdAxisFinder)
386 
387  step[0] = 10;
388  step[1] = 10;
389  step[2] = 0.1;
390  step[3] = 0.1;
391  step[4] = 10.0;
392 
393  theMinuit.mnparm(0,"Northing ",vstart[0], step[0],0,0,ierflag);
394  theMinuit.mnparm(1,"Easting ", vstart[1], step[1],0,0,ierflag);
395  theMinuit.mnparm(2,"Theta ", vstart[2], step[2],0,0,ierflag);
396  theMinuit.mnparm(3,"Phi ", vstart[3], step[3],0,0,ierflag);
397  theMinuit.mnparm(4,"T01 ", vstart[4], step[4],0,0,ierflag);
398 
399  arglist[0]=1500; // [maxcalls]
400  arglist[1]=0.01; // [tolerance]
401  theMinuit.mnexcm("MIGRAD", arglist ,2,ierflag);
402 
403  /*
404  // error contours
405  //---------------------------------------
406  //This is to print the contour points of two of the parameters
407  int npoints = 20;
408  double xptu[npoints];
409  double yptu[npoints];
410  theMinuit->mncont(0,1,npoints,xptu,yptu,ierflag);
411  for (int i = 0 ; i<npoints ; i++)
412  cout<<xptu[i]/degree<<" "<<yptu[i]/degree<<"\n";
413  //------------------
414  */
415 
416  if (ierflag)
417  ERROR("Minuit MIGRAD failed");
418 
419  double Theta = 0;
420  double Theta_err = 0;
421  double Phi = 0;
422  double Phi_err = 0;
423  double northing = 0;
424  double northing_err = 0;
425  double easting = 0;
426  double easting_err = 0;
427  double To = 0;
428  double To_err = 0;
429 
430 
431  theMinuit.GetParameter(0,northing,northing_err);
432  theMinuit.GetParameter(1,easting,easting_err);
433  theMinuit.GetParameter(2,Theta,Theta_err);
434  theMinuit.GetParameter(3,Phi,Phi_err);
435  theMinuit.GetParameter(4,To,To_err);
436 
437 
438  if (northing != northing) {
439  northing=fNorthing;
440  easting=fEasting;
441  Theta=fAxisTheta;
442  Phi=fAxisPhi;
443  To=fTZero;
444 
445  cout<<"======= FAILED STEREO RECONSTRUCTION =====\n";
446  }
447 
448 
449  cout<<"\n";
450  cout<<"After Pure Stereo: \n";
451  printf( "core UTM(E,N,H) : %9.1f , %10.1f , 1400 [m] \n",northing,easting);
452  printf("Axis(Theta,Phi)(coreCS) : %5.2f , %6.2f [deg] \n",Theta / degree, Phi /degree);
453  cout<<"\n";
454 
455  fNorthing = northing;
456  fEasting = easting;
457  fAxisTheta = Theta;
458  fAxisPhi= Phi;
459  fTZero = To;
460 
461 
462  //----------------
463  UTMPoint UTMcore(northing,easting,1400,19,'H',e);
464  Point core_1400 = UTMcore.GetPoint(CS);
466 
467  Vector stereoAxis(1,Theta,Phi,coreCS, Vector::kSpherical);
468 
469  bool IsUpGoing = false;
470  if ( cos( stereoAxis.GetTheta(CS) ) < 0 )
471  IsUpGoing = true;
472 
473  //-----------------------------
474  //Estimating the core location (at the Eye level), the horizontal
475  // and the SDP normal for the Eyes involved in the event
476  //-----------------------------
477  count = 0;
478  for (eyeIter = fevent.EyesBegin(ComponentSelector::eHasData);
479  eyeIter != fevent.EyesEnd(ComponentSelector::eHasData);
480  ++eyeIter) {
481 
482  const fevt::Eye& eye = *eyeIter;
483  const fevt::EyeRecData& eyeRecData = eye.GetRecData();
484 
485  //Checking that the Eye has enough pixels
486  if (eyeRecData.GetNSDPPixels() <= 3)
487  continue;
488 
489  CoordinateSystemPtr eyeCS =
490  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetEyeCoordinateSystem();
491 
492  eyePosition[count] =
493  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetPosition();
494 
495  //vertical distance from the core at 1400m altitute.
496  double deltaH = core_1400.GetZ(eyeCS);
497  Vector AxisPointingUp = stereoAxis;
498  if( IsUpGoing )
499  AxisPointingUp *= -1;
500  //distance along the shower axis
501  double deltaLength = deltaH /cos(AxisPointingUp.GetTheta(eyeCS));
502 
503  core[count] = core_1400 - deltaLength * AxisPointingUp ;
504  EyeToCore[count] = core[count] - eyePosition[count];
505  coreDistance[count] = EyeToCore[count].GetR(eyeCS);
506  EyeToCore[count] /= EyeToCore[count].GetR(eyeCS);
507  sdp[count] = cross(stereoAxis,EyeToCore[count]);
508  sdp[count] /= sdp[count].GetR(eyeCS);
509  Vector EyeVertical(0,0,1,eyeCS);
510  horizontal[count] = cross(sdp[count],EyeVertical);
511  horizontal[count] /= horizontal[count].GetR(eyeCS);
512 
513  // eyeId[count] = eye.GetId(); // unused
514 
515  utl::TimeStamp time = eye.GetHeader().GetTimeStamp();
516  EndFADCTrace[count] = double (time.GetGPSNanoSecond());
517 
518  ++count;
519  }
520 
521  // Setting the Multi-Eye geometry parameters for all Eyes involved
522  count = 0;
523 
524  for (fevt::FEvent::EyeIterator eyeIter = fevent.EyesBegin(ComponentSelector::eHasData);
525  eyeIter != fevent.EyesEnd(ComponentSelector::eHasData);
526  ++eyeIter) {
527 
528  fevt::Eye& eye = *eyeIter;
529  fevt::EyeRecData& eyerec = eye.GetRecData();
530 
531 
532  //Checking that the Eye has enough pixels
533  if (eyerec.GetNSDPPixels() <= 3)
534  continue;
535 
536  CoordinateSystemPtr eyeCS = fdetector.GetEye(eye).GetEyeCoordinateSystem();
537  CoordinateSystemPtr eye2CS = fdetector.GetEye(eye).GetLocalCoordinateSystem();
538 
539  if (fDebugging == 1)
540  cout << "Eye: " << eye.GetId()
541  << " core (x,y,z): (" << core[count].GetX(eye2CS)
542  << "," << core[count].GetY(eye2CS)
543  << "," << core[count].GetZ(eye2CS) << ")\n";
544 
545  double chi_0 = Angle(horizontal[count],stereoAxis);
546  if (IsUpGoing)
547  chi_0 *= -1;
548  double r_p = coreDistance[count] * sin(kPi - chi_0);
549  if (IsUpGoing)
550  r_p *= -1;
551 
552  fChi0 = chi_0;
553  fRp = r_p;
554  double deltaT;
555  //-------------------------------------
556  //--- T_zero corresponds to To of the first Eye (count=0) -----
557  //----------- Estimating To for the corresponding Eye ----
558  Point PointRp;
559  Point PointRp_eye0;
560  double chi_eye0 = Angle(horizontal[0],stereoAxis);
561  if (IsUpGoing)
562  chi_eye0 *= -1;
563  double Rp_magnitude_eye0 = coreDistance[0] * sin(chi_eye0);
564  Vector Rp_unit_eye0 = cross(sdp[0],stereoAxis); // Check this definition
565  if (IsUpGoing)
566  Rp_unit_eye0 *= -1;
567  Rp_unit_eye0 /= Rp_unit_eye0.GetR(CS);
568  PointRp_eye0 = eyePosition[0] + Rp_magnitude_eye0*Rp_unit_eye0;
569  double chi_00 = Angle(horizontal[count],stereoAxis);
570  if (IsUpGoing)
571  chi_00 *= -1;
572  double Rp_magnitude = coreDistance[count] * sin(chi_00);
573  Vector Rp_unit = cross(sdp[count],stereoAxis);
574  if (IsUpGoing)
575  Rp_unit *= -1;
576  Rp_unit /= Rp_unit.GetR(CS);
577  PointRp = eyePosition[count] + Rp_magnitude*Rp_unit;
578  Vector delta_distance = PointRp - PointRp_eye0;
579  deltaT = delta_distance.GetR(CS) / kSpeedOfLight;
580 
581  if (PointRp.GetZ(CS) > PointRp_eye0.GetZ(CS))// asuming a downgoing shower
582  deltaT *= -1;
583  if ( IsUpGoing)// correting for upgoing showers
584  deltaT *= -1;
585 
586  double T_zero = To + deltaT;
587  T_zero += (EndFADCTrace[0] - EndFADCTrace[count]);
588 
589  eyerec.SetTZero(T_zero,To_err);
590  eyerec.SetSDP(sdp[count]);
591 
592  //This variables are not estimated in the
593  //current Multi_Eye reconstruction
594  fChi0Error = 0;
595  fRpError = 0;
596  //-----------------------
597  eyerec.SetChiZero(fChi0,fChi0Error);
598  eyerec.SetRp(fRp,fRpError);
599 
600  //Setting chi_i for each pixel
601 
602  fevt::EyeRecData& recdata = eye.GetRecData();
603 
604  for (EyeRecData::PixelIterator iter = recdata.PulsedPixelsBegin();
605  iter != recdata.PulsedPixelsEnd(); ++iter) {
606 
607  fevt::Pixel& evtPixel = *iter;
608  const fdet::Pixel& detPixel = fdetector.GetPixel(evtPixel);
609  Vector pixeldir = detPixel.GetDirection();
610  // subtract component parallel to sdp
611  Vector chi_i_vector = pixeldir - (sdp[count] * pixeldir) * sdp[count];
612  chi_i_vector /= chi_i_vector.GetR(eyeCS);
613 
614  double chi_i = Angle(chi_i_vector,horizontal[count]);
615 
616  evtPixel.GetRecData().SetChi_i(chi_i);
617 
618 
619  } //End Setting chi_i
620 
621  ++count;
622  }
623 }
624 
625 
626 void
627 StereoGeometryFinder::FindAxisStereoHybrid(evt::Event& event)
628 {
629  fevt::FEvent& fevent = event.GetFEvent();
631 
632  const fdet::FDetector& fdetector = det::Detector::GetInstance().GetFDetector();
633  const unsigned int nEyes = fdetector.GetLastEyeId();
634 
636  det::Detector::GetInstance().GetSiteCoordinateSystem();
637 
638  const ReferenceEllipsoid& e = ReferenceEllipsoid::GetWGS84();
639 
640  vector<Vector> sdp(nEyes);
641  vector<Vector> horizontal(nEyes);
642  vector<Vector> EyeToCore(nEyes);
643  vector<Point> eyePosition(nEyes);
644  // int eyeId(nEyes); // unused
645  vector<double> coreDistance(nEyes);
646  vector<double> EndFADCTrace(nEyes);
647  vector<Point> core(nEyes);
648  int count = 0;
649 
650 
651  const int npar = 5; // number of parameters
652 
653 
654  TMinuit theMinuit(npar); // 5 parameter fit
655 
656  theMinuit.SetPrintLevel(-1); // minuit verbosity
657 
658  theMinuit.SetFCN(StereoGeometryFinder::MinuitFitFuncStereoHybrid);
659 
660  double arglist[npar]; // arguments to pass to the Minuit interpreter
661  int ierflag =0;
662 
663  arglist[0]=1; // [up]
664  arglist[1]=1; // unused
665  theMinuit.mnexcm("SET ERR", arglist,1,ierflag);
666 
667  if (ierflag)
668  ERROR("Minuit SET ERR failed");
669 
670  static double vstart[npar]; // inital point
671  static double step[npar]; // step size
672 
673  // To is relative to the first Eye.
674 
675  // Loading first guest from pure Stereo reconstruction (No hybrid information)
676 
677  vstart[0] = fNorthing; //Northing
678  vstart[1] = fEasting; //Easting
679  vstart[2] = fAxisTheta;//axis Theta
680  vstart[3] = fAxisPhi; // axis Phi
681  vstart[4] = fTZero; //T0
682 
683 
684  step[0] = 10;
685  step[1] = 10;
686  step[2] = 0.1;
687  step[3] = 0.1;
688  step[4] = 10.0;
689 
690  theMinuit.mnparm(0,"Northing ",vstart[0], step[0],0,0,ierflag);
691  theMinuit.mnparm(1,"Easting ", vstart[1], step[1],0,0,ierflag);
692  theMinuit.mnparm(2,"Theta ", vstart[2], step[2],0,0,ierflag);
693  theMinuit.mnparm(3,"Phi ", vstart[3], step[3],0,0,ierflag);
694  theMinuit.mnparm(4,"T01 ", vstart[4], step[4],0,0,ierflag);
695 
696  arglist[0]=1500; // [maxcalls]
697  arglist[1]=0.01; // [tolerance]
698  theMinuit.mnexcm("MIGRAD", arglist ,2,ierflag);
699 
700  /*
701  // error contours
702  //---------------------------------------
703  //This is to print the contour points of two of the parameters
704  int npoints = 20;
705  double xptu[npoints];
706  double yptu[npoints];
707  theMinuit->mncont(0,1,npoints,xptu,yptu,ierflag);
708  for (int i = 0 ; i<npoints ; i++)
709  cout<<xptu[i]/degree<<" "<<yptu[i]/degree<<"\n";
710  //------------------
711  */
712 
713  if (ierflag)
714  ERROR("Minuit MIGRAD failed");
715 
716  double Theta = 0;
717  double Theta_err = 0;
718  double Phi = 0;
719  double Phi_err = 0;
720  double northing = 0;
721  double northing_err = 0;
722  double easting = 0;
723  double easting_err = 0;
724  double To = 0;
725  double To_err = 0;
726 
727 
728  theMinuit.GetParameter(0,northing,northing_err);
729  theMinuit.GetParameter(1,easting,easting_err);
730  theMinuit.GetParameter(2,Theta,Theta_err);
731  theMinuit.GetParameter(3,Phi,Phi_err);
732  theMinuit.GetParameter(4,To,To_err);
733 
734  cout<<"\n";
735  cout<<"After Stereo-hybrid: \n";
736  printf( "core UTM(E,N,H) : %9.1f , %10.1f , 1400 [m] \n",northing,easting);
737  printf("Axis(Theta,Phi)(coreCS) : %5.2f , %6.2f [deg] \n",Theta / degree, Phi /degree);
738 
739  cout<<"\n";
740 
741  if (northing != northing) {
742  northing=fNorthing;
743  easting=fEasting;
744  Theta=fAxisTheta;
745  Phi=fAxisPhi;
746  To=fTZero;
747 
748  cout<<"======= FAILED STEREO RECONSTRUCTION =====\n";
749  }
750 
751 
752 
753  //----------------
754  UTMPoint UTMcore(northing,easting,1400,19,'H',e);
755  Point core_1400 = UTMcore.GetPoint(CS);
757 
758  Vector stereoAxis(1,Theta,Phi,coreCS, Vector::kSpherical);
759 
760  bool IsUpGoing = false;
761  if ( cos( stereoAxis.GetTheta(CS) ) < 0 )
762  IsUpGoing = true;
763 
764  //-----------------------------
765  //Estimating the core location (at the Eye level), the horizontal
766  // and the SDP normal for the Eyes involved in the event
767  //-----------------------------
768  count = 0;
769  for (eyeIter = fevent.EyesBegin(ComponentSelector::eHasData);
770  eyeIter != fevent.EyesEnd(ComponentSelector::eHasData);
771  ++eyeIter) {
772 
773  const fevt::Eye& eye = *eyeIter;
774  const fevt::EyeRecData& eyeRecData = eye.GetRecData();
775 
776  //Checking that the Eye has enough pixels
777  if (eyeRecData.GetNSDPPixels() <= 3)
778  continue;
779 
780  CoordinateSystemPtr eyeCS =
781  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetEyeCoordinateSystem();
782 
783  eyePosition[count] =
784  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetPosition();
785 
786  //vertical distance from the core at 1400m altitute.
787  double deltaH = core_1400.GetZ(eyeCS);
788  Vector AxisPointingUp = stereoAxis;
789  if( IsUpGoing )
790  AxisPointingUp *= -1;
791  //distance along the shower axis
792  double deltaLength = deltaH /cos( AxisPointingUp.GetTheta(eyeCS));
793 
794  core[count] = core_1400 - deltaLength * AxisPointingUp ;
795  EyeToCore[count] = core[count] - eyePosition[count];
796  coreDistance[count] = EyeToCore[count].GetR(eyeCS);
797  EyeToCore[count] /= EyeToCore[count].GetR(eyeCS);
798  sdp[count] = cross(stereoAxis,EyeToCore[count]);
799  sdp[count] /= sdp[count].GetR(eyeCS);
800  Vector EyeVertical(0,0,1,eyeCS);
801  horizontal[count] = cross(sdp[count],EyeVertical);
802  horizontal[count] /= horizontal[count].GetR(eyeCS);
803 
804 
805  // eyeId[count] = eye.GetId(); // unused
806 
807  utl::TimeStamp time = eye.GetHeader().GetTimeStamp();
808  EndFADCTrace[count] = double (time.GetGPSNanoSecond());
809 
810  ++count;
811  }
812 
813  // Setting the Multi-Eye geometry parameters for all Eyes involved
814  count = 0;
815 
816  for (fevt::FEvent::EyeIterator eyeIter = fevent.EyesBegin(ComponentSelector::eHasData);
817  eyeIter != fevent.EyesEnd(ComponentSelector::eHasData);
818  ++eyeIter) {
819 
820  fevt::Eye& eye = *eyeIter;
821  fevt::EyeRecData& eyerec = eye.GetRecData();
822 
823 
824  //Checking that the Eye has enough pixels
825  if (eyerec.GetNSDPPixels() <= 3)
826  continue;
827 
828  CoordinateSystemPtr eyeCS = fdetector.GetEye(eye).GetEyeCoordinateSystem();
829  CoordinateSystemPtr eye2CS = fdetector.GetEye(eye).GetLocalCoordinateSystem();
830 
831  if (fDebugging == 1)
832  cout << "Eye: " << eye.GetId()
833  << " core (x,y,z): (" << core[count].GetX(eye2CS)
834  << "," << core[count].GetY(eye2CS)
835  << "," << core[count].GetZ(eye2CS) << ")\n";
836 
837  double chi_0 = Angle(horizontal[count],stereoAxis);
838  if (IsUpGoing)
839  chi_0 *= -1;
840  double r_p = coreDistance[count] * sin(kPi - chi_0);
841  if (IsUpGoing)
842  r_p *= -1;
843 
844  fChi0 = chi_0;
845  fRp = r_p;
846  double deltaT;
847  //-------------------------------------
848  //--- T_zero corresponds to To of the first Eye (count=0) -----
849  //----------- Estimating To for the corresponding Eye ----
850  Point PointRp;
851  Point PointRp_eye0;
852  double chi_eye0 = Angle(horizontal[0],stereoAxis);
853  if (IsUpGoing)
854  chi_eye0 *= -1;
855  double Rp_magnitude_eye0 = coreDistance[0] * sin(chi_eye0);
856  Vector Rp_unit_eye0 = cross(sdp[0],stereoAxis); // Check this definition
857  if (IsUpGoing)
858  Rp_unit_eye0 *= -1;
859  Rp_unit_eye0 /= Rp_unit_eye0.GetR(CS);
860  PointRp_eye0 = eyePosition[0] + Rp_magnitude_eye0*Rp_unit_eye0;
861  double chi_00 = Angle(horizontal[count],stereoAxis);
862  if (IsUpGoing)
863  chi_00 *= -1;
864  double Rp_magnitude = coreDistance[count] * sin(chi_00);
865  Vector Rp_unit = cross(sdp[count],stereoAxis);
866  if (IsUpGoing)
867  Rp_unit *= -1;
868  Rp_unit /= Rp_unit.GetR(CS);
869  PointRp = eyePosition[count] + Rp_magnitude*Rp_unit;
870  Vector delta_distance = PointRp - PointRp_eye0;
871  deltaT = delta_distance.GetR(CS) / kSpeedOfLight;
872 
873  if (PointRp.GetZ(CS) > PointRp_eye0.GetZ(CS))// asuming a downgoing shower
874  deltaT *= -1;
875  if ( IsUpGoing)// correting for upgoing showers
876  deltaT *= -1;
877 
878  double T_zero = To + deltaT;
879  T_zero += (EndFADCTrace[0] - EndFADCTrace[count]);
880 
881 
882  eyerec.SetTZero(T_zero,To_err);
883  eyerec.SetSDP(sdp[count]);
884 
885  //This variables are not estimated in the
886  //current Multi_Eye reconstruction
887  fChi0Error = 0;
888  fRpError = 0;
889  //-----------------------
890  eyerec.SetChiZero(fChi0,fChi0Error);
891  eyerec.SetRp(fRp,fRpError);
892 
893  //Setting chi_i for each pixel
894 
895  fevt::EyeRecData& recdata = eye.GetRecData();
896 
897  for (EyeRecData::PixelIterator iter = recdata.PulsedPixelsBegin();
898  iter != recdata.PulsedPixelsEnd(); ++iter) {
899 
900  fevt::Pixel& evtPixel = *iter;
901  const fdet::Pixel& detPixel = fdetector.GetPixel(evtPixel);
902  Vector pixeldir = detPixel.GetDirection();
903  // subtract component parallel to sdp
904  Vector chi_i_vector = pixeldir - (sdp[count] * pixeldir) * sdp[count];
905  chi_i_vector /= chi_i_vector.GetR(eyeCS);
906 
907  double chi_i = Angle(chi_i_vector,horizontal[count]);
908  evtPixel.GetRecData().SetChi_i(chi_i);
909 
910  } //End Setting chi_i
911 
912  ++count;
913  }
914 }
915 
916 
917 void
918 StereoGeometryFinder::MinuitFitFuncStereoHybrid(
919  int& /*npar*/, double* /*gin*/, double& f, double* par, int /*iflag*/)
920 {
921  fevt::FEvent& fevent = fCurEvent->GetFEvent();
923 
924  const fdet::FDetector& fdetector = det::Detector::GetInstance().GetFDetector();
925  const unsigned int nEyes = fdetector.GetLastEyeId();
926 
928  det::Detector::GetInstance().GetSiteCoordinateSystem();
929 
930  //--------------------------
931  const ReferenceEllipsoid& e = ReferenceEllipsoid::GetWGS84();
932 
933  // This is to avoid having crazy core first guess values
934  double R = sqrt((par[0]-6095767)*(par[0]-6095767) + (par[1]-469363)*(par[1]-469363));
935  if( R > 60000) {
936  par[0] = 6095767;
937  par[1] = 469363;
938  }
939 
940  UTMPoint UTMcore(par[0],par[1],1400,19,'H',e);
941  Point core_1400 = UTMcore.GetPoint(CS);
943  Vector stereoAxis(1,par[2],par[3],coreCS, Vector::kSpherical);
944 
945  bool IsUpGoing = false;
946  if ( cos( stereoAxis.GetTheta(CS) ) < 0 )
947  IsUpGoing = true;
948 
949 
950  vector<Vector> sdp(nEyes);
951  vector<Vector> horizontal(nEyes);
952  vector<Point> eyePosition(nEyes);
953  vector<int> eyeId(nEyes);
954  vector<double> coreDistance(nEyes);
955  vector<double> EndFADCTrace(nEyes);
956  vector<Point> core(nEyes);
957  int count = 0;
958 
959  utl::TimeStamp time0;
960  //-------------------------------------------------------------
961  //Estimating the core location (at the Eye level), the horizontal
962  // and the SDP normal for the Eyes involved in the event
963 
964  for (eyeIter = fevent.EyesBegin(ComponentSelector::eHasData);
965  eyeIter != fevent.EyesEnd(ComponentSelector::eHasData);
966  ++eyeIter) {
967 
968  const fevt::Eye& eye = *eyeIter;
969 
970  CoordinateSystemPtr eyeCS =
971  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetEyeCoordinateSystem();
972 
973  eyePosition[count] =
974  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetPosition();
975 
976  //vertical distance from the core at 1400m altitute.
977  double deltaH = core_1400.GetZ(eyeCS);
978  Vector AxisPointingUp = stereoAxis;
979  if( IsUpGoing )
980  AxisPointingUp *= -1;
981  //distance along the shower axis
982  double deltaLength = deltaH / cos(AxisPointingUp.GetTheta(eyeCS)) ;
983 
984  core[count] = core_1400 - deltaLength * AxisPointingUp ;
985  horizontal[count] = core[count] - eyePosition[count];
986 
987  coreDistance[count] = horizontal[count].GetR(eyeCS);
988  horizontal[count] /= horizontal[count].GetR(eyeCS);
989 
990  sdp[count] = cross(stereoAxis,horizontal[count]);
991  sdp[count] /= sdp[count].GetR(eyeCS);
992 
993  eyeId[count] = eye.GetId();
994 
995  utl::TimeStamp time = eye.GetHeader().GetTimeStamp();
996  if (count == 0 )
997  time0 = time;
998  EndFADCTrace[count] = double (time.GetGPSNanoSecond());
999 
1000  ++count;
1001  }
1002  //--------------------------
1003 
1004  //---------------------------------------------------
1005  // Starting with the Multiple Eye Fit
1006  count = 0;
1007  double chisq = 0;
1008 
1009  // The To used in the stereo fit corresponds to the first eye.
1010  // We are loading the first eye geometry information, So that
1011  // we can estimate the To corresponding to the other eyes.
1012  double chi_eye0 = Angle(horizontal[0],stereoAxis);
1013  if (IsUpGoing)
1014  chi_eye0 *= -1;
1015  double Rp_magnitude_eye0 = coreDistance[0] * sin(chi_eye0);
1016  Vector Rp_unit_eye0 = cross(sdp[0],stereoAxis);
1017  if (IsUpGoing)
1018  Rp_unit_eye0 *= -1;
1019  Rp_unit_eye0 /= Rp_unit_eye0.GetR(CS);
1020  Point PointRp_eye0;
1021  PointRp_eye0 = eyePosition[0] + Rp_magnitude_eye0*Rp_unit_eye0;
1022 
1023  UTMPoint UTM_Rp_Eye0(PointRp_eye0,e);
1024  double Rp0_height = UTM_Rp_Eye0.GetHeight();
1025  double DeltaHeight = Rp0_height - 1400;
1026  double Delta_L = DeltaHeight / cos(stereoAxis.GetTheta(coreCS));
1027  double tcore_1400 = par[4] + Delta_L / kSpeedOfLight;
1028  //------------------------------------------------------------
1029  // Initializing some parameters
1030  vector<double> chisq_time(nEyes, 0);
1031  vector<int> dof(nEyes, 0);
1032  double sum_charge = 0;
1033  //-------------------------------
1034  //Begin Time Fit
1035 
1036  for (eyeIter = fevent.EyesBegin(ComponentSelector::eHasData);
1037  eyeIter != fevent.EyesEnd(ComponentSelector::eHasData);
1038  ++eyeIter) {
1039 
1040  sum_charge = 0;
1041 
1042  const fevt::Eye& eye = *eyeIter;
1043  const fevt::EyeRecData& recdata = eye.GetRecData();
1044 
1045  //Checking that the Eye has enough pixels
1046  if (recdata.GetNSDPPixels() <= 3 )
1047  continue;
1048 
1049  CoordinateSystemPtr eyeCS = fdetector.GetEye(eye).GetEyeCoordinateSystem();
1050 
1051 
1052  double chi_0 = Angle(horizontal[count],stereoAxis);
1053  if (IsUpGoing)
1054  chi_0 *= -1;
1055  double r_p = coreDistance[count] * sin(kPi - chi_0);
1056 
1057 
1058  //Estimating To for the corresponding Eye
1059  double deltaT;
1060  Point PointRp;
1061 
1062 
1063  double Rp_magnitude = coreDistance[count] * sin(chi_0);
1064  Vector Rp_unit = cross(sdp[count],stereoAxis);
1065  if (IsUpGoing)
1066  Rp_unit *= -1;
1067  Rp_unit /= Rp_unit.GetR(CS);
1068  PointRp = eyePosition[count] + Rp_magnitude*Rp_unit;
1069  Vector delta_distance = PointRp - PointRp_eye0;
1070  deltaT = delta_distance.GetR(CS) / kSpeedOfLight;
1071 
1072 
1073  if (PointRp.GetZ(CS) > PointRp_eye0.GetZ(CS))//asuming a downgoing shower
1074  deltaT *= -1;
1075  if ( IsUpGoing ) // correting for upgoing showers
1076  deltaT *= -1;
1077 
1078  double t_0 = par[4] + deltaT ;
1079  t_0 += (EndFADCTrace[0] - EndFADCTrace[count]);
1080  //-----------------------------------------
1082  for (iter= recdata.TimeFitPixelsBegin();
1083  iter!=recdata.TimeFitPixelsEnd(); ++iter) {
1084 
1085  const Pixel& pixel = *iter;
1086  const PixelRecData& pixrec = pixel.GetRecData();
1087 
1088  double t_i = pixrec.GetT_i().GetNanoSecond();
1089  double t_i_Err = pixrec.GetT_iError().GetInterval();
1090  double chi_i = pixrec.GetChi_i();
1091  //double chi_i_Err = 0;
1092 
1093  //Re-estimate chi_i according to the current SDP
1094  const fevt::Pixel& evtPixel = *iter;
1095  const fdet::Pixel& detPixel = fdetector.GetPixel(evtPixel);
1096  Vector pixeldir = detPixel.GetDirection();
1097  pixeldir.TransformTo(eyeCS);
1098  sdp[count].TransformTo(eyeCS);
1099  // subtract component parallel to sdp
1100  Vector chi_i_vector = pixeldir - (sdp[count] * pixeldir) * sdp[count];
1101  chi_i_vector.TransformTo(eyeCS);
1102  chi_i_vector /= chi_i_vector.GetR(eyeCS);
1103  horizontal[count].TransformTo(eyeCS);
1104  chi_i = Angle(chi_i_vector,horizontal[count]);
1105  //End Re-estimating chi_i
1106 
1107  double t_expected =
1108  t_0 + r_p/kSpeedOfLight * std::tan(0.5 * (chi_0 - chi_i));
1109 
1110  double tmp = t_i - t_expected ;
1111 
1112  // weighting according to the pixel charge
1113 
1114  double charge = pixrec.GetTotalCharge();
1115  charge = 1;
1116 
1117  chisq_time[count] += tmp*tmp*charge/ (t_i_Err * t_i_Err) ;
1118  sum_charge += charge;
1119 
1120  if (fDebugging == 1)
1121  cout << "delta t: " << tmp
1122  << " chisq " << tmp*tmp / (t_i_Err * t_i_Err)
1123  << " Eye: " << eye.GetId()
1124  << " Chi0 : " << chi_0/degree
1125  << " Rp: " << r_p
1126  << " T0: " << t_0
1127  << "chisq_time: " << chisq_time[count]
1128  << " " << count
1129  << endl;
1130  }
1131 
1132  dof[count] = recdata.GetNTimeFitPixels();
1133  chisq_time[count] /= sum_charge;
1134  chisq_time[count] *= recdata.GetNTimeFitPixels();
1135  ++count;
1136  }
1137  // end Time fit
1138  //---------------------------
1139  //Begin SDP fit
1140  vector<double> chisq_sdp(nEyes, 0);
1141 
1142  sum_charge = 0;
1143  count = 0;
1144 
1145  for (eyeIter = fevent.EyesBegin(ComponentSelector::eHasData);
1146  eyeIter != fevent.EyesEnd(ComponentSelector::eHasData);
1147  ++eyeIter) {
1148 
1149  const fevt::Eye& eye = *eyeIter;
1150  const fevt::EyeRecData& recdata = eye.GetRecData();
1151 
1152  //Checking that the Eye has enough pixels
1153  if (recdata.GetNSDPPixels() <= 3)
1154  continue;
1155 
1157 
1158  const fdet::Eye& deteye = fdetector.GetEye(eye);
1159 
1160  // use the eye coordinate system.
1161  // CS refer to the eye CS.
1163 
1164  sdp[count].TransformTo(eyeCS);
1165 
1166  double sdpTheta = sdp[count].GetTheta(eyeCS);
1167  double sdpPhi = sdp[count].GetPhi(eyeCS);
1168 
1169  Vector sdp2 (1,sdpTheta ,sdpPhi ,eyeCS, Vector::kSpherical);
1170 
1171  // iterate over pixels
1172  for (pixeliter = recdata.TimeFitPixelsBegin();
1173  pixeliter != recdata.TimeFitPixelsEnd();
1174  ++pixeliter) {
1175 
1176  const fevt::Pixel& evtPixel = *pixeliter;
1177  const fdet::Pixel& detPixel = fdetector.GetPixel(evtPixel);
1178 
1179  Vector dir = detPixel.GetDirection();
1180  dir.TransformTo(eyeCS);
1181 
1182  // distance from trial plane
1183  double tmp = kPiOnTwo - Angle(dir, sdp2);
1184 
1185  if (fDebugging == 1)
1186  cout << "deviation from SDP " << tmp /degree
1187  << " [deg] , Eye: " << eye.GetId()
1188  << " Pixel Id : " << detPixel.GetId()
1189  << endl;
1190 
1191  // weight to assign
1192  double charge = evtPixel.GetRecData().GetTotalCharge();
1193 
1194  chisq_sdp[count] += tmp*tmp * charge / ((0.35 * degree * 0.35 * degree));
1195  sum_charge += charge;
1196  }
1197 
1198  chisq_sdp[count] /= sum_charge;
1199  chisq_sdp[count] *= dof[count];
1200  ++count;
1201  }
1202  // End SDP Fit
1203  //---------------------
1204  //Start of the Hybrid fit
1205 
1206  double chisq_hybrid = 0;
1207 
1208  sevt::SEvent& sevent = fCurEvent->GetSEvent();
1209  SEvent::StationIterator sditer;
1210  for(sditer=sevent.StationsBegin(); sditer != sevent.StationsEnd(); ++sditer)
1211  {
1212 
1213  if (!sditer->HasRecData()) {
1214  continue;
1215  }
1216  sevt::Station& station=*sditer;
1217 
1218  if (station.GetId() != fHotStationId )
1219  continue;
1220 
1221 
1223 
1224 
1225 
1226  const sdet::Station& detstation =
1227  det::Detector::GetInstance().GetSDetector().GetStation(station);
1228  const Point& stationpos=detstation.GetPosition();
1229  const utl::Point& pos = stationpos ;
1230 
1231  const Vector VCoreToStation = pos - core_1400;
1232  //const double CoreToStation = VCoreToStation.GetMag();
1233  const double Axis_VS_CoreToStation_angle = Angle(VCoreToStation,stereoAxis);
1234 
1235  const double station_to_axis = VCoreToStation.GetMag() * sin(Axis_VS_CoreToStation_angle);
1236 
1237 
1238  //-----------------------------
1239  // Expected time at the station
1240  const double delta_d = VCoreToStation.GetMag() * cos(Axis_VS_CoreToStation_angle);
1241 
1242  double exp_t_st = tcore_1400 - delta_d/kSpeedOfLight;
1243  // time delay due to the shower front curvature
1244  // do not apply shower front corrrection for up-going events
1245  if (!IsUpGoing) {
1246  const double VerticalCurvature = 1 / 9000.;
1247  const double d2 = station_to_axis * station_to_axis;
1248  const double curvature = VerticalCurvature*stereoAxis.GetCosTheta(coreCS);
1249  const double timeDelay = curvature * d2 / (2*kSpeedOfLight);
1250  exp_t_st += timeDelay;
1251  }
1252 
1253  // Hybrid upgoing events involving station 203 (Celeste)
1254  // are very likely to be laser shots
1255  // 180 ns is the fiber optic propagation time
1256  if (IsUpGoing && station.GetId() == 203) exp_t_st += fCelesteDelay;
1257 
1258  // The 'exp_t_st' is relative to the trigger time of the first Eye
1259  //-----------------------------
1260  double eye_trigger_time = double(time0.GetGPSNanoSecond());
1261  // double(time0.GetGPSNanoSecond()) gives the time at the end of the FD FADC trace from the first Eye.
1262  // by substracting 1000 *100 ns we get the start time of the first Eye FD FADC trace.
1263  eye_trigger_time -= 1000 *100;
1264  // exp_t_st, is the expected trigger time of the station
1265  exp_t_st += eye_trigger_time;
1266  //Compare the expected with the observed station time
1267  double chi_hybrid = nanosecond - exp_t_st;
1268  double hybrid_error = 100;
1269 
1270  chisq_hybrid += chi_hybrid * chi_hybrid / (hybrid_error * hybrid_error);
1271 
1272  }
1273 
1274  //End hybrid chisqr
1275 
1276  //=============================
1277  //--------------------------------
1278  //Here we apply weights (if necesary) to the different
1279  //chisqr components
1280  count = 0;
1281  chisq = 0;
1282  for (eyeIter = fevent.EyesBegin(ComponentSelector::eHasData);
1283  eyeIter != fevent.EyesEnd(ComponentSelector::eHasData);
1284  ++eyeIter) {
1285 
1286  fevt::Eye& eye = *eyeIter;
1287  fevt::EyeRecData& recdata = eye.GetRecData();
1288 
1289  //Checking that the Eye has enough pixels
1290  if (recdata.GetNSDPPixels() <= 3)
1291  continue;
1292 
1293 
1294  //Storing the Stereo time and SDP chisqr values
1295  fNDofTimeFit = recdata.GetNTimeFitPixels() - 5 ;
1296  fNDofSDP = recdata.GetNTimeFitPixels() - 4 ;
1297  recdata.SetSDPFitChiSquare(chisq_sdp[count],fNDofSDP);
1298  recdata.SetTimeFitChiSquare(chisq_time[count],fNDofTimeFit);
1299  //-------------------------------------------------
1300  if (fDebugging == 1)
1301  cout << "chisq time: " << chisq_time[count]/dof[count]
1302  << " chisq SDP: " << chisq_sdp[count]/dof[count]
1303  << " dof " << dof[count]
1304  << endl;
1305 
1306  //----------------------------
1307  //NOTICE:
1308  // When the Eye's time offset is greater than ~100 ns is better to use
1309  // only one of the time chisq commponents. Otherwise it may find a
1310  // geometry that reduces the time offset, but having one or more
1311  // SDPs clearly off from the best SDP.
1312 
1313  if (eyeId[count] < 6 ) { //Excluding the 6th eye from the Fit
1314  if (fExcludeEye.count(eyeId[count]) == 0)
1315  chisq += chisq_time[count];
1316  if (fExcludeSDPEye.count(eyeId[count]) == 0)
1317  chisq += chisq_sdp[count]*5; //higher weight to the SDP component
1318  }
1319  ++count;
1320  }
1321  chisq += chisq_hybrid;
1322  f = chisq;
1323 }
1324 
1325 void
1326 StereoGeometryFinder::MinuitFitFuncStereo(
1327  int& /*npar*/, double* /*gin*/, double& f, double* par, int /*iflag*/)
1328 {
1329  fevt::FEvent& fevent = fCurEvent->GetFEvent();
1330  fevt::FEvent::EyeIterator eyeIter;
1331 
1332  const fdet::FDetector& fdetector = det::Detector::GetInstance().GetFDetector();
1333  const unsigned int nEyes = fdetector.GetLastEyeId();
1334 
1335  CoordinateSystemPtr CS =
1336  det::Detector::GetInstance().GetSiteCoordinateSystem();
1337 
1338  //--------------------------
1339  const ReferenceEllipsoid& e = ReferenceEllipsoid::GetWGS84();
1340 
1341  UTMPoint UTMcore(par[0],par[1],1400,19,'H',e);
1342  Point core_1400 = UTMcore.GetPoint(CS);
1344  Vector stereoAxis(1,par[2],par[3],coreCS, Vector::kSpherical);
1345 
1346  bool IsUpGoing = false;
1347  if ( cos( stereoAxis.GetTheta(CS) ) < 0 )
1348  IsUpGoing = true;
1349 
1350  vector<Vector> sdp(nEyes);
1351  vector<Vector> horizontal(nEyes);
1352  vector<Point> eyePosition(nEyes);
1353  vector<int> eyeId(nEyes);
1354  vector<double> coreDistance(nEyes);
1355  vector<double> EndFADCTrace(nEyes);
1356  vector<Point> core(nEyes);
1357  int count = 0;
1358 
1359  //-------------------------------------------------------------
1360  //Estimating the core location (at the Eye level), the horizontal
1361  // and the SDP normal for the Eyes involved in the event
1362 
1363 
1364  for (eyeIter = fevent.EyesBegin(ComponentSelector::eHasData);
1365  eyeIter != fevent.EyesEnd(ComponentSelector::eHasData);
1366  ++eyeIter) {
1367 
1368  const fevt::Eye& eye = *eyeIter;
1369 
1370  CoordinateSystemPtr eyeCS =
1371  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetEyeCoordinateSystem();
1372 
1373  eyePosition[count] =
1374  det::Detector::GetInstance().GetFDetector().GetEye(eye).GetPosition();
1375 
1376  //vertical distance from the core at 1400m altitute.
1377  double deltaH = core_1400.GetZ(eyeCS);
1378  Vector AxisPointingUp = stereoAxis;
1379  if( IsUpGoing )
1380  AxisPointingUp *= -1;
1381  //distance along the shower axis
1382  double deltaLength = deltaH / cos( AxisPointingUp.GetTheta(eyeCS)) ;
1383 
1384  core[count] = core_1400 - deltaLength * AxisPointingUp ;
1385  horizontal[count] = core[count] - eyePosition[count];
1386 
1387  coreDistance[count] = horizontal[count].GetR(eyeCS);
1388  horizontal[count] /= horizontal[count].GetR(eyeCS);
1389 
1390  sdp[count] = cross(stereoAxis,horizontal[count]);
1391  sdp[count] /= sdp[count].GetR(eyeCS);
1392 
1393  eyeId[count] = eye.GetId();
1394 
1395  utl::TimeStamp time = eye.GetHeader().GetTimeStamp();
1396  EndFADCTrace[count] = double (time.GetGPSNanoSecond());
1397 
1398  ++count;
1399  }
1400  //--------------------------
1401 
1402  //---------------------------------------------------
1403  // Starting with the Multiple Eye Fit
1404  count = 0;
1405  double chisq = 0;
1406 
1407  // The To used in the stereo fit corresponds to the first eye.
1408  // We are loading the first eye geometry information, So that
1409  // we can estimate the To corresponding to the other eyes.
1410  double chi_eye0 = Angle(horizontal[0],stereoAxis);
1411  if (IsUpGoing)
1412  chi_eye0 *= -1;
1413  double Rp_magnitude_eye0 = coreDistance[0] * sin(chi_eye0);
1414  Vector Rp_unit_eye0 = cross(sdp[0],stereoAxis);
1415  if (IsUpGoing)
1416  Rp_unit_eye0 *= -1;
1417  Rp_unit_eye0 /= Rp_unit_eye0.GetR(CS);
1418  Point PointRp_eye0;
1419  PointRp_eye0 = eyePosition[0] + Rp_magnitude_eye0*Rp_unit_eye0;
1420 
1421  //------------------------------------------------------------
1422  // Initializing some parameters
1423  double chisq_time[nEyes];
1424  int dof[nEyes];
1425  for (unsigned int i = 0; i < nEyes; i++) {
1426  chisq_time[i] = 0.;
1427  dof[i] = 0;
1428  }
1429  double sum_charge = 0;
1430  //-------------------------------
1431  //Begin Time Fit
1432 
1433  for (eyeIter = fevent.EyesBegin(ComponentSelector::eHasData);
1434  eyeIter != fevent.EyesEnd(ComponentSelector::eHasData);
1435  ++eyeIter) {
1436 
1437  sum_charge = 0;
1438 
1439  const fevt::Eye& eye = *eyeIter;
1440  const fevt::EyeRecData& recdata = eye.GetRecData();
1441 
1442  //Checking that the Eye has enough pixels
1443  if (recdata.GetNSDPPixels() <= 3 )
1444  continue;
1445 
1446  CoordinateSystemPtr eyeCS = fdetector.GetEye(eye).GetEyeCoordinateSystem();
1447 
1448 
1449  double chi_0 = Angle(horizontal[count],stereoAxis);
1450  if (IsUpGoing)
1451  chi_0 *= -1;
1452  double r_p = coreDistance[count] * sin(kPi - chi_0);
1453 
1454 
1455  //Estimating To for the corresponding Eye
1456  double deltaT;
1457  Point PointRp;
1458 
1459 
1460  double Rp_magnitude = coreDistance[count] * sin(chi_0);
1461  Vector Rp_unit = cross(sdp[count],stereoAxis);
1462  if (IsUpGoing)
1463  Rp_unit *= -1;
1464  Rp_unit /= Rp_unit.GetR(CS);
1465  PointRp = eyePosition[count] + Rp_magnitude*Rp_unit;
1466  Vector delta_distance = PointRp - PointRp_eye0;
1467  deltaT = delta_distance.GetR(CS) / kSpeedOfLight;
1468 
1469 
1470  if (PointRp.GetZ(CS) > PointRp_eye0.GetZ(CS))//asuming a downgoing shower
1471  deltaT *= -1;
1472  if ( IsUpGoing ) // correting for upgoing showers
1473  deltaT *= -1;
1474 
1475  double t_0 = par[4] + deltaT ;
1476  t_0 += (EndFADCTrace[0] - EndFADCTrace[count]);
1477  //-----------------------------------------
1479  for (iter= recdata.TimeFitPixelsBegin();
1480  iter!=recdata.TimeFitPixelsEnd(); ++iter) {
1481 
1482  const Pixel& pixel = *iter;
1483  const PixelRecData& pixrec = pixel.GetRecData();
1484 
1485  double t_i = pixrec.GetT_i().GetNanoSecond();
1486  double t_i_Err = pixrec.GetT_iError().GetInterval();
1487  double chi_i = pixrec.GetChi_i();
1488  //double chi_i_Err = 0;
1489 
1490  //Re-estimate chi_i according to the current SDP
1491  const fevt::Pixel& evtPixel = *iter;
1492  const fdet::Pixel& detPixel = fdetector.GetPixel(evtPixel);
1493  Vector pixeldir = detPixel.GetDirection();
1494  pixeldir.TransformTo(eyeCS);
1495  sdp[count].TransformTo(eyeCS);
1496  // subtract component parallel to sdp
1497  Vector chi_i_vector = pixeldir - (sdp[count] * pixeldir) * sdp[count];
1498  chi_i_vector.TransformTo(eyeCS);
1499  chi_i_vector /= chi_i_vector.GetR(eyeCS);
1500  horizontal[count].TransformTo(eyeCS);
1501  chi_i = Angle(chi_i_vector,horizontal[count]);
1502  //End Re-estimating chi_i
1503 
1504  double t_expected =
1505  t_0 + r_p/kSpeedOfLight * std::tan(0.5 * (chi_0 - chi_i));
1506 
1507  double tmp = t_i - t_expected ;
1508 
1509  // weighting according to the pixel charge
1510 
1511  double charge = pixrec.GetTotalCharge();
1512  charge = 1;
1513 
1514  chisq_time[count] += tmp*tmp*charge/ (t_i_Err * t_i_Err) ;
1515  sum_charge += charge;
1516 
1517  if (fDebugging == 1)
1518  cout << "delta t: " << tmp
1519  << " chisq " << tmp*tmp / (t_i_Err * t_i_Err)
1520  << " Eye: " << eye.GetId()
1521  << " Chi0 : " << chi_0/degree
1522  << " Rp: " << r_p
1523  << " T0: " << t_0
1524  << "chisq_time: " << chisq_time[count]
1525  << " " << count
1526  << endl;
1527  }
1528 
1529  dof[count] = recdata.GetNTimeFitPixels();
1530  chisq_time[count] /= sum_charge;
1531  chisq_time[count] *= recdata.GetNTimeFitPixels();
1532  ++count;
1533  }
1534  // end Time fit
1535  //---------------------------
1536  //Begin SDP fit
1537  double chisq_sdp[nEyes];
1538  for (unsigned int i = 0; i < nEyes; i++)
1539  chisq_sdp[i] = 0.;
1540 
1541  sum_charge = 0;
1542  count = 0;
1543 
1544  for (eyeIter = fevent.EyesBegin(ComponentSelector::eHasData);
1545  eyeIter != fevent.EyesEnd(ComponentSelector::eHasData);
1546  ++eyeIter) {
1547 
1548  const fevt::Eye& eye = *eyeIter;
1549  const fevt::EyeRecData& recdata = eye.GetRecData();
1550 
1551  //Checking that the Eye has enough pixels
1552  if (recdata.GetNSDPPixels() <= 3)
1553  continue;
1554 
1556 
1557  const fdet::Eye& deteye = fdetector.GetEye(eye);
1558 
1559  // use the eye coordinate system.
1560  // CS refer to the eye CS.
1562 
1563  sdp[count].TransformTo(CS);
1564 
1565  double sdpTheta = sdp[count].GetTheta(CS);
1566  double sdpPhi = sdp[count].GetPhi(CS);
1567 
1568  Vector sdp2 (1,sdpTheta ,sdpPhi ,CS, Vector::kSpherical);
1569 
1570  // iterate over pixels
1571  for (pixeliter = recdata.TimeFitPixelsBegin();
1572  pixeliter != recdata.TimeFitPixelsEnd();
1573  ++pixeliter) {
1574 
1575  const fevt::Pixel& evtPixel = *pixeliter;
1576  const fdet::Pixel& detPixel = fdetector.GetPixel(evtPixel);
1577 
1578  Vector dir = detPixel.GetDirection();
1579  dir.TransformTo(CS);
1580 
1581  // distance from trial plane
1582  double tmp = kPiOnTwo - Angle(dir, sdp2);
1583 
1584  if (fDebugging == 1)
1585  cout << "deviation from SDP " << tmp /degree
1586  << " [deg] , Eye: " << eye.GetId()
1587  << " Pixel Id : " << detPixel.GetId()
1588  << endl;
1589 
1590  // weight to assign
1591  double charge = evtPixel.GetRecData().GetTotalCharge();
1592 
1593  chisq_sdp[count] += tmp*tmp * charge / ((0.35 * degree * 0.35 * degree));
1594  sum_charge += charge;
1595  }
1596 
1597  chisq_sdp[count] /= sum_charge;
1598  chisq_sdp[count] *= dof[count];
1599  ++count;
1600  }
1601  // End SDP Fit
1602  //--------------------------------
1603  //Here we apply weights (if necesary) to the different
1604  //chisqr components
1605  count = 0;
1606  chisq = 0;
1607  for (eyeIter = fevent.EyesBegin(ComponentSelector::eHasData);
1608  eyeIter != fevent.EyesEnd(ComponentSelector::eHasData);
1609  ++eyeIter) {
1610 
1611  fevt::Eye& eye = *eyeIter;
1612  fevt::EyeRecData& recdata = eye.GetRecData();
1613 
1614  //Checking that the Eye has enough pixels
1615  if (recdata.GetNSDPPixels() <= 3)
1616  continue;
1617 
1618 
1619  //Storing the Stereo time and SDP chisqr values
1620  fNDofTimeFit = recdata.GetNTimeFitPixels() - 5 ;
1621  fNDofSDP = recdata.GetNTimeFitPixels() - 4 ;
1622  recdata.SetSDPFitChiSquare(chisq_sdp[count],fNDofSDP);
1623  recdata.SetTimeFitChiSquare(chisq_time[count],fNDofTimeFit);
1624  //-------------------------------------------------
1625  if (fDebugging == 1)
1626  cout << "chisq time: " << chisq_time[count]/dof[count]
1627  << " chisq SDP: " << chisq_sdp[count]/dof[count]
1628  << " dof " << dof[count]
1629  << endl;
1630 
1631  //----------------------------
1632  //NOTICE:
1633  // When the Eye's time offset is greater than ~100 ns is better to use
1634  // only one of the time chisq commponents. Otherwise it may find a
1635  // geometry that reduces the time offset, but having one or more
1636  // SDPs clearly off from the best SDP.
1637 
1638  if (eyeId[count] < 6 ) { //Excluding the 6th eye from the Fit
1639  if (fExcludeEye.count(eyeId[count]) == 0)
1640  chisq += chisq_time[count];
1641  if (fExcludeSDPEye.count(eyeId[count]) == 0)
1642  chisq += chisq_sdp[count]*5; //higher weight to the SDP component
1643  }
1644  ++count;
1645  }
1646  f = chisq;
1647 }
1648 
1649 
1651 StereoGeometryFinder::Finish()
1652 {
1653  return eSuccess;
1654 }
1655 
1656 
1657 
AxialVector cross(const Vector &l, const Vector &r)
vector cross product
Definition: OperationsAV.h:32
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
The Auger coordinate system (x to east, z local verical) for this eye.
unsigned int GetId() const
Definition: FEvent/Eye.h:54
unsigned int GetId() const
By default from 1..440.
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
double GetChi0TZeroCorrelation() const
Definition: EyeRecData.h:88
StationIterator StationsEnd()
End of all stations.
Definition: SEvent.h:59
void SetSDPFitChiSquare(const double sdpChi2, const unsigned int ndof)
int GetId() const
Get the station Id.
void Normalize()
Definition: Vector.h:64
const double degree
Point object.
Definition: Point.h:32
double Angle(const double theta1, const double phi1, const double theta2, const double phi2)
double GetRpError() const
Definition: EyeRecData.h:91
double GetPhi(const CoordinateSystemPtr &coordinateSystem) const
azimuth (phi) angle in spherical and cylindrical coordinates
Definition: BasicVector.h:254
Detector description interface for Station-related data.
void SetSDPFitChiSquare(const double sdpChi2, const unsigned int ndof)
Definition: EyeRecData.h:229
fevt::EyeHeader & GetHeader()
Header for this Eye Event.
Definition: FEvent/Eye.cc:180
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
double GetR(const CoordinateSystemPtr &coordinateSystem) const
radius r in spherical coordinates coordinates (distance to origin)
Definition: BasicVector.h:257
const Pixel & GetPixel(const fevt::Pixel &eventPixel) const
Get fdet::Pixel from fevt::Channel.
Definition: FDetector.cc:198
Interface class to access to the SD part of an event.
Definition: SEvent.h:39
void MakeRecData()
Definition: FEvent/Eye.cc:145
double GetTheta(const CoordinateSystemPtr &coordinateSystem) const
zenith (theta) angle in spherical coordinates
Definition: BasicVector.h:248
double GetChiZero() const
Definition: EyeRecData.h:85
Class to hold and convert a point in geodetic coordinates.
Definition: UTMPoint.h:40
double GetSDPFitChiSquare() const
Definition: EyeRecData.h:80
void SetAxis(const utl::Vector &axis)
fRp(t.GetRp())
double GetCosTheta(const CoordinateSystemPtr &coordinateSystem) const
cos of zenith (theta) angle
Definition: BasicVector.h:251
std::vector< unsigned short int > & GetStationIds()
retrieve vector of station IDs used in hybrid fit
unsigned int GetSDPFitNDof() const
Definition: EyeRecData.h:81
void SetCorePosition(const utl::Point &core)
EyeIterator EyesEnd(const ComponentSelector::Status status)
Definition: FEvent.h:66
unsigned int GetTimeFitNDof() const
Definition: EyeRecData.h:93
double GetRpTZeroCorrelation() const
Definition: EyeRecData.h:90
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
unsigned int GetLastEyeId() const
Get Id of last eye.
Definition: FDetector.cc:35
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.
const Eye & GetEye(const unsigned int eyeId) const
Find eye by numerical Id.
Definition: FDetector.cc:68
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 GetNorthing() const
Get the northing.
Definition: UTMPoint.h:206
double GetMag() const
Definition: Vector.h:58
double GetSDPPhiError() const
Definition: EyeRecData.h:78
double GetTZeroError() const
Definition: EyeRecData.h:84
Detector description interface for FDetector-related data.
Definition: FDetector.h:44
double GetChiZeroError() const
Definition: EyeRecData.h:86
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.
V To(const G4ThreeVector &v, const utl::CoordinateSystemPtr &cs, const double unitConversion)
Definition: G4Utils.h:30
void SetSDP(const utl::AxialVector &vec)
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
fTZero(t.GetTZero())
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.
utl::TimeStamp GetSignalStartTime() const
Start time of the signal.
double GetHeight() const
Get the height.
Definition: UTMPoint.h:212
Fluorescence Detector Pixel event.
Definition: FEvent/Pixel.h:28
const double ns
void SetCoreTime(const utl::TimeStamp &coreTime, const utl::TimeInterval &coreTimeErr)
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
constexpr double nanosecond
Definition: AugerUnits.h:143
void SetAxis(const utl::Vector &axis)
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 SetSDPPhiError(const double sdpPhiError)
void SetChiZero(const double chiZero, const double error)
void SetTimeFitChiSquare(const double tfitChi2, const unsigned int ndof)
Definition: EyeRecData.h:232
double GetEasting() const
Get the easting.
Definition: UTMPoint.h:209
constexpr double kPiOnTwo
Definition: MathConstants.h:25
double GetSDPCorrThetaPhi() const
Definition: EyeRecData.h:79
Telescope-specific shower reconstruction data.
void SetSDPThetaError(const double sdpThetaError)
boost::filter_iterator< ComponentSelector, AllTelescopeIterator > TelescopeIterator
selective Telescope iterators
Definition: FEvent/Eye.h:72
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
double GetTimeFitChiSquare() const
Definition: EyeRecData.h:92
unsigned int GetNTimeFitPixels() const
Get number of Time Fit pixels.
Definition: EyeRecData.h:184
double GetRpChi0Correlation() const
Definition: EyeRecData.h:89
boost::indirect_iterator< InternalPixelIterator, fevt::Pixel & > PixelIterator
Iterator over pixels used in reconstruction.
Definition: EyeRecData.h:113
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 GetGPSNanoSecond() const
GPS nanosecond.
Definition: TimeStamp.h:127
void SetTZero(const double tzero, const double error)
double GetRp() const
Definition: EyeRecData.h:87
utl::TimeStamp GetTimeStamp() const
Time of the Eye Event as tagged by FD-DAS (== eye trigger time plus pixel trace length) ...
Definition: EyeHeader.h:118
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
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
void SetSDP(const utl::AxialVector &vec)
Definition: EyeRecData.h:218
double GetTZero() const
Definition: EyeRecData.h:83
void SetTZero(const double tzero, const double error)
Definition: EyeRecData.h:235
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
static Policy::type Create(const utl::Point &theOrigin)
Create the standard local coordinate system for a Point.
unsigned int GetNSDPPixels() const
Get number of SDP pixels.
Definition: EyeRecData.h:165
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
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)
void SetChi_i(const double chi_i)
Definition: PixelRecData.h:114
PixelRecData & GetRecData()
Definition: FEvent/Pixel.h:40
void SetSDPCorrThetaPhi(double sdpCorrThetaPhi)
fevt::EyeRecData & GetRecData()
Reconstructed data for this eye.
Definition: FEvent/Eye.cc:130
double GetSDPThetaError() const
Definition: EyeRecData.h:77

, generated on Tue Sep 26 2023.