ATLAS Offline Software
LArNoisyROTool.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // LArNoisyROTool.h
8 // Header file for class LArNoisyROTool
9 // Author: S.Binet<binet@cern.ch>
11 #ifndef LARCELLREC_LARNOISYROTOOL_H
12 #define LARCELLREC_LARNOISYROTOOL_H 1
13 
14 
15 // FrameWork includes
19 
25 
26 // STL includes
27 #include <string>
28 #include <set>
29 #include <array>
30 #include <unordered_map>
31 #include <memory>
32 
33 class LArOnlineID;
34 class CaloCell_ID;
35 class LArOnOffIdMapping;
36 class CaloCellContainer;
37 class LArElectrodeID;
38 class LArHVNMap;
39 
40 class LArNoisyROTool : public extends<AthAlgTool, ILArNoisyROTool> {
41  public:
42  // delegate constructor
43  using base_class::base_class;
44 
46  virtual ~LArNoisyROTool() = default;
47 
48  // Athena algtool's Hooks
49  virtual StatusCode initialize();
50 
51  virtual std::unique_ptr<LArNoisyROSummary> process(const EventContext&, const CaloCellContainer*, const std::set<unsigned int>*,
52  const std::vector<HWIdentifier>*, const LArHVNMap*, const CaloDetDescrManager*,
53  const LArHVIdMapping*) const;
54 
55  private: // classes
56  // this class accumulates the number of bad channel in a FEB, per preamp in a FEB
57  class FEBEvtStat{
58  public:
59  FEBEvtStat() = default;
60 
61  void addBadChannel(unsigned int channel){
62  m_chanCounter++;
63  unsigned int preamp = channel / 4;
64  m_PAcounters[preamp]++;
65  }
66 
67  void resetCounters(){
68  m_chanCounter = 0;
69  for (size_t i = 0; i < 32; i++)
70  m_PAcounters[i] = 0;
71  }
72 
73  unsigned int badChannels() const { return m_chanCounter; }
74  const unsigned int* PAcounters() const { return &m_PAcounters[0]; }
75 
76 
77  private:
78  unsigned int m_chanCounter{};
79  unsigned int m_PAcounters[32]{};
80  };
81 
82  size_t partitionNumber(const HWIdentifier) const;
83 
84  typedef std::unordered_map<unsigned int, FEBEvtStat> FEBEvtStatMap;
85 
86  std::unordered_map<unsigned int, unsigned int> m_mapPSFEB;
87 
88  typedef std::unordered_map<HWIdentifier, unsigned int> HVlinesStatMap;
89 
90  private:
91  ToolHandle<ILArHVMapTool> m_hvMapTool{"LArHVMapTool"};
92 
93  const CaloCell_ID* m_calo_id = nullptr;
94  const LArOnlineID* m_onlineID = nullptr;
95  const LArElectrodeID* m_elecID = nullptr;
96  SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this, "CablingKey", "LArOnOffIdMap", "key to read OnOff mapping"};
97 
98  Gaudi::Property<unsigned int> m_CellQualityCut{this, "CellQualityCut", 4000, "Qfactor value above which a channel is considered bad"};
99 
100  Gaudi::Property<bool> m_ignore_masked_cells{this, "IgnoreMaskedCells", false, "ignore masked cells"};
101 
102  Gaudi::Property<bool> m_ignore_front_innerwheel_cells{this, "IgnoreFrontInnerWheelCells", true, "ignore front inner wheel cells ?"};
103 
104  Gaudi::Property<unsigned int> m_BadChanPerFEB{this, "BadChanPerFEB", 30, "number of bad channels to declare a FEB noisy"};
105 
106  Gaudi::Property<unsigned int> m_MinBadFEB{this, "BadFEBCut", 3, "min number of bad FEB to put LAr warning in event info"};
107 
108  Gaudi::Property<unsigned int> m_SaturatedCellQualityCut{this, "SaturatedCellQualityCut", 65535,
109  " Qfactor value above which (>=) a channel is considered with a saturated Qfactor"};
110 
111  Gaudi::Property<float> m_SaturatedCellEnergyTightCut{this, "SaturatedCellEnergyTightCut", 1000.,
112  "Count saturated Qfactor cells above this energy cut (absolute value)"};
113 
114  Gaudi::Property<unsigned int> m_SaturatedCellTightCut{this, "SaturatedCellTightCut", 20, "min number of saturated Qfactor cells to declare an event bad"};
115 
116  Gaudi::Property<bool> m_doHVline{this, "DoHVflag", true, "do HVline flagging"};
117 
118  Gaudi::Property<float> m_BadChanFracPerHVline{this, "BadChanFracPerHVline", 0.25, "fraction of bad cells in one HV line"};
119 
120  Gaudi::Property<unsigned int> m_MinBadHV{this, "BadHVCut", 3, " min number of bad HV lines"};
121 
122  Gaudi::Property<unsigned int> m_MNBLooseCut{this, "MNBLooseCut", 5, "Loose cut on number of cells above CellQualityCut"};
123  Gaudi::Property<unsigned int> m_MNBTightCut{this, "MNBTightCut", 17, "Thight cut on number of cells above CellQualityCut"};
124  Gaudi::Property<std::vector<unsigned int> > m_MNBTight_PsVetoCut{this, "MNBTight_PsVetoCut", {13, 3}};
125 
126  std::array<uint8_t, 4> m_partitionMask{
128  // beware: The order matters!
129 };
130 
131 inline size_t LArNoisyROTool::partitionNumber(const HWIdentifier hwid) const {
132  int pn=m_onlineID->pos_neg(hwid);
133 
134  if (m_onlineID->isEMECchannel(hwid)) {
135  if (pn)
136  return 0; // positive EMECA side
137  else
138  return 3; // negative EMECC side
139  }
140  if (m_onlineID->isEMBchannel(hwid)) {
141  if (pn)
142  return 1; // positive EMBA side
143  else
144  return 2; // negative EMBC side
145  }
146  return 4;//Anything else
147 }
148 
149 #endif //> !LARCELLREC_LARNOISYROTOOL_H
LArNoisyROSummary::EMBAMask
@ EMBAMask
Definition: LArNoisyROSummary.h:34
LArNoisyROSummary::EMECCMask
@ EMECCMask
Definition: LArNoisyROSummary.h:33
LArNoisyROTool::HVlinesStatMap
std::unordered_map< HWIdentifier, unsigned int > HVlinesStatMap
Definition: LArNoisyROTool.h:88
LArNoisyROTool::m_SaturatedCellEnergyTightCut
Gaudi::Property< float > m_SaturatedCellEnergyTightCut
Definition: LArNoisyROTool.h:111
LArNoisyROTool::m_doHVline
Gaudi::Property< bool > m_doHVline
Definition: LArNoisyROTool.h:116
LArNoisyROTool::m_MinBadHV
Gaudi::Property< unsigned int > m_MinBadHV
Definition: LArNoisyROTool.h:120
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
LArHVNMap
Definition: LArHVNMap.h:14
ILArNoisyROTool.h
python.ZdcOnlineRecMonitorConfig.pn
pn
Definition: ZdcOnlineRecMonitorConfig.py:341
LArElectrodeID
Helper for the Liquid Argon Calorimeter cell at the electrode level.
Definition: LArElectrodeID.h:95
LArNoisyROTool::m_ignore_front_innerwheel_cells
Gaudi::Property< bool > m_ignore_front_innerwheel_cells
Definition: LArNoisyROTool.h:102
LArNoisyROTool::partitionNumber
size_t partitionNumber(const HWIdentifier) const
Definition: LArNoisyROTool.h:131
LArNoisyROTool::FEBEvtStat::addBadChannel
void addBadChannel(unsigned int channel)
Definition: LArNoisyROTool.h:61
LArNoisyROTool::m_BadChanPerFEB
Gaudi::Property< unsigned int > m_BadChanPerFEB
Definition: LArNoisyROTool.h:104
HWIdentifier
Definition: HWIdentifier.h:13
LArNoisyROTool::m_elecID
const LArElectrodeID * m_elecID
Definition: LArNoisyROTool.h:95
LArNoisyROSummary::EMECAMask
@ EMECAMask
Definition: LArNoisyROSummary.h:33
LArNoisyROTool::m_hvMapTool
ToolHandle< ILArHVMapTool > m_hvMapTool
Definition: LArNoisyROTool.h:91
LArNoisyROTool::m_SaturatedCellQualityCut
Gaudi::Property< unsigned int > m_SaturatedCellQualityCut
Definition: LArNoisyROTool.h:108
LArOnlineID::isEMECchannel
bool isEMECchannel(const HWIdentifier id) const override final
Definition: LArOnlineID.cxx:763
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LArHVIdMapping.h
LArNoisyROTool::m_ignore_masked_cells
Gaudi::Property< bool > m_ignore_masked_cells
Definition: LArNoisyROTool.h:100
LArNoisyROSummary::EMBCMask
@ EMBCMask
Definition: LArNoisyROSummary.h:34
LArNoisyROTool::m_CellQualityCut
Gaudi::Property< unsigned int > m_CellQualityCut
Definition: LArNoisyROTool.h:98
AthAlgTool.h
LArNoisyROTool::initialize
virtual StatusCode initialize()
Definition: LArNoisyROTool.cxx:22
LArOnlineID_Base::pos_neg
int pos_neg(const HWIdentifier id) const
Return the side of a hardware cell identifier pos_neg = [0,1] positive-side or negative-side Barrel...
Definition: LArOnlineID_Base.cxx:1954
LArNoisyROTool::FEBEvtStat::resetCounters
void resetCounters()
Definition: LArNoisyROTool.h:67
LArNoisyROTool::FEBEvtStat::badChannels
unsigned int badChannels() const
Definition: LArNoisyROTool.h:73
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
ILArHVMapTool.h
LArNoisyROTool
Definition: LArNoisyROTool.h:40
LArNoisyROTool::m_partitionMask
std::array< uint8_t, 4 > m_partitionMask
Definition: LArNoisyROTool.h:126
LArNoisyROTool::m_MNBTightCut
Gaudi::Property< unsigned int > m_MNBTightCut
Definition: LArNoisyROTool.h:123
LArNoisyROTool::m_MNBLooseCut
Gaudi::Property< unsigned int > m_MNBLooseCut
Definition: LArNoisyROTool.h:122
ReadCondHandleKey.h
LArNoisyROTool::FEBEvtStat
Definition: LArNoisyROTool.h:57
LArNoisyROTool::m_SaturatedCellTightCut
Gaudi::Property< unsigned int > m_SaturatedCellTightCut
Definition: LArNoisyROTool.h:114
HWIdentifier.h
LArNoisyROTool::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition: LArNoisyROTool.h:96
LArNoisyROSummary.h
LArOnlineID
Definition: LArOnlineID.h:21
LArNoisyROTool::m_mapPSFEB
std::unordered_map< unsigned int, unsigned int > m_mapPSFEB
Definition: LArNoisyROTool.h:86
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
LArOnlineID_Base::isEMBchannel
bool isEMBchannel(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1652
LArNoisyROTool::FEBEvtStat::PAcounters
const unsigned int * PAcounters() const
Definition: LArNoisyROTool.h:74
SG::ReadCondHandleKey< LArOnOffIdMapping >
LArNoisyROTool::m_BadChanFracPerHVline
Gaudi::Property< float > m_BadChanFracPerHVline
Definition: LArNoisyROTool.h:118
LArHVIdMapping
Definition: LArHVIdMapping.h:21
LArNoisyROTool::m_MNBTight_PsVetoCut
Gaudi::Property< std::vector< unsigned int > > m_MNBTight_PsVetoCut
Definition: LArNoisyROTool.h:124
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
LArNoisyROTool::FEBEvtStat::m_PAcounters
unsigned int m_PAcounters[32]
Definition: LArNoisyROTool.h:79
LArNoisyROTool::FEBEvtStatMap
std::unordered_map< unsigned int, FEBEvtStat > FEBEvtStatMap
Definition: LArNoisyROTool.h:84
LArNoisyROTool::process
virtual std::unique_ptr< LArNoisyROSummary > process(const EventContext &, const CaloCellContainer *, const std::set< unsigned int > *, const std::vector< HWIdentifier > *, const LArHVNMap *, const CaloDetDescrManager *, const LArHVIdMapping *) const
Definition: LArNoisyROTool.cxx:60
LArNoisyROTool::FEBEvtStat::m_chanCounter
unsigned int m_chanCounter
Definition: LArNoisyROTool.h:78
LArNoisyROTool::~LArNoisyROTool
virtual ~LArNoisyROTool()=default
Destructor:
LArNoisyROTool::m_calo_id
const CaloCell_ID * m_calo_id
Definition: LArNoisyROTool.h:93
LArNoisyROTool::m_onlineID
const LArOnlineID * m_onlineID
Definition: LArNoisyROTool.h:94
LArNoisyROTool::m_MinBadFEB
Gaudi::Property< unsigned int > m_MinBadFEB
Definition: LArNoisyROTool.h:106
LArOnlineID.h
LArNoisyROTool::FEBEvtStat::FEBEvtStat
FEBEvtStat()=default
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20