ATLAS Offline Software
Loading...
Searching...
No Matches
FwdZDCMonitoringAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8
9FwdZDCMonitoringAlg::FwdZDCMonitoringAlg(const std::string &name, ISvcLocator *pSvcLocator)
10 : AthMonitorAlgorithm(name, pSvcLocator) {}
11
13
22
23StatusCode FwdZDCMonitoringAlg::fillHistograms(const EventContext &context) const
24{
25 const auto &trigDecTool = getTrigDecisionTool();
26
28 // access ZDC modules
30 // access ZDC aux data
32
33 if (!zdcModules.isValid())
34 {
35 ATH_MSG_DEBUG("evtStore() does not contain Zdc Collection with name " << m_zdcModuleContainerKey << ", is the Zdc present in this sample?");
36 return StatusCode::SUCCESS;
37 }
38 if (eventInfo->isEventFlagBitSet(xAOD::EventInfo::ForwardDet, ZdcEventInfo::DECODINGERROR )){
39 ATH_MSG_WARNING("Error in LUCROD decoding, cannot write monitoring histograms. Skipping this event");
40 return StatusCode::SUCCESS;
41 }
42 for (const auto &trig : m_triggerList)
43 {
44 if (!trigDecTool->isPassed(trig, TrigDefs::Physics))
45 {
46 continue;
47 }
48
49 ATH_MSG_DEBUG("Chain " << trig << " is passed: YES");
50
51 auto TrigCounts = Monitored::Scalar<std::string>("TrigCounts", trig);
52 fill("ZDCall", TrigCounts);
53
54 // declare the quantities which should be monitored
55 auto e_A = Monitored::Scalar<float>("e_A", 0.0); // ZDC ADC on Side A
56 auto e_C = Monitored::Scalar<float>("e_C", 0.0); // ZDC ADC on Side C
57 auto moduleEnergy = Monitored::Scalar<float>("moduleEnergy", 0.0);
58 auto moduleNum = Monitored::Scalar<float>("moduleNum", 0.0);
59
60 // read single modules
61 for (const auto zdcModule : *zdcModules)
62 {
63 if (zdcModule->zdcType() == 0)
64 { // type = 0 are big modules, type = 1 the pixels
65 // Side A
66 if (zdcModule->zdcSide() > 0)
67 {
68 moduleEnergy = zdcModuleCalibEnergyHandle(*zdcModule);
69 moduleNum = zdcModule->zdcModule();
70 e_A += zdcModuleCalibEnergyHandle(*zdcModule);
71 fill(trig + "_expert", moduleEnergy, moduleNum);
72 fill("ZDCall", moduleEnergy, moduleNum);
73 }
74 // Side C
75 if (zdcModule->zdcSide() < 0)
76 {
77 moduleEnergy = zdcModuleCalibEnergyHandle(*zdcModule);
78 moduleNum = zdcModule->zdcModule() + 4.;
79 e_C += zdcModuleCalibEnergyHandle(*zdcModule);
80 fill(trig + "_expert", moduleEnergy, moduleNum);
81 fill("ZDCall", moduleEnergy, moduleNum);
82 }
83 }
84 }
85 fill(trig + "_expert", e_A, e_C);
86 fill("ZDCall", e_A, e_C);
87 }
88 return StatusCode::SUCCESS;
89}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Define enumerations for event-level ZDC data.
virtual StatusCode initialize() override
initialize
const ToolHandle< Trig::TrigDecisionTool > & getTrigDecisionTool() const
Get the trigger decision tool member.
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
SG::ReadHandleKey< xAOD::EventInfo > m_EventInfoKey
Key for retrieving EventInfo from StoreGate.
SG::ReadHandleKey< xAOD::ZdcModuleContainer > m_zdcModuleContainerKey
virtual StatusCode initialize() override
initialize
Gaudi::Property< std::vector< std::string > > m_triggerList
FwdZDCMonitoringAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode fillHistograms(const EventContext &context) const override
adds event to the monitoring histograms
SG::ReadDecorHandleKey< xAOD::EventInfo > m_eventInfoDecorKey
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_zdcModuleCalibEnergyKey
Declare a monitored scalar variable.
Handle class for reading a decoration on an object.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
@ ForwardDet
The forward detectors.
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.