1 #if !defined(__CINT__) || defined(__MAKECINT__)
3 #include "AliTPCtracker.h"
5 #include "TPolyMarker3D.h"
6 #include "AliSimDigits.h"
7 #include "AliTPCParam.h"
8 #include "AliRunLoader.h"
9 #include "AliTPCclusterMI.h"
13 Author: marian.ivanov@cern.ch
16 .L AliTPCDisplayClustersMI.C+
17 AliTPCDisplayClusters disp;
18 disp.Init(0,0); //specify event number, and threshold for the noise
19 disp.DisplayClusters();
26 class AliTPCDisplayClusters{
28 AliTPCDisplayClusters();
29 void SetIO(Int_t event);
30 void LoadClusters(Int_t noiseth);
31 void DisplayClusters(Int_t first=0, Int_t last=-1);
32 void Init(Int_t event, Int_t noiseth){SetIO(event); LoadClusters(noiseth);}
40 //----------------------------------------------------------------------
41 AliTPCDisplayClusters::AliTPCDisplayClusters()
48 //----------------------------------------------------------------------
49 void AliTPCDisplayClusters::SetIO(Int_t event)
51 AliRunLoader* rl = AliRunLoader::Open();
53 AliLoader* tpcl = (AliTPCLoader*)rl->GetLoader("TPCLoader");
56 cerr<<"Can not get TPC Loader"<<endl;
60 fParam=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60");
61 fGeom=(TGeometry*)gDirectory->Get("AliceGeom");
63 fParam = new AliTPCParamSR();
67 if (!fParam) {cerr<<"TPC parameters have not been found !\n"; return ;}
68 tpcl->LoadRecPoints();
69 fTree = tpcl->TreeR();
72 //----------------------------------------------------------------------
73 void AliTPCDisplayClusters::LoadClusters(Int_t noiseth)
76 // load all clusters to memory
81 fArray = new TObjArray(fParam->GetNSegmentsTotal());
83 AliTPCClustersRow * pclrow = new AliTPCClustersRow;
84 pclrow->SetClass("AliTPCclusterMI");
86 TBranch *br = fTree->GetBranch("Segment");
87 br->SetAddress(&pclrow);
90 Int_t nrows=Int_t(fTree->GetEntries());
91 for (Int_t n=0; n<nrows; n++) {
93 pclrow = new AliTPCClustersRow;
94 pclrow->SetClass("AliTPCclusterMI");
96 br->SetAddress(&pclrow);
99 AliTPCClustersRow &clrow = *pclrow;
100 Int_t ncl=clrow.GetArray()->GetEntriesFast();
101 TObjArray * arrrow = new TObjArray(0);
102 fArray->AddAt(arrrow,pclrow->GetID());
104 // printf("segment\t%d\trow\t%d\tclusters\t%d",n,pclrow->GetID(),ncl);
106 AliTPCclusterMI *cl=(AliTPCclusterMI*)clrow[ncl];
107 if (cl->GetQ()>noiseth){
111 // printf("over\t%d\n",arrrow->GetEntries());
117 void AliTPCDisplayClusters::DisplayClusters(Int_t first, Int_t last)
119 Int_t nrows = fParam->GetNSegmentsTotal();
121 Int_t markerColorSignal = 5;
122 Int_t markerColorBgr = 2;
123 Int_t MASK = 10000000;
125 TCanvas *c1=new TCanvas("cdisplay", "Cluster display",0,0,700,730);
126 TView *v=new TView(1);
127 v->SetRange(-330,-360,-330,360,360,1710);
133 for (Int_t irow=0; irow<nrows; irow++) {
135 TObjArray * arr = (TObjArray*)fArray->At(irow);
139 fParam->AdjustSectorRow(irow,sec,row);
140 Int_t ncl=arr->GetEntriesFast();
142 TPolyMarker3D *pm=new TPolyMarker3D(ncl);
143 TPolyMarker3D *pmSignal=new TPolyMarker3D(ncl); // polymarker for signal
148 AliTPCclusterMI *cl=(AliTPCclusterMI*)arr->At(ncl);
151 Double_t x=fParam->GetPadRowRadii(sec,row), y=cl->GetY(), z=cl->GetZ();
153 fParam->AdjustCosSin(sec,cs,sn);
154 tmp = x*cs-y*sn; y= x*sn+y*cs; x=tmp;
155 Int_t trackId = cl->GetLabel(0);
156 if ( (last>0) &&trackId>last) continue;
157 if (trackId<first) continue;
158 if (trackId < MASK-1) {
159 pmSignal->SetPoint(imarSignal,x,y,z);
162 pm->SetPoint(imarBgr,x,y,z);
168 // change color for signal
169 pm->SetMarkerSize(1);
170 pm->SetMarkerColor(markerColorBgr);
171 pm->SetMarkerStyle(1);
174 pmSignal->SetMarkerSize(1);
175 pmSignal->SetMarkerColor(markerColorSignal);
176 pmSignal->SetMarkerStyle(1);
181 TNode * main = (TNode*)((fGeom->GetListOfNodes())->First());
182 TIter next(main->GetListOfNodes());
184 while((module = (TNode*)next())) {
186 sprintf(ch,"%s\n",module->GetTitle());
187 //printf("%s\n",module->GetTitle());
188 if (ch[0]=='T'&&ch[1]=='P' && ch[2]=='C') //if TPC draw
189 module->SetVisibility(3);
191 module->SetVisibility(-1);
196 c1->Modified(); c1->Update();