ATLAS Offline Software
TruthSvc.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_TRUTHSVC_H
6 #define ISF_SERVICES_TRUTHSVC_H 1
7 
8 // STL includes
9 #include <string>
10 
11 // FrameWork includes
12 #include "GaudiKernel/ToolHandle.h"
13 #include "GaudiKernel/ServiceHandle.h"
15 
16 // ISF include
20 
21 // DetectorDescription
23 
24 // Barcode
26 
27 // McEventCollection
29 
30 // forward declarations
31 class StoreGateSvc;
32 
34 #include "AtlasHepMC/GenVertex.h"
35 
36 namespace ISFTesting {
37  class TruthSvc_test;
38 }
39 
40 namespace ISF {
41 
50  class TruthSvc final : public extends<AthService, ITruthSvc> {
51 
52  // allow test to access private data
53  friend ISFTesting::TruthSvc_test;
54 
55  public:
56 
57  //** Constructor with parameters */
58  TruthSvc( const std::string& name, ISvcLocator* pSvcLocator );
59 
61  virtual ~TruthSvc() = default;
62 
64  StatusCode initialize() override;
66  StatusCode finalize() override;
67 
69  void registerTruthIncident( ITruthIncident& truthincident, bool saveAllChildren=false) const override;
70 
72  StatusCode initializeTruthCollection(int largestGeneratedParticleBC=0, int largestGeneratedVertexBC=0) override;
73 
75  StatusCode releaseEvent() override;
76 
77  private:
79  void recordIncidentToMCTruth( ITruthIncident& truthincident, bool passWholeVertex) const;
82 
83  ServiceHandle<Barcode::IBarcodeSvc> m_barcodeSvc{this, "BarcodeSvc", "BarcodeSvc", ""};
84 
86  ToolHandleArray<ITruthStrategy> m_truthStrategies{this, "TruthStrategies", {}, ""};
90 
92  Gaudi::Property<bool> m_skipIfNoChildren{this, "SkipIfNoChildren", true, ""};
93  Gaudi::Property<bool> m_skipIfNoParentId{this, "SkipIfNoParentId", true, ""};
94  Gaudi::Property<bool> m_ignoreUndefinedBarcodes{this, "IgnoreUndefinedBarcodes", false, ""};
95 
96  Gaudi::Property<bool> m_passWholeVertex{this, "PassWholeVertices", true, ""};
97 
98  Gaudi::Property<std::vector<unsigned int> > m_forceEndVtxRegionsVec{this, "ForceEndVtxInRegions", {}, ""};
99  // to write end-vtx
100  std::array<bool, AtlasDetDescr::fNumAtlasRegions> m_forceEndVtx;
101  // all parent particles if they die
102 
103  Gaudi::Property<bool> m_quasiStableParticlesIncluded{this, "QuasiStableParticlesIncluded", false, ""};
104  Gaudi::Property<bool> m_quasiStableParticleOverwrite{this, "QuasiStableParticleOverwrite", true, ""};
105 
106  };
107 }
108 
109 
110 #endif //> !ISF_SERVICES_TRUTHSVC_H
HepMC::GenVertexPtr
HepMC::GenVertex * GenVertexPtr
Definition: GenVertex.h:59
ISF::TruthSvc::TruthSvc
TruthSvc(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: TruthSvc.cxx:49
AtlasDetDescr::fNumAtlasRegions
@ fNumAtlasRegions
Definition: AtlasRegion.h:39
ISF::TruthSvc::~TruthSvc
virtual ~TruthSvc()=default
Destructor.
ISF::TruthSvc::registerTruthIncident
void registerTruthIncident(ITruthIncident &truthincident, bool saveAllChildren=false) const override
Register a truth incident.
Definition: TruthSvc.cxx:125
ISF::TruthSvc::m_quasiStableParticleOverwrite
Gaudi::Property< bool > m_quasiStableParticleOverwrite
should the job be overwriting QS particles
Definition: TruthSvc.h:104
ISF::TruthSvc::m_passWholeVertex
Gaudi::Property< bool > m_passWholeVertex
Definition: TruthSvc.h:96
ISF::TruthSvc::releaseEvent
StatusCode releaseEvent() override
Finalize the Truth Svc at the end of each event.
Definition: TruthSvc.cxx:119
ISF::TruthSvc::m_quasiStableParticlesIncluded
Gaudi::Property< bool > m_quasiStableParticlesIncluded
does this job simulate quasi-stable particles.
Definition: TruthSvc.h:103
AtlasRegion.h
ISF::ITruthStrategy
Definition: ITruthStrategy.h:29
GenVertex.h
ISF::TruthSvc::m_forceEndVtxRegionsVec
Gaudi::Property< std::vector< unsigned int > > m_forceEndVtxRegionsVec
property containing AtlasRegions for which
Definition: TruthSvc.h:98
ISF::TruthSvc::finalize
StatusCode finalize() override
Athena algorithm's interface method finalize()
Definition: TruthSvc.cxx:105
ISF::TruthSvc::m_barcodeSvc
ServiceHandle< Barcode::IBarcodeSvc > m_barcodeSvc
The Barcode service.
Definition: TruthSvc.h:83
ITruthStrategy.h
ISF::TruthSvc::m_geoStrategies
ITruthStrategy ** m_geoStrategies[AtlasDetDescr::fNumAtlasRegions]
for faster access: using an internal pointer to the actual ITruthStrategy instances
Definition: TruthSvc.h:88
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
McEventCollection.h
ITruthIncident.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ISF::ITruthIncident
Definition: ITruthIncident.h:45
GenEvent_fwd.h
IBarcodeSvc.h
ISF::TruthSvc::createGenVertexFromTruthIncident
HepMC::GenVertexPtr createGenVertexFromTruthIncident(ITruthIncident &truthincident) const
Record and end vertex to the MC Truth for the parent particle.
Definition: TruthSvc.cxx:300
ISF::TruthSvc::initializeTruthCollection
StatusCode initializeTruthCollection(int largestGeneratedParticleBC=0, int largestGeneratedVertexBC=0) override
Initialize the Truth Svc at the beginning of each event.
Definition: TruthSvc.cxx:113
ISF::TruthSvc::m_skipIfNoParentId
Gaudi::Property< bool > m_skipIfNoParentId
do not record if parentId == HepMC::UNDEFINED_ID
Definition: TruthSvc.h:93
ISF::TruthSvc::recordIncidentToMCTruth
void recordIncidentToMCTruth(ITruthIncident &truthincident, bool passWholeVertex) const
Record the given truth incident to the MC Truth.
Definition: TruthSvc.cxx:199
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
ISF::TruthSvc::m_skipIfNoChildren
Gaudi::Property< bool > m_skipIfNoChildren
MCTruth steering.
Definition: TruthSvc.h:92
ISF::TruthSvc::m_truthStrategies
ToolHandleArray< ITruthStrategy > m_truthStrategies
the truth strategies applied (as AthenaToolHandle Array)
Definition: TruthSvc.h:86
ISF::TruthSvc::m_forceEndVtx
std::array< bool, AtlasDetDescr::fNumAtlasRegions > m_forceEndVtx
attach end vertex to
Definition: TruthSvc.h:100
ISF
ISFParticleOrderedQueue.
Definition: PrimaryParticleInformation.h:13
ISF::TruthSvc::m_numStrategies
unsigned short m_numStrategies[AtlasDetDescr::fNumAtlasRegions]
Definition: TruthSvc.h:89
AthService.h
ISFTesting
Core Athena algorithm for the Integrated Simulation Framework.
Definition: CollectionMerger.h:37
ITruthSvc.h
ISF::TruthSvc::initialize
StatusCode initialize() override
Athena algorithm's interface method initialize()
Definition: TruthSvc.cxx:57
ISF::TruthSvc::m_ignoreUndefinedBarcodes
Gaudi::Property< bool > m_ignoreUndefinedBarcodes
do/don't abort if retrieve an undefined barcode
Definition: TruthSvc.h:94
ISF::TruthSvc
Definition: TruthSvc.h:50
ServiceHandle< Barcode::IBarcodeSvc >