BmnRoot
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 "FairRootManager.h"
8#include "FairLogger.h"
9
10#include "TEveManager.h"
11#include "TEveTreeTools.h" // for TEvePointSelectorConsumer
12#include "TString.h" // for Form()
13
14#include <iostream>
15using namespace std;
16
17// ----- Default constructor -------------------------------------------
19: FairTask("MpdPointSetDraw", 0),
20 fVerbose(0),
21 fEventManager(NULL),
22 fPointList(NULL),
23 fq(NULL),
24 fColor(0),
25 fStyle(0)
26{}
27
28// ----- Standard constructor ------------------------------------------
29MpdPointSetDraw::MpdPointSetDraw(const char* name, Color_t color, Style_t mstyle, Int_t iVerbose)
30: FairTask(name, iVerbose),
31 fVerbose(iVerbose),
32 fEventManager(NULL),
33 fPointList(NULL),
34 fq(NULL),
35 fColor(color),
36 fStyle(mstyle)
37{}
38
39// ----- Destructor ----------------------------------------------------
42
43// -------------------------------------------------------------------------
45{
46 if (fVerbose > 0) cout<<"MpdPointSetDraw::Init()"<<endl;
47
48 FairRootManager* fManager = FairRootManager::Instance();
49
50 fPointList = (TClonesArray*) fManager->GetObject(GetName());
51 if (fPointList == 0)
52 {
53 LOG(error)<<"MpdPointSetDraw::Init() branch "<<GetName()<<" not found! Task will be deactivated";
54 SetActive(kFALSE);
55 }
56 if (fVerbose > 1) cout<<"MpdPointSetDraw::Init() get point list "<<fPointList<<endl;
57
59 if (fVerbose > 1) cout<<"MpdPointSetDraw::Init() get instance of MpdEventManager"<<endl;
60
61 fq = 0;
62
63 return kSUCCESS;
64}
65
66void MpdPointSetDraw::Exec(Option_t* /*option*/)
67{
68 if (fVerbose > 0) cout<<"MpdPointSetDraw::Exec()"<<endl;
69 if (!IsActive())
70 return;
71
72 Reset();
73
74 Int_t npoints = fPointList->GetEntriesFast();
75 if (fVerbose > 0) cout<<"MpdPointSetDraw::Exec() the number of points is "<<fPointList->GetEntries()<<endl;
76
77 TEvePointSet* q = new TEvePointSet(GetName(), npoints, TEvePointSelectorConsumer::kTVT_XYZ);
78 q->SetOwnIds(kTRUE);
79 q->SetMarkerColor(fColor);
80 q->SetMarkerSize(1.5);
81 q->SetMarkerStyle(fStyle);
82
83 for (Int_t i = 0; i < npoints; i++)
84 {
85 TObject* p = (TObject*) fPointList->At(i);
86 if (p != 0)
87 {
88 TVector3 vec(GetVector(p));
89 q->SetNextPoint(vec.X(), vec.Y(), vec.Z());
90 q->SetPointId(GetValue(p, i));
91 if (fVerbose > 2) cout<<"MpdPointSetDraw::Exec() add point to EVE set: "<<i<<endl;
92 }
93 else cout<<"CRITICAL ERROR: MpdPointSetDraw::Exec() point is not TObject"<<endl;
94 }
95
96 fq = q;
97
99
100 //gEve->Redraw3D(kFALSE);
101}
102
103TObject* MpdPointSetDraw::GetValue(TObject* /*obj*/, Int_t i)
104{
105 return new TNamed(Form("Point %d", i),"");
106}
107
108// -------------------------------------------------------------------------
111
115
116// -------------------------------------------------------------------------
118{
119 if (fq != 0)
120 {
121 fq->Reset();
123 }
124}
int i
Definition P4_F32vec4.h:22
static MpdEventManager * Instance()
virtual TVector3 GetVector(TObject *obj)=0
TClonesArray * fPointList
virtual void RemoveEveElementList()=0
virtual void Exec(Option_t *option)
virtual InitStatus Init()
virtual void Finish()
TEvePointSet * fq
virtual void AddEveElementList()=0
virtual TObject * GetValue(TObject *obj, Int_t i)
virtual ~MpdPointSetDraw()
virtual void SetParContainers()
MpdEventManager * fEventManager
STL namespace.