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 
17 
19  G4VPhysicsConstructor(name), theParSet(p)
20 {}
21 
23  if(nullptr != tpdata) {
24  delete tpdata->theEMShowerModel;
25  delete tpdata->theHadShowerModel;
27  delete tpdata;
28  tpdata = nullptr;
29  }
30 }
31 
33 {
34  G4LeptonConstructor pLeptonConstructor;
35  pLeptonConstructor.ConstructParticle();
36 
37  G4MesonConstructor pMesonConstructor;
38  pMesonConstructor.ConstructParticle();
39 
40  G4BaryonConstructor pBaryonConstructor;
41  pBaryonConstructor.ConstructParticle();
42 
43  G4ShortLivedConstructor pShortLivedConstructor;
44  pShortLivedConstructor.ConstructParticle();
45 
46  G4IonConstructor pConstructor;
47  pConstructor.ConstructParticle();
48 }
49 
51 
52  tpdata = new ThreadPrivate;
53  tpdata->theEMShowerModel = nullptr;
54  tpdata->theHadShowerModel = nullptr;
55  tpdata->theHadronShowerModel = nullptr;
56 
57  bool gem = theParSet.getParameter<bool>("GflashEcal");
58  bool ghad = theParSet.getParameter<bool>("GflashHcal");
59  G4cout << "GFlash Construct: " << gem << " " << ghad << G4endl;
60 
61  if(gem || ghad) {
62  G4FastSimulationManagerProcess * theFastSimulationManagerProcess =
63  new G4FastSimulationManagerProcess();
64  aParticleIterator->reset();
65  while ((*aParticleIterator)()) {
66  G4ParticleDefinition * particle = aParticleIterator->value();
67  G4ProcessManager * pmanager = particle->GetProcessManager();
68  G4String pname = particle->GetParticleName();
69  if(pname == "e-" || pname == "e+") {
70  pmanager->AddProcess(theFastSimulationManagerProcess, -1, -1, 1);
71  }
72  }
73 
74  if(gem) {
75  G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("EcalRegion");
76 
77  if(!aRegion){
78  G4cout << "EcalRegion is not defined !!!" << G4endl;
79  G4cout << "This means that GFlash will not be turned on." << G4endl;
80 
81  } else {
82 
83  //Electromagnetic Shower Model for ECAL
85  new GflashEMShowerModel("GflashEMShowerModel",aRegion,theParSet);
86  G4cout << "GFlash is defined for EcalRegion" << G4endl;
87  }
88  }
89  if(ghad) {
90  G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("HcalRegion");
91  if(!aRegion) {
92  G4cout << "HcalRegion is not defined !!!" << G4endl;
93  G4cout << "This means that GFlash will not be turned on." << G4endl;
94 
95  } else {
96 
97  //Electromagnetic Shower Model for HCAL
99  new GflashEMShowerModel("GflashHadShowerModel",aRegion,theParSet);
100  G4cout << "GFlash is defined for HcalRegion" << G4endl;
101  }
102  }
103  }
104 }
T getParameter(std::string const &) const
ParametrisedPhysics(std::string name, const edm::ParameterSet &p)
edm::ParameterSet theParSet
virtual void ConstructParticle()
virtual void ConstructProcess()
GflashHadronShowerModel * theHadronShowerModel
static G4ThreadLocal ThreadPrivate * tpdata