  | 
  
    ATLAS Offline Software
    
   | 
 
 
 
 
#include <G4HadIntProcessor.h>
 | 
|   | G4HadIntProcessor (const std::string &, const std::string &, const IInterface *) | 
|   | AlgTool constructor for G4HadIntProcessor.  More...
  | 
|   | 
| virtual  | ~G4HadIntProcessor () | 
|   | Destructor.  More...
  | 
|   | 
| StatusCode  | initialize () | 
|   | AlgTool initailize method.  More...
  | 
|   | 
| StatusCode  | finalize () | 
|   | AlgTool finalize method.  More...
  | 
|   | 
| bool  | hadronicInteraction (const Amg::Vector3D &position, const Amg::Vector3D &momentum, double p, double E, double charge, const Trk::MaterialProperties &mprop, double pathCorrection, Trk::ParticleHypothesis particle=Trk::pion) const | 
|   | interface for processing of the nuclear interactions  More...
  | 
|   | 
| bool  | doHadronicInteraction (double time, const Amg::Vector3D &position, const Amg::Vector3D &momentum, const Trk::Material *ematprop, Trk::ParticleHypothesis particle=Trk::pion, bool processSecondaries=true) const | 
|   | 
| ISF::ISFParticleVector  | doHadIntOnLayer (const ISF::ISFParticle *parent, double time, const Amg::Vector3D &position, const Amg::Vector3D &momentum, const Trk::Material *ematprop, Trk::ParticleHypothesis particle=Trk::pion) const | 
|   | interface for processing of the presampled nuclear interactions on layer  More...
  | 
|   | 
Wrapper class for multiple scattering, energyloss, hadronic interaction tool from Geant4.
- Author
 - Andre.nosp@m.as.S.nosp@m.alzbu.nosp@m.rger.nosp@m.@cern.nosp@m..ch 
 
Definition at line 62 of file G4HadIntProcessor.h.
 
