BmnRoot 26.10.0-210-gc52d34b0
Software framework of the BM@N experiment
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>
14using namespace std;
15
16// ----- Default constructor -------------------------------------------
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 ------------------------------------------
28MpdPointSetDraw::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 ----------------------------------------------------
40
41// -------------------------------------------------------------------------
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
58 if (fVerbose > 1)
59 cout << "MpdPointSetDraw::Init() get instance of MpdEventManager" << endl;
60
61 fq = 0;
62
63 return kSUCCESS;
64}
65
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
80 q->SetOwnIds(kTRUE);
82 q->SetMarkerSize(1.5);
84
85 for (Int_t i = 0; i < npoints; i++) {
86 TObject* p = (TObject*)fPointList->At(i);
87 if (p != 0) {
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
100
101 // gEve->Redraw3D(kFALSE);
102}
103
105{
106 return new TNamed(Form("Point %d", i), "");
107}
108
109// -------------------------------------------------------------------------
111
112/** Action after each event**/
114
115// -------------------------------------------------------------------------
117{
118 if (fq != 0) {
119 fq->Reset();
121 }
122}
int i
Definition P4_F32vec4.h:22
short Style_t
int Int_t
short Color_t
constexpr Bool_t kFALSE
constexpr Bool_t kTRUE
const char Option_t
char * Form(const char *fmt,...)
static MpdEventManager * Instance()
virtual TVector3 GetVector(TObject *obj)=0
virtual void RemoveEveElementList()=0
virtual void Exec(Option_t *option)
Executed task.
virtual InitStatus Init()
virtual void Finish()
Action after each event.
virtual void AddEveElementList()=0
MpdPointSetDraw()
Default constructor.
MpdEventManager * fEventManager
virtual TObject * GetValue(TObject *obj, Int_t i)
virtual ~MpdPointSetDraw()
Destructor.
virtual void SetParContainers()
TEvePointSet * fq
TClonesArray * fPointList
void SetMarkerColor(Color_t col) override
void SetMarkerStyle(Style_t mstyle=1) override
void SetMarkerSize(Size_t msize=1) override
void SetPointId(Int_t n, TObject *id)
void SetOwnIds(Bool_t o)
virtual Int_t SetNextPoint(Double_t x, Double_t y, Double_t z)