ATLAS Offline Software
Loading...
Searching...
No Matches
CaloMonAlgBase.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "CaloMonAlgBase.h"
6
7CaloMonAlgBase::CaloMonAlgBase(const std::string& name, ISvcLocator* pSvcLocator)
8 :AthMonitorAlgorithm(name, pSvcLocator)
9 {
10 declareProperty("useBadLBTool", m_useBadLBTool=false);
11 declareProperty("BadLBTool", m_BadLBTool);
12
13 declareProperty("useReadyFilterTool",m_useReadyFilterTool=true);
14 declareProperty("ReadyFilterTool",m_ReadyFilterTool);
15
16 declareProperty("useLArCollisionFilterTool",m_useCollisionFilterTool=true);
17
18 declareProperty("useLArNoisyAlg",m_useLArNoisyAlg=false);
19
20 declareProperty("useBeamBackgroundRemoval",m_useBeamBackgroundRemoval=false);
21}
22
24
25 // retrieve AtlasReadyFilter tool
27 StatusCode sc = m_ReadyFilterTool.retrieve();
28 if(sc.isFailure()) {
29 ATH_MSG_ERROR("Could Not Retrieve AtlasReadyFilterTool " << m_ReadyFilterTool);
31 return sc;
32 }
33 }
34 else {
35 m_ReadyFilterTool.disable();
36 }
37
38 // retrieve BadLBFilter tool
40 StatusCode sc = m_BadLBTool.retrieve();
41 if(sc.isFailure()){
42 ATH_MSG_ERROR("Unable to retrieve the DQBadLBFilterTool");
43 m_useBadLBTool = false;
44 return sc;
45 }
46 ATH_MSG_INFO("DQBadLBFilterTool retrieved");
47 }
48 else {
49 m_BadLBTool.disable();
50 }
51
54 ATH_CHECK( detStore()->retrieve (m_calo_id, "CaloCell_ID") );
55
57}
58
59StatusCode CaloMonAlgBase::checkFilters(bool &ifPass, bool &passBeamBackgroundRemoval, const std::string &MonGroupName, const EventContext &ctx) const{
60
61 ATH_MSG_DEBUG("CaloMonAlgBase:checkFilters() starts "<<MonGroupName);
62
63 auto evtbin = Monitored::Scalar<int>("EvtBin",1);
64 fill(MonGroupName,evtbin);
65
66 ifPass = 0;
68 if (m_ReadyFilterTool->accept()) {
69 ifPass = 1;
70 evtbin = 2;
71 fill(MonGroupName,evtbin); //All events with ATLAS Ready
72 }
73 }
74 else{
75 evtbin = 2;
76 fill(MonGroupName,evtbin); //ATLAS ready not activated
77 ifPass = 1;
78 }
79
80 ATH_MSG_DEBUG("CaloMonAlgBase::checkFilters() ATLAS Ready done");
81
83
84 if (m_useBadLBTool) {
85 if (m_BadLBTool->accept()) {
86 ifPass = ifPass && 1;
87 if(ifPass) {evtbin=3; fill(MonGroupName,evtbin);} //All events with ATLAS Ready and Good LB
88 }
89 else {
90 ifPass = 0;
91 }
92 }
93 else{
94 if(ifPass) {evtbin=3; fill(MonGroupName,evtbin);}
95 }
96
97 ATH_MSG_DEBUG("CaloMonAlgBase::checkFilters() BadLBTool done");
98
99 // Filter the events identfied as collision by the LAr system
100 // Useful in CosmicCalo to reject collision candidates
103 if(!larTime.isValid()){
104 ATH_MSG_WARNING("Unable to retrieve LArCollisionTime event store");
105 if(ifPass) {evtbin=4; fill(MonGroupName,evtbin);}
106 }
107 else {
108 if (larTime->timeC()!=0 && larTime->timeA()!=0 && std::fabs(larTime->timeC() - larTime->timeA())<10) {
109 ifPass = 0;
110 }
111 else {
112 ifPass = ifPass && 1;
113 if(ifPass) {evtbin=4; fill(MonGroupName,evtbin);} //All events with ATLAS Ready and Good LB and Good LAr collision time
114 }
115 }
116 }
117 else{
118 if(ifPass) {evtbin=4; fill(MonGroupName,evtbin);}
119 }
120 ATH_MSG_DEBUG("CaloMonAlgBase::checkFilters() CollisionFilterTool done");
121
122
123 passBeamBackgroundRemoval=true;
126 if(!beamBackgroundData.isValid()){
127 ATH_MSG_WARNING("Unable to retrieve BeamBackgroundData");
128 }
129 else {
130 if( beamBackgroundData->GetNumSegment() > 0 ) {
131 passBeamBackgroundRemoval = false;
132 ifPass = 0;
133 ATH_MSG_DEBUG("Identified background event");
134 }
135 else {
136 passBeamBackgroundRemoval = true;
137 ifPass = ifPass && 1;
138 if(ifPass){evtbin=5; fill(MonGroupName,evtbin);} //All events with ATLAS Ready and Good LB and Good LAr collision time and not Beam Background
139 }
140 }
141 }
142 else { // Do not use BeamBackgroundRemoval
143 ifPass = ifPass && 1;
144 if(ifPass) {evtbin=5; fill(MonGroupName,evtbin);} //All events with ATLAS Ready and Good LB and Good LAr collision time and not Beam Background
145
146 }
147 ATH_MSG_DEBUG("CaloMonAlgBase::checkFilters() m_useBeamBackgroundRemoval done");
148
149 std::string TheTrigger;
150 if ( m_vTrigChainNames.empty()) {
151 TheTrigger="NoTrigSel";
152 ifPass = ifPass && 1; // No Trigger Filter check
153 if(ifPass) {evtbin=6; fill(MonGroupName,evtbin);} //All events with ATLAS Ready and Good LB and Good LAr collision time and not Beam Background and Trigger Filter pass
154 }
155 else {
156 TheTrigger = m_triggerChainString; // Trigger Filter not implemented ++ FIXME ==
157 if(ifPass) {evtbin=6; fill(MonGroupName,evtbin);}
158 }
159
160 if(m_useLArNoisyAlg && (eventInfo->errorState(xAOD::EventInfo::LAr) == xAOD::EventInfo::Error)) {
161 ifPass = 0;
162 }
163 else {
164 ifPass = ifPass && 1;
165 if(ifPass) {evtbin=7; fill(MonGroupName,evtbin);} //All events with ATLAS Ready and Good LB and Good LAr collision time and not Beam Background and Trigger Filter pass and no Lar Error
166 }
167
168 ATH_MSG_DEBUG("CaloMonAlgBase::checkFilters() is done");
169 return StatusCode::SUCCESS;
170}
171
172
173
174void CaloMonAlgBase::getHistoCoordinates(const CaloDetDescrElement* dde, float& celleta, float& cellphi, unsigned& iLyr, unsigned& iLyrNS) const {
175
176 celleta=dde->eta_raw();
177 cellphi=dde->phi_raw();
178
179 int calosample=dde->getSampling();
180 if (dde->is_lar_em_endcap_inner()) calosample-=1; //Here, we consider the two layers of the EMEC IW as EME1 and EME2 instad of layer 2 and 3
181 iLyrNS=m_caloSamplingToLyrNS.at(calosample); //will throw if out of bounds
182 if ((iLyrNS==EMB1NS || iLyrNS==EMB2NS) && m_calo_id->region(dde->identify())==1) {
183 //We are in the awkward region 1 of the EM Barrel
184 //Looking at the image at http://atlas.web.cern.ch/Atlas/GROUPS/LIQARGEXT/TDR/figures6/figure6-17.eps
185 //may be useful to understand what's going on here.
186
187 //In brief: Region 1, layer 1 is closer related ot the middle compartment (aka layer 2)
188 // and region 1, layer 2 closer related to the back compartment (aka layer 3)
189 iLyrNS+=1;
190
191 //Layer 2: 0<eta<1.4 + 1.4<eta<1.475, deta = 0.025. 3 rows of cells from region 1
192 //Layer 3: 0<eta<1.35 (deta=0.050) + 1.4<eta<1.475 (deta = 0.075). 1 row of cell from region 1 with different dEta
193 }
194
195 const unsigned side=(celleta>0) ? 0 : 1; //Value >0 means A-side
196 iLyr=iLyrNS*2+side;
197 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
Gaudi::Property< std::string > m_triggerChainString
Trigger chain string pulled from the job option and parsed into a vector.
virtual StatusCode initialize() override
initialize
std::vector< std::string > m_vTrigChainNames
Vector of trigger chain names parsed from trigger chain string.
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.)
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
This class groups all DetDescr information related to a CaloCell.
CaloCell_ID::CaloSample getSampling() const
cell sampling
Identifier identify() const override final
cell identifier
bool is_lar_em_endcap_inner() const
cell belongs to the inner wheel of EM end cap
CaloMonAlgBase(const std::string &name, ISvcLocator *pSvcLocator)
ToolHandle< IDQFilterTool > m_ReadyFilterTool
virtual StatusCode initialize()
initialize
StatusCode checkFilters(bool &ifPass, bool &passBeamBackgroundRemoval, const std::string &MonGroupName, const EventContext &ctx) const
SG::ReadHandleKey< LArCollisionTime > m_LArCollisionTimeKey
bool m_useBeamBackgroundRemoval
ToolHandle< IDQFilterTool > m_BadLBTool
const std::map< unsigned, LayerEnumNoSides > m_caloSamplingToLyrNS
void getHistoCoordinates(const CaloDetDescrElement *dde, float &celleta, float &cellphi, unsigned &iLyr, unsigned &iLyrNS) const
bool m_useCollisionFilterTool
const CaloCell_ID * m_calo_id
SG::ReadHandleKey< BeamBackgroundData > m_beamBackgroundKey
Declare a monitored scalar variable.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
@ LAr
The LAr calorimeter.
@ Error
The sub-detector issued an error.
void fill(H5::Group &out_file, size_t iterations)