BmnRoot
26.10.0-210-gc52d34b0
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
MpdPointSetDraw.cxx
Go to the documentation of this file.
1
// -------------------------------------------------------------------------
2
// ----- MpdPointSetDraw source file -----
3
// ----- Created 03/01/08 by M. Al-Turany -----
4
// -------------------------------------------------------------------------
5
#include "
MpdPointSetDraw.h
"
6
7
#include "FairLogger.h"
8
#include "FairRootManager.h"
9
#include "
TEveManager.h
"
10
#include "
TEveTreeTools.h
"
// for TEvePointSelectorConsumer
11
#include "
TString.h
"
// for Form()
12
13
#include <iostream>
14
using namespace
std;
15
16
// ----- Default constructor -------------------------------------------
17
MpdPointSetDraw::MpdPointSetDraw
()
18
:
FairTask
(
"MpdPointSetDraw"
, 0)
19
,
fVerbose
(0)
20
,
fEventManager
(NULL)
21
,
fPointList
(NULL)
22
,
fq
(NULL)
23
,
fColor
(0)
24
,
fStyle
(0)
25
{}
26
27
// ----- Standard constructor ------------------------------------------
28
MpdPointSetDraw::MpdPointSetDraw
(
const
char
* name,
Color_t
color,
Style_t
mstyle,
Int_t
iVerbose)
29
:
FairTask
(name, iVerbose)
30
,
fVerbose
(iVerbose)
31
,
fEventManager
(NULL)
32
,
fPointList
(NULL)
33
,
fq
(NULL)
34
,
fColor
(color)
35
,
fStyle
(mstyle)
36
{}
37
38
// ----- Destructor ----------------------------------------------------
39
MpdPointSetDraw::~MpdPointSetDraw
() {}
40
41
// -------------------------------------------------------------------------
42
InitStatus
MpdPointSetDraw::Init
()
43
{
44
if
(
fVerbose
> 0)
45
cout <<
"MpdPointSetDraw::Init()"
<< endl;
46
47
FairRootManager* fManager = FairRootManager::Instance();
48
49
fPointList
= (
TClonesArray
*)fManager->GetObject(GetName());
50
if
(
fPointList
== 0) {
51
LOG(error) <<
"MpdPointSetDraw::Init() branch "
<< GetName() <<
" not found! Task will be deactivated"
;
52
SetActive(
kFALSE
);
53
}
54
if
(
fVerbose
> 1)
55
cout <<
"MpdPointSetDraw::Init() get point list "
<<
fPointList
<< endl;
56
57
fEventManager
=
MpdEventManager::Instance
();
58
if
(
fVerbose
> 1)
59
cout <<
"MpdPointSetDraw::Init() get instance of MpdEventManager"
<< endl;
60
61
fq
= 0;
62
63
return
kSUCCESS;
64
}
65
66
void
MpdPointSetDraw::Exec
(
Option_t
*
/*option*/
)
67
{
68
if
(
fVerbose
> 0)
69
cout <<
"MpdPointSetDraw::Exec()"
<< endl;
70
if
(!IsActive())
71
return
;
72
73
Reset
();
74
75
Int_t
npoints =
fPointList
->GetEntriesFast();
76
if
(
fVerbose
> 0)
77
cout <<
"MpdPointSetDraw::Exec() the number of points is "
<<
fPointList
->GetEntries() << endl;
78
79
TEvePointSet
* q =
new
TEvePointSet
(GetName(), npoints,
TEvePointSelectorConsumer::kTVT_XYZ
);
80
q->
SetOwnIds
(
kTRUE
);
81
q->
SetMarkerColor
(
fColor
);
82
q->
SetMarkerSize
(1.5);
83
q->
SetMarkerStyle
(
fStyle
);
84
85
for
(
Int_t
i
= 0;
i
< npoints;
i
++) {
86
TObject
* p = (
TObject
*)
fPointList
->At(
i
);
87
if
(p != 0) {
88
TVector3
vec
(
GetVector
(p));
89
q->
SetNextPoint
(
vec
.X(),
vec
.Y(),
vec
.Z());
90
q->
SetPointId
(
GetValue
(p,
i
));
91
if
(
fVerbose
> 2)
92
cout <<
"MpdPointSetDraw::Exec() add point to EVE set: "
<<
i
<< endl;
93
}
else
94
cout <<
"CRITICAL ERROR: MpdPointSetDraw::Exec() point is not TObject"
<< endl;
95
}
96
97
fq
= q;
98
99
AddEveElementList
();
100
101
// gEve->Redraw3D(kFALSE);
102
}
103
104
TObject
*
MpdPointSetDraw::GetValue
(
TObject
*
/*obj*/
,
Int_t
i
)
105
{
106
return
new
TNamed
(
Form
(
"Point %d"
,
i
),
""
);
107
}
108
109
// -------------------------------------------------------------------------
110
void
MpdPointSetDraw::SetParContainers
() {}
111
112
/** Action after each event**/
113
void
MpdPointSetDraw::Finish
() {}
114
115
// -------------------------------------------------------------------------
116
void
MpdPointSetDraw::Reset
()
117
{
118
if
(
fq
!= 0) {
119
fq
->Reset();
120
RemoveEveElementList
();
121
}
122
}
MpdPointSetDraw.h
i
int i
Definition
P4_F32vec4.h:22
Style_t
short Style_t
Int_t
int Int_t
Color_t
short Color_t
kFALSE
constexpr Bool_t kFALSE
kTRUE
constexpr Bool_t kTRUE
Option_t
const char Option_t
TEveManager.h
TEveTreeTools.h
TString.h
Form
char * Form(const char *fmt,...)
FairTask
MpdEventManager::Instance
static MpdEventManager * Instance()
Definition
MpdEventManager.cxx:30
MpdPointSetDraw::GetVector
virtual TVector3 GetVector(TObject *obj)=0
MpdPointSetDraw::RemoveEveElementList
virtual void RemoveEveElementList()=0
MpdPointSetDraw::fColor
Color_t fColor
Definition
MpdPointSetDraw.h:62
MpdPointSetDraw::Exec
virtual void Exec(Option_t *option)
Executed task.
Definition
MpdPointSetDraw.cxx:66
MpdPointSetDraw::Init
virtual InitStatus Init()
Definition
MpdPointSetDraw.cxx:42
MpdPointSetDraw::Finish
virtual void Finish()
Action after each event.
Definition
MpdPointSetDraw.cxx:113
MpdPointSetDraw::fStyle
Style_t fStyle
Definition
MpdPointSetDraw.h:63
MpdPointSetDraw::Reset
void Reset()
Definition
MpdPointSetDraw.cxx:116
MpdPointSetDraw::fVerbose
Int_t fVerbose
Definition
MpdPointSetDraw.h:57
MpdPointSetDraw::AddEveElementList
virtual void AddEveElementList()=0
MpdPointSetDraw::MpdPointSetDraw
MpdPointSetDraw()
Default constructor.
Definition
MpdPointSetDraw.cxx:17
MpdPointSetDraw::fEventManager
MpdEventManager * fEventManager
Definition
MpdPointSetDraw.h:58
MpdPointSetDraw::GetValue
virtual TObject * GetValue(TObject *obj, Int_t i)
Definition
MpdPointSetDraw.cxx:104
MpdPointSetDraw::~MpdPointSetDraw
virtual ~MpdPointSetDraw()
Destructor.
Definition
MpdPointSetDraw.cxx:39
MpdPointSetDraw::SetParContainers
virtual void SetParContainers()
Definition
MpdPointSetDraw.cxx:110
MpdPointSetDraw::fq
TEvePointSet * fq
Definition
MpdPointSetDraw.h:60
MpdPointSetDraw::fPointList
TClonesArray * fPointList
Definition
MpdPointSetDraw.h:59
TClonesArray
TEvePointSelectorConsumer::kTVT_XYZ
kTVT_XYZ
TEvePointSet
TEvePointSet::SetMarkerColor
void SetMarkerColor(Color_t col) override
TEvePointSet::SetMarkerStyle
void SetMarkerStyle(Style_t mstyle=1) override
TEvePointSet::SetMarkerSize
void SetMarkerSize(Size_t msize=1) override
TNamed
TObject
TPointSet3D::SetPointId
void SetPointId(Int_t n, TObject *id)
TPointSet3D::SetOwnIds
void SetOwnIds(Bool_t o)
TPolyMarker3D::SetNextPoint
virtual Int_t SetNextPoint(Double_t x, Double_t y, Double_t z)
TVector3
vec
eventdisplay
MpdPointSetDraw.cxx
Generated on
for BmnRoot by
1.17.0