1 /**************************************************************************
2 * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15 /////////////////////////////////////////////////////////////////////////
16 // ALICE DISPLAY CLUSTERS CLASS //
17 // Author: Mayeul ROUSSELET //
18 // e-mail: Mayeul.Rousselet@cern.ch //
19 // Last update:26/08/2003 //
20 /////////////////////////////////////////////////////////////////////////
22 #include <Riostream.h>
24 #include <TPolyMarker3D.h>
26 #include "AliClusters.h"
27 #include "AliDisplay2.h"
28 #include "AliDisplayClusters.h"
29 #include "AliITSLoader.h"
30 #include "AliITSclusterV2.h"
31 #include "AliITSgeom.h"
32 #include "AliModuleInfo.h"
34 #include "AliRunLoader.h"
35 #include "AliTPCLoader.h"
36 #include "AliTPCParam.h"
37 #include "AliTPCclusterMI.h"
39 ClassImp(AliDisplayClusters)
41 //_____________________________________________________________
42 AliDisplayClusters::AliDisplayClusters()
45 fPoints = new TPolyMarker3D[gAliDisplay2->GetNbModules()];
46 fName = new char*[gAliDisplay2->GetNbModules()];
48 for(Int_t i=0;i<gAliDisplay2->GetNbModules();i++){
49 fPoints[i].SetMarkerSize(0.2);
50 fPoints[i].SetMarkerColor(2);
51 fPoints[i].SetMarkerStyle(1);
55 //_____________________________________________________________
56 AliDisplayClusters::~AliDisplayClusters()
62 //_____________________________________________________________
63 Int_t AliDisplayClusters::GetNbClusters()
65 // Returns the number of clusters
67 for(Int_t i=0;i<fNb;i++){
68 if(gAliDisplay2->GetModuleInfo()->IsEnabled(fName[i])) r+=fPoints[i].GetN();
73 //_____________________________________________________________
74 void AliDisplayClusters::LoadClusters(const char *name,Int_t nevent)
76 // Loads ITS and TPC clusters
77 if(strstr(name,"ITS")) LoadITSClusters(nevent);
78 if(strstr(name,"TPC")) LoadTPCClusters(nevent);
81 //_____________________________________________________________
82 void AliDisplayClusters::LoadITSClusters(Int_t nevent)
85 fName[fNb]=new char[strlen("ITS")];
86 strcpy(fName[fNb],"ITS");
87 AliRunLoader *rl = AliRunLoader::Open("galice.root");
89 cerr<<"Can't open galice.root";
92 AliITSLoader *itsl = (AliITSLoader*)rl->GetLoader("ITSLoader");
95 itsl->LoadRecPoints();
96 TTree *cTree=itsl->TreeR();
99 cerr<<"Error occured during ITS clusters load";
103 TDirectory * olddir = gDirectory;
105 AliITSgeom *geom = (AliITSgeom*)gDirectory->Get("AliITSgeom");
109 TClonesArray *clusters=new TClonesArray("AliITSclusterV2",10000);
110 TBranch *branch=cTree->GetBranch("Clusters");
111 branch->SetAddress(&clusters);
112 Int_t nentr=(Int_t)cTree->GetEntries();
113 for (Int_t i=0; i<nentr; i++) {
114 if (!cTree->GetEvent(i)) continue;
117 geom->GetRotMatrix(i,rot);
119 geom->GetModuleId(i,lay,lad,det);
121 geom->GetTrans(lay,lad,det,tx,ty,tz);
123 Double_t r=-tx*rot[1]+ty*rot[0];
125 Double_t phi=TMath::ATan2(rot[1],rot[0]);
126 if (lay==1) phi-=3.1415927;
127 Double_t cp=TMath::Cos(phi), sp=TMath::Sin(phi);
129 Int_t ncl=clusters->GetEntriesFast();
131 AliITSclusterV2 *c=(AliITSclusterV2*)clusters->UncheckedAt(ncl);
133 g[0]= r*cp + c->GetY()*sp; //
134 g[1]=-r*sp + c->GetY()*cp; //
136 fPoints[fNb].SetPoint(count,g[0],g[1],g[2]);
143 //_____________________________________________________________
144 void AliDisplayClusters::LoadTPCClusters(Int_t nevent)
146 // Loads TPC clusters
147 fName[fNb]=new char[strlen("TPC")];
148 strcpy(fName[fNb],"TPC");
149 TFile *file = TFile::Open("galice.root");
150 AliTPCParam *dig=(AliTPCParam *)file->Get("75x40_100x60_150x60");
151 if (!dig) {cerr<<"TPC parameters have not been found !\n";}
154 AliRunLoader *rl = AliRunLoader::Open("galice.root");
156 cerr<<"Can't open galice.root";
159 AliTPCLoader *itsl = (AliTPCLoader*)rl->GetLoader("TPCLoader");
161 cerr<<"Can't find Loader";
165 rl->GetEvent(nevent);
166 itsl->LoadRecPoints();
167 TTree *cTree=itsl->TreeR();
170 cerr<<"Error during TPC clusters load";
175 Float_t noiseth = 10;
177 AliClusters *clusters=new AliClusters();
178 clusters->SetClass("AliTPCclusterMI");
180 cTree->SetBranchAddress("Segment",&clusters);
182 Int_t nrows=Int_t(cTree->GetEntries());
183 for (Int_t n=0; n<nrows; n++) {
186 dig->AdjustSectorRow(clusters->GetID(),sec,row);
187 TClonesArray &clrow=*clusters->GetArray();
188 Int_t ncl=clrow.GetEntriesFast();
190 AliTPCclusterMI *cl=(AliTPCclusterMI*)clrow[ncl];
191 Double_t x=dig->GetPadRowRadii(sec,row), y=cl->GetY(), z=cl->GetZ();
192 if (cl->GetQ()<noiseth) continue;
194 dig->AdjustCosSin(sec,cs,sn);
195 tmp = x*cs-y*sn; y= x*sn+y*cs; x=tmp;
196 fPoints[fNb].SetPoint(count,x,y,z);
208 //_____________________________________________________________
209 void AliDisplayClusters::Draw()
212 for(Int_t i=0;i<fNb;i++){
213 if(gAliDisplay2->GetModuleInfo()->IsEnabled(fName[i])) fPoints[i].Draw();