CMS 3D CMS Logo

ParametrisedPhysics.cc
Go to the documentation of this file.
2 
3 #include "G4Electron.hh"
4 #include "G4ProcessManager.hh"
5 
6 #include "G4LeptonConstructor.hh"
7 #include "G4MesonConstructor.hh"
8 #include "G4BaryonConstructor.hh"
9 #include "G4ShortLivedConstructor.hh"
10 #include "G4IonConstructor.hh"
11 #include "G4RegionStore.hh"
12 
13 using namespace CLHEP;
14 
16 
18  G4VPhysicsConstructor(name), theParSet(p)
19 {}
20 
22  if(nullptr != tpdata) {
23  delete tpdata->theEMShowerModel;
24  delete tpdata->theHadShowerModel;
27  tpdata = nullptr;
28  }
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  tpdata = new ThreadPrivate;
52  tpdata->theEMShowerModel = nullptr;
53  tpdata->theHadShowerModel = nullptr;
54  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) {
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->AddDiscreteProcess(tpdata->theFastSimulationManagerProcess);
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
G4FastSimulationManagerProcess * theFastSimulationManagerProcess
virtual void ConstructParticle()
virtual void ConstructProcess()
GflashHadronShowerModel * theHadronShowerModel
static G4ThreadLocal ThreadPrivate * tpdata