ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
FastHitConvertTool Class Reference

#include <FastHitConvertTool.h>

Inheritance diagram for FastHitConvertTool:
Collaboration diagram for FastHitConvertTool:

Public Member Functions

 FastHitConvertTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual ~FastHitConvertTool ()
 default destructor More...
 
virtual StatusCode initialize () override final
 standard Athena-Algorithm method More...
 
virtual StatusCode process (CaloCellContainer *theCellContainer, const EventContext &ctx) const override
 standard Athena-Algorithm method More...
 

Private Attributes

SG::WriteHandleKey< LArHitContainerm_embHitContainerKey {this,"embHitContainername","LArHitEMB","Name of output FastSim LAr EM Barrel Hit Container"}
 
SG::WriteHandleKey< LArHitContainerm_emecHitContainerKey {this,"emecHitContainername","LArHitEMEC","Name of output FastSim LAr EM Endcap Hit Container"}
 
SG::WriteHandleKey< LArHitContainerm_fcalHitContainerKey {this,"fcalHitContainername","LArHitFCAL","Name of output FastSim LAr FCAL Hit Container"}
 
SG::WriteHandleKey< LArHitContainerm_hecHitContainerKey {this,"hecHitContainername","LArHitHEC","Name of output FastSim LAr HEC Hit Container"}
 
SG::WriteHandleKey< TileHitVectorm_tileHitVectorKey {this,"tileHitContainername","TileHitVec","Name of output FastSim Tile Hit Container"}
 
SG::ReadCondHandleKey< ILArfSamplm_fSamplKey {this,"fSamplKey","LArfSamplSym","SG Key of LArfSampl object"}
 
SG::ReadCondHandleKey< TileSamplingFractionm_tileSamplingFractionKey
 Name of TileSamplingFraction in condition store. More...
 
ServiceHandle< TileCablingSvcm_tileCablingSvc
 Name of Tile cabling service. More...
 
const LArEM_IDm_larEmID {nullptr}
 
const LArFCAL_IDm_larFcalID {nullptr}
 
const LArHEC_IDm_larHecID {nullptr}
 
const TileIDm_tileID {nullptr}
 
const TileHWIDm_tileHWID {nullptr}
 
const TileCablingServicem_tileCabling {nullptr}
 

Detailed Description

This is for the Doxygen-Documentation. Please delete these lines and fill in information about the Algorithm! Please precede every member function declaration with a short Doxygen comment stating the purpose of this function.

Author
Bo Liu boliu.nosp@m.@cer.nosp@m.n.ch

Definition at line 43 of file FastHitConvertTool.h.

Constructor & Destructor Documentation

◆ FastHitConvertTool()

FastHitConvertTool::FastHitConvertTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 28 of file FastHitConvertTool.cxx.

31  :
32  base_class(type,name,parent)
33 {
34 }

◆ ~FastHitConvertTool()

virtual FastHitConvertTool::~FastHitConvertTool ( )
inlinevirtual

default destructor

Definition at line 49 of file FastHitConvertTool.h.

49 {};

Member Function Documentation

◆ initialize()

StatusCode FastHitConvertTool::initialize ( )
finaloverridevirtual

standard Athena-Algorithm method

Definition at line 44 of file FastHitConvertTool.cxx.

45 {
46 
47  const CaloIdManager* caloIdManager = nullptr;
48  CHECK(detStore()->retrieve(caloIdManager));
49  m_larEmID=caloIdManager->getEM_ID();
50  if(m_larEmID==0)
51  throw std::runtime_error("FastHitConvertTool: Invalid LAr EM ID helper");
52  m_larFcalID=caloIdManager->getFCAL_ID();
53  if(m_larFcalID==0)
54  throw std::runtime_error("FastHitConvertTool: Invalid FCAL ID helper");
55  m_larHecID=caloIdManager->getHEC_ID();
56  if(m_larHecID==0)
57  throw std::runtime_error("FastHitConvertTool: Invalid HEC ID helper");
58  m_tileID=caloIdManager->getTileID();
59  if(m_tileID==0)
60  throw std::runtime_error("FastHitConvertTool: Invalid Tile ID helper");
61 
62  // LAr and Tile Sampling Fractions
64 
67 
68  ATH_CHECK( m_tileCablingSvc.retrieve() );
69  m_tileCabling = m_tileCablingSvc->cablingService();
70 
71  // Output keys
76  ATH_CHECK(m_tileHitVectorKey.initialize());
77 
78  return StatusCode::SUCCESS;
79 }

◆ process()

StatusCode FastHitConvertTool::process ( CaloCellContainer theCellContainer,
const EventContext &  ctx 
) const
overridevirtual

