ATLAS Offline Software
ParticleBrokerDynamicOnReadIn.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ISF_SERVICES_PARTICLEBROKERDYNAMICONREADIN_H
6 #define ISF_SERVICES_PARTICLEBROKERDYNAMICONREADIN_H 1
7 
8 // STL includes
9 #include <string>
10 #include <set>
11 
12 // FrameWork includes
13 #include "GaudiKernel/ToolHandle.h"
14 #include "GaudiKernel/ServiceHandle.h"
16 #include "GaudiKernel/ITHistSvc.h"
17 
18 // ISF includes
24 #include "ISF_Event/EntryLayer.h"
27 
28 // AtlasDetDescr
30 
31 // forward declarations
32 namespace PMonUtils {
33  class CustomBenchmark;
34 }
35 // ROOT forward declarations
36 class TTree;
37 
38 namespace ISF {
39 
40  class ISimulationSelector;
41 
42  typedef std::vector<ISimulationSelector*> SimSelectorArray;
43  typedef std::set<ISimulationSelector*> SimSelectorSet;
44 
53  class ATLAS_NOT_THREAD_SAFE ParticleBrokerDynamicOnReadIn : public extends<AthService, IParticleBroker> {
54  public:
55 
56  //** Constructor with parameters */
57  ParticleBrokerDynamicOnReadIn( const std::string& name, ISvcLocator* pSvcLocator );
58 
61 
64 
66  StatusCode initializeEvent(ISFParticleContainer&& simParticles);
67 
69  virtual StatusCode finalizeEvent();
70 
74  virtual void push( ISFParticle *particle, const ISFParticle *ancestor);
75 
77  virtual const ISFParticleVector& popVector(size_t maxVectorSize);
78 
80  virtual size_t numParticles() const;
81 
83  //const ParticleContainer& particleStack() const;
84 
85  /* Dump the stack to the screen */
86  StatusCode dump() const;
87 
89  StatusCode registerSimSelector(SimSelectorToolArray &simSelectorTools, AtlasDetDescr::AtlasRegion geoID);
90 
91  private:
94 
96  StatusCode registerPosValTree( const char *treeName,
97  const char *treeDescr,
98  TTree *&tree );
99 
101  void fillPosValTree( TTree *tree, const ISFParticle &particle);
102 
104  void updateAllSelectors(const ISFParticle &particle);
105 
108  void selectAndStore( ISFParticle* p);
109 
112  ISF::SimSvcID identifySimID( const ISF::ISFParticle* p);
113 
115  PublicToolHandle<IEntryLayerTool> m_entryLayerTool{this, "EntryLayerTool", "iGeant4::EntryLayerTool/ISF_EntryLayerTool"};
116 
118  PublicToolHandle<IParticleOrderingTool> m_orderingTool{this, "ParticleOrderingTool", ""};
119 
122  ServiceHandle<IGeoIDSvc> m_geoIDSvc{this, "GeoIDSvc", ""};
123  IGeoIDSvc *m_geoIDSvcQuick{};
124 
126  BooleanProperty m_forceGeoIDSvc{this, "AlwaysUseGeoIDSvc", false};
127 
129  BooleanProperty m_validateGeoID{this, "ValidateGeoIDs", false};
130 
133 
136 
140 
142  std::string m_screenOutputPrefix{"isf >> "};
143  std::string m_screenEmptyPrefix{""};
144 
146  BooleanProperty m_doSelectorCPUMon{this, "SimSelectorCPUMonitoring", false};
147  PMonUtils::CustomBenchmark *m_benchPDGCode{};
148  PMonUtils::CustomBenchmark *m_benchGeoID{};
149 
151  BooleanProperty m_validationOutput{this, "ValidationOutput", false, "If turned on, write out a ROOT tree."};
152  ServiceHandle<ITHistSvc> m_thistSvc{this, "THistService", "THistSvc"};
153  StringProperty m_validationStream{this, "ValidationStreamName", "ParticleBroker"};
154 
155  TTree *m_t_pushPosition{};
156  TTree *m_t_entryLayerPos[ISF::fNumAtlasEntryLayers];
158  int m_val_pdg{0};
159  float m_val_p{0.f};
160  float m_val_x{0.f};
161  float m_val_y{0.f};
162  float m_val_z{0.f};
163  };
164 
166  inline size_t ParticleBrokerDynamicOnReadIn::numParticles() const { return m_particles.size(); }
167 
169  /* inline const ParticleContainer& ParticleBrokerDynamicOnReadIn::particleStack() const
170  {
171  // @TODO:
172  //ATH_MSG_WARNING("TODO: the ParticleBrokerDynamicOnReadIn::particleStack() method only returns the active part of the partilce stack");
173  return m_activeStack;
174  } */
175 
176 }
177 
178 #endif //> !ISF_SERVICES_PARTICLEBROKERDYNAMICONREADIN_H
ISFParticleOrderedQueue.h
ISF::ISFParticleContainer
std::list< ISF::ISFParticle * > ISFParticleContainer
generic ISFParticle container (not necessarily a std::list!)
Definition: ISFParticleContainer.h:23
AtlasDetDescr::fNumAtlasRegions
@ fNumAtlasRegions
Definition: AtlasRegion.h:39
ISF::ParticleBrokerDynamicOnReadIn::m_simSelectorSet
SimSelectorSet m_simSelectorSet
used to remove multiple uses of the same selector
Definition: ParticleBrokerDynamicOnReadIn.h:139
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition: checker_macros.h:212
AtlasRegion.h
initialize
void initialize()
Definition: run_EoverP.cxx:894
AtlasDetDescr::AtlasRegion
AtlasRegion
Definition: AtlasRegion.h:27
IParticleBroker.h
tree
TChain * tree
Definition: tile_monitor.h:30
ISF::ISFParticleOrderedQueue
std::priority_queue< ISF::ISFParticle *, ISF::ISFParticleVector, ISF::ISFParticleOrdering > ISFParticleOrderedQueue
the actual particle priority_queue
Definition: ISFParticleOrderedQueue.h:28
ISF::ISFParticle
Definition: ISFParticle.h:42
ISF::SimSelectorToolArray
ToolHandleArray< ISimulationSelector > SimSelectorToolArray
typedef for better readable code
Definition: ISimulationSelector.h:76
IEntryLayerTool.h
run_Egamma1_LArStrip_Fex.dump
dump
Definition: run_Egamma1_LArStrip_Fex.py:88
ISFParticleContainer.h
ISF::SimSelectorArray
std::vector< ISimulationSelector * > SimSelectorArray
Definition: ParticleBrokerDynamicOnReadIn.h:40
ISF::ParticleBrokerDynamicOnReadIn::m_popParticles
ISFParticleVector m_popParticles
the vector of particles returned for simulation (via popVector() )
Definition: ParticleBrokerDynamicOnReadIn.h:135
PMonUtils
Definition: SimKernel.h:33
ISF::fNumAtlasEntryLayers
@ fNumAtlasEntryLayers
Definition: EntryLayer.h:41
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
EntryLayer.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ISF::SimSelectorSet
std::set< ISimulationSelector * > SimSelectorSet
Definition: ParticleBrokerDynamicOnReadIn.h:43
ISF::ParticleBrokerDynamicOnReadIn::numParticles
virtual size_t numParticles() const
Get the current stack size.
Definition: ParticleBrokerDynamicOnReadIn.h:166
ISF::ISFParticleVector
std::vector< ISF::ISFParticle * > ISFParticleVector
ISFParticle vector.
Definition: ISFParticleContainer.h:26
ISF::IGeoIDSvc
Definition: IGeoIDSvc.h:41
dumpFileToPlots.treeName
string treeName
Definition: dumpFileToPlots.py:20
ISF::ParticleBrokerDynamicOnReadIn::ParticleBrokerDynamicOnReadIn
ParticleBrokerDynamicOnReadIn()
Default constructor.
IGeoIDSvc.h
IParticleOrderingTool.h
ISF::ParticleBrokerDynamicOnReadIn::m_particles
ISFParticleOrderedQueue m_particles
the particle container storing all particles which need to be simulated
Definition: ParticleBrokerDynamicOnReadIn.h:132
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ISF::ParticleBrokerDynamicOnReadIn
Definition: ParticleBrokerDynamicOnReadIn.h:53
ISF::SimSvcID
uint8_t SimSvcID
Simulation service ID datatype.
Definition: SimSvcID.h:28
ISF
ISFParticleOrderedQueue.
Definition: PrimaryParticleInformation.h:13
AthService.h
SimulationFlavor.h
PMonUtils::CustomBenchmark
Definition: CustomBenchmark.h:30
ServiceHandle
Definition: ClusterMakerTool.h:37