Implementation of the TVirtualMCApplication.
More...
#include <MCApplication.h>
Implementation of the TVirtualMCApplication.
Garfield garfieldpp example adapted to Virtual Monte Carlo.
- Date
- 28/10/2015
- Author
- I. Hrivnacova; IPN, Orsay
Definition at line 47 of file MCApplication.h.
◆ MCApplication() [1/3]
VMC::ExGarfield::MCApplication::MCApplication |
( |
const char * | name, |
|
|
const char * | title ) |
Standard constructor
- Parameters
-
name | The MC application name |
title | The MC application description |
Definition at line 48 of file MCApplication.cxx.
49 : TVirtualMCApplication(name, title),
58 {
59
60
61
62
63
64 fStack =
new Ex03MCStack(1000);
65
66
68
69
71
72
74 }
Int_t fEventNo
Event counter.
Bool_t fIsMaster
If is on master thread.
DetectorConstruction * fDetConstruction
Dector construction.
TMCRootManager * fRootManager
Root manager.
SensitiveDetector * fSensitiveDetector
Calorimeter SD.
TMCVerbose fVerbose
VMC verbose helper.
Ex03MCStack * fStack
VMC stack.
PrimaryGenerator * fPrimaryGenerator
Primary generator.
◆ MCApplication() [2/3]
VMC::ExGarfield::MCApplication::MCApplication |
( |
| ) |
|
Default constructor
Definition at line 103 of file MCApplication.cxx.
104 : TVirtualMCApplication(),
112 {
113
114 }
◆ ~MCApplication()
VMC::ExGarfield::MCApplication::~MCApplication |
( |
| ) |
|
|
virtual |
Destructor
Definition at line 117 of file MCApplication.cxx.
118 {
119
120
121
122
128 delete gMC;
129
130
131 }
◆ MCApplication() [3/3]
VMC::ExGarfield::MCApplication::MCApplication |
( |
const MCApplication & | origin | ) |
|
|
private |
Copy constructor for cloning application on workers (in multithreading mode)
- Parameters
-
origin | The source MC application |
Definition at line 77 of file MCApplication.cxx.
78 : TVirtualMCApplication(origin.GetName(), origin.GetTitle()),
87 {
88
89
90
91
92 fStack =
new Ex03MCStack(1000);
93
94
96
97
99 new PrimaryGenerator(*(origin.fPrimaryGenerator),
fStack);
100 }
◆ InitMC()
void VMC::ExGarfield::MCApplication::InitMC |
( |
const char * | setup | ) |
|
Initialize MC. The selection of the concrete MC is done in the macro.
- Parameters
-
setup | The name of the configuration macro |
Definition at line 153 of file MCApplication.cxx.
154 {
155
156
157
158
160
161 if (TString(setup) != "") {
162 gROOT->LoadMacro(setup);
163 gInterpreter->ProcessLine("Config()");
164 if (!gMC) {
165 Fatal(
166 "InitMC", "Processing Config() has failed. (No MC is instantiated.)");
167 }
168 }
169
170
171#if ROOT_VERSION_CODE >= 336402
172
173 if (!gMC->IsMT()) {
174 fRootManager =
new TMCRootManager(GetName(), TMCRootManager::kWrite);
175
176 }
177#else
178
179 fRootManager =
new TMCRootManager(GetName(), TMCRootManager::kWrite);
180
181#endif
182
184 gMC->Init();
185 gMC->BuildPhysics();
186
188 }
void RegisterStack() const
◆ RunMC()
void VMC::ExGarfield::MCApplication::RunMC |
( |
Int_t | nofEvents | ) |
|
Run MC.
- Parameters
-
nofEvents | Number of events to be processed |
Definition at line 191 of file MCApplication.cxx.
192 {
193
194
195
197
198 gMC->ProcessRun(nofEvents);
200 }
◆ FinishRun()
void VMC::ExGarfield::MCApplication::FinishRun |
( |
| ) |
|
◆ ReadEvent()
void VMC::ExGarfield::MCApplication::ReadEvent |
( |
Int_t | i | ) |
|
Read i -th event and prints hits.
- Parameters
-
i | The number of event to be read |
Definition at line 247 of file MCApplication.cxx.
◆ CloneForWorker()
◆ InitOnWorker()
void VMC::ExGarfield::MCApplication::InitOnWorker |
( |
| ) |
|
|
virtual |
Definition at line 222 of file MCApplication.cxx.
223 {
224
225
226
227 fRootManager =
new TMCRootManager(GetName(), TMCRootManager::kWrite);
228
229
230
232
234 }
◆ FinishRunOnWorker()
void VMC::ExGarfield::MCApplication::FinishRunOnWorker |
( |
| ) |
|
|
virtual |
◆ ConstructGeometry()
void VMC::ExGarfield::MCApplication::ConstructGeometry |
( |
| ) |
|
|
virtual |
Construct geometry using detector contruction class. The detector contruction class is using TGeo functions or TVirtualMC functions (if oldGeometry is selected)
Definition at line 258 of file MCApplication.cxx.
259 {
260
261
262
263
265
267 }
◆ InitGeometry()
void VMC::ExGarfield::MCApplication::InitGeometry |
( |
| ) |
|
|
virtual |
◆ GeneratePrimaries()
void VMC::ExGarfield::MCApplication::GeneratePrimaries |
( |
| ) |
|
|
virtual |
◆ BeginEvent()
void VMC::ExGarfield::MCApplication::BeginEvent |
( |
| ) |
|
|
virtual |
User actions at beginning of event
Definition at line 292 of file MCApplication.cxx.
293 {
294
295
297
298
299 if (TString(gMC->GetName()) == "TGeant3TGeo" &&
300 gGeoManager->GetListOfTracks() && gGeoManager->GetTrack(0) &&
301 ((TVirtualGeoTrack*)gGeoManager->GetTrack(0))->HasPoints()) {
302
303 gGeoManager->ClearTracks();
304
305 }
306
308 cout <<
" Start generating event Nr " <<
fEventNo << endl;
309 }
◆ BeginPrimary()
void VMC::ExGarfield::MCApplication::BeginPrimary |
( |
| ) |
|
|
virtual |
User actions at beginning of a primary track. If test for user defined decay is activated, the primary track ID is printed on the screen.
Definition at line 312 of file MCApplication.cxx.
313 {
314
315
316
317
319 }
◆ PreTrack()
void VMC::ExGarfield::MCApplication::PreTrack |
( |
| ) |
|
|
virtual |
User actions at beginning of each track If test for user defined decay is activated, the decay products of the primary track (K0Short) are printed on the screen.
Definition at line 322 of file MCApplication.cxx.
323 {
324
325
326
327
328
330 }
◆ Stepping()
void VMC::ExGarfield::MCApplication::Stepping |
( |
| ) |
|
|
virtual |
User actions at each step
Definition at line 333 of file MCApplication.cxx.
334 {
335
336
337
338
339
340
341 static Int_t trackId = 0;
342 if (TString(gMC->GetName()) == "TFluka" &&
343 gMC->GetStack()->GetCurrentTrackNumber() != trackId) {
345 trackId = gMC->GetStack()->GetCurrentTrackNumber();
346 }
347
349
351 }
◆ PostTrack()
void VMC::ExGarfield::MCApplication::PostTrack |
( |
| ) |
|
|
virtual |
◆ FinishPrimary()
void VMC::ExGarfield::MCApplication::FinishPrimary |
( |
| ) |
|
|
virtual |
◆ FinishEvent()
void VMC::ExGarfield::MCApplication::FinishEvent |
( |
| ) |
|
|
virtual |
User actions after finishing of an event
Definition at line 370 of file MCApplication.cxx.
371 {
372
373
375
376
379
380
383 }
◆ SetVerboseLevel()
void VMC::ExGarfield::MCApplication::SetVerboseLevel |
( |
Int_t | verboseLevel | ) |
|
|
inline |
Set verbosity
- Parameters
-
verboseLevel | The new verbose level value |
Definition at line 105 of file MCApplication.h.
◆ GetDetectorConstruction()
◆ GetCalorimeterSD()
◆ GetPrimaryGenerator()
PrimaryGenerator * VMC::ExGarfield::MCApplication::GetPrimaryGenerator |
( |
| ) |
const |
|
inline |
◆ RegisterStack()
void VMC::ExGarfield::MCApplication::RegisterStack |
( |
| ) |
const |
|
private |
Register stack in the Root manager.
Definition at line 138 of file MCApplication.cxx.
139 {
140
141
143
145 }
146 }
◆ fRootManager
TMCRootManager* VMC::ExGarfield::MCApplication::fRootManager |
|
mutableprivate |
◆ fEventNo
Int_t VMC::ExGarfield::MCApplication::fEventNo |
|
private |
◆ fVerbose
TMCVerbose VMC::ExGarfield::MCApplication::fVerbose |
|
private |
◆ fStack
◆ fDetConstruction
◆ fSensitiveDetector
◆ fPrimaryGenerator
◆ fIsMaster
Bool_t VMC::ExGarfield::MCApplication::fIsMaster |
|
private |
The documentation for this class was generated from the following files: