CMS 3D CMS Logo

ParametrisedPhysics.cc
Go to the documentation of this file.
3 
4 #include "G4Electron.hh"
5 #include "G4ProcessManager.hh"
6 
7 #include "G4BaryonConstructor.hh"
8 #include "G4IonConstructor.hh"
9 #include "G4LeptonConstructor.hh"
10 #include "G4MesonConstructor.hh"
11 #include "G4RegionStore.hh"
12 #include "G4ShortLivedConstructor.hh"
13 
14 using namespace CLHEP;
15 
17 
19  : G4VPhysicsConstructor(name), theParSet(p) {}
20 
22  if (nullptr != tpdata) {
23  delete tpdata->theEMShowerModel;
24  delete tpdata->theHadShowerModel;
27  tpdata = nullptr;
28  }
29 }
30 
32  G4LeptonConstructor pLeptonConstructor;
33  pLeptonConstructor.ConstructParticle();
34 
35  G4MesonConstructor pMesonConstructor;
36  pMesonConstructor.ConstructParticle();
37 
38  G4BaryonConstructor pBaryonConstructor;
39  pBaryonConstructor.ConstructParticle();
40 
41  G4ShortLivedConstructor pShortLivedConstructor;
42  pShortLivedConstructor.ConstructParticle();
43 
44  G4IonConstructor pConstructor;
45  pConstructor.ConstructParticle();
46 }
47 
49  tpdata = new ThreadPrivate;
50  tpdata->theEMShowerModel = nullptr;
51  tpdata->theHadShowerModel = nullptr;
52  tpdata->theHadronShowerModel = nullptr;
54 
55  bool gem = theParSet.getParameter<bool>("GflashEcal");
56  bool ghad = theParSet.getParameter<bool>("GflashHcal");
57  G4cout << "GFlash Construct: " << gem << " " << ghad << G4endl;
58 
59  if (gem || ghad) {
60  tpdata->theFastSimulationManagerProcess = new G4FastSimulationManagerProcess();
61 
62  G4ParticleTable *table = G4ParticleTable::GetParticleTable();
63  EmParticleList emList;
64  for (const auto &particleName : emList.PartNames()) {
65  G4ParticleDefinition *particle = table->FindParticle(particleName);
66  G4ProcessManager *pmanager = particle->GetProcessManager();
67  const G4String &pname = particle->GetParticleName();
68  if (pname == "e-" || pname == "e+") {
69  pmanager->AddDiscreteProcess(tpdata->theFastSimulationManagerProcess);
70  }
71  }
72 
73  if (gem) {
74  G4Region *aRegion = G4RegionStore::GetInstance()->GetRegion("EcalRegion");
75 
76  if (!aRegion) {
77  G4cout << "EcalRegion is not defined !!!" << G4endl;
78  G4cout << "This means that GFlash will not be turned on." << G4endl;
79 
80  } else {
81  // Electromagnetic Shower Model for ECAL
82  tpdata->theEMShowerModel = new GflashEMShowerModel("GflashEMShowerModel", aRegion, theParSet);
83  G4cout << "GFlash is defined for EcalRegion" << G4endl;
84  }
85  }
86  if (ghad) {
87  G4Region *aRegion = G4RegionStore::GetInstance()->GetRegion("HcalRegion");
88  if (!aRegion) {
89  G4cout << "HcalRegion is not defined !!!" << G4endl;
90  G4cout << "This means that GFlash will not be turned on." << G4endl;
91 
92  } else {
93  // Electromagnetic Shower Model for HCAL
94  tpdata->theHadShowerModel = new GflashEMShowerModel("GflashHadShowerModel", aRegion, theParSet);
95  G4cout << "GFlash is defined for HcalRegion" << G4endl;
96  }
97  }
98  }
99 }
T getParameter(std::string const &) const
const std::vector< G4String > & PartNames() const
void ConstructParticle() override
void ConstructProcess() override
ParametrisedPhysics(std::string name, const edm::ParameterSet &p)
edm::ParameterSet theParSet
G4FastSimulationManagerProcess * theFastSimulationManagerProcess
Definition: AMC13Event.h:6
GflashHadronShowerModel * theHadronShowerModel
static G4ThreadLocal ThreadPrivate * tpdata