ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
RHadronsPhysicsTool Class Reference

#include "RHadrons/RHadronsPhysicsTool.h"

Inheritance diagram for RHadronsPhysicsTool:
Collaboration diagram for RHadronsPhysicsTool:

Public Member Functions

 RHadronsPhysicsTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard constructor. More...
 
virtual ~RHadronsPhysicsTool ()
 Destructor. More...
 
virtual StatusCode initialize ()
 Initialize method. More...
 
virtual void ConstructParticle ()
 
virtual void ConstructProcess ()
 
virtual RHadronsPhysicsToolGetPhysicsOption ()
 Implements. More...
 

Private Attributes

IntegerArrayProperty m_standardpdgidtodecay
 

Detailed Description

Author
Edoardo Farina
Date
2015-05-14

Definition at line 20 of file RHadronsPhysicsTool.h.

Constructor & Destructor Documentation

◆ RHadronsPhysicsTool()

RHadronsPhysicsTool::RHadronsPhysicsTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Standard constructor.

Definition at line 35 of file RHadronsPhysicsTool.cxx.

37  : base_class ( type, nam , parent )
38 {
39  m_physicsOptionType = G4AtlasPhysicsOption::Type::BSMPhysics;
40 }

◆ ~RHadronsPhysicsTool()

RHadronsPhysicsTool::~RHadronsPhysicsTool ( )
virtual

Destructor.

Definition at line 46 of file RHadronsPhysicsTool.cxx.

47 {
48 }

Member Function Documentation

◆ ConstructParticle()

void RHadronsPhysicsTool::ConstructParticle ( )
virtual

Definition at line 66 of file RHadronsPhysicsTool.cxx.

67 {
68  ATH_MSG_DEBUG("RHadronsPhysicsTool::ConstructParticle() - start");
70  ATH_MSG_DEBUG("RHadronsPhysicsTool::ConstructParticle() - end");
71 }

◆ ConstructProcess()

void RHadronsPhysicsTool::ConstructProcess ( )
virtual

Definition at line 72 of file RHadronsPhysicsTool.cxx.

73 {
74  ATH_MSG_DEBUG("RHadronsPhysicsTool::ConstructProcess() - start");
75  G4Decay* theDecayProcess = new G4Decay();
76  theDecayProcess->SetExtDecayer( new RHadronPythiaDecayer("RHadronPythiaDecayer") );
77  G4ParticleTable::G4PTblDicIterator* particleIterator = G4ParticleTable::GetParticleTable()->GetIterator();
78  particleIterator->reset();
79 
80  //First deal with the standard particles that G4 doesn't know about...
81  //G4Etac::Definition();
82  G4BaryonConstructor::ConstructParticle();
83  ATH_MSG_DEBUG("RHadronsPhysicsTool::ConstructProcess() - m_standardpdgidtodecay = " << m_standardpdgidtodecay);
84  G4ProcessManager *templateProcessMgr = G4ParticleTable::GetParticleTable()->FindParticle(4122)->GetProcessManager();
85  for (const int pid : m_standardpdgidtodecay.value()) {
86  ATH_MSG_VERBOSE ( "Adding decay for "<<pid );
87  G4ParticleDefinition *particle = G4ParticleTable::GetParticleTable()->FindParticle( pid );
88  if (particle) {
89  ATH_MSG_VERBOSE ( particle->GetParticleName()<<" is standard for Pythia, lifetime is "<<particle->GetPDGLifeTime() );
90  G4ProcessManager *processMgr = particle->GetProcessManager();
91  if (!processMgr) {
92  ATH_MSG_VERBOSE ( "No process manager found for " << particle->GetParticleName() << " (" << pid << "). Copying process manager from 4122 (one we know works) to this particle" );
93  particle->SetProcessManager(new G4ProcessManager(*templateProcessMgr));
94  processMgr = particle->GetProcessManager();
95  }
96  G4ProcessVector *pros = processMgr->GetProcessList();
97  for (unsigned int pi=0; pi<pros->size(); ++pi) {
98  if ((*pros)[pi]->GetProcessType()==fDecay) {
99  ATH_MSG_VERBOSE ( "Found a pre-existing decay process for " <<particle->GetParticleName() << " (" << pid << "). Will remove in favour of using RHadronPythiaDecayer." );
100  processMgr->RemoveProcess(pi);
101  break;
102  }
103  }
104  for (unsigned int pi=0; pi<pros->size(); ++pi) {
105  if ((*pros)[pi]->GetProcessType()==fDecay) {
106  ATH_MSG_WARNING ( "There is another decay process for " <<particle->GetParticleName() << " (" << pid << ") already defined!" );
107  processMgr ->DumpInfo();
108  }
109  }
110  ATH_MSG_VERBOSE ( "Adding decay process for " <<particle->GetParticleName() << " (" << pid << ") using RHadronPythiaDecayer." );
111  processMgr ->AddProcess(theDecayProcess);
112  processMgr ->SetProcessOrdering(theDecayProcess, idxPostStep); processMgr ->SetProcessOrdering(theDecayProcess, idxAtRest);
113  //processMgr ->DumpInfo();
114  } else {
115  ATH_MSG_WARNING ( "Particle with pdgid "<<pid<<" has no definition in G4?" );
116  }
117  } // Loop over all particles that we need to define
118 
119  // Now add RHadrons... Keep a vector of those we've already dealt with
120  std::vector<int> handled;
121  // Use the G4 particle iterator
122  while ((*particleIterator)()) {
123  G4ParticleDefinition *particle = particleIterator->value();
125  if (find(handled.begin(),handled.end(),particle->GetPDGEncoding())==handled.end()) {
126  handled.push_back(particle->GetPDGEncoding());
127  ATH_MSG_VERBOSE ( particle->GetParticleName() << " (" << particle->GetPDGEncoding() << ") " << " is a Custom Particle. Attempting to add a decay process." );
128  G4ProcessManager *processMgr = particle->GetProcessManager();
129  if (particle->GetParticleType()=="rhadron" ||
130  particle->GetParticleType()=="mesonino" ||
131  particle->GetParticleType()=="sbaryon" ) {
132  processMgr->AddDiscreteProcess(new FullModelHadronicProcess());
133  if (theDecayProcess->IsApplicable(*particle)) {
134  ATH_MSG_VERBOSE ( "Adding decay..." );
135  processMgr ->AddProcess(theDecayProcess);
136  // set ordering for PostStepDoIt and AtRestDoIt
137  processMgr->SetProcessOrdering(theDecayProcess, idxPostStep);
138  processMgr->SetProcessOrdering(theDecayProcess, idxAtRest);
139  } else {
140  ATH_MSG_WARNING ( "No decay allowed for " << particle->GetParticleName() );
141  if (!particle->GetPDGStable() && particle->GetPDGLifeTime()<0.1*CLHEP::ns) {
142  ATH_MSG_WARNING ( "Gonna decay it anyway!!!" );
143  processMgr->AddProcess(theDecayProcess);
144  // set ordering for PostStepDoIt and AtRestDoIt
145  processMgr->SetProcessOrdering(theDecayProcess, idxPostStep);
146  processMgr->SetProcessOrdering(theDecayProcess, idxAtRest);
147  }
148  }
149  }
150  if (particle->GetPDGCharge()/CLHEP::eplus != 0) {
151  processMgr->AddProcess(new G4hMultipleScattering, -1, 1, 1);
152  processMgr->AddProcess(new G4hIonisation, -1, 2, 2);
153  ATH_MSG_VERBOSE ( "Processes for charged particle added." );
154  } else {
155  ATH_MSG_VERBOSE ( "It is neutral!!" );
156  }
157  processMgr->DumpInfo();
158  } else {
159  ATH_MSG_VERBOSE ( "Skipping already handled particle: "<<particle->GetParticleName() );
160  } // If it has not been handled yet
161  } // If this is one of our custom particles (RHadrons)
162  } // End of the particle iterator
163  ATH_MSG_DEBUG("RHadronsPhysicsTool::ConstructProcess() - list of handled RHadrons = " << handled);
164  ATH_MSG_DEBUG("RHadronsPhysicsTool::ConstructProcess() - end");
165 }

