CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/SimG4Core/GFlash/src/ParametrisedPhysics.cc

Go to the documentation of this file.
00001 #include "SimG4Core/GFlash/interface/ParametrisedPhysics.h"
00002 
00003 #include "G4Electron.hh"
00004 #include "G4FastSimulationManagerProcess.hh"
00005 #include "G4ProcessManager.hh"
00006 
00007 #include "G4LeptonConstructor.hh"
00008 #include "G4MesonConstructor.hh"
00009 #include "G4BaryonConstructor.hh"
00010 #include "G4ShortLivedConstructor.hh"
00011 #include "G4IonConstructor.hh"
00012 #include "G4RegionStore.hh"
00013 
00014 
00015 ParametrisedPhysics::ParametrisedPhysics(std::string name, const edm::ParameterSet & p) :
00016   G4VPhysicsConstructor(name), theParSet(p) {}
00017 
00018 ParametrisedPhysics::~ParametrisedPhysics() {
00019   if(theParSet.getParameter<bool>("GflashEMShowerModel") && theEMShowerModel) 
00020     delete theEMShowerModel;
00021   if(theParSet.getParameter<bool>("GflashHadronShowerModel") && theHadronShowerModel) 
00022     delete theHadronShowerModel;
00023 }
00024 
00025 void ParametrisedPhysics::ConstructParticle() 
00026 {
00027     G4LeptonConstructor pLeptonConstructor;
00028     pLeptonConstructor.ConstructParticle();
00029 
00030     G4MesonConstructor pMesonConstructor;
00031     pMesonConstructor.ConstructParticle();
00032 
00033     G4BaryonConstructor pBaryonConstructor;
00034     pBaryonConstructor.ConstructParticle();
00035 
00036     G4ShortLivedConstructor pShortLivedConstructor;
00037     pShortLivedConstructor.ConstructParticle();  
00038     
00039     G4IonConstructor pConstructor;
00040     pConstructor.ConstructParticle();  
00041 }
00042 
00043 void ParametrisedPhysics::ConstructProcess() {
00044 
00045   G4FastSimulationManagerProcess * theFastSimulationManagerProcess = new G4FastSimulationManagerProcess();
00046   theParticleIterator->reset();
00047   while ((*theParticleIterator)()) {
00048     G4ParticleDefinition * particle = theParticleIterator->value();
00049     G4ProcessManager * pmanager = particle->GetProcessManager();
00050     pmanager->AddProcess(theFastSimulationManagerProcess, -1, -1, 1);
00051   }
00052 
00053   // GflashEnvelop definition as CaloRegion which includes EcalRegion & HcalRegion
00054   G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("CaloRegion");
00055   if(aRegion == 0){
00056     std::cout << "CaloRegion is not defined !!!" << std::endl;
00057     std::cout << "This means that GFlash will not be turned on." << std::endl;
00058     std::cout << "Take a look at cmsGflashGeometryXML.cfi if it includes gflashCaloProdCuts.xml." << std::endl;
00059   }
00060 
00061   //Electromagnetic Shower Model
00062   if(theParSet.getParameter<bool>("GflashEMShowerModel")) {
00063     theEMShowerModel  = new GflashEMShowerModel("GflashEMShowerModel",aRegion,theParSet);
00064   }    
00065 
00066   //Hadronic Shower Model
00067   if(theParSet.getParameter<bool>("GflashHadronShowerModel")) {
00068     theHadronShowerModel = new GflashHadronShowerModel("GflashHadronShowerModel",aRegion,theParSet);
00069   }
00070 }