ATLAS Offline Software
Loading...
Searching...
No Matches
CaloEstimatedGainTool Class Reference

#include <CaloEstimatedGainTool.h>

Inheritance diagram for CaloEstimatedGainTool:
Collaboration diagram for CaloEstimatedGainTool:

Public Types

typedef ICaloEstimatedGainTool::Step Step

Public Member Functions

virtual StatusCode initialize () override
virtual CaloGain::CaloGain estimatedGain (const EventContext &ctx, const CaloCell &caloCell, const Step step) const override
virtual CaloGain::CaloGain estimatedGain (const EventContext &ctx, const CaloCell &caloCell, const CaloDetDescrElement &caloDDE, const Step step) const override
virtual CaloGain::CaloGain estimatedGain (const EventContext &ctx, const CaloDetDescrElement &caloDDE, const float energy, const Step step) const override

Private Member Functions

CaloGain::CaloGain estimatedLArGain (const EventContext &ctx, const CaloCell_ID::SUBCALO iCalo, const CaloDetDescrElement &caloDDE, const float energy, const Step step) const
CaloGain::CaloGain estimatedTileGain (const EventContext &ctx, const CaloCell &caloCell, const CaloDetDescrElement &caloDDE, const Step) const
float adc2mev (const EventContext &ctx, const CaloDetDescrElement &caloDDE, const CaloGain::CaloGain gain) const

Private Attributes

SG::ReadCondHandleKey< LArADC2MeVm_adc2mevKey { this, "ADC2MeVKey", "LArADC2MeV", "SG Key of the LArADC2MeV CDO" }
float m_LowGainThresh [m_nCalos] = {0}
float m_HighGainThresh [m_nCalos] = {0}
const LArEM_IDm_lar_em_id = nullptr
const TileInfom_tileInfo
ToolHandle< TileCondIdTransformsm_tileIdTransforms
ToolHandle< TileCondToolEmscalem_tileToolEmscale
ToolHandle< TileCondToolNoiseSamplem_tileToolNoiseSample

Static Private Attributes

static const int m_nCalos =4

Detailed Description

Definition at line 32 of file CaloEstimatedGainTool.h.

Member Typedef Documentation

◆ Step

Member Function Documentation

◆ adc2mev()

float CaloEstimatedGainTool::adc2mev ( const EventContext & ctx,
const CaloDetDescrElement & caloDDE,
const CaloGain::CaloGain gain ) const
private

Definition at line 240 of file CaloEstimatedGainTool.cxx.

243{
244 SG::ReadCondHandle adc2mev (m_adc2mevKey, ctx);
245 const auto& p = adc2mev->ADC2MEV (caloDDE.identify(), gain);
246 if (p.size() >= 2) {
247 return p[1];
248 }
249 return 0;
250}
Identifier identify() const override final
cell identifier
float adc2mev(const EventContext &ctx, const CaloDetDescrElement &caloDDE, const CaloGain::CaloGain gain) const
SG::ReadCondHandleKey< LArADC2MeV > m_adc2mevKey

◆ estimatedGain() [1/3]

CaloGain::CaloGain CaloEstimatedGainTool::estimatedGain ( const EventContext & ctx,
const CaloCell & caloCell,
const CaloDetDescrElement & caloDDE,
const Step step ) const
overridevirtual

Definition at line 58 of file CaloEstimatedGainTool.cxx.

62{
63 CaloCell_ID::SUBCALO iCalo = caloDDE.getSubCalo();
64
65 if (iCalo == CaloCell_ID::LAREM ||
66 iCalo == CaloCell_ID::LARHEC ||
67 iCalo == CaloCell_ID::LARFCAL)
68 {
69 return estimatedLArGain (ctx, iCalo, caloDDE, caloCell.energy(), step);
70 }
71 else if (iCalo == CaloCell_ID::TILE)
72 {
73 return estimatedTileGain (ctx, caloCell, caloDDE, step);
74 }
75 else
76 {
77 ATH_MSG_WARNING("CaloEstimatedGainTool::estimatedGain wrong id ! "
78 << m_lar_em_id->show_to_string (caloDDE.identify()) );
80 }
81}
#define ATH_MSG_WARNING(x)
CaloCell_Base_ID::SUBCALO SUBCALO
Definition CaloCell_ID.h:50
double energy() const
get energy (data member)
Definition CaloCell.h:327
CaloGain::CaloGain estimatedLArGain(const EventContext &ctx, const CaloCell_ID::SUBCALO iCalo, const CaloDetDescrElement &caloDDE, const float energy, const Step step) const
CaloGain::CaloGain estimatedTileGain(const EventContext &ctx, const CaloCell &caloCell, const CaloDetDescrElement &caloDDE, const Step) const
@ INVALIDGAIN
Definition CaloGain.h:18

