CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/SimG4Core/GFlash/plugins/GFlash.cc

Go to the documentation of this file.
00001 #include "SimG4Core/GFlash/interface/GFlash.h"
00002 #include "SimG4Core/GFlash/interface/ParametrisedPhysics.h"
00003 #include "SimG4Core/GFlash/interface/HadronPhysicsQGSP_WP.h"
00004 #include "SimG4Core/GFlash/interface/HadronPhysicsQGSP_BERT_WP.h"
00005 #include "SimG4Core/GFlash/interface/HadronPhysicsQGSPCMS_FTFP_BERT_WP.h"
00006 #include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics92.h"
00007 #include "SimG4Core/PhysicsLists/interface/CMSMonopolePhysics.h"
00008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00009 
00010 #include "G4DecayPhysics.hh"
00011 #include "G4EmExtraPhysics.hh"
00012 #include "G4IonPhysics.hh"
00013 #include "G4QStoppingPhysics.hh"
00014 #include "G4HadronElasticPhysics.hh" 
00015 #include "G4NeutronTrackingCut.hh"
00016 
00017 #include "G4DataQuestionaire.hh"
00018 #include "SimGeneral/GFlash/interface/GflashHistogram.h"
00019 
00020 #include <string>
00021 
00022 GFlash::GFlash(G4LogicalVolumeToDDLogicalPartMap& map, 
00023                const HepPDT::ParticleDataTable * table_, 
00024                sim::FieldBuilder *fieldBuilder_, 
00025                const edm::ParameterSet & p) : PhysicsList(map, table_, fieldBuilder_, p), 
00026                                               thePar(p.getParameter<edm::ParameterSet>("GFlash")) {
00027 
00028   G4DataQuestionaire it(photon);
00029 
00030   std::string hadronPhysics = thePar.getParameter<std::string>("GflashHadronPhysics");
00031 
00032   int  ver     = p.getUntrackedParameter<int>("Verbosity",0);
00033   bool emPhys  = p.getUntrackedParameter<bool>("EMPhysics",true);
00034   bool hadPhys = p.getUntrackedParameter<bool>("HadPhysics",true);
00035   bool tracking= p.getParameter<bool>("TrackingCut");
00036   std::string region = p.getParameter<std::string>("Region");
00037 
00038   edm::LogInfo("PhysicsList") << "You are using the simulation engine: "
00039                               << hadronPhysics << " + CMS GFLASH with Flags for EM Physics "
00040                               << emPhys << ", for Hadronic Physics "
00041                               << hadPhys << " and tracking cut " << tracking
00042                               << " with special region " << region;
00043 
00044   RegisterPhysics(new ParametrisedPhysics("parametrised",thePar)); 
00045 
00046   if (emPhys) {
00047     // EM Physics
00048     RegisterPhysics( new CMSEmStandardPhysics92("standard EM EML",ver,region));
00049 
00050     // Synchroton Radiation & GN Physics
00051     RegisterPhysics( new G4EmExtraPhysics("extra EM"));
00052   }
00053 
00054   // Decays
00055   RegisterPhysics( new G4DecayPhysics("decay",ver) );
00056 
00057   if (hadPhys) {
00058     // Hadron Elastic scattering
00059     RegisterPhysics( new G4HadronElasticPhysics("elastic",ver,false));
00060 
00061     // Hadron Physics
00062     G4bool quasiElastic=true;
00063 
00064     if(hadronPhysics=="QGSP_FTFP_BERT") {
00065       RegisterPhysics( new HadronPhysicsQGSPCMS_FTFP_BERT_WP("hadron",quasiElastic)); 
00066     }
00067     else if(hadronPhysics=="QGSP_BERT") {
00068       RegisterPhysics( new HadronPhysicsQGSP_BERT_WP("hadron",quasiElastic));
00069     }
00070     else if (hadronPhysics=="QGSP") {
00071       RegisterPhysics( new HadronPhysicsQGSP_WP("hadron",quasiElastic));
00072     }
00073     else {
00074       edm::LogInfo("PhysicsList") << hadronPhysics << " is not available for GflashHadronPhysics!"
00075                                   << "... Using QGSP_FTFP_BERT\n";
00076       RegisterPhysics( new HadronPhysicsQGSPCMS_FTFP_BERT_WP("hadron",quasiElastic));
00077     }
00078     // Stopping Physics
00079     RegisterPhysics( new G4QStoppingPhysics("stopping"));
00080 
00081     // Ion Physics
00082     RegisterPhysics( new G4IonPhysics("ion"));
00083 
00084     // Neutron tracking cut
00085     if (tracking) 
00086       RegisterPhysics( new G4NeutronTrackingCut("Neutron tracking cut", ver));
00087   }
00088 
00089   // Monopoles
00090   RegisterPhysics( new CMSMonopolePhysics(table_,fieldBuilder_,p));
00091 
00092   // singleton histogram object
00093   if(thePar.getParameter<bool>("GflashHistogram")) {
00094     theHisto = GflashHistogram::instance();
00095     theHisto->setStoreFlag(true);
00096     theHisto->bookHistogram(thePar.getParameter<std::string>("GflashHistogramName"));
00097   }
00098 
00099 }
00100 
00101 GFlash::~GFlash() {
00102 
00103   if(thePar.getParameter<bool>("GflashHistogram")) {
00104     if(theHisto) delete theHisto;
00105   }
00106 
00107 }
00108 
00109 //define this as a plug-in
00110 #include "FWCore/Framework/interface/MakerMacros.h"
00111 #include "SimG4Core/Physics/interface/PhysicsListFactory.h"
00112 
00113 
00114 DEFINE_PHYSICSLIST(GFlash);
00115