◆ G4HadIntProcessor()
      
        
          | iFatras::G4HadIntProcessor::G4HadIntProcessor  | 
          ( | 
          const std::string &  | 
          t,  | 
        
        
           | 
           | 
          const std::string &  | 
          n,  | 
        
        
           | 
           | 
          const IInterface *  | 
          p  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
AlgTool constructor for G4HadIntProcessor. 
Definition at line 67 of file G4HadIntProcessor.cxx.
   81   declareProperty(
"DoElasticInteractions"            , 
m_doElastic                                                       );
 
   82   declareProperty(
"HadronicInteractionScaleFactor"   , 
m_hadIntProbScale=1.0  , 
"Scale probability of HadrInteractions"  );
 
   84   declareProperty(
"ParticleBroker"                   , 
m_particleBroker       , 
"ISF Particle Broker"                    );
 
   85   declareProperty(
"TruthRecordSvc"                   , 
m_truthRecordSvc       , 
"ISF Particle Truth Svc"                 );
 
   87   declareProperty(
"RandomNumberService"                 , 
m_rndGenSvc          , 
"Random number generator");
 
   88   declareProperty(
"RandomStreamName"                    , 
m_randomEngineName   , 
"Name of the random number stream");
 
 
 
 
◆ ~G4HadIntProcessor()
  
  
      
        
          | iFatras::G4HadIntProcessor::~G4HadIntProcessor  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
virtual   | 
  
 
 
◆ ATLAS_NOT_THREAD_SAFE()
  
  
      
        
          | StatusCode initG4RunManager iFatras::G4HadIntProcessor::ATLAS_NOT_THREAD_SAFE  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
private   | 
  
 
initialize G4RunManager on first call if not done by then 
 
 
◆ doHadIntOnLayer()
interface for processing of the presampled nuclear interactions on layer 
Definition at line 550 of file G4HadIntProcessor.cxx.
 
 
◆ doHadronicInteraction()
Definition at line 519 of file G4HadIntProcessor.cxx.
  533   if (ispVec.empty()) 
return false; 
 
  536   if (processSecondaries) {
 
  537     for (
auto *childParticle : ispVec) {
 
  539       if (!childParticle->getTruthBinding()) {
 
  540         ATH_MSG_ERROR(
"Could not retrieve TruthBinding from child ISFParticle "<< *childParticle);
 
 
 
 
◆ finalize()
      
        
          | StatusCode iFatras::G4HadIntProcessor::finalize  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ getHadState()
collect secondaries for layer material update 
Initialize inleastic hadronic Geant4 processes 
Definition at line 323 of file G4HadIntProcessor.cxx.
  329   const int pdg = 
parent->pdgCode();
 
  332   if ( pdg>10000 ) 
return chDef;
 
  342   static const StatusCode g4RunManagerInit = [&]() {
 
  343     std::scoped_lock 
lock(processMapMutex);
 
  348   if (g4RunManagerInit.isFailure()) 
return chDef;
 
  356     ATH_MSG_DEBUG ( 
" [ g4sim ] No hadronic interactions registered for current particle type (pdg=" << pdg << 
")" );
 
  357     std::scoped_lock 
lock(processMapMutex);
 
  364   ATH_MSG_DEBUG ( 
" [ g4sim ] Found registered hadronic interactions for current particle type (pdg=" << pdg << 
")" );
 
  368   const G4ParticleDefinition *g4parDef = G4ParticleTable::GetParticleTable()->FindParticle(pdg);
 
  370     ATH_MSG_WARNING( 
"[ ---- ] Unable to find G4ParticleDefinition for particle with PID=" << pdg << 
" --> skipping hadronic interactions" );
 
  373   G4DynamicParticle* inputPar = 
new G4DynamicParticle();
 
  374   inputPar->SetDefinition( g4parDef);
 
  381   inputPar->SetMomentum( 
mom);
 
  383   G4Track g4track( inputPar, 0 , {0, 0, 0} );
 
  396   G4StepPoint* g4stepPoint = 
new G4StepPoint();
 
  397   g4step.SetPreStepPoint( g4stepPoint);  
 
  403   g4track.SetStep( &g4step);
 
  414     if( 
rand < 0.5) 
process = processIter_elast->second;
 
  417   ATH_MSG_VERBOSE ( 
" [ g4sim ] Computing " << 
process->GetProcessName() << 
" process with current particle" );
 
  423   G4VParticleChange* g4change = 
process->PostStepDoIt(g4track, g4step);
 
  425     ATH_MSG_WARNING( 
" [ ---- ] Geant4 did not return any hadronic interaction information of particle with pdg=" << pdg );
 
  430   unsigned int numSecondaries = g4change->GetNumberOfSecondaries();
 
  431   ATH_MSG_DEBUG( 
"[ g4sim ] Material update created " <<  numSecondaries << 
" Geant4 particle (s)." );
 
  434   if ( numSecondaries ) {
 
  438     unsigned short                numChildren = 0;
 
  439     for ( 
unsigned int i = 0; 
i < numSecondaries; 
i++ ){
 
  442       G4Track *trk = g4change->GetSecondary(
i);
 
  443       const G4DynamicParticle *dynPar = trk->GetDynamicParticle();
 
  450       const G4ParticleDefinition *parDef = trk->GetParticleDefinition();
 
  453       if (parDef->GetPDGEncoding()>1.e09) 
continue; 
 
  459       ATH_MSG_VERBOSE( 
" [ g4sim ] Adding child particle to particle stack (pdg=" << parDef->GetPDGEncoding()
 
  460                << 
" p=" << dynPar->GetTotalMomentum() );
 
  464       const G4ThreeVector &momG4 = dynPar->GetMomentum();
 
  471                                                           parDef->GetPDGMass(),
 
  472                                                           parDef->GetPDGCharge(),
 
  473                                                           parDef->GetPDGEncoding(),
 
  481       *childrenIt = cParticle;
 
  482       ++childrenIt; numChildren++;
 
  488     const int processForTI  = 121; 
 
  497     truth.updateChildParticleProperties();
 
  500     for (
auto *childParticle : 
children) {
 
  501       if (!childParticle->getTruthBinding()) {
 
  502         ATH_MSG_ERROR(
"Could not retrieve TruthBinding from child ISFParticle "<< *childParticle);
 
 
 
 
◆ hadronicInteraction()
interface for processing of the nuclear interactions 
Definition at line 209 of file G4HadIntProcessor.cxx.
  217   bool processSecondaries = 
true;
 
  222     ATH_MSG_WARNING(
"[ ---- ] Unable to cast MaterialProperties->MaterialProperties -> no material interactions for this particle");
 
  229   double meanIntLength   = pathCorrection*ematprop->
l0();
 
  230   double rndIntLength    = CLHEP::RandExponential::shoot(
m_randomEngine, meanIntLength);
 
  231   double thickness       = pathCorrection*ematprop->
thickness();
 
  234   if ( rndIntLength < thickness ) {
 
  235     ATH_MSG_DEBUG(
" [ g4sim ] computing hadronic interaction on current particle in current material layer");
 
 
 
 
◆ initialize()
      
        
          | StatusCode iFatras::G4HadIntProcessor::initialize  | 
          ( | 
           | ) | 
           | 
        
      
 
AlgTool initailize method. 
Definition at line 100 of file G4HadIntProcessor.cxx.
  107     return StatusCode::FAILURE;
 
  111     return StatusCode::FAILURE;
 
  117     return StatusCode::FAILURE;
 
  125     return StatusCode::FAILURE;
 
  130   return StatusCode::SUCCESS;
 
 
 
 
◆ initProcessPDG()
  
  
      
        
          | std::map< int, G4VProcess * >::const_iterator iFatras::G4HadIntProcessor::initProcessPDG  | 
          ( | 
          int  | 
          pdg | ) | 
           | 
         
       
   | 
  
private   | 
  
 
choose for list of predefined (pure) materials 
Definition at line 142 of file G4HadIntProcessor.cxx.
  144   ATH_MSG_VERBOSE( 
"  [ g4sim ] Registering Geant4 processes for particles with pdg code " << pdg );
 
  150   G4ParticleDefinition *parDef = G4ParticleTable::GetParticleTable()->FindParticle( pdg);
 
  153   if ( !parDef || !parDef->GetProcessManager() ) {
 
  154     ATH_MSG_WARNING( 
"  [ ---- ] Unable to register particle type with PDG code " << pdg );
 
  160   G4ProcessVector *physIntVector = parDef->GetProcessManager()->GetPostStepProcessVector(typeGPIL);
 
  163   if ( !physIntVector) {
 
  164     ATH_MSG_WARNING( 
"  [ ---- ] No Geant4 processes registered for PDG code " << pdg << 
" particles" );
 
  169   for( 
size_t np=0; 
np < physIntVector->size(); 
np++) {
 
  171     G4VProcess* curProc = (*physIntVector)(
np);
 
  173     if ( curProc == 0 ) 
continue;
 
  175     ATH_MSG_VERBOSE( 
"  [ g4sim ] Found Geant4 process " << curProc->GetProcessName());
 
  177     G4HadronInelasticProcess *hadInelastic = 
dynamic_cast<G4HadronInelasticProcess*
>( curProc);
 
  178     G4HadronElasticProcess *hadElastic = 
dynamic_cast<G4HadronElasticProcess*
>( curProc);
 
  179     ATH_MSG_DEBUG( 
"  hadronic process inelastic,elastic " << hadInelastic << 
", " << hadElastic);
 
  180     if ( !hadInelastic && !hadElastic) {
 
  181       ATH_MSG_VERBOSE( 
"  [ g4sim ] Current process not an inelastic or elastic  hadronic process -> process not registered" );
 
  185     if (hadInelastic || hadElastic) {
 
  187       curProc->PreparePhysicsTable(*parDef);
 
  188       curProc->BuildPhysicsTable(*parDef);
 
  193       ATH_MSG_DEBUG( 
"  [ g4sim ] Registered Geant4 hadronic interaction processes for particles with pdg code " << pdg );
 
  197       G4ProcessType pType = curProc->GetProcessType();
 
  198       ATH_MSG_DEBUG( 
"  [ g4sim ] Registered Geant4 ELASTIC hadronic interaction processes for particles with pdg code " 
  199              << pdg << 
"and process " <<  pType);
 
 
 
 
◆ retrieveG4MaterialIndex()
  
  
      
        
          | unsigned int iFatras::G4HadIntProcessor::retrieveG4MaterialIndex  | 
          ( | 
          const Trk::Material *  | 
          ematprop | ) | 
           const | 
         
       
   | 
  
private   | 
  
 
random number service 
Definition at line 560 of file G4HadIntProcessor.cxx.
  563   unsigned int invalidIndex = nMaterials + 1;
 
  566     ATH_MSG_WARNING(
" no predefined G4 material available for hadronic interaction " );
 
  567     return (invalidIndex);
 
  572   float  iZ = ematprop ? ematprop->
averageZ() : 13 ;
 
  579   unsigned int iSel=imat< nMaterials ? imat : nMaterials-1;
 
 
 
 
◆ m_doElastic
  
  
      
        
          | bool iFatras::G4HadIntProcessor::m_doElastic | 
         
       
   | 
  
private   | 
  
 
 
◆ m_g4HadrElasticProcesses
  
  
      
        
          | std::map<int, G4VProcess*> iFatras::G4HadIntProcessor::m_g4HadrElasticProcesses | 
         
       
   | 
  
private   | 
  
 
 
◆ m_g4HadrInelasticProcesses
  
  
      
        
          | std::map<int, G4VProcess*> iFatras::G4HadIntProcessor::m_g4HadrInelasticProcesses | 
         
       
   | 
  
private   | 
  
 
 
◆ m_g4Material
  
  
      
        
          | std::vector<std::pair<float,std::pair< G4Material*, G4MaterialCutsCouple> > > iFatras::G4HadIntProcessor::m_g4Material | 
         
       
   | 
  
private   | 
  
 
 
◆ m_g4RunManagerHelper
◆ m_hadIntProbScale
  
  
      
        
          | double iFatras::G4HadIntProcessor::m_hadIntProbScale | 
         
       
   | 
  
private   | 
  
 
 
◆ m_minMomentum
  
  
      
        
          | double iFatras::G4HadIntProcessor::m_minMomentum | 
         
       
   | 
  
private   | 
  
 
Geant4 processes <PDGcode, process> TODO : fission, capture. 
Definition at line 118 of file G4HadIntProcessor.h.
 
 
◆ m_particleBroker
◆ m_randomEngine
  
  
      
        
          | CLHEP::HepRandomEngine* iFatras::G4HadIntProcessor::m_randomEngine | 
         
       
   | 
  
private   | 
  
 
 
◆ m_randomEngineName
  
  
      
        
          | std::string iFatras::G4HadIntProcessor::m_randomEngineName | 
         
       
   | 
  
private   | 
  
 
 
◆ m_rndGenSvc
◆ m_truthRecordSvc
The documentation for this class was generated from the following files:
 
JetConstituentVector::iterator iterator
 
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
 
void setNextGeoID(AtlasDetDescr::AtlasRegion geoID)
register the next AtlasDetDescr::AtlasRegion
 
static ParticleClipboard & getInstance()
get the singleton instance
 
float thicknessInX0() const
Return the radiationlength fraction.
 
std::vector< std::pair< float, std::pair< G4Material *, G4MaterialCutsCouple > > > m_g4Material
 
float thicknessInL0() const
Return the nuclear interaction length fraction.
 
std::string m_randomEngineName
Name of the random number stream.
 
#define ATH_MSG_VERBOSE(x)
 
const Material & material() const
Return the stored Material.
 
float thickness() const
Return the thickness in mm.
 
ServiceHandle< ISF::ITruthSvc > m_truthRecordSvc
 
::StatusCode StatusCode
StatusCode definition for legacy code.
 
std::vector< ISF::ISFParticle * > ISFParticleVector
ISFParticle vector.
 
ServiceHandle< ISF::IParticleBroker > m_particleBroker
ISF services & Tools.
 
CLHEP::HepRandomEngine * m_randomEngine
Random engine
 
std::map< int, G4VProcess * > m_g4HadrInelasticProcesses
 
ToolHandle< ISF::IG4RunManagerHelper > m_g4RunManagerHelper
steering: enable elastic interactions?
 
constexpr int UNDEFINED_ID
 
constexpr int SIM_STATUS_THRESHOLD
Constant definiting the status threshold for simulated particles, eg. can be used to separate generat...
 
void setNextSimID(SimSvcID simID)
register the next SimSvcID
 
Eigen::Matrix< double, 3, 1 > Vector3D
 
const ISF::ISFParticle * getParticle() const
get the particle from the clipboard
 
bool doHadronicInteraction(double time, const Amg::Vector3D &position, const Amg::Vector3D &momentum, const Trk::Material *ematprop, Trk::ParticleHypothesis particle=Trk::pion, bool processSecondaries=true) const
 
def time(flags, cells_name, *args, **kw)
 
#define ATH_MSG_WARNING(x)
 
double m_minMomentum
Geant4 processes <PDGcode, process> TODO : fission, capture.
 
std::map< int, G4VProcess * >::const_iterator initProcessPDG(int pdg)
choose for list of predefined (pure) materials
 
#define ATLAS_THREAD_SAFE
 
std::map< int, G4VProcess * > m_g4HadrElasticProcesses
 
ISF::ISFParticleVector getHadState(const ISF::ISFParticle *parent, double time, const Amg::Vector3D &position, const Amg::Vector3D &momentum, const Trk::Material *ematprop) const
collect secondaries for layer material update
 
constexpr int pow(int base, int exp) noexcept
 
float l0() const
Return the nuclear interaction length.
 
unsigned int retrieveG4MaterialIndex(const Trk::Material *ematprop) const
random number service
 
ServiceHandle< IAtRndmGenSvc > m_rndGenSvc