BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
FairMCModuleDraw.cxx
Go to the documentation of this file.
1
// -------------------------------------------------------------------------
2
// ----- FairMCModuleDraw source file -----
3
// ----- -----
4
// -------------------------------------------------------------------------
5
#include "
FairMCModuleDraw.h
"
6
7
#include "BmnZdcPoint.h"
8
#include "CbmMCTrack.h"
9
#include "FairLogger.h"
10
#include "FairRootManager.h"
11
#include "
TEvePointSet.h
"
12
#include "
TString.h
"
13
14
#include <iostream>
15
using namespace
std
;
16
17
// ----- Default constructor -------------------------------------------
18
FairMCModuleDraw::FairMCModuleDraw
()
19
:
FairTask
(
"FairMCModuleDraw"
, 0)
20
,
fVerbose
(0)
21
,
fEventManager
(nullptr)
22
,
fPointList
(nullptr)
23
,
fMCTracks
(nullptr)
24
,
fColor
(0)
25
,
fStyle
(0)
26
{}
27
28
// ----- Standard constructor ------------------------------------------
29
FairMCModuleDraw::FairMCModuleDraw
(
const
char
* name,
Color_t
color,
Style_t
mstyle,
Int_t
iVerbose)
30
:
FairTask
(name, iVerbose)
31
,
fVerbose
(iVerbose)
32
,
fEventManager
(nullptr)
33
,
fPointList
(nullptr)
34
,
fMCTracks
(nullptr)
35
,
fColor
(color)
36
,
fStyle
(mstyle)
37
{}
38
39
// -------------------------------------------------------------------------
40
InitStatus
FairMCModuleDraw::Init
()
41
{
42
if
(
fVerbose
> 1)
43
cout <<
"FairMCModuleDraw::Init()"
<< endl;
44
45
FairRootManager* fManager = FairRootManager::Instance();
46
47
fPointList
= (
TClonesArray
*)fManager->GetObject(GetName());
48
if
(
fPointList
== 0) {
49
LOG(error) <<
"FairMCModuleDraw::Init() branch "
<< GetName() <<
" not found! Task will be deactivated"
;
50
SetActive(
kFALSE
);
51
return
kERROR;
52
}
53
if
(
fVerbose
> 2)
54
cout <<
"FairMCModuleDraw::Init() get point list"
<<
fPointList
<< endl;
55
56
fMCTracks
= (
TClonesArray
*)fManager->GetObject(
"MCTrack"
);
57
58
fEventManager
=
MpdEventManager::Instance
();
59
if
(
fVerbose
> 2)
60
cout <<
"FairMCModuleDraw::Init() get instance of MpdEventManager "
<< endl;
61
62
// create array for ZDC modules' visibility
63
fEventManager
->isZDCModule =
new
bool
[104];
64
65
return
kSUCCESS;
66
}
67
68
void
FairMCModuleDraw::Exec
(
Option_t
* option)
69
{
70
if
(!IsActive())
71
return
Reset
();
72
73
bool
* pZDCModuleNumber =
fEventManager
->isZDCModule;
74
Int_t
npoints =
fPointList
->GetEntriesFast();
75
for
(
int
i
= 0;
i
< npoints;
i
++) {
76
BmnZdcPoint
* p = (
BmnZdcPoint
*)
fPointList
->At(
i
);
77
78
CbmMCTrack
* pMCTrack = (
CbmMCTrack
*)
fMCTracks
->At(p->GetTrackID());
79
if
(!pMCTrack) {
80
cout <<
"MCTrack is NULL for selected index"
<< endl;
81
continue
;
82
}
83
84
// filter only forward points
85
Double32_t
start_z = pMCTrack->
GetStartZ
();
86
// cout<<"StartZ: "<<start_z<<cout<<endl;
87
if
(start_z < 1000.0)
88
pZDCModuleNumber[p->
GetCopyMother
()] =
true
;
89
}
90
}
91
92
TVector3
FairMCModuleDraw::GetVector
(
TObject
* obj)
93
{
94
FairMCPoint
* p = (
FairMCPoint
*)obj;
95
return
TVector3
(p->GetX(), p->GetY(), p->GetZ());
96
}
97
98
TObject
*
FairMCModuleDraw::GetValue
(
TObject
* obj,
Int_t
i
)
99
{
100
return
new
TNamed
(
Form
(
"Point %d"
,
i
),
""
);
101
}
102
103
// ----- Destructor ----------------------------------------------------
104
FairMCModuleDraw::~FairMCModuleDraw
()
105
{
106
delete
[]
fEventManager
->isZDCModule;
107
}
108
109
// -------------------------------------------------------------------------
110
void
FairMCModuleDraw::SetParContainers
() {}
111
112
/** Action after each event**/
113
void
FairMCModuleDraw::Finish
() {}
114
115
// -------------------------------------------------------------------------
116
void
FairMCModuleDraw::Reset
()
117
{
118
bool
* pZDCModuleNumber =
fEventManager
->isZDCModule;
119
for
(
int
i
= 0;
i
< 104;
i
++)
120
pZDCModuleNumber[
i
] =
false
;
121
}
i
int i
Definition
P4_F32vec4.h:22
Style_t
short Style_t
Int_t
int Int_t
Double32_t
double Double32_t
Color_t
short Color_t
kFALSE
constexpr Bool_t kFALSE
Option_t
const char Option_t
TEvePointSet.h
TString.h
Form
char * Form(const char *fmt,...)
BmnZdcPoint
Definition
BmnZdcPoint.h:20
BmnZdcPoint::GetCopyMother
Short_t GetCopyMother() const
Definition
BmnZdcPoint.h:58
CbmMCTrack
CbmMCTrack.h.
Definition
CbmMCTrack.h:26
CbmMCTrack::GetStartZ
Double_t GetStartZ() const
Definition
CbmMCTrack.h:63
FairMCModuleDraw::GetValue
virtual TObject * GetValue(TObject *obj, Int_t i)
Definition
FairMCModuleDraw.cxx:98
FairMCModuleDraw::Init
virtual InitStatus Init()
Definition
FairMCModuleDraw.cxx:40
FairMCModuleDraw::~FairMCModuleDraw
virtual ~FairMCModuleDraw()
Destructor.
Definition
FairMCModuleDraw.cxx:104
FairMCModuleDraw::Reset
void Reset()
Definition
FairMCModuleDraw.cxx:116
FairMCModuleDraw::fEventManager
MpdEventManager * fEventManager
Definition
FairMCModuleDraw.h:45
FairMCModuleDraw::fStyle
Style_t fStyle
Definition
FairMCModuleDraw.h:50
FairMCModuleDraw::fMCTracks
TClonesArray * fMCTracks
Definition
FairMCModuleDraw.h:47
FairMCModuleDraw::Finish
virtual void Finish()
Action after each event.
Definition
FairMCModuleDraw.cxx:113
FairMCModuleDraw::FairMCModuleDraw
FairMCModuleDraw()
Default constructor.
Definition
FairMCModuleDraw.cxx:18
FairMCModuleDraw::Exec
virtual void Exec(Option_t *option)
Executed task.
Definition
FairMCModuleDraw.cxx:68
FairMCModuleDraw::GetVector
virtual TVector3 GetVector(TObject *obj)
Definition
FairMCModuleDraw.cxx:92
FairMCModuleDraw::fColor
Color_t fColor
Definition
FairMCModuleDraw.h:49
FairMCModuleDraw::fVerbose
Int_t fVerbose
Definition
FairMCModuleDraw.h:44
FairMCModuleDraw::SetParContainers
virtual void SetParContainers()
Definition
FairMCModuleDraw.cxx:110
FairMCModuleDraw::fPointList
TClonesArray * fPointList
Definition
FairMCModuleDraw.h:46
FairMCPoint
FairTask
MpdEventManager::Instance
static MpdEventManager * Instance()
Definition
MpdEventManager.cxx:30
TClonesArray
TNamed
TObject
TVector3
FairMCModuleDraw.h
std
Definition
json.hpp:4446
eventdisplay
bmn
FairMCModuleDraw.cxx
Generated on
for BmnRoot by
1.17.0