CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CustomPhysicsList.cc
Go to the documentation of this file.
4 #include "SimG4Core/CustomPhysics/interface/G4ProcessHelper.hh"
5 
9 
10 #include "G4Decay.hh"
11 #include "G4hMultipleScattering.hh"
12 #include "G4hIonisation.hh"
13 #include "G4ProcessManager.hh"
14 
15 #include "G4LeptonConstructor.hh"
16 #include "G4MesonConstructor.hh"
17 #include "G4BaryonConstructor.hh"
18 #include "G4ShortLivedConstructor.hh"
19 #include "G4IonConstructor.hh"
20 
21 #include "SimG4Core/CustomPhysics/interface/FullModelHadronicProcess.hh"
22 #include "SimG4Core/CustomPhysics/interface/ToyModelHadronicProcess.hh"
23 
24 using namespace CLHEP;
25 
26 
28  : G4VPhysicsConstructor(name)
29 {
30  myConfig = p;
31  edm::FileInPath fp = p.getParameter<edm::FileInPath>("particlesDef");
33  edm::LogInfo("CustomPhysics")<<"Path for custom particle definition file: "
35  myHelper = 0;
36 }
37 
39  delete myHelper;
40 }
41 
44 }
45 
48 }
49 
51  LogDebug("CustomPhysics") << " CustomPhysicsList: adding CustomPhysics processes";
52  aParticleIterator->reset();
53 
54  while((*aParticleIterator)()) {
55  G4ParticleDefinition* particle = aParticleIterator->value();
56  CustomParticle* cp = dynamic_cast<CustomParticle*>(particle);
58  LogDebug("CustomPhysics") << particle->GetParticleName()
59  <<", "<<particle->GetPDGEncoding()
60  << " is Custom. Mass is "
61  <<particle->GetPDGMass()/GeV <<" GeV.";
62  if(cp->GetCloud()!=0) {
63  LogDebug("CustomPhysics")
64  <<"Cloud mass is "
65  <<cp->GetCloud()->GetPDGMass()/GeV
66  <<" GeV. Spectator mass is "
67  <<static_cast<CustomParticle*>(particle)->GetSpectator()->GetPDGMass()/GeV
68  <<" GeV.";
69  }
70  G4ProcessManager* pmanager = particle->GetProcessManager();
71  if(pmanager) {
72  if(particle->GetPDGCharge()/eplus != 0) {
73  pmanager->AddProcess(new G4hMultipleScattering,-1, 1, 1);
74  pmanager->AddProcess(new G4hIonisation, -1, 2, 2);
75  }
76  if(cp!=0) {
77  if(particle->GetParticleType()=="rhadron" ||
78  particle->GetParticleType()=="mesonino" ||
79  particle->GetParticleType() == "sbaryon"){
80  if(!myHelper) myHelper = new G4ProcessHelper(myConfig);
81  pmanager->AddDiscreteProcess(new FullModelHadronicProcess(myHelper));
82  }
83  }
84  }
85  else LogDebug("CustomPhysics") << " No pmanager";
86  }
87  }
88 }
89 
90 
91 void CustomPhysicsList::setupRHadronPhycis(G4ParticleDefinition* particle)
92 {
93  // LogDebug("CustomPhysics")<<"Configuring rHadron: "
94  // <<cp->
95 
96  CustomParticle* cp = dynamic_cast<CustomParticle*>(particle);
97  if(cp->GetCloud()!=0) {
98  LogDebug("CustomPhysics")
99  <<"Cloud mass is "
100  <<cp->GetCloud()->GetPDGMass()/GeV
101  <<" GeV. Spectator mass is "
102  <<static_cast<CustomParticle*>(particle)->GetSpectator()->GetPDGMass()/GeV
103  <<" GeV.";
104  }
105  G4ProcessManager* pmanager = particle->GetProcessManager();
106  if(pmanager){
107  if(!myHelper) myHelper = new G4ProcessHelper(myConfig);
108  if(particle->GetPDGCharge()/eplus != 0){
109  pmanager->AddProcess(new G4hMultipleScattering,-1, 1, 1);
110  pmanager->AddProcess(new G4hIonisation, -1, 2, 2);
111  }
112  pmanager->AddDiscreteProcess(new FullModelHadronicProcess(myHelper)); //GHEISHA
113  }
114  else LogDebug("CustomPhysics") << " No pmanager";
115 }
116 
117 void CustomPhysicsList::setupSUSYPhycis(G4ParticleDefinition* particle)
118 {
119  G4ProcessManager* pmanager = particle->GetProcessManager();
120  if(pmanager){
121  if(particle->GetPDGCharge()/eplus != 0){
122  pmanager->AddProcess(new G4hMultipleScattering,-1, 1, 1);
123  pmanager->AddProcess(new G4hIonisation, -1, 2, 2);
124  }
125  pmanager->AddProcess(new G4Decay, 1, -1, 3);
126  }
127  else LogDebug("CustomPhysics") << " No pmanager";
128 }
#define LogDebug(id)
T getParameter(std::string const &) const
edm::ParameterSet myConfig
std::string particleDefFilePath
G4ParticleDefinition * GetCloud()
void setupRHadronPhycis(G4ParticleDefinition *particle)
static void loadCustomParticles(const std::string &filePath)
virtual ~CustomPhysicsList()
void setupSUSYPhycis(G4ParticleDefinition *particle)
G4ProcessHelper * myHelper
CustomPhysicsList(std::string name, const edm::ParameterSet &p)
static bool isCustomParticle(G4ParticleDefinition *particle)
std::string fullPath() const
Definition: FileInPath.cc:165
virtual void ConstructParticle()
virtual void ConstructProcess()