standard Athena-Algorithm method

Definition at line 81 of file FastHitConvertTool.cxx.

82 {
83  ATH_MSG_DEBUG("initEvent()");
84  auto embHitContainer = SG::makeHandle<LArHitContainer>( m_embHitContainerKey, ctx );
85  auto emecHitContainer = SG::makeHandle<LArHitContainer>( m_emecHitContainerKey, ctx );
86  auto fcalHitContainer = SG::makeHandle<LArHitContainer>( m_fcalHitContainerKey, ctx );
87  auto hecHitContainer = SG::makeHandle<LArHitContainer>( m_hecHitContainerKey, ctx );
88  auto tileHitVector = SG::makeHandle<TileHitVector>( m_tileHitVectorKey, ctx );
89  embHitContainer = std::make_unique<LArHitContainer>( m_embHitContainerKey.key() );
90  emecHitContainer = std::make_unique<LArHitContainer>( m_emecHitContainerKey.key() );
91  fcalHitContainer = std::make_unique<LArHitContainer>( m_fcalHitContainerKey.key() );
92  hecHitContainer = std::make_unique<LArHitContainer>( m_hecHitContainerKey.key() );
93  tileHitVector = std::make_unique<TileHitVector>( m_tileHitVectorKey.key() );
94 
95  ATH_MSG_DEBUG("ATLFASTIIDigi "<<this->name()<<" hitConstruction");
96  const double minEnergy=1e-9;
97  double hitTime=0.0;
98  Identifier cellid((unsigned int) 0);
99  double energy=0.0;
100  double energyConv=0.0;
101  float SampFrac=0.0;
102 
103  int countFastCell=0;
104 
105  double eLArEMRead=0.0;
106  double eLArHECRead=0.0;
107  double eLArFCALRead=0.0;
108  double eTileRead=0.0;
109 
110  double eLArEMConv=0.0;
111  double eLArHECConv=0.0;
112  double eLArFCALConv=0.0;
113  double eTileConv=0.0;
114 
116  const ILArfSampl* fSampl=*fSamplHdl;
117 
118  CaloCellContainer::const_iterator it1=theCellCont->beginConstCalo(CaloCell_ID::LAREM);
119  CaloCellContainer::const_iterator it2=theCellCont->endConstCalo(CaloCell_ID::LAREM);
120  for(;it1!=it2;++it1)
121  {
122  ATH_MSG_DEBUG("FastCell LArEM"<<countFastCell);
123 
124  cellid=(*it1)->ID();
125  energy=(*it1)->energy();
126  SampFrac=fSampl->FSAMPL(cellid);
127  energyConv=energy*SampFrac;
128 
129  eLArEMRead+=energy;
130  eLArEMConv+=energyConv;
131 
132  ATH_MSG_DEBUG("ReadFastCell id= "<<cellid<<"E= "<<energy<<" SampFrac= "<<SampFrac);
133  if(energyConv > minEnergy)
134  {
135  if(m_larEmID->is_lar_em(cellid))
136  {
137  if(m_larEmID->is_em_barrel(cellid))
138  {
139  ATH_MSG_DEBUG("Storing em barrel hit");
140  embHitContainer->push_back(new LArHit(cellid,energyConv,hitTime));
141  }
142  else if(m_larEmID->is_em_endcap(cellid))
143  {
144  ATH_MSG_DEBUG("Storing em endcap hit");
145  emecHitContainer->push_back(new LArHit(cellid,energyConv,hitTime));
146  }
147  }
148  }
149  countFastCell++;
150  }
151 
152  it1=theCellCont->beginConstCalo(CaloCell_ID::LARHEC);
153  it2=theCellCont->endConstCalo(CaloCell_ID::LARHEC);
154 
155  countFastCell=0;
156  for(;it1!=it2;++it1)
157  {
158  ATH_MSG_DEBUG("FastCell LArHEC"<<countFastCell);
159 
160  cellid=(*it1)->ID();
161  energy=(*it1)->energy();
162  SampFrac=fSampl->FSAMPL(cellid);
163  energyConv=energy*SampFrac;
164 
165  eLArHECRead+=energy;
166  eLArHECConv+=energyConv;
167 
168  ATH_MSG_DEBUG("ReadFastCell id= "<<cellid<<"E= "<<energy<<"SampFrac= "<<SampFrac);
169 
170  if(energyConv>minEnergy)
171  {
172  if(m_larHecID->is_lar_hec(cellid))
173  {
174  ATH_MSG_DEBUG("Storing hec hit");
175  hecHitContainer->push_back(new LArHit(cellid,energyConv,hitTime));
176  }
177  }
178  countFastCell++;
179  }
180 
181  it1=theCellCont->beginConstCalo(CaloCell_ID::LARFCAL);
182  it2=theCellCont->endConstCalo(CaloCell_ID::LARFCAL);
183  countFastCell=0;
184  for(;it1!=it2;++it1)
185  {
186  ATH_MSG_DEBUG("FastCell LArFCAL"<<countFastCell);
187  cellid=(*it1)->ID();
188  energy=(*it1)->energy();
189  SampFrac=fSampl->FSAMPL(cellid);
190  energyConv=energy*SampFrac;
191 
192  eLArHECRead+=energy;
193  eLArHECConv+=energyConv;
194 
195  ATH_MSG_DEBUG("ReadFastCell id= "<<cellid<<"E="<<energy<<"SampFrac="<<SampFrac);
196  if(energyConv>minEnergy)
197  {
198  if(m_larFcalID->is_lar_fcal(cellid))
199  {
200  ATH_MSG_DEBUG("Storing fcal hit");
201  fcalHitContainer->push_back(new LArHit(cellid,energyConv,hitTime));
202  }
203  }
204  countFastCell++;
205  }
206 
208  ATH_CHECK( tileSamplingFraction.isValid() );
209 
210  it1=theCellCont->beginConstCalo(CaloCell_ID::TILE);
211  it2=theCellCont->endConstCalo(CaloCell_ID::TILE);
212 
213  countFastCell=0;
214  Identifier pmt_id0((unsigned int) 0);
215  Identifier pmt_id1((unsigned int) 0);
216 
217  for(;it1!=it2;++it1)
218  {
219  ATH_MSG_DEBUG("FastCell Tile Cal"<<countFastCell);
220  cellid=(*it1)->ID();
221  energy=(*it1)->energy();
222 
223  pmt_id0=m_tileID->pmt_id(cellid,0);
224  pmt_id1=m_tileID->pmt_id(cellid,1);
225 
228  int drawerIdx = m_tileHWID->drawerIdx(channel_id);
229  SampFrac = tileSamplingFraction->getSamplingFraction(drawerIdx, channel);
230  energyConv=energy/SampFrac;
231 
232  eTileRead+=energy;
233  eTileConv+=energyConv;
234 
235  ATH_MSG_DEBUG("ReadFastCell id= "<<cellid<<"E="<<energy<<"SampFrac"<<SampFrac);
236  ATH_MSG_DEBUG("PMT_id0="<<pmt_id0<<"PMT_id1="<<pmt_id1);
237  if(energyConv>minEnergy)
238  {
239  if(m_tileID->is_tile(cellid))
240  {
241  ATH_MSG_DEBUG("Storing tile hit");
242  if(m_tileID->is_tile_gapscin(cellid))
243  {
244  tileHitVector->push_back(TileHit(pmt_id0,energyConv,hitTime));
245  }
246  else
247  {
248  tileHitVector->push_back(TileHit(pmt_id0,energyConv/2.0,hitTime));
249  tileHitVector->push_back(TileHit(pmt_id1,energyConv/2.0,hitTime));
250  }
251  }
252  }
253  countFastCell++;
254  }
255  ATH_MSG_DEBUG("eReadTot= "<<eLArEMRead+eLArHECRead+eLArFCALRead+eTileRead);
256  ATH_MSG_DEBUG("eLArEMRead= "<<eLArEMRead<<" eLArHECRead= "<<eLArHECRead<<" eLArFCALRead= "<<eLArFCALRead<<" eTileRead= "<<eTileRead);
257  ATH_MSG_DEBUG("eConvTot= "<<eLArEMConv+eLArHECConv+eLArFCALConv+eTileConv);
258  ATH_MSG_DEBUG("eLArEMConv= "<<eLArEMConv<<" eLArHECConv= "<<eLArHECConv<<"eLArFCALConv"<<eLArFCALConv<<"eTileConv"<<eTileConv);
259 
260  ATH_MSG_DEBUG("finaliseEvent()");
261  ATH_MSG_DEBUG(embHitContainer.name()<<" : "<<embHitContainer->size()<<" hits ");
262  ATH_MSG_DEBUG(emecHitContainer.name()<<" : "<<emecHitContainer->size()<<" hits ");
263  ATH_MSG_DEBUG(fcalHitContainer.name()<<" : "<<fcalHitContainer->size()<<" hits ");
264  ATH_MSG_DEBUG(hecHitContainer.name()<<" : "<<hecHitContainer->size()<<" hits ");
265  ATH_MSG_DEBUG(tileHitVector.name()<<" : "<<tileHitVector->size()<<" hits ");
266 
267  return StatusCode::SUCCESS;
268 }

