ATLAS Offline Software
ZdcMonitorAlgorithm.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 
10 ZdcMonitorAlgorithm::ZdcMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator )
11 :AthMonitorAlgorithm(name,pSvcLocator){
12  ATH_MSG_DEBUG("calling the constructor of ZdcMonitorAlgorithm");
13 }
14 
15 
17 
18 
19 void ZdcMonitorAlgorithm::calculate_log_bin_edges(float min_value, float max_value, int num_bins, std::vector<float>& bin_edges) {
20  // Clear the vector to ensure it's empty
21  bin_edges.clear();
22 
23  // Calculate the logarithmic bin edges
24  float log_min = std::log10(min_value);
25  float log_max = std::log10(max_value);
26 
27  // Linear space between log_min and log_max with num_bins+1 points
28  float step = (log_max - log_min) / num_bins;
29 
30  // Populate the vector with the bin edges
31  for (int i = 0; i <= num_bins; ++i) {
32  float edge = log_min + i * step;
33  bin_edges.push_back(std::pow(10, edge));
34  }
35 }
36 
37 
38 float ZdcMonitorAlgorithm::calculate_inverse_bin_width(float event_value, const std::string& variable_name, const std::vector<float>& bin_edges) const {
39  // Check if the event_value is out of range
40  if (event_value < bin_edges.front() || event_value > bin_edges.back()) { // changed output level to debug: this is not uncommon
41  ATH_MSG_DEBUG("In calculation of inverse-bin-width event weight for the variable " << variable_name << ", the current event value " << event_value << " is out of the bin range.");
42  ATH_MSG_DEBUG("Assign zero weight for the current event (event not filled).");
43  return 0.0; // event weight is zero
44  }
45 
46  // Find the bin in which event_value falls
47  for (size_t i = 0; i < bin_edges.size() - 1; ++i) {
48  if (event_value >= bin_edges[i] && event_value < bin_edges[i + 1]) {
49  float bin_width = bin_edges[i + 1] - bin_edges[i];
50  if (bin_width != 0) {
51  return 1.0f / bin_width; // Return the inverse of bin width
52  } else {
53  ATH_MSG_WARNING("Warning: in calculation of inverse-bin-width event weight for the variable " << variable_name << ", bin width containing the event value " << event_value << " is zero.");
54  ATH_MSG_WARNING("Assign zero weight for the current event (event not filled).");
55  return 0.0; // event weight is zero
56  }
57  }
58  }
59 
60  // Handle edge case where event_value == bin_edges.back()
61  if (event_value == bin_edges.back()) {
62  size_t last_bin_index = bin_edges.size() - 2;
63  float bin_width = bin_edges[last_bin_index + 1] - bin_edges[last_bin_index];
64  return 1.0 / bin_width;
65  }
66 
67  // If no bin is found (should not reach here)
68  ATH_MSG_WARNING("Warning: in calculation of inverse-bin-width event weight for the variable " << variable_name << ", no valid bin found for the event value " << event_value << ".");
69  ATH_MSG_WARNING("Assign zero weight for the current event (event not filled).");
70  return 0.0; // event weight is zero
71 }
72 
73 
75 
76  ATH_MSG_DEBUG("initializing for the monitoring algorithm");
77  ATH_MSG_DEBUG("Is online? " << m_isOnline);
78  ATH_MSG_DEBUG("Is calorimeter info turned on? " << m_CalInfoOn);
79  ATH_MSG_DEBUG("Is single-side ZDC trigger info turned on? " << m_EnableZDCSingleSideTriggers);
80  ATH_MSG_DEBUG("Is UCC trigger info turned on? " << m_EnableUCCTriggers);
81  ATH_MSG_DEBUG("Is injected pulse? " << m_isInjectedPulse);
82  ATH_MSG_DEBUG("Is Standalone? " << m_isStandalone);
83  ATH_MSG_DEBUG("Enable ZDC? " << m_enableZDC);
84  ATH_MSG_DEBUG("Enable ZDC Physics? " << m_enableZDCPhysics);
85  ATH_MSG_DEBUG("Enable RPD Amp? " << m_enableRPDAmp);
86  ATH_MSG_DEBUG("Enable Centroid? " << m_enableCentroid);
87 
88  using namespace Monitored;
89  ATH_CHECK( m_ZdcSumContainerKey.initialize() );
90  ATH_CHECK( m_ZdcModuleContainerKey.initialize() );
92 
93  ATH_CHECK( m_eventTypeKey.initialize() );
94  // ATH_CHECK( m_ZdcBCIDKey.initialize() );
95  ATH_CHECK( m_DAQModeKey.initialize() );
96 
101 
102  // access to conditions in cool database
104 
117 
123 
131 
140 
141  // calculate log binnings
144 
145  // read json file for LB-to-injector-pulse-amplitude mapping and fill the mapping vector
146  m_zdcInjPulserAmpMap = std::make_shared<ZdcInjPulserAmpMap>();
147  ATH_MSG_DEBUG( "Using JSON file for injector-pulse voltage at path " << m_zdcInjPulserAmpMap->getFilePath() );
148  ATH_MSG_DEBUG("CALIBPATH: " << std::getenv("CALIBPATH"));
149 
150  // create monitoring tools and map the strings to the tools
151  std::vector<std::string> sides = {"C","A"};
152  std::vector<std::string> modules = {"0","1","2","3"};
153  std::vector<std::string> channels = {"0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"};
154  m_ZDCModuleToolIndices = buildToolMap<std::map<std::string,int>>(m_tools,"ZdcModuleMonitor",sides,modules);
155  if (m_enableZDCPhysics || m_enableRPDAmp || m_enableCentroid){ // none is true for injector pulse --> no Per-side monitoring tool
156  m_ZDCSideToolIndices = buildToolMap<int>(m_tools,"ZdcSideMonitor",sides);
157  }
158  if (m_enableRPDAmp){
159  m_RPDChannelToolIndices = buildToolMap<std::map<std::string,int>>(m_tools,"RpdChannelMonitor",sides,channels);
160  }
161 
162  //---------------------------------------------------
163 
164  // Get access to the injector pulse steps for (fixed) run number for current job
165  //
167 
169  if (!m_injMapRunToken.isValid()) {
170  ATH_MSG_ERROR("Unable to obtain injector pulse steps for run " << m_runNumber);
171  }
172  else {
173  unsigned int startLB = m_zdcInjPulserAmpMap->getFirstLumiBlock(m_injMapRunToken);
174  unsigned int nsteps = m_zdcInjPulserAmpMap->getNumSteps(m_injMapRunToken);
175  ATH_MSG_DEBUG("Successfully obtained injector pulse steps for run " << m_runNumber
176  << ", first LB = " << startLB << ", number of steps = " << nsteps);
177  }
178  }
179 
180  //---------------------------------------------------
181  // initialize superclass
182 
184  //---------------------------------------------------
185 
186 }
187 
188 
190  ATH_MSG_DEBUG("calling the fillPhysicsDataHistograms function");
191 
192 // ______________________________________________________________________________
193  // EVENT-level flags for whether ZDC, RPD and RPDCentroid data is available
194  // needed for events with LUCROD decoding error - will have missing aux data
195  bool cur_event_ZDC_available = true;
196  bool cur_event_RPD_available = true;
197  bool cur_event_RPDCentroid_available = true;
198 
199 // ______________________________________________________________________________
200 
201 // ______________________________________________________________________________
202  // declaring & obtaining event-level information of interest
203 // ______________________________________________________________________________
205  // already checked in fillHistograms that eventInfo is valid
206  auto lumiBlock = Monitored::Scalar<uint32_t>("lumiBlock", eventInfo->lumiBlock());
207  auto bcid = Monitored::Scalar<unsigned int>("bcid", eventInfo->bcid());
208  uint32_t eventTime = eventInfo->timeStamp();
209  uint32_t runNumber = eventInfo->runNumber();
210 
211 // ______________________________________________________________________________
212  // check for decoding errors
213 // ______________________________________________________________________________
216  std::array<float, m_nDecodingErrorBits> decodingErrorBitsArr = {0, 0, 0};
217 
218  cur_event_ZDC_available &= !zdcDecodingError;
219  cur_event_RPD_available &= !rpdDecodingError;
220 
221  if (!zdcDecodingError && !rpdDecodingError){
222  decodingErrorBitsArr[0] += 1;
223  } else if (zdcDecodingError){
224  ATH_MSG_WARNING("ZDC Decoding error!");
225  decodingErrorBitsArr[1] += 1;
226  } else { // RPD decoding error
227  ATH_MSG_WARNING("RPD Decoding error!");
228  decodingErrorBitsArr[2] += 1;
229  }
230 
231  auto zdcTool = getGroup("genZdcMonTool"); // get the tool for easier group filling
232 
233  auto decodingErrorBits = Monitored::Collection("decodingErrorBits", decodingErrorBitsArr);
234  fill(zdcTool, decodingErrorBits, lumiBlock);
235 
236 // ______________________________________________________________________________
237  // does event pass trigger selection?
238 // ______________________________________________________________________________
239 
240  auto passTrigSideA = Monitored::Scalar<bool>("passTrigSideA",false); // if trigger isn't enabled (e.g, MC) the with-trigger histograms are never filled (cut mask never satisfied)
241  auto passTrigSideC = Monitored::Scalar<bool>("passTrigSideC",false);
242 
243  if(m_EnableZDCSingleSideTriggers && m_enableZDCPhysics){ // if not enable trigger, the pass-trigger booleans will still be defined but with value always set to false
244  const auto &trigDecTool = getTrigDecisionTool();
245  passTrigSideA = trigDecTool->isPassed(m_triggerSideA, TrigDefs::Physics);
246  passTrigSideC = trigDecTool->isPassed(m_triggerSideC, TrigDefs::Physics);
247  if (passTrigSideA) ATH_MSG_DEBUG("passing trig on side A!");
248  if (passTrigSideC) ATH_MSG_DEBUG("passing trig on side C!");
249  }
250 
251  auto passUCCTrig_HELT15 = Monitored::Scalar<bool>("passUCCTrig_HELT15",false);
252  auto passUCCTrig_HELT20 = Monitored::Scalar<bool>("passUCCTrig_HELT20",false);
253  auto passUCCTrig_HELT25 = Monitored::Scalar<bool>("passUCCTrig_HELT25",false);
254  auto passUCCTrig_HELT35 = Monitored::Scalar<bool>("passUCCTrig_HELT35",false);
255  auto passUCCTrig_HELT50 = Monitored::Scalar<bool>("passUCCTrig_HELT50",false);
256 
257  std::array<float, m_nUCCTrigBits> uccTrigBitsArr = {0};
258 
259  if(m_EnableUCCTriggers && m_enableZDCPhysics){ // if not enable trigger, the pass-trigger booleans will still be defined but with value always set to false
260  uccTrigBitsArr[UCCTrigEnabledBit] += 1;
261 
262  const auto &trigDecTool = getTrigDecisionTool();
263  passUCCTrig_HELT15 = trigDecTool->isPassed(m_UCCtriggerHELT15);
264  passUCCTrig_HELT20 = trigDecTool->isPassed(m_UCCtriggerHELT20);
265  passUCCTrig_HELT25 = trigDecTool->isPassed(m_UCCtriggerHELT25);
266  passUCCTrig_HELT35 = trigDecTool->isPassed(m_UCCtriggerHELT35);
267  passUCCTrig_HELT50 = trigDecTool->isPassed(m_UCCtriggerHELT50);
268 
269  if (passUCCTrig_HELT15){
270  uccTrigBitsArr[TrigHELT15Bit] += 1;
271  ATH_MSG_DEBUG("passing UCC trigger L1_ZDC_HELT15_jTE4000!");
272  }
273  if (passUCCTrig_HELT20){
274  uccTrigBitsArr[TrigHELT20Bit] += 1;
275  ATH_MSG_DEBUG("passing UCC trigger L1_ZDC_HELT20_jTE4000!");
276  }
277  if (passUCCTrig_HELT25){
278  uccTrigBitsArr[TrigHELT25Bit] += 1;
279  ATH_MSG_DEBUG("passing UCC trigger L1_ZDC_HELT25_jTE4000!");
280  }
281  if (passUCCTrig_HELT35){
282  uccTrigBitsArr[TrigHELT35Bit] += 1;
283  ATH_MSG_DEBUG("passing UCC trigger L1_ZDC_HELT35_jTE4000!");
284  }
285  if (passUCCTrig_HELT50){
286  uccTrigBitsArr[TrigHELT50Bit] += 1;
287  ATH_MSG_DEBUG("passing UCC trigger L1_ZDC_HELT50_jTE4000!");
288  }
289  }else{
290  uccTrigBitsArr[UCCTrigDisabledBit] += 1;
291  }
292 
293  auto uccTrigBits = Monitored::Collection("uccTrigBits", uccTrigBitsArr);
294  fill(zdcTool, uccTrigBits, lumiBlock);
295 
296 // ______________________________________________________________________________
297  // declaring & obtaining variables of interest for the ZDC sums
298  // including the RPD x,y positions, reaction plane and status
299 // ______________________________________________________________________________
301 
302  auto zdcEnergySumTwoSidesTeV = Monitored::Scalar<float>("zdcEnergySumTwoSidesTeV",0.0);
303  auto zdcHadronicEnergySumTwoSidesTeV = Monitored::Scalar<float>("zdcHadronicEnergySumTwoSidesTeV",0.0);
304  auto zdcEnergySumA = Monitored::Scalar<float>("zdcEnergySumA",-1000.0);
305  auto zdcEnergySumC = Monitored::Scalar<float>("zdcEnergySumC",-1000.0);
306  auto zdcUncalibSumA = Monitored::Scalar<float>("zdcUncalibSumA",-1000.0);
307  auto zdcUncalibSumC = Monitored::Scalar<float>("zdcUncalibSumC",-1000.0);
308  auto rpdCosDeltaReactionPlaneAngle = Monitored::Scalar<float>("rpdCosDeltaReactionPlaneAngle",-1000.0);
309  auto bothReactionPlaneAngleValid = Monitored::Scalar<bool>("bothReactionPlaneAngleValid",true);
310  auto bothHasCentroid = Monitored::Scalar<bool>("bothHasCentroid",true); // the looser requirement that both centroids were calculated (ignore valid)
311 
312  std::array<bool, 2> centroidSideValidArr;
313  std::array<bool, 2> rpdSideValidArr = {false, false};
314  std::array<std::vector<float>,2> rpdSubAmpVecs;
315  auto rpdSubAmpSumCurSide = Monitored::Scalar<float>("rpdSubAmpSum",-1000.0);
316  auto rpdXCentroidCurSide = Monitored::Scalar<float>("xCentroid",-1000.0);
317  auto rpdYCentroidCurSide = Monitored::Scalar<float>("yCentroid",-1000.0);
318  auto rpdReactionPlaneAngleCurSide = Monitored::Scalar<float>("ReactionPlaneAngle",-1000.0);
319  auto centroidValid = Monitored::Scalar<bool>("centroidValid",false);
320  auto centroidValidBitFloat = Monitored::Scalar<float>("centroidValidBitFloat", -1000.0); // 0.5 if valid, 1.5 if invalid --> needed for DQ
321  auto passMinZDCEnergyCutForCentroidValidEvaluation = Monitored::Scalar<bool>("passMinZDCEnergyCutForCentroidValidEvaluation",false);
322 
323  // need to recognize same-side correlation among the following observables
324  // since they are filled differently, it is helpful to store each of their values in the 2-dimension array first
325  // and fill the side monitoring tool in the same "monitoring group"
326  std::array<float, 2> zdcEMModuleEnergyArr = {-1000.,-1000.};
327  std::array<float, 2> zdcEnergySumArr = {-1000,-1000.};
328  std::array<float, 2> zdcUncalibSumArr = {-1000.,-1000.};
329  std::array<float, 2> zdcAvgTimeArr = {-1000.,-1000.};
330  std::array<bool, 2> zdcModuleMaskArr = {false, false};
331  std::array<bool, 2> passTrigOppSideArr = {false, false};
332  std::array<float, 2> rpdAmplitudeCalibSum = {-1000.,-1000.};
333  std::array<float, 2> rpdMaxADCSum = {-1000.,-1000.};
334 
335  std::array<float, m_nRpdCentroidStatusBits> centroidStatusBitsCountCurSide;
336 
337  if (! zdcSums.isValid() ) {
338  ATH_MSG_WARNING("evtStore() does not contain Collection with name "<< m_ZdcSumContainerKey);
339  return StatusCode::SUCCESS;
340  }
341 
346 
347  // write ZDC per-arm information to arrays
348  zdcEnergySumTwoSidesTeV = 0.;
349 
350  if (m_enableZDCPhysics){ // write down energy sum, uncalib sum, average time, and module mask if we enable ZDC physics
351  cur_event_ZDC_available &= ZdcSumCalibEnergyHandle.isAvailable();
352 
353  if (cur_event_ZDC_available){
354  for (const auto zdcSum : *zdcSums) { // side -1: C; side 1: A
355  if (zdcSum->zdcSide() != 0){
356  int iside = (zdcSum->zdcSide() > 0)? 1 : 0;
357 
358  zdcEnergySumArr[iside] = ZdcSumCalibEnergyHandle(*zdcSum);
359  zdcUncalibSumArr[iside] = ZdcSumUncalibSumHandle(*zdcSum);
360  zdcAvgTimeArr[iside] = ZdcSumAverageTimeHandle(*zdcSum);
361  zdcModuleMaskArr[iside] = ZdcSumModuleMaskHandle(*zdcSum);
362 
363  passTrigOppSideArr[iside] = (iside == 0)? passTrigSideA : passTrigSideC;
364 
365  zdcEnergySumTwoSidesTeV += (ZdcSumCalibEnergyHandle(*zdcSum)) / 1000.;
366 
367  if (zdcSum->zdcSide() == 1){
368  zdcEnergySumA = ZdcSumCalibEnergyHandle(*zdcSum);
369  zdcUncalibSumA = ZdcSumUncalibSumHandle(*zdcSum);
370  }
371  else {
372  zdcEnergySumC = ZdcSumCalibEnergyHandle(*zdcSum);
373  zdcUncalibSumC = ZdcSumUncalibSumHandle(*zdcSum);
374  }
375  }
376  } // having filled both sides
377  }
378  } else if (m_enableZDC){ // enable ZDC but not physics - for now, the only case is injector pulse --> no energy, only record uncalib sum
379  cur_event_ZDC_available &= ZdcSumUncalibSumHandle.isAvailable();
380  if (cur_event_ZDC_available){
381  for (const auto zdcSum : *zdcSums) { // side -1: C; side 1: A
382  if (zdcSum->zdcSide() != 0){
383  int iside = (zdcSum->zdcSide() > 0)? 1 : 0;
384  zdcUncalibSumArr[iside] = ZdcSumUncalibSumHandle(*zdcSum);
385  }
386  }
387  }
388  }
389 
390  // write RPD per-arm status to arrays
391  if (m_enableRPDAmp){
393  cur_event_RPD_available &= RPDsideStatusHandle.isAvailable();
394  if (cur_event_RPD_available){
395  for (const auto zdcSum : *zdcSums) { // side -1: C; side 1: A
396  if (zdcSum->zdcSide() != 0){ // contains the RPD Cos Delta reaction plane
397  int iside = (zdcSum->zdcSide() > 0)? 1 : 0;
398  unsigned int rpdStatusCurSide = RPDsideStatusHandle(*zdcSum);
399  rpdSideValidArr.at(iside) = rpdStatusCurSide & 1 << ZDC::RPDDataAnalyzer::ValidBit;
400  }
401  }
402  }
403  }
404 
405  // fill RPD centroid information to monitoring tools
406  if (m_enableCentroid){
414 
415  cur_event_RPDCentroid_available &= RPDcentroidStatusHandle.isAvailable();
416  if (cur_event_RPDCentroid_available){
417  for (const auto zdcSum : *zdcSums) { // side -1: C; side 1: A
418 
419  if (zdcSum->zdcSide() == 0){ // contains the RPD Cos Delta reaction plane
420  rpdCosDeltaReactionPlaneAngle = RPDcosDeltaReactionPlaneAngleHandle(*zdcSum);
421  }else{
422  int iside = (zdcSum->zdcSide() > 0)? 1 : 0; // already exclude the possibility of global sum
423  std::string side_str = (iside == 0)? "C" : "A";
424 
425  rpdSubAmpVecs[iside] = RPDsubAmpHandle(*zdcSum);
426  rpdSubAmpSumCurSide = RPDsubAmpSumHandle(*zdcSum);
427  rpdXCentroidCurSide = RPDxCentroidHandle(*zdcSum);
428  rpdYCentroidCurSide = RPDyCentroidHandle(*zdcSum);
429  rpdReactionPlaneAngleCurSide = RPDreactionPlaneAngleHandle(*zdcSum);
430 
431  unsigned int rpdCentroidStatusCurSide = RPDcentroidStatusHandle(*zdcSum);
432 
433  // Remarks - Oct 2024
434  // HasCentroidBit is false if RPD on the current side is invalid
435  // The centroid ValidBit, compared with Has HasCentroidBit, also checks that ZDC is valid
436  // and has the infrastruture to require (1) ZDC total energy to be in given range
437  // (2) EM-module energy to be in given range
438  // (3) pile up fraction is below a threshold
439  // but these are currently NOT implemented
440  // for online, we only monitor the ones requiring valid bit
441  // for offline, we plot both sets, with the expectation that they are the same for now
442  centroidValid = (rpdCentroidStatusCurSide & 1 << ZDC::RpdSubtractCentroidTool::ValidBit);
443 
444  centroidValidBitFloat = (centroidValid)? 0.5 : 1.5;
445 
446  centroidSideValidArr.at(iside) = rpdCentroidStatusCurSide & 1 << ZDC::RpdSubtractCentroidTool::ValidBit;
447  bool curSideHasCentroid = (rpdCentroidStatusCurSide & 1 << ZDC::RpdSubtractCentroidTool::HasCentroidBit);
448 
449  bothReactionPlaneAngleValid &= centroidValid;
450  bothHasCentroid &= curSideHasCentroid;
451 
452  for (int bit = 0; bit < m_nRpdCentroidStatusBits; bit++) centroidStatusBitsCountCurSide[bit] = 0; // reset
453  for (int bit = 0; bit < m_nRpdCentroidStatusBits; bit++){
454  if (rpdCentroidStatusCurSide & 1 << bit){
455  centroidStatusBitsCountCurSide[bit] += 1;
456  }
457  }
458  auto centroidStatusBits = Monitored::Collection("centroidStatusBits", centroidStatusBitsCountCurSide);
459 
460  if (curSideHasCentroid){ // only impose the looser requirement that this side has centroid; have a set of histograms for the more stringent centroid-valid requirement
461  if (m_enableZDCPhysics){ // if not enable ZDC physics, no ZDC energy --> the boolean requiring minimum ZDC energy will always be set to false
462  passMinZDCEnergyCutForCentroidValidEvaluation = (zdcEnergySumArr[iside] > m_ZDCEnergyCutForCentroidValidBitMonitor);
463  }
464  fill(m_tools[m_ZDCSideToolIndices.at(side_str)], rpdSubAmpSumCurSide, centroidValid, passMinZDCEnergyCutForCentroidValidEvaluation, centroidValidBitFloat, rpdXCentroidCurSide, rpdYCentroidCurSide, rpdReactionPlaneAngleCurSide, centroidStatusBits, lumiBlock, bcid);
465  }else{
466  fill(m_tools[m_ZDCSideToolIndices.at(side_str)], rpdSubAmpSumCurSide, centroidStatusBits, lumiBlock, bcid);
467  }
468  }
469  } // having filled both sides
470  }
471  }
472 
473 // ______________________________________________________________________________
474  // declaring & obtaining variables of interest for the ZDC modules & RPD channels
475  // filling arrays of monitoring tools (module/channel-level)
476  // updating status bits
477 // ______________________________________________________________________________
478 
480 
493 
499 
500  auto zdcModuleAmp = Monitored::Scalar<float>("zdcModuleAmp", -1000.0);
501  auto zdcModuleFitAmp = Monitored::Scalar<float>("zdcModuleFitAmp", -1000.0);
502  auto zdcModuleMaxADC = Monitored::Scalar<float>("zdcModuleMaxADC", -1000.0);
503  auto zdcModuleMaxADCHG = Monitored::Scalar<float>("zdcModuleMaxADCHG", -1000.0);
504  auto zdcModuleMaxADCLG = Monitored::Scalar<float>("zdcModuleMaxADCLG", -1000.0);
505  auto zdcModuleAmpToMaxADCRatio = Monitored::Scalar<float>("zdcModuleAmpToMaxADCRatio", -1000.0);
506  auto zdcModuleFract = Monitored::Scalar<float>("zdcModuleFract", -1000.0);
507  auto zdcUncalibSumCurrentSide = Monitored::Scalar<float>("zdcUncalibSumCurrentSide", -1000.0);
508  auto zdcEnergySumCurrentSide = Monitored::Scalar<float>("zdcEnergySumCurrentSide", -1000.0);
509  auto zdcAbove20NCurrentSide = Monitored::Scalar<bool>("zdcAbove20NCurrentSide", false);
510  auto zdcEnergyAboveModuleFractCut = Monitored::Scalar<bool>("zdcEnergyAboveModuleFractCut", false);
511  auto zdcModuleTime = Monitored::Scalar<float>("zdcModuleTime", -1000.0);
512  auto zdcModuleFitT0 = Monitored::Scalar<float>("zdcModuleFitT0", -1000.0);
513  auto zdcModuleChisq = Monitored::Scalar<float>("zdcModuleChisq", -1000.0);
514  auto zdcModuleChisqEventWeight = Monitored::Scalar<float>("zdcModuleChisqEventWeight", -1000.0);
515  auto zdcModuleChisqOverAmp = Monitored::Scalar<float>("zdcModuleChisqOverAmp", -1000.0);
516  auto zdcModuleChisqOverAmpEventWeight = Monitored::Scalar<float>("zdcModuleChisqOverAmpEventWeight", -1000.0);
517  auto zdcModuleCalibAmp = Monitored::Scalar<float>("zdcModuleCalibAmp", -1000.0);
518  auto zdcModuleCalibTime = Monitored::Scalar<float>("zdcModuleCalibTime", -1000.0);
519  auto zdcModuleLG = Monitored::Scalar<bool>("zdcModuleLG", false);
520  auto zdcModuleHG = Monitored::Scalar<bool>("zdcModuleHG", false);
521  auto injectedPulseInputVoltage = Monitored::Scalar<float>("injectedPulseInputVoltage", -1000.0);
522  auto zdcHGInjPulseValid = Monitored::Scalar<bool>("zdcHGInjPulseValid", true);
523  auto zdcLGInjPulseValid = Monitored::Scalar<bool>("zdcLGInjPulseValid", true);
524 
525  auto zdcModuleFractionValid = Monitored::Scalar<bool>("zdcModuleFractionValid", false);
526  auto zdcModuleTimeValid = Monitored::Scalar<bool>("zdcModuleTimeValid", false);
527  auto zdcModuleHGTimeValid = Monitored::Scalar<bool>("zdcModuleHGTimeValid", false);
528  auto zdcModuleLGTimeValid = Monitored::Scalar<bool>("zdcModuleLGTimeValid", false);
529 
530  auto zdcModuleLGFitAmp = Monitored::Scalar<float>("zdcModuleLGFitAmp", -1000.0);
531  auto zdcModuleFitAmpLGRefit = Monitored::Scalar<float>("zdcModuleFitAmpLGRefit", -1000.0);
532  auto zdcModuleAmpLGRefit = Monitored::Scalar<float>("zdcModuleAmpLGRefit", -1000.0);
533  auto zdcModuleT0LGRefit = Monitored::Scalar<float>("zdcModuleT0LGRefit", -1000.0);
534  auto zdcModuleT0SubLGRefit = Monitored::Scalar<float>("zdcModuleT0SubLGRefit", -1000.0);
535  auto zdcModuleChisqLGRefit = Monitored::Scalar<float>("zdcModuleChisqLGRefit", -1000.0);
536 
537  auto zdcModuleHGtoLGAmpRatio = Monitored::Scalar<float>("zdcModuleHGtoLGAmpRatio", -1000.0);
538  auto zdcModuleHGtoLGAmpRatioNoNonlinCorr = Monitored::Scalar<float>("zdcModuleHGtoLGAmpRatioNoNonlinCorr", -1000.0);
539  auto zdcModuleHGtoLGT0Diff = Monitored::Scalar<float>("zdcModuleHGtoLGT0Diff", -1000.0);
540 
541  auto rpdChannelSubAmp = Monitored::Scalar<float>("RPDChannelSubAmp", -1000.0);
542  auto rpdChannelAmplitude = Monitored::Scalar<float>("RPDChannelAmplitude", -1000.0);
543  auto rpdChannelMaxADC = Monitored::Scalar<float>("RPDChannelMaxADC", -1000.0);
544  auto rpdChannelMaxSample = Monitored::Scalar<unsigned int>("RPDChannelMaxSample", 1000);
545  auto rpdChannelAmplitudeCalib = Monitored::Scalar<float>("RPDChannelAmplitudeCalib", -1000.0);
546  auto rpdChannelStatus = Monitored::Scalar<unsigned int>("RPDChannelStatus", 1000);
547  auto rpdChannelPileupFitSlope = Monitored::Scalar<float>("RPDChannelPileupFitSlope", -1000);
548  auto absRpdChannelAmplitude = Monitored::Scalar<float>("absRPDChannelAmplitude", -1000.); // EM module energy on the same side (assuming filled already)
549  auto rpdChannelValid = Monitored::Scalar<bool>("RPDChannelValid", false);
550  auto rpdChannelValidBitFloat = Monitored::Scalar<float>("RPDChannelValidBitFloat", -1000.0); // 0.5 if valid, 1.5 if invalid --> needed for DQ
551  auto rpdChannelCentroidValid = Monitored::Scalar<bool>("RPDChannelCentroidValid", false);
552  auto rpdChannelPileupFrac = Monitored::Scalar<float>("RPDChannelPileupFrac", -1000.);
553  auto zdcEMModuleEnergySameSide = Monitored::Scalar<float>("zdcEMModuleEnergySameSide", -1000.); // EM module energy on the same side (assuming filled already)
554  auto zdcEnergySumSameSide = Monitored::Scalar<float>("zdcEnergySumSameSide", -1000.); // EM module energy on the same side (assuming filled already)
555 
556  std::array<float, m_nZdcStatusBits> zdcStatusBitsCount;
557  std::array<float, m_nRpdStatusBits> rpdStatusBitsCount;
558 
559  if (! zdcModules.isValid() ) {
560  ATH_MSG_WARNING("evtStore() does not contain Collection with name "<< m_ZdcModuleContainerKey);
561  return StatusCode::SUCCESS;
562  }
563 
565  // Check the event run number agrees with fixed run number
566  if (runNumber != m_runNumber) {
567  ATH_MSG_WARNING("The event run number differs from the fixed run number read from the input-file metadata!");
568  ATH_MSG_WARNING("The event run number is " << runNumber << "; the fixed run number is " << m_runNumber);
569  }
570 
571  injectedPulseInputVoltage = m_zdcInjPulserAmpMap->getPulserAmplitude(m_injMapRunToken, lumiBlock);
572  if (injectedPulseInputVoltage > 0){ // LB > startLB
573  ATH_MSG_DEBUG("Lumi block: " << lumiBlock << "; pulser amplitude: " << injectedPulseInputVoltage);
574  }
575  }
576 
577  // first loop over zdcModules - read ZDC-module information & fill in ZDC histograms
578  // separate ZDC and RPD variable retrieval into two for loops to make sure
579  // essential ZDC information (e.g, the EM module energy and total energy sum on both sides) is properly filled
580  // before they are required in RPD channel monitoring
581  zdcHadronicEnergySumTwoSidesTeV = 0.;
582  if (m_enableZDC){
583  cur_event_ZDC_available &= zdcModuleStatusHandle.isAvailable();
584  if (cur_event_ZDC_available){
585  for (const auto zdcMod : *zdcModules){
586  int iside = (zdcMod->zdcSide() > 0)? 1 : 0;
587  std::string side_str = (iside == 0)? "C" : "A";
588 
589  if (zdcMod->zdcType() == 0){
590  int imod = zdcMod->zdcModule();
591  std::string module_str = std::to_string(imod);
592 
593  int status = zdcModuleStatusHandle(*zdcMod);
594 
595  for (int bit = 0; bit < m_nZdcStatusBits; bit++) zdcStatusBitsCount[bit] = 0; // reset
596  for (int bit = 0; bit < m_nZdcStatusBits; bit++){
597  if (status & 1 << bit){
598  zdcStatusBitsCount[bit] += 1;
599  }
600  }
601 
602  auto zdcStatusBits = Monitored::Collection("zdcStatusBits", zdcStatusBitsCount);
603  fill(m_tools[m_ZDCModuleToolIndices.at(side_str).at(module_str)], zdcStatusBits, lumiBlock, bcid);
604 
605  if ((status & 1 << ZDCPulseAnalyzer::PulseBit) != 0){ // has pulse
606  zdcModuleAmp = zdcModuleAmplitudeHandle(*zdcMod);
607  float zdcModuleAmpNoNonLin = zdcModuleAmpNoNonLinHandle(*zdcMod); // module fit amplitude (without gain factor or nonlinear corrections applied)
608  zdcModuleFitAmp = zdcModuleFitAmpHandle(*zdcMod); // module fit amplitude (without gain factor or nonlinear corrections applied)
609  zdcModuleMaxADC = zdcModuleMaxADCHandle(*zdcMod);
610  zdcModuleMaxADCHG = zdcModuleMaxADCHGHandle(*zdcMod);
611  zdcModuleMaxADCLG = zdcModuleMaxADCLGHandle(*zdcMod);
612  zdcModuleAmpToMaxADCRatio = (zdcModuleMaxADC == 0)? -1000. : zdcModuleAmp / zdcModuleMaxADC;
613  zdcModuleTime = zdcModuleTimeHandle(*zdcMod);
614  zdcModuleFitT0 = zdcModuleFitT0Handle(*zdcMod);
615  zdcModuleChisq = zdcModuleChisqHandle(*zdcMod);
616  zdcModuleCalibAmp = zdcModuleCalibEnergyHandle(*zdcMod);
617  zdcModuleCalibTime = zdcModuleCalibTimeHandle(*zdcMod);
618  zdcUncalibSumCurrentSide = zdcUncalibSumArr[iside];
619  zdcEnergySumCurrentSide = zdcEnergySumArr[iside];
620  zdcAbove20NCurrentSide = (zdcUncalibSumCurrentSide > 20 * m_expected1N);
621  zdcEnergyAboveModuleFractCut = (zdcEnergySumCurrentSide > m_energyCutForModuleFractMonitor);
622 
623  if (m_enableZDCPhysics){
624  zdcModuleFract = (zdcEnergySumCurrentSide == 0)? -1000. : zdcModuleCalibAmp / zdcEnergySumCurrentSide; // use calibrated amplitudes + energy sum
625  }else{
626  zdcModuleFract = (zdcUncalibSumCurrentSide == 0)? -1000. : zdcModuleAmp / zdcUncalibSumCurrentSide; // use uncalibrated amplitudes + amplitude sum
627  }
628 
629  // use fit amplitude for chisq over amplitude: neither fit amplitude nor chisq has gain factor applied
630  zdcModuleChisqOverAmp = (zdcModuleFitAmp == 0)? -1000. : zdcModuleChisq / zdcModuleFitAmp;
631  zdcModuleLG = (status & 1 << ZDCPulseAnalyzer::LowGainBit);
632  zdcModuleHG = !zdcModuleLG;
633 
634  zdcModuleFractionValid = (zdcModuleFract >= 0 && zdcModuleFract <= 1);
635  zdcModuleTimeValid = (zdcModuleTime > -100.);
636  zdcModuleHGTimeValid = zdcModuleHG && zdcModuleTimeValid;
637  zdcModuleLGTimeValid = zdcModuleLG && zdcModuleTimeValid;
638 
639 
640  zdcModuleFitAmpLGRefit = zdcModuleFitAmpLGRefitHandle(*zdcMod);
641  zdcModuleAmpLGRefit = zdcModuleAmpLGRefitHandle(*zdcMod);
642  zdcModuleT0LGRefit = zdcModuleT0LGRefitHandle(*zdcMod);
643  zdcModuleT0SubLGRefit = zdcModuleT0SubLGRefitHandle(*zdcMod);
644  zdcModuleChisqLGRefit = zdcModuleChisqLGRefitHandle(*zdcMod);
645 
646  zdcModuleLGFitAmp = (zdcModuleHG)? zdcModuleFitAmpLGRefit * 1. : zdcModuleFitAmp * 1.;
647 
648  zdcModuleHGtoLGAmpRatio = (zdcModuleLG || zdcModuleAmpLGRefit == 0)? -1000. : zdcModuleAmp * 1. / zdcModuleAmpLGRefit; // HG/LG ratio if HG is valid and LG-refit amplitude is nonzero (shouldn't be)
649  zdcModuleHGtoLGAmpRatioNoNonlinCorr = (zdcModuleLG || zdcModuleAmpLGRefit == 0)? -1000. : zdcModuleAmpNoNonLin * 1. / zdcModuleAmpLGRefit; // HG/LG ratio if HG is valid and LG-refit amplitude is nonzero (shouldn't be)
650  zdcModuleHGtoLGT0Diff = (zdcModuleLG)? -1000. : zdcModuleFitT0 - zdcModuleT0LGRefit;
651 
652  zdcModuleChisqEventWeight = calculate_inverse_bin_width(zdcModuleChisq, "module chisq", m_ZdcModuleChisqBinEdges);
653  zdcModuleChisqOverAmpEventWeight = calculate_inverse_bin_width(zdcModuleChisqOverAmp, "module chisq over amplitude", m_ZdcModuleChisqOverAmpBinEdges);
654 
655  if (imod == 0) zdcEMModuleEnergyArr[iside] = zdcModuleCalibAmp; // EM module energy
656  else zdcHadronicEnergySumTwoSidesTeV += zdcModuleCalibAmp / 1000.; // hadronic module energy
657 
658 
659  // ------------ throw away the first few seconds of each LB ------------
660  // get the start + end time of the event LB from the cool data
661  // copied from Trigger/TrigT1/TrigT1CTMonitoring/src/BSMonitoringAlg.cxx
662  if (!m_isSim && !m_isOnline && m_isInjectedPulse) {
663  uint64_t lb_stime = 0; // LB POSIX start time in seconds
664  uint64_t lb_etime = 0; // LB POSIX end time in seconds
665  bool retrievedLumiBlockTimes = false;
666 
668  const AthenaAttributeList* lblbattrList{*lblb};
669  if (lblbattrList==nullptr) {
670  ATH_MSG_WARNING("Failed to retrieve /TRIGGER/LUMI/LBLB " << m_LBLBFolderInputKey.key() << " not found");
671  }
672  else {
673  retrievedLumiBlockTimes = true;
674  auto lb_stime_loc = (*lblbattrList)["StartTime"].data<cool::UInt63>();
675  auto lb_etime_loc = (*lblbattrList)["EndTime"].data<cool::UInt63>();
676  lb_stime = lb_stime_loc;
677  lb_etime = lb_etime_loc;
678  ATH_MSG_DEBUG("lb_stime: " << lb_stime << " lb_etime: " << lb_etime );
679  }
680 
681  lb_stime /= 1000000000;
682  lb_etime /= 1000000000;
683 
684  if (lb_etime <= lb_stime || !retrievedLumiBlockTimes){
685  ATH_MSG_WARNING("The LB start + end time for current event is not retrieved.");
686  ATH_MSG_WARNING("No event rejection at beginning of LB is implemented.");
687  }else if(eventTime < lb_stime){
688  ATH_MSG_WARNING("Event time is before the start time of the current LB");
689  ATH_MSG_WARNING("Event time: " << eventTime << "; current LB: " << lumiBlock << "; start time of current LB: " << lb_stime);
690  }else if (eventTime > lb_etime){
691  ATH_MSG_WARNING("Event time is after the end time of the current LB");
692  ATH_MSG_WARNING("Event time: " << eventTime << "; current LB: " << lumiBlock << "; end time of current LB: " << lb_etime);
693  }else{ // require event time to be at least X seconds after start time of the current LB
694  zdcHGInjPulseValid &= (eventTime > lb_stime + m_nSecondsRejectStartofLBInjectorPulse);
695  zdcLGInjPulseValid &= (eventTime > lb_stime + m_nSecondsRejectStartofLBInjectorPulse);
696  }
697  }
698 
699  // ------------ impose the rest of HG/LG injector-pulse validity requirements ------------
700 
701  zdcHGInjPulseValid &= zdcModuleHG;
702  zdcHGInjPulseValid &= !(status & 1 << ZDCPulseAnalyzer::ExcludeEarlyLGBit);
703  zdcHGInjPulseValid &= !(status & 1 << ZDCPulseAnalyzer::preExpTailBit);
704  zdcHGInjPulseValid &= !(status & 1 << ZDCPulseAnalyzer::BadChisqBit);
705  zdcHGInjPulseValid &= !(status & 1 << ZDCPulseAnalyzer::FailBit);
706  zdcHGInjPulseValid &= !(status & 1 << ZDCPulseAnalyzer::FitMinAmpBit);
708  zdcHGInjPulseValid &= (zdcModuleAmp > m_minAmpRequiredHGInjectorPulse);
709  }
710  zdcHGInjPulseValid &= (zdcModuleFitT0 >= m_timingCutsInjectorPulse[iside][imod][0] && zdcModuleFitT0 <= m_timingCutsInjectorPulse[iside][imod][1]);
711 
712  zdcLGInjPulseValid &= !(status & 1 << ZDCPulseAnalyzer::LGOverflowBit);
713  zdcLGInjPulseValid &= !(status & 1 << ZDCPulseAnalyzer::ExcludeEarlyLGBit);
714  zdcLGInjPulseValid &= !(status & 1 << ZDCPulseAnalyzer::preExpTailBit);
715  zdcLGInjPulseValid &= !(status & 1 << ZDCPulseAnalyzer::BadChisqBit);
716  zdcLGInjPulseValid &= !(status & 1 << ZDCPulseAnalyzer::FailBit);
717  zdcLGInjPulseValid &= !(status & 1 << ZDCPulseAnalyzer::FitMinAmpBit);
719  zdcLGInjPulseValid &= (zdcModuleLGFitAmp > m_minAmpRequiredLGInjectorPulse);
720  }
721  zdcLGInjPulseValid &= (zdcModuleFitT0 >= m_timingCutsInjectorPulse[iside][imod][0] && zdcModuleFitT0 <= m_timingCutsInjectorPulse[iside][imod][1]);
722 
723  if (m_isInjectedPulse){
724  if (m_isStandalone) injectedPulseInputVoltage = zdcModuleAmp * 1. / 25000.; // no LB in standalone --> fill dummy histograms
725  fill(m_tools[m_ZDCModuleToolIndices.at(side_str).at(module_str)], zdcModuleAmp, zdcModuleFitAmp, zdcModuleMaxADC, zdcModuleMaxADCHG, zdcModuleMaxADCLG, zdcModuleAmpToMaxADCRatio, zdcModuleFract, zdcUncalibSumCurrentSide, zdcEnergySumCurrentSide, zdcModuleTime, zdcModuleFitT0, zdcModuleChisq, zdcModuleChisqOverAmp, zdcModuleChisqEventWeight, zdcModuleChisqOverAmpEventWeight, zdcModuleCalibAmp, zdcModuleCalibTime, zdcModuleLG, zdcModuleHG, zdcModuleAmpLGRefit, zdcModuleT0LGRefit, zdcModuleT0SubLGRefit, zdcModuleChisqLGRefit, zdcModuleLGFitAmp, zdcModuleHGtoLGAmpRatio, zdcModuleHGtoLGAmpRatioNoNonlinCorr, zdcModuleHGtoLGT0Diff, zdcModuleFractionValid, zdcModuleTimeValid, zdcModuleHGTimeValid, zdcModuleLGTimeValid, injectedPulseInputVoltage, zdcHGInjPulseValid, zdcLGInjPulseValid, lumiBlock, bcid);
726  }else{
727  fill(m_tools[m_ZDCModuleToolIndices.at(side_str).at(module_str)], zdcModuleAmp, zdcModuleMaxADC, zdcModuleMaxADCHG, zdcModuleMaxADCLG, zdcModuleAmpToMaxADCRatio, zdcModuleFract, zdcUncalibSumCurrentSide, zdcEnergySumCurrentSide, zdcAbove20NCurrentSide, zdcEnergyAboveModuleFractCut, zdcModuleTime, zdcModuleFitT0, zdcModuleChisq, zdcModuleChisqOverAmp, zdcModuleChisqEventWeight, zdcModuleChisqOverAmpEventWeight, zdcModuleCalibAmp, zdcModuleCalibTime, zdcModuleLG, zdcModuleHG, zdcModuleAmpLGRefit, zdcModuleT0LGRefit, zdcModuleT0SubLGRefit, zdcModuleChisqLGRefit, zdcModuleHGtoLGAmpRatio, zdcModuleHGtoLGAmpRatioNoNonlinCorr, zdcModuleHGtoLGT0Diff, zdcModuleFractionValid, zdcModuleTimeValid, zdcModuleHGTimeValid, zdcModuleLGTimeValid, lumiBlock, bcid);
728  }
729  }
730  }
731  }
732  }
733  }
734 
735 
736  // second loop over zdcModules - read RPD-channel information & fill in RPD histograms
737  // only run if NOT injector pulse
738  if (m_enableRPDAmp){
746 
747  cur_event_RPD_available &= RPDChannelStatusHandle.isAvailable();
748  if (cur_event_RPD_available){
749  for (const auto zdcMod : *zdcModules){
750  int iside = (zdcMod->zdcSide() > 0)? 1 : 0;
751  std::string side_str = (iside == 0)? "C" : "A";
752 
753  if (zdcMod->zdcType() == 1) {
754  // this is the RPD
755 
756  int ichannel = zdcMod->zdcChannel(); // zero-based
757  std::string channel_str = std::to_string(ichannel);
758 
759  int status = RPDChannelStatusHandle(*zdcMod);
760 
761  for (int bit = 0; bit < m_nRpdStatusBits; bit++) rpdStatusBitsCount[bit] = 0; // reset
762  for (int bit = 0; bit < m_nRpdStatusBits; bit++){
763  if (status & 1 << bit){
764  rpdStatusBitsCount[bit] += 1;
765  }
766  }
767 
768  auto rpdStatusBits = Monitored::Collection("RPDStatusBits", rpdStatusBitsCount);
769 
770  rpdChannelSubAmp = rpdSubAmpVecs[iside][ichannel];
771  rpdChannelAmplitude = RPDChannelAmplitudeHandle(*zdcMod);
772  rpdChannelMaxADC = RPDChannelMaxADCHandle(*zdcMod);
773  rpdChannelMaxSample = RPDChannelMaxSampleHandle(*zdcMod);
774  rpdChannelAmplitudeCalib = RPDChannelAmplitudeCalibHandle(*zdcMod);
775  std::vector<float> rpdChannelPileupFitParams = RPDChannelPileupExpFitParamsHandle(*zdcMod);
776  rpdChannelPileupFitSlope = rpdChannelPileupFitParams[1];
777  rpdChannelPileupFrac = RPDChannelPileupFracHandle(*zdcMod);
778 
779  absRpdChannelAmplitude = abs(rpdChannelAmplitude);
780  zdcEMModuleEnergySameSide = zdcEMModuleEnergyArr[iside];
781  zdcEnergySumSameSide = zdcEnergySumArr[iside];
782  bool curRpdChannelValid = status & 1 << ZDC::RPDDataAnalyzer::ValidBit;
783  rpdChannelValid = curRpdChannelValid;
784  rpdChannelValidBitFloat = (curRpdChannelValid)? 0.5 : 1.5;
785  rpdChannelCentroidValid = centroidSideValidArr.at(iside);
786 
787  rpdAmplitudeCalibSum[iside] += rpdChannelAmplitudeCalib;
788  rpdMaxADCSum[iside] += rpdChannelMaxADC;
789 
790  fill(m_tools[m_RPDChannelToolIndices.at(side_str).at(channel_str)], rpdChannelSubAmp, rpdChannelAmplitude, rpdChannelAmplitudeCalib, rpdChannelMaxADC, rpdChannelMaxSample, rpdStatusBits, rpdChannelPileupFitSlope, absRpdChannelAmplitude, rpdChannelPileupFrac, zdcEMModuleEnergySameSide, zdcEnergySumSameSide, rpdChannelValid, rpdChannelValidBitFloat, rpdChannelCentroidValid, lumiBlock, bcid);
791  }
792  }
793  }
794  }
795 
796 
797 // ______________________________________________________________________________
798  // obtaining fCalEt on A,C side
799 // ______________________________________________________________________________
800 
801  auto fcalEtA = Monitored::Scalar<double>("fcalEtA", 0.0);
802  auto fcalEtC = Monitored::Scalar<double>("fcalEtC", 0.0);
803  auto fcalEtSumTwoSides = Monitored::Scalar<double>("fcalEtSumTwoSides", 0.0);
804  std::array<double,2> fcalEtArr = {0.,0.};
805 
808  if (! eventShapes.isValid()) {
809  ATH_MSG_WARNING("evtStore() does not contain Collection with name "<< m_HIEventShapeContainerKey);
810  }
811  else{
812  for (const auto eventShape : *eventShapes){
813  int layer = eventShape->layer();
814  float eta = eventShape->etaMin();
815  float et = eventShape->et();
816  if (layer == 21 || layer == 22 || layer == 23){
817  fcalEtSumTwoSides += et / 1000000.;
818  if (eta > 0){
819  fcalEtA += et / 1000000.;
820  fcalEtArr[1] += et / 1000000.;
821  }
822  if (eta < 0){
823  fcalEtC += et / 1000000.;
824  fcalEtArr[0] += et / 1000000.;
825  }
826  }
827  }
828  }
829 
830  }
831 
832 
833 // ______________________________________________________________________________
834  // give warning if there is missing aux data but no decoding error
835 // ______________________________________________________________________________
836  if (!cur_event_ZDC_available && !zdcDecodingError){
837  ATH_MSG_WARNING("Current event has no ZDC decoding error but ZDC aux data is not available!");
838  }
839  if (!cur_event_RPD_available && !rpdDecodingError){
840  ATH_MSG_WARNING("Current event has no RPD decoding error but RPD aux data is not available!");
841  }
842 // ______________________________________________________________________________
843  // give warning and return if neither ZDC nor RPD are available
844 // ______________________________________________________________________________
845  if (!cur_event_ZDC_available && !cur_event_RPD_available){
846  ATH_MSG_WARNING("For current event, neither ZDC nor RPD data are available!");
847  return StatusCode::SUCCESS;
848  }
849 
850 // ______________________________________________________________________________
851  // filling generic ZDC monitoring tool for A-C side correlations & cos(reaction plane angle)
852 // ______________________________________________________________________________
853 
854  if ((m_enableZDCPhysics && cur_event_ZDC_available) || (m_enableCentroid && cur_event_RPD_available)){
855 
856  if (m_enableZDCPhysics && cur_event_ZDC_available){
857  if (m_CalInfoOn){ // calorimeter information is turned on
858  fill(zdcTool, lumiBlock, bcid, passTrigSideA, passTrigSideC, zdcEnergySumA, zdcEnergySumC, zdcUncalibSumA, zdcUncalibSumC, fcalEtA, fcalEtC);
859  if (m_EnableUCCTriggers){
860  ATH_MSG_DEBUG("zdcEnergySumTwoSidesTeV: " << zdcEnergySumTwoSidesTeV << "; fcalEtSumTwoSides: " << fcalEtSumTwoSides);
861  fill(zdcTool, lumiBlock, bcid, zdcEnergySumTwoSidesTeV, zdcHadronicEnergySumTwoSidesTeV, fcalEtSumTwoSides, passUCCTrig_HELT15, passUCCTrig_HELT20, passUCCTrig_HELT25, passUCCTrig_HELT35, passUCCTrig_HELT50);
862  }else{
863  fill(zdcTool, lumiBlock, bcid, zdcEnergySumTwoSidesTeV, zdcHadronicEnergySumTwoSidesTeV, fcalEtSumTwoSides);
864  }
865  } else{
866  fill(zdcTool, lumiBlock, bcid, passTrigSideA, passTrigSideC, zdcEnergySumA, zdcEnergySumC, zdcUncalibSumA, zdcUncalibSumC);
867  }
868  }
869 
870  if (m_enableCentroid && cur_event_RPD_available){
871  fill(zdcTool, rpdCosDeltaReactionPlaneAngle, bothReactionPlaneAngleValid, bothHasCentroid);
872  }
873  }
874 
875 // ______________________________________________________________________________
876  // filling per-side tools
877 // ______________________________________________________________________________
878 
879 
880  if (m_enableZDCPhysics && cur_event_ZDC_available && m_enableRPDAmp && cur_event_RPD_available){
881  for (int iside = 0; iside < m_nSides; iside++){
882  std::string side_str = (iside == 0)? "C" : "A";
883 
884  auto passTrigOppSide = Monitored::Scalar<bool>("passTrigOppSide",passTrigOppSideArr[iside]); // this is duplicate information as A,C but convenient for filling per-side histograms
885  auto zdcEnergySumCurSide = Monitored::Scalar<float>("zdcEnergySum",zdcEnergySumArr[iside]); // this is duplicate information as A,C but convenient for filling per-side histograms
886  auto zdcEnergySumCurSideTeV = Monitored::Scalar<float>("zdcEnergySumTeV",zdcEnergySumArr[iside]/1000.); // this is duplicate information as A,C but convenient for filling per-side histograms
887  auto zdcUncalibSumCurSide = Monitored::Scalar<float>("zdcUncalibSum",zdcUncalibSumArr[iside]); // this is duplicate information as A,C but convenient for filling per-side histograms
888  auto zdcEMModuleEnergyCurSide = Monitored::Scalar<float>("zdcEMModuleEnergy",zdcEMModuleEnergyArr[iside]);
889  auto zdcAvgTimeCurSide = Monitored::Scalar<float>("zdcAvgTime",zdcAvgTimeArr[iside]);
890  auto zdcModuleMaskCurSide = Monitored::Scalar<bool>("zdcModuleMask",zdcModuleMaskArr[iside]);
891 
892  auto fcalEtCurSide = Monitored::Scalar<float>("fCalEt",fcalEtArr[iside]);
893 
894  ATH_MSG_DEBUG("fcalEtCurSide: " << fcalEtCurSide);
895  auto rpdAmplitudeCalibSumCurSide = Monitored::Scalar<float>("rpdAmplitudeCalibSum",rpdAmplitudeCalibSum[iside]);
896  auto rpdMaxADCSumCurSide = Monitored::Scalar<float>("rpdMaxADCSum",rpdMaxADCSum[iside]);
897  auto rpdCurSideValid = Monitored::Scalar<bool>("RPDSideValid",rpdSideValidArr[iside]);
898 
899  fill(m_tools[m_ZDCSideToolIndices.at(side_str)], passTrigOppSide, zdcEnergySumCurSide, zdcEnergySumCurSideTeV, zdcUncalibSumCurSide, zdcEMModuleEnergyCurSide, zdcAvgTimeCurSide, zdcModuleMaskCurSide, rpdAmplitudeCalibSumCurSide, rpdMaxADCSumCurSide, rpdCurSideValid, fcalEtCurSide, lumiBlock, bcid);
900  }
901  }else if (m_enableZDCPhysics && cur_event_ZDC_available){
902  for (int iside = 0; iside < m_nSides; iside++){
903  std::string side_str = (iside == 0)? "C" : "A";
904 
905  auto passTrigOppSide = Monitored::Scalar<bool>("passTrigOppSide",passTrigOppSideArr[iside]); // this is duplicate information as A,C but convenient for filling per-side histograms
906  auto zdcEnergySumCurSide = Monitored::Scalar<float>("zdcEnergySum",zdcEnergySumArr[iside]); // this is duplicate information as A,C but convenient for filling per-side histograms
907  auto zdcEnergySumCurSideTeV = Monitored::Scalar<float>("zdcEnergySum",zdcEnergySumArr[iside]/1000.); // this is duplicate information as A,C but convenient for filling per-side histograms
908  auto zdcUncalibSumCurSide = Monitored::Scalar<float>("zdcUncalibSum",zdcUncalibSumArr[iside]); // this is duplicate information as A,C but convenient for filling per-side histograms
909  auto zdcEMModuleEnergyCurSide = Monitored::Scalar<float>("zdcEMModuleEnergy",zdcEMModuleEnergyArr[iside]);
910  auto zdcAvgTimeCurSide = Monitored::Scalar<float>("zdcAvgTime",zdcAvgTimeArr[iside]);
911  auto zdcModuleMaskCurSide = Monitored::Scalar<bool>("zdcModuleMask",zdcModuleMaskArr[iside]);
912  auto fcalEtCurSide = Monitored::Scalar<float>("fCalEt",fcalEtArr[iside]);
913 
914  fill(m_tools[m_ZDCSideToolIndices.at(side_str)], passTrigOppSide, zdcEnergySumCurSide, zdcEnergySumCurSideTeV, zdcUncalibSumCurSide, zdcEMModuleEnergyCurSide, zdcAvgTimeCurSide, zdcModuleMaskCurSide, fcalEtCurSide, lumiBlock, bcid);
915  }
916  }else if (m_enableRPDAmp && cur_event_RPD_available){
917  for (int iside = 0; iside < m_nSides; iside++){
918  std::string side_str = (iside == 0)? "C" : "A";
919 
920  auto rpdAmplitudeCalibSumCurSide = Monitored::Scalar<float>("rpdAmplitudeCalibSum",rpdAmplitudeCalibSum[iside]);
921  auto rpdMaxADCSumCurSide = Monitored::Scalar<float>("rpdMaxADCSum",rpdMaxADCSum[iside]);
922  auto rpdCurSideValid = Monitored::Scalar<bool>("RPDSideValid",rpdSideValidArr[iside]);
923 
924  fill(m_tools[m_ZDCSideToolIndices.at(side_str)], rpdAmplitudeCalibSumCurSide, rpdMaxADCSumCurSide, rpdCurSideValid, lumiBlock, bcid);
925  }
926  }
927 
928  return StatusCode::SUCCESS;
929 }
930 
931 
932 StatusCode ZdcMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const {
933 
934  ATH_MSG_DEBUG("calling the fillHistograms function");
935 
937  if (! eventInfo.isValid() ) {
938  ATH_MSG_WARNING("cannot retrieve event info from evtStore()!");
939  return StatusCode::SUCCESS;
940  }
941 
942  unsigned int eventType = ZdcEventInfo::ZdcEventUnknown;
943  unsigned int DAQMode = ZdcEventInfo::DAQModeUndef;
944 
947 
949 
950  if (! zdcSums.isValid() ) {
951  ATH_MSG_WARNING("evtStore() does not contain Collection with name "<< m_ZdcSumContainerKey);
952  return StatusCode::SUCCESS;
953  }
954  for (const auto zdcSum : *zdcSums) {
955  if (zdcSum->zdcSide() == 0){
956  if (!eventTypeHandle.isAvailable()){
957  ATH_MSG_WARNING("The global sum entry in zdc sum container can be retrieved; but it does NOT have the variable eventType written as a decoration!");
958  return StatusCode::SUCCESS;
959  }
960 
961  if (!DAQModeHandle.isAvailable()){
962  ATH_MSG_WARNING("The global sum entry in zdc sum container can be retrieved; but it does NOT have the variable DAQMode written as a decoration!");
963  return StatusCode::SUCCESS;
964  }
965 
966  eventType = eventTypeHandle(*zdcSum);
967  DAQMode = DAQModeHandle(*zdcSum);
968  }
969  }
970 
971  ATH_MSG_DEBUG("The event type is: " << eventType);
972 
974  ATH_MSG_WARNING("The zdc sum container can be retrieved from the evtStore() but");
975  ATH_MSG_WARNING("Either the event type or the DAQ mode is the default unknown value");
976  ATH_MSG_WARNING("Most likely, there is no global sum (side == 0) entry in the zdc sum container");
977  return StatusCode::SUCCESS;
978  }
979 
980  if (eventType == ZdcEventInfo::ZdcEventPhysics || eventType == ZdcEventInfo::ZdcSimulation){
981  return fillPhysicsDataHistograms(ctx);
982  }
983 
984  ATH_MSG_WARNING("Event type should be PhysicsData/Simulation but it is NOT");
985  return StatusCode::SUCCESS;
986 }
987 
ZdcMonitorAlgorithm::fillPhysicsDataHistograms
StatusCode fillPhysicsDataHistograms(const EventContext &ctx) const
Definition: ZdcMonitorAlgorithm.cxx:189
ZDCPulseAnalyzer::FitMinAmpBit
@ FitMinAmpBit
Definition: ZDCPulseAnalyzer.h:46
ZdcMonitorAlgorithm::m_nSecondsRejectStartofLBInjectorPulse
Gaudi::Property< unsigned int > m_nSecondsRejectStartofLBInjectorPulse
Definition: ZdcMonitorAlgorithm.h:85
ZdcEventInfo::ZdcEventPhysics
@ ZdcEventPhysics
Definition: ZdcEventInfo.h:16
ZdcMonitorAlgorithm::m_ZdcSumAverageTimeKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcSumAverageTimeKey
Definition: ZdcMonitorAlgorithm.h:146
et
Extra patterns decribing particle interation process.
ZdcMonitorAlgorithm::m_ZdcModuleChisqKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleChisqKey
Definition: ZdcMonitorAlgorithm.h:157
ZdcMonitorAlgorithm::m_ZDCEnergyCutForCentroidValidBitMonitor
Gaudi::Property< float > m_ZDCEnergyCutForCentroidValidBitMonitor
Definition: ZdcMonitorAlgorithm.h:64
ZdcMonitorAlgorithm::m_minAmpRequiredLGInjectorPulse
Gaudi::Property< float > m_minAmpRequiredLGInjectorPulse
Definition: ZdcMonitorAlgorithm.h:87
ZdcMonitorAlgorithm::UCCTrigDisabledBit
@ UCCTrigDisabledBit
Definition: ZdcMonitorAlgorithm.h:41
ZdcMonitorAlgorithm::TrigHELT35Bit
@ TrigHELT35Bit
Definition: ZdcMonitorAlgorithm.h:37
ZdcMonitorAlgorithm::m_moduleChisqHistMaxvalue
Gaudi::Property< float > m_moduleChisqHistMaxvalue
Definition: ZdcMonitorAlgorithm.h:67
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ZdcMonitorAlgorithm::m_RPDChannelToolIndices
std::map< std::string, std::map< std::string, int > > m_RPDChannelToolIndices
Definition: ZdcMonitorAlgorithm.h:106
ZdcMonitorAlgorithm::m_nRpdStatusBits
static const int m_nRpdStatusBits
Definition: ZdcMonitorAlgorithm.h:100
ZdcMonitorAlgorithm::m_RPDSideStatusKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_RPDSideStatusKey
Definition: ZdcMonitorAlgorithm.h:207
ZdcMonitorAlgorithm::m_UCCtriggerHELT35
Gaudi::Property< std::string > m_UCCtriggerHELT35
Definition: ZdcMonitorAlgorithm.h:81
ZdcMonitorAlgorithm::m_ZdcSumUncalibSumKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcSumUncalibSumKey
Definition: ZdcMonitorAlgorithm.h:147
ZdcMonitorAlgorithm::m_ZdcModuleT0SubLGRefitKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleT0SubLGRefitKey
Definition: ZdcMonitorAlgorithm.h:168
ZdcMonitorAlgorithm::fillHistograms
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Definition: ZdcMonitorAlgorithm.cxx:932
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
ZdcMonitorAlgorithm::m_RPDChannelPileupFracKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_RPDChannelPileupFracKey
Definition: ZdcMonitorAlgorithm.h:182
ZDCPulseAnalyzer.h
RPDUtils::sides
constexpr std::initializer_list< unsigned int > sides
Definition: RPDUtils.h:17
ZdcMonitorAlgorithm::m_ZdcModuleMaxADCHGKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleMaxADCHGKey
Definition: ZdcMonitorAlgorithm.h:161
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
CheckAppliedSFs.bin_width
bin_width
Definition: CheckAppliedSFs.py:242
ZdcMonitorAlgorithm::m_RPDyCentroidKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_RPDyCentroidKey
Definition: ZdcMonitorAlgorithm.h:194
ZdcMonitorAlgorithm.h
AthMonitorAlgorithm::m_EventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_EventInfoKey
Key for retrieving EventInfo from StoreGate.
Definition: AthMonitorAlgorithm.h:362
ZdcMonitorAlgorithm::m_RPDChannelAmplitudeCalibKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_RPDChannelAmplitudeCalibKey
Definition: ZdcMonitorAlgorithm.h:173
AthMonitorAlgorithm::getTrigDecisionTool
const ToolHandle< Trig::TrigDecisionTool > & getTrigDecisionTool() const
Get the trigger decision tool member.
Definition: AthMonitorAlgorithm.cxx:189
ZdcMonitorAlgorithm::m_ZdcModuleContainerKey
SG::ReadHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleContainerKey
Definition: ZdcMonitorAlgorithm.h:135
ZdcMonitorAlgorithm::TrigHELT50Bit
@ TrigHELT50Bit
Definition: ZdcMonitorAlgorithm.h:36
ZdcMonitorAlgorithm::m_ZdcModuleFitT0Key
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleFitT0Key
Definition: ZdcMonitorAlgorithm.h:156
ZdcEventInfo::ZdcEventUnknown
@ ZdcEventUnknown
Definition: ZdcEventInfo.h:16
ZdcMonitorAlgorithm::m_isOnline
Gaudi::Property< bool > m_isOnline
Definition: ZdcMonitorAlgorithm.h:118
ZdcMonitorAlgorithm::m_ZdcModuleChisqLGRefitKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleChisqLGRefitKey
Definition: ZdcMonitorAlgorithm.h:169
ZdcMonitorAlgorithm::m_isSim
Gaudi::Property< bool > m_isSim
Definition: ZdcMonitorAlgorithm.h:119
ZDC::RPDDataAnalyzer::ValidBit
@ ValidBit
Definition: RPDDataAnalyzer.h:40
ZDCPulseAnalyzer::LGOverflowBit
@ LGOverflowBit
Definition: ZDCPulseAnalyzer.h:33
ZdcMonitorAlgorithm::TrigHELT25Bit
@ TrigHELT25Bit
Definition: ZdcMonitorAlgorithm.h:38
ZdcMonitorAlgorithm::m_ZdcModuleAmpNoNonLinKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleAmpNoNonLinKey
Definition: ZdcMonitorAlgorithm.h:154
ZdcMonitorAlgorithm::m_moduleChisqHistMinValue
Gaudi::Property< float > m_moduleChisqHistMinValue
Definition: ZdcMonitorAlgorithm.h:66
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
ZdcEventInfo::DAQMode
DAQMode
Definition: ZdcEventInfo.h:17
ZDCPulseAnalyzer::PulseBit
@ PulseBit
Definition: ZDCPulseAnalyzer.h:26
ZdcMonitorAlgorithm::m_ZdcModuleAmpLGRefitKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleAmpLGRefitKey
Definition: ZdcMonitorAlgorithm.h:166
ZdcMonitorAlgorithm::m_nSides
static const int m_nSides
Definition: ZdcMonitorAlgorithm.h:94
ZdcMonitorAlgorithm::m_enableCentroid
Gaudi::Property< bool > m_enableCentroid
Definition: ZdcMonitorAlgorithm.h:130
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
compute_lumi.lblb
lblb
Definition: compute_lumi.py:45
ZdcMonitorAlgorithm::m_ZdcModuleFitAmpKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleFitAmpKey
Definition: ZdcMonitorAlgorithm.h:155
dq_defect_copy_defect_database.channels
def channels
Definition: dq_defect_copy_defect_database.py:56
ZdcMonitorAlgorithm::m_ZdcModuleChisqOverAmpBinEdges
std::vector< float > m_ZdcModuleChisqOverAmpBinEdges
Definition: ZdcMonitorAlgorithm.h:109
Monitored::Collection
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Definition: MonitoredCollection.h:38
ZdcMonitorAlgorithm::m_triggerSideA
Gaudi::Property< std::string > m_triggerSideA
Definition: ZdcMonitorAlgorithm.h:74
ZdcMonitorAlgorithm::m_RPDChannelMaxADCKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_RPDChannelMaxADCKey
Definition: ZdcMonitorAlgorithm.h:174
ZdcMonitorAlgorithm::m_ZdcModuleCalibTimeKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleCalibTimeKey
Definition: ZdcMonitorAlgorithm.h:159
ZdcMonitorAlgorithm::m_UCCtriggerHELT50
Gaudi::Property< std::string > m_UCCtriggerHELT50
Definition: ZdcMonitorAlgorithm.h:82
AthMonitorAlgorithm
Base class for Athena Monitoring Algorithms.
Definition: AthMonitorAlgorithm.h:36
ZdcMonitorAlgorithm::m_triggerSideC
Gaudi::Property< std::string > m_triggerSideC
Definition: ZdcMonitorAlgorithm.h:75
ZdcMonitorAlgorithm::m_zdcInjPulserAmpMap
std::shared_ptr< ZdcInjPulserAmpMap > m_zdcInjPulserAmpMap
Definition: ZdcMonitorAlgorithm.h:111
ZdcMonitorAlgorithm::m_expected1N
Gaudi::Property< float > m_expected1N
Definition: ZdcMonitorAlgorithm.h:61
ZdcMonitorAlgorithm::m_HIEventShapeContainerKey
SG::ReadHandleKey< xAOD::HIEventShapeContainer > m_HIEventShapeContainerKey
Definition: ZdcMonitorAlgorithm.h:136
ZdcMonitorAlgorithm::m_moduleChisqOverAmpHistMaxvalue
Gaudi::Property< float > m_moduleChisqOverAmpHistMaxvalue
Definition: ZdcMonitorAlgorithm.h:70
ZdcMonitorAlgorithm::m_RPDSubtrAmpSumKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_RPDSubtrAmpSumKey
Definition: ZdcMonitorAlgorithm.h:188
ZdcInjPulserAmpMap::Token::isValid
bool isValid() const
Definition: ZdcInjPulserAmpMap.h:48
ZdcMonitorAlgorithm::m_ZdcModuleStatusKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleStatusKey
Definition: ZdcMonitorAlgorithm.h:151
ZdcMonitorAlgorithm::m_RPDxCentroidKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_RPDxCentroidKey
Definition: ZdcMonitorAlgorithm.h:191
ZdcMonitorAlgorithm::m_DAQModeKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_DAQModeKey
Definition: ZdcMonitorAlgorithm.h:142
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ZdcMonitorAlgorithm::m_ZdcSumModuleMaskKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcSumModuleMaskKey
Definition: ZdcMonitorAlgorithm.h:148
ZdcMonitorAlgorithm::m_EnableZDCSingleSideTriggers
Gaudi::Property< bool > m_EnableZDCSingleSideTriggers
Definition: ZdcMonitorAlgorithm.h:121
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:94
ZdcEventInfo::ZDCDECODINGERROR
@ ZDCDECODINGERROR
Definition: ZdcEventInfo.h:19
ZdcMonitorAlgorithm::m_CalInfoOn
Gaudi::Property< bool > m_CalInfoOn
Definition: ZdcMonitorAlgorithm.h:120
ZdcMonitorAlgorithm::m_RPDChannelStatusKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_RPDChannelStatusKey
Definition: ZdcMonitorAlgorithm.h:176
lumiFormat.i
int i
Definition: lumiFormat.py:85
Monitored
Generic monitoring tool for athena components.
Definition: GenericMonitoringTool.h:30
ZdcMonitorAlgorithm::m_RPDChannelSubtrAmpKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_RPDChannelSubtrAmpKey
Definition: ZdcMonitorAlgorithm.h:185
ZdcMonitorAlgorithm::m_ZdcModuleMaxADCLGKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleMaxADCLGKey
Definition: ZdcMonitorAlgorithm.h:162
ZdcMonitorAlgorithm::UCCTrigEnabledBit
@ UCCTrigEnabledBit
Definition: ZdcMonitorAlgorithm.h:35
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ZdcMonitorAlgorithm::m_RPDChannelMaxSampleKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_RPDChannelMaxSampleKey
Definition: ZdcMonitorAlgorithm.h:175
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
ZdcEventInfo::ZdcSimulation
@ ZdcSimulation
Definition: ZdcEventInfo.h:16
ZdcMonitorAlgorithm::m_injMapRunToken
ZdcInjPulserAmpMap::Token m_injMapRunToken
Definition: ZdcMonitorAlgorithm.h:55
ZdcMonitorAlgorithm::m_enableZDC
Gaudi::Property< bool > m_enableZDC
Definition: ZdcMonitorAlgorithm.h:126
ZdcMonitorAlgorithm::~ZdcMonitorAlgorithm
virtual ~ZdcMonitorAlgorithm()
Definition: ZdcMonitorAlgorithm.cxx:16
ZdcMonitorAlgorithm::m_RPDChannelAmplitudeKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_RPDChannelAmplitudeKey
Definition: ZdcMonitorAlgorithm.h:172
ZDC::RpdSubtractCentroidTool::ValidBit
@ ValidBit
Definition: RpdSubtractCentroidTool.h:32
ZDCPulseAnalyzer::LowGainBit
@ LowGainBit
Definition: ZDCPulseAnalyzer.h:27
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
Definition: PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:45
ZdcMonitorAlgorithm::m_isStandalone
Gaudi::Property< bool > m_isStandalone
Definition: ZdcMonitorAlgorithm.h:125
ZdcMonitorAlgorithm::m_ZdcModuleCalibEnergyKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleCalibEnergyKey
Definition: ZdcMonitorAlgorithm.h:158
ZdcMonitorAlgorithm::m_minVInjToImposeAmpRequirementLGInjectorPulse
Gaudi::Property< float > m_minVInjToImposeAmpRequirementLGInjectorPulse
Definition: ZdcMonitorAlgorithm.h:89
AthMonitorAlgorithm::fill
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable >> &&variables) const
Fills a vector of variables to a group by reference.
ZdcMonitorAlgorithm::m_RPDChannelPileupExpFitParamsKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_RPDChannelPileupExpFitParamsKey
Definition: ZdcMonitorAlgorithm.h:179
ZdcMonitorAlgorithm::m_ZdcSumContainerKey
SG::ReadHandleKey< xAOD::ZdcModuleContainer > m_ZdcSumContainerKey
Definition: ZdcMonitorAlgorithm.h:134
ZdcMonitorAlgorithm::m_nRpdCentroidStatusBits
static const int m_nRpdCentroidStatusBits
Definition: ZdcMonitorAlgorithm.h:101
xAOD::EventInfo_v1::lumiBlock
uint32_t lumiBlock() const
The current event's luminosity block number.
xAOD::EventInfo_v1::ForwardDet
@ ForwardDet
The forward detectors.
Definition: EventInfo_v1.h:338
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ZdcMonitorAlgorithm::m_enableRPDAmp
Gaudi::Property< bool > m_enableRPDAmp
Definition: ZdcMonitorAlgorithm.h:129
ZdcMonitorAlgorithm::m_minVInjToImposeAmpRequirementHGInjectorPulse
Gaudi::Property< float > m_minVInjToImposeAmpRequirementHGInjectorPulse
Definition: ZdcMonitorAlgorithm.h:88
ZDCPulseAnalyzer::BadChisqBit
@ BadChisqBit
Definition: ZDCPulseAnalyzer.h:39
AthMonitorAlgorithm::m_tools
ToolHandleArray< GenericMonitoringTool > m_tools
Array of Generic Monitoring Tools.
Definition: AthMonitorAlgorithm.h:338
ZdcMonitorAlgorithm::m_ZDCSideToolIndices
std::map< std::string, int > m_ZDCSideToolIndices
Definition: ZdcMonitorAlgorithm.h:104
ZdcMonitorAlgorithm::m_ZdcModuleFitAmpLGRefitKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleFitAmpLGRefitKey
Definition: ZdcMonitorAlgorithm.h:165
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
ZdcMonitorAlgorithm::m_ZDCModuleToolIndices
std::map< std::string, std::map< std::string, int > > m_ZDCModuleToolIndices
Definition: ZdcMonitorAlgorithm.h:105
RPDDataAnalyzer.h
ZdcMonitorAlgorithm::m_ZdcModuleT0LGRefitKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleT0LGRefitKey
Definition: ZdcMonitorAlgorithm.h:167
ZdcMonitorAlgorithm::m_eventTypeKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_eventTypeKey
Definition: ZdcMonitorAlgorithm.h:140
ZdcMonitorAlgorithm::m_ZdcModuleTimeKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleTimeKey
Definition: ZdcMonitorAlgorithm.h:153
ZdcMonitorAlgorithm::m_timingCutsInjectorPulse
float m_timingCutsInjectorPulse[2][4][2]
Definition: ZdcMonitorAlgorithm.h:84
ZdcEventInfo::DAQModeUndef
@ DAQModeUndef
Definition: ZdcEventInfo.h:17
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: AthMonitorAlgorithm.cxx:18
ZdcMonitorAlgorithm::m_ZdcModuleMaxADCKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleMaxADCKey
Definition: ZdcMonitorAlgorithm.h:160
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
ZdcMonitorAlgorithm::m_EnableUCCTriggers
Gaudi::Property< bool > m_EnableUCCTriggers
Definition: ZdcMonitorAlgorithm.h:122
ZdcMonitorAlgorithm::TrigHELT15Bit
@ TrigHELT15Bit
Definition: ZdcMonitorAlgorithm.h:40
ZdcMonitorAlgorithm::ZdcMonitorAlgorithm
ZdcMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Definition: ZdcMonitorAlgorithm.cxx:10
SCT_ConditionsAlgorithms::CoveritySafe::getenv
std::string getenv(const std::string &variableName)
get an environment variable
Definition: SCT_ConditionsUtilities.cxx:17
ZdcMonitorAlgorithm::m_ZdcModuleAmplitudeKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleAmplitudeKey
Definition: ZdcMonitorAlgorithm.h:152
ZdcMonitorAlgorithm::calculate_inverse_bin_width
float calculate_inverse_bin_width(float event_value, const std::string &variable_name, const std::vector< float > &bin_edges) const
Definition: ZdcMonitorAlgorithm.cxx:38
ZdcMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: ZdcMonitorAlgorithm.cxx:74
ZdcMonitorAlgorithm::m_LBLBFolderInputKey
SG::ReadCondHandleKey< AthenaAttributeList > m_LBLBFolderInputKey
Definition: ZdcMonitorAlgorithm.h:138
ZdcMonitorAlgorithm::m_UCCtriggerHELT15
Gaudi::Property< std::string > m_UCCtriggerHELT15
Definition: ZdcMonitorAlgorithm.h:78
ZdcMonitorAlgorithm::m_UCCtriggerHELT20
Gaudi::Property< std::string > m_UCCtriggerHELT20
Definition: ZdcMonitorAlgorithm.h:79
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
ZdcMonitorAlgorithm::m_moduleChisqHistNumBins
Gaudi::Property< float > m_moduleChisqHistNumBins
Definition: ZdcMonitorAlgorithm.h:68
ZdcMonitorAlgorithm::m_moduleChisqOverAmpHistMinValue
Gaudi::Property< float > m_moduleChisqOverAmpHistMinValue
Definition: ZdcMonitorAlgorithm.h:69
ZdcMonitorAlgorithm::m_moduleChisqOverAmpHistNumBins
Gaudi::Property< float > m_moduleChisqOverAmpHistNumBins
Definition: ZdcMonitorAlgorithm.h:71
ZdcMonitorAlgorithm::m_ZdcModuleChisqBinEdges
std::vector< float > m_ZdcModuleChisqBinEdges
Definition: ZdcMonitorAlgorithm.h:108
ZdcMonitorAlgorithm::m_RPDreactionPlaneAngleKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_RPDreactionPlaneAngleKey
Definition: ZdcMonitorAlgorithm.h:198
ZdcMonitorAlgorithm::m_isInjectedPulse
Gaudi::Property< bool > m_isInjectedPulse
Definition: ZdcMonitorAlgorithm.h:124
xAOD::EventInfo_v1::timeStamp
uint32_t timeStamp() const
POSIX time in seconds from 1970. January 1st.
LArCellBinning.step
step
Definition: LArCellBinning.py:158
xAOD::EventInfo_v1::isEventFlagBitSet
bool isEventFlagBitSet(EventFlagSubDet subDet, size_t bit) const
Check one particular bit of one particular sub-detector.
Definition: EventInfo_v1.cxx:703
merge.status
status
Definition: merge.py:17
ZdcMonitorAlgorithm::m_runNumber
Gaudi::Property< unsigned int > m_runNumber
Definition: ZdcMonitorAlgorithm.h:54
ZdcMonitorAlgorithm::calculate_log_bin_edges
void calculate_log_bin_edges(float min_value, float max_value, int num_bins, std::vector< float > &bin_edges)
Definition: ZdcMonitorAlgorithm.cxx:19
ZDCPulseAnalyzer::FailBit
@ FailBit
Definition: ZDCPulseAnalyzer.h:28
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
ZDCPulseAnalyzer::preExpTailBit
@ preExpTailBit
Definition: ZDCPulseAnalyzer.h:44
ZdcMonitorAlgorithm::TrigHELT20Bit
@ TrigHELT20Bit
Definition: ZdcMonitorAlgorithm.h:39
xAOD::EventInfo_v1::bcid
uint32_t bcid() const
The bunch crossing ID of the event.
xAOD::lumiBlock
setTeId lumiBlock
Definition: L2StandAloneMuon_v1.cxx:327
ZDC::RpdSubtractCentroidTool::HasCentroidBit
@ HasCentroidBit
Definition: RpdSubtractCentroidTool.h:33
ZdcMonitorAlgorithm::m_minAmpRequiredHGInjectorPulse
Gaudi::Property< float > m_minAmpRequiredHGInjectorPulse
Definition: ZdcMonitorAlgorithm.h:86
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
SG::ReadDecorHandle::isAvailable
bool isAvailable()
Test to see if this variable exists in the store, for the referenced object.
RpdSubtractCentroidTool.h
ZdcMonitorAlgorithm::m_RPDcosDeltaReactionPlaneAngleKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_RPDcosDeltaReactionPlaneAngleKey
Definition: ZdcMonitorAlgorithm.h:201
ZdcMonitorAlgorithm::m_ZdcSumCalibEnergyKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcSumCalibEnergyKey
Definition: ZdcMonitorAlgorithm.h:145
ZdcMonitorAlgorithm::m_UCCtriggerHELT25
Gaudi::Property< std::string > m_UCCtriggerHELT25
Definition: ZdcMonitorAlgorithm.h:80
ZDCPulseAnalyzer::ExcludeEarlyLGBit
@ ExcludeEarlyLGBit
Definition: ZDCPulseAnalyzer.h:42
AthMonitorAlgorithm::getGroup
const ToolHandle< GenericMonitoringTool > & getGroup(const std::string &name) const
Get a specific monitoring tool from the tool handle array.
Definition: AthMonitorAlgorithm.cxx:164
ZdcMonitorAlgorithm::m_enableZDCPhysics
Gaudi::Property< bool > m_enableZDCPhysics
Definition: ZdcMonitorAlgorithm.h:127
ZdcEventInfo::RPDDECODINGERROR
@ RPDDECODINGERROR
Definition: ZdcEventInfo.h:19
ZdcMonitorAlgorithm::m_RPDcentroidStatusKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_RPDcentroidStatusKey
Definition: ZdcMonitorAlgorithm.h:204
ZdcMonitorAlgorithm::m_nZdcStatusBits
static const int m_nZdcStatusBits
Definition: ZdcMonitorAlgorithm.h:99
ZdcMonitorAlgorithm::m_energyCutForModuleFractMonitor
Gaudi::Property< float > m_energyCutForModuleFractMonitor
Definition: ZdcMonitorAlgorithm.h:63