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 
16  G4VPhysicsConstructor(name), theParSet(p)
17 {
18  theEMShowerModel = 0;
21 }
22 
24  delete theEMShowerModel;
25  delete theHadShowerModel;
26  delete theHadronShowerModel;
27 }
28 
30 {
31  G4LeptonConstructor pLeptonConstructor;
32  pLeptonConstructor.ConstructParticle();
33 
34  G4MesonConstructor pMesonConstructor;
35  pMesonConstructor.ConstructParticle();
36 
37  G4BaryonConstructor pBaryonConstructor;
38  pBaryonConstructor.ConstructParticle();
39 
40  G4ShortLivedConstructor pShortLivedConstructor;
41  pShortLivedConstructor.ConstructParticle();
42 
43  G4IonConstructor pConstructor;
44  pConstructor.ConstructParticle();
45 }
46 
48 
49  bool gem = theParSet.getParameter<bool>("GflashEcal");
50  bool ghad = theParSet.getParameter<bool>("GflashHcal");
51  std::cout << "GFlash Construct: " << gem << " " << ghad << std::endl;
52 
53  if(gem || ghad) {
54  G4FastSimulationManagerProcess * theFastSimulationManagerProcess =
55  new G4FastSimulationManagerProcess();
56  theParticleIterator->reset();
57  while ((*theParticleIterator)()) {
58  G4ParticleDefinition * particle = theParticleIterator->value();
59  G4ProcessManager * pmanager = particle->GetProcessManager();
60  G4String pname = particle->GetParticleName();
61  if(pname == "e-" || pname == "e+") {
62  pmanager->AddProcess(theFastSimulationManagerProcess, -1, -1, 1);
63  }
64  }
65 
66  if(gem) {
67  G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("EcalRegion");
68 
69  if(!aRegion){
70  std::cout << "EcalRegion is not defined !!!" << std::endl;
71  std::cout << "This means that GFlash will not be turned on." << std::endl;
72 
73  } else {
74 
75  //Electromagnetic Shower Model for ECAL
77  new GflashEMShowerModel("GflashEMShowerModel",aRegion,theParSet);
78  std::cout << "GFlash is defined for EcalRegion" << std::endl;
79  }
80  }
81  if(ghad) {
82  G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("HcalRegion");
83  if(!aRegion) {
84  std::cout << "HcalRegion is not defined !!!" << std::endl;
85  std::cout << "This means that GFlash will not be turned on." << std::endl;
86 
87  } else {
88 
89  //Electromagnetic Shower Model for HCAL
91  new GflashEMShowerModel("GflashHadShowerModel",aRegion,theParSet);
92  std::cout << "GFlash is defined for HcalRegion" << std::endl;
93  }
94  }
95  }
96 }
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