◆ GetPhysicsOption()

RHadronsPhysicsTool * RHadronsPhysicsTool::GetPhysicsOption ( )
virtual

Implements.

Definition at line 60 of file RHadronsPhysicsTool.cxx.

61 {
62  return this;
63 }

◆ initialize()

StatusCode RHadronsPhysicsTool::initialize ( )
virtual

Initialize method.

Definition at line 53 of file RHadronsPhysicsTool.cxx.

54 {
55  ATH_MSG_DEBUG("RHadronsPhysicsTool::initialize()");
56  this->SetPhysicsName(name());
57  return StatusCode::SUCCESS;
58 }

Member Data Documentation

◆ m_standardpdgidtodecay

IntegerArrayProperty RHadronsPhysicsTool::m_standardpdgidtodecay
private
Initial value:
{this, "StandardParticlesToDecay",
{
4122, 4222, 4212, 4112, 4232, 4132, 4332, 5122, 5222, 5212, 5112, 5232, 5132, 5332,
-4122, -4222, -4212, -4112, -4232, -4132, -4332, -5122, -5222, -5212, -5112, -5232, -5132, -5332,
411, -411, 421, -421, 431, -431, 441, 443, 521,
-521, 511, -511, 531, -531, 541, -541, 553
},
"Particles which are known to Geant4"}

Definition at line 75 of file RHadronsPhysicsTool.h.


The documentation for this class was generated from the following files:
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
CustomParticleFactory::loadCustomParticles
static void loadCustomParticles()
Definition: CustomParticleFactory.cxx:27
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
pi
#define pi
Definition: TileMuonFitter.cxx:65
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
RHadronPythiaDecayer
Definition: RHadronPythiaDecayer.h:17
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CustomParticleFactory::isCustomParticle
static bool isCustomParticle(G4ParticleDefinition *particle)
Definition: CustomParticleFactory.cxx:21
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
python.SystemOfUnits.ns
int ns
Definition: SystemOfUnits.py:130
python.SystemOfUnits.eplus
int eplus
Definition: SystemOfUnits.py:137
G4AtlasPhysicsOption::BSMPhysics
@ BSMPhysics
Definition: IPhysicsOptionTool.h:22
RHadronsPhysicsTool::m_standardpdgidtodecay
IntegerArrayProperty m_standardpdgidtodecay
Definition: RHadronsPhysicsTool.h:75