SdCompositionParameters.cc
Go to the documentation of this file.
1 // File "SdCompositionParameters.cc"
2 //
3 // This module calculates composition sensitive variables for an event.
4 // In includes Risetime calculation from the former Module "Risetime1000LLL", which is obsolete now.
5 // The risetime is a value interpolated from a fit to the individual risetimes of
6 // each candidate station in the shower plane. An option to
7 // recalculate the risetime of each station is provided.
8 //
9 //
10 // Author: Philipp Papenbreer, M.D.Healy, D.Barnhill
11 // Modified: Feb 2014, P.Papenbreer
12 // Created: May 24, 2016
13 // Modified: May 24, 2016
14 //********************************************************************
15 //
16 //
17 //
18 //History of Risetime1000LLL.cc parts:
19 // D.Barnhill (August 10, 2005)
20 // Taking M. Healy's original code and modifying a few things to make
21 // it more simple and reliable
22 //
23 // M.Healy (Sep 18, 2006): Further modifing the code to allow the
24 // error parameterization from leeds. Also commenting out the linear
25 // fit for risetime to eliminate events that are on the cusp in terms
26 // of quality.
27 //
28 // M.Healy (Oct 9, 2006): Export the chi2 of the risetime fit for
29 // collection by subsiquent modules.
30 //
31 // M.Healy (Nov 21, 2006): Fixed a bug related to the inclusion of
32 // non-canidate stations from the event selection.
33 //
34 // M.Healy (Nov 29, 2006): Major upgrade to eliminate vestigial code
35 // and bring the module up to distribution quality standards. Version
36 // to be submitted to the offline SVN shortly.
37 //
38 // M.Healy (Dec 1, 2006): Used the major upgrade to add functionality
39 // that will interface with the ADST produced by Karlsruhe. This will
40 // allow browsing the fit results in the ADST viewer.
41 //
42 // M.Healy (Dec 14, 2006): Bug fixes, and changes to compile with
43 // version v2r2p3 of the offline.
44 //
45 // M.Healy (Jan 8, 2007): Strip out code to call RecShower->GetZenith()
46 // because it is not implimented. Reverted to old method for getting
47 // the shower zenith angle.
48 //
49 // M.Healy (Jan 17, 2007): Eliminated the streaming of the TF1 object
50 // in the fit results. This was not working with the ADST writer so
51 // resorted to the use of two doubles.
52 //
53 // M.Healy (May 15, 2007): The module is changed to use variables in
54 // the event now. This is intended to replace the static variables
55 // that are currently in use. For now I leave much of the old code as
56 // is so that the changes are incrimental. I don't want to break
57 // anything just before a release.
58 //
59 //
60 // C. Jarne (2014/02) New asymmetry correction.
61 // C. Jarne (2014/02) Modification in uncertanty estimation according
62 // to gap2013-079 (now correlation term included).
63 
64 // Standard c++ headers
65 #include <sstream>
66 #include <cmath>
67 #include <vector>
68 
69 // Offline headers
70 #include <fwk/CentralConfig.h>
71 
72 #include <evt/Event.h>
73 #include <evt/ShowerRecData.h>
74 #include <evt/ShowerSRecData.h>
75 
76 #include <sevt/SEvent.h>
77 #include <sevt/Header.h>
78 #include <sevt/Station.h>
79 #include <sevt/StationRecData.h>
80 #include <sevt/StationConstants.h>
81 #include <sevt/PMT.h>
82 #include <sevt/PMTRecData.h>
83 
84 #include <det/Detector.h>
85 
86 #include <utl/Reader.h>
87 #include <utl/AugerUnits.h>
88 #include <utl/ErrorLogger.h>
89 #include <utl/StringCompare.h>
90 #include <utl/Trace.h>
91 #include <utl/TraceAlgorithm.h>
92 
93 #include <fwk/VModule.h>
94 
95 // ROOT headers
96 #include <TFormula.h>
97 #include <TMatrixD.h>
98 #include <TVirtualFitter.h>
99 
100 // Headers for this module
101 #include "SdCompositionParameters.h"
102 #include <evt/ShowerSRecDataQuantities.h>
103 
104 using namespace std;
105 using namespace fwk;
106 using namespace utl;
107 using namespace sevt;
108 using namespace SdCompParam;
109 using std::ostringstream;
110 using std::vector;
111 
112 
113 // These are static variables and will be refered to in this manner throughout
114 double SdCompositionParameters::fgRisetime = -1;
115 double SdCompositionParameters::fgRisetimeError = -1;
116 double SdCompositionParameters::fgRisetimeReducedChi2 = -1;
117 SdCompositionParameterResults* SdCompositionParameters::fgCompositionParameterResults = NULL;
118 DeltaResults* SdCompositionParameters::fgDeltaResults = NULL;
119 // End static variables
120 
121 //#define DEBUG_Risetime1000LLL
122 
123 
124 SdCompositionParameterResults::SdCompositionParameterResults() :
125  fFitPar0(0),
126  fFitPar1(0),
127  fRisetime1000(-1),
128  fRisetime1000Error(-1),
129  fRisetime1000Chi2(-1),
130  fRisetime1000NDF(-1),
131  fXmax(-1),
132  fXmaxErrorUp(-1),
133  fXmaxErrorDown(-1)
134 { }
135 
136 
138 {
139  for (std::vector<StationSdParameterData*>::iterator sIt = fStationData.begin();
140  sIt != fStationData.end(); ++sIt)
141  delete *sIt;
142 }
143 
144 
146 {
147  Delta = -1;
148 }
149 
150 
152 {
153  for (std::vector<StationSdParameterData*>::iterator sIt = fStationData.begin();
154  sIt != fStationData.end(); ++sIt)
155  delete *sIt;
156 }
157 
158 
160 {
161  // Define the Risetime
162  fRiseTimeStartPercent = 0.1; //10%
163  fRiseTimeStopPercent = 0.5; //50%
164  fForceRiseTimeRecalculation = false; //False
165 
166  // Fit the Risetime
167  fDoRiseTimeFit = true; //True
168  fMinimumSignalForRiseTimeFit = 10; //10.0 VEM
169  fMinimumDistanceForRiseTimeFit = 0; //0.0 meters
170  fMaximumDistanceForRiseTimeFit = 1600; //1600.0 meters
171  fIncludeSaturatedForRiseTimeFit = false; //False
172  fDistanceToInterpolateFitResult = 1000; //1000.0 meters
173  fRTWeightingFunction = NULL;
174  fRTWeights = NULL;
175  fRejectedStations = 0;
176  fRTRejectedStations = 0; //Stations only rejected for Risetime studies
177  fLDFRejectedStations = 0; //Stations rejected for LDF studies
178  //Calculate Leeds Delta
179  fDoCalculateLeedsDelta = true;
181 }
182 
183 
185 {
186  delete[] fRTWeightingFunction;
190 }
191 
192 
195 {
196  CentralConfig* const cc = CentralConfig::GetInstance();
197  std::ostringstream info;
198 
199  info << "Configuring the FADC Parameters module.\n"
200  "***************************************\n";
201 
202  Branch topBranch = cc->GetTopBranch("SdCompositionParameters");
203 
204  //Risetime Stuff
205  //Branch RiseTimeBranch = topBranch.GetChild("RecalculateRisetime");
206  Branch riseTimeBranch = topBranch.GetFirstChild();
207  riseTimeBranch.GetChild("RiseTimeStart").GetData(fRiseTimeStartPercent);
208  riseTimeBranch.GetChild("RiseTimeStop").GetData(fRiseTimeStopPercent);
209  AttributeMap attributes = riseTimeBranch.GetAttributes();
210  if (StringEquivalent(attributes["ReCalc"], "yes")) {
211  info << "Going to recalculate risetimes for stations.\n"
212  "Pulse RiseTime defined as:\n"
213  << fRiseTimeStartPercent*100 << "% to " << fRiseTimeStopPercent*100
214  << "% of total signal.\n";
216  } else {
217  info << "Using existing station risetimes (from SdCalibrator).\n";
219  }
220  //End Risetime Stuff
221 
222  //Risetime Fit Stuff
223  info << "\nConfiguring the risetime fit routines.\n";
224  Branch risetimeFitBranch;
225  //if(RisetimeFitBranch = topBranch.GetChild("DoRisetimeFit"))
226  if ((risetimeFitBranch = riseTimeBranch.GetNextSibling())) {
227  attributes = risetimeFitBranch.GetAttributes();
228  }
229 
230  if (StringEquivalent(attributes["Fit"], "yes")) {
231  info << "Fitting the risetime for the event is enabled.\n";
232 
233  fDoRiseTimeFit = true;
234  risetimeFitBranch.GetChild("MinimumSignal").GetData(fMinimumSignalForRiseTimeFit);
235  risetimeFitBranch.GetChild("MinimumDistance").GetData(fMinimumDistanceForRiseTimeFit);
236  risetimeFitBranch.GetChild("MaximumDistance").GetData(fMaximumDistanceForRiseTimeFit);
237  risetimeFitBranch.GetChild("RisetimeEvaluatedAt").GetData(fDistanceToInterpolateFitResult);
238  info << "\tMinimum Signal " << fMinimumSignalForRiseTimeFit << " VEM\n"
239  << "\tMinimum Distance " << fMinimumDistanceForRiseTimeFit/m << " meters\n"
240  << "\tMaximum Distance " << fMaximumDistanceForRiseTimeFit/m << " meters\n"
241  << "\tRisetime Distance " << fDistanceToInterpolateFitResult/m << " meters\n";
242 
243  risetimeFitBranch.GetChild("IncludeSaturated").GetData(fIncludeSaturatedForRiseTimeFit);
245  info << "\tIncluding saturated stations.\n";
246  else
247  info << "\tNot including saturated stations.\n";
248 
249  std::string weightingFunction;
250  risetimeFitBranch.GetChild("WeightAsFunctionDistance").GetData(weightingFunction);
251  fRTWeightingFunction = new char[weightingFunction.size() + 1];
252  std::strcpy(fRTWeightingFunction, weightingFunction.c_str());
253  info << "\tWeighting Function: " << fRTWeightingFunction << '\n';
254  } else
255  info << "Fitting the risetime for the event is disabled.\n";
256 
257  fRTWeights = new TFormula("RiseTimeWeights", fRTWeightingFunction);
258  if (fRTWeights->IsZombie()) {
259  ostringstream error;
260  error << "Weight formula defined in SdCompositionParameters.xml contains an error!\n"
261  "Current formula is: weight=" << fRTWeightingFunction << "\n"
262  "This formula does not conform to the ROOT formula class guidelines.";
263  ERROR(error);
264  //fRTWeights->Delete();
265  // this was memory leak: fRTWeights = NULL;
266  delete fRTWeights;
267  fRTWeights = 0;
268  return eFailure;
269  }
270  //End Risetime Fit Stuff
271 
272  topBranch.GetChild("UseDLECorrectedTrace").GetData(fUseDLECorrectedTrace);
275  else
277 
278  Branch CalculateLeedsDeltaBranch;
279  if ((CalculateLeedsDeltaBranch = topBranch.GetChild("LeedsDelta"))) {
280  fDoCalculateLeedsDelta = true;
281  attributes = CalculateLeedsDeltaBranch.GetAttributes();
282  CalculateLeedsDeltaBranch.GetChild("CalculateLeedsDelta").GetData(fDoCalculateLeedsDelta);
284  std::string currentFunction;
285  CalculateLeedsDeltaBranch.GetChild("RisetimeBenchmarkFunction").GetData(currentFunction);
286  fRisetimeBenchmarkFunction = new char[currentFunction.size() + 1];
287  std::strcpy(fRisetimeBenchmarkFunction, currentFunction.c_str());
288  fRTBenchmark = new TFormula("RiseTimeBenchmark", fRisetimeBenchmarkFunction);
289  CalculateLeedsDeltaBranch.GetChild("RisetimeBenchmarkParameterA").GetData(currentFunction);
290  fRisetimeBenchmarkParameterA = new char[currentFunction.size() + 1];
291  std::strcpy(fRisetimeBenchmarkParameterA, currentFunction.c_str());
292  fRTBenchmarkParameterA = new TFormula("RisetimeBenchmarkParA", fRisetimeBenchmarkParameterA);
293  CalculateLeedsDeltaBranch.GetChild("RisetimeBenchmarkParameterA_0").GetData(fRisetimeBenchmarkParameterA_0);
294  CalculateLeedsDeltaBranch.GetChild("RisetimeBenchmarkParameterA_1").GetData(fRisetimeBenchmarkParameterA_1);
295  CalculateLeedsDeltaBranch.GetChild("RisetimeBenchmarkParameterA_2").GetData(fRisetimeBenchmarkParameterA_2);
296  CalculateLeedsDeltaBranch.GetChild("RisetimeBenchmarkParameterB").GetData(currentFunction);
297  fRisetimeBenchmarkParameterB = new char[currentFunction.size() + 1];
298  std::strcpy(fRisetimeBenchmarkParameterB, currentFunction.c_str());
299  fRTBenchmarkParameterB = new TFormula("RisetimeBenchmarkParB", fRisetimeBenchmarkParameterB);
300  CalculateLeedsDeltaBranch.GetChild("RisetimeBenchmarkParameterB_0").GetData(fRisetimeBenchmarkParameterB_0);
301  CalculateLeedsDeltaBranch.GetChild("RisetimeBenchmarkParameterB_1").GetData(fRisetimeBenchmarkParameterB_1);
302  CalculateLeedsDeltaBranch.GetChild("RisetimeBenchmarkParameterB_2").GetData(fRisetimeBenchmarkParameterB_2);
303  CalculateLeedsDeltaBranch.GetChild("RisetimeAzimuthCorrectionFunction").GetData(currentFunction);
304  fRisetimeAzimuthCorrectionFunction = new char[currentFunction.size() + 1];
305  std::strcpy(fRisetimeAzimuthCorrectionFunction, currentFunction.c_str());
306  fRTAzimuthCorrections = new TFormula("RiseTimeAzimuthCorrection", fRisetimeAzimuthCorrectionFunction);
307  CalculateLeedsDeltaBranch.GetChild("RisetimeDistanceCorrectionFunction").GetData(currentFunction);
308  fRisetimeDistanceCorrectionFunction = new char[currentFunction.size() + 1];
309  std::strcpy(fRisetimeDistanceCorrectionFunction, currentFunction.c_str());
310  fRTDistanceCorrections = new TFormula("RiseTimeDistanceCorrection", fRisetimeDistanceCorrectionFunction);
311  CalculateLeedsDeltaBranch.GetChild("RisetimeZenithCorrectionFunction1").GetData(currentFunction);
312  fRisetimeZenithCorrectionFunction1 = new char[currentFunction.size() + 1];
313  std::strcpy(fRisetimeZenithCorrectionFunction1, currentFunction.c_str());
314  fRTZenithCorrections1 = new TFormula("RiseTimeZenithCorrection1", fRisetimeZenithCorrectionFunction1);
315  CalculateLeedsDeltaBranch.GetChild("RisetimeZenithCorrectionFunction1Parameterl0").GetData(fRisetimeZenithCorrectionFunction1Parameterl0);
316  CalculateLeedsDeltaBranch.GetChild("RisetimeZenithCorrectionFunction1Parameterl1").GetData(fRisetimeZenithCorrectionFunction1Parameterl1);
317  CalculateLeedsDeltaBranch.GetChild("RisetimeZenithCorrectionFunction1Parameterl2").GetData(fRisetimeZenithCorrectionFunction1Parameterl2);
318  CalculateLeedsDeltaBranch.GetChild("RisetimeZenithCorrectionFunction2").GetData(currentFunction);
319  fRisetimeZenithCorrectionFunction2 = new char[currentFunction.size() + 1];
320  std::strcpy(fRisetimeZenithCorrectionFunction2, currentFunction.c_str());
321  fRTZenithCorrections2 = new TFormula("RiseTimeZenithCorrection2", fRisetimeZenithCorrectionFunction2);
322  CalculateLeedsDeltaBranch.GetChild("RisetimeZenithCorrectionFunction2Parameterm0").GetData(fRisetimeZenithCorrectionFunction2Parameterm0);
323  CalculateLeedsDeltaBranch.GetChild("RisetimeZenithCorrectionFunction2Parameterm1").GetData(fRisetimeZenithCorrectionFunction2Parameterm1);
324  CalculateLeedsDeltaBranch.GetChild("RisetimeZenithCorrectionFunction2Parameterm2").GetData(fRisetimeZenithCorrectionFunction2Parameterm2);
325  }
326  }
327 
328  Branch CalculateLDFParametersBranch;
329  if ((CalculateLDFParametersBranch = topBranch.GetChild("LDFParameters"))) {
331  attributes = CalculateLDFParametersBranch.GetAttributes();
332  CalculateLDFParametersBranch.GetChild("CalculateLDFParameters").GetData(fDoCalculateLDFParameters);
334  CalculateLDFParametersBranch.GetChild("LDFParametersOptimumDistance").GetData(fLDFParametersOptimumDistance);
335  CalculateLDFParametersBranch.GetChild("LDFParametersScaleDistance").GetData(fLDFParametersScaleDistance);
336  CalculateLDFParametersBranch.GetChild("Cut1000").GetData(fCut1000);
337  }
338  }
339 
340  Branch GeneralParametersBranch;
341  if ((GeneralParametersBranch = topBranch.GetChild("GeneralParameters"))) {
342  std::string errorFunction;
343  GeneralParametersBranch.GetChild("StationRisetimeErrorFunction").GetData(errorFunction);
344  fRTErrorFunction = new char[errorFunction.size() + 1];
345  std::strcpy(fRTErrorFunction, errorFunction.c_str());
346  fRTErrorFunc = new TFormula("RiseTimeErrorFunc", fRTErrorFunction);
347  GeneralParametersBranch.GetChild("StationRisetimeErrorParameter_Ja0").GetData(fRTErrorFunctionParameterJa0);
348  GeneralParametersBranch.GetChild("StationRisetimeErrorParameter_Ja1").GetData(fRTErrorFunctionParameterJa1);
349  GeneralParametersBranch.GetChild("StationRisetimeErrorParameter_Jb0").GetData(fRTErrorFunctionParameterJb0);
350  GeneralParametersBranch.GetChild("StationRisetimeErrorParameter_Jb1").GetData(fRTErrorFunctionParameterJb1);
351  }
352  info <<"\n***************************************\n"
353  "FADC Parameters module initialized.\n";
354  INFO(info);
355 
356  return eSuccess;
357 }
358 
359 
362 {
363  std::ostringstream info;
364  fgRisetime = -1;
365  fgRisetimeError = -1;
369  fRejectedStations = 0;
372 
373  if (!theEvent.HasSEvent()) {
374  info << "There is no SEvent";
375  INFO(info);
376  return eSuccess;
377  }
378 
379  if (theEvent.HasRecShower()) {
380  if (theEvent.GetRecShower().HasSRecShower()) {
381  sevt::SEvent& theSEvent = theEvent.GetSEvent();
383  // Prefer the first method, but currently not implimented in v2r2 of the offline
384  //const double secZenith = 1.0/std::cos(theEvent.GetRecShower().GetZenith()); // is this in radians?
385 
386  // Eliminate once RecShower-> GetAzimuth() and GetZenith() and GetCore() work
387  // This line is using the current agreed method for Sd reconstuction where
388  // GetX(SiteCoordinateSystem) returns the shower u and GetY(SiteCoordinateSystem)
389  // returns the shower v.
390  const CoordinateSystemPtr CS = det::Detector::GetInstance().GetSiteCoordinateSystem();
391  const double this_u = theEvent.GetRecShower().GetSRecShower().GetAxis().GetX(CS);
392  const double this_v = theEvent.GetRecShower().GetSRecShower().GetAxis().GetY(CS);
393  const double EventThetaRec = std::asin(sqrt(this_u*this_u + this_v*this_v)); // in radians
394  secZenith = 1 / std::cos(EventThetaRec);
396  // End hack for zenith angle
397 
398  for (sevt::SEvent::StationIterator sIt = theSEvent.StationsBegin(); sIt != theSEvent.StationsEnd(); ++sIt) {
399  sevt::Station& currentStation = *sIt;
400  if (theSEvent.HasStation(currentStation.GetId()) /*&& currentStation.HasVEMTrace(fComponent)*/ && currentStation.HasRecData()) {
401  unsigned short rejectcode = 0;
402  bool usestation = true;
403  int saturationflag = -1;
404 
405  // Setting the above variables
406  sevt::StationRecData& theStationRecData = currentStation.GetRecData();
407  double stationrisetime = fForceRiseTimeRecalculation ?
408  RecalculateRiseTime(currentStation) :
409  fUseDLECorrectedTrace ? theStationRecData.GetRiseTimeCleaned() :
410  theStationRecData.GetRiseTime();
411 
412  if (stationrisetime <= 0) {
413  ostringstream info;
414  info << "Station " << currentStation.GetId()
415  << " has no rise time information, calculating...";
416  INFO(info);
417  stationrisetime = RecalculateRiseTime(currentStation);
418  if (stationrisetime <= 0)
419  continue;
420  }
421 
422  const double stationdistance = theStationRecData.GetSPDistance();
423  const double stationdistanceerror = theStationRecData.GetSPDistanceError();
424  // Added a correction to the MeanRiseTime for shower asymmetry as
425  // suggested by the Leeds group in a private communication.
426  // t1/2(correct) = t1/2 - g cos(zeta)
427  // g = alpha + gamma r^2
428  // alpha = -66.61 + 95.13 sec(theta) - 30.73 sec^2(theta)
429  // gamma = -0.0009721 + 0.001993 sec(theta) - 0.001259 sec^2(theta) + 0.0002546 sec^3(theta)
430  //
431  // r is the distance to the shower plane (meters), theta is the zenith angle,
432  // and zeta is the angle to a station with the zero direction defined
433  // to be under the shower axis.
434  // M.Healy August 8, 2006
435  //const double alpha = -66.61 + secZenith*(95.13 - 30.73*secZenith);
436  //const double gamma = -0.0009721 + secZenith*(0.001993 + secZenith*(-0.001259 + 0.0002546*secZenith));
437  // New asymmetry correction (2014/01 C. Jarne)
438  /* Old risetime corrections.. these were replaced by adaptable ones in the xml
439  const double alpha = 96.73 + secZenith*(-282.40 + secZenith*(241.80 - 62.61*secZenith));
440  const double gamma = -0.0009572 + secZenith*(0.002068 + secZenith*(-0.001362 + 0.0002861*secZenith));
441  const double g = alpha + gamma * stationdistance*stationdistance;
442  // This gets the asymmetry angle as set by the reconstruction module.
443  // Beware of custom reconstructions that do not set this information.
444  const double zeta = theStationRecData.GetAzimuthShowerPlane();
445  stationrisetime = stationrisetime - g * std::cos(zeta);
446  // M.Healy August 8, 2006
447  // End additions by M.Healy
448  */
449 
452  const double g = fRTDistanceCorrections->Eval(l,m,stationdistance);
453  const double zeta = theStationRecData.GetAzimuthShowerPlane();
454  stationrisetime = fRTAzimuthCorrections->Eval(stationrisetime, g, zeta);
455 
456  const double signal =
457  fUseDLECorrectedTrace ? theStationRecData.GetTotalSignalCleaned() : theStationRecData.GetTotalSignal();
458  // slight mistake in error propogation here
459  //const double stationrisetimeerror =
460  // fRTWeights->Eval(stationdistance/m, secZenith, signal);
462 
463  const double stationrisetimeerror =
464  fRTErrorFunc->EvalPar(&pararray[0]);//replace old error function by parametrization of Nicole Krohm
465  const double photonbenchmark_A =
467  const double photonbenchmark_B =
469  const double photonbenchmark =
470  fRTBenchmark->Eval(photonbenchmark_A, photonbenchmark_B, stationdistance);
471  if (signal < fMinimumSignalForRiseTimeFit)
472  rejectcode |= sevt::StationRecData::eLowSignal;
473  if (!currentStation.IsCandidate())
475  if (currentStation.IsLowGainSaturation() && !fIncludeSaturatedForRiseTimeFit)
477  if (stationdistance < fMinimumDistanceForRiseTimeFit || stationdistance > fMaximumDistanceForRiseTimeFit)
478  rejectcode |= sevt::StationRecData::eNotInRing;
479  saturationflag = SaturationFlag(currentStation);
480  bool stflag = RTCandidateFlag(theEvent, rejectcode, stationdistance, usestation, stationrisetime, signal);
481  int num_pmts=0;
482  for (sevt::Station::PMTIterator pmtIt = currentStation.PMTsBegin(); pmtIt != currentStation.PMTsEnd(); ++pmtIt) {
483  sevt::PMT& currentPMT = *pmtIt;
484  if (currentPMT.HasRecData() && currentPMT.GetRecData().HasVEMTrace(fComponent)){
485  if(currentPMT.GetRecData().GetVEMTrace().GetSize()>0){
486  ++num_pmts;
487  }
488  TraceD& aVEMTrace = currentPMT.GetRecData().GetVEMTrace(fComponent);
489 
490  int start_bin = currentStation.GetRecData().GetSignalStartSlot() - 4;
491  const int stop_bin = currentStation.GetRecData().GetSignalEndSlot();
492 
493  if (start_bin >= stop_bin || start_bin < 0 || start_bin > 5000)
494  start_bin = 0;
495 
496  const double risetime_start =
497  TraceAlgorithm::TimeAtRelativeSignalX(aVEMTrace, start_bin, stop_bin, 100*fRiseTimeStartPercent);
498  const double risetime_stop =
499  TraceAlgorithm::TimeAtRelativeSignalX(aVEMTrace, start_bin, stop_bin, 100*fRiseTimeStopPercent);
500 
501  const double diff = risetime_stop - risetime_start;
502  if ((stationrisetime - diff) / stationrisetime >= 0.0001)
503  --num_pmts;
504  }
505  }
506 
507  usestation = num_pmts >= 1;
508 
509  // Done setting variables
510 
511  if (rejectcode)
513  if (!rejectcode&&!stflag)
515  if (rejectcode & sevt::StationRecData::eNotCandidate)
517  // Assign to the station risetime data
518  StationSdParameterData* const currentStationSdParameterData = new StationSdParameterData;
519  currentStationSdParameterData->fStationId = currentStation.GetId();
520  currentStationSdParameterData->fCorrRisetime = stationrisetime;
521  currentStationSdParameterData->fCorrRisetimeError = stationrisetimeerror;
522  currentStationSdParameterData->fDistance = stationdistance;
523  currentStationSdParameterData->fDistanceError = stationdistanceerror;
524  currentStationSdParameterData->fSecZenith = secZenith;
525  currentStationSdParameterData->fPhotonBenchmark = photonbenchmark;
526  currentStationSdParameterData->fSignal = signal;
527  currentStationSdParameterData->fRejectCode = rejectcode;
528  currentStationSdParameterData->fUseStation = usestation;
529  currentStationSdParameterData->fSaturationFlag = saturationflag;
530  currentStationSdParameterData->fRTCandidateFlag = stflag;
531  // End assign data
532 
533 #ifdef DEBUG_Risetime1000LLL
534  ostringstream info;
535  info << "Station Id: " << currentStationSdParameterData->fStationId << "\n"
536  "Risetime: " << currentStationSdParameterData->fCorrRisetime << "\n"
537  "Risetime Error: " << currentStationSdParameterData->fCorrRisetimeError << "\n"
538  "Distance: " << currentStationSdParameterData->fDistance << "\n"
539  "DistanceError: " << currentStationSdParameterData->fDistanceError << "\n"
540  "RejectCode: " << currentStationSdParameterData->fRejectCode;
541  INFO(info);
542 #endif
543 
544  fgCompositionParameterResults->fStationData.push_back(currentStationSdParameterData);
545  theStationRecData.SetCorrectedRiseTime(currentStationSdParameterData->fCorrRisetime,
546  currentStationSdParameterData->fCorrRisetimeError);
547  theStationRecData.SetRiseTimeRejectionCode(currentStationSdParameterData->fRejectCode);
548 
549 
550  }
551  }
552  } else {
553  info << "There is no surface reconstruction!\n"
554  "Need a core position and zenith angle before this module.";
555  INFO(info);
556  return eSuccess;
557  }
558  }
559 
560  if (fDoRiseTimeFit) {
561  FitEventRiseTime(theEvent);
562 
563  ostringstream info;
564  info << "The RiseTime at " << fDistanceToInterpolateFitResult/km
565  << " km is " << fgRisetime
566  << " +- " << fgRisetimeError
567  << " ns";
568  INFO(info);
569 
570  if (theEvent.HasRecShower()) {
571  if (theEvent.GetRecShower().HasSRecShower()) {
572  evt::ShowerSRecData& theSRecData = theEvent.GetRecShower().GetSRecShower();
573  if (!theSRecData.HasRiseTime1000())
574  theSRecData.MakeRiseTime1000();
575 
576  evt::RiseTime1000& theRisetime1000Data = theSRecData.GetRiseTime1000();
577  theRisetime1000Data.SetRiseTime1000(fgRisetime, fgRisetimeError);
582  theRisetime1000Data.SetXmax(fgCompositionParameterResults->fXmax,
585  }
586  }
587  }
588 
590  LeedsDeltaCalculation(theEvent);
591 
593  LDFParametersCalculation(theEvent);
594 
596 
597  return eSuccess;
598 }
599 
600 
603 {
604  INFO("SdCompositionParameters::Finish()");
605 
606  return eSuccess;
607 }
608 
609 
621 double
623 {
624  evt::ShowerSRecData& theSRecData = theEvent.GetRecShower().GetSRecShower();
625  const unsigned int pointsInGraph =
627 
628  // If only 2 stations pass the cuts then we will ignore the event
629  // M.Healy (18 Sep 2006)
630  if (pointsInGraph <= 2) {
631  INFO("Event risetime uncalculated due to an insuffiecent number of acceptable stations.");
632  return -1;
633  }
634 
635  vector<double> distances(pointsInGraph);
636  vector<double> distanceserror(pointsInGraph);
637  vector<double> risetimes(pointsInGraph);
638  vector<double> risetimeserror(pointsInGraph);
639  vector<bool> stflag(pointsInGraph);
640  unsigned int point = 0;
641  int nstClose = 0;
642 
643  for (std::vector<StationSdParameterData*>::const_iterator stationrisetimeiterator = fgCompositionParameterResults->fStationData.begin();
644  stationrisetimeiterator != fgCompositionParameterResults->fStationData.end(); ++stationrisetimeiterator) {
645  const StationSdParameterData& currentStation = **stationrisetimeiterator;
646  if (currentStation.fRejectCode)
647  continue;
648  if (!currentStation.fRTCandidateFlag)
649  continue;
650  distances[point] = currentStation.fDistance/km;
651  distanceserror[point] = currentStation.fDistanceError/km;
652  risetimes[point] = currentStation.fCorrRisetime/ns;
653  risetimeserror[point] = currentStation.fCorrRisetimeError/ns;
654  stflag[point] = currentStation.fRTCandidateFlag;
655 
656  ostringstream info;
657  info << "Passed Cut: station " << currentStation.fStationId << ", "
658  "distance " << distances[point] << " km, "
659  "risetime " << risetimes[point] << " ns";
660  INFO(info);
661 
662  if (currentStation.fDistance<=1000.){
663  nstClose++;
664  }
665  ++point;
666  }
667 
668  ostringstream info;
669  info << pointsInGraph << " stations passed the cuts.";
670  INFO(info);
671 
672  TGraphErrors riseTimeGraph(pointsInGraph, &distances.front(), &risetimes.front(), 0, &risetimeserror.front());
673  riseTimeGraph.SetMarkerStyle(20);
674  riseTimeGraph.SetMarkerColor(2);
675  riseTimeGraph.SetLineColor(2);
676  riseTimeGraph.SetLineWidth(2);
677  TF1 risetimeFit("RisetimeFit", "40+[0]*x+[1]*x*x",
679  risetimeFit.SetParLimits(0, 0, 10000);
680  risetimeFit.SetParLimits(1, 0, 10000);
681 
682  // Offline Modification in uncertanty estimation -2013 by C. Jarne (Before not correlation term included)
683  // Added to calculate the correct uncertainties considering the correlation
684  double risetime = -1;
685  double risetimeerr = -1;
686  double risetimechi2 = -1;
687  double risetimeNDF = -1;
688  bool risetime1000Flag = false;
689  bool risetime1000FlagAlt = false;
690 
691  const int failed = riseTimeGraph.Fit(&risetimeFit, "Q", "", fMinimumDistanceForRiseTimeFit/km, fMaximumDistanceForRiseTimeFit/km);
692  if (!failed) {
693  risetime = risetimeFit.Eval(fDistanceToInterpolateFitResult/km);
694  TVirtualFitter* const fitter = TVirtualFitter::GetFitter();
695  const int nPar = fitter->GetNumberTotalParameters();
696  const TMatrixD covar(nPar, nPar, fitter->GetCovarianceMatrix());
697  //covar.Print();
698  const double rtcov = covar[0][1];
699  const double rtcov2 = covar[1][1];
700  const double rtcov1 = covar[0][0];
701 
702  //risetimeerr = sqrt(pow(risetimeFit.GetParError(0), 2) + pow(risetimeFit.GetParError(1), 2));
703  // New estimation including the correlation term 2014/01 C. Jarne
704  risetimeerr = sqrt(rtcov2 + rtcov1 + 2*rtcov);
705 
706  risetimechi2 = risetimeFit.GetChisquare();
707  risetimeNDF = risetimeFit.GetNDF();
708 
709  risetime1000Flag = SdCompositionParameters::SelectionRiseTime1000(pointsInGraph, nstClose, theEvent.GetRecShower().GetSRecShower().GetEnergy(), false);
710  risetime1000FlagAlt = SdCompositionParameters::SelectionRiseTime1000(pointsInGraph, nstClose, theEvent.GetRecShower().GetSRecShower().GetEnergy(), true);
711  }
712 
713  fgRisetime = risetime*ns;
714  fgRisetimeError = risetimeerr*ns;
715  fgRisetimeReducedChi2 = risetimechi2/risetimeNDF;
716 
717  fgCompositionParameterResults->fFitPar0 = risetimeFit.GetParameter(0)*m/km;
718  fgCompositionParameterResults->fFitPar1 = risetimeFit.GetParameter(1)*m/km*m/km;
723 
724  // This functionality not yet included
728 
729  theSRecData.SetParameter(eRiseTime1000, risetime*ns);
730  theSRecData.SetParameterCovariance(eRiseTime1000, eRiseTime1000, risetimeerr*ns*risetimeerr*ns);
731  theSRecData.SetParameter(eRiseTime1000Chi2, risetimechi2);
732  theSRecData.SetParameter(eRiseTime1000NDF, risetimeNDF);
733  theSRecData.SetParameter(eRiseTime1000NSt, pointsInGraph);
734  theSRecData.SetParameter(eRiseTime1000NStClose, nstClose);
735  theSRecData.SetParameter(eRiseTime1000Flag, risetime1000Flag);
736  theSRecData.SetParameter(eRiseTime1000FlagAlt, risetime1000FlagAlt);
737  return risetime*ns;
738 }
739 
740 
741 double
743 {
744  int num_pmts = 0;
745  double total_risetime = 0;
746  std::vector<double> risetime;
747  for (sevt::Station::PMTIterator pmtIt = theStation.PMTsBegin(); pmtIt != theStation.PMTsEnd(); ++pmtIt) {
748  sevt::PMT& currentPMT = *pmtIt;
749  if (currentPMT.HasRecData() && currentPMT.GetRecData().HasVEMTrace(fComponent)) {
750  ++num_pmts;
751  sevt::PMTRecData& pmtRec = currentPMT.GetRecData();
752  TraceD& aVEMTrace = pmtRec.GetVEMTrace(fComponent);
753 
754  int start_bin = theStation.GetRecData().GetSignalStartSlot() - 4;
755  const int stop_bin = theStation.GetRecData().GetSignalEndSlot();
756 
757  if (start_bin >= stop_bin || start_bin < 0 || start_bin > 5000)
758  start_bin = 0;
759 
760  const double risetime_start =
761  TraceAlgorithm::TimeAtRelativeSignalX(aVEMTrace, start_bin, stop_bin, 100*fRiseTimeStartPercent);
762  const double risetime_stop =
763  TraceAlgorithm::TimeAtRelativeSignalX(aVEMTrace, start_bin, stop_bin, 100*fRiseTimeStopPercent);
764 
765  const double diff = risetime_stop - risetime_start;
766  risetime.push_back(diff);
767  total_risetime += diff;
768  }
769  }
770 
771  if (num_pmts == 0) {
772  ERROR("Valid station, but no PMTRecData. Risetime recalculation failed!");
773  return -1;
774  }
775  const double meanRiseTime = total_risetime / num_pmts;
776  /*double rmsRiseTime = 0;
777  for (int i = 0; i < num_pmts; ++i)
778  rmsRiseTime += pow(meanRiseTime - risetime[i], 2);
779  rmsRiseTime = sqrt(rmsRiseTime / num_pmts);*/
780 
781  return meanRiseTime;
782 }
783 
784 
785 double
787 {
788  evt::ShowerSRecData& theSRecData = theEvent.GetRecShower().GetSRecShower();
789  const unsigned int pointsInGraph =
791 
792  vector<double> distances(pointsInGraph);
793  vector<double> risetimes(pointsInGraph);
794  vector<double> risetimeserror(pointsInGraph);
795  vector<double> benchmarks(pointsInGraph);
796  vector<double> signals(pointsInGraph);
797  vector<int> saturationflags(pointsInGraph);
798  vector<bool> usestations(pointsInGraph);
799  unsigned int point = 0;
800  double deltaRiseTime = 0;
801 
802  for (std::vector<StationSdParameterData*>::const_iterator stationrisetimeiterator = fgCompositionParameterResults->fStationData.begin();
803  stationrisetimeiterator != fgCompositionParameterResults->fStationData.end(); ++stationrisetimeiterator) {
804  const StationSdParameterData& currentStation = **stationrisetimeiterator;
805  if (currentStation.fRejectCode)
806  continue;
807  if (!currentStation.fRTCandidateFlag)
808  continue;
809  distances[point] = currentStation.fDistance;
810  risetimes[point] = currentStation.fCorrRisetime/ns;
811  risetimeserror[point] = currentStation.fCorrRisetimeError/ns;
812  benchmarks[point] = currentStation.fPhotonBenchmark;
813  signals[point] = currentStation.fSignal;
814  saturationflags[point] = currentStation.fSaturationFlag;
815  usestations[point] = currentStation.fUseStation;
816 
817  deltaRiseTime += (risetimes[point]-benchmarks[point])/risetimeserror[point];
818  ++point;
819  }
820  deltaRiseTime = deltaRiseTime/double(point);
821  bool deltaRiseTimeFlag = SelectionDeltaRiseTime(point, theEvent.GetRecShower().GetSRecShower().GetEnergy(), false);
822  bool deltaRiseTimeFlagAlt = SelectionDeltaRiseTime(point, theEvent.GetRecShower().GetSRecShower().GetEnergy(), true);
823  theSRecData.SetParameter(eLeedsDelta, deltaRiseTime);
824  theSRecData.SetParameter(eDeltaRiseTimeFlag, deltaRiseTimeFlag);
825  theSRecData.SetParameter(eDeltaRiseTimeFlagAlt, deltaRiseTimeFlagAlt);
826 
827  return deltaRiseTime;
828 }
829 
830 
831 double
833 {
834  if (theEvent.HasRecShower()) {
835  if (theEvent.GetRecShower().HasSRecShower()) {
836  evt::ShowerSRecData& theSRecData = theEvent.GetRecShower().GetSRecShower();
837  double R_NKG = 0;
838  double S_4 = 0;
840  double s1000 = theSRecData.GetShowerSize();
841  double beta = theSRecData.GetBeta();
842  double gamma = theSRecData.GetGamma();
843  const unsigned int pointsInGraph =
845  unsigned int point = 0;
846 
847  vector<double> signals(pointsInGraph);
848  vector<double> distances(pointsInGraph);
849  vector<double> saturationflags(pointsInGraph);
850 
851  for (std::vector<StationSdParameterData*>::const_iterator stationrisetimeiterator = fgCompositionParameterResults->fStationData.begin();
852  stationrisetimeiterator != fgCompositionParameterResults->fStationData.end(); ++stationrisetimeiterator) {
853  const StationSdParameterData& currentStation = **stationrisetimeiterator;
855  continue;
856  signals[point] = currentStation.fSignal;
857  distances[point] = currentStation.fDistance/km;
858  saturationflags[point] = currentStation.fSaturationFlag;
859  bool sbflag = SbCandidateFlag(saturationflags[point], distances[point], fCut1000);
860  if(sbflag){
861  double signalexp = s1000 * pow(distances[point]/fLDFParametersOptimumDistance, beta) * pow((distances[point]+fLDFParametersScaleDistance)/(fLDFParametersOptimumDistance+fLDFParametersScaleDistance), (beta+gamma));
862  R_NKG += signals[point] / signalexp;
863  double signalexp_2 = s1000 * pow(distances[point]/fLDFParametersOptimumDistance, -4);
864  S_4 += signals[point] / signalexp_2;
865  ++point;
866  }
867  }
868  if (point>0) {
869  R_NKG = R_NKG/double(point);
870  S_4 = S_4/double(point);
871  }
872 
873  bool rnkg_event_sel = SelectionLDFPar(point, theEvent);
874  theSRecData.SetParameter(eLDF_RNKG, R_NKG);
875  theSRecData.SetParameter(eLDF_S4, S_4);
876  theSRecData.SetParameter(eLDFFlag, rnkg_event_sel);
877  theSRecData.SetParameter(eLDF_NSt, point);
878  }
879  }
880 
881  return 0;
882 }
883 
884 
885 double
886 SdCompositionParameters::PhotonEnergyCalculation(evt::Event& theEvent, double E_hadron, double secZenith)
887 {
888  evt::ShowerSRecData& theSRecData = theEvent.GetRecShower().GetSRecShower();
889  const double kElongRatePar1WGNew = 872.;
890  const double kElongRatePar2WGNew = 64.;
891  const double kElongRatePar3WGNew = 37.;
892  const double kUniversalityPar1WGCorrGH = 3.03; // 3.04
893  const double kUniversalityPar2WGCorrGH = 592.;
894  const double kUniversalityPar3WGCorrGH = 152.;
895  const double kUniversalityPar4WGCorrGH = 100.;
896 
897  TF1 fElongRate("fElongRate", "[0] + [1]*log10(x) + [2]*log10(x)*log10(x)", 0.5, 2.5);
898  TF1 fUn("fUn", "[0] * (1.+(x-[3])/[1]) / (1. + pow((x-[3])/[2],2.))", -100., 2000.);
899  TF1 fUnGH("fUnGH", "[0] * pow(1.+(x-[2])/[1], [1]/[3]) * exp(-(x-[2])/[3])", -100., 2000.);
900 
901  // Pars: [0] VEM/EeV, [1] g/cm^2, [2] g/cm^2
902  // [3] is the shift between Xmax(axis) and Xmax(R=1000m) g/cm^2
903  const double ElongRatePars[3] = {kElongRatePar1WGNew, kElongRatePar2WGNew, kElongRatePar3WGNew};
904  const double UnPars[4] = {kUniversalityPar1WGCorrGH, kUniversalityPar2WGCorrGH, kUniversalityPar3WGCorrGH, kUniversalityPar4WGCorrGH};
905 
906  double _scale = 1;
907 
908  // Set parameters according to EERecOption
909  for (int i = 0; i < fElongRate.GetNumberFreeParameters(); ++i)
910  fElongRate.SetParameter(i,ElongRatePars[i]);
911 
912  for (int i = 0; i < fUnGH.GetNumberFreeParameters(); ++i)
913  fUnGH.SetParameter(i, UnPars[i]);
914 
915  // Ground slant depth
916  static const double xground = 880.0; //is this correct?
917  double X = xground * secZenith;
918  static const double kF0 = 2; // first guess is Ehadr*kF0
919  static const double kERecTolerance = 1e-5;
920  static const double kERecMinDeltaX = -50;
921  // End hack for zenith angle
923  double s1000 = theSRecData.GetShowerSize();
924 
925  // Iterations start here (use EeV as internal energy unit)
926  // initial guess
927  double Eold_EeV = kF0 * E_hadron / 1e18;
928  double epsilon = 1000;
929  int niter = 0;
930  double DxTolerance = kERecMinDeltaX * 2;
931  double XM = 0;
932 
933  while ((X-XM) > DxTolerance && epsilon > kERecTolerance) {
934  niter += 1;
935 
936  // find Xmax from elongation rate
937  XM = fElongRate.Eval(Eold_EeV);
938 
939  // find energy from universal profile
940  double E_EeV = 0;
941  _scale = (0.83 + 2.3e-4 * (X - XM)); // with corr. factor
942  E_EeV = pow(s1000/fUnGH.Eval(X-XM), 1./_scale);
943 
944  epsilon = std::abs(E_EeV - Eold_EeV);
945 
946  Eold_EeV = E_EeV;
947  }
948 
949  int EgammaFlag = 1;
950  // If no iteration or final DX <= -50 g/cm^2 (or 0 g/cm^2)
951  if (niter == 0) {
952  EgammaFlag = -1;
953  } else if ((X - fElongRate.Eval(Eold_EeV)) <= kERecMinDeltaX) {
954  EgammaFlag = 0;
955  }
956  /*
957  recEv->SetEgammaRec(Eold_EeV*1e18, opt);
958  recEv->SetEgammaIter(niter, opt);
959  recEv->SetEgammaXmax(XM, opt);
960  */
961 
962  theSRecData.SetParameter(eEgammaRec, Eold_EeV * 1e18);
963  theSRecData.SetParameter(eEgammaIter, niter);
964  theSRecData.SetParameter(eEgammaXmax, XM);
965  theSRecData.SetParameter(eEgammaFlag, EgammaFlag);
966 
967  return 0;
968 }
969 
970 
971 int
973 {
974  Int_t flag = -2;
975  if (station.IsCandidate()) {
976  flag = -1;
977  const bool saturation = station.IsLowGainSaturation() || station.IsHighGainSaturation();
978  if (!saturation) {
979  flag = 1;
980  } else if (!station.IsLowGainSaturation()) {
981  flag = 0;
982  }
983  }
984  return flag;
985 }
986 
987 
988 bool
989 SdCompositionParameters::RTCandidateFlag(evt::Event& theEvent, int saturationflag, double distance, bool usest, double rtcorr, double signal)
990 {
991  evt::ShowerSRecData& theSRecData = theEvent.GetRecShower().GetSRecShower();
992  double beta = theSRecData.GetBeta();
993  double gamma = theSRecData.GetGamma();
995  double s1000 = theSRecData.GetShowerSize();
996  double ehadr = theSRecData.GetEnergy();
997 
998  double signalexp = s1000 * pow(distance/1000., beta) * pow((distance + 700.) / 1700., beta + gamma);
999 
1000  double kMinDistBenchNicole = 600;
1001  double kMaxDistBenchNicole = 2000;
1002  // use only non low-gain saturated stations
1003  const bool flag =
1004  usest &&
1005  saturationflag >= 0 &&
1006  ehadr * 1e-18 > 1 &&
1007  rtcorr > 40 &&
1008  signal >= 6 && // 3
1009  signalexp >= 0 && // 10
1010  kMinDistBenchNicole < distance && distance < kMaxDistBenchNicole;
1011 
1012  return flag;
1013  //return 0;
1014 }
1015 
1016 
1017 bool
1018 SdCompositionParameters::SbCandidateFlag(int saturationflag, double distance, bool cut1000)
1019 {
1020  // Allow only HG-saturation or no saturation at all
1021  bool flag = (saturationflag >= 0);
1022  // If selected, use only stations > 1000m
1023  if (cut1000)
1024  flag = (flag && distance > 1);
1025 
1026  return flag;
1027 }
1028 
1029 
1030 bool
1031 SdCompositionParameters::SelectionDeltaRiseTime(int nst, double hadrenergy, bool doAltSel)
1032 {
1033  bool cut = (hadrenergy >= 1e18);
1034  if (doAltSel)
1035  cut = (cut && nst >= 4);
1036  else
1037  cut = (cut && nst >= 3);
1038  return cut;
1039 }
1040 
1041 
1042 bool
1044 {
1045  bool cut = false;
1046  if (theEvent.HasRecShower()) {
1047  if (theEvent.GetRecShower().HasSRecShower()) {
1048  evt::ShowerSRecData& theSRecData = theEvent.GetRecShower().GetSRecShower();
1049 
1050  cut = (theSRecData.HasLDF() && nst >= 1);
1051  }
1052  }
1053  return cut;
1054 }
1055 
1056 
1057 bool
1058 SdCompositionParameters::SelectionRiseTime1000(int nst, int nstClose, double hadrenergy, bool doAltSel)
1059 {
1060  bool cut = hadrenergy * 1e-18 >= 1;
1061  if (doAltSel)
1062  cut = (cut && nst >= 3 && nstClose > 0);
1063  else
1064  cut = (cut && nst >= 4);
1065 
1066  return cut;
1067 }
double GetAzimuthShowerPlane() const
Azimuth in shower plane coordinates.
bool SelectionRiseTime1000(int nst, int nstClose, double hadrenergy, bool doAltSel)
Class to access station level reconstructed data.
void SetCorrectedRiseTime(const double crt, const double crte)
double GetSPDistanceError() const
Error in core distance in shower plane coordinates.
StationIterator StationsEnd()
End of all stations.
Definition: SEvent.h:59
utl::TraceD & GetVEMTrace(const StationConstants::SignalComponent source=StationConstants::eTotal)
Traces calibrated in VEM Peak.
Definition: PMTRecData.h:46
double GetRiseTime() const
Rise time averaged over PMTs.
int GetId() const
Get the station Id.
bool HasRecData() const
Check for existenc of PMT reconstructed data object.
Definition: SEvent/PMT.h:53
std::vector< StationSdParameterData * > fStationData
class to hold data at PMT level
Definition: SEvent/PMT.h:28
bool HasStation(const int stationId) const
Check whether station exists.
Definition: SEvent.cc:81
void SetRiseTimeRejectionCode(const int code)
Report success to RunController.
Definition: VModule.h:62
total (shower and background)
double GetRiseTimeCleaned() const
Interface class to access to the SD Reconstruction of a Shower.
double LDFParametersCalculation(evt::Event &event)
bool HasRecShower() const
Interface class to access to the SD part of an event.
Definition: SEvent.h:39
void SetChi2Ndof(const double chi2, const double ndof)
Definition: RiseTime1000.h:40
PMTIterator PMTsBegin(const sdet::PMTConstants::PMTType type=sdet::PMTConstants::eWaterCherenkovLarge)
begin PMT iterator for read/write
void SetParameterCovariance(const Parameter q1, const Parameter q2, const double corr, const bool lock=true)
PMTRecData & GetRecData()
Get object containing PMT reconstructed data.
Definition: SEvent/PMT.h:48
ShowerRecData & GetRecShower()
std::map< std::string, std::string > AttributeMap
Definition: Branch.h:24
sevt::StationRecData & GetRecData()
Get station level reconstructed data.
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
void SetXmax(const double xmax, const double xmaxErrUp, const double xmaxErrDown)
Definition: RiseTime1000.h:46
double GetShowerSize() const
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Definition: Branch.cc:211
boost::filter_iterator< PMTFilter, InternalPMTIterator > PMTIterator
Iterator over station for read/write.
double pow(const double x, const unsigned int i)
bool IsHighGainSaturation() const
static const RiseTimeRejectionCode eNotCandidate
bool StringEquivalent(const std::string &a, const std::string &b, Predicate p)
Utility to compare strings for equivalence. It takes a predicate to determine the equivalence of indi...
Definition: StringCompare.h:38
ShowerSRecData & GetSRecShower()
bool IsCandidate() const
Check if the station is a candidate.
fwk::VModule::ResultFlag Run(evt::Event &theEvent)
Run: invoked once per event.
AttributeMap GetAttributes() const
Get a map&lt;string, string&gt; containing all the attributes of this Branch.
Definition: Branch.cc:267
Branch GetNextSibling() const
Get next sibling of this branch.
Definition: Branch.cc:284
double GetBeta() const
static const RiseTimeRejectionCode eLowSignal
bool HasRiseTime1000() const
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
void SetAlphaBeta(const double alpha, const double beta=0)
Definition: RiseTime1000.h:43
Class representing a document branch.
Definition: Branch.h:107
class to hold data at Station level
void SetRiseTime1000(const double rt, const double rte)
Definition: RiseTime1000.h:37
class to hold reconstructed data at PMT level
Definition: PMTRecData.h:38
void SetParameter(const Parameter q, const double param, const bool lock=true)
std::vector< StationSdParameterData * > fStationData
static const RiseTimeRejectionCode eLowGainSaturated
double GetX(const CoordinateSystemPtr &coordinateSystem) const
Definition: BasicVector.h:206
const double ns
double abs(const SVector< n, T > &v)
double GetTotalSignal() const
Total integrated signal in VEM unit, averaged over pmts.
double PhotonEnergyCalculation(evt::Event &event, double E_hadron, double secZenith)
fwk::VModule::ResultFlag Init()
Initialize: invoked at beginning of run (NOT beginning of event)
unsigned int GetSignalStartSlot() const
Start time of the signal in time slots from beginning of trace.
bool SelectionDeltaRiseTime(int nst, double hadrenergy, bool doAltSel)
PMTIterator PMTsEnd(const sdet::PMTConstants::PMTType type=sdet::PMTConstants::eWaterCherenkovLarge)
end PMT iterator for read/write
const double km
constexpr double g
Definition: AugerUnits.h:200
signal after subtracting direct light (includes all particle sources).
const utl::Vector & GetAxis() const
SizeType GetSize() const
Definition: Trace.h:156
void GetData(bool &b) const
Overloads of the GetData member template function.
Definition: Branch.cc:644
unsigned int GetSignalEndSlot() const
End time of the signal in time slots from beginning of trace.
sevt::StationConstants::SignalComponent fComponent
double GetEnergy() const
double RecalculateRiseTime(sevt::Station &station)
bool IsLowGainSaturation() const
Check which gains are saturated.
double GetY(const CoordinateSystemPtr &coordinateSystem) const
Definition: BasicVector.h:209
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
bool HasRecData() const
Check whether station reconstructed data exists.
bool RTCandidateFlag(evt::Event &event, int saturationflag, double distance, bool usest, double rtcorr, double signal)
StationIterator StationsBegin()
Beginning of all stations.
Definition: SEvent.h:57
bool SelectionLDFPar(int nst, evt::Event &event)
double GetSPDistance() const
Distance from core in shower plane coordinates.
static const RiseTimeRejectionCode eNotInRing
Report failure to RunController, causing RunController to terminate execution.
Definition: VModule.h:64
Main configuration utility.
Definition: CentralConfig.h:51
boost::indirect_iterator< InternalStationIterator, Station & > StationIterator
Iterator over all stations.
Definition: SEvent.h:52
void SetShowerSizeType(const ShowerSizeType type)
bool HasLDF() const
Branch GetFirstChild() const
Get first child of this Branch.
Definition: Branch.cc:98
evt::RiseTime1000 & GetRiseTime1000()
static SdCompositionParameterResults * fgCompositionParameterResults
fwk::VModule::ResultFlag Finish()
Finish: invoked at end of the run (NOT end of the event)
const int nPar
Definition: GeomAsym.h:37
bool HasVEMTrace(const StationConstants::SignalComponent source=StationConstants::eTotal) const
Definition: PMTRecData.h:55
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165
constexpr double m
Definition: AugerUnits.h:121
bool HasSRecShower() const
sevt::SEvent & GetSEvent()
bool HasSEvent() const
double GetGamma() const
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)
bool SbCandidateFlag(int saturationflag, double distance, bool sat1000)
double GetTotalSignalCleaned() const

, generated on Tue Sep 26 2023.