ATLAS Offline Software
LArHitFillerTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
13 #include "LArHitFillerTool.h"
14 #include "CaloEvent/CaloCell.h"
16 #include "GaudiKernel/ServiceHandle.h"
18 #include "StoreGate/StoreGateSvc.h"
22 #include "CaloIdentifier/TileID.h"
24 #include "CaloDetDescr/CaloDetDescrElement.h"
25 #include <sstream>
26 
27 
28 namespace D3PD {
29 
30 
38  (const std::string& type,
39  const std::string& name,
40  const IInterface* parent)
42  m_emid(0),
43  m_fcalid(0),
44  m_hecid(0),
45  m_tileid(0),
46  m_onlineid(0)
47 {
48  // declareProperty ("SelectedCells", m_writeSelectedCells=true);
49  LArHitFillerTool::book().ignore();
50 }
51 
52 
57 {
58  ServiceHandle<StoreGateSvc> detStore("DetectorStore", name());
59  ATH_CHECK ( detStore.retrieve() );
60 
62  ATH_CHECK ( detStore->retrieve(m_emid) );
63  ATH_CHECK ( detStore->retrieve(m_fcalid) );
64  ATH_CHECK ( detStore->retrieve(m_hecid) );
65  ATH_CHECK ( detStore->retrieve(m_tileid) );
66  ATH_CHECK ( detStore->retrieve(m_onlineid));
67 
68  return StatusCode::SUCCESS;
69 }
70 
71 
76 {
77  CHECK( addVariable ("eta", m_eta) );
78  CHECK( addVariable ("phi", m_phi) );
79  CHECK( addVariable ("E", m_e) );
80  CHECK( addVariable ("Time",m_time) );
81  CHECK( addVariable ("ID", m_id) );
82  return StatusCode::SUCCESS;
83 }
84 
85 
95 {
96 
97  Identifier id = p.cellID();
98 
99  //bool fcal = m_tileid->is_lar_fcal(id);
100 
101  *m_e = p.energy();
102  *m_time = p.time();
104  ATH_CHECK(caloMgrHandle.isValid());
105  const CaloDetDescrElement* dde = (*caloMgrHandle)->get_element(id);
106  *m_eta = dde->eta();
107  *m_phi = dde->phi();
109 
110  return StatusCode::SUCCESS;
111 }
112 
113 
114 
116 {
117  // AtlasID bit (4)
118  // 1 : lar_em
119  // 2 : lar_hec
120  // 3 : lar_fcal
121  // 4 : tile
122  unsigned ATbit1 = m_emid->is_lar_em(cellID) ? (1<<0) : 0;
123  unsigned ATbit2 = m_hecid->is_lar_hec(cellID) ? (1<<1) : 0;
124  unsigned ATbit3 = m_fcalid->is_lar_fcal(cellID) ? (1<<2) : 0;
125  unsigned ATbit4 = m_tileid->is_tile(cellID) ? (1<<3) : 0;
126  unsigned ATbit = (ATbit1 | ATbit2 | ATbit3 | ATbit4);
127 
128  //std::cout << "ATLAS Calo(EM,HEC,FCal,Tile) : " << ATbit1 << " " << ATbit2 << " " << ATbit3 << " " << ATbit4 << std::endl;
129 
130  // EM bit (5)
131  // 1-2 : sampling
132  // 0,1,2,3
133  // 0 presampler
134  // 1,2,3 each layer
135  // 3 : barrel
136  // 4 : endcap_inner
137  // 5 : endcap_outer
138  unsigned EMbit1 = 0;
139  unsigned EMbit3 = 0;
140  unsigned EMbit4 = 0;
141  unsigned EMbit5 = 0;
142  if (ATbit1) {
143  EMbit1 = unsigned(m_emid->sampling(cellID));
144  EMbit3 = m_emid->is_em_barrel(cellID) ? (1<<2) : 0;
145  EMbit4 = m_emid->is_em_endcap_inner(cellID) ? (1<<3) : 0;
146  EMbit5 = m_emid->is_em_endcap_outer(cellID) ? (1<<4) : 0;
147  }
148  unsigned EMbit = (EMbit1 | EMbit3 | EMbit4 | EMbit5);
149 
150  //std::cout << "EM : " << EMbit1 << " " << EMbit3 << " " << EMbit4 << " " << EMbit5 << std::endl;
151 
152  // HEC (2)
153  // 1-2: sampling
154  // 0,1 = first wheel
155  // 2,3 = second wheel
156  unsigned HCbit1 = 0;
157  if (ATbit2) {
158  HCbit1 = unsigned(m_hecid->sampling(cellID));
159  }
160  unsigned HCbit = HCbit1;
161 
162  //std::cout << "HEC : " << HCbit1 << std::endl;
163 
164  // FCal (2)
165  // 1-2 : module
166  // 1,2,3
167  // 1 EM
168  // 2,3 Hadronic
169  //
170  unsigned FCbit1 = 0;
171  if (ATbit3) {
172  FCbit1 = unsigned(m_fcalid->module(cellID));
173  }
174  unsigned FCbit = FCbit1;
175 
176  //std::cout << "FCal : " << FCbit1 << std::endl;
177 
178  // Tile bit (8)
179  // 1-3 : sample
180  // 0 = SAMP_A
181  // 1 = SAMP_B, SAMP_BC, SAMP_C
182  // 2 = SAMP_D
183  // 3 = SAMP_E
184  // 4 = SAMP_X
185  // 4 : barrel
186  // 5 : extbarrel
187  // 6 : gap
188  // 7 : gapscin
189  unsigned TLbit1 = 0;
190  unsigned TLbit4 = 0;
191  unsigned TLbit5 = 0;
192  unsigned TLbit6 = 0;
193  unsigned TLbit7 = 0;
194  if (ATbit4) {
195  TLbit1 = unsigned(m_tileid->sample(cellID));
196  TLbit4 = m_tileid->is_tile_barrel(cellID) ? (1<<3) : 0;
197  TLbit5 = m_tileid->is_tile_extbarrel(cellID) ? (1<<4) : 0;
198  TLbit6 = m_tileid->is_tile_gap(cellID) ? (1<<5) : 0;
199  TLbit7 = m_tileid->is_tile_gapscin(cellID) ? (1<<6) : 0;
200  }
201  unsigned TLbit = (TLbit1 | TLbit4 | TLbit5 | TLbit6 | TLbit7);
202 
203  //std::cout << "Tile : " << TLbit1 << " " << TLbit4 << " " << TLbit5 << " " << TLbit6 << " " << TLbit7 << std::endl;
204 
205  unsigned int CombBit = (ATbit | (EMbit<<4) | (HCbit<<9) |
206  (FCbit<<11) | (TLbit<<13));
207 
208  return CombBit;
209 }
210 
211 
212 
213 } // namespace D3PD
LArEM_ID.h
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
AtlasDetectorID::is_lar_fcal
bool is_lar_fcal(Identifier id) const
Definition: AtlasDetectorID.h:839
Tile_Base_ID::is_tile_gap
bool is_tile_gap(const Identifier &id) const
Definition: Tile_Base_ID.cxx:223
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
D3PD::LArHitFillerTool::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition: LArHitFillerTool.h:98
D3PD::LArHitFillerTool::m_emid
const LArEM_ID * m_emid
Definition: LArHitFillerTool.h:92
D3PD::LArHitFillerTool::m_hecid
const LArHEC_ID * m_hecid
Definition: LArHitFillerTool.h:94
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
D3PD::LArHitFillerTool::m_id
unsigned int * m_id
Definition: LArHitFillerTool.h:89
Tile_Base_ID::sample
int sample(const Identifier &id) const
Definition: Tile_Base_ID.cxx:171
LArFCAL_Base_ID::module
int module(const Identifier id) const
module [1,3]
CaloCell.h
Tile_Base_ID::is_tile_extbarrel
bool is_tile_extbarrel(const Identifier &id) const
Definition: Tile_Base_ID.cxx:214
LArEM_Base_ID::sampling
int sampling(const Identifier id) const
return sampling according to :
D3PD::AddVariable::addVariable
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Add a variable to the tuple.
Definition: AddVariable.cxx:85
D3PD::LArHitFillerTool::initialize
virtual StatusCode initialize() override
Standard Gaudi initialize method.
Definition: LArHitFillerTool.cxx:56
LArHEC_ID.h
xAOD::unsigned
unsigned
Definition: RingSetConf_v1.cxx:662
TileID.h
D3PD::LArHitFillerTool::CaloCell_GetDetectorInfo
unsigned int CaloCell_GetDetectorInfo(Identifier &cellID)
Definition: LArHitFillerTool.cxx:115
D3PD::LArHitFillerTool::m_time
float * m_time
Definition: LArHitFillerTool.h:88
D3PD::LArHitFillerTool::book
virtual StatusCode book() override
Book variables for this block.
Definition: LArHitFillerTool.cxx:75
D3PD
Block filler tool for noisy FEB information.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/ChainGroup.h:21
Tile_Base_ID::is_tile_gapscin
bool is_tile_gapscin(const Identifier &id) const
Definition: Tile_Base_ID.cxx:268
LArHitFillerTool.h
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
D3PD::BlockFillerTool
Type-safe wrapper for block filler tools.
Definition: BlockFillerTool.h:68
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
AtlasDetectorID::is_tile
bool is_tile(Identifier id) const
Definition: AtlasDetectorID.h:695
AtlasDetectorID::is_lar_hec
bool is_lar_hec(Identifier id) const
Definition: AtlasDetectorID.h:829
D3PD::LArHitFillerTool::m_phi
float * m_phi
Definition: LArHitFillerTool.h:86
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
D3PD::LArHitFillerTool::m_e
float * m_e
Definition: LArHitFillerTool.h:87
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
D3PD::LArHitFillerTool::fill
virtual StatusCode fill(const LArHit &p) override
Fill one block — type-safe version.
Definition: LArHitFillerTool.cxx:94
errorcheck.h
Helpers for checking error return status codes and reporting errors.
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
LArHit
Class to store hit energy and time in LAr cell from G4 simulation.
Definition: LArHit.h:25
CaloCellContainer.h
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
LArFCAL_ID.h
LArEM_Base_ID::is_em_barrel
bool is_em_barrel(const Identifier id) const
test if the id belongs to the EM barrel
D3PD::LArHitFillerTool::m_eta
float * m_eta
Variable: time, quality and id.
Definition: LArHitFillerTool.h:85
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
D3PD::LArHitFillerTool::m_fcalid
const LArFCAL_ID * m_fcalid
Definition: LArHitFillerTool.h:93
LArHEC_Base_ID::sampling
int sampling(const Identifier id) const
return sampling [0,3] (only 0 for supercells)
D3PD::LArHitFillerTool::m_onlineid
const LArOnlineID * m_onlineid
Definition: LArHitFillerTool.h:96
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
Tile_Base_ID::is_tile_barrel
bool is_tile_barrel(const Identifier &id) const
Test of an Identifier to see if it belongs to a particular part of the calorimeter.
Definition: Tile_Base_ID.cxx:205
StoreGateSvc.h
AtlasDetectorID::is_lar_em
bool is_lar_em(Identifier id) const
Definition: AtlasDetectorID.h:818
D3PD::LArHitFillerTool::m_tileid
const TileID * m_tileid
Definition: LArHitFillerTool.h:95
D3PD::LArHitFillerTool::LArHitFillerTool
LArHitFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition: LArHitFillerTool.cxx:38
LArOnlineID.h
ServiceHandle< StoreGateSvc >