ATLAS Offline Software
Loading...
Searching...
No Matches
TruthStrategyManager.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5// class header
7
8// Framework includes
10
12
13// Geant4 Includes
14#include "G4Event.hh"
15#include "G4EventManager.hh"
16#include "G4PhysicalVolumeStore.hh"
17#include "G4Step.hh"
18#include "G4TransportationManager.hh"
19#include "G4VPhysicalVolume.hh"
20#include "G4VSolid.hh"
21
22// Truth-related includes
24#include "MCTruth/TrackHelper.h"
25
26// ISF includes
30
31// DetectorDescription
35
41
43{
44 static const TruthStrategyManager theMgr;
45 return theMgr;
46}
47
48TruthStrategyManager& TruthStrategyManager::GetStrategyManager_nc ATLAS_NOT_THREAD_SAFE ()
49{
50 return const_cast<TruthStrategyManager&>(GetStrategyManager());
51}
52
54{
55 m_truthSvc = truthSvc;
56}
57
58
60{
61 m_geoIDSvc = geoIDSvc;
62}
63
64bool TruthStrategyManager::CreateTruthIncident(const G4Step* aStep, int subDetVolLevel) const
65{
67
68 auto* atlasG4EvtUserInfo = static_cast<AtlasG4EventUserInfo*> (G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetUserInformation());
69
70 // This is pretty ugly and but necessary because the Geant4TruthIncident
71 // requires an ISFParticle at this point.
72 // TODO: cleanup Geant4TruthIncident to not require an ISFParticle instance any longer
73 const Amg::Vector3D myPos(0,0,0);
74 const Amg::Vector3D myMom(0,0,0);
75 const double myMass = 0.0;
76 const double myCharge = 0.0;
77 const int myPdgCode = 0;
78 const int mystatus = 3333;
79 const double myTime =0.;
80 const int myID = HepMC::UNDEFINED_ID;
82 ISF::ISFParticle myISFParticle(myPos, myMom, myMass, myCharge, myPdgCode, mystatus, myTime, origin, myID);
83
84 iGeant4::Geant4TruthIncident truth(aStep, myISFParticle, geoID, atlasG4EvtUserInfo);
85
86 m_truthSvc->registerTruthIncident(truth);
87 return false;
88}
89
TruthStrategyManager &TruthStrategyManager::GetStrategyManager_nc ATLAS_NOT_THREAD_SAFE()
Install fatal handler with default options.
This class is attached to G4Event objects as UserInformation.
The interface to chose between the sub geometry services, realized as an AlgTool since it does not ha...
Definition IGeoIDSvc.h:41
The generic ISF particle definition,.
Definition ISFParticle.h:42
@ class ITruthSvc
Definition ITruthSvc.h:29
Singleton class for creating truth incidents.
ISF::ITruthSvc * m_truthSvc
ISF Services the TruthStrategyManager talks to.
ISF::IGeoIDSvc * m_geoIDSvc
void SetISFGeoIDSvc(ISF::IGeoIDSvc *geoIDSvc)
Define which ISF GeoIDSvc to use.
void SetISFTruthSvc(ISF::ITruthSvc *truthSvc)
Define which ISF TruthService to use.
bool CreateTruthIncident(const G4Step *, int subDetVolLevel) const
Returns true if any of the truth strategies return true.
static const TruthStrategyManager & GetStrategyManager()
Retrieve the (const) singleton instance.
ISF_Geant4 specific implementation of the ISF::ITruthIncident.
static AtlasDetDescr::AtlasRegion nextGeoId(const G4Step *aStep, int truthVolLevel, ISF::IGeoIDSvc *geoIDSvc)
Eigen::Matrix< double, 3, 1 > Vector3D
AtlasRegion
A simple enum of ATLAS regions and sub-detectors.
Definition AtlasRegion.h:21
constexpr int UNDEFINED_ID
std::pair< AtlasDetDescr::AtlasRegion, ISF::SimSvcID > DetRegionSvcIDPair
the datatype to be used to store each individual particle hop
Definition ISFParticle.h:30
@ fUndefinedSimID
Definition SimSvcID.h:32