]>
Commit | Line | Data |
---|---|---|
1e40ae31 | 1 | #if !defined(__CINT__) || defined(__MAKECINT__) |
2 | #include <TCanvas.h> | |
3 | #include <TClassTable.h> | |
4 | #include <TGraph.h> | |
5 | #include <TGraph2D.h> | |
6 | #include <TGeoManager.h> | |
7 | #include <TStyle.h> | |
8 | #include <TH1.h> | |
9 | #include <TH2.h> | |
10 | #include <TInterpreter.h> | |
11 | #include "AliGeomManager.h" | |
12 | #include "AliCDBManager.h" | |
13 | #include "AliHeader.h" | |
14 | #include "AliITS.h" | |
15 | #include "AliITSdigit.h" | |
16 | #include "AliITSDetTypeRec.h" | |
17 | #include "AliITSgeomTGeo.h" | |
18 | #include "AliITSRecPoint.h" | |
19 | #include "AliRun.h" | |
20 | #endif | |
21 | ||
22 | // Macro to display the SDD digits for 1 ladder | |
23 | // Origin: F. Prino, prino@to.infn.it | |
24 | ||
25 | ||
26 | Int_t PlotSDDDigits(Int_t lay, Int_t lad, Int_t iev=0){ | |
27 | if (gClassTable->GetID("AliRun") < 0) { | |
28 | gInterpreter->ExecuteMacro("loadlibs.C"); | |
29 | } | |
30 | ||
31 | ||
32 | AliCDBManager* man = AliCDBManager::Instance(); | |
33 | if (!man->IsDefaultStorageSet()) { | |
34 | printf("Setting a local default storage and run number 0\n"); | |
162637e4 | 35 | man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); |
1e40ae31 | 36 | man->SetRun(0); |
37 | } | |
38 | else { | |
39 | printf("Using deafult storage \n"); | |
40 | } | |
41 | ||
42 | // retrives geometry | |
43 | if(!gGeoManager){ | |
44 | AliGeomManager::LoadGeometry("geometry.root"); | |
45 | } | |
46 | ||
47 | AliRunLoader* rl = AliRunLoader::Open("galice.root"); | |
48 | if (rl == 0x0){ | |
49 | cerr<<"Can not open session RL=NULL"<< endl; | |
50 | return -1; | |
51 | } | |
52 | Int_t retval = rl->LoadgAlice(); | |
53 | if (retval){ | |
54 | cerr<<"AliITSGeoPlot.C : LoadgAlice returned error"<<endl; | |
55 | return -1; | |
56 | } | |
57 | gAlice=rl->GetAliRun(); | |
58 | ||
59 | retval = rl->LoadHeader(); | |
60 | if (retval){ | |
61 | cerr<<"LoadHeader returned error"<<endl; | |
62 | return -1; | |
63 | } | |
64 | ||
65 | ||
66 | AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader"); | |
67 | if(!ITSloader){ | |
68 | cerr<<"ITS loader not found"<<endl; | |
69 | return -1; | |
70 | } | |
71 | AliITSgeom *geom = ITSloader->GetITSgeom(); | |
72 | ||
73 | ITSloader->LoadDigits("read"); | |
74 | rl->GetEvent(iev); | |
75 | AliITS *ITS = (AliITS*)gAlice->GetModule("ITS"); | |
76 | ITS->SetTreeAddress(); | |
77 | ||
78 | TTree *TD = ITSloader->TreeD(); | |
79 | AliITSDetTypeRec* detTypeRec = new AliITSDetTypeRec(); | |
80 | detTypeRec->SetITSgeom(geom); | |
81 | detTypeRec->SetDefaults(); | |
82 | TClonesArray *ITSdigits = ITS->DigitsAddress(1); | |
83 | detTypeRec->ResetDigits(); | |
84 | Int_t maxmod=6; | |
85 | if(lay==4) maxmod=8; | |
86 | TH2F **hdig0=new TH2F*[8]; | |
87 | TH2F **hdig1=new TH2F*[8]; | |
88 | Char_t histtit[100], histname[10]; | |
89 | Int_t nbytes; | |
90 | for(Int_t i=0; i<maxmod; i++){ | |
91 | Int_t nmod=AliITSgeomTGeo::GetModuleIndex(lay,lad,i+1); | |
92 | nbytes = TD->GetEvent(nmod); | |
93 | Int_t ndigits = ITSdigits->GetEntries(); | |
94 | printf("Module %d ndigits=%d\n",nmod,ndigits); | |
95 | sprintf(histname,"hdig%ds0",nmod); | |
96 | sprintf(histtit,"Digit mod %d side 0",nmod); | |
97 | hdig0[i]=new TH2F(histname,histtit,256,-0.5,255.5,256,-0.5,255.5); | |
98 | sprintf(histname,"hdig%ds1",nmod); | |
99 | sprintf(histtit,"Digit mod %d side 1",nmod); | |
100 | hdig1[i]=new TH2F(histname,histtit,256,-0.5,255.5,256,-0.5,255.5); | |
101 | hdig0[i]->SetStats(0); | |
102 | hdig1[i]->SetStats(0); | |
103 | for (Int_t idig=0; idig<ndigits; idig++) { | |
104 | AliITSdigit *dig=(AliITSdigit*)ITSdigits->UncheckedAt(idig); | |
105 | Int_t iz=dig->GetCoord1(); // cell number z | |
106 | Int_t ix=dig->GetCoord2(); // cell number x | |
107 | Int_t sig=dig->GetSignal(); | |
108 | if(iz<256){ | |
109 | hdig0[i]->SetBinContent(ix+1,iz+1,sig); | |
110 | }else{ | |
111 | iz-=256; | |
112 | hdig1[i]->SetBinContent(ix+1,iz+1,sig); | |
113 | } | |
114 | } | |
115 | } | |
116 | gStyle->SetPalette(1); | |
117 | TCanvas *c1=new TCanvas("c1","",1200,900); | |
118 | c1->Divide(4,maxmod/2); | |
119 | for(Int_t i=0;i<maxmod;i++){ | |
120 | c1->cd(1+2*i); | |
121 | hdig0[i]->Draw("colz"); | |
122 | hdig0[i]->GetXaxis()->SetTitle("Time bin"); | |
123 | hdig0[i]->GetYaxis()->SetTitle("Anode"); | |
124 | c1->cd(2+2*i); | |
125 | hdig1[i]->Draw("colz"); | |
126 | hdig1[i]->GetXaxis()->SetTitle("Time bin"); | |
127 | hdig1[i]->GetYaxis()->SetTitle("Anode"); | |
128 | } | |
129 | return 0; | |
130 | } |