ATLAS Offline Software
Loading...
Searching...
No Matches
TileCisDefaultCalibTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 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
18
25
26#include "TString.h"
27#include <stdint.h>
28#include <string>
29#include <map>
30
31#define NBITS 10
32#define NBSTATUS 4
33
34// Forward declaration
35class TileHWID;
36class TileCablingSvc;
37class TFile;
38class TileInfo;
39class TMap;
40
42 , virtual public ITileCalibTool {
43
44 public:
45 TileCisDefaultCalibTool(const std::string& type, const std::string& name,
46 const IInterface* pParent);
48
49 virtual StatusCode initialize() override;
50 virtual StatusCode initNtuple(int runNumber, int runType, TFile * rootfile) override;
51 virtual StatusCode execute() override;
52 virtual StatusCode finalizeCalculations() override;
53 virtual StatusCode writeNtuple(int runNumber, int runType, TFile * rootfile) override;
54 virtual StatusCode finalize() override;
55
56 private:
57
58 // Bit definitions for calibration quality flag
72 // typedefs for maps
73 // dac map: uses dac value as key
74 typedef std::map<uint32_t, int> TDACIntMap;
75 typedef std::map<uint32_t, double> TDACDoubleMap;
76 typedef std::map<uint32_t, double>::iterator TDACDoubleMapIter;
77 // adc map: uses hwid as key
78 // values of these maps are dac maps
79 typedef std::map<HWIdentifier, TDACIntMap*> TAdcIntMap;
80 typedef std::map<HWIdentifier, TDACDoubleMap*> TAdcDoubleMap;
81 typedef std::map<HWIdentifier, TDACDoubleMap*>::iterator TAdcDoubleMapIter;
82
83 // Maps for number of events, mean, and rms:
84 // Fill these with "running" values, i.e. values are updated event-by-event,
89
90 // Tools / storegate info
94 ToolHandle<ITileStuckBitsProbsTool> m_stuckBitsProbs{this,
95 "StuckBitsProbsTool","","Tile stuck bits probabilities tool"};
96
99 "TileDigitsContainer", "TileDigitsCnt", "Tile digits container"};
101 "TileRawChannelContainer", "TileRawChannelFit", "Tile raw channel container"};
102 // jobOptions
104 std::string m_ntupleID;
106 // whether or not to use small capacitor, by default no
108
109 // remove pedestal events: should only be necessary for runs where
110 // pedestal triggers are mixed with CIS triggers
112
113 // expected maximal ped to set overflow limit (mostly needed for low gain)
114 double m_maxPed;
115
116 // phase range for calibration, by default use full range
119
120 // Maximum charge (gain-dependent) for filling dac map: not equivalent to charge range used in linear fit
121 // by default, fill low gain up to 800 pC, high gain up to 12.5 pC (25 pC for demonstrator)
126
127 // Range for linear fits: by default do high gain fit from 3-10 pC, and low gain from 300 - 700 pC
132
133 // Range for linear fits for demonstrator: by default do high gain fit from 6-20 pC, and low gain from 300 - 700 pC
138
140
142 // Results
145 int (*m_nDAC)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]; // This is now deprecated since you can get this form the TGraph
148
149 // These will not be saved to the ntuple
150 // They are for the sample check that gets written to qflag
151 // Mike Miller - 4 June 2009
154
155 // these arrays are used to contain information about stuck bits in adc's
156 // this array pertains to the "stuck bit" quality flag; it is not written to
157 // the ntuple
159 // This array contains information about each bit in the adc
160 // it IS written into the ntuple
162 // used to count the number of injection samples analyzed for odd bit behavior
164
167
168 double m_defaultCalib[4] = {0., 0., 0., 0.};
169 double m_dac2Charge[4] = {0., 0., 0., 0.};
170 double m_chargeMin[4] = {0., 0., 0., 0.};
171 double m_chargeMax[4] = {0., 0., 0., 0.};
172 double m_linfitMin[4] = {0., 0., 0., 0.};
173 double m_linfitMax[4] = {0., 0., 0., 0.};
174 double m_maxAmp[4] = {0., 0., 0., 0.};
175 std::vector<int> m_fragIDsDemonstrators;
176
177 // TileInfo
178 std::string m_infoName;
180
181 // Functions
182 inline int chanIsConnected(int ros, int chan) {
183 if (m_cabling->channel2hole(ros, chan) < 0) return 0; //negative means not connected
184 return 1;
185 }
186
187 inline void setBit(QualityType qb, int& bitflag) {
188 bitflag |= (1 << qb);
189 }
190
191 inline void unsetBit(QualityType qb, int& bitflag) {
192 bitflag &= ~(1 << qb);
193 }
194
195 inline TString arrayString(int ros, int drawer, int chan, int gain) {
196 TString str = "";
197 str += ros;
198 str += "_";
199 str += drawer;
200 str += "_";
201 str += chan;
202 str += "_";
203 str += gain;
204 return str;
205 }
206
207};
208
209#endif // #ifndef TILECALIBALG_TILECISDEFAULTCALIBTOOL_H
Property holding a SG store/key/clid from which a ReadHandle is made.
#define NBITS
#define NBSTATUS
Information produced by TileDQstatusAlg (used to be done by TileBeamInfoProvider).
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Property holding a SG store/key/clid from which a ReadHandle is made.
Static class providing several utility functions and constants.
static const unsigned int MAX_GAIN
Number of gains per channel.
static const unsigned int MAX_DRAWER
Number of drawers in ROS 1-4.
static const unsigned int MAX_CHAN
Number of channels in drawer.
int(* m_nextToEdgeSample)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
float(* m_calib)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
const TileCablingService * m_cabling
std::map< HWIdentifier, TDACDoubleMap * >::iterator TAdcDoubleMapIter
virtual StatusCode finalizeCalculations() override
std::vector< int > m_fragIDsDemonstrators
int(* m_sampleBit)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN][NBITS]
int(* m_qflag)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
std::map< uint32_t, int > TDACIntMap
SG::ReadHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
virtual StatusCode initialize() override
int(* m_numSamp)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
int(* m_nDAC)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
std::map< uint32_t, double >::iterator TDACDoubleMapIter
float(* m_chi2)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
void unsetBit(QualityType qb, int &bitflag)
int chanIsConnected(int ros, int chan)
int(* m_edgeSample)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
ServiceHandle< TileCablingSvc > m_cablingSvc
std::map< uint32_t, double > TDACDoubleMap
SG::ReadHandleKey< TileDQstatus > m_dqStatusKey
std::map< HWIdentifier, TDACIntMap * > TAdcIntMap
ToolHandle< ITileStuckBitsProbsTool > m_stuckBitsProbs
TString arrayString(int ros, int drawer, int chan, int gain)
void setBit(QualityType qb, int &bitflag)
unsigned short(* m_bitStatus)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN][NBSTATUS]
int(* m_nDigitalErrors)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
virtual StatusCode execute() override
std::map< HWIdentifier, TDACDoubleMap * > TAdcDoubleMap
virtual StatusCode finalize() override
virtual StatusCode writeNtuple(int runNumber, int runType, TFile *rootfile) override
TileCisDefaultCalibTool(const std::string &type, const std::string &name, const IInterface *pParent)
virtual StatusCode initNtuple(int runNumber, int runType, TFile *rootfile) override
SG::ReadHandleKey< TileDigitsContainer > m_digitsContainerKey
Helper class for TileCal online (hardware) identifiers.
Definition TileHWID.h:49
static std::vector< std::string > rootfile
Definition iLumiCalc.h:30