EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
eASTPhysicsList.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file eASTPhysicsList.cc
1 
2 //
3 // eASTPhysicsList.cc
4 // Geant4 physics list for Electron Ion Collider detector simulation
5 //
6 // History
7 // Jun.21.2018 : original implementation - Dennis H. Wright (SLAC)
8 // May.05.2021 : migration to eAST - Makoto Asai (SLAC)
9 // Dec.22.2021 : migration to Geant4 version 11.0 - Makoto Asai (JLab)
10 //
12 
13 #include "eASTPhysicsList.hh"
15 
16 #include "G4SystemOfUnits.hh"
17 #include "G4UnitsTable.hh"
18 #include "G4ProcessTable.hh"
19 #include "G4RegionStore.hh"
20 
21 #include "G4EmStandardPhysics.hh"
22 #include "G4EmExtraPhysics.hh"
23 #include "G4EmParameters.hh"
24 #include "G4HadronicParameters.hh"
25 #include "G4DecayPhysics.hh"
26 #include "G4NuclideTable.hh"
27 
28 #include "G4RadioactiveDecayPhysics.hh"
29 #include "G4OpticalPhysics.hh"
30 #include "G4StepLimiterPhysics.hh"
31 
32 #include "eASTProtonPhysics.hh"
33 #include "eASTNeutronPhysics.hh"
34 #include "eASTPionPhysics.hh"
35 #include "eASTKaonPhysics.hh"
36 #include "eASTHyperonPhysics.hh"
37 #include "eASTAntiBaryonPhysics.hh"
38 #include "eASTIonPhysics.hh"
40 
41 // particles
42 
43 #include "G4BosonConstructor.hh"
44 #include "G4LeptonConstructor.hh"
45 #include "G4MesonConstructor.hh"
46 #include "G4BaryonConstructor.hh"
47 #include "G4IonConstructor.hh"
48 #include "G4ShortLivedConstructor.hh"
49 
50 #include "G4Version.hh"
51 
53  :G4VModularPhysicsList()
54 {
55  G4int verb = 1;
56  SetVerboseLevel(verb);
57 
58  //add new units for radioActive decays
59  //
60  new G4UnitDefinition( "millielectronVolt", "meV", "Energy", 1.e-3*eV);
61  //
62 #if G4VERSION_NUMBER < 1100
63  const G4double minute = 60*second;
64  const G4double hour = 60*minute;
65  const G4double day = 24*hour;
66  const G4double year = 365*day;
67  new G4UnitDefinition("minute", "min", "Time", minute);
68  new G4UnitDefinition("hour", "h", "Time", hour);
69  new G4UnitDefinition("day", "d", "Time", day);
70  new G4UnitDefinition("year", "y", "Time", year);
71 #endif
72 
73  // Mandatory for G4NuclideTable
74  // Half-life threshold must be set small or many short-lived isomers
75  // will not be assigned life times (default to 0)
76  G4NuclideTable::GetInstance()->SetThresholdOfHalfLife(0.1*picosecond);
77  G4NuclideTable::GetInstance()->SetLevelTolerance(1.0*eV);
78 
79  globalCuts[2] = 0.7*mm; //gamma
80  globalCuts[0] = 0.7*mm; //e-
81  globalCuts[1] = 0.7*mm; //e+
82  globalCuts[3] = 0.7*mm; //proton
83 
85 }
86 
87 
89 { delete pMessenger; }
90 
92 {
94 
95  G4BosonConstructor pBosonConstructor;
96  pBosonConstructor.ConstructParticle();
97 
98  G4LeptonConstructor pLeptonConstructor;
99  pLeptonConstructor.ConstructParticle();
100 
101  G4MesonConstructor pMesonConstructor;
102  pMesonConstructor.ConstructParticle();
103 
104  G4BaryonConstructor pBaryonConstructor;
105  pBaryonConstructor.ConstructParticle();
106 
107  G4IonConstructor pIonConstructor;
108  pIonConstructor.ConstructParticle();
109 
110  G4ShortLivedConstructor pShortLivedConstructor;
111  pShortLivedConstructor.ConstructParticle();
112 }
113 
115 {
116  // EM physics
117  RegisterPhysics(new G4EmStandardPhysics());
118  G4EmParameters* param = G4EmParameters::Instance();
119  param->SetAugerCascade(true);
120  param->SetStepFunction(1., 1.*CLHEP::mm);
121  param->SetStepFunctionMuHad(1., 1.*CLHEP::mm);
122 
123  // Decay
124  RegisterPhysics(new G4DecayPhysics());
125 
126  // Radioactive decay
127  if(addRDM)
128  { RegisterPhysics(new G4RadioactiveDecayPhysics()); }
129 
130  // Hadronic physics
131  RegisterPhysics(new eASTProtonPhysics() );
132  RegisterPhysics(new eASTNeutronPhysics() );
133  RegisterPhysics(new eASTPionPhysics() );
134  RegisterPhysics(new eASTKaonPhysics() );
135  RegisterPhysics(new eASTHyperonPhysics() );
136  RegisterPhysics(new eASTAntiBaryonPhysics() );
137  RegisterPhysics(new eASTIonPhysics() );
138  RegisterPhysics(new eASTGammaLeptoNuclearPhysics() );
139 
140  // Optical physics
141  if(addOptical)
142  { RegisterPhysics(new G4OpticalPhysics() ); }
143 
144  // Step limiter
145  if(stepLimit_opt>=0)
146  { RegisterPhysics(new G4StepLimiterPhysics()); }
147 
148  processesAreRegistered = true;
149 }
150 
152 {
153  auto verbose = G4ProcessTable::GetProcessTable()->GetVerboseLevel();
154  SetVerboseLevel(verbose);
155  G4EmParameters::Instance()->SetVerbose(verbose);
156  G4HadronicParameters::Instance()->SetVerboseLevel(verbose);
157 
158  G4VModularPhysicsList::ConstructProcess();
159 }
160 
162 {
163  SetCutValue(globalCuts[2],"gamma"); // gamma should be defined first!
164  SetCutValue(globalCuts[0],"e-");
165  SetCutValue(globalCuts[1],"e+");
166  SetCutValue(globalCuts[3],"proton");
167 }
168 
169 G4Region* eASTPhysicsList::FindRegion(const G4String& reg) const
170 {
171  auto store = G4RegionStore::GetInstance();
172  return store->GetRegion(reg);
173 }
174 
176 {
177  for(G4int i=0; i<4; i++)
178  { SetGlobalCut(i,val); }
179  SetCuts();
180 }
181 
182 void eASTPhysicsList::SetGlobalCut(G4int i, G4double val)
183 {
184  globalCuts[i] = val;
185  SetCuts();
186 }
187 
188 G4Region* eASTPhysicsList::SetLocalCut(const G4String& reg,G4int i,G4double val)
189 {
190  auto regPtr = FindRegion(reg);
191  if(!regPtr) return regPtr;
192 
193  auto cuts = regPtr->GetProductionCuts();
194  if(!cuts)
195  {
196  cuts = new G4ProductionCuts();
197  regPtr->SetProductionCuts(cuts);
198  }
199 
200  cuts->SetProductionCut(val,i);
201  return regPtr;
202 }
203 
204 G4double eASTPhysicsList::GetLocalCut(const G4String& reg,G4int i) const
205 {
206  auto regPtr = FindRegion(reg);
207  G4double val = -1.0;
208  if(regPtr)
209  {
210  auto cuts = regPtr->GetProductionCuts();
211  if(cuts) val = cuts->GetProductionCut(i);
212  }
213  return val;
214 }
215 
216 #include "G4UserLimits.hh"
217 
218 G4Region* eASTPhysicsList::SetLocalStepLimit(const G4String& reg,G4double val)
219 {
220  auto regPtr = FindRegion(reg);
221  if(!regPtr) return regPtr;
222 
223  auto uLim = regPtr->GetUserLimits();
224  if(!uLim)
225  {
226  uLim = new G4UserLimits(val);
227  regPtr->SetUserLimits(uLim);
228  }
229  else
230  { uLim->SetMaxAllowedStep(val); }
231  return regPtr;
232 }
233 
234 #include "G4Track.hh"
235 G4double eASTPhysicsList::GetLocalStepLimit(const G4String& reg) const
236 {
237  static G4Track dummyTrack;
238  auto regPtr = FindRegion(reg);
239  G4double val = -1.0;
240  if(regPtr)
241  {
242  auto uLim = regPtr->GetUserLimits();
243  if(uLim) val = uLim->GetMaxAllowedStep(dummyTrack);
244  }
245  return val;
246 }
247 
249 { SetLocalStepLimit("DefaultRegionForTheWorld",val); }
250 
252 { return GetLocalStepLimit("DefaultRegionForTheWorld"); }
253