Member Data Documentation

◆ m_embHitContainerKey

SG::WriteHandleKey<LArHitContainer> FastHitConvertTool::m_embHitContainerKey {this,"embHitContainername","LArHitEMB","Name of output FastSim LAr EM Barrel Hit Container"}
private

Definition at line 60 of file FastHitConvertTool.h.

◆ m_emecHitContainerKey

SG::WriteHandleKey<LArHitContainer> FastHitConvertTool::m_emecHitContainerKey {this,"emecHitContainername","LArHitEMEC","Name of output FastSim LAr EM Endcap Hit Container"}
private

Definition at line 61 of file FastHitConvertTool.h.

◆ m_fcalHitContainerKey

SG::WriteHandleKey<LArHitContainer> FastHitConvertTool::m_fcalHitContainerKey {this,"fcalHitContainername","LArHitFCAL","Name of output FastSim LAr FCAL Hit Container"}
private

Definition at line 62 of file FastHitConvertTool.h.

◆ m_fSamplKey

SG::ReadCondHandleKey<ILArfSampl> FastHitConvertTool::m_fSamplKey {this,"fSamplKey","LArfSamplSym","SG Key of LArfSampl object"}
private

Definition at line 66 of file FastHitConvertTool.h.

◆ m_hecHitContainerKey

