ATLAS Offline Software
CBNT_CaloH6.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 //#####################################################
6 //# #
7 //# File : CBNT_Calo_H6.cxx #
8 //# Package: TBRec #
9 //# #
10 //# Author : Marco Bieri <mbieri@sfu.ca> #
11 //# Adopted for CBNTAA Pavol Strizenec #
12 //# #
13 //#####################################################
14 
15 #include "CBNT_CaloH6.h"
16 
20 
21 #include "Identifier/Identifier.h"
22 
23 
24 CBNT_CaloH6::CBNT_CaloH6(const std::string & name, ISvcLocator * pSvcLocator) :
25  CBNT_TBRecBase(name, pSvcLocator),
26  m_emecID_help(0),
27  m_hecID_help(0),
28  m_fcalID_help(0)
29 {
30  declareProperty("Det_Type", m_det_type);
31  declareProperty("Max_Chan", m_numchan);
32  m_noiseSigma = 0;
33 
34  m_NoiseRMS = 0;
35  m_energy = 0;
36  m_eta = 0;
37  m_ieta = 0;
38  m_iphi = 0;
39  m_phi = 0;
40  m_region = 0;
41  m_sampling = 0;
42 }
43 
45 
47 { //initialize
48  ATH_MSG_DEBUG( "initialize()" );
49 
50  m_hecID_help = NULL;
51  m_emecID_help = NULL;
52  m_fcalID_help = NULL;
53 
54  // Identifier helpers
55  const CaloCell_ID* idHelper = nullptr;
56  ATH_CHECK( detStore()->retrieve (idHelper, "CaloCell_ID") );
57  m_hecID_help = idHelper->hec_idHelper();
58  if (!m_hecID_help) {
59  ATH_MSG_ERROR ( "unable to obtain hec id " );
60  return StatusCode::FAILURE;
61  }
62 
63  m_emecID_help = idHelper->em_idHelper();
64  if (!m_emecID_help) {
65  ATH_MSG_ERROR ( "unable to obtain emec id " );
66  return StatusCode::FAILURE;
67  }
68 
69  m_fcalID_help = idHelper->fcal_idHelper();
70  if (!m_fcalID_help) {
71  ATH_MSG_ERROR ( "unable to obtain fcal id " );
72  return StatusCode::FAILURE;
73  }
74 
75  ATH_MSG_DEBUG("Got to before p_toolSvc");
76 
78 
79  ATH_MSG_DEBUG ( "Before Booking Ntuple" );
80 
81  //hec, 241 channels
82  //emec, 113 channels
83  //fcal, 347 channels
84 
85  addBranch(m_det_type+"_energy",m_energy);
86  addBranch(m_det_type+"_noiseRMS",m_NoiseRMS);
87  addBranch(m_det_type+"_ieta",m_ieta);
88  addBranch(m_det_type+"_iphi",m_iphi);
89  addBranch(m_det_type+"_eta",m_eta);
90  addBranch(m_det_type+"_phi",m_phi);
91  addBranch(m_det_type+"_sampling",m_sampling);
92 
93  if(m_det_type=="HEC") {
94  addBranch(m_det_type+"_region",m_region);
95  } else m_region = 0;
96 
97  return StatusCode::SUCCESS;
98 
99 } //initialize
100 
101 /*-----------------------------------Execute-----------------------------*/
102 
104 { //execute
105  ATH_MSG_DEBUG ( "execute()");
106 
107  //Accesing the CaloCellContainer
108  const CaloCellContainer* cellContainer;
109 
110  ATH_CHECK( evtStore()->retrieve(cellContainer) );
111 
113 
114  for (const CaloCell* cell_ptr : *cellContainer) {
115 
116  //obtaining dde pointer
117  const CaloDetDescrElement* caloDDE_ptr = cell_ptr->caloDDE();
118 
119  //obtaining SubCalo
120  const CaloCell_ID::SUBCALO subcalo = caloDDE_ptr->getSubCalo();
121 
122  //obtaining sampling (layer)
123  const CaloCell_ID::CaloSample sampling = caloDDE_ptr->getSampling();
124  if (m_det_type=="HEC" && subcalo==CaloCell_ID::LARHEC) {
125 
126  const Identifier hecid=cell_ptr->ID();
127 
128  float noise = elecNoise->getNoise(hecid, cell_ptr->gain());
129  ATH_MSG_DEBUG("noiseRMS HEC"<<noise);
130 
131  m_energy->push_back(cell_ptr->energy());
132  m_NoiseRMS->push_back(noise);
133  m_eta->push_back(caloDDE_ptr->eta());
134  m_phi->push_back(caloDDE_ptr->phi());
135  m_ieta->push_back(m_hecID_help->eta(hecid));
136  m_iphi->push_back(m_hecID_help->phi(hecid));
137  m_sampling->push_back(sampling);
138  m_region->push_back(m_hecID_help->region(hecid));
139  }
140 
141  if (m_det_type=="EMEC" && subcalo==CaloCell_ID::LAREM) {
142 
143  const Identifier emecid=cell_ptr->ID();
144 
145  float noise = elecNoise->getNoise(emecid, cell_ptr->gain());
146  ATH_MSG_DEBUG("noiseRMS EMEC"<<noise);
147 
148  m_energy->push_back(cell_ptr->energy());
149  m_NoiseRMS->push_back(noise);
150  m_eta->push_back(caloDDE_ptr->eta());
151  m_phi->push_back(caloDDE_ptr->phi());
152  m_ieta->push_back(m_emecID_help->eta(emecid));
153  m_iphi->push_back(m_emecID_help->phi(emecid));
154  m_sampling->push_back(sampling);
155  }
156  if (m_det_type=="FCAL" && subcalo==CaloCell_ID::LARFCAL) {
157 
158  const Identifier fcalid=cell_ptr->ID();
159 
160  float noise = elecNoise->getNoise(fcalid, cell_ptr->gain());
161  ATH_MSG_DEBUG("noiseRMS FCAL"<<noise);
162 
163  m_energy->push_back(cell_ptr->energy());
164  m_NoiseRMS->push_back(noise);
165  m_eta->push_back(caloDDE_ptr->eta());
166  m_phi->push_back(caloDDE_ptr->phi());
167  m_ieta->push_back(m_fcalID_help->eta(fcalid));
168  m_iphi->push_back(m_fcalID_help->phi(fcalid));
169  m_sampling->push_back(sampling);
170  }
171  }
172 
173  return StatusCode::SUCCESS;
174 
175 } //execute
176 
177 /*-----------------------------------Finalize-----------------------------*/
178 
180 { //finalize
181  ATH_MSG_INFO ( "finalize()" );
182  return StatusCode::SUCCESS;
183 
184 } //finalize
185 
187 {
188  if(m_energy) m_energy->clear();
189  if(m_NoiseRMS) m_NoiseRMS->clear();
190  if(m_eta) m_eta->clear();
191  if(m_phi) m_phi->clear();
192  if(m_ieta) m_ieta->clear();
193  if(m_iphi) m_iphi->clear();
194  if(m_sampling) m_sampling->clear();
195  if(m_region) m_region->clear();
196 
197  return StatusCode::SUCCESS;
198 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
CBNT_CaloH6::CBNT_finalize
virtual StatusCode CBNT_finalize() override
Definition: CBNT_CaloH6.cxx:179
LArEM_Base_ID::phi
int phi(const Identifier id) const
return phi according to :
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition: CaloCell_Base_ID.h:46
CBNT_CaloH6::m_det_type
std::string m_det_type
Definition: CBNT_CaloH6.h:60
CBNT_CaloH6::m_NoiseRMS
std::vector< float > * m_NoiseRMS
Definition: CBNT_CaloH6.h:66
LArHEC_Base_ID::eta
int eta(const Identifier id) const
return eta [0,9] outer part [0,3] inner part
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CaloCell_ID::em_idHelper
const LArEM_ID * em_idHelper() const
access to EM idHelper
Definition: CaloCell_ID.h:63
CBNT_CaloH6::CBNT_clear
virtual StatusCode CBNT_clear() override
Definition: CBNT_CaloH6.cxx:186
CBNT_CaloH6::m_eta
std::vector< float > * m_eta
Definition: CBNT_CaloH6.h:69
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CBNT_CaloH6::m_noiseSigma
float m_noiseSigma
Definition: CBNT_CaloH6.h:57
CBNT_CaloH6::m_hecID_help
const LArHEC_ID * m_hecID_help
Definition: CBNT_CaloH6.h:51
CBNT_CaloH6::m_phi
std::vector< float > * m_phi
Definition: CBNT_CaloH6.h:70
CBNT_CaloH6::CBNT_CaloH6
CBNT_CaloH6(const std::string &name, ISvcLocator *pSvcLocator)
Definition: CBNT_CaloH6.cxx:24
CaloCell_Base_ID::LARHEC
@ LARHEC
Definition: CaloCell_Base_ID.h:46
CBNT_CaloH6::m_elecNoiseKey
SG::ReadCondHandleKey< CaloNoise > m_elecNoiseKey
Definition: CBNT_CaloH6.h:55
CBNT_CaloH6::m_fcalID_help
const LArFCAL_ID * m_fcalID_help
Definition: CBNT_CaloH6.h:52
CBNT_CaloH6::m_energy
std::vector< float > * m_energy
Definition: CBNT_CaloH6.h:65
CBNT_CaloH6::~CBNT_CaloH6
virtual ~CBNT_CaloH6()
Definition: CBNT_CaloH6.cxx:44
CaloNoise::getNoise
float getNoise(const IdentifierHash h, const int gain) const
Accessor by IdentifierHash and gain.
Definition: CaloNoise.h:34
ReadCondHandle.h
LArEM_Base_ID::eta
int eta(const Identifier id) const
return eta according to :
LArFCAL_Base_ID::eta
int eta(const Identifier id) const
eta [0,63] module 1 ; [0,31] module 2 ; [0,15] module 3
CaloCell_ID.h
CaloCell_ID::hec_idHelper
const LArHEC_ID * hec_idHelper() const
access to HEC idHelper
Definition: CaloCell_ID.h:69
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
CaloDetDescrElement::getSubCalo
CaloCell_ID::SUBCALO getSubCalo() const
cell subcalo
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:433
CBNT_CaloH6::CBNT_initialize
virtual StatusCode CBNT_initialize() override
Definition: CBNT_CaloH6.cxx:46
CBNT_CaloH6::m_emecID_help
const LArEM_ID * m_emecID_help
Definition: CBNT_CaloH6.h:50
CBNT_CaloH6::m_numchan
int m_numchan
Definition: CBNT_CaloH6.h:61
LArFCAL_Base_ID::phi
int phi(const Identifier id) const
phi [0,15]
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CBNT_TBRecBase
Definition: CBNT_TBRecBase.h:21
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CaloCell_Base_ID::SUBCALO
SUBCALO
enumeration of sub calorimeters
Definition: CaloCell_Base_ID.h:46
CBNT_TBRecBase::addBranch
void addBranch(const std::string &branchname, T &obj, const std::string &leaflist)
Definition: CBNT_TBRecBase.h:44
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
CBNT_CaloH6.h
CBNT_CaloH6::m_ieta
std::vector< float > * m_ieta
Definition: CBNT_CaloH6.h:67
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
CaloCellContainer.h
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
CaloDetDescrElement::getSampling
CaloCell_ID::CaloSample getSampling() const
cell sampling
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:395
CBNT_CaloH6::m_region
std::vector< float > * m_region
Definition: CBNT_CaloH6.h:72
CBNT_CaloH6::m_sampling
std::vector< float > * m_sampling
Definition: CBNT_CaloH6.h:71
CaloDetDescrElement::eta
float eta() const
cell eta
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:344
CaloDetDescrElement::phi
float phi() const
cell phi
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:346
CaloCell_Base_ID::LAREM
@ LAREM
Definition: CaloCell_Base_ID.h:46
LArHEC_Base_ID::region
int region(const Identifier id) const
return region [0,1]
CBNT_CaloH6::m_iphi
std::vector< float > * m_iphi
Definition: CBNT_CaloH6.h:68
WriteCellNoiseToCool.noise
noise
Definition: WriteCellNoiseToCool.py:380
CaloCell_ID::fcal_idHelper
const LArFCAL_ID * fcal_idHelper() const
access to FCAL idHelper
Definition: CaloCell_ID.h:75
CBNT_CaloH6::CBNT_execute
virtual StatusCode CBNT_execute() override
Definition: CBNT_CaloH6.cxx:103
LArHEC_Base_ID::phi
int phi(const Identifier id) const
return phi[0,63] outer part [0,31] inner part
Identifier
Definition: IdentifierFieldParser.cxx:14