BmnRoot 26.10.0-210-gc52d34b0
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
MpdBoxSetDraw.cxx
Go to the documentation of this file.
1// -------------------------------------------------------------------------
2// ----- MpdBoxSetDraw source file -----
3// ----- Created 03/01/08 by M. Al-Turany -----
4// -------------------------------------------------------------------------
5#include "MpdBoxSetDraw.h"
6
7#include "FairRunAna.h"
8#include "MpdBoxSet.h"
9#include "TEveManager.h" // for TEveManager, gEve
10
11#include <iostream>
12using namespace std;
13
14// ----- Default constructor -------------------------------------------
16 : FairTask("MpdBoxSetDraw", 0)
17 , fVerbose(0)
18 , fList(NULL)
19 , fEventManager(NULL)
20 , fManager(NULL)
21 , fq(NULL)
22 , fX(0.3)
23 , fY(0.3)
24 , fZ(0.3)
25 , fTimeWindowPlus(0.)
27 , fStartTime(0.)
31 , fStopFunctor()
32{}
33
34// ----- Standard constructor ------------------------------------------
35MpdBoxSetDraw::MpdBoxSetDraw(const char* name, Int_t iVerbose)
36 : FairTask(name, iVerbose)
37 , fVerbose(iVerbose)
38 , fList(NULL)
39 , fEventManager(NULL)
40 , fManager(NULL)
41 , fq(NULL)
42 , fX(0.3)
43 , fY(0.3)
44 , fZ(0.3)
45 , fTimeWindowPlus(0.)
47 , fStartTime(0.)
51 , fStopFunctor()
52{}
53
54// ----- Destructor ----------------------------------------------------
56
58{
59 if (fVerbose > 1)
60 cout << "MpdBoxSetDraw::Init()" << endl;
61
62 fManager = FairRootManager::Instance();
63
64 fList = (TClonesArray*)FairRootManager::Instance()->GetObject(GetName());
65 if (fList == 0) {
66 cout << "MpdBoxSetDraw::Init() branch " << GetName() << " not found! Task will be deactivated" << endl;
67 SetActive(kFALSE);
68 return kERROR;
69 }
70 if (fVerbose > 2)
71 cout << "MpdBoxSetDraw::Init() get track list " << fList << endl;
72
74 if (fVerbose > 2)
75 cout << "MpdBoxSetDraw::Init() get instance of MpdEventManager" << endl;
76
77 fq = 0;
78 fStartFunctor = new StopTime();
79 fStopFunctor = new StopTime();
80
81 return kSUCCESS;
82}
83// -------------------------------------------------------------------------
85{
86 if (!IsActive())
87 return;
88
89 Reset();
90
92 if (FairRunAna::Instance()->IsTimeStamp()) {
93 fList->Clear();
94 Double_t eventTime = fManager->GetEventTime();
95 if (fUseEventTime)
96 fStartTime = eventTime - fTimeWindowMinus;
97 cout << "EventTime: " << eventTime << " TimeWindow: " << fStartTime << " - " << eventTime + fTimeWindowPlus
98 << endl;
99
100 fList = fManager->GetData(GetName(), fStartFunctor, fStartTime, fStopFunctor,
101 eventTime + fTimeWindowPlus); // FairRootManager::Instance()->GetEventTime() +
102 }
103 if (fVerbose > 1)
104 cout << GetName() << " fList: " << fList->GetEntries() << endl;
105
106 for (Int_t i = 0; i < fList->GetEntriesFast(); i++) {
107 TObject* p = fList->At(i);
108 AddBoxes(fq, p, i);
109 }
110
111 gEve->AddElement(fq, fEventManager);
112 if (isRedraw)
113 gEve->Redraw3D();
114}
115
117{
118 TVector3 point = GetVector(obj);
119 set->AddBox(point.X(), point.Y(), point.Z());
120 set->DigitValue(GetValue(obj, i));
121 if (fVerbose > 2)
122 cout << "MpdBoxSetDraw::Init() Add point " << i << ": " << point.X() << " " << point.Y() << " " << point.Z()
123 << " " << endl;
124}
125
127{
128 return i;
129}
130
132{
133 MpdBoxSet* aBoxSet = new MpdBoxSet(this, GetName());
135 aBoxSet->SetDefWidth(fX);
136 aBoxSet->SetDefHeight(fY);
137 aBoxSet->SetDefDepth(fZ);
138
139 fq = aBoxSet;
140
141 return aBoxSet;
142}
143
145
146/** Action after each event**/
148
150{
151 if (fq != 0) {
152 fq->Reset();
153 gEve->RemoveElement(fq, fEventManager);
154 }
155}
int i
Definition P4_F32vec4.h:22
int Int_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
const char Option_t
R__EXTERN TEveManager * gEve
virtual TVector3 GetVector(TObject *obj)=0
BinaryFunctor * fStartFunctor
MpdBoxSet * fq
MpdBoxSetDraw()
Default constructor.
virtual void SetParContainers()
Double_t fTimeWindowMinus
BinaryFunctor * fStopFunctor
virtual void Finish()
Action after each event.
virtual void Exec(Option_t *option)
Executed task.
virtual void AddBoxes(MpdBoxSet *set, TObject *obj, Int_t i=0)
MpdBoxSet * CreateBoxSet()
virtual Int_t GetValue(TObject *obj, Int_t i)
Double_t fTimeWindowPlus
MpdEventManager * fEventManager
Bool_t fUseEventTime
TClonesArray * fList
virtual ~MpdBoxSetDraw()
Destructor.
Double_t fStartTime
FairRootManager * fManager
virtual InitStatus Init()
MpdBoxSet.
Definition MpdBoxSet.h:24
static MpdEventManager * Instance()
void SetDefHeight(Float_t v)
void AddBox(const Float_t *verts)
void SetDefDepth(Float_t v)
void SetDefWidth(Float_t v)
void Reset()
void DigitValue(Int_t value)
Double_t Z() const
Double_t Y() const
Double_t X() const