"git@code.ihep.ac.cn:maxt/CEPCSW.git" did not exist on "8a9409216c62ad76d7f71fd4201805e58df1b07d"
Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
//==========================================================================
// AIDA Detector description implementation
//--------------------------------------------------------------------------
// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
// All rights reserved.
//
// For the licensing terms see $DD4hepINSTALL/LICENSE.
// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
//
// Author : M.Frank
//
//==========================================================================
#ifndef DDG4_GEANT4GFLASHACTION_H
#define DDG4_GEANT4GFLASHACTION_H
// Framework include files
#include <DDG4/Geant4DetectorConstruction.h>
// Geant4 include files
#include "G4FastSimulationPhysics.hh"
class GVFlashShowerParameterisation;
class GFlashParticleBounds;
class GFlashShowerModel;
class GFlashHitMaker;
// C/C++ include files
#include <vector>
/// Namespace for the AIDA detector description toolkit
namespace dd4hep {
/// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit
namespace sim {
class Geant4InputAction;
/// Steering class for Geant4 GFlash parametrization
/**
* Steering class for Geant4 GFlash parametrization
*
* \author M.Frank
*
* \version 1.0
* \ingroup DD4HEP_SIMULATION
*/
class Geant4GFlashShowerModel : public Geant4DetectorConstruction {
protected:
/// Define standard assignments and constructors
DDG4_DEFINE_ACTION_CONSTRUCTORS(Geant4GFlashShowerModel);
/// Region name to which this parametrization should be applied
std::string m_regionName;
/// Name of the shower model constructor
std::string m_modelName;
std::string m_paramName;
GFlashShowerModel* m_showerModel { nullptr };
GVFlashShowerParameterisation* m_parametrization { nullptr };
GFlashParticleBounds* m_particleBounds { nullptr };
GFlashHitMaker* m_hitMaker { nullptr };
public:
/// Standard constructor
Geant4GFlashShowerModel(Geant4Context* context, const std::string& nam);
/// Default destructor
virtual ~Geant4GFlashShowerModel();
/// Geometry construction callback. Called at "Construct()"
virtual void constructGeo(Geant4DetectorConstructionContext* ctxt);
/// Electromagnetic field construction callback. Called at "ConstructSDandField()"
virtual void constructField(Geant4DetectorConstructionContext* ctxt);
/// Sensitive detector construction callback. Called at "ConstructSDandField()"
virtual void constructSensitives(Geant4DetectorConstructionContext* ctxt);
};
} /* End namespace sim */
} /* End namespace dd4hep */
#endif // DDG4_GEANT4GFLASHACTION_H
//==========================================================================
// AIDA Detector description implementation
//--------------------------------------------------------------------------
// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
// All rights reserved.
//
// For the licensing terms see $DD4hepINSTALL/LICENSE.
// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
//
// Author : M.Frank
//
//==========================================================================
// #include <DDG4/Geant4GFlashShowerModel.h>
// Framework include files
#include <DDG4/Geant4Action.h>
#include <DDG4/Geant4Kernel.h>
// Geant4 include files
#include "GVFlashShowerParameterisation.hh"
#include "G4FastSimulationManager.hh"
#include "GFlashShowerModel.hh"
#include "GFlashHitMaker.hh"
#include "GFlashParticleBounds.hh"
using namespace dd4hep;
using namespace dd4hep::sim;
/// Standard constructor
Geant4GFlashShowerModel::Geant4GFlashShowerModel(Geant4Context* ctxt, const std::string& nam)
: Geant4DetectorConstruction(ctxt, nam)
{
declareProperty("Region", m_regionName);
declareProperty("Parametrization", m_paramName);
declareProperty("Model", m_modelName);
}
/// Default destructor
Geant4GFlashShowerModel::~Geant4GFlashShowerModel() {
detail::deletePtr(m_showerModel);
detail::deletePtr(m_particleBounds);
detail::deletePtr(m_hitMaker);
}
/// Geometry construction callback. Called at "Construct()"
void Geant4GFlashShowerModel::constructGeo(Geant4DetectorConstructionContext* /* ctxt */) {
}
/// Electromagnetic field construction callback. Called at "ConstructSDandField()"
void Geant4GFlashShowerModel::constructField(Geant4DetectorConstructionContext* /* ctxt */) {
}
/// Sensitive detector construction callback. Called at "ConstructSDandField()"
void Geant4GFlashShowerModel::constructSensitives(Geant4DetectorConstructionContext* /* ctxt */) {
auto& kernel = this->context()->kernel();
G4Region* region = 0;
Geant4Action* action = nullptr;
if ( !this->m_parametrization && this->m_paramName.empty() ) {
except("No proper parametrization name supplied in the properties: %s",this->m_paramName.c_str());
}
this->m_showerModel = new GFlashShowerModel(this->name(), region);
if ( !this->m_parametrization ) {
action = kernel.globalAction(this->m_paramName, false);
if ( action ) {
this->m_parametrization = dynamic_cast<GVFlashShowerParameterisation*>(action);
if ( !this->m_parametrization ) {
except("The supplied parametrization %s was found as Geant4Action, but is no "
"GVFlashShowerParameterisation!", this->m_paramName.c_str());
}
}
}
this->m_hitMaker = new GFlashHitMaker();
this->m_particleBounds = new GFlashParticleBounds();
this->m_showerModel->SetParameterisation(*this->m_parametrization);
this->m_showerModel->SetParticleBounds(*this->m_particleBounds);
this->m_showerModel->SetHitMaker(*this->m_hitMaker);
}
#if 0
// Get nist material manager
G4NistManager* nistManager = G4NistManager::Instance();
G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
// -- fast simulation models:
// **********************************************
// * Initializing shower modell
// ***********************************************
G4cout << "Creating shower parameterization models" << G4endl;
fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion);
fParameterisation = new GFlashHomoShowerParameterisation(pbWO4);
fFastShowerModel->SetParameterisation(*fParameterisation);
// Energy Cuts to kill particles:
fParticleBounds = new GFlashParticleBounds();
fFastShowerModel->SetParticleBounds(*fParticleBounds);
// Makes the EnergieSpots
fHitMaker = new GFlashHitMaker();
fFastShowerModel->SetHitMaker(*fHitMaker);
#endif
#if 0
//------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------
main() {
// -- Create a fast simulation physics constructor, used to augment
// -- the above physics list to allow for fast simulation:
G4FastSimulationPhysics* fastSimulationPhysics = new G4FastSimulationPhysics();
// -- We now configure the fastSimulationPhysics object.
// -- The gflash model (GFlashShowerModel, see ExGflashDetectorConstruction.cc)
// -- is applicable to e+ and e- : we augment the physics list for these
// -- particles (by adding a G4FastSimulationManagerProcess with below's
// -- calls), this will make the fast simulation to be activated:
fastSimulationPhysics->ActivateFastSimulation("e-");
fastSimulationPhysics->ActivateFastSimulation("e+");
// -- Register this fastSimulationPhysics to the physicsList,
// -- when the physics list will be called by the run manager
// -- (will happen at initialization of the run manager)
// -- for physics process construction, the fast simulation
// -- configuration will be applied as well.
physicsList->RegisterPhysics( fastSimulationPhysics );
}
//------------------------------------------------------------------------------------------------
void ExGflash1DetectorConstruction::ConstructSDandField()
{
// -- sensitive detectors:
G4SDManager* SDman = G4SDManager::GetSDMpointer();
ExGflash1SensitiveDetector* CaloSD
= new ExGflash1SensitiveDetector("Calorimeter",this);
SDman->AddNewDetector(CaloSD);
fCrystalLog->SetSensitiveDetector(CaloSD);
// Get nist material manager
G4NistManager* nistManager = G4NistManager::Instance();
G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
// -- fast simulation models:
// **********************************************
// * Initializing shower modell
// ***********************************************
G4cout << "Creating shower parameterization models" << G4endl;
fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion);
fParameterisation = new GFlashHomoShowerParameterisation(pbWO4);
fFastShowerModel->SetParameterisation(*fParameterisation);
// Energy Cuts to kill particles:
fParticleBounds = new GFlashParticleBounds();
fFastShowerModel->SetParticleBounds(*fParticleBounds);
// Makes the EnergieSpots
fHitMaker = new GFlashHitMaker();
fFastShowerModel->SetHitMaker(*fHitMaker);
G4cout<<"end shower parameterization."<<G4endl;
// **********************************************
}
//------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------
main() {
auto detector = new ExGflash2DetectorConstruction();
detector->RegisterParallelWorld(new ExGflash2ParallelWorld("parallelWorld"));
runManager->SetUserInitialization(detector);
// G4cout<<"# GFlash Example: Physics "<<G4endl;
// -- Select a physics list:
G4VModularPhysicsList* physicsList = new FTFP_BERT();
// -- Create a fast simulation physics constructor, used to augment
// -- the above physics list to allow for fast simulation:
G4FastSimulationPhysics* fastSimulationPhysics = new G4FastSimulationPhysics();
// -- We now configure the fastSimulationPhysics object.
// -- The gflash model (GFlashShowerModel, see ExGflashDetectorConstruction.cc)
// -- is applicable to e+ and e- : we augment the physics list for these
// -- particles (by adding a G4FastSimulationManagerProcess with below's
// -- calls), this will make the fast simulation to be activated:
fastSimulationPhysics->ActivateFastSimulation("e-", "parallelWorld");
fastSimulationPhysics->ActivateFastSimulation("e+", "parallelWorld");
// -- Register this fastSimulationPhysics to the physicsList,
// -- when the physics list will be called by the run manager
// -- (will happen at initialization of the run manager)
// -- for physics process construction, the fast simulation
// -- configuration will be applied as well.
physicsList->RegisterPhysics( fastSimulationPhysics );
runManager->SetUserInitialization(physicsList);
// Action initialization:
runManager->SetUserInitialization(new ExGflashActionInitialization);
}
//------------------------------------------------------------------------------------------------
void ExGflash2ParallelWorld::ConstructSD()
{
// Get nist material manager
G4NistManager* nistManager = G4NistManager::Instance();
G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
// -- fast simulation models:
// **********************************************
// * Initializing shower modell
// ***********************************************
fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion);
fParameterisation = new GFlashHomoShowerParameterisation(pbWO4);
fFastShowerModel->SetParameterisation(*fParameterisation);
// Energy Cuts to kill particles:
fParticleBounds = new GFlashParticleBounds();
fFastShowerModel->SetParticleBounds(*fParticleBounds);
// Makes the EnergieSpots
fHitMaker = new GFlashHitMaker();
fFastShowerModel->SetHitMaker(*fHitMaker);
}
//------------------------------------------------------------------------------------------------
void ExGflash2DetectorConstruction::ConstructSDandField()
{
// -- sensitive detectors:
G4SDManager* SDman = G4SDManager::GetSDMpointer();
ExGflash2SensitiveDetector* CaloSD
= new ExGflash2SensitiveDetector("Calorimeter",this);
SDman->AddNewDetector(CaloSD);
fCrystalLog->SetSensitiveDetector(CaloSD);
// Fast simulation implemented in ExGflash2ParallelWorld
}
//------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------
main() {
auto detector = new ExGflash3DetectorConstruction();
detector->RegisterParallelWorld(new ExGflash3ParallelWorld("parallelWorld"));
runManager->SetUserInitialization(detector);
// G4cout<<"# GFlash Example: Physics "<<G4endl;
// -- Select a physics list:
G4VModularPhysicsList* physicsList = new FTFP_BERT();
// -- Create a fast simulation physics constructor, used to augment
// -- the above physics list to allow for fast simulation:
G4FastSimulationPhysics* fastSimulationPhysics = new G4FastSimulationPhysics();
// -- We now configure the fastSimulationPhysics object.
// -- The gflash model (GFlashShowerModel, see ExGflashDetectorConstruction.cc)
// -- is applicable to e+ and e- : we augment the physics list for these
// -- particles (by adding a G4FastSimulationManagerProcess with below's
// -- calls), this will make the fast simulation to be activated:
fastSimulationPhysics->ActivateFastSimulation("e-");
fastSimulationPhysics->ActivateFastSimulation("e+");
// -- Register this fastSimulationPhysics to the physicsList,
// -- when the physics list will be called by the run manager
// -- (will happen at initialization of the run manager)
// -- for physics process construction, the fast simulation
// -- configuration will be applied as well.
physicsList->RegisterPhysics( new G4ParallelWorldPhysics("parallelWorld") );
physicsList->RegisterPhysics( fastSimulationPhysics );
runManager->SetUserInitialization(physicsList);
}
//------------------------------------------------------------------------------------------------
void ExGflash3ParallelWorld::ConstructSD()
{
// -- sensitive detectors:
G4SDManager* SDman = G4SDManager::GetSDMpointer();
ExGflash3SensitiveDetector* CaloSD
= new ExGflash3SensitiveDetector("Calorimeter",this);
SDman->AddNewDetector(CaloSD);
fCrystalLog->SetSensitiveDetector(CaloSD);
}
//------------------------------------------------------------------------------------------------
void ExGflash3DetectorConstruction::ConstructSDandField()
{
// SD moved to parallel world
// -- fast simulation models:
// **********************************************
// * Initializing shower modell
// ***********************************************
fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion);
fParameterisation = new GFlashHomoShowerParameterisation(fRegion->GetMaterialIterator()[0]);
fFastShowerModel->SetParameterisation(*fParameterisation);
// Energy Cuts to kill particles:
fParticleBounds = new GFlashParticleBounds();
fFastShowerModel->SetParticleBounds(*fParticleBounds);
// Makes the EnergieSpots
fHitMaker = new GFlashHitMaker();
// Important: use SD defined in different geometry
fHitMaker->SetNameOfWorldWithSD("parallelWorld");
fFastShowerModel->SetHitMaker(*fHitMaker);
}
//------------------------------------------------------------------------------------------------
#endif