ATLAS Offline Software
LArCalibValidationAlg.h
Go to the documentation of this file.
1 //Dear emacs, this is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 
16 #ifndef LARCALIBVALIDATIONALG_H
17 #define LARCALIBVALIDATIONALG_H
18 
19 #include <vector>
20 #include <string>
21 #include <sstream>
22 #include <fstream>
23 
25 #include "GaudiKernel/ToolHandle.h"
27 
32 
35 
36 
46 template<class CONDITIONSCONTAINER, class REFCONTAINER>
48 
49 public:
53  LArCalibValidationAlg (const std::string& name, ISvcLocator* pSvcLocator);
54 
59 
64 
69  StatusCode execute() {return StatusCode::SUCCESS;}
70 
76  StatusCode finalize(){return StatusCode::SUCCESS;}
77 
78 protected:
79  typedef typename CONDITIONSCONTAINER::ConstConditionsMapIterator CONTIT;
80  typedef typename CONDITIONSCONTAINER::LArCondObj LArCondObj;
81  typedef typename CONDITIONSCONTAINER::MultChanCollection MULTICHANCOLL;
82 
87  virtual StatusCode preLoop();
88 
89 
98  virtual bool validateChannel(const LArCondObj& ref, const LArCondObj& val, const HWIdentifier chid, const int gain, const LArOnOffIdMapping *cabling,const LArBadChannelCont *bcCont)=0;
99 
100 
103  virtual LArCondObj getRefObj(const HWIdentifier chid, const int gain) const=0;
104 
113 
123  const std::string channelDescription(const HWIdentifier& chid, const LArOnOffIdMapping *cabling, const LArBadChannelCont *bcCont, const unsigned gain=99, bool isFeb=false) const;
124 
125 
126 private:
133 
134 
135  typedef std::vector<std::pair<HWIdentifier,unsigned> > FEBANDGAIN_t;
143  bool patchMissingFEBs(const FEBANDGAIN_t& febAndGain, const LArOnOffIdMapping *cabling, const LArBadChannelCont *bcCont);
144 
145 typedef std::vector<std::pair<std::pair<HWIdentifier,unsigned>, unsigned > > CBANDCHANANDGAIN_t;
154 
155  void febOutput(const HWIdentifier& febid, const unsigned gain, const unsigned nGood, const unsigned nBad);
156 
158 
159  std::vector<std::string> m_gainMap;
160 
161 protected:
165 
166 
167  SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"};
168  SG::ReadCondHandleKey<LArBadChannelCont> m_BCKey{this, "BadChanKey", "LArBadChannel", "SG bad channels key"};
169  SG::ReadCondHandleKey<LArCalibLineMapping> m_CLKey{this, "CalibLineKey", "LArCalibLineMap", "SG calib line key"};
171  Gaudi::Property<std::vector<std::string> > m_problemsToMask{this,"ProblemsToMask",{}, "Bad-Channel categories to mask"};
172  Gaudi::Property<std::vector<unsigned int> > m_patchCBs{this, "PatchCBs", {}, "List of missing CalibBoards to patch using values from reference container."};
173  BooleanProperty m_isSC{this, "SuperCells", false, "Working on SuperCells ?"};
174 
175  // Pointers to various identifier helper classes, not used her, but
176  // probably useful for deriving algorithm
178  const CaloCell_Base_ID* m_caloId=nullptr;
179 
180 
182  const REFCONTAINER* m_reference=nullptr;
183 
185  const CONDITIONSCONTAINER* m_validation=nullptr;
186 
188  CONDITIONSCONTAINER* m_nc_validation=nullptr;
189 
191  std::string m_validationKey;
192 
194  SG::ReadCondHandleKey<REFCONTAINER> m_referenceKey{this,"ReferenceKey","", "SG key of the LArConditionsContainer used as reference"};
195 
199 
202 
205 
208 
211 
213  unsigned m_maxmessages;
214 
215  //Count the various cases:
216 
218  unsigned m_nChecked=0;
219 
222 
224  unsigned m_nValidated=0;
225 
227  unsigned m_nBad=0;
228 
230  unsigned m_nNoReference=0;
231 
233  typedef std::vector<std::pair<HWIdentifier, bool > > CHECKEDID_t;
234  std::vector<CHECKEDID_t> m_checkedIds;
235 
237  std::string m_chanFileName;
238 
240  std::ofstream m_chanFile;
241 
243  std::string m_febFileName;
244 
246  std::ofstream m_febFile;
247 
249 
250 };
251 
252 #include "LArCalibValidationAlg.icc"
253 
254 #endif
255 
LArCalibValidationAlg::m_patchMissingFEBs
bool m_patchMissingFEBs
wether missing FEBS (incomplete COOL channels) should be patched
Definition: LArCalibValidationAlg.h:204
LArCalibValidationAlg::m_referenceKey
SG::ReadCondHandleKey< REFCONTAINER > m_referenceKey
SG key of the reference container (job-property)
Definition: LArCalibValidationAlg.h:194
LArCalibValidationAlg::m_validation
const CONDITIONSCONTAINER * m_validation
Pointer to container to be validated.
Definition: LArCalibValidationAlg.h:185
LArCalibValidationAlg::m_onlineHelper
const LArOnlineID_Base * m_onlineHelper
Definition: LArCalibValidationAlg.h:177
LArCalibValidationAlg::m_nFailedValidation
unsigned m_nFailedValidation
Number of channels for which vaildateChannel returned false.
Definition: LArCalibValidationAlg.h:221
LArCalibValidationAlg::m_gainMap
std::vector< std::string > m_gainMap
Definition: LArCalibValidationAlg.h:159
LArCalibValidationAlg::m_myMsgLvlProp
int m_myMsgLvlProp
Definition: LArCalibValidationAlg.h:164
LArCalibValidationAlg::m_reference
const REFCONTAINER * m_reference
Pointer to container with reference values.
Definition: LArCalibValidationAlg.h:182
LArCalibValidationAlg::m_BCKey
SG::ReadCondHandleKey< LArBadChannelCont > m_BCKey
Definition: LArCalibValidationAlg.h:168
LArCalibValidationAlg::m_CLKey
SG::ReadCondHandleKey< LArCalibLineMapping > m_CLKey
Definition: LArCalibValidationAlg.h:169
LArBadXCont
Conditions-Data class holding LAr Bad Channel or Bad Feb information.
Definition: LArBadChannelCont.h:28
LArCalibLineMapping
Definition: LArCalibLineMapping.h:17
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
LArCalibValidationAlg::CBANDCHANANDGAIN_t
std::vector< std::pair< std::pair< HWIdentifier, unsigned >, unsigned > > CBANDCHANANDGAIN_t
Definition: LArCalibValidationAlg.h:145
LArCalibValidationAlg::stop
StatusCode stop()
Standard finalize method Loops over all channels and all gains and calls the validateChannel method.
LArCalibValidationAlg::m_patchCBs
Gaudi::Property< std::vector< unsigned int > > m_patchCBs
Definition: LArCalibValidationAlg.h:172
LArCalibValidationAlg::patchMissingFEBs
bool patchMissingFEBs(const FEBANDGAIN_t &febAndGain, const LArOnOffIdMapping *cabling, const LArBadChannelCont *bcCont)
Fills channels of missing FEBs.
LArCalibValidationAlg::FEBANDGAIN_t
std::vector< std::pair< HWIdentifier, unsigned > > FEBANDGAIN_t
Definition: LArCalibValidationAlg.h:135
LArCalibValidationAlg::m_printFailedPattern
bool m_printFailedPattern
wether to check for FEBs and Calib-lines with many deviating channels
Definition: LArCalibValidationAlg.h:207
LArCalibValidationAlg::m_useCorrChannel
bool m_useCorrChannel
Definition: LArCalibValidationAlg.h:248
LArCalibValidationAlg::CHECKEDID_t
std::vector< std::pair< HWIdentifier, bool > > CHECKEDID_t
Keeping track of channels failing the validation criteria (per gain)
Definition: LArCalibValidationAlg.h:233
LArCalibValidationAlg::finalize
StatusCode finalize()
Definition: LArCalibValidationAlg.h:76
LArCalibValidationAlg::MULTICHANCOLL
CONDITIONSCONTAINER::MultChanCollection MULTICHANCOLL
Definition: LArCalibValidationAlg.h:81
HWIdentifier
Definition: HWIdentifier.h:13
LArCalibValidationAlg::m_chanFile
std::ofstream m_chanFile
File name to store list of deviating channels.
Definition: LArCalibValidationAlg.h:240
CaloCell_ID.h
AthAlgorithm.h
LArBadChannelCont.h
LArCalibValidationAlg::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition: LArCalibValidationAlg.h:167
LArCalibValidationAlg::m_nValidated
unsigned m_nValidated
Number of channels for which vaildateChannel returned true.
Definition: LArCalibValidationAlg.h:224
LArCalibValidationAlg::findFailedPatterns
void findFailedPatterns(const LArOnOffIdMapping *cabling, const LArCalibLineMapping *clCont, const LArBadChannelCont *bcCont)
LArOnOffIdMapping.h
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LArCalibValidationAlg::getRefObj
virtual LArCondObj getRefObj(const HWIdentifier chid, const int gain) const =0
Method implmented in derived class to get the reference object from ref-container.
LArCalibValidationAlg::execute
StatusCode execute()
Standard execute method This method has to be emtpy since all the job is done in stop()
Definition: LArCalibValidationAlg.h:69
LArCalibValidationAlg::m_nc_validation
CONDITIONSCONTAINER * m_nc_validation
Non-const pointer to container to be validated (for FEB patching)
Definition: LArCalibValidationAlg.h:188
LArCalibValidationAlg::validateChannel
virtual bool validateChannel(const LArCondObj &ref, const LArCondObj &val, const HWIdentifier chid, const int gain, const LArOnOffIdMapping *cabling, const LArBadChannelCont *bcCont)=0
Abstract method to validate a single readout channels.
LArCalibValidationAlg::m_febFileName
std::string m_febFileName
File name to store list of FEBs with deviating channels.
Definition: LArCalibValidationAlg.h:243
LArCalibValidationAlg::summary
virtual StatusCode summary(const LArOnOffIdMapping *cabling, const LArBadChannelCont *bcCont)
Method executed after the loop over all channels The implementation in the base class writes out only...
LArCalibValidationAlg::LArCalibValidationAlg
LArCalibValidationAlg(const std::string &name, ISvcLocator *pSvcLocator)
Regular algorithm constructor.
LArCalibValidationAlg::m_febFile
std::ofstream m_febFile
File name to store list of FEBs with deviating channels.
Definition: LArCalibValidationAlg.h:246
LArCalibValidationAlg::m_caloId
const CaloCell_Base_ID * m_caloId
Definition: LArCalibValidationAlg.h:178
python.compareNtuple.nGood
nGood
Definition: compareNtuple.py:55
LArCalibValidationAlg::LArCondObj
CONDITIONSCONTAINER::LArCondObj LArCondObj
Definition: LArCalibValidationAlg.h:80
AthAlgorithm
Definition: AthAlgorithm.h:47
LArCalibValidationAlg::m_chanFileName
std::string m_chanFileName
File name to store list of deviating channels.
Definition: LArCalibValidationAlg.h:237
ReadCondHandleKey.h
LArCalibValidationAlg::m_nNoReference
unsigned m_nNoReference
Number of channels for which not reference channel could be found.
Definition: LArCalibValidationAlg.h:230
LArOnlineID_Base
Helper for the Liquid Argon Calorimeter cell identifiers.
Definition: LArOnlineID_Base.h:105
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
LArCalibValidationAlg::m_checkedIds
std::vector< CHECKEDID_t > m_checkedIds
Definition: LArCalibValidationAlg.h:234
LArCalibValidationAlg::m_nChecked
unsigned m_nChecked
Number of channels that where checked (grand-total)
Definition: LArCalibValidationAlg.h:218
LArCalibValidationAlg::m_myMsgLvl
MSG::Level m_myMsgLvl
Message level for reporting deviations.
Definition: LArCalibValidationAlg.h:163
LArCalibValidationAlg::m_checkCompleteness
bool m_checkCompleteness
wether completeness shall be checked or not (job-property)
Definition: LArCalibValidationAlg.h:201
LArCalibValidationAlg::patchMissingCalibBoards
bool patchMissingCalibBoards(const CBANDCHANANDGAIN_t &CBAndGain, const LArOnOffIdMapping *cabling, const LArBadChannelCont *bcCont)
Fills channels of missing calib boards.
LArCalibValidationAlg::initialize
StatusCode initialize()
Standard initialization method.
SG::ReadCondHandleKey< LArOnOffIdMapping >
LArCalibValidationAlg::febOutput
void febOutput(const HWIdentifier &febid, const unsigned gain, const unsigned nGood, const unsigned nBad)
ref
const boost::regex ref(r_ef)
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
LArCalibValidationAlg::checkCoolChannelCompleteness
bool checkCoolChannelCompleteness(const LArOnOffIdMapping *cabling, const LArCalibLineMapping *clCont, const LArBadChannelCont *bcCont)
Verify if all FEBs of each Cool-Channel is present.
LArCalibValidationAlg::m_useBCInfo
bool m_useBCInfo
Flag set to true in order to use bad-channel info for the channel description as well as to ingore so...
Definition: LArCalibValidationAlg.h:198
LArCalibValidationAlg::m_maxmessages
unsigned m_maxmessages
Limit for the number of messages about indiviual deviating channels (usd only by derived class)
Definition: LArCalibValidationAlg.h:213
LArCalibValidationAlg
Algorithm to validate LAr Autocorr;.
Definition: LArCalibValidationAlg.h:47
LArCalibValidationAlg::m_validationKey
std::string m_validationKey
SG key of the container to be validated (job-property)
Definition: LArCalibValidationAlg.h:191
LArCalibValidationAlg.icc
LArCalibValidationAlg::preLoop
virtual StatusCode preLoop()
Method executed before the loop over all channels This method can be implemented by the deriving algo...
LArCalibValidationAlg::CONTIT
CONDITIONSCONTAINER::ConstConditionsMapIterator CONTIT
Definition: LArCalibValidationAlg.h:79
ReadBchFromCool.nBad
nBad
Definition: ReadBchFromCool.py:455
LArCalibValidationAlg::channelDescription
const std::string channelDescription(const HWIdentifier &chid, const LArOnOffIdMapping *cabling, const LArBadChannelCont *bcCont, const unsigned gain=99, bool isFeb=false) const
Textual representation of gain and location of a certain cell or FEB.
LArCalibValidationAlg::m_nBad
unsigned m_nBad
Number of channels known to be bad according to the bad-channel tool.
Definition: LArCalibValidationAlg.h:227
CaloGain.h
LArCalibLineMapping.h
CaloCell_Base_ID
Helper base class for offline cell identifiers.
Definition: CaloCell_Base_ID.h:41
LArBadChannelMask.h
LArCalibValidationAlg::m_doFebAverages
bool m_doFebAverages
wether to compare feb-averages (used only by derived class)
Definition: LArCalibValidationAlg.h:210
LArCalibValidationAlg::~LArCalibValidationAlg
~LArCalibValidationAlg()
Destructor.
LArCalibValidationAlg::m_isSC
BooleanProperty m_isSC
Definition: LArCalibValidationAlg.h:173
LArCalibValidationAlg::m_problemsToMask
Gaudi::Property< std::vector< std::string > > m_problemsToMask
Definition: LArCalibValidationAlg.h:171
LArCalibValidationAlg::m_bcMask
LArBadChannelMask m_bcMask
Definition: LArCalibValidationAlg.h:170
LArBadChannelMask
Definition: LArBadChannelMask.h:18
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20