ATLAS Offline Software
TileCisDefaultCalibTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TILECALIBALG_TILECISDEFAULTCALIBTOOL_H
6 #define TILECALIBALG_TILECISDEFAULTCALIBTOOL_H
7 
8 // Gaudi includes
9 #include "GaudiKernel/ToolHandle.h"
10 #include "GaudiKernel/ServiceHandle.h"
11 
12 // Athena includes
15 
16 // Tile includes
19 #include "TileEvent/TileDQstatus.h"
26 
27 #include "TString.h"
28 #include <stdint.h>
29 #include <string>
30 #include <map>
31 
32 #define NBITS 10
33 #define NBSTATUS 4
34 
35 // Forward declaration
36 class TileHWID;
37 class TileCablingSvc;
38 class TFile;
40 class TMap;
41 
43  , virtual public ITileCalibTool {
44 
45  public:
46  TileCisDefaultCalibTool(const std::string& type, const std::string& name,
47  const IInterface* pParent);
48  virtual ~TileCisDefaultCalibTool();
49 
50  virtual StatusCode initialize() override;
51  virtual StatusCode initNtuple(int runNumber, int runType, TFile * rootfile) override;
52  virtual StatusCode execute() override;
53  virtual StatusCode finalizeCalculations() override;
54  virtual StatusCode writeNtuple(int runNumber, int runType, TFile * rootfile) override;
55  virtual StatusCode finalize() override;
56 
57  private:
58 
59  // Bit definitions for calibration quality flag
60  enum QualityType {
63  rangeBit = 2,
64  probBit = 3,
65  noiseBit = 4,
66  injRMSBit = 5,
69  edgeSamp = 8,
71  stuckbitBit = 10
72  };
73  // typedefs for maps
74  // dac map: uses dac value as key
75  typedef std::map<uint32_t, int> TDACIntMap;
76  typedef std::map<uint32_t, double> TDACDoubleMap;
78  // adc map: uses hwid as key
79  // values of these maps are dac maps
80  typedef std::map<HWIdentifier, TDACIntMap*> TAdcIntMap;
81  typedef std::map<HWIdentifier, TDACDoubleMap*> TAdcDoubleMap;
83 
84  // Maps for number of events, mean, and rms:
85  // Fill these with "running" values, i.e. values are updated event-by-event,
90 
91  // Tools / storegate info
95  ToolHandle<ITileStuckBitsProbsTool> m_stuckBitsProbs{this,
96  "StuckBitsProbsTool","","Tile stuck bits probabilities tool"};
97 
100  "TileDigitsContainer", "TileDigitsCnt", "Tile digits container"};
102  "TileRawChannelContainer", "TileRawChannelFit", "Tile raw channel container"};
103  // jobOptions
105  std::string m_ntupleID;
107  // whether or not to use small capacitor, by default no
109 
110  // remove pedestal events: should only be necessary for runs where
111  // pedestal triggers are mixed with CIS triggers
113 
114  // expected maximal ped to set overflow limit (mostly needed for low gain)
115  double m_maxPed;
116 
117  // phase range for calibration, by default use full range
118  double m_phaseMin;
119  double m_phaseMax;
120 
121  // Maximum charge (gain-dependent) for filling dac map: not equivalent to charge range used in linear fit
122  // by default, fill low gain up to 800 pC, high gain up to 12.5 pC (25 pC for demonstrator)
127 
128  // Range for linear fits: by default do high gain fit from 3-10 pC, and low gain from 300 - 700 pC
133 
134  // Range for linear fits for demonstrator: by default do high gain fit from 6-20 pC, and low gain from 300 - 700 pC
139 
141 
143  // Results
146  int (*m_nDAC)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]; // This is now deprecated since you can get this form the TGraph
149 
150  // These will not be saved to the ntuple
151  // They are for the sample check that gets written to qflag
152  // Mike Miller - 4 June 2009
155 
156  // these arrays are used to contain information about stuck bits in adc's
157  // this array pertains to the "stuck bit" quality flag; it is not written to
158  // the ntuple
160  // This array contains information about each bit in the adc
161  // it IS written into the ntuple
163  // used to count the number of injection samples analyzed for odd bit behavior
165 
166  TMap* m_scanMap;
168 
169  double m_defaultCalib[4] = {0., 0., 0., 0.};
170  double m_dac2Charge[4] = {0., 0., 0., 0.};
171  double m_chargeMin[4] = {0., 0., 0., 0.};
172  double m_chargeMax[4] = {0., 0., 0., 0.};
173  double m_linfitMin[4] = {0., 0., 0., 0.};
174  double m_linfitMax[4] = {0., 0., 0., 0.};
175  double m_maxAmp[4] = {0., 0., 0., 0.};
176  std::vector<int> m_fragIDsDemonstrators;
177 
178  // TileInfo
179  std::string m_infoName;
181 
182  // Functions
183  inline int chanIsConnected(int ros, int chan) {
184  if (m_cabling->channel2hole(ros, chan) < 0) return 0; //negative means not connected
185  return 1;
186  }
187 
188  inline void setBit(QualityType qb, int& bitflag) {
189  bitflag |= (1 << qb);
190  }
191 
192  inline void unsetBit(QualityType qb, int& bitflag) {
193  bitflag &= ~(1 << qb);
194  }
195 
196  inline TString arrayString(int ros, int drawer, int chan, int gain) {
197  TString str = "";
198  str += ros;
199  str += "_";
200  str += drawer;
201  str += "_";
202  str += chan;
203  str += "_";
204  str += gain;
205  return str;
206  }
207 
208 };
209 
210 #endif // #ifndef TILECALIBALG_TILECISDEFAULTCALIBTOOL_H
TileCisDefaultCalibTool::m_sampleBit
int(* m_sampleBit)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN][NBITS]
Definition: TileCisDefaultCalibTool.h:159
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
TileCisDefaultCalibTool::m_scanMap
TMap * m_scanMap
Definition: TileCisDefaultCalibTool.h:166
TileRawChannelContainer
Definition: TileRawChannelContainer.h:13
TileCisDefaultCalibTool::m_chi2
float(* m_chi2)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileCisDefaultCalibTool.h:148
xAOD::short
short
Definition: Vertex_v1.cxx:165
TileCisDefaultCalibTool::finalize
virtual StatusCode finalize() override
Definition: TileCisDefaultCalibTool.cxx:834
TileCisDefaultCalibTool::m_infoName
std::string m_infoName
Definition: TileCisDefaultCalibTool.h:179
TileCisDefaultCalibTool::m_cablingSvc
ServiceHandle< TileCablingSvc > m_cablingSvc
Definition: TileCisDefaultCalibTool.h:94
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
TileCisDefaultCalibTool::stuckbitBit
@ stuckbitBit
Definition: TileCisDefaultCalibTool.h:71
TileCisDefaultCalibTool::noiseBit
@ noiseBit
Definition: TileCisDefaultCalibTool.h:65
TileCisDefaultCalibTool::digiErrorBit
@ digiErrorBit
Definition: TileCisDefaultCalibTool.h:67
TileCisDefaultCalibTool::m_linfitMin
double m_linfitMin[4]
Definition: TileCisDefaultCalibTool.h:173
TileCisDefaultCalibTool::~TileCisDefaultCalibTool
virtual ~TileCisDefaultCalibTool()
Definition: TileCisDefaultCalibTool.cxx:93
TileCisDefaultCalibTool
Definition: TileCisDefaultCalibTool.h:43
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
TileCisDefaultCalibTool::m_dac2Charge
double m_dac2Charge[4]
Definition: TileCisDefaultCalibTool.h:170
ITileCalibTool
Definition: ITileCalibTool.h:19
TileInfo.h
TileCalibUtils.h
TileCisDefaultCalibTool::TAdcDoubleMapIter
std::map< HWIdentifier, TDACDoubleMap * >::iterator TAdcDoubleMapIter
Definition: TileCisDefaultCalibTool.h:82
TileInfo
Definition: TileInfo.h:49
TileCisDefaultCalibTool::m_linfitMinHiDemo
double m_linfitMinHiDemo
Definition: TileCisDefaultCalibTool.h:136
TileCisDefaultCalibTool::m_dqStatusKey
SG::ReadHandleKey< TileDQstatus > m_dqStatusKey
Definition: TileCisDefaultCalibTool.h:98
SG::ReadHandleKey< TileDQstatus >
TileCisDefaultCalibTool::m_nDigitalErrors
int(* m_nDigitalErrors)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileCisDefaultCalibTool.h:147
TileCisDefaultCalibTool::m_DigitsContainerName
std::string m_DigitsContainerName
Definition: TileCisDefaultCalibTool.h:106
LArCalib_HVScale2NtupleConfig.rootfile
string rootfile
Definition: LArCalib_HVScale2NtupleConfig.py:74
TileCisDefaultCalibTool::m_chargeMinLo
double m_chargeMinLo
Definition: TileCisDefaultCalibTool.h:126
TileCisDefaultCalibTool::m_defaultCalib
double m_defaultCalib[4]
Definition: TileCisDefaultCalibTool.h:169
NBITS
#define NBITS
Definition: TileCisDefaultCalibTool.h:32
TileCisDefaultCalibTool::m_MeanMap
TAdcDoubleMap m_MeanMap
Definition: TileCisDefaultCalibTool.h:88
TileCisDefaultCalibTool::QualityType
QualityType
Definition: TileCisDefaultCalibTool.h:60
TileCisDefaultCalibTool::m_linfitMaxLo
double m_linfitMaxLo
Definition: TileCisDefaultCalibTool.h:131
Example_ReadSampleNoise.drawer
drawer
Definition: Example_ReadSampleNoise.py:39
TileCisDefaultCalibTool::m_linfitMaxHiDemo
double m_linfitMaxHiDemo
Definition: TileCisDefaultCalibTool.h:135
TileCisDefaultCalibTool::probBit
@ probBit
Definition: TileCisDefaultCalibTool.h:64
TileCisDefaultCalibTool::m_stuckBitsProbs
ToolHandle< ITileStuckBitsProbsTool > m_stuckBitsProbs
Definition: TileCisDefaultCalibTool.h:95
TileCalibUtils::MAX_DRAWER
static const unsigned int MAX_DRAWER
Number of drawers in ROS 1-4.
Definition: TileCalibUtils.h:139
TileCisDefaultCalibTool::m_calib
float(* m_calib)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileCisDefaultCalibTool.h:144
TileRawChannelContainer.h
TileCisDefaultCalibTool::rangeBit
@ rangeBit
Definition: TileCisDefaultCalibTool.h:63
TileCisDefaultCalibTool::m_linfitMinHi
double m_linfitMinHi
Definition: TileCisDefaultCalibTool.h:130
ITileCalibTool.h
TileHWID
Helper class for TileCal online (hardware) identifiers.
Definition: TileHWID.h:49
TileCisDefaultCalibTool::m_linfitMinLo
double m_linfitMinLo
Definition: TileCisDefaultCalibTool.h:132
TileCisDefaultCalibTool::TileCisDefaultCalibTool
TileCisDefaultCalibTool(const std::string &type, const std::string &name, const IInterface *pParent)
Definition: TileCisDefaultCalibTool.cxx:35
TileCisDefaultCalibTool::m_chargeMaxLo
double m_chargeMaxLo
Definition: TileCisDefaultCalibTool.h:125
Tile
Definition: TileVolumeBuilder.h:43
TileCisDefaultCalibTool::m_cabling
const TileCablingService * m_cabling
Definition: TileCisDefaultCalibTool.h:93
TileCisDefaultCalibTool::m_edgeSample
int(* m_edgeSample)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileCisDefaultCalibTool.h:153
TileCisDefaultCalibTool::TAdcDoubleMap
std::map< HWIdentifier, TDACDoubleMap * > TAdcDoubleMap
Definition: TileCisDefaultCalibTool.h:81
TileCablingService.h
TileCablingSvc
Definition: TileCablingSvc.h:29
TileCisDefaultCalibTool::m_linfitMaxLoDemo
double m_linfitMaxLoDemo
Definition: TileCisDefaultCalibTool.h:137
TileCisDefaultCalibTool::m_maxPed
double m_maxPed
Definition: TileCisDefaultCalibTool.h:115
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
TileCisDefaultCalibTool::m_maxAmp
double m_maxAmp[4]
Definition: TileCisDefaultCalibTool.h:175
TileDigitsContainer.h
TileCisDefaultCalibTool::m_removePed
bool m_removePed
Definition: TileCisDefaultCalibTool.h:112
TileCisDefaultCalibTool::m_linfitMax
double m_linfitMax[4]
Definition: TileCisDefaultCalibTool.h:174
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
TileCisDefaultCalibTool::m_tileHWID
const TileHWID * m_tileHWID
Definition: TileCisDefaultCalibTool.h:92
TileCisDefaultCalibTool::TDACDoubleMap
std::map< uint32_t, double > TDACDoubleMap
Definition: TileCisDefaultCalibTool.h:76
TileCisDefaultCalibTool::m_NEvtMap
TAdcIntMap m_NEvtMap
Definition: TileCisDefaultCalibTool.h:86
TileCisDefaultCalibTool::m_nDAC
int(* m_nDAC)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileCisDefaultCalibTool.h:146
TileCisDefaultCalibTool::chanIsConnected
int chanIsConnected(int ros, int chan)
Definition: TileCisDefaultCalibTool.h:183
TileCisDefaultCalibTool::writeNtuple
virtual StatusCode writeNtuple(int runNumber, int runType, TFile *rootfile) override
Definition: TileCisDefaultCalibTool.cxx:802
TileCisDefaultCalibTool::probChi2Bit
@ probChi2Bit
Definition: TileCisDefaultCalibTool.h:68
maskDeadModules.ros
ros
Definition: maskDeadModules.py:35
TileCablingService
Definition: TileCablingService.h:23
TileDQstatus.h
Information produced by TileDQstatusAlg (used to be done by TileBeamInfoProvider).
TileCisDefaultCalibTool::initialize
virtual StatusCode initialize() override
Definition: TileCisDefaultCalibTool.cxx:108
python.OnlineISConfiguration.runType
def runType
Definition: OnlineISConfiguration.py:112
NBSTATUS
#define NBSTATUS
Definition: TileCisDefaultCalibTool.h:33
TileCisDefaultCalibTool::m_chargeMin
double m_chargeMin[4]
Definition: TileCisDefaultCalibTool.h:171
TileCisDefaultCalibTool::m_useSmallCap
bool m_useSmallCap
Definition: TileCisDefaultCalibTool.h:108
TileCisDefaultCalibTool::m_rawChannelContainerKey
SG::ReadHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
Definition: TileCisDefaultCalibTool.h:101
TileCisDefaultCalibTool::nextToEdgeSamp
@ nextToEdgeSamp
Definition: TileCisDefaultCalibTool.h:70
TileCisDefaultCalibTool::m_digitsContainerKey
SG::ReadHandleKey< TileDigitsContainer > m_digitsContainerKey
Definition: TileCisDefaultCalibTool.h:99
HWIdentifier.h
TileCisDefaultCalibTool::includedBit
@ includedBit
Definition: TileCisDefaultCalibTool.h:61
TileCisDefaultCalibTool::m_bitStatus
unsigned short(* m_bitStatus)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN][NBSTATUS]
Definition: TileCisDefaultCalibTool.h:162
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TileCisDefaultCalibTool::m_chargeMaxHi
double m_chargeMaxHi
Definition: TileCisDefaultCalibTool.h:123
TileCisDefaultCalibTool::initNtuple
virtual StatusCode initNtuple(int runNumber, int runType, TFile *rootfile) override
Definition: TileCisDefaultCalibTool.cxx:189
TileCisDefaultCalibTool::m_scanMapRMS
TMap * m_scanMapRMS
Definition: TileCisDefaultCalibTool.h:167
TileCisDefaultCalibTool::m_ntupleID
std::string m_ntupleID
Definition: TileCisDefaultCalibTool.h:105
TileCisDefaultCalibTool::m_rawChannelContainerName
std::string m_rawChannelContainerName
Definition: TileCisDefaultCalibTool.h:104
TileCisDefaultCalibTool::m_fragIDsDemonstrators
std::vector< int > m_fragIDsDemonstrators
Definition: TileCisDefaultCalibTool.h:176
TileCisDefaultCalibTool::TDACDoubleMapIter
std::map< uint32_t, double >::iterator TDACDoubleMapIter
Definition: TileCisDefaultCalibTool.h:77
TileCisDefaultCalibTool::m_NDigitalErrorsMap
TAdcIntMap m_NDigitalErrorsMap
Definition: TileCisDefaultCalibTool.h:87
TileCisDefaultCalibTool::m_nextToEdgeSample
int(* m_nextToEdgeSample)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileCisDefaultCalibTool.h:154
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
TileCisDefaultCalibTool::unsetBit
void unsetBit(QualityType qb, int &bitflag)
Definition: TileCisDefaultCalibTool.h:192
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
TileCisDefaultCalibTool::m_chargeMinHi
double m_chargeMinHi
Definition: TileCisDefaultCalibTool.h:124
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TileCisDefaultCalibTool::m_phaseMax
double m_phaseMax
Definition: TileCisDefaultCalibTool.h:119
TileCablingService::channel2hole
static int channel2hole(int ros, int channel)
Definition: TileCablingService.cxx:1946
python.Classes.TileCalibUtils
TileCalibUtils
Definition: TileCalib/TileCalibBlobObjs/python/Classes.py:5
TileCisDefaultCalibTool::finalizeCalculations
virtual StatusCode finalizeCalculations() override
Definition: TileCisDefaultCalibTool.cxx:405
TileCisDefaultCalibTool::m_doSampleChecking
bool m_doSampleChecking
Definition: TileCisDefaultCalibTool.h:140
ITileStuckBitsProbsTool.h
TileCisDefaultCalibTool::injRMSBit
@ injRMSBit
Definition: TileCisDefaultCalibTool.h:66
TileCisDefaultCalibTool::setBit
void setBit(QualityType qb, int &bitflag)
Definition: TileCisDefaultCalibTool.h:188
TileCisDefaultCalibTool::TAdcIntMap
std::map< HWIdentifier, TDACIntMap * > TAdcIntMap
Definition: TileCisDefaultCalibTool.h:80
str
Definition: BTagTrackIpAccessor.cxx:11
TileCisDefaultCalibTool::arrayString
TString arrayString(int ros, int drawer, int chan, int gain)
Definition: TileCisDefaultCalibTool.h:196
TileCisDefaultCalibTool::edgeSamp
@ edgeSamp
Definition: TileCisDefaultCalibTool.h:69
TileCisDefaultCalibTool::execute
virtual StatusCode execute() override
Definition: TileCisDefaultCalibTool.cxx:195
AthAlgTool
Definition: AthAlgTool.h:26
TileCalibUtils::MAX_CHAN
static const unsigned int MAX_CHAN
Number of channels in drawer.
Definition: TileCalibUtils.h:141
TileCisDefaultCalibTool::TDACIntMap
std::map< uint32_t, int > TDACIntMap
Definition: TileCisDefaultCalibTool.h:75
TileCisDefaultCalibTool::m_tileInfo
const TileInfo * m_tileInfo
Definition: TileCisDefaultCalibTool.h:180
TileCisDefaultCalibTool::m_phaseMin
double m_phaseMin
Definition: TileCisDefaultCalibTool.h:118
TileCisDefaultCalibTool::m_linfitMinLoDemo
double m_linfitMinLoDemo
Definition: TileCisDefaultCalibTool.h:138
TileCisDefaultCalibTool::m_chargeMax
double m_chargeMax[4]
Definition: TileCisDefaultCalibTool.h:172
TileCisDefaultCalibTool::m_qflag
int(* m_qflag)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileCisDefaultCalibTool.h:145
readCCLHist.float
float
Definition: readCCLHist.py:83
TileCisDefaultCalibTool::calibratedBit
@ calibratedBit
Definition: TileCisDefaultCalibTool.h:62
TileCisDefaultCalibTool::m_MeanSqMap
TAdcDoubleMap m_MeanSqMap
Definition: TileCisDefaultCalibTool.h:89
TileCisDefaultCalibTool::m_numSamp
int(* m_numSamp)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileCisDefaultCalibTool.h:164
ServiceHandle< TileCablingSvc >
TileCisDefaultCalibTool::m_linfitMaxHi
double m_linfitMaxHi
Definition: TileCisDefaultCalibTool.h:129
TileCalibUtils::MAX_GAIN
static const unsigned int MAX_GAIN
Number of gains per channel
Definition: TileCalibUtils.h:142