CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/SimG4Core/Application/src/ParametrisedEMPhysics.cc

Go to the documentation of this file.
00001 //
00002 // Joanna Weng 08.2005
00003 // Physics process for Gflash parameterisation
00004 // modified by Soon Yung Jun, Dongwook Jang
00005 // V.Ivanchenko rename the class, cleanup, and move
00006 //              to SimG4Core/Application - 2012/08/14
00007 
00008 #include "SimG4Core/Application/interface/ParametrisedEMPhysics.h"
00009 #include "SimG4Core/Application/interface/GFlashEMShowerModel.h"
00010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00011 
00012 #include "G4FastSimulationManagerProcess.hh"
00013 #include "G4ProcessManager.hh"
00014 
00015 #include "G4LeptonConstructor.hh"
00016 #include "G4MesonConstructor.hh"
00017 #include "G4BaryonConstructor.hh"
00018 #include "G4ShortLivedConstructor.hh"
00019 #include "G4IonConstructor.hh"
00020 #include "G4RegionStore.hh"
00021 
00022 #include "G4EmProcessOptions.hh"
00023 
00024 ParametrisedEMPhysics::ParametrisedEMPhysics(std::string name, const edm::ParameterSet & p) 
00025   : G4VPhysicsConstructor(name), theParSet(p) 
00026 {
00027   theEMShowerModel = 0;
00028   theHadShowerModel = 0;
00029 }
00030 
00031 ParametrisedEMPhysics::~ParametrisedEMPhysics() {
00032   delete theEMShowerModel;
00033   delete theHadShowerModel;
00034 }
00035 
00036 void ParametrisedEMPhysics::ConstructParticle() 
00037 {
00038   G4LeptonConstructor pLeptonConstructor;
00039   pLeptonConstructor.ConstructParticle();
00040 
00041   G4MesonConstructor pMesonConstructor;
00042   pMesonConstructor.ConstructParticle();
00043 
00044   G4BaryonConstructor pBaryonConstructor;
00045   pBaryonConstructor.ConstructParticle();
00046 
00047   G4ShortLivedConstructor pShortLivedConstructor;
00048   pShortLivedConstructor.ConstructParticle();  
00049     
00050   G4IonConstructor pConstructor;
00051   pConstructor.ConstructParticle();  
00052 }
00053 
00054 void ParametrisedEMPhysics::ConstructProcess() {
00055 
00056   // GFlash part 
00057   bool gem  = theParSet.getParameter<bool>("GflashEcal");
00058   bool ghad = theParSet.getParameter<bool>("GflashHcal");
00059 
00060   if(gem || ghad) {
00061     edm::LogInfo("SimG4CoreApplication") 
00062       << "ParametrisedEMPhysics: GFlash Construct: " 
00063       << gem << "  " << ghad;
00064     G4FastSimulationManagerProcess * theFastSimulationManagerProcess = 
00065       new G4FastSimulationManagerProcess();
00066     theParticleIterator->reset();
00067     while ((*theParticleIterator)()) {
00068       G4ParticleDefinition * particle = theParticleIterator->value();
00069       G4ProcessManager * pmanager = particle->GetProcessManager();
00070       G4String pname = particle->GetParticleName();
00071       if(pname == "e-" || pname == "e+") {
00072         pmanager->AddProcess(theFastSimulationManagerProcess, -1, -1, 1);
00073       }
00074     }
00075 
00076     if(gem) {
00077       G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("EcalRegion");
00078 
00079       if(!aRegion){
00080         edm::LogInfo("SimG4CoreApplication") 
00081           << "ParametrisedEMPhysics::ConstructProcess: " 
00082           << "EcalRegion is not defined, GFlash will not be enabled for ECAL!";
00083         
00084       } else {
00085 
00086         //Electromagnetic Shower Model for ECAL
00087         theEMShowerModel = 
00088           new GFlashEMShowerModel("GflashEMShowerModel",aRegion,theParSet);
00089         //std::cout << "GFlash is defined for EcalRegion" << std::endl;
00090       }    
00091     }
00092     if(ghad) {
00093       G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("HcalRegion");
00094       if(!aRegion) {
00095         edm::LogInfo("SimG4CoreApplication") 
00096           << "ParametrisedEMPhysics::ConstructProcess: " 
00097           << "HcalRegion is not defined, GFlash will not be enabled for HCAL!";
00098         
00099       } else {
00100 
00101         //Electromagnetic Shower Model for HCAL
00102         theHadShowerModel = 
00103           new GFlashEMShowerModel("GflashHadShowerModel",aRegion,theParSet);
00104         //std::cout << "GFlash is defined for HcalRegion" << std::endl;
00105       }
00106     }
00107   }
00108   // Russian Roulette part 
00109   G4EmProcessOptions opt;
00110   const G4String rname[8] = {"EcalRegion", "HcalRegion", "QuadRegion", "MuonIron",
00111                              "PreshowerRegion","CastorRegion","BeamPipeOutsideRegion",
00112                              "DefaultRegionForTheWorld"};
00113   G4double rrfact[8] = { 1.0 };
00114 
00115   // Russian roulette for gamma
00116   G4double energyLim = theParSet.getParameter<double>("RusRoGammaEnergyLimit")*MeV;
00117   if(energyLim > 0.0) {
00118     rrfact[0] = theParSet.getParameter<double>("RusRoEcalGamma");
00119     rrfact[1] = theParSet.getParameter<double>("RusRoHcalGamma");
00120     rrfact[2] = theParSet.getParameter<double>("RusRoQuadGamma");
00121     rrfact[3] = theParSet.getParameter<double>("RusRoMuonIronGamma");
00122     rrfact[4] = theParSet.getParameter<double>("RusRoPreShowerGamma");
00123     rrfact[5] = theParSet.getParameter<double>("RusRoCastorGamma");
00124     rrfact[6] = theParSet.getParameter<double>("RusRoBeamPipeOutGamma");
00125     rrfact[7] = theParSet.getParameter<double>("RusRoWorldGamma");
00126     for(int i=0; i<8; ++i) {
00127       if(rrfact[i] < 1.0) {
00128         opt.ActivateSecondaryBiasing("eBrem",rname[i],rrfact[i],energyLim);
00129         edm::LogInfo("SimG4CoreApplication") 
00130           << "ParametrisedEMPhysics: Russian Roulette"
00131           << " for gamma Prob= " << rrfact[i]  
00132           << " Elimit(MeV)= " << energyLim/CLHEP::MeV
00133           << " inside " << rname[i];
00134       }
00135     }
00136   }
00137   // Russian roulette for e-
00138   energyLim = theParSet.getParameter<double>("RusRoElectronEnergyLimit")*MeV;
00139   if(energyLim > 0.0) {
00140     rrfact[0] = theParSet.getParameter<double>("RusRoEcalElectron");
00141     rrfact[1] = theParSet.getParameter<double>("RusRoHcalElectron");
00142     rrfact[2] = theParSet.getParameter<double>("RusRoQuadElectron");
00143     rrfact[3] = theParSet.getParameter<double>("RusRoMuonIronElectron");
00144     rrfact[4] = theParSet.getParameter<double>("RusRoPreShowerElectron");
00145     rrfact[5] = theParSet.getParameter<double>("RusRoCastorElectron");
00146     rrfact[6] = theParSet.getParameter<double>("RusRoBeamPipeOutElectron");
00147     rrfact[7] = theParSet.getParameter<double>("RusRoWorldElectron");
00148     for(int i=0; i<8; ++i) {
00149       if(rrfact[i] < 1.0) {
00150         opt.ActivateSecondaryBiasing("eIoni",rname[i],rrfact[i],energyLim);
00151         opt.ActivateSecondaryBiasing("hIoni",rname[i],rrfact[i],energyLim);
00152         opt.ActivateSecondaryBiasing("muIoni",rname[i],rrfact[i],energyLim);
00153         opt.ActivateSecondaryBiasing("ionIoni",rname[i],rrfact[i],energyLim);
00154         opt.ActivateSecondaryBiasingForGamma("phot",rname[i],rrfact[i],energyLim);
00155         opt.ActivateSecondaryBiasingForGamma("compt",rname[i],rrfact[i],energyLim);
00156         opt.ActivateSecondaryBiasingForGamma("conv",rname[i],rrfact[i],energyLim);
00157         edm::LogInfo("SimG4CoreApplication") 
00158           << "ParametrisedEMPhysics: Russian Roulette"
00159           << " for e- Prob= " << rrfact[i]  
00160           << " Elimit(MeV)= " << energyLim/CLHEP::MeV
00161           << " inside " << rname[i];
00162       }
00163     }
00164   }
00165 }