ATLAS Offline Software
LArNoisyROTool.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2021 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 // STL includes
15 #include <string>
16 #include <set>
17 #include <array>
18 #include <unordered_map>
19 
20 // FrameWork includes
23 
28 
29 class LArOnlineID;
30 class CaloCell_ID;
31 class LArOnOffIdMapping;
32 class LArNoisyROSummary;
33 class CaloCellContainer;
34 
36  virtual public ILArNoisyROTool,
37  public AthAlgTool
38 {
39 
41  // Public methods:
43  public:
44 
45  // Copy constructor:
46 
48  LArNoisyROTool( const std::string& type,
49  const std::string& name,
50  const IInterface* parent );
51 
53  virtual ~LArNoisyROTool();
54 
55  static const InterfaceID& interfaceID();
56 
57  // Athena algtool's Hooks
58  virtual StatusCode initialize();
59  virtual StatusCode finalize();
60 
61  virtual
62  std::unique_ptr<LArNoisyROSummary> process(const CaloCellContainer*, const std::set<unsigned int>*, const std::vector<HWIdentifier>*) const;
63 
64  private:
65 
68 
69  // Containers
70 
71  //enum LARFLAGREASON { BADFEBS=0, MEDIUMSATURATEDQ=1, TIGHTSATURATEDQ=2, BADFEBS_W=3} ;
72 
73  private: // classes
74 
75  // this class accumulates the number of bad channel in a FEB, per preamp in a FEB
76  class FEBEvtStat
77  {
78  public:
80  {
81  resetCounters();
82  }
83 
84  void addBadChannel(unsigned int channel)
85  {
86  m_chanCounter++;
87  unsigned int preamp = channel/4;
88  m_PAcounters[preamp]++;
89  }
90 
92  {
93  m_chanCounter = 0;
94  for ( size_t i = 0; i < 32; i++ ) m_PAcounters[i] = 0;
95  }
96 
97  unsigned int badChannels() const { return m_chanCounter; }
98  const unsigned int* PAcounters() const { return &m_PAcounters[0]; }
99  private:
100  unsigned int m_chanCounter;
101  unsigned int m_PAcounters[32];
102 
103  };
104 
105  size_t partitionNumber(const HWIdentifier) const;
106 
107 
108  typedef std::unordered_map<unsigned int, FEBEvtStat> FEBEvtStatMap;
110  typedef std::unordered_map<unsigned int, FEBEvtStat>::const_iterator FEBEvtStatMapCstIt;
111 
112  std::unordered_map<unsigned int,unsigned int> m_mapPSFEB;
113 
114  private:
115 
118  SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey {this, "CablingKey", "LArOnOffIdMap", "key to read OnOff mapping"};
119 
120  //** Qfactor value above which a channel is considered bad */
121  unsigned int m_CellQualityCut;
122 
123  //** ignore masked cells ? */
125 
126  //** ignore front inner wheel cells ? */
128 
129  //** number of bad channels to declare a preamp noisy */
130  unsigned int m_BadChanPerPA = 0U;
131 
132  //** number of bad channels to declare a FEB noisy */
133  unsigned int m_BadChanPerFEB;
134 
135  //** min number of bad FEB to put LAr warning in event info */
136  unsigned int m_MinBadFEB;
137 
138  //** count bad FEB for job */
139  //std::unordered_map<unsigned int, unsigned int> m_badFEB_counters;
140 
141  //** count bad PA for job */
142  //std::map<uint64_t, unsigned int> m_badPA_counters;
143 
144  //** Qfactor value above which (>=) a channel is considered with a saturated Qfactor*/
146 
147  //** Count saturated Qfactor cells above this energy cut (absolute value)*/
149 
150  //** min number of saturated Qfactor cells to declare an event bad */
152 
153  //** Count events with too many saturated Qfactor cells */
154  unsigned int m_SaturatedCellTightCutEvents = 0U;
155 
156  unsigned int m_MNBLooseCut;
157  unsigned int m_MNBTightCut;
158  std::vector<unsigned int> m_MNBTight_PsVetoCut;
159 
160  std::array<uint8_t,4> m_partitionMask;
161 
162 };
163 
164 
165 
166 
167 inline size_t LArNoisyROTool::partitionNumber(const HWIdentifier hwid) const {
168 
169  int pn=m_onlineID->pos_neg(hwid);
170  if (m_onlineID->isEMECchannel(hwid)) {
171  if (pn)
172  return 0; //positive EMECA side
173  else
174  return 3; //negative EMECC side
175  }
176  if (m_onlineID->isEMBchannel(hwid)) {
177  if (pn)
178  return 1; //positive EMBA side
179  else
180  return 2; //negative EMBC side
181  }
182 
183  return 4;//Anything else
184 }
185 
186 
187 
188 
189 #endif //> !LARCELLREC_LARNOISYROTOOL_H
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
LArNoisyROTool::process
virtual std::unique_ptr< LArNoisyROSummary > process(const CaloCellContainer *, const std::set< unsigned int > *, const std::vector< HWIdentifier > *) const
Definition: LArNoisyROTool.cxx:85
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
LArNoisyROTool::m_SaturatedCellQualityCut
unsigned int m_SaturatedCellQualityCut
Definition: LArNoisyROTool.h:145
ILArNoisyROTool.h
LArNoisyROTool::partitionNumber
size_t partitionNumber(const HWIdentifier) const
Definition: LArNoisyROTool.h:167
LArNoisyROTool::FEBEvtStat::addBadChannel
void addBadChannel(unsigned int channel)
Definition: LArNoisyROTool.h:84
LArNoisyROTool::m_BadChanPerFEB
unsigned int m_BadChanPerFEB
Definition: LArNoisyROTool.h:133
LArNoisyROTool::m_mapPSFEB
std::unordered_map< unsigned int, unsigned int > m_mapPSFEB
Definition: LArNoisyROTool.h:112
LArNoisyROTool::m_ignore_front_innerwheel_cells
bool m_ignore_front_innerwheel_cells
Definition: LArNoisyROTool.h:127
HWIdentifier
Definition: HWIdentifier.h:13
LArNoisyROTool::FEBEvtStatMapIt
std::unordered_map< unsigned int, FEBEvtStat >::iterator FEBEvtStatMapIt
Definition: LArNoisyROTool.h:109
LArNoisyROTool::m_MinBadFEB
unsigned int m_MinBadFEB
Definition: LArNoisyROTool.h:136
LArNoisyROTool::m_ignore_masked_cells
bool m_ignore_masked_cells
Definition: LArNoisyROTool.h:124
python.ZdcRecConfig.pn
pn
Definition: ZdcRecConfig.py:506
LArNoisyROTool::m_SaturatedCellTightCutEvents
unsigned int m_SaturatedCellTightCutEvents
Definition: LArNoisyROTool.h:154
LArNoisyROTool::m_partitionMask
std::array< uint8_t, 4 > m_partitionMask
Definition: LArNoisyROTool.h:160
LArOnlineID::isEMECchannel
bool isEMECchannel(const HWIdentifier id) const override final
Definition: LArOnlineID.cxx:763
LArNoisyROTool::m_CellQualityCut
unsigned int m_CellQualityCut
Definition: LArNoisyROTool.h:121
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
AthAlgTool.h
LArNoisyROTool::initialize
virtual StatusCode initialize()
Definition: LArNoisyROTool.cxx:48
test_pyathena.parent
parent
Definition: test_pyathena.py:15
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:1950
LArNoisyROTool::FEBEvtStat::FEBEvtStat
FEBEvtStat()
Definition: LArNoisyROTool.h:79
LArNoisyROTool::FEBEvtStat::resetCounters
void resetCounters()
Definition: LArNoisyROTool.h:91
LArNoisyROTool::~LArNoisyROTool
virtual ~LArNoisyROTool()
Destructor:
LArNoisyROTool::FEBEvtStat::badChannels
unsigned int badChannels() const
Definition: LArNoisyROTool.h:97
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
LArNoisyROTool::FEBEvtStatMapCstIt
std::unordered_map< unsigned int, FEBEvtStat >::const_iterator FEBEvtStatMapCstIt
Definition: LArNoisyROTool.h:110
LArNoisyROTool
Definition: LArNoisyROTool.h:38
LArNoisyROTool::m_MNBTightCut
unsigned int m_MNBTightCut
Definition: LArNoisyROTool.h:157
ReadCondHandleKey.h
LArNoisyROTool::m_SaturatedCellTightCut
unsigned int m_SaturatedCellTightCut
Definition: LArNoisyROTool.h:151
LArNoisyROTool::FEBEvtStat
Definition: LArNoisyROTool.h:77
HWIdentifier.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
LArNoisyROTool::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition: LArNoisyROTool.h:118
LArOnlineID
Definition: LArOnlineID.h:20
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
LArOnlineID_Base::isEMBchannel
bool isEMBchannel(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1648
LArNoisyROTool::FEBEvtStat::PAcounters
const unsigned int * PAcounters() const
Definition: LArNoisyROTool.h:98
LArNoisyROTool::LArNoisyROTool
LArNoisyROTool()
Default constructor:
SG::ReadCondHandleKey< LArOnOffIdMapping >
LArNoisyROTool::m_MNBLooseCut
unsigned int m_MNBLooseCut
Definition: LArNoisyROTool.h:156
ILArNoisyROTool
Definition: ILArNoisyROTool.h:29
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LArNoisyROTool::FEBEvtStat::m_PAcounters
unsigned int m_PAcounters[32]
Definition: LArNoisyROTool.h:101
LArNoisyROTool::m_SaturatedCellEnergyTightCut
float m_SaturatedCellEnergyTightCut
Definition: LArNoisyROTool.h:148
LArNoisyROTool::m_BadChanPerPA
unsigned int m_BadChanPerPA
Definition: LArNoisyROTool.h:130
LArNoisyROTool::finalize
virtual StatusCode finalize()
Definition: LArNoisyROTool.cxx:311
LArNoisyROTool::FEBEvtStatMap
std::unordered_map< unsigned int, FEBEvtStat > FEBEvtStatMap
Definition: LArNoisyROTool.h:108
LArNoisyROTool::FEBEvtStat::m_chanCounter
unsigned int m_chanCounter
Definition: LArNoisyROTool.h:100
LArNoisyROTool::interfaceID
static const InterfaceID & interfaceID()
IOVSvcDefs.h
defines and typedefs for IOVSvc
AthAlgTool
Definition: AthAlgTool.h:26
LArNoisyROTool::m_calo_id
const CaloCell_ID * m_calo_id
Definition: LArNoisyROTool.h:116
LArNoisyROTool::m_onlineID
const LArOnlineID * m_onlineID
Definition: LArNoisyROTool.h:117
LArOnlineID.h
LArNoisyROSummary
Summary information for noisy LAr preamp / FEBs.
Definition: LArNoisyROSummary.h:26
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20
LArNoisyROTool::m_MNBTight_PsVetoCut
std::vector< unsigned int > m_MNBTight_PsVetoCut
Definition: LArNoisyROTool.h:158