◆ estimatedGain() [2/3]

CaloGain::CaloGain CaloEstimatedGainTool::estimatedGain ( const EventContext & ctx,
const CaloCell & caloCell,
const Step step ) const
overridevirtual

Definition at line 49 of file CaloEstimatedGainTool.cxx.

52{
53 return estimatedGain (ctx, caloCell, *caloCell.caloDDE(), step);
54}
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition CaloCell.h:321
virtual CaloGain::CaloGain estimatedGain(const EventContext &ctx, const CaloCell &caloCell, const Step step) const override

◆ estimatedGain() [3/3]

CaloGain::CaloGain CaloEstimatedGainTool::estimatedGain ( const EventContext & ctx,
const CaloDetDescrElement & caloDDE,
const float energy,
const Step step ) const
overridevirtual

Definition at line 85 of file CaloEstimatedGainTool.cxx.

89{
90 CaloCell_ID::SUBCALO iCalo = caloDDE.getSubCalo();
91
92 if (iCalo == CaloCell_ID::LAREM ||
93 iCalo == CaloCell_ID::LARHEC ||
94 iCalo == CaloCell_ID::LARFCAL)
95 {
96 return estimatedLArGain (ctx, iCalo, caloDDE, energy, step);
97 }
98 else if (iCalo == CaloCell_ID::TILE)
99 {
100 ATH_MSG_WARNING("CaloEstimatedGainTool::estimatedGain NOT IMPLEMENTED FOR TILE "
101 <<"with these arguments! "
102 << m_lar_em_id->show_to_string (caloDDE.identify()) );
104 }
105 else
106 {
107 ATH_MSG_WARNING("CaloEstimatedGainTool::estimatedGain wrong id ! "
108 << m_lar_em_id->show_to_string (caloDDE.identify()) );
110 }
111}

◆ estimatedLArGain()

CaloGain::CaloGain CaloEstimatedGainTool::estimatedLArGain ( const EventContext & ctx,
const CaloCell_ID::SUBCALO iCalo,
const CaloDetDescrElement & caloDDE,
const float energy,
const Step step ) const
private

Definition at line 115 of file CaloEstimatedGainTool.cxx.

120{
121 //returns the gain of a cell according to the energy
122 //(converts in ADC counts in MediumGain and uses thresholds in ADC counts
123 //to determine the gain)
124
125 // the function could be called before (step=0, RawChannels)
126 // or after (step=1, Cells) LArG3Escale
127
129
130 //--EM/HEC--
131 if( iCalo == CaloCell_ID::LAREM ||
132 iCalo == CaloCell_ID::LARHEC ||
133 iCalo == CaloCell_ID::LARFCAL )
134 {
135 //We choose the gain in applying thresholds on the energy
136 //converted in ADC counts in MediumGain (index "1" of adc2mev(id,1)).
137 //Indeed, thresholds in ADC counts are defined with respect
138 //to the MediumGain.
139 //
140 // 1300 3900
141 // ---------------|----------------|-------------> ADC counts in MediumGain
142 // HighGain <--- MediumGain ---> LowGain
143
144 float adc=0.;
145
146 if (step == Step::CELLS || //Cells (with E scale and weights from LArG3Escale)
147 step == Step::RAWCHANNELS) //RawChannels
148 {
149 float fac = adc2mev (ctx, caloDDE, CaloGain::LARMEDIUMGAIN);
150 if (fac != 0) {
151 adc = energy / fac + 1000;
152 }
153 }
154 else
155 {
156 ATH_MSG_WARNING( "CaloEstimatedGainTool::estimatedGain wrong step" );
157 }
158
159 if (adc < m_HighGainThresh[iCalo]) igain = CaloGain::LARHIGHGAIN;
160 else if (adc > m_LowGainThresh[iCalo]) igain = CaloGain::LARLOWGAIN;
162 }
163
164 return igain;
165}
@ LARMEDIUMGAIN
Definition CaloGain.h:18
@ LARLOWGAIN
Definition CaloGain.h:18
@ LARHIGHGAIN
Definition CaloGain.h:18

◆ estimatedTileGain()

