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.
3 
4 #include "G4Electron.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;
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;
57 
58  bool gem = theParSet.getParameter<bool>("GflashEcal");
59  bool ghad = theParSet.getParameter<bool>("GflashHcal");
60  G4cout << "GFlash Construct: " << gem << " " << ghad << G4endl;
61 
62  if(gem || ghad) {
64  new G4FastSimulationManagerProcess();
65 
66  G4ParticleTable* table = G4ParticleTable::GetParticleTable();
67  EmParticleList emList;
68  for(const auto& particleName : emList.PartNames()) {
69  G4ParticleDefinition* particle = table->FindParticle(particleName);
70  G4ProcessManager * pmanager = particle->GetProcessManager();
71  const G4String& pname = particle->GetParticleName();
72  if(pname == "e-" || pname == "e+") {
73  pmanager->AddDiscreteProcess(tpdata->theFastSimulationManagerProcess);
74  }
75  }
76 
77  if(gem) {
78  G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("EcalRegion");
79 
80  if(!aRegion){
81  G4cout << "EcalRegion is not defined !!!" << G4endl;
82  G4cout << "This means that GFlash will not be turned on." << G4endl;
83 
84  } else {
85 
86  //Electromagnetic Shower Model for ECAL
88  new GflashEMShowerModel("GflashEMShowerModel",aRegion,theParSet);
89  G4cout << "GFlash is defined for EcalRegion" << G4endl;
90  }
91  }
92  if(ghad) {
93  G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("HcalRegion");
94  if(!aRegion) {
95  G4cout << "HcalRegion is not defined !!!" << G4endl;
96  G4cout << "This means that GFlash will not be turned on." << G4endl;
97 
98  } else {
99 
100  //Electromagnetic Shower Model for HCAL
102  new GflashEMShowerModel("GflashHadShowerModel",aRegion,theParSet);
103  G4cout << "GFlash is defined for HcalRegion" << G4endl;
104  }
105  }
106  }
107 }
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
A class for AMC data.
Definition: AMC13Event.h:6
GflashHadronShowerModel * theHadronShowerModel
static G4ThreadLocal ThreadPrivate * tpdata