AliTPCcalibPulser added (repalcing AliTPCCalibSignal)
[u/mrichter/AliRoot.git] / TPC / AliTPCDisplayClusters.C
CommitLineData
c2b0eaa4 1/****************************************************************************
2 * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch *
3 ****************************************************************************/
4
5#ifndef __CINT__
bcc04e2a 6#include <Riostream.h>
c2b0eaa4 7#include <TFile.h>
8#include <TTree.h>
9#include <TCanvas.h>
10#include <TView.h>
11#include <TPolyMarker3D.h>
12#include <TNode.h>
13#include <TGeometry.h>
14
15#include "AliTPCParam.h"
bcc04e2a 16#include "AliClusters.h"
c2b0eaa4 17#include "AliTPCcluster.h"
18#endif
19
79cec2af 20Int_t AliTPCDisplayClusters(Int_t eventn=0, Int_t noiseth=15) {
73042f01 21 cerr<<"Displaying clusters...\n";
22
afc42102 23 TFile *file=TFile::Open("galice.root");
73042f01 24 if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 1;}
25
26 TFile *cf=TFile::Open("AliTPCclusters.root");
27 if (!cf->IsOpen()){cerr<<"Can't open AliTPCclusters.root !\n"; return 3;}
28
c2b0eaa4 29 AliTPCParam *dig=(AliTPCParam *)cf->Get("75x40_100x60_150x60");
73042f01 30 if (!dig) {cerr<<"TPC parameters have not been found !\n"; return 2;}
31
32 TCanvas *c1=new TCanvas("cdisplay", "Cluster display",0,0,700,730);
33 TView *v=new TView(1);
34 v->SetRange(-430,-560,-430,430,560,1710);
35 c1->Clear();
36 c1->SetFillColor(1);
37 c1->SetTheta(90.);
38 c1->SetPhi(0.);
39
afc42102 40 char cname[100];
41 sprintf(cname,"TreeC_TPC_%d",eventn);
bcc04e2a 42 TTree *cTree=(TTree *)cf->Get(cname);
43 if (!cTree) {
44 cerr<<"Can't find tree : "<<cname<<endl;
45 return 1;
46 }
47
48 AliClusters *clusters=new AliClusters();
49 clusters->SetClass("AliTPCcluster");
50
51 cTree->SetBranchAddress("Segment",&clusters);
afc42102 52
bcc04e2a 53 Int_t nrows=Int_t(cTree->GetEntries());
73042f01 54 for (Int_t n=0; n<nrows; n++) {
bcc04e2a 55 cTree->GetEvent(n);
73042f01 56 Int_t sec,row;
bcc04e2a 57 dig->AdjustSectorRow(clusters->GetID(),sec,row);
58 TClonesArray &clrow=*clusters->GetArray();
59 Int_t ncl=clrow.GetEntriesFast();
73042f01 60 TPolyMarker3D *pm=new TPolyMarker3D(ncl);
61 while (ncl--) {
62 AliTPCcluster *cl=(AliTPCcluster*)clrow[ncl];
63 Double_t x=dig->GetPadRowRadii(sec,row), y=cl->GetY(), z=cl->GetZ();
79cec2af 64 if (cl->GetQ()<noiseth) continue;
73042f01 65 Float_t cs, sn, tmp;
66 dig->AdjustCosSin(sec,cs,sn);
67 tmp = x*cs-y*sn; y= x*sn+y*cs; x=tmp;
68 pm->SetPoint(ncl,x,y,z);
69 }
bcc04e2a 70 clrow.Clear();
73042f01 71 pm->SetMarkerSize(1); pm->SetMarkerColor(2); pm->SetMarkerStyle(1);
72 pm->Draw();
73 }
bcc04e2a 74 delete cTree;
75 delete dig;
73042f01 76 cf->Close();
77
78 TGeometry *geom=(TGeometry*)file->Get("AliceGeom");
c2b0eaa4 79 TNode * main = (TNode*)((geom->GetListOfNodes())->First());
79cec2af 80 TIter next(main->GetListOfNodes());
81 TNode *module=0;
82 while((module = (TNode*)next())) {
83 char ch[100];
84 sprintf(ch,"%s\n",module->GetTitle());
85 //printf("%s\n",module->GetTitle());
86 if (ch[0]=='T'&&ch[1]=='P' && ch[2]=='C') //if TPC draw
87 module->SetVisibility(3);
88 else
89 module->SetVisibility(-1);
90 }
91
92
73042f01 93 geom->Draw("same");
94 c1->Modified(); c1->Update();
95
96 file->Close();
97 return 0;
98}
79cec2af 99