1919#include " G4HepEmGammaManager.hh"
2020#include " G4HepEmGammaTrack.hh"
2121
22+ #include " G4Version.hh"
2223#include " G4MaterialCutsCouple.hh"
2324#include " G4Step.hh"
2425#include " G4StepPoint.hh"
3536#include " G4ProductionCutsTable.hh"
3637
3738#include " G4VProcess.hh"
39+ #include " G4ProcessTable.hh"
3840#include " G4EmProcessSubType.hh"
41+ #include " G4GammaGeneralProcess.hh"
3942#include " G4HadronicProcessType.hh"
43+ #include " G4HadronicProcess.hh"
4044#include " G4ProcessType.hh"
4145#include " G4TransportationProcessType.hh"
4246
@@ -156,13 +160,21 @@ void G4HepEmTrackingManager::BuildPhysicsTable(const G4ParticleDefinition &part)
156160 InitFastSimRelated (particleID);
157161 // Find the ATLAS specific trans. rad. (XTR) process (if has been attached)
158162 InitXTRRelated ();
163+ // Report extra process configuration
164+ if (G4Threading::IsMasterThread () && fVerbose > 0 ) {
165+ ReportExtraProcesses (particleID);
166+ }
159167 } else if (&part == G4Positron::Definition ()) {
160168 int particleID = 1 ;
161169 fRunManager ->Initialize (fRandomEngine , particleID, fConfig ->GetG4HepEmParameters ());
162170 // Find the positron-nuclear process if has been attached
163171 InitNuclearProcesses (particleID);
164172 // Find the fast simulation manager process for e+ (if has been attached)
165173 InitFastSimRelated (particleID);
174+ // Report extra process configuration
175+ if (G4Threading::IsMasterThread () && fVerbose > 0 ) {
176+ ReportExtraProcesses (particleID);
177+ }
166178 } else if (&part == G4Gamma::Definition ()) {
167179 int particleID = 2 ;
168180 fRunManager ->Initialize (fRandomEngine , particleID, fConfig ->GetG4HepEmParameters ());
@@ -186,7 +198,11 @@ void G4HepEmTrackingManager::BuildPhysicsTable(const G4ParticleDefinition &part)
186198 fWDTHelper = nullptr ;
187199 }
188200 }
189- //
201+ // Report extra process configuration
202+ if (G4Threading::IsMasterThread () && fVerbose > 0 ) {
203+ ReportExtraProcesses (particleID);
204+ }
205+ // Report the configuration
190206 if (G4Threading::IsMasterThread () && fVerbose > 0 ) {
191207 fConfig ->Dump ();
192208 }
@@ -658,8 +674,8 @@ bool G4HepEmTrackingManager::TrackElectron(G4Track *aTrack) {
658674
659675 // ATLAS XTR RELATED:
660676 // Invoke the TRTTransitionRadiation process for e-/e+ fXTRProcess:
661- // But only if the step was done in the Radiator region with energy > 255 MeV (m_EkinMin)
662- if (fXTRProcess != nullptr && fXTRRegion == preStepPoint.GetPhysicalVolume ()->GetLogicalVolume ()->GetRegion () && thePrimaryTrack-> GetEKin () > 255.0 ) {
677+ // But only if the step was done with energy > 255 MeV (m_EkinMin) in the Radiator region (if that region was found )
678+ if (fXTRProcess != nullptr && thePrimaryTrack-> GetEKin () > 255.0 && ( fXTRRegion == nullptr || fXTRRegion == preStepPoint.GetPhysicalVolume ()->GetLogicalVolume ()->GetRegion ()) ) {
663679 // the TRTTransitionRadiation process might create photons as secondary
664680 // and changes the primary e-/e+ energy only but nothing more than that
665681 // requires: kinetic energy and momentum direction from the track (dynamic part.) and logical volume
@@ -1105,7 +1121,7 @@ bool G4HepEmTrackingManager::TrackGamma(G4Track *aTrack) {
11051121 step.UpdateTrack ();
11061122
11071123 // Stack secondaries created by the HepEm physics above
1108- edep += StackSecondaries (theTLData, aTrack, proc , g4IMC, isApplyCuts);
1124+ edep += StackSecondaries (theTLData, aTrack, fGammaNoProcessVector [iDProc] , g4IMC, isApplyCuts);
11091125
11101126 } else {
11111127 // Gamma-nuclear: --> use Geant4 for the interaction:
@@ -1369,6 +1385,21 @@ void G4HepEmTrackingManager::InitNuclearProcesses(int particleID) {
13691385 (*proc)->BuildPhysicsTable (*particleDef);
13701386 break ;
13711387 }
1388+ // gamma ageneral case
1389+ if ( (*processVector)[ip]->GetProcessSubType ()==G4EmProcessSubType::fGammaGeneralProcess ) {
1390+ #if G4VERSION_NUMBER >= 1120
1391+ // this getter available only in the `G4GammaGeneralProcess` only from g4-11.2.0
1392+ *proc = static_cast <G4GammaGeneralProcess*>((*processVector)[ip])->GetGammaNuclear ();
1393+ #else
1394+ *proc = G4ProcessTable::GetProcessTable ()->FindProcess (nameNuclearProcess, G4Gamma::Definition ());
1395+ #endif
1396+ if ((*proc) != nullptr ) {
1397+ // make sure the process is initialised (element selectors needs to be built)
1398+ (*proc)->PreparePhysicsTable (*particleDef);
1399+ (*proc)->BuildPhysicsTable (*particleDef);
1400+ break ;
1401+ }
1402+ }
13721403 }
13731404}
13741405
@@ -1405,7 +1436,7 @@ void G4HepEmTrackingManager::InitXTRRelated() {
14051436 // NOTE: becomes `nullptr` if there is no detector region with the name ensuring
14061437 // that everything works fine also outside ATLAS Athena
14071438 // NOTE: after the suggested changes in Athena, the region name should be
1408- // `TRT_RADIATOR` but till that it's `DefaultRegionForTheWorld`
1439+ // `TRT_RADIATOR` but till that `nullptr` also works fine (just less effitient)
14091440 fXTRRegion = G4RegionStore::GetInstance ()->GetRegion (fXTRRegionName , false );
14101441 // Try to get the pointer to the TRTTransitionRadiation process (same for e-/e+)
14111442 // NOTE: stays `nullptr` if gamma dosen't have process with the name ensuring
@@ -1418,12 +1449,57 @@ void G4HepEmTrackingManager::InitXTRRelated() {
14181449 }
14191450 }
14201451 // Print information if the XTR process was found (enable to check)
1421- if (fXTRProcess != nullptr ) {
1422- std::cout << " G4HepEmTrackingManager: found the ATLAS specific "
1423- << fXTRProcess ->GetProcessName () << " process" ;
1424- if (fXTRRegion != nullptr ) {
1425- std::cout << " with the " << fXTRRegion ->GetName () << " region." ;
1452+ // if (fXTRProcess != nullptr) {
1453+ // std::cout << " G4HepEmTrackingManager: found the ATLAS specific "
1454+ // << fXTRProcess->GetProcessName() << " process";
1455+ // if (fXTRRegion != nullptr) {
1456+ // std::cout << " with the " << fXTRRegion->GetName() << " region.";
1457+ // }
1458+ // std::cout << std::endl;
1459+ // }
1460+ }
1461+
1462+
1463+ void G4HepEmTrackingManager::ReportExtraProcesses (int particleID) {
1464+ G4VProcess* pNuclear = nullptr ;
1465+ G4VProcess* pFastSim = nullptr ;
1466+ std::string partName = " " ;
1467+ if (particleID == 0 ) { // e-
1468+ partName = " e-" ;
1469+ pNuclear = fENucProcess ;
1470+ pFastSim = fFastSimProcess [0 ];
1471+ } else if (particleID == 1 ) {
1472+ partName = " e+" ;
1473+ pNuclear = fPNucProcess ;
1474+ pFastSim = fFastSimProcess [1 ];
1475+ } else if (particleID == 2 ) {
1476+ partName = " gamma" ;
1477+ pNuclear = fGNucProcess ;
1478+ pFastSim = fFastSimProcess [2 ];
1479+ }
1480+ std::string strNuclear = " Nuclear interaction process : has not been found. " ;
1481+ if (pNuclear != nullptr ) {
1482+ strNuclear = " Nuclear interaction process : has been found (name = " +
1483+ pNuclear->GetProcessName () + " )" ;
1484+ }
1485+ std::string strFastSim = " Fast simulation process : has not been found. " ;
1486+ if (pFastSim != nullptr ) {
1487+ strFastSim = " Fast simulation process : has been found (name = " +
1488+ pFastSim->GetProcessName () + " )" ;
1489+ }
1490+
1491+ std::cout << " --- G4HepEmTrackingManager: extra processes for " << partName << " \n " ;
1492+ std::cout << " " << strNuclear << " \n " << strFastSim << std::endl;
1493+ if (particleID == 0 || particleID == 1 ) { // e-/e+
1494+ std::string strXTRProc = " The special XTR process : has not been found. " ;
1495+ if (fXTRProcess != nullptr ) {
1496+ strXTRProc = " The special XTR process : has been found " ;
1497+ if (fXTRRegion != nullptr ) {
1498+ strXTRProc += " (with the specific region : " + fXTRRegionName + " )." ;
1499+ } else {
1500+ strXTRProc += " (without a specific region). " ;
1501+ }
14261502 }
1427- std::cout << std::endl;
1503+ std::cout << " " << strXTRProc << std::endl;
14281504 }
14291505}
0 commit comments