CaloGain::CaloGain CaloEstimatedGainTool::estimatedTileGain ( const EventContext & ctx,
const CaloCell & caloCell,
const CaloDetDescrElement & caloDDE,
const Step  ) const
private

Definition at line 169 of file CaloEstimatedGainTool.cxx.

173{
174 const TileCell& tileCell = dynamic_cast<const TileCell&> (caloCell);
175
176 // threshold (1023 counts) is the same for all channels
177 double threshold = m_tileInfo->ADCmax();
178
179 // xxx
180 static TileHWID const * const tileHWID = TileCablingService::getInstance()->getTileHWID();
181 static const IdContext chContext = tileHWID->channel_context();
182
183 HWIdentifier hwid1;
184 tileHWID->get_id (caloDDE.onl1(), hwid1, &chContext ); // pmt id
185 hwid1 = tileHWID->adc_id (hwid1, TileHWID::HIGHGAIN); // high gain ADC id
186
187 unsigned int drawerIdx1(0), channel1(0), adc1(0);
188 m_tileIdTransforms->getIndices (hwid1, drawerIdx1, channel1, adc1);
189
190 // first PMT, convert energy to ADC counts
191 double amplitude1 = tileCell.ene1();
192 amplitude1 /= m_tileToolEmscale->channelCalib (drawerIdx1, channel1, adc1, 1.0,
195
196 double pedestal1 = m_tileToolNoiseSample->getPed (drawerIdx1, channel1, adc1, TileRawChannelUnit::ADCcounts, ctx);
197
198 int igain1;
199
200 if (amplitude1 + pedestal1 < threshold ) {
201 igain1 = TileID::HIGHGAIN;
202 } else {
203 igain1 = TileID::LOWGAIN;
204 }
205
206 // second PMT, if it exists
207 if (caloDDE.onl2() != TileID::NOT_VALID_HASH ) {
208
209 HWIdentifier hwid2;
210 tileHWID->get_id( caloDDE.onl2(), hwid2, &chContext ); // pmt id
211 hwid2 = tileHWID->adc_id (hwid2, TileHWID::HIGHGAIN); // high gain ADC id
212
213 unsigned int drawerIdx2(0), channel2(0), adc2(0);
214 m_tileIdTransforms->getIndices (hwid2, drawerIdx2, channel2, adc2);
215
216 // first PMT, convert energy to ADC counts
217 double amplitude2 = tileCell.ene2();
218 amplitude2 /= m_tileToolEmscale->channelCalib (drawerIdx2, channel2, adc2, 1.0,
221
222 double pedestal2 = m_tileToolNoiseSample->getPed (drawerIdx2, channel2, adc2, TileRawChannelUnit::ADCcounts, ctx);
223
224 if (amplitude2 + pedestal2 < threshold) {
225 // igain2 high
227 } else {
228 // igain2 low
230 }
231 // nb. Having HIGHLOW in two places seems wrong, but that's what the
232 // original code was doing.
233 }
234
235 // igain2 doesn't exist.
237}
IdentifierHash onl2() const
cell online identifier 2
IdentifierHash onl1() const
cell online identifier 1
ToolHandle< TileCondIdTransforms > m_tileIdTransforms
ToolHandle< TileCondToolNoiseSample > m_tileToolNoiseSample
ToolHandle< TileCondToolEmscale > m_tileToolEmscale
const TileHWID * getTileHWID() const
static const TileCablingService * getInstance()
get pointer to service instance
float ene1(void) const
get energy of first PMT
Definition TileCell.h:187
float ene2(void) const
get energy of second PMT
Definition TileCell.h:189
@ HIGHGAIN
Definition TileHWID.h:73
virtual int get_id(const IdentifierHash &hash_id, HWIdentifier &id, const IdContext *context=0) const
create compact HW ID from hash id (return == 0 for OK)
Definition TileHWID.cxx:491
IdContext channel_context() const
idContext for channels
Definition TileHWID.cxx:478
HWIdentifier adc_id(int ros, int drawer, int channel, int adc) const
adc HWIdentifer
Definition TileHWID.cxx:229
@ TILELOWLOW
Definition CaloGain.h:12
@ TILEONEHIGH
Definition CaloGain.h:17
@ TILEONELOW
Definition CaloGain.h:16
@ TILEHIGHLOW
Definition CaloGain.h:14
@ TILEHIGHHIGH
Definition CaloGain.h:15

◆ initialize()

StatusCode CaloEstimatedGainTool::initialize ( )
overridevirtual

Definition at line 21 of file CaloEstimatedGainTool.cxx.

22{
23 m_LowGainThresh[CaloCell_ID::LAREM] = 3900;//ADC counts in MediumGain
24 m_HighGainThresh[CaloCell_ID::LAREM] = 1300;//ADC counts in MediumGain
25 m_LowGainThresh[CaloCell_ID::LARHEC] = 2500;//ADC counts in MediumGain
26 m_HighGainThresh[CaloCell_ID::LARHEC] = 0;//-> high-gain never used for HEC
27 m_LowGainThresh[CaloCell_ID::LARFCAL] = 2000.;//ADC counts
28 m_HighGainThresh[CaloCell_ID::LARFCAL] = 1100.;//ADC counts
31
32 const CaloCell_ID* calocell_id;
33 ATH_CHECK( detStore()->retrieve (calocell_id, "CaloCell_ID") );
34 m_lar_em_id = calocell_id->em_idHelper();
35
36 ATH_CHECK( detStore()->retrieve (m_tileInfo, "TileInfo") );
37
38 ATH_CHECK( m_tileIdTransforms.retrieve() );
39 ATH_CHECK( m_tileToolEmscale.retrieve() );
40 ATH_CHECK( m_tileToolNoiseSample.retrieve() );
41
42 ATH_CHECK( m_adc2mevKey.initialize() );
43
44 return StatusCode::SUCCESS;
45}
#define ATH_CHECK
Evaluate an expression and check for errors.
const LArEM_ID * em_idHelper() const
access to EM idHelper
Definition CaloCell_ID.h:63

Member Data Documentation

◆ m_adc2mevKey

SG::ReadCondHandleKey<LArADC2MeV> CaloEstimatedGainTool::m_adc2mevKey { this, "ADC2MeVKey", "LArADC2MeV", "SG Key of the LArADC2MeV CDO" }
private

Definition at line 78 of file CaloEstimatedGainTool.h.

79{ this, "ADC2MeVKey", "LArADC2MeV", "SG Key of the LArADC2MeV CDO" };

◆ m_HighGainThresh

float CaloEstimatedGainTool::m_HighGainThresh[m_nCalos] = {0}
private

Definition at line 85 of file CaloEstimatedGainTool.h.

85{0};

◆ m_lar_em_id

const LArEM_ID* CaloEstimatedGainTool::m_lar_em_id = nullptr
private

Definition at line 87 of file CaloEstimatedGainTool.h.

◆ m_LowGainThresh

float CaloEstimatedGainTool::m_LowGainThresh[m_nCalos] = {0}
private

Definition at line 84 of file CaloEstimatedGainTool.h.

84{0};

◆ m_nCalos

const int CaloEstimatedGainTool::m_nCalos =4
staticprivate

Definition at line 82 of file CaloEstimatedGainTool.h.

◆ m_tileIdTransforms

ToolHandle<TileCondIdTransforms> CaloEstimatedGainTool::m_tileIdTransforms
private
Initial value:
{ this, "TileCondIdTransforms", "TileCondIdTransforms",
"Tile tool to translate hardware identifiers to the drawerIdx, channel, and adc" }

Definition at line 90 of file CaloEstimatedGainTool.h.

91 { this, "TileCondIdTransforms", "TileCondIdTransforms",
92 "Tile tool to translate hardware identifiers to the drawerIdx, channel, and adc" };

◆ m_tileInfo

const TileInfo* CaloEstimatedGainTool::m_tileInfo
private

Definition at line 88 of file CaloEstimatedGainTool.h.

◆ m_tileToolEmscale

ToolHandle<TileCondToolEmscale> CaloEstimatedGainTool::m_tileToolEmscale
private
Initial value:
{ this, "TileCondToolEmscale", "TileCondToolEmscale",
"Tile EM scale calibration tool" }

Definition at line 94 of file CaloEstimatedGainTool.h.

95 { this, "TileCondToolEmscale", "TileCondToolEmscale",
96 "Tile EM scale calibration tool" };

◆ m_tileToolNoiseSample

ToolHandle<TileCondToolNoiseSample> CaloEstimatedGainTool::m_tileToolNoiseSample
private
Initial value:
{ this, "TileCondToolNoiseSample", "TileCondToolNoiseSample",
"Tile sample noise tool" }

Definition at line 98 of file CaloEstimatedGainTool.h.

99 { this, "TileCondToolNoiseSample", "TileCondToolNoiseSample",
100 "Tile sample noise tool" };

The documentation for this class was generated from the following files: