26#include "G4ParticleDefinition.hh"
27#include "G4DynamicParticle.hh"
28#include "G4TouchableHistory.hh"
30#include "G4TransportationManager.hh"
31#include "G4LogicalVolumeStore.hh"
48 G4cout <<
"create TrackProcessorUserActionFullG4" << G4endl;
54 if ( m_config.entryLayerTool.retrieve().isFailure()) {
55 G4ExceptionDescription description;
56 description << G4String(
"TrackProcessorUserActionFullG4: ") +
"Could not retrieve ISF Entry Layer Tool: " << m_config.entryLayerTool;
57 G4Exception(
"G4UA::iGeant4::TrackProcessorUserActionFullG4",
"NoISFEntryLayerTool", FatalException, description);
63 if ( !m_config.geoIDSvc.empty() ) {
64 if (m_config.geoIDSvc.retrieve().isFailure()) {
65 G4ExceptionDescription description;
66 description << G4String(
"TrackProcessorUserActionFullG4: ") +
"Could not retrieve ISF GeoID Svc: " << m_config.geoIDSvc;
67 G4Exception(
"G4UA::iGeant4::TrackProcessorUserActionFullG4",
"NoISFGeoIDSvc", FatalException, description);
71 m_geoIDSvcQuick = &(*m_config.geoIDSvc);
74 m_entryLayerMap[
"CALO::CALO"] = m_config.truthVolLevel+1;
75 m_entryLayerMap[
"MUONQ02::MUONQ02"] = m_config.truthVolLevel+1;
76 m_entryLayerMap[m_config.isITkGeometry ?
"ITK::ITK" :
"IDET::IDET"] = m_config.truthVolLevel+1;
82 G4Track* aTrack = aStep->GetTrack();
84 G4TrackStatus aTrackStatus = aTrack->GetTrackStatus();
86 const G4StepPoint *preStep = aStep->GetPreStepPoint();
87 const G4StepPoint *postStep = aStep->GetPostStepPoint();
99 if ( aTrackStatus==fStopAndKill ) {
105 const G4VPhysicalVolume *preVol = preStep->GetPhysicalVolume();
106 const G4VPhysicalVolume *postVol = postStep->GetPhysicalVolume();
118 if ( preVol==postVol ) {
151 auto generationZeroBarcode = tHelp.
GetBarcode();
154 tmpISP->
setId(generationZeroID);
176 const G4StepPoint *preStep =aStep->GetPreStepPoint();
177 const G4StepPoint *postStep=aStep->GetPostStepPoint();
179 const G4TouchableHistory *preTHist=
static_cast<const G4TouchableHistory*
>(preStep->GetTouchable());
180 const G4TouchableHistory *postTHist=
static_cast<const G4TouchableHistory*
>(postStep->GetTouchable());
181 int nLev1 = preTHist->GetHistoryDepth();
182 int nLev2 = postTHist->GetHistoryDepth();
193 vname1=preTHist->GetVolume(nLev1-il+1)->GetName();
195 if (vname1!=(*it).first)
continue;
198 if (vname1 ==
static_cast<const std::string&
>(postTHist->GetVolume(nLev2-il+1)->GetName()))
virtual void PreUserTrackingAction(const G4Track *) override
TrackProcessorUserActionBase()=default
ISF::EntryLayer entryLayer(const G4Step *aStep)
AtlasDetDescr::AtlasRegion m_nextGeoID
const G4Track * m_currentTrack
std::map< std::string, int, std::less< std::string > > m_entryLayerMap
ISF::IEntryLayerTool * m_entryLayerToolQuick
access to the ISF Entry Layer tool which is used to record entry-layer collections
TrackProcessorUserActionFullG4(const Config &config)
ISF::IGeoIDSvc * m_geoIDSvcQuick
access to the central ISF GeoID serice
void ISFSteppingAction(const G4Step *, ISF::ISFParticle *curISP) override final
Called by the base class after the G4Track->ISFParticle association has been established.
virtual void PreUserTrackingAction(const G4Track *) override final
The generic ISF particle definition,.
void setNextSimID(SimSvcID simID)
register the next SimSvcID
void setBarcode(int bc)
set a new barcode
void setId(int id)
set a new unique ID
void setNextGeoID(AtlasDetDescr::AtlasRegion geoID)
register the next AtlasDetDescr::AtlasRegion
AtlasDetDescr::AtlasRegion nextGeoID() const
next geoID the particle will be simulated in
static AtlasDetDescr::AtlasRegion nextGeoId(const G4Step *aStep, int truthVolLevel, ISF::IGeoIDSvc *geoIDSvc)
static ISF::ISFParticle * convertG4TrackToISFParticle(const G4Track &aTrack, const ISF::ISFParticle &parent, ISF::TruthBinding *truth=nullptr)
convert the given G4Track into an ISFParticle
AtlasRegion
A simple enum of ATLAS regions and sub-detectors.
EntryLayer
Identifiers for the TrackRecordCollections on the boundaries between CaloEntry: Inner Detector - Calo...