Implementation of the TVirtualMCApplication.
More...
#include <MCApplication.h>
Implementation of the TVirtualMCApplication.
- Date
- 18/12/2015
- Author
- I. Hrivnacova; IPN, Orsay
Definition at line 44 of file MCApplication.h.
◆ MCApplication() [1/3]
VMC::TR::MCApplication::MCApplication |
( |
const char * | name, |
|
|
const char * | title ) |
Standard constructor
- Parameters
-
name | The MC application name |
title | The MC application description |
Definition at line 51 of file MCApplication.cxx.
65 {
66
67
68
69
70
72
73
75
76
78
79
81
82
84 }
Implementation of the TVirtualMCStack interface.
Ex03MCStack * fStack
VMC stack.
Bool_t fOldGeometry
Option for geometry definition.
Int_t fPrintModulo
The event modulus number to be printed.
Bool_t fIsControls
Option to activate special controls.
Bool_t fIsMaster
If is on master thread.
SensitiveDetector * fSensitiveDetector
Absorber SD.
PrimaryGenerator * fPrimaryGenerator
Primary generator.
TMCVerbose fVerbose
VMC verbose helper.
TGeoUniformMagField * fMagField
Magnetic field.
TMCRootManager * fRootManager
Root manager.
Int_t fEventNo
Event counter.
DetectorConstruction * fDetConstruction
Dector construction.
◆ MCApplication() [2/3]
VMC::TR::MCApplication::MCApplication |
( |
| ) |
|
◆ ~MCApplication()
VMC::TR::MCApplication::~MCApplication |
( |
| ) |
|
|
virtual |
Destructor
Definition at line 139 of file MCApplication.cxx.
140 {
141
142
143
144
151 delete gMC;
152
153
154 }
◆ MCApplication() [3/3]
VMC::TR::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 87 of file MCApplication.cxx.
100 {
101
102
103
104
106
107
109
110
112 new PrimaryGenerator(*(origin.fPrimaryGenerator),
fStack);
113
114
115 fMagField =
new TGeoUniformMagField(origin.fMagField->GetFieldValue()[0],
116 origin.fMagField->GetFieldValue()[1],
117 origin.fMagField->GetFieldValue()[2]);
118 }
◆ InitMC()
void VMC::TR::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 188 of file MCApplication.cxx.
189 {
190
191
192
193
195
196 if (TString(setup) != "") {
197 gROOT->LoadMacro(setup);
198 gInterpreter->ProcessLine("Config()");
199 if (!gMC) {
200 Fatal(
201 "InitMC", "Processing Config() has failed. (No MC is instantiated.)");
202 }
203 }
204
205
206#if ROOT_VERSION_CODE >= 336402
207
208 if (!gMC->IsMT()) {
209 fRootManager =
new TMCRootManager(GetName(), TMCRootManager::kWrite);
210
211 }
212#else
213
214 fRootManager =
new TMCRootManager(GetName(), TMCRootManager::kWrite);
215
216#endif
217
219
222 gMC->Init();
223 gMC->BuildPhysics();
224
226 }
void RegisterStack() const
◆ RunMC()
void VMC::TR::MCApplication::RunMC |
( |
Int_t | nofEvents | ) |
|
Run MC.
- Parameters
-
nofEvents | Number of events to be processed |
Definition at line 229 of file MCApplication.cxx.
230 {
231
232
233
235
236 gMC->ProcessRun(nofEvents);
238 }
◆ FinishRun()
void VMC::TR::MCApplication::FinishRun |
( |
| ) |
|
Finish MC run.
Definition at line 241 of file MCApplication.cxx.
242 {
243
244
246
247
248
249 cout << " ================== run summary =====================" << endl;
250 cout <<
" End of Run TotNbofEvents = " <<
fEventNo << endl;
251
252 cout <<
" Mean energy deposit in absorber = " <<
fHistograms[0]->GetMean()
253 <<
" +-" <<
fHistograms[0]->GetRMS() <<
" MeV " << endl;
254
255 cout <<
" Total number of XTR gammas = " <<
fHistograms[1]->GetEntries()
256 << endl;
257
258 cout <<
" Total number of all gammas = " <<
fHistograms[2]->GetEntries()
259 << endl;
260
264 }
265 }
std::vector< TH1D * > fHistograms
◆ CloneForWorker()
◆ InitOnWorker()
void VMC::TR::MCApplication::InitOnWorker |
( |
| ) |
|
|
virtual |
Definition at line 274 of file MCApplication.cxx.
275 {
276
277
278
279 fRootManager =
new TMCRootManager(GetName(), TMCRootManager::kWrite);
280
281
282
285
287 }
◆ FinishRunOnWorker()
void VMC::TR::MCApplication::FinishRunOnWorker |
( |
| ) |
|
|
virtual |
◆ ConstructGeometry()
void VMC::TR::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 300 of file MCApplication.cxx.
301 {
302
303
304
305
307
309 }
◆ InitGeometry()
void VMC::TR::MCApplication::InitGeometry |
( |
| ) |
|
|
virtual |
◆ GeneratePrimaries()
void VMC::TR::MCApplication::GeneratePrimaries |
( |
| ) |
|
|
virtual |
Fill the user stack (derived from TVirtualMCStack) with primary particles.
Definition at line 322 of file MCApplication.cxx.
323 {
324
325
326
328
330 }
virtual void GeneratePrimaries()
◆ BeginEvent()
void VMC::TR::MCApplication::BeginEvent |
( |
| ) |
|
|
virtual |
User actions at beginning of event
Definition at line 333 of file MCApplication.cxx.
334 {
335
336
338
339
340 if (TString(gMC->GetName()) == "TGeant3TGeo" &&
341 gGeoManager->GetListOfTracks() && gGeoManager->GetTrack(0) &&
342 ((TVirtualGeoTrack*)gGeoManager->GetTrack(0))->HasPoints()) {
343
344 gGeoManager->ClearTracks();
345
346 }
347
350 cout <<
"\n---> Begin of event: " <<
fEventNo << endl;
351 }
352 }
◆ BeginPrimary()
void VMC::TR::MCApplication::BeginPrimary |
( |
| ) |
|
|
virtual |
◆ PreTrack()
void VMC::TR::MCApplication::PreTrack |
( |
| ) |
|
|
virtual |
User actions at beginning of each track. Fill spectra.
Definition at line 363 of file MCApplication.cxx.
364 {
365
366
367
369
370
371 if (gMC->TrackPid() == kGamma) {
372
374
375
376
377#if ((ROOT_VERSION_CODE >= ROOT_VERSION(6, 7, 3)) || \
378 ((ROOT_VERSION_CODE <= ROOT_VERSION(6, 0, 0)) && \
379 (ROOT_VERSION_CODE >= ROOT_VERSION(5, 34, 35))))
380 if (creatorProcess == kPTransitionRadiation) {
381#else
382 if (creatorProcess == kPNull) {
383#endif
385 }
387 }
388
389
390 if (gMC->TrackPid() == kElectron &&
392
393 fHistograms[3]->Fill((gMC->Etot() - gMC->TrackMass()) * 1e+03);
394 }
395 }
virtual TParticle * GetCurrentTrack() const
virtual Int_t GetCurrentParentTrackNumber() const
◆ Stepping()
void VMC::TR::MCApplication::Stepping |
( |
| ) |
|
|
virtual |
User actions at each step
Definition at line 398 of file MCApplication.cxx.
399 {
400
401
402
403
404
405
406 static Int_t trackId = 0;
407 if (TString(gMC->GetName()) == "TFluka" &&
408 gMC->GetStack()->GetCurrentTrackNumber() != trackId) {
410 trackId = gMC->GetStack()->GetCurrentTrackNumber();
411 }
412
414
416 }
◆ PostTrack()
void VMC::TR::MCApplication::PostTrack |
( |
| ) |
|
|
virtual |
◆ FinishPrimary()
void VMC::TR::MCApplication::FinishPrimary |
( |
| ) |
|
|
virtual |
◆ FinishEvent()
void VMC::TR::MCApplication::FinishEvent |
( |
| ) |
|
|
virtual |
User actions after finishing of an event
Definition at line 435 of file MCApplication.cxx.
436 {
437
438
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
465
467
470 }
471
474 }
Double_t GetEdep() const
Return energy deposit.
virtual void Print(Option_t *option="") const
◆ SetPrintModulo()
void VMC::TR::MCApplication::SetPrintModulo |
( |
Int_t | value | ) |
|
|
inline |
Set the event modulus number to be printed
- Parameters
-
value | The new event modulus number value |
Definition at line 112 of file MCApplication.h.
◆ SetVerboseLevel()
void VMC::TR::MCApplication::SetVerboseLevel |
( |
Int_t | verboseLevel | ) |
|
|
inline |
Set verbosity
- Parameters
-
verboseLevel | The new verbose level value |
Definition at line 116 of file MCApplication.h.
◆ SetControls()
void VMC::TR::MCApplication::SetControls |
( |
Bool_t | isControls | ) |
|
|
inline |
Switch on/off special process controls
- Parameters
-
isControls | If true, special process controls setting is activated |
Definition at line 155 of file MCApplication.h.
◆ SetField()
void VMC::TR::MCApplication::SetField |
( |
Double_t | bz | ) |
|
|
inline |
◆ GetDetectorConstruction()
◆ GetSensitiveDetector()
◆ GetPrimaryGenerator()
◆ SetOldGeometry()
void VMC::TR::MCApplication::SetOldGeometry |
( |
Bool_t | oldGeometry = kTRUE | ) |
|
|
inline |
Switch on/off the old geometry definition (via VMC functions)
- Parameters
-
oldGeometry | If true, geometry definition via VMC functions |
Definition at line 148 of file MCApplication.h.
◆ RegisterStack()
void VMC::TR::MCApplication::RegisterStack |
( |
| ) |
const |
|
private |
Register stack in the Root manager.
Definition at line 161 of file MCApplication.cxx.
162 {
163
164
166
168 }
169 }
◆ BookHisto()
void VMC::TR::MCApplication::BookHisto |
( |
| ) |
const |
|
private |
Create histograms
Definition at line 172 of file MCApplication.cxx.
173 {
174
175
176 fHistograms.push_back(
new TH1D(
"1",
"Edep", 100, 0., 0.1));
177 fHistograms.push_back(
new TH1D(
"2",
"XTR Gamma spectrum", 100, 0., 0.1));
179 new TH1D("3", "Secondary Gamma spectrum", 100, 0., 0.1));
180 fHistograms.push_back(
new TH1D(
"4",
"Secondary e- spectrum", 100, 0., 0.1));
181 }
◆ fRootManager
TMCRootManager* VMC::TR::MCApplication::fRootManager |
|
mutableprivate |
◆ fPrintModulo
Int_t VMC::TR::MCApplication::fPrintModulo |
|
private |
The event modulus number to be printed.
Definition at line 93 of file MCApplication.h.
◆ fEventNo
Int_t VMC::TR::MCApplication::fEventNo |
|
private |
◆ fVerbose
TMCVerbose VMC::TR::MCApplication::fVerbose |
|
private |
◆ fStack
◆ fDetConstruction
◆ fSensitiveDetector
◆ fPrimaryGenerator
◆ fMagField
TGeoUniformMagField* VMC::TR::MCApplication::fMagField |
|
private |
◆ fOldGeometry
Bool_t VMC::TR::MCApplication::fOldGeometry |
|
private |
◆ fIsControls
Bool_t VMC::TR::MCApplication::fIsControls |
|
private |
◆ fIsMaster
Bool_t VMC::TR::MCApplication::fIsMaster |
|
private |
The documentation for this class was generated from the following files: