VMC
Version 2.2
Toggle main menu visibility
Loading...
Searching...
No Matches
source
src
TMCVerbose.cxx
Go to the documentation of this file.
1
// -----------------------------------------------------------------------
2
// Copyright (C) 2019 CERN and copyright holders of VMC Project.
3
// This software is distributed under the terms of the GNU General Public
4
// License v3 (GPL Version 3), copied verbatim in the file "LICENSE".
5
//
6
// See https://github.com/vmc-project/vmc for full licensing information.
7
// -----------------------------------------------------------------------
8
9
// Author: Ivana Hrivnacova, 27/03/2002
10
11
/*************************************************************************
12
* Copyright (C) 2006, Rene Brun and Fons Rademakers. *
13
* Copyright (C) 2002, ALICE Experiment at CERN. *
14
* All rights reserved. *
15
* *
16
* For the licensing terms see $ROOTSYS/LICENSE. *
17
* For the list of contributors see $ROOTSYS/README/CREDITS. *
18
*************************************************************************/
19
20
#include "Riostream.h"
21
#include "
TVirtualMC.h
"
22
#include "
TVirtualMCStack.h
"
23
#include "TDatabasePDG.h"
24
#include "TParticlePDG.h"
25
#include "TArrayI.h"
26
27
#include "
TMCVerbose.h
"
28
40
43
44
TMCVerbose::TMCVerbose
(Int_t level) : TObject(),
fLevel
(level),
fStepNumber
(0) {}
45
48
49
TMCVerbose::TMCVerbose
() : TObject(),
fLevel
(0),
fStepNumber
(0) {}
50
53
54
TMCVerbose::~TMCVerbose
() {}
55
56
//
57
// private methods
58
//
59
62
63
void
TMCVerbose::PrintBanner
()
const
64
{
65
std::cout << std::endl;
66
for
(Int_t i = 0; i < 10; i++)
67
std::cout <<
"**********"
;
68
std::cout << std::endl;
69
}
70
73
74
void
TMCVerbose::PrintTrackInfo
()
const
75
{
76
// Particle
77
//
78
std::cout <<
" Particle = "
;
79
TParticlePDG *particle = TDatabasePDG::Instance()->GetParticle(
gMC
->TrackPid());
80
if
(particle)
81
std::cout << particle->GetName() <<
" "
;
82
else
83
std::cout <<
"unknown"
84
<<
" "
;
85
86
// Track ID
87
//
88
std::cout <<
" Track ID = "
<<
gMC
->GetStack()->GetCurrentTrackNumber() <<
" "
;
89
90
// Parent ID
91
//
92
std::cout <<
" Parent ID = "
<<
gMC
->GetStack()->GetCurrentParentTrackNumber();
93
}
94
97
98
void
TMCVerbose::PrintStepHeader
()
const
99
{
100
std::cout <<
"Step# "
101
<<
"X(cm) "
102
<<
"Y(cm) "
103
<<
"Z(cm) "
104
<<
"KinE(MeV) "
105
<<
"dE(MeV) "
106
<<
"Step(cm) "
107
<<
"TrackL(cm) "
108
<<
"Volume "
109
<<
"Process "
<< std::endl;
110
}
111
112
//
113
// public methods
114
//
115
118
119
void
TMCVerbose::InitMC
()
120
{
121
if
(
fLevel
> 0)
122
std::cout <<
"--- Init MC "
<< std::endl;
123
}
124
127
128
void
TMCVerbose::RunMC
(Int_t nofEvents)
129
{
130
if
(
fLevel
> 0)
131
std::cout <<
"--- Run MC for "
<< nofEvents <<
" events"
<< std::endl;
132
}
133
136
137
void
TMCVerbose::FinishRun
()
138
{
139
if
(
fLevel
> 0)
140
std::cout <<
"--- Finish Run MC "
<< std::endl;
141
}
142
145
146
void
TMCVerbose::ConstructGeometry
()
147
{
148
if
(
fLevel
> 0)
149
std::cout <<
"--- Construct geometry "
<< std::endl;
150
}
151
154
155
void
TMCVerbose::ConstructOpGeometry
()
156
{
157
if
(
fLevel
> 0)
158
std::cout <<
"--- Construct geometry for optical processes"
<< std::endl;
159
}
160
163
164
void
TMCVerbose::InitGeometry
()
165
{
166
if
(
fLevel
> 0)
167
std::cout <<
"--- Init geometry "
<< std::endl;
168
}
169
172
173
void
TMCVerbose::AddParticles
()
174
{
175
if
(
fLevel
> 0)
176
std::cout <<
"--- Add particles "
<< std::endl;
177
}
178
181
182
void
TMCVerbose::AddIons
()
183
{
184
if
(
fLevel
> 0)
185
std::cout <<
"--- Add ions "
<< std::endl;
186
}
187
190
191
void
TMCVerbose::GeneratePrimaries
()
192
{
193
if
(
fLevel
> 0)
194
std::cout <<
"--- Generate primaries "
<< std::endl;
195
}
196
199
200
void
TMCVerbose::BeginEvent
()
201
{
202
if
(
fLevel
> 0)
203
std::cout <<
"--- Begin event "
<< std::endl;
204
}
205
208
209
void
TMCVerbose::BeginPrimary
()
210
{
211
if
(
fLevel
> 1)
212
std::cout <<
"--- Begin primary "
<< std::endl;
213
}
214
217
218
void
TMCVerbose::PreTrack
()
219
{
220
if
(
fLevel
> 2) {
221
PrintBanner
();
222
PrintTrackInfo
();
223
PrintBanner
();
224
PrintStepHeader
();
225
226
fStepNumber
= 0;
227
228
return
;
229
}
230
231
if
(
fLevel
> 1)
232
std::cout <<
"--- Pre track "
<< std::endl;
233
}
234
237
238
void
TMCVerbose::Stepping
()
239
{
240
if
(
fLevel
> 2) {
241
242
#if __GNUC__ >= 3
243
std::cout << std::fixed;
244
#endif
245
246
// Step number
247
//
248
// std::cout << "#" << std::setw(4) << gMC->StepNumber() << " ";
249
std::cout <<
"#"
<< std::setw(4) <<
fStepNumber
++ <<
" "
;
250
251
// Position
252
//
253
Double_t x, y, z;
254
gMC
->TrackPosition(x, y, z);
255
std::cout << std::setw(8) << std::setprecision(3) << x <<
" "
<< std::setw(8) << std::setprecision(3) << y <<
" "
256
<< std::setw(8) << std::setprecision(3) << z <<
" "
;
257
258
// Kinetic energy
259
//
260
Double_t px, py, pz, etot;
261
gMC
->TrackMomentum(px, py, pz, etot);
262
Double_t ekin = etot -
gMC
->TrackMass();
263
std::cout << std::setw(9) << std::setprecision(4) << ekin * 1e03 <<
" "
;
264
265
// Energy deposit
266
//
267
std::cout << std::setw(9) << std::setprecision(4) <<
gMC
->Edep() * 1e03 <<
" "
;
268
269
// Step length
270
//
271
std::cout << std::setw(8) << std::setprecision(3) <<
gMC
->TrackStep() <<
" "
;
272
273
// Track length
274
//
275
std::cout << std::setw(8) << std::setprecision(3) <<
gMC
->TrackLength() <<
" "
;
276
277
// Volume
278
//
279
if
(
gMC
->CurrentVolName() != 0)
280
std::cout << std::setw(4) <<
gMC
->CurrentVolName() <<
" "
;
281
else
282
std::cout << std::setw(4) <<
"None"
283
<<
" "
;
284
285
// Process
286
//
287
TArrayI processes;
288
Int_t nofProcesses =
gMC
->StepProcesses(processes);
289
if
(nofProcesses > 0)
290
std::cout <<
TMCProcessName
[processes[nofProcesses - 1]];
291
292
std::cout << std::endl;
293
}
294
}
295
298
299
void
TMCVerbose::PostTrack
()
300
{
301
if
(
fLevel
== 2)
302
std::cout <<
"--- Post track "
<< std::endl;
303
}
304
307
308
void
TMCVerbose::FinishPrimary
()
309
{
310
if
(
fLevel
== 1)
311
std::cout <<
"--- Finish primary "
<< std::endl;
312
}
313
316
317
void
TMCVerbose::EndOfEvent
()
318
{
319
if
(
fLevel
> 0)
320
std::cout <<
"--- End of event "
<< std::endl;
321
}
322
325
326
void
TMCVerbose::FinishEvent
()
327
{
328
if
(
fLevel
> 0)
329
std::cout <<
"--- Finish event "
<< std::endl;
330
}
TMCProcessName
static const char *const TMCProcessName[kMaxMCProcess]
Definition
TMCProcess.h:100
TMCVerbose.h
TVirtualMCStack.h
TVirtualMC.h
gMC
#define gMC
Definition
TVirtualMC.h:931
TMCVerbose::InitMC
virtual void InitMC()
Initialize MC info.
Definition
TMCVerbose.cxx:119
TMCVerbose::AddIons
virtual void AddIons()
Add ions info.
Definition
TMCVerbose.cxx:182
TMCVerbose::FinishEvent
virtual void FinishEvent()
Finish of an event info.
Definition
TMCVerbose.cxx:326
TMCVerbose::PrintTrackInfo
void PrintTrackInfo() const
Prints track information.
Definition
TMCVerbose.cxx:74
TMCVerbose::AddParticles
virtual void AddParticles()
Add particles info.
Definition
TMCVerbose.cxx:173
TMCVerbose::BeginPrimary
virtual void BeginPrimary()
Begin of a primary track info.
Definition
TMCVerbose.cxx:209
TMCVerbose::GeneratePrimaries
virtual void GeneratePrimaries()
Generate primaries info.
Definition
TMCVerbose.cxx:191
TMCVerbose::RunMC
virtual void RunMC(Int_t nofEvents)
MC run info.
Definition
TMCVerbose.cxx:128
TMCVerbose::ConstructGeometry
virtual void ConstructGeometry()
Construct geometry info.
Definition
TMCVerbose.cxx:146
TMCVerbose::fLevel
Int_t fLevel
Verbose level.
Definition
TMCVerbose.h:76
TMCVerbose::EndOfEvent
virtual void EndOfEvent()
End of event info.
Definition
TMCVerbose.cxx:317
TMCVerbose::FinishRun
virtual void FinishRun()
Finish MC run info.
Definition
TMCVerbose.cxx:137
TMCVerbose::PrintStepHeader
void PrintStepHeader() const
Prints the header for stepping information.
Definition
TMCVerbose.cxx:98
TMCVerbose::InitGeometry
virtual void InitGeometry()
Initialize geometry info.
Definition
TMCVerbose.cxx:164
TMCVerbose::fStepNumber
Int_t fStepNumber
Current step number.
Definition
TMCVerbose.h:77
TMCVerbose::FinishPrimary
virtual void FinishPrimary()
Finish of a primary track info.
Definition
TMCVerbose.cxx:308
TMCVerbose::TMCVerbose
TMCVerbose()
Default constructor.
Definition
TMCVerbose.cxx:49
TMCVerbose::BeginEvent
virtual void BeginEvent()
Begin event info.
Definition
TMCVerbose.cxx:200
TMCVerbose::~TMCVerbose
virtual ~TMCVerbose()
Destructor.
Definition
TMCVerbose.cxx:54
TMCVerbose::ConstructOpGeometry
virtual void ConstructOpGeometry()
Construct geometry for optical physics info.
Definition
TMCVerbose.cxx:155
TMCVerbose::PrintBanner
void PrintBanner() const
Prints banner for track information.
Definition
TMCVerbose.cxx:63
TMCVerbose::Stepping
virtual void Stepping()
Stepping info.
Definition
TMCVerbose.cxx:238
TMCVerbose::PreTrack
virtual void PreTrack()
Begin of each track info.
Definition
TMCVerbose.cxx:218
TMCVerbose::PostTrack
virtual void PostTrack()
Finish of each track info.
Definition
TMCVerbose.cxx:299
Generated on
for VMC by
1.17.0