CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ParametrisedPhysics.cc
Go to the documentation of this file.
2 
3 #include "G4Electron.hh"
4 #include "G4FastSimulationManagerProcess.hh"
5 #include "G4ProcessManager.hh"
6 
7 #include "G4LeptonConstructor.hh"
8 #include "G4MesonConstructor.hh"
9 #include "G4BaryonConstructor.hh"
10 #include "G4ShortLivedConstructor.hh"
11 #include "G4IonConstructor.hh"
12 #include "G4RegionStore.hh"
13 
14 using namespace CLHEP;
15 
16 
18  G4VPhysicsConstructor(name), theParSet(p)
19 {
20  theEMShowerModel = 0;
23 }
24 
26  delete theEMShowerModel;
27  delete theHadShowerModel;
28  delete theHadronShowerModel;
29 }
30 
32 {
33  G4LeptonConstructor pLeptonConstructor;
34  pLeptonConstructor.ConstructParticle();
35 
36  G4MesonConstructor pMesonConstructor;
37  pMesonConstructor.ConstructParticle();
38 
39  G4BaryonConstructor pBaryonConstructor;
40  pBaryonConstructor.ConstructParticle();
41 
42  G4ShortLivedConstructor pShortLivedConstructor;
43  pShortLivedConstructor.ConstructParticle();
44 
45  G4IonConstructor pConstructor;
46  pConstructor.ConstructParticle();
47 }
48 
50 
51  bool gem = theParSet.getParameter<bool>("GflashEcal");
52  bool ghad = theParSet.getParameter<bool>("GflashHcal");
53  std::cout << "GFlash Construct: " << gem << " " << ghad << std::endl;
54 
55  if(gem || ghad) {
56  G4FastSimulationManagerProcess * theFastSimulationManagerProcess =
57  new G4FastSimulationManagerProcess();
58  aParticleIterator->reset();
59  while ((*aParticleIterator)()) {
60  G4ParticleDefinition * particle = aParticleIterator->value();
61  G4ProcessManager * pmanager = particle->GetProcessManager();
62  G4String pname = particle->GetParticleName();
63  if(pname == "e-" || pname == "e+") {
64  pmanager->AddProcess(theFastSimulationManagerProcess, -1, -1, 1);
65  }
66  }
67 
68  if(gem) {
69  G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("EcalRegion");
70 
71  if(!aRegion){
72  std::cout << "EcalRegion is not defined !!!" << std::endl;
73  std::cout << "This means that GFlash will not be turned on." << std::endl;
74 
75  } else {
76 
77  //Electromagnetic Shower Model for ECAL
79  new GflashEMShowerModel("GflashEMShowerModel",aRegion,theParSet);
80  std::cout << "GFlash is defined for EcalRegion" << std::endl;
81  }
82  }
83  if(ghad) {
84  G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("HcalRegion");
85  if(!aRegion) {
86  std::cout << "HcalRegion is not defined !!!" << std::endl;
87  std::cout << "This means that GFlash will not be turned on." << std::endl;
88 
89  } else {
90 
91  //Electromagnetic Shower Model for HCAL
93  new GflashEMShowerModel("GflashHadShowerModel",aRegion,theParSet);
94  std::cout << "GFlash is defined for HcalRegion" << std::endl;
95  }
96  }
97  }
98 }
T getParameter(std::string const &) const
ParametrisedPhysics(std::string name, const edm::ParameterSet &p)
edm::ParameterSet theParSet
GflashEMShowerModel * theEMShowerModel
virtual void ConstructParticle()
virtual void ConstructProcess()
GflashHadronShowerModel * theHadronShowerModel
GflashEMShowerModel * theHadShowerModel
tuple cout
Definition: gather_cfg.py:121