CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/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   theEMShowerModel = 0;
00019   theHadShowerModel = 0;
00020   theHadronShowerModel = 0;
00021 }
00022 
00023 ParametrisedPhysics::~ParametrisedPhysics() {
00024   delete theEMShowerModel;
00025   delete theHadShowerModel;
00026   delete theHadronShowerModel;
00027 }
00028 
00029 void ParametrisedPhysics::ConstructParticle() 
00030 {
00031     G4LeptonConstructor pLeptonConstructor;
00032     pLeptonConstructor.ConstructParticle();
00033 
00034     G4MesonConstructor pMesonConstructor;
00035     pMesonConstructor.ConstructParticle();
00036 
00037     G4BaryonConstructor pBaryonConstructor;
00038     pBaryonConstructor.ConstructParticle();
00039 
00040     G4ShortLivedConstructor pShortLivedConstructor;
00041     pShortLivedConstructor.ConstructParticle();  
00042     
00043     G4IonConstructor pConstructor;
00044     pConstructor.ConstructParticle();  
00045 }
00046 
00047 void ParametrisedPhysics::ConstructProcess() {
00048 
00049   bool gem  = theParSet.getParameter<bool>("GflashEcal");
00050   bool ghad = theParSet.getParameter<bool>("GflashHcal");
00051   std::cout << "GFlash Construct: " << gem << "  " << ghad << std::endl;
00052 
00053   if(gem || ghad) {
00054     G4FastSimulationManagerProcess * theFastSimulationManagerProcess = 
00055       new G4FastSimulationManagerProcess();
00056     theParticleIterator->reset();
00057     while ((*theParticleIterator)()) {
00058       G4ParticleDefinition * particle = theParticleIterator->value();
00059       G4ProcessManager * pmanager = particle->GetProcessManager();
00060       G4String pname = particle->GetParticleName();
00061       if(pname == "e-" || pname == "e+") {
00062         pmanager->AddProcess(theFastSimulationManagerProcess, -1, -1, 1);
00063       }
00064     }
00065 
00066     if(gem) {
00067       G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("EcalRegion");
00068 
00069       if(!aRegion){
00070         std::cout << "EcalRegion is not defined !!!" << std::endl;
00071         std::cout << "This means that GFlash will not be turned on." << std::endl;
00072         
00073       } else {
00074 
00075         //Electromagnetic Shower Model for ECAL
00076         theEMShowerModel = 
00077           new GflashEMShowerModel("GflashEMShowerModel",aRegion,theParSet);
00078         std::cout << "GFlash is defined for EcalRegion" << std::endl;
00079       }    
00080     }
00081     if(ghad) {
00082       G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("HcalRegion");
00083       if(!aRegion) {
00084         std::cout << "HcalRegion is not defined !!!" << std::endl;
00085         std::cout << "This means that GFlash will not be turned on." << std::endl;
00086         
00087       } else {
00088 
00089         //Electromagnetic Shower Model for HCAL
00090         theHadShowerModel = 
00091           new GflashEMShowerModel("GflashHadShowerModel",aRegion,theParSet);
00092         std::cout << "GFlash is defined for HcalRegion" << std::endl;    
00093       }
00094     }
00095   }
00096 }