SG::WriteHandleKey<LArHitContainer> FastHitConvertTool::m_hecHitContainerKey {this,"hecHitContainername","LArHitHEC","Name of output FastSim LAr HEC Hit Container"}
private

Definition at line 63 of file FastHitConvertTool.h.

◆ m_larEmID

const LArEM_ID* FastHitConvertTool::m_larEmID {nullptr}
private

Definition at line 80 of file FastHitConvertTool.h.

◆ m_larFcalID

const LArFCAL_ID* FastHitConvertTool::m_larFcalID {nullptr}
private

Definition at line 81 of file FastHitConvertTool.h.

◆ m_larHecID

const LArHEC_ID* FastHitConvertTool::m_larHecID {nullptr}
private

Definition at line 82 of file FastHitConvertTool.h.

◆ m_tileCabling

const TileCablingService* FastHitConvertTool::m_tileCabling {nullptr}
private

Definition at line 85 of file FastHitConvertTool.h.

◆ m_tileCablingSvc

ServiceHandle<TileCablingSvc> FastHitConvertTool::m_tileCablingSvc
private
Initial value:
{ this,
"TileCablingSvc", "TileCablingSvc", "Tile cabling service"}

Name of Tile cabling service.

Definition at line 77 of file FastHitConvertTool.h.

◆ m_tileHitVectorKey

SG::WriteHandleKey<TileHitVector> FastHitConvertTool::m_tileHitVectorKey {this,"tileHitContainername","TileHitVec","Name of output FastSim Tile Hit Container"}
private

Definition at line 64 of file FastHitConvertTool.h.

◆ m_tileHWID

const TileHWID* FastHitConvertTool::m_tileHWID {nullptr}
private

Definition at line 84 of file FastHitConvertTool.h.

◆ m_tileID

const TileID* FastHitConvertTool::m_tileID {nullptr}
private

Definition at line 83 of file FastHitConvertTool.h.

◆ m_tileSamplingFractionKey

SG::ReadCondHandleKey<TileSamplingFraction> FastHitConvertTool::m_tileSamplingFractionKey
private
Initial value:
{this,
"TileSamplingFraction", "TileSamplingFraction", "Input Tile sampling fraction"}

Name of TileSamplingFraction in condition store.

