Belle II Software  release-08-01-10
ECLDigitCalibratorModule.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 /* Own header. */
10 #include <ecl/modules/eclDigitCalibration/ECLDigitCalibratorModule.h>
11 
12 /* ECL headers. */
13 #include <ecl/dataobjects/ECLCalDigit.h>
14 #include <ecl/dataobjects/ECLDigit.h>
15 #include <ecl/dataobjects/ECLDsp.h>
16 #include <ecl/dataobjects/ECLPureCsIInfo.h>
17 #include <ecl/dbobjects/ECLCrystalCalib.h>
18 #include <ecl/digitization/EclConfiguration.h>
19 #include <ecl/geometry/ECLGeometryPar.h>
20 #include <ecl/utility/utilityFunctions.h>
21 
22 /* Basf2 headers. */
23 #include <framework/core/Environment.h>
24 #include <framework/gearbox/Unit.h>
25 #include <framework/geometry/B2Vector3.h>
26 #include <framework/logging/Logger.h>
27 #include <framework/utilities/FileSystem.h>
28 #include <mdst/dataobjects/EventLevelClusteringInfo.h>
29 
30 /* ROOT headers. */
31 #include <TFile.h>
32 #include <TH1F.h>
33 
34 /* C++ headers. */
35 #include <unordered_map>
36 
37 using namespace std;
38 using namespace Belle2;
39 using namespace ECL;
40 
41 //-----------------------------------------------------------------
42 // Register the Modules
43 //-----------------------------------------------------------------
44 REG_MODULE(ECLDigitCalibrator);
45 REG_MODULE(ECLDigitCalibratorPureCsI);
46 
47 //-----------------------------------------------------------------
48 // Implementation
49 //-----------------------------------------------------------------
50 
51 // constructor
52 ECLDigitCalibratorModule::ECLDigitCalibratorModule() :
53  m_calibrationCrystalElectronics("ECLCrystalElectronics"),
54  m_calibrationCrystalEnergy("ECLCrystalEnergy"),
55  m_calibrationCrystalElectronicsTime("ECLCrystalElectronicsTime"),
56  m_calibrationCrystalTimeOffset("ECLCrystalTimeOffset"),
57  m_calibrationCrateTimeOffset("ECLCrateTimeOffset"),
58  m_calibrationCrystalFlightTime("ECLCrystalFlightTime"),
59  m_eclDigits(eclDigitArrayName()),
60  m_eclCalDigits(eclCalDigitArrayName()),
61  m_eclDsps(eclDspArrayName()),
62  m_eclPureCsIInfo(eclPureCsIInfoArrayName())
63 {
64  // Set module properties
65  setDescription("Applies digit energy, time and time-resolution calibration to each ECL digit. Counts number of out-of-time background digits to determine the event-by-event background level.");
66  addParam("backgroundEnergyCut", m_backgroundEnergyCut, "Energy cut used to count background digits", 7.0 * Belle2::Unit::MeV);
67  addParam("backgroundTimingCut", m_backgroundTimingCut, "Timing cut used to count background digits", 110.0 * Belle2::Unit::ns);
68  addParam("fileBackgroundName", m_fileBackgroundName, "Background filename.",
69  FileSystem::findFile("/data/ecl/background_norm.root"));
70  addParam("simulatePure", m_simulatePure, "Flag to simulate pure CsI option", false);
71 
72  // t-t0 = p1 + pow( (p3/(amplitude+p2)), p4 ) + p5*exp(-amplitude/p6) ("Energy dependence equation")
73  addParam("energyDependenceTimeOffsetFitParam_p1", m_energyDependenceTimeOffsetFitParam_p1,
74  "Fit parameter (p1) for applying correction to the time offset as a function of the energy (amplitude)", -999.0);
75  addParam("energyDependenceTimeOffsetFitParam_p2", m_energyDependenceTimeOffsetFitParam_p2,
76  "Fit parameter (p2) for applying correction to the time offset as a function of the energy (amplitude)", -999.0);
77  addParam("energyDependenceTimeOffsetFitParam_p3", m_energyDependenceTimeOffsetFitParam_p3,
78  "Fit parameter (p3) for applying correction to the time offset as a function of the energy (amplitude)", -999.0);
79  addParam("energyDependenceTimeOffsetFitParam_p4", m_energyDependenceTimeOffsetFitParam_p4,
80  "Fit parameter (p4) for applying correction to the time offset as a function of the energy (amplitude)", -999.0);
81  addParam("energyDependenceTimeOffsetFitParam_p5", m_energyDependenceTimeOffsetFitParam_p5,
82  "Fit parameter (p5) for applying correction to the time offset as a function of the energy (amplitude)", -999.0);
83  addParam("energyDependenceTimeOffsetFitParam_p6", m_energyDependenceTimeOffsetFitParam_p6,
84  "Fit parameter (p6) for applying correction to the time offset as a function of the energy (amplitude)", -999.0);
85 
86 
87  // Parallel processing certification
89 
90  m_averageBG = 0;
91  m_pol2Max = 0.0;
92  m_timeInverseSlope = 0.0;
93 
94 }
95 
96 // destructor
98 {
99 }
100 
101 // initialize calibration
103 {
104 
105  // 1/(4fRF) = 0.4913 ns/clock tick, where fRF is the accelerator RF frequency. Same for all crystals:
106  m_timeInverseSlope = 1.0 / (4.0 * EclConfiguration::getRF()) * 1e3;
107  m_pureCsIEnergyCalib = 0.00005; //conversion factor from ADC counts to GeV
108  m_pureCsITimeCalib = 0.1; //conversion factor from eclPureCsIDigitizer to ns
109  m_pureCsITimeOffset = 0.31; //ad-hoc offset correction for pureCsI timing
110 
118 }
119 
120 // callback calibration
122  std::vector<float>& constantsUnc)
123 {
124  constants = cal->getCalibVector();
125  constantsUnc = cal->getCalibUncVector();
126 }
127 
128 
129 // initialize
131 {
132  //mdst dataobjects
133  // This object is registered by both ECL and KLM packages. Let's be agnostic about the
134  // execution order of ecl and klm modules: the first package run registers the module
137 
138  // Register Digits, CalDigits and their relation in datastore
139  m_eclDigits.registerInDataStore(eclDigitArrayName());
140  m_eclDsps.registerInDataStore(eclDspArrayName());
141  m_eclCalDigits.registerInDataStore(eclCalDigitArrayName());
142  m_eclCalDigits.registerRelationTo(m_eclDigits);
143 
144  //Special information for pure CsI simulation
145  m_eclPureCsIInfo.registerInDataStore(eclPureCsIInfoArrayName());
146 
147  // initialize calibration
149 
150  // initialize time resolution (not yet from the database)
151  // read the Background correction factors (for full background)
152  m_fileBackground = new TFile(m_fileBackgroundName.c_str(), "READ");
153  if (!m_fileBackground) B2FATAL("Could not find file: " << m_fileBackgroundName);
154  m_th1fBackground = dynamic_cast<TH1F*>(m_fileBackground->Get("background"));
155  if (!m_th1fBackground) B2FATAL("Could not find m_th1fBackground");
156 
157  // average BG value from m_th1fBackground
158  m_averageBG = m_th1fBackground->Integral() / m_th1fBackground->GetEntries();
159 
160  // get maximum position ("x") of 2-order pol background for t99
161  if (fabs(c_pol2Var3) > 1e-12) {
162  m_pol2Max = -c_pol2Var2 / (2 * c_pol2Var3);
163  } else {
164  m_pol2Max = 0.;
165  }
166 
173  B2DEBUG(80, "m_energyDependenceTimeOffsetFitParam_p1 = " << m_energyDependenceTimeOffsetFitParam_p1);
174  B2DEBUG(80, "m_energyDependenceTimeOffsetFitParam_p2 = " << m_energyDependenceTimeOffsetFitParam_p2);
175  B2DEBUG(80, "m_energyDependenceTimeOffsetFitParam_p3 = " << m_energyDependenceTimeOffsetFitParam_p3);
176  B2DEBUG(80, "m_energyDependenceTimeOffsetFitParam_p4 = " << m_energyDependenceTimeOffsetFitParam_p4);
177  B2DEBUG(80, "m_energyDependenceTimeOffsetFitParam_p5 = " << m_energyDependenceTimeOffsetFitParam_p5);
178  B2DEBUG(80, "m_energyDependenceTimeOffsetFitParam_p6 = " << m_energyDependenceTimeOffsetFitParam_p6);
179 
186  }
187 }
188 
189 // begin run
191 {
192  // Check if any of the calibration constants have changed
193  if (m_calibrationCrystalElectronics.hasChanged()) {
196  } else B2ERROR("ECLDigitCalibratorModule::beginRun - Couldn't find m_calibrationCrystalElectronics for current run!");
197  }
198 
199  if (m_calibrationCrystalEnergy.hasChanged()) {
202  } else B2ERROR("ECLDigitCalibratorModule::beginRun - Couldn't find m_calibrationCrystalEnergy for current run!");
203  }
204 
205  if (m_calibrationCrystalElectronicsTime.hasChanged()) {
209  } else B2ERROR("ECLDigitCalibratorModule::beginRun - Couldn't find m_calibrationCrystalElectronicsTime for current run!");
210  }
211 
212  if (m_calibrationCrystalTimeOffset.hasChanged()) {
215  } else B2ERROR("ECLDigitCalibratorModule::beginRun - Couldn't find m_calibrationCrystalTimeOffset for current run!");
216  }
217 
218  if (m_calibrationCrateTimeOffset.hasChanged()) {
221  } else B2ERROR("ECLDigitCalibratorModule::beginRun - Couldn't find m_calibrationCrateTimeOffset for current run!");
222  }
223 
224  if (m_calibrationCrystalFlightTime.hasChanged()) {
227  } else B2ERROR("ECLDigitCalibratorModule::beginRun - Couldn't find m_calibrationCrystalFlightTime for current run!");
228  }
229 
230 }
231 
232 // event
234 {
235 
236  // Loop over the input array
237  for (auto& aECLDigit : m_eclDigits) {
238 
239  bool is_pure_csi = 0;
240 
241  // append an ECLCalDigit to the storearray
242  const auto aECLCalDigit = m_eclCalDigits.appendNew();
243 
244  // get the cell id from the ECLDigit as identifier
245  const int cellid = aECLDigit.getCellId();
246 
247  // check that the cell id is valid
248  if (cellid < 1 or cellid > c_nCrystals) {
249  B2FATAL("ECLDigitCalibrationModule::event():" << cellid << " out of range!");
250  }
251 
252  // perform the digit energy calibration: E = A * Ce * Cs
253  const int amplitude = aECLDigit.getAmp();
254  double calibratedEnergy = 0;
255 
256  if (m_simulatePure) {
257  if (aECLDigit.getRelated<ECLPureCsIInfo>(eclPureCsIInfoArrayName()) != nullptr) {
258  if (aECLDigit.getRelated<ECLPureCsIInfo>(eclPureCsIInfoArrayName())->getPureCsI())
259  is_pure_csi = 1;
260  }
261  }
262 
263  if (is_pure_csi) {
264  calibratedEnergy = amplitude * m_pureCsIEnergyCalib;
265  } else {
266  calibratedEnergy = amplitude * v_calibrationCrystalElectronics[cellid - 1] * v_calibrationCrystalEnergy[cellid - 1];
267  }
268  if (calibratedEnergy < 0.0) calibratedEnergy = 0.0;
269 
270  // perform the digit timing calibration: t = c * (tfit - Te - Ts)
271  const int time = aECLDigit.getTimeFit();
272  const int quality = aECLDigit.getQuality();
273  double calibratedTime = c_timeForFitFailed;
274  if (quality == 1) {
275  aECLCalDigit->addStatus(ECLCalDigit::c_IsFailedFit); //this is used to flag failed fits
276  } else { //only calibrate digit time if we have a good waveform fit
277  if (is_pure_csi) {
278  calibratedTime = m_pureCsITimeCalib * m_timeInverseSlope * (time - v_calibrationCrystalElectronicsTime[cellid - 1] -
279  v_calibrationCrystalTimeOffset[cellid - 1] -
280  v_calibrationCrateTimeOffset[cellid - 1])
282  } else {
283  calibratedTime = m_timeInverseSlope * (time - v_calibrationCrystalElectronicsTime[cellid - 1] -
284  v_calibrationCrystalTimeOffset[cellid - 1] -
285  v_calibrationCrateTimeOffset[cellid - 1])
286  - v_calibrationCrystalFlightTime[cellid - 1] ;
287  }
288 
289  // For data, apply a correction to the time as a function of the signal amplitude. Correction determined from a fit.
290  // No correction for MC
291  bool m_IsMCFlag = Environment::Instance().isMC();
292  B2DEBUG(35, "cellid = " << cellid << ", m_IsMCFlag = " << m_IsMCFlag) ;
293 
294  if (!m_IsMCFlag) {
295  double energyTimeShift = ECLTimeUtil->energyDependentTimeOffsetElectronic(amplitude * v_calibrationCrystalElectronics[cellid - 1]) *
297  B2DEBUG(35, "cellid = " << cellid << ", amplitude = " << amplitude << ", corrected amplitude = " << amplitude*
298  v_calibrationCrystalElectronics[cellid - 1] << ", time before t(E) shift = " << calibratedTime << ", t(E) shift = " <<
299  energyTimeShift << " ns") ;
300  calibratedTime -= energyTimeShift ;
301  }
302  }
303 
304  B2DEBUG(35, "cellid = " << cellid << ", amplitude = " << amplitude << ", calibrated energy = " << calibratedEnergy);
305  B2DEBUG(35, "cellid = " << cellid << ", time = " << time << ", calibratedTime = " << calibratedTime);
306 
307  //Calibrating offline fit results
308  ECLDsp* aECLDsp = ECLDsp::getByCellID(cellid);
309  aECLCalDigit->setTwoComponentChi2(-1);
310  aECLCalDigit->setTwoComponentSavedChi2(ECLDsp::photonHadron, -1);
311  aECLCalDigit->setTwoComponentSavedChi2(ECLDsp::photonHadronBackgroundPhoton, -1);
312  aECLCalDigit->setTwoComponentSavedChi2(ECLDsp::photonDiodeCrossing, -1);
313  aECLCalDigit->setTwoComponentTotalEnergy(-1);
314  aECLCalDigit->setTwoComponentHadronEnergy(-1);
315  aECLCalDigit->setTwoComponentDiodeEnergy(-1);
316  if (aECLDsp) {
317  //require ECLDigit to have offline waveform
318  if (aECLDsp->getTwoComponentChi2() > 0) {
319  //require offline waveform to have offline fit result
320 
321  const double calibratedTwoComponentTotalEnergy = aECLDsp->getTwoComponentTotalAmp() * v_calibrationCrystalElectronics[cellid - 1] *
322  v_calibrationCrystalEnergy[cellid - 1];
323  const double calibratedTwoComponentHadronEnergy = aECLDsp->getTwoComponentHadronAmp() * v_calibrationCrystalElectronics[cellid -
324  1] *
325  v_calibrationCrystalEnergy[cellid - 1];
326  const double calibratedTwoComponentDiodeEnergy = aECLDsp->getTwoComponentDiodeAmp() * v_calibrationCrystalElectronics[cellid - 1] *
327  v_calibrationCrystalEnergy[cellid - 1];
328  const double twoComponentChi2 = aECLDsp->getTwoComponentChi2();
329  const ECLDsp::TwoComponentFitType twoComponentFitType = aECLDsp->getTwoComponentFitType();
330 
331  aECLCalDigit->setTwoComponentTotalEnergy(calibratedTwoComponentTotalEnergy);
332  aECLCalDigit->setTwoComponentHadronEnergy(calibratedTwoComponentHadronEnergy);
333  aECLCalDigit->setTwoComponentDiodeEnergy(calibratedTwoComponentDiodeEnergy);
334  aECLCalDigit->setTwoComponentChi2(twoComponentChi2);
335  aECLCalDigit->setTwoComponentSavedChi2(ECLDsp::photonHadron, aECLDsp->getTwoComponentSavedChi2(ECLDsp::photonHadron));
336  aECLCalDigit->setTwoComponentSavedChi2(ECLDsp::photonHadronBackgroundPhoton,
338  aECLCalDigit->setTwoComponentSavedChi2(ECLDsp::photonDiodeCrossing, aECLDsp->getTwoComponentSavedChi2(ECLDsp::photonDiodeCrossing));
339  aECLCalDigit->setTwoComponentFitType(twoComponentFitType);
340 
341  }
342  }
343 
344  // fill the ECLCalDigit with the cell id, the calibrated information and calibration status
345  aECLCalDigit->setCellId(cellid);
346 
347  aECLCalDigit->setEnergy(calibratedEnergy);
348  aECLCalDigit->addStatus(ECLCalDigit::c_IsEnergyCalibrated);
349 
350  aECLCalDigit->setTime(calibratedTime);
351  aECLCalDigit->addStatus(ECLCalDigit::c_IsTimeCalibrated);
352 
353  // set a relation to the ECLDigit
354  aECLCalDigit->addRelationTo(&aECLDigit);
355  }
356 
357  // determine background level
358  const int bgCount = determineBackgroundECL();
359 
360  // set the t99 (time resolution)
361  for (auto& aECLCalDigit : m_eclCalDigits) {
362 
363  // perform the time resolution calibration
364  const double t99 = getT99(aECLCalDigit.getCellId(),
365  aECLCalDigit.getEnergy(),
366  aECLCalDigit.hasStatus(ECLCalDigit::c_IsFailedFit),
367  bgCount); // calibrated time resolution
368  aECLCalDigit.setTimeResolution(t99);
369 
370  if (t99 == c_timeResolutionForFitFailed) {
371  aECLCalDigit.addStatus(ECLCalDigit::c_IsFailedTimeResolution);
372  }
373 
374  aECLCalDigit.addStatus(ECLCalDigit::c_IsTimeResolutionCalibrated);
375  }
376 }
377 
378 // end run
380 {
381 
382 }
383 
384 // terminate
386 {
387 
388 }
389 
390 // Time resolution calibration
391 double ECLDigitCalibratorModule::getT99(const int cellid, const double energy, const bool fitfailed, const int bgcount) const
392 {
393 
394  // if this digit is calibrated to the trigger time, we set the resolution to 'very bad' (to be discussed)
395  if (fitfailed) return c_timeResolutionForFitFailed;
396 
397  // Get the background level [MeV / mus]
398  const double bglevel = TMath::Min((double) bgcount / (double) c_nominalBG * m_th1fBackground->GetBinContent(cellid) / m_averageBG,
399  m_pol2Max); // c_nominalBG = 183 for actual version of digitizer, m_averageBG is about 2 MeV/ mus
400 
401  // Get p1 as function of background level
402  const double p1 = c_pol2Var1 + c_pol2Var2 * bglevel + c_pol2Var3 * bglevel * bglevel;
403 
404  // inverse energy in 1/MeV
405  double einv = 0.;
406  if (energy > 1e-12) einv = 1. / (energy / Belle2::Unit::MeV);
407 
408  // calculate t99 using the inverse energy and p1 (p0 is zero)
409  double t99 = p1 * einv;
410 
411  // for high energies we fix t99 to 3.5ns
412  if (t99 < c_minT99) t99 = c_minT99;
413 
414  B2DEBUG(35, "ECLDigitCalibratorModule::getCalibratedTimeResolution: dose = " << m_th1fBackground->GetBinContent(
415  cellid) << ", bglevel = " << bglevel << ", cellid = " << cellid << ", t99 = " << t99 << ", energy = " << energy /
417 
418  return t99;
419 }
420 
421 // Determine background level by event by counting out-of-time digits above threshold.
423 {
424  //EventLevelClustering counters
425  using regionCounter = std::unordered_map<ECL::DetectorRegion, uint>;
426 
427  regionCounter outOfTimeCount {{ECL::DetectorRegion::FWD, 0},
428  {ECL::DetectorRegion::BRL, 0},
429  {ECL::DetectorRegion::BWD, 0}};
430 
432 
433  // Loop over the input array
434  for (auto& aECLCalDigit : m_eclCalDigits) {
435  if (abs(aECLCalDigit.getTime()) >= m_backgroundTimingCut) {
436  if (aECLCalDigit.getEnergy() >= m_backgroundEnergyCut) {
437  //Get digit theta
438  const B2Vector3D position = geom->GetCrystalPos(aECLCalDigit.getCellId() - 1);
439  const double theta = position.Theta();
440 
441  //Get detector region
442  const auto detectorRegion = ECL::getDetectorRegion(theta);
443 
444  //Count out of time digits per region
445  ++outOfTimeCount.at(detectorRegion);
446  }
447  }
448  }
449 
450  //Save EventLevelClusteringInfo
453  }
454 
455  m_eventLevelClusteringInfo->setNECLCalDigitsOutOfTimeFWD(outOfTimeCount.at(ECL::DetectorRegion::FWD));
456  m_eventLevelClusteringInfo->setNECLCalDigitsOutOfTimeBarrel(outOfTimeCount.at(ECL::DetectorRegion::BRL));
457  m_eventLevelClusteringInfo->setNECLCalDigitsOutOfTimeBWD(outOfTimeCount.at(ECL::DetectorRegion::BWD));
458 
459  B2DEBUG(35, "ECLDigitCalibratorModule::determineBackgroundECL found " << outOfTimeCount.at(ECL::DetectorRegion::FWD) << ", " <<
460  outOfTimeCount.at(ECL::DetectorRegion::BRL) << ", " <<
461  outOfTimeCount.at(ECL::DetectorRegion::BWD) << " out of time digits in FWD, BRL, BWD");
462 
463  return m_eventLevelClusteringInfo->getNECLCalDigitsOutOfTime();
464 }
DataType Theta() const
The polar angle.
Definition: B2Vector3.h:153
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
double m_pureCsITimeCalib
conversion factor from eclPureCsIDigitizer to ns.
double m_energyDependenceTimeOffsetFitParam_p5
p5 in "energy dependence equation"
const double c_pol2Var2
2-order fit for p1.
StoreArray< ECLDsp > m_eclDsps
storearray ECLDsp
virtual const char * eclDigitArrayName() const
Name of the ECLDigit.
DBObjPtr< ECLCrystalCalib > m_calibrationCrateTimeOffset
single crate time calibration offset (per crystal)
double m_pureCsITimeOffset
ad-hoc offset correction for pureCsI timing/
TH1F * m_th1fBackground
Background histogram.
DBObjPtr< ECLCrystalCalib > m_calibrationCrystalElectronics
single crystal electronics calibration
double m_energyDependenceTimeOffsetFitParam_p2
p2 in "energy dependence equation"
const double c_minT99
The minimum t99.
virtual void initialize() override
Initialize variables.
std::vector< float > v_calibrationCrystalElectronicsUnc
single crystal electronics calibration as vector uncertainty
std::string m_fileBackgroundName
Background filename.
std::vector< float > v_calibrationCrateTimeOffsetUnc
single crate time calibration offset as vector uncertainty (per crystal)
double m_energyDependenceTimeOffsetFitParam_p3
p3 in "energy dependence equation"
double m_energyDependenceTimeOffsetFitParam_p6
p6 in "energy dependence equation"
std::vector< float > v_calibrationCrystalElectronicsTimeUnc
single crystal time calibration offset electronics as vector uncertainty
virtual void event() override
event per event.
DBObjPtr< ECLCrystalCalib > m_calibrationCrystalEnergy
single crystal energy calibration
StoreArray< ECLPureCsIInfo > m_eclPureCsIInfo
storearray ECLPureCsIInfo - Special information for pure CsI simulation
virtual void endRun() override
end run.
double getT99(const int cellid, const double energy, const bool fitfailed, const int bgcount) const
t99%.
virtual void terminate() override
terminate.
const double c_pol2Var1
2-order fit for p1 Var1 + Var2*bg + Var3*bg^2.
StoreArray< ECLDigit > m_eclDigits
storearray ECLDigit
const double c_timeResolutionForFitFailed
Time resolution for failed fits".
std::vector< float > v_calibrationCrystalElectronicsTime
single crystal time calibration offset electronics as vector
std::vector< float > v_calibrationCrystalFlightTime
single crystal time calibration TOF as vector
void callbackCalibration(DBObjPtr< ECLCrystalCalib > &cal, std::vector< float > &constants, std::vector< float > &constantsUnc)
reads calibration constants
std::unique_ptr< Belle2::ECL::ECLTimingUtilities > ECLTimeUtil
ECL timing tools.
double m_energyDependenceTimeOffsetFitParam_p4
p4 in "energy dependence equation"
void initializeCalibration()
reads calibration constants, performs checks, put them into a vector
std::vector< float > v_calibrationCrystalEnergy
single crystal energy calibration as vector
std::vector< float > v_calibrationCrystalEnergyUnc
single crystal energy calibration as vector uncertainty
virtual void beginRun() override
begin run.
virtual const char * eclPureCsIInfoArrayName() const
Name of the ECL pure CsI Information.
const double c_pol2Var3
2-order fit for p1.
std::vector< float > v_calibrationCrateTimeOffset
single crate time calibration offset as vector (per crystal)
const double c_timeForFitFailed
Time for failed fits".
int determineBackgroundECL()
count out of time digits to determine baclground levels
double m_timeInverseSlope
Time calibration inverse slope "a".
DBObjPtr< ECLCrystalCalib > m_calibrationCrystalTimeOffset
single crystal time calibration offset
double m_backgroundTimingCut
Timing window for background level counting.
std::vector< float > v_calibrationCrystalElectronics
single crystal electronics calibration as vector
DBObjPtr< ECLCrystalCalib > m_calibrationCrystalElectronicsTime
single crystal time calibration offset electronics
virtual const char * eventLevelClusteringInfoName() const
Name of the EventLevelClusteringInfo.
double m_pureCsIEnergyCalib
conversion factor from ADC counts to GeV.
double m_energyDependenceTimeOffsetFitParam_p1
p1 in "energy dependence equation"
const int c_nCrystals
Number of ECL crystals.
std::vector< float > v_calibrationCrystalTimeOffset
single crystal time calibration offset as vector
virtual const char * eclDspArrayName() const
Name of the ECLDsp.
DBObjPtr< ECLCrystalCalib > m_calibrationCrystalFlightTime
single crystal time calibration TOF
double m_averageBG
Average dose per crystal calculated from m_th1dBackground.
double m_pol2Max
Maximum of p1 2-order fit to limit values.
std::vector< float > v_calibrationCrystalFlightTimeUnc
single crystal time calibration TOF as vector uncertainty
double m_backgroundEnergyCut
Energy cut for background level counting.
virtual const char * eclCalDigitArrayName() const
Name of the ECLCalDigit.
StoreObjPtr< EventLevelClusteringInfo > m_eventLevelClusteringInfo
event level clustering info
StoreArray< ECLCalDigit > m_eclCalDigits
storearray ECLCalDigit
const int c_nominalBG
Number of out of time digits at BGx1.0.
std::vector< float > v_calibrationCrystalTimeOffsetUnc
single crystal time calibration offset as vector uncertainty
bool m_simulatePure
Flag to set pure CsI simulation option.
Class to store ECL ShaperDSP waveform ADC data.
Definition: ECLDsp.h:25
double getTwoComponentHadronAmp() const
get two comp hadron amp
Definition: ECLDsp.h:136
double getTwoComponentSavedChi2(TwoComponentFitType FitTypeIn) const
get two comp chi2 for a fit type see enum TwoComponentFitType in ECLDsp.h for description of fit type...
Definition: ECLDsp.h:152
TwoComponentFitType
Offline two component fit type.
Definition: ECLDsp.h:29
@ photonHadronBackgroundPhoton
photon + hadron template + pile-up photon fit
Definition: ECLDsp.h:32
@ photonDiodeCrossing
photon + diode template fit
Definition: ECLDsp.h:33
@ photonHadron
photon + hadron template fit
Definition: ECLDsp.h:31
double getTwoComponentTotalAmp() const
get two comp total amp
Definition: ECLDsp.h:131
double getTwoComponentChi2() const
get two comp chi2
Definition: ECLDsp.h:146
TwoComponentFitType getTwoComponentFitType() const
get two comp fit type
Definition: ECLDsp.h:171
static ECLDsp * getByCellID(int cid)
Find ECLDsp by Cell ID using linear search.
Definition: ECLDsp.cc:14
double getTwoComponentDiodeAmp() const
get two comp diode amp
Definition: ECLDsp.h:141
Class to store ECL crystal type relation to ECLDigit for the simulation pure CsI upgrade option fille...
The Class for ECL Geometry Parameters.
static ECLGeometryPar * Instance()
Static method to get a reference to the ECLGeometryPar instance.
static double getRF()
See m_rf.
bool isMC() const
Do we have generated, not real data?
Definition: Environment.cc:54
static Environment & Instance()
Static method to get a reference to the Environment instance.
Definition: Environment.cc:28
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
Definition: FileSystem.cc:148
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
static const double MeV
[megaelectronvolt]
Definition: Unit.h:114
static const double ns
Standard of [time].
Definition: Unit.h:48
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.