ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ISF::SimHitTreeCreator Class Reference

#include <SimHitTreeCreator.h>

Inheritance diagram for ISF::SimHitTreeCreator:
Collaboration diagram for ISF::SimHitTreeCreator:

Public Member Functions

 SimHitTreeCreator (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor with parameters. More...
 
virtual ~SimHitTreeCreator ()
 Destructor. More...
 
virtual StatusCode initialize () override final
 Athena algorithm's interface method initialize() More...
 
virtual StatusCode execute () override final
 Athena algorithm's interface method execute() More...
 
virtual StatusCode sysInitialize () override
 Override sysInitialize. More...
 
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

StatusCode createSimHitsTree ()
 Create the simhits tree - validation mode only. More...
 
StatusCode fillSimHitsTree ()
 Fill the simhits tree - validation mode only. More...
 
void addHepMcParticleLinkInfoToTree (HepMcParticleLink &HMPL)
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

ServiceHandle< ITHistSvc > m_thistSvc
 the histogram service More...
 
std::string m_validationStream
 validation THist stream name More...
 
TTree * m_t_simHits
 Validation output TTree (+variables) More...
 
int m_pileup
 
int m_type
 
int m_id
 
int m_mother
 
int m_barcode
 
float m_time
 
float m_drift
 
float m_edeposit
 
float m_momentum
 
float m_theta
 
float m_phi
 
float m_eta
 
SG::ReadHandleKey< SiHitCollectionm_bcmHits
 
SG::ReadHandleKey< SiHitCollectionm_blmHits
 
SG::ReadHandleKey< SiHitCollectionm_pixHits
 
SG::ReadHandleKey< SiHitCollectionm_sctHits
 
SG::ReadHandleKey< TRTUncompressedHitCollectionm_trtHits
 
SG::ReadHandleKey< SiHitCollectionm_pixPileupHits
 
SG::ReadHandleKey< SiHitCollectionm_sctPileupHits
 
SG::ReadHandleKey< TRTUncompressedHitCollectionm_trtPileupHits
 
SG::ReadHandleKey< MDTSimHitCollectionm_mdtHits
 
SG::ReadHandleKey< RPCSimHitCollectionm_rpcHits
 
SG::ReadHandleKey< TGCSimHitCollectionm_tgcHits
 
SG::ReadHandleKey< CSCSimHitCollectionm_cscHits
 
DataObjIDColl m_extendedExtraObjects
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 27 of file SimHitTreeCreator.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ SimHitTreeCreator()

ISF::SimHitTreeCreator::SimHitTreeCreator ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Constructor with parameters.

Definition at line 18 of file SimHitTreeCreator.cxx.

19  : ::AthAlgorithm( name, pSvcLocator )
20  , m_thistSvc("THistSvc",name)
21  , m_validationStream("ISFSimHit")
22  , m_t_simHits(nullptr)
23  , m_pileup(-1)
24  , m_type(-1)
25  , m_id(-1)
26  , m_mother(-1)
27  , m_barcode(-1)
28  , m_time(-1.)
29  , m_drift(-1.)
30  , m_edeposit(-1.)
31  , m_momentum(-1.)
32  , m_theta(-1.)
33  , m_phi(-1.)
34  , m_eta(-1.)
35  , m_bcmHits("BCMHits")
36  , m_blmHits("BLMHits")
37  , m_pixHits("PixelHits")
38  , m_sctHits("SCT_Hits")
39  , m_trtHits("TRTUncompressedHits")
40  , m_pixPileupHits("PileupPixelHits")
41  , m_sctPileupHits("PileupSCT_Hits")
42  , m_trtPileupHits("PileupTRTUncompressedHits")
43  , m_mdtHits("MDT_Hits")
44  , m_rpcHits("RPC_Hits")
45  , m_tgcHits("TGC_Hits")
46  , m_cscHits("CSC_Hits")
47 {
48  declareProperty("ValidationStreamName",
49  m_validationStream = "ISFSimHit",
50  "Name of the output stream" );
51  declareProperty("THistService",
52  m_thistSvc,
53  "The THistSvc" );
54 
55  declareProperty("BCM_HitCollection", m_bcmHits );
56  declareProperty("BLM_HitCollection", m_blmHits );
57  declareProperty("PixelHitCollection", m_pixHits );
58  declareProperty("SCT_HitCollection", m_sctHits );
59  declareProperty("TRT_HitCollection", m_trtHits );
60  declareProperty("PileupPixelHitCollection", m_pixPileupHits );
61  declareProperty("PileupSCT_HitCollection", m_sctPileupHits );
62  declareProperty("PileupTRT_HitCollection", m_trtPileupHits );
63  declareProperty("MDT_HitCollection", m_mdtHits );
64  declareProperty("RPC_HitCollection", m_rpcHits );
65  declareProperty("TGC_HitCollection", m_tgcHits );
66  declareProperty("CSC_HitCollection", m_cscHits );
67 
68 }

◆ ~SimHitTreeCreator()

ISF::SimHitTreeCreator::~SimHitTreeCreator ( )
virtual

Destructor.

Definition at line 72 of file SimHitTreeCreator.cxx.

73 {}

Member Function Documentation

◆ addHepMcParticleLinkInfoToTree()

void ISF::SimHitTreeCreator::addHepMcParticleLinkInfoToTree ( HepMcParticleLink HMPL)
private

Definition at line 310 of file SimHitTreeCreator.cxx.

310  {
311  if (HMPL.isValid()) {
312  auto t_mom=(HMPL.cptr())->momentum();
313  m_momentum = std::sqrt( t_mom.x()*t_mom.x()+t_mom.y()*t_mom.y()+t_mom.z()*t_mom.z());
314  m_eta= (HMPL.cptr())->momentum().eta();
315  m_theta= (HMPL.cptr())->momentum().theta();
316  m_phi = (HMPL.cptr())->momentum().phi();
317  }
318  else {
319  m_momentum=-1.;
320  m_theta=-1.;
321  m_eta=-10.;
322  m_phi = -10.;
323  }
324  return;
325 }

◆ createSimHitsTree()

StatusCode ISF::SimHitTreeCreator::createSimHitsTree ( )
private

Create the simhits tree - validation mode only.

Definition at line 103 of file SimHitTreeCreator.cxx.

103  {
104  // Create the prefix of histogram names for the THistSvc
105  //std::string prefix = "/" + m_validationStream + "/";
106  const char *treeName="simhits";
107  const std::string prefix = "/" + m_validationStream + "/"+ treeName;
108  m_t_simHits = new TTree( treeName, treeName );
109  m_t_simHits->Branch("pileup" , &m_pileup , "pileup/I" );
110  m_t_simHits->Branch("type" , &m_type , "type/I" );
111  m_t_simHits->Branch("id" , &m_id , "id/I" );
112  m_t_simHits->Branch("mother" , &m_mother , "mother/I" );
113  m_t_simHits->Branch("barcode" , &m_barcode , "barcode/I" );
114  m_t_simHits->Branch("momentum" , &m_momentum , "momentum/F" );
115  m_t_simHits->Branch("time" , &m_time , "time/F" );
116  m_t_simHits->Branch("drift" , &m_drift , "dist/F" );
117  m_t_simHits->Branch("edeposit" , &m_edeposit , "edeposit/F" );
118  m_t_simHits->Branch("theta" , &m_theta , "theta/F" );
119  m_t_simHits->Branch("phi" , &m_phi , "phi/F" );
120  m_t_simHits->Branch("eta" , &m_eta , "eta/F" );
121 
122  // register the Tree to the THistSvc and return it's StatusCodes
123  ATH_CHECK( m_thistSvc->regTree( prefix, m_t_simHits) );
124 
125  return StatusCode::SUCCESS;
126 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ execute()

StatusCode ISF::SimHitTreeCreator::execute ( )
finaloverridevirtual

Athena algorithm's interface method execute()

Definition at line 97 of file SimHitTreeCreator.cxx.

97  {
98  ATH_CHECK(this->fillSimHitsTree());
99  return StatusCode::SUCCESS;
100 }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51 {
52  // If we didn't find any symlinks to add, just return the collection
53  // from the base class. Otherwise, return the extended collection.
54  if (!m_extendedExtraObjects.empty()) {
56  }
57  return Algorithm::extraOutputDeps();
58 }

◆ fillSimHitsTree()

StatusCode ISF::SimHitTreeCreator::fillSimHitsTree ( )
private

Fill the simhits tree - validation mode only.

Fill the simhit TTree - validation mode only.

Definition at line 129 of file SimHitTreeCreator.cxx.

130 {
131  // loop over collections
132 
134  if (mdtHits.isValid() && mdtHits->size()) {
135  MDTSimHitCollection::const_iterator ih=mdtHits->begin();
136  while ( ih!=mdtHits->end()) {
137  m_type = 1;
138  m_id = (*ih).MDTid();
139  m_mother = (*ih).particleEncoding();
140  m_time = (*ih).globalTime();
141  m_drift = (*ih).driftRadius();
142  m_edeposit = (*ih).energyDeposit();
143  m_barcode = (*ih).truthBarcode();
144  HepMcParticleLink HMPL = (*ih).particleLink();
145  this->addHepMcParticleLinkInfoToTree(HMPL);
146 
147  ++ih;
148  while (ih!=mdtHits->end() && m_id==(*ih).MDTid() && m_barcode==(*ih).truthBarcode() ) {
149  // merge energy deposits and move on
150  m_edeposit += (*ih).energyDeposit();
151  ++ih;
152  }
153  m_t_simHits->Fill();
154  }
155  }
156 
158  if (rpcHits.isValid() && rpcHits->size()) {
159  RPCSimHitCollection::const_iterator ih=rpcHits->begin();
160  while (ih!=rpcHits->end()) {
161  m_type = 2;
162  m_id = (*ih).RPCid();
163  m_mother = (*ih).particleEncoding();
164  m_time = (*ih).globalTime();
165  m_drift = 0.;
166  m_edeposit = (*ih).energyDeposit();
167  m_barcode = (*ih).truthBarcode();
168  HepMcParticleLink HMPL = (*ih).particleLink();
169  this->addHepMcParticleLinkInfoToTree(HMPL);
170 
171  ++ih;
172  while (ih!=rpcHits->end() && m_id==(*ih).RPCid() && m_barcode==(*ih).truthBarcode() ) {
173  // merge energy deposits and move on
174  m_edeposit += (*ih).energyDeposit();
175  ++ih;
176  }
177  m_t_simHits->Fill();
178  }
179  }
180 
182  if (tgcHits.isValid() && tgcHits->size()) {
183  TGCSimHitCollection::const_iterator ih=tgcHits->begin();
184  while ( ih!=tgcHits->end()) {
185  m_type = 3;
186  m_id = (*ih).TGCid();
187  m_mother = (*ih).particleEncoding();
188  m_time = (*ih).globalTime();
189  m_drift = 0.;
190  m_edeposit = (*ih).energyDeposit();
191  m_barcode = (*ih).truthBarcode();
192  HepMcParticleLink HMPL = (*ih).particleLink();
193  this->addHepMcParticleLinkInfoToTree(HMPL);
194 
195  ++ih;
196  while (ih!=tgcHits->end() && m_id==(*ih).TGCid() && m_barcode==(*ih).truthBarcode() ) {
197  // merge energy deposits and move on
198  m_edeposit += (*ih).energyDeposit();
199  ++ih;
200  }
201  m_t_simHits->Fill();
202  }
203  }
204 
206  if (cscHits.isValid() && cscHits->size()) {
207  CSCSimHitCollection::const_iterator ih=cscHits->begin();
208  while ( ih!=cscHits->end()) {
209  m_type = 4;
210  m_id = (*ih).CSCid();
211  m_mother = (*ih).particleID();
212  m_time = (*ih).globalTime();
213  m_drift = 0.;
214  m_edeposit = (*ih).energyDeposit();
215  m_barcode = (*ih).truthBarcode();
216  HepMcParticleLink HMPL = (*ih).particleLink();
217  this->addHepMcParticleLinkInfoToTree(HMPL);
218 
219  ++ih;
220  while (ih!=cscHits->end() && m_id==(*ih).CSCid() && m_barcode==(*ih).truthBarcode() ) {
221  // merge energy deposits and move on
222  m_edeposit += (*ih).energyDeposit();
223  ++ih;
224  }
225  m_t_simHits->Fill();
226  }
227  }
228 
229  for (int ipileup=0;ipileup<2;ipileup++) {
230  m_pileup = ipileup;
231 
233  if (pixHits.isValid() && pixHits->size()) {
234  SiHitCollection::const_iterator ih=pixHits->begin();
235  while (ih!=pixHits->end()) {
236  m_type = 5;
237  m_id = (*ih).identify();
238  HepMcParticleLink HMPL = (*ih).particleLink();
239  if (HMPL.isValid()) m_mother = (HMPL.cptr())->pdg_id();
240  else m_mother=0;
241  m_time = (*ih).meanTime();
242  m_drift = 0.;
243  m_edeposit = (*ih).energyLoss();
244  m_barcode = (*ih).truthBarcode();
245  this->addHepMcParticleLinkInfoToTree(HMPL);
246 
247  ++ih;
248  while (ih!=pixHits->end() && ((unsigned int)m_id)==(*ih).identify() && m_barcode==(*ih).truthBarcode() ) {
249  // merge energy deposits and move on
250  m_edeposit += (*ih).energyLoss();
251  ++ih;
252  }
253  m_t_simHits->Fill();
254  }
255  }
256 
258  if (sctHits.isValid() && sctHits->size()) {
259  SiHitCollection::const_iterator ih=sctHits->begin();
260  while (ih!=sctHits->end()) {
261  m_type = 6;
262  m_id = (*ih).identify();
263  HepMcParticleLink HMPL = (*ih).particleLink();
264  if (HMPL.isValid()) m_mother = (HMPL.cptr())->pdg_id();
265  else m_mother=0;
266  m_time = (*ih).meanTime();
267  m_drift = 0.;
268  m_edeposit = (*ih).energyLoss();
269  m_barcode = (*ih).truthBarcode();
270  this->addHepMcParticleLinkInfoToTree(HMPL);
271 
272  ++ih;
273  while (ih!=sctHits->end() && ((unsigned int)m_id)==(*ih).identify() && m_barcode==(*ih).truthBarcode() ) {
274  // merge energy deposits and move on
275  m_edeposit += (*ih).energyLoss();
276  ++ih;
277  }
278  m_t_simHits->Fill();
279  }
280  }
281 
283  if (trtHits.isValid() && trtHits->size()) {
285  while ( ih!=trtHits->end()) {
286  m_type = 7;
287  m_id = (*ih).GetHitID();
288  m_mother = (*ih).GetParticleEncoding();
289  HepMcParticleLink HMPL = (*ih).particleLink();
290  m_time = (*ih).GetGlobalTime();
291  m_drift = 0.;
292  m_edeposit = (*ih).GetEnergyDeposit();
293  m_barcode = (*ih).truthBarcode();
294  this->addHepMcParticleLinkInfoToTree(HMPL);
295 
296  ++ih;
297  while (ih!=trtHits->end() && m_id==(*ih).GetHitID() && m_barcode==(*ih).truthBarcode() ) {
298  // merge energy deposits and move on
299  m_edeposit += (*ih).GetEnergyDeposit();
300  ++ih;
301  }
302  m_t_simHits->Fill();
303  }
304  }
305  }
306  return StatusCode::SUCCESS;
307 }

◆ initialize()

StatusCode ISF::SimHitTreeCreator::initialize ( )
finaloverridevirtual

Athena algorithm's interface method initialize()

framework methods

Definition at line 76 of file SimHitTreeCreator.cxx.

76  {
77  // retrieve the histogram service
78  ATH_CHECK( m_thistSvc.retrieve() );
79 
81 
82  ATH_CHECK( m_bcmHits.initialize() );
83  ATH_CHECK( m_blmHits.initialize() );
84  ATH_CHECK( m_pixHits.initialize() );
85  ATH_CHECK( m_sctHits.initialize() );
86  ATH_CHECK( m_trtHits.initialize() );
87  ATH_CHECK( m_pixPileupHits.initialize() );
88  ATH_CHECK( m_sctPileupHits.initialize() );
89  ATH_CHECK( m_trtPileupHits.initialize() );
90  ATH_CHECK( m_mdtHits.initialize() );
91  ATH_CHECK( m_rpcHits.initialize() );
92  ATH_CHECK( m_tgcHits.initialize() );
93  ATH_CHECK( m_cscHits.initialize() );
94  return StatusCode::SUCCESS;
95 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg() [1/2]

MsgStream& AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< Algorithm >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, PyAthena::Alg, and AthHistogramAlgorithm.

Definition at line 66 of file AthAlgorithm.cxx.

66  {
68 
69  if (sc.isFailure()) {
70  return sc;
71  }
72  ServiceHandle<ICondSvc> cs("CondSvc",name());
73  for (auto h : outputHandles()) {
74  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75  // do this inside the loop so we don't create the CondSvc until needed
76  if ( cs.retrieve().isFailure() ) {
77  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78  return StatusCode::SUCCESS;
79  }
80  if (cs->regHandle(this,*h).isFailure()) {
81  sc = StatusCode::FAILURE;
82  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83  << " with CondSvc");
84  }
85  }
86  }
87  return sc;
88 }

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_barcode

int ISF::SimHitTreeCreator::m_barcode
private

Definition at line 58 of file SimHitTreeCreator.h.

◆ m_bcmHits

SG::ReadHandleKey<SiHitCollection> ISF::SimHitTreeCreator::m_bcmHits
private

Definition at line 69 of file SimHitTreeCreator.h.

◆ m_blmHits

SG::ReadHandleKey<SiHitCollection> ISF::SimHitTreeCreator::m_blmHits
private

Definition at line 70 of file SimHitTreeCreator.h.

◆ m_cscHits

SG::ReadHandleKey<CSCSimHitCollection> ISF::SimHitTreeCreator::m_cscHits
private

Definition at line 82 of file SimHitTreeCreator.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_drift

float ISF::SimHitTreeCreator::m_drift
private

Definition at line 60 of file SimHitTreeCreator.h.

◆ m_edeposit

float ISF::SimHitTreeCreator::m_edeposit
private

Definition at line 61 of file SimHitTreeCreator.h.

◆ m_eta

float ISF::SimHitTreeCreator::m_eta
private

Definition at line 65 of file SimHitTreeCreator.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_id

int ISF::SimHitTreeCreator::m_id
private

Definition at line 56 of file SimHitTreeCreator.h.

◆ m_mdtHits

SG::ReadHandleKey<MDTSimHitCollection> ISF::SimHitTreeCreator::m_mdtHits
private

Definition at line 79 of file SimHitTreeCreator.h.

◆ m_momentum

float ISF::SimHitTreeCreator::m_momentum
private

Definition at line 62 of file SimHitTreeCreator.h.

◆ m_mother

int ISF::SimHitTreeCreator::m_mother
private

Definition at line 57 of file SimHitTreeCreator.h.

◆ m_phi

float ISF::SimHitTreeCreator::m_phi
private

Definition at line 64 of file SimHitTreeCreator.h.

◆ m_pileup

int ISF::SimHitTreeCreator::m_pileup
private

Definition at line 54 of file SimHitTreeCreator.h.

◆ m_pixHits

SG::ReadHandleKey<SiHitCollection> ISF::SimHitTreeCreator::m_pixHits
private

Definition at line 71 of file SimHitTreeCreator.h.

◆ m_pixPileupHits

SG::ReadHandleKey<SiHitCollection> ISF::SimHitTreeCreator::m_pixPileupHits
private

Definition at line 74 of file SimHitTreeCreator.h.

◆ m_rpcHits

SG::ReadHandleKey<RPCSimHitCollection> ISF::SimHitTreeCreator::m_rpcHits
private

Definition at line 80 of file SimHitTreeCreator.h.

◆ m_sctHits

SG::ReadHandleKey<SiHitCollection> ISF::SimHitTreeCreator::m_sctHits
private

Definition at line 72 of file SimHitTreeCreator.h.

◆ m_sctPileupHits

SG::ReadHandleKey<SiHitCollection> ISF::SimHitTreeCreator::m_sctPileupHits
private

Definition at line 75 of file SimHitTreeCreator.h.

◆ m_t_simHits

TTree* ISF::SimHitTreeCreator::m_t_simHits
private

Validation output TTree (+variables)

ROOT tree containing simulated hit info

Definition at line 53 of file SimHitTreeCreator.h.

◆ m_tgcHits

SG::ReadHandleKey<TGCSimHitCollection> ISF::SimHitTreeCreator::m_tgcHits
private

Definition at line 81 of file SimHitTreeCreator.h.

◆ m_theta

float ISF::SimHitTreeCreator::m_theta
private

Definition at line 63 of file SimHitTreeCreator.h.

◆ m_thistSvc

ServiceHandle<ITHistSvc> ISF::SimHitTreeCreator::m_thistSvc
private

the histogram service

Definition at line 50 of file SimHitTreeCreator.h.

◆ m_time

float ISF::SimHitTreeCreator::m_time
private

Definition at line 59 of file SimHitTreeCreator.h.

◆ m_trtHits

SG::ReadHandleKey<TRTUncompressedHitCollection> ISF::SimHitTreeCreator::m_trtHits
private

Definition at line 73 of file SimHitTreeCreator.h.

◆ m_trtPileupHits

SG::ReadHandleKey<TRTUncompressedHitCollection> ISF::SimHitTreeCreator::m_trtPileupHits
private

Definition at line 76 of file SimHitTreeCreator.h.

◆ m_type

int ISF::SimHitTreeCreator::m_type
private

Definition at line 55 of file SimHitTreeCreator.h.

◆ m_validationStream

std::string ISF::SimHitTreeCreator::m_validationStream
private

validation THist stream name

Definition at line 51 of file SimHitTreeCreator.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
ISF::SimHitTreeCreator::m_pixHits
SG::ReadHandleKey< SiHitCollection > m_pixHits
Definition: SimHitTreeCreator.h:71
ISF::SimHitTreeCreator::m_thistSvc
ServiceHandle< ITHistSvc > m_thistSvc
the histogram service
Definition: SimHitTreeCreator.h:50
ISF::SimHitTreeCreator::m_drift
float m_drift
Definition: SimHitTreeCreator.h:60
ISF::SimHitTreeCreator::m_blmHits
SG::ReadHandleKey< SiHitCollection > m_blmHits
Definition: SimHitTreeCreator.h:70
ISF::SimHitTreeCreator::m_sctPileupHits
SG::ReadHandleKey< SiHitCollection > m_sctPileupHits
Definition: SimHitTreeCreator.h:75
ISF::SimHitTreeCreator::m_sctHits
SG::ReadHandleKey< SiHitCollection > m_sctHits
Definition: SimHitTreeCreator.h:72
ISF::SimHitTreeCreator::m_rpcHits
SG::ReadHandleKey< RPCSimHitCollection > m_rpcHits
Definition: SimHitTreeCreator.h:80
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
ISF::SimHitTreeCreator::addHepMcParticleLinkInfoToTree
void addHepMcParticleLinkInfoToTree(HepMcParticleLink &HMPL)
Definition: SimHitTreeCreator.cxx:310
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ISF::SimHitTreeCreator::m_pixPileupHits
SG::ReadHandleKey< SiHitCollection > m_pixPileupHits
Definition: SimHitTreeCreator.h:74
ISF::SimHitTreeCreator::m_edeposit
float m_edeposit
Definition: SimHitTreeCreator.h:61
AtlasHitsVector::const_iterator
CONT::const_iterator const_iterator
Definition: AtlasHitsVector.h:43
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
ISF::SimHitTreeCreator::m_trtPileupHits
SG::ReadHandleKey< TRTUncompressedHitCollection > m_trtPileupHits
Definition: SimHitTreeCreator.h:76
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
ISF::SimHitTreeCreator::m_trtHits
SG::ReadHandleKey< TRTUncompressedHitCollection > m_trtHits
Definition: SimHitTreeCreator.h:73
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
ISF::SimHitTreeCreator::createSimHitsTree
StatusCode createSimHitsTree()
Create the simhits tree - validation mode only.
Definition: SimHitTreeCreator.cxx:103
ISF::SimHitTreeCreator::m_eta
float m_eta
Definition: SimHitTreeCreator.h:65
ISF::SimHitTreeCreator::m_cscHits
SG::ReadHandleKey< CSCSimHitCollection > m_cscHits
Definition: SimHitTreeCreator.h:82
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
AthAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthAlgorithm.cxx:66
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ParticleGun_EoverP_Config.momentum
momentum
Definition: ParticleGun_EoverP_Config.py:63
AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ISF::SimHitTreeCreator::m_time
float m_time
Definition: SimHitTreeCreator.h:59
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
dumpFileToPlots.treeName
string treeName
Definition: dumpFileToPlots.py:20
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ISF::SimHitTreeCreator::m_momentum
float m_momentum
Definition: SimHitTreeCreator.h:62
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
ISF::SimHitTreeCreator::m_id
int m_id
Definition: SimHitTreeCreator.h:56
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
ISF::SimHitTreeCreator::m_theta
float m_theta
Definition: SimHitTreeCreator.h:63
ISF::SimHitTreeCreator::m_barcode
int m_barcode
Definition: SimHitTreeCreator.h:58
ISF::SimHitTreeCreator::m_pileup
int m_pileup
Definition: SimHitTreeCreator.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
ISF::SimHitTreeCreator::m_validationStream
std::string m_validationStream
validation THist stream name
Definition: SimHitTreeCreator.h:51
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ISF::SimHitTreeCreator::m_phi
float m_phi
Definition: SimHitTreeCreator.h:64
ISF::SimHitTreeCreator::fillSimHitsTree
StatusCode fillSimHitsTree()
Fill the simhits tree - validation mode only.
Definition: SimHitTreeCreator.cxx:129
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition: AthAlgorithm.h:79
ISF::SimHitTreeCreator::m_mdtHits
SG::ReadHandleKey< MDTSimHitCollection > m_mdtHits
Definition: SimHitTreeCreator.h:79
ISF::SimHitTreeCreator::m_type
int m_type
Definition: SimHitTreeCreator.h:55
a
TList * a
Definition: liststreamerinfos.cxx:10
ISF::SimHitTreeCreator::m_mother
int m_mother
Definition: SimHitTreeCreator.h:57
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
ISF::SimHitTreeCreator::m_bcmHits
SG::ReadHandleKey< SiHitCollection > m_bcmHits
Definition: SimHitTreeCreator.h:69
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
AthAlgorithm::AthAlgorithm
AthAlgorithm()
Default constructor:
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
ISF::SimHitTreeCreator::m_tgcHits
SG::ReadHandleKey< TGCSimHitCollection > m_tgcHits
Definition: SimHitTreeCreator.h:81
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528
ServiceHandle< ICondSvc >
ISF::SimHitTreeCreator::m_t_simHits
TTree * m_t_simHits
Validation output TTree (+variables)
Definition: SimHitTreeCreator.h:53