Definition at line 71 of file FastHitConvertTool.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition: CaloCell_Base_ID.h:46
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
FastHitConvertTool::m_larEmID
const LArEM_ID * m_larEmID
Definition: FastHitConvertTool.h:80
AtlasDetectorID::is_lar_fcal
bool is_lar_fcal(Identifier id) const
Definition: AtlasDetectorID.h:839
FastHitConvertTool::m_embHitContainerKey
SG::WriteHandleKey< LArHitContainer > m_embHitContainerKey
Definition: FastHitConvertTool.h:60
CaloIdManager::getEM_ID
const LArEM_ID * getEM_ID(void) const
Definition: CaloIdManager.cxx:80
FastHitConvertTool::m_fcalHitContainerKey
SG::WriteHandleKey< LArHitContainer > m_fcalHitContainerKey
Definition: FastHitConvertTool.h:62
CaloCell_Base_ID::LARHEC
@ LARHEC
Definition: CaloCell_Base_ID.h:46
FastHitConvertTool::m_hecHitContainerKey
SG::WriteHandleKey< LArHitContainer > m_hecHitContainerKey
Definition: FastHitConvertTool.h:63
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
HWIdentifier
Definition: HWIdentifier.h:13
FastHitConvertTool::m_tileSamplingFractionKey
SG::ReadCondHandleKey< TileSamplingFraction > m_tileSamplingFractionKey
Name of TileSamplingFraction in condition store.
Definition: FastHitConvertTool.h:71
TileHWID::channel
int channel(const HWIdentifier &id) const
extract channel field from HW identifier
Definition: TileHWID.h:189
FastHitConvertTool::m_tileHitVectorKey
SG::WriteHandleKey< TileHitVector > m_tileHitVectorKey
Definition: FastHitConvertTool.h:64
CaloIdManager::getTileID
const TileID * getTileID(void) const
Definition: CaloIdManager.cxx:100
CaloIdManager::getHEC_ID
const LArHEC_ID * getHEC_ID(void) const
Definition: CaloIdManager.cxx:95
Tile_Base_ID::is_tile_gapscin
bool is_tile_gapscin(const Identifier &id) const
Definition: Tile_Base_ID.cxx:268
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
CaloIdManager
This class initializes the Calo (LAr and Tile) offline identifiers.
Definition: CaloIdManager.h:45
DetDescrDictionaryDict::it1
std::vector< HWIdentifier >::iterator it1
Definition: DetDescrDictionaryDict.h:17
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
FastHitConvertTool::m_tileHWID
const TileHWID * m_tileHWID
Definition: FastHitConvertTool.h:84
ILArfSampl::FSAMPL
virtual const float & FSAMPL(const HWIdentifier &id) const =0
CaloIdManager::getFCAL_ID
const LArFCAL_ID * getFCAL_ID(void) const
Definition: CaloIdManager.cxx:85
createCoolChannelIdFile.channel_id
channel_id
Definition: createCoolChannelIdFile.py:52
test_pyathena.parent
parent
Definition: test_pyathena.py:15
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
CaloCell_Base_ID::TILE
@ TILE
Definition: CaloCell_Base_ID.h:46
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
FastHitConvertTool::m_tileCabling
const TileCablingService * m_tileCabling
Definition: FastHitConvertTool.h:85
FastHitConvertTool::m_larFcalID
const LArFCAL_ID * m_larFcalID
Definition: FastHitConvertTool.h:81
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TileHWID::drawerIdx
int drawerIdx(const HWIdentifier &id) const
construct drawer index from HW identifier
Definition: TileHWID.h:175
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
TileHit
Definition: TileSimEvent/TileSimEvent/TileHit.h:30
LArHit
Class to store hit energy and time in LAr cell from G4 simulation.
Definition: LArHit.h:25
FastHitConvertTool::m_tileID
const TileID * m_tileID
Definition: FastHitConvertTool.h:83
FastHitConvertTool::m_emecHitContainerKey
SG::WriteHandleKey< LArHitContainer > m_emecHitContainerKey
Definition: FastHitConvertTool.h:61
LArEM_Base_ID::is_em_barrel
bool is_em_barrel(const Identifier id) const
test if the id belongs to the EM barrel
Tile_Base_ID::pmt_id
Identifier pmt_id(const Identifier &any_id) const
Definition: Tile_Base_ID.cxx:640
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
FastHitConvertTool::m_tileCablingSvc
ServiceHandle< TileCablingSvc > m_tileCablingSvc
Name of Tile cabling service.
Definition: FastHitConvertTool.h:77
hitTime
float hitTime(const AFP_SIDSimHit &hit)
Definition: AFP_SIDSimHit.h:39
FastHitConvertTool::m_larHecID
const LArHEC_ID * m_larHecID
Definition: FastHitConvertTool.h:82
CaloCell_Base_ID::LAREM
@ LAREM
Definition: CaloCell_Base_ID.h:46
FastHitConvertTool::m_fSamplKey
SG::ReadCondHandleKey< ILArfSampl > m_fSamplKey
Definition: FastHitConvertTool.h:66
AtlasDetectorID::is_lar_em
bool is_lar_em(Identifier id) const
Definition: AtlasDetectorID.h:818
LArEM_Base_ID::is_em_endcap
bool is_em_endcap(const Identifier id) const
test if the id belongs to the EM Endcap
ILArfSampl
Definition: ILArfSampl.h:14
TileCablingService::s2h_channel_id
HWIdentifier s2h_channel_id(const Identifier &id) const
Definition: TileCablingService.cxx:1076
Identifier
Definition: IdentifierFieldParser.cxx:14