SLIC  6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
LCExtendedParticles.cc
Go to the documentation of this file.
1 #include "LCExtendedParticles.hh"
2 
3 // SLIC
4 #include "HepPDTManager.hh"
5 
6 // Geant4
7 #include "G4Version.hh"
8 #include "G4ParticleTable.hh"
9 #include "G4ProcessManager.hh"
10 #include "G4ParticleDefinition.hh"
11 #include "G4SystemOfUnits.hh"
12 
13 namespace slic {
14 
16  G4VPhysicsConstructor(name) {
17 }
18 
20 }
21 
22 #ifndef aParticleIterator
23 #define aParticleIterator ((subInstanceManager.offset[g4vpcInstanceID])._aParticleIterator)
24 #endif
25 
27 
28  //std::cout << "LCExtendedParticles::ConstructParticle" << std::endl;
29 
30  // Get the particle data table to be imported.
31  HepPDT::ParticleDataTable* pdtbl = HepPDTManager::instance()->getParticleDataTable();
32 
33  // Loop over all particles.
34  for (HepPDT::ParticleDataTable::const_iterator it = pdtbl->begin(); it != pdtbl->end(); it++) {
35  HepPDT::ParticleID id = it->first;
36  HepPDT::ParticleData pdata = it->second;
37 
38  // Check for a built-in definition of this particle.
39  G4ParticleDefinition* pdef = G4ParticleTable::GetParticleTable()->FindParticle(pdata.pid());
40 
41  // Add particles that Geant4 does not already know about.
42  if (pdef == 0) {
43 
44  //std::cout << "constructing new particle: " << pdata.PDTname() << std::endl;
45 
46  G4String particleType = "extended";
47  if (id.isSUSY())
48  particleType = "susy";
49 
50  //std::cout << " type: " << particleType << std::endl;
51 
52  // Create a G4ParticleDefinition for this SUSY particle.
53  new G4ParticleDefinition(pdata.PDTname(), // name
54  pdata.mass().value() * GeV, // mass
55  pdata.totalWidth().value(), // width
56  pdata.charge(), // charge
57  0, // 2*spin
58  0, // parity
59  0, // C-conjugation
60  0, // 2*isospin
61  0, // 2*isospin3
62  0, // G-parity
63  particleType, // type
64  0, // lepton number
65  0, // baryon number
66  pdata.pid(), // PDG encoding
67  false, // stable
68  DBL_MIN, // lifetime (can be overridden by predefined decay time)
69  0,// decay table
70  false// short lived
71  );
72  }
73  }
74 }
75 
77 
78  aParticleIterator->reset();
79  while ((*aParticleIterator)()) {
80  G4ParticleDefinition* pdef = aParticleIterator->value();
81  G4ProcessManager* pmgr = pdef->GetProcessManager();
82  if (pdef->GetParticleType() == "extended" || pdef->GetParticleType() == "susy") {
83 
84  //std::cout << "assigning processes to particle: " << pdef->GetParticleName() << std::endl;
85 
86  if (pdef->GetPDGCharge() != 0) {
87  pmgr->AddProcess(&m_scatter, -1, 1, 1); // multiple scattering
88  pmgr->AddProcess(&m_ionise, -1, 2, 2); // ionisation
89  pmgr->AddProcess(&m_decay, -1, -1, 2); // decay
90  } else {
91  pmgr->AddProcess(&m_scatter, -1, 1, 1); // multiple scattering
92  pmgr->AddProcess(&m_decay, -1, -1, 2); // decay
93  }
94  }
95  }
96 }
97 }
#define aParticleIterator
static HepPDTManager * instance()
LCExtendedParticles(const G4String &name="LCExtendedParticles")
G4hMultipleScattering m_scatter
@ name
Definition: LogStream.hh:26