Go to the documentation of this file.00001 #include "SimG4Core/CustomPhysics/interface/CustomPhysicsList.h"
00002 #include "SimG4Core/CustomPhysics/interface/CustomParticleFactory.h"
00003 #include "SimG4Core/CustomPhysics/interface/DummyChargeFlipProcess.h"
00004
00005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00006 #include "FWCore/ParameterSet/interface/FileInPath.h"
00007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00008
00009 #include "G4Decay.hh"
00010 #include "G4hMultipleScattering.hh"
00011 #include "G4hIonisation.hh"
00012 #include "G4ProcessManager.hh"
00013
00014 #include "G4LeptonConstructor.hh"
00015 #include "G4MesonConstructor.hh"
00016 #include "G4BaryonConstructor.hh"
00017 #include "G4ShortLivedConstructor.hh"
00018 #include "G4IonConstructor.hh"
00019
00020 #include "SimG4Core/CustomPhysics/interface/FullModelHadronicProcess.hh"
00021 #include "SimG4Core/CustomPhysics/interface/ToyModelHadronicProcess.hh"
00022
00023
00024 CustomPhysicsList::CustomPhysicsList(std::string name, const edm::ParameterSet & p) : G4VPhysicsConstructor(name) {
00025
00026 myConfig = p;
00027 edm::FileInPath fp = p.getParameter<edm::FileInPath>("particlesDef");
00028 particleDefFilePath = fp.fullPath();
00029 edm::LogInfo("CustomPhysics")<<"Path for custom particle definition file: "<<particleDefFilePath;
00030 myHelper = 0;
00031
00032 }
00033
00034 CustomPhysicsList::~CustomPhysicsList() {
00035 delete myHelper;
00036 }
00037
00038 void CustomPhysicsList::ConstructParticle(){
00039 CustomParticleFactory::loadCustomParticles(particleDefFilePath);
00040 }
00041
00042 void CustomPhysicsList::ConstructProcess() {
00043 addCustomPhysics();
00044 }
00045
00046 void CustomPhysicsList::addCustomPhysics(){
00047 LogDebug("CustomPhysics") << " CustomPhysics: adding CustomPhysics processes";
00048 theParticleIterator->reset();
00049
00050 while((*theParticleIterator)()) {
00051 int i = 0;
00052 G4ParticleDefinition* particle = theParticleIterator->value();
00053 CustomParticle* cp = dynamic_cast<CustomParticle*>(particle);
00054 if(CustomParticleFactory::isCustomParticle(particle)) {
00055 LogDebug("CustomPhysics") << particle->GetParticleName()<<", "<<particle->GetPDGEncoding()
00056 << " is Custom. Mass is "
00057 <<particle->GetPDGMass()/GeV <<" GeV.";
00058 if(cp->GetCloud()!=0) {
00059 LogDebug("CustomPhysics")<<"Cloud mass is "
00060 <<cp->GetCloud()->GetPDGMass()/GeV
00061 <<" GeV. Spectator mass is "
00062 <<static_cast<CustomParticle*>(particle)->GetSpectator()->GetPDGMass()/GeV
00063 <<" GeV.";
00064 }
00065 G4ProcessManager* pmanager = particle->GetProcessManager();
00066 if(pmanager) {
00067 if(cp!=0) {
00068 if(particle->GetParticleType()=="rhadron" || particle->GetParticleType()=="mesonino" || particle->GetParticleType() == "sbaryon"){
00069 if(!myHelper) myHelper = new G4ProcessHelper(myConfig);
00070 pmanager->AddDiscreteProcess(new FullModelHadronicProcess(myHelper));
00071 }
00072 }
00073 if(particle->GetPDGCharge()/eplus != 0) {
00074 pmanager->AddProcess(new G4hMultipleScattering,-1, 1,i+1);
00075 pmanager->AddProcess(new G4hIonisation, -1, 2,i+2);
00076 }
00077 }
00078 else LogDebug("CustomPhysics") << " No pmanager";
00079 }
00080 }
00081 }
00082
00083
00084 void CustomPhysicsList::setupRHadronPhycis(G4ParticleDefinition* particle){
00085
00086
00087
00088
00089 CustomParticle* cp = dynamic_cast<CustomParticle*>(particle);
00090 if(cp->GetCloud()!=0)
00091 LogDebug("CustomPhysics")<<"Cloud mass is "
00092 <<cp->GetCloud()->GetPDGMass()/GeV
00093 <<" GeV. Spectator mass is "
00094 <<static_cast<CustomParticle*>(particle)->GetSpectator()->GetPDGMass()/GeV
00095 <<" GeV.";
00096
00097 G4ProcessManager* pmanager = particle->GetProcessManager();
00098 if(pmanager){
00099 if(!myHelper) myHelper = new G4ProcessHelper(myConfig);
00100 pmanager->AddDiscreteProcess(new FullModelHadronicProcess(myHelper));
00101 if(particle->GetPDGCharge()/eplus != 0){
00102 pmanager->AddProcess(new G4hMultipleScattering,-1, 1,1);
00103 pmanager->AddProcess(new G4hIonisation, -1, 2,2);
00104 }
00105 }
00106 else LogDebug("CustomPhysics") << " No pmanager";
00107 }
00108
00109
00110 void CustomPhysicsList::setupSUSYPhycis(G4ParticleDefinition* particle){
00111
00112
00113 G4ProcessManager* pmanager = particle->GetProcessManager();
00114 if(pmanager){
00115 pmanager->AddProcess(new G4Decay,1, 1,1);
00116 if(particle->GetPDGCharge()/eplus != 0){
00117 pmanager->AddProcess(new G4hMultipleScattering,-1, 2,2);
00118 pmanager->AddProcess(new G4hIonisation, -1, 3,3);
00119 }
00120 }
00121 else LogDebug("CustomPhysics") << " No pmanager";
00122 }