ATLAS Offline Software
LArRawChannelBuilderADC2EConstants.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
8 
10 #include "Identifier/Identifier.h"
11 
12 using CLHEP::MeV;
13 
15  const std::string& name,
16  const IInterface* parent):
18  m_emId(nullptr),
19  m_fcalId(nullptr),
20  m_hecId(nullptr)
21 {
22  m_helper = new LArRawChannelBuilderStatistics( 1, // number of possible errors
23  0x10); // bit pattern special for this tool,
24  // to be stored in "uint16_t provenance"
25  m_helper->setErrorString(0, "no errors");
26 }
27 
29 {
30  const CaloCell_ID* idHelper = nullptr;
31  ATH_CHECK( detStore()->retrieve (idHelper, "CaloCell_ID") );
32  m_emId=idHelper->em_idHelper();
33  m_fcalId=idHelper->fcal_idHelper();
34  m_hecId=idHelper->hec_idHelper();
35 
36  return StatusCode::SUCCESS;
37 }
38 
39 bool
40 LArRawChannelBuilderADC2EConstants::ADC2E(const EventContext& /*ctx*/,
41  std::vector<float>& Ramps, MsgStream* pLog)
42 {
43  Ramps.resize(2, 0);
44  Ramps[0]=0;
45  Ramps[1]=1;
46 
47  float GainFactor;
49  GainFactor = 9.8*9.8;
50  } else if (m_parent->curr_gain == CaloGain::LARMEDIUMGAIN ) {
51  GainFactor = 9.8;
52  } else if (m_parent->curr_gain == CaloGain::LARHIGHGAIN ) {
53  GainFactor = 1.0;
54  } else {
55  GainFactor = 1.0;
56  if(bool(pLog))
57  (*pLog) << MSG::WARNING << "Channel " << std::hex << m_parent->curr_chid << std::dec
58  << "unknown gain: " << m_parent->curr_gain << endmsg;
59  }
60  Ramps[1]*=GainFactor;
61 
62  Identifier id=currentID();
63 
64  float ADCtoMeVFCAL[3];
65  float ADCtoMeVHEC[2];
66  float ADCtoMeVEMECInner[2];
67  float ADCtoMeVEMECOuter[2];
68  float ADCtoMeVEMB[4];
69  ADCtoMeVFCAL[0] = 87.0 * MeV; // FCAL1 High gain
70  ADCtoMeVFCAL[1] = 117.0 * MeV; // FCAL2 High gain
71  ADCtoMeVFCAL[2] = 193.0 * MeV; // FCAL3 High gain
72  ADCtoMeVHEC[0] = 136.0 / 9.8 * MeV; // HEC 1 Medium gain from Monika.
73  ADCtoMeVHEC[1] = 136.0 / 9.8 * MeV; // HEC 2 Medium gain from Monika.
74  ADCtoMeVEMECInner[0] = 20.0 * MeV; // EMEC High gain : fixed 18/8/2004 RMcP
75  ADCtoMeVEMECInner[1] = 20.0 * MeV; // EMEC High gain : fixed 18/8/2004 RMcP
76  ADCtoMeVEMECOuter[0] = 16.0 * MeV; // EMEC High gain from Monika, approximate
77  ADCtoMeVEMECOuter[1] = 16.0 * MeV; // EMEC High gain from Monika, approximate
78  ADCtoMeVEMB[0] = 7.0 * MeV; // EMB High gain from Isabelle, approximate
79  ADCtoMeVEMB[1] = 2.5 * MeV; // EMB High gain from Isabelle, approximate
80  ADCtoMeVEMB[2] = 18.0 * MeV; // EMB High gain from Isabelle, approximate
81  ADCtoMeVEMB[3] = 9.0 * MeV; // EMB High gain from Isabelle, approximate
82 
83  if (m_emId->is_em_barrel(id)) {
84  const int layer= m_emId->sampling(id);
85  const int eta=m_emId->eta(id);
86  Ramps[1] *= ADCtoMeVEMB[layer];
87  if (layer==2 && eta<32)
88  Ramps[1] *= (12./18.); //Correct for lead thickness
89  } else if (m_emId->is_em_endcap_inner(id)) {
90  Ramps[1] *= ADCtoMeVEMECInner[m_emId->sampling(id)-1];
91  } else if (m_emId->is_em_endcap_outer(id)) {
92  Ramps[1] *= ADCtoMeVEMECOuter[m_emId->sampling(id)-1];
93  } else if (m_fcalId->is_lar_fcal(id)) {
94  Ramps[1] *= ADCtoMeVFCAL[m_fcalId->module(id)-1];
95  } else if (m_hecId->is_lar_hec(id)) {
96  Ramps[1] *= ADCtoMeVHEC[0];
97  }
98  // (*pLog) << MSG::VERBOSE << "ADC2EConstants tool - energy : " << energy << endmsg;
101 
102  return true;
103 }
104 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
LArRawChannelBuilderParams::curr_gain
CaloGain::CaloGain curr_gain
Definition: LArRawChannelBuilderParams.h:25
LArRawChannelBuilderADC2EConstants::m_emId
const LArEM_Base_ID * m_emId
Definition: LArRawChannelBuilderADC2EConstants.h:38
CaloCell_ID::em_idHelper
const LArEM_ID * em_idHelper() const
access to EM idHelper
Definition: CaloCell_ID.h:63
AtlasDetectorID::is_lar_fcal
bool is_lar_fcal(Identifier id) const
Definition: AtlasDetectorID.h:839
LArRawChannelBuilderADC2EConstants::LArRawChannelBuilderADC2EConstants
LArRawChannelBuilderADC2EConstants(const std::string &type, const std::string &name, const IInterface *parent)
Definition: LArRawChannelBuilderADC2EConstants.cxx:14
LArEM_Base_ID::is_em_endcap_outer
bool is_em_endcap_outer(const Identifier id) const
test if the id belongs to the EM Endcap outer wheel
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
LArRawChannelBuilderADC2EConstants::m_fcalId
const LArFCAL_Base_ID * m_fcalId
Definition: LArRawChannelBuilderADC2EConstants.h:39
python.SystemOfUnits.MeV
int MeV
Definition: SystemOfUnits.py:154
LArRawChannelBuilderStatistics::setErrorString
void setErrorString(unsigned int nerr, const std::string &s)
Definition: LArRawChannelBuilderStatistics.cxx:69
LArFCAL_Base_ID::module
int module(const Identifier id) const
module [1,3]
LArEM_Base_ID::sampling
int sampling(const Identifier id) const
return sampling according to :
LArRawChannelBuilderStatistics
Returns various counters from the LArRawChannel building.
Definition: LArRawChannelBuilderStatistics.h:21
LArRawChannelBuilderStatistics::incrementErrorCount
void incrementErrorCount(unsigned int nerr)
Definition: LArRawChannelBuilderStatistics.cxx:34
LArEM_Base_ID::eta
int eta(const Identifier id) const
return eta according to :
CaloCell_ID.h
CaloCell_ID::hec_idHelper
const LArHEC_ID * hec_idHelper() const
access to HEC idHelper
Definition: CaloCell_ID.h:69
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AtlasDetectorID::is_lar_hec
bool is_lar_hec(Identifier id) const
Definition: AtlasDetectorID.h:829
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
LArRawChannelBuilderToolBaseClass::m_helper
LArRawChannelBuilderStatistics * m_helper
Definition: LArRawChannelBuilderToolBaseClass.h:82
LArRawChannelBuilderADC2EConstants::ADC2E
virtual bool ADC2E(const EventContext &ctx, std::vector< float > &Ramps, MsgStream *pLog) override
Definition: LArRawChannelBuilderADC2EConstants.cxx:40
LArRawChannelBuilderADC2EToolBase
Interface definition for Tools to Convert ADC to energy.
Definition: LArRawChannelBuilderADC2EToolBase.h:24
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
CaloGain::LARHIGHGAIN
@ LARHIGHGAIN
Definition: CaloGain.h:18
LArEM_Base_ID::is_em_endcap_inner
bool is_em_endcap_inner(const Identifier id) const
test if the id belongs to the EM Endcap inner wheel
CaloGain::LARMEDIUMGAIN
@ LARMEDIUMGAIN
Definition: CaloGain.h:18
LArRawChannelBuilderToolBaseClass::currentID
Identifier currentID()
Definition: LArRawChannelBuilderToolBaseClass.cxx:94
LArRawChannelBuilderADC2EConstants::initTool
virtual StatusCode initTool() override
Definition: LArRawChannelBuilderADC2EConstants.cxx:28
LArEM_Base_ID::is_em_barrel
bool is_em_barrel(const Identifier id) const
test if the id belongs to the EM barrel
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LArRawChannelBuilderADC2EConstants.h
LArRawChannelBuilderStatistics.h
LArRawChannelBuilderADC2EConstants::m_hecId
const LArHEC_Base_ID * m_hecId
Definition: LArRawChannelBuilderADC2EConstants.h:40
CaloGain::LARLOWGAIN
@ LARLOWGAIN
Definition: CaloGain.h:18
LArRawChannelBuilderStatistics::returnBitPattern
unsigned int returnBitPattern() const
Definition: LArRawChannelBuilderStatistics.cxx:85
LArRawChannelBuilderParams::curr_chid
HWIdentifier curr_chid
Definition: LArRawChannelBuilderParams.h:24
LArRawChannelBuilderParams::qualityBitPattern
unsigned int qualityBitPattern
Definition: LArRawChannelBuilderParams.h:34
LArRawChannelBuilderToolBaseClass::m_parent
LArRawChannelBuilderParams * m_parent
Definition: LArRawChannelBuilderToolBaseClass.h:80
CaloCell_ID::fcal_idHelper
const LArFCAL_ID * fcal_idHelper() const
access to FCAL idHelper
Definition: CaloCell_ID.h:75