]>
Commit | Line | Data |
---|---|---|
1e40ae31 | 1 | #if !defined(__CINT__) || defined(__MAKECINT__) |
2 | #include <TH2F.h> | |
e5b2f7f2 | 3 | #include <TGrid.h> |
1e40ae31 | 4 | #include <TCanvas.h> |
5 | #include <TStopwatch.h> | |
6 | #include <TStyle.h> | |
7 | #include "AliRawReaderDate.h" | |
8 | #include "AliRawReaderRoot.h" | |
9 | #include "AliITSRawStreamSDD.h" | |
e5b2f7f2 | 10 | #include "AliITSRawStreamSDDCompressed.h" |
1e40ae31 | 11 | #endif |
12 | ||
13 | // Macro to display the SDD Raw Data for 1 DDL | |
14 | // Origin: F. Prino, prino@to.infn.it | |
15 | ||
a2960214 | 16 | void PlotSDDRawData(Char_t datafil[100], |
17 | Int_t nDDL, | |
18 | Int_t firstEv=18, | |
19 | Int_t lastEv=20){ | |
20 | ||
21 | // Main function | |
1e40ae31 | 22 | |
1e40ae31 | 23 | const Int_t nHybrids=24; |
e5b2f7f2 | 24 | Bool_t writtenoutput=kFALSE; |
1e40ae31 | 25 | TH2F** histo = new TH2F*[nHybrids]; |
1e40ae31 | 26 | for(Int_t i=0;i<nHybrids;i++){ |
e5ab676a | 27 | histo[i]=new TH2F(Form("histo%d",i),"",256,-0.5,255.5,256,-0.5,255.5); |
1e40ae31 | 28 | histo[i]->SetStats(0); |
29 | } | |
30 | ||
e5ab676a | 31 | Bool_t isSingleMod=kFALSE; |
32 | Int_t npx=4; | |
33 | Int_t npy=6; | |
a2960214 | 34 | Int_t xsiz=700; |
35 | Int_t ysiz=700; | |
e5ab676a | 36 | Int_t nHybrToPlot=24; |
37 | Int_t iMod=-1; | |
90af9cac | 38 | Int_t nCarlos; |
e5ab676a | 39 | if(nDDL>=240 && nDDL<500){ |
40 | iMod=nDDL; | |
41 | AliITSDDLModuleMapSDD* dmap=new AliITSDDLModuleMapSDD(); | |
42 | dmap->SetJun09Map(); | |
e5ab676a | 43 | dmap->FindInDDLMap(iMod,nDDL,nCarlos); |
44 | histo[nCarlos*2]->SetTitle(Form("Module %d Side 0",iMod)); | |
a2960214 | 45 | histo[nCarlos*2+1]->SetTitle(Form("Module %d Side 1",iMod)); |
e5ab676a | 46 | isSingleMod=kTRUE; |
47 | npx=2; | |
48 | npy=1; | |
49 | xsiz=900; | |
50 | ysiz=450; | |
51 | nHybrToPlot=2; | |
52 | } | |
53 | ||
1e40ae31 | 54 | Int_t iev=firstEv; |
55 | AliRawReader *rd; | |
56 | if(strstr(datafil,".root")!=0){ | |
57 | rd=new AliRawReaderRoot(datafil,iev); | |
58 | }else{ | |
59 | rd=new AliRawReaderDate(datafil,iev); | |
60 | } | |
61 | TStopwatch *evtime=new TStopwatch(); | |
e5ab676a | 62 | TCanvas* c0 = new TCanvas("cd0","c0",xsiz,ysiz); |
1e40ae31 | 63 | gStyle->SetPalette(1); |
e5b2f7f2 | 64 | |
1e40ae31 | 65 | do{ |
66 | c0->Clear(); | |
e5ab676a | 67 | c0->Divide(npx,npy,0.001,0.001); |
1e40ae31 | 68 | |
69 | evtime->Start(); | |
70 | printf("Event # %d\n",iev); | |
1e40ae31 | 71 | rd->Reset(); |
72 | for(Int_t i=0;i<nHybrids;i++) histo[i]->Reset(); | |
e5b2f7f2 | 73 | UChar_t cdhAttr=AliITSRawStreamSDD::ReadBlockAttributes(rd); |
74 | UInt_t amSamplFreq=AliITSRawStreamSDD::ReadAMSamplFreqFromCDH(cdhAttr); | |
75 | AliITSRawStream* s=AliITSRawStreamSDD::CreateRawStreamSDD(rd,cdhAttr); | |
76 | if(!writtenoutput){ | |
77 | printf("Use %s raw stream, sampling frequency %d MHz\n",s->ClassName(),amSamplFreq); | |
78 | writtenoutput=kTRUE; | |
79 | } | |
80 | ||
1e40ae31 | 81 | Int_t iCountNext=0; |
e5b2f7f2 | 82 | while(s->Next()){ |
1e40ae31 | 83 | iCountNext++; |
e5b2f7f2 | 84 | if(s->IsCompletedModule()==kFALSE && s->IsCompletedDDL()==kFALSE){ |
85 | Int_t i=s->GetCarlosId()*2+s->GetChannel(); | |
86 | if(rd->GetDDLID()==nDDL) histo[i]->Fill(s->GetCoord2(),s->GetCoord1(),s->GetSignal()); | |
1e40ae31 | 87 | } |
88 | } | |
1e40ae31 | 89 | evtime->Stop(); |
e5b2f7f2 | 90 | printf("**** Event=%d \n",iev); |
1e40ae31 | 91 | evtime->Print("u"); |
92 | evtime->Reset(); | |
93 | iev++; | |
94 | ||
e5ab676a | 95 | for(Int_t i=0;i<nHybrToPlot;i++){ |
1e40ae31 | 96 | c0->cd(i+1); |
e5ab676a | 97 | if(isSingleMod){ |
98 | histo[nCarlos*2+i]->DrawCopy("colz"); | |
99 | }else{ | |
100 | histo[i]->DrawCopy("colz"); | |
101 | } | |
1e40ae31 | 102 | } |
103 | c0->Update(); | |
a2960214 | 104 | // if(histo[nCarlos*2]->GetMaximum()>1) getchar(); |
1e40ae31 | 105 | }while(rd->NextEvent()&&iev<=lastEv); |
106 | ||
107 | } | |
108 | ||
a2960214 | 109 | void PlotSDDRawData(Int_t nrun, |
110 | Int_t n2, | |
111 | Int_t year=2011, | |
112 | Char_t* dir="LHC11d_SDD", | |
e5b2f7f2 | 113 | Int_t nDDL=0, |
114 | Int_t firstEv=18, | |
115 | Int_t lastEv=20){ | |
116 | ||
a2960214 | 117 | // Get file directly from alien |
118 | ||
e5b2f7f2 | 119 | TGrid::Connect("alien:",0,0,"t"); |
120 | Char_t filnam[200]; | |
121 | sprintf(filnam,"alien:///alice/data/%d/%s/%09d/raw/%02d%09d%03d.10.root",year,dir,nrun,year-2000,nrun,n2); | |
122 | printf("Open file %s\n",filnam); | |
123 | PlotSDDRawData(filnam,nDDL,firstEv,lastEv); | |
124 | } | |
125 | ||
a2960214 | 126 | void PlotSDDRawData(Char_t datafil[100], |
127 | Int_t nLay, | |
128 | Int_t nLad, | |
129 | Int_t nDet, | |
130 | Int_t firstEv, | |
131 | Int_t lastEv){ | |
132 | ||
133 | // plot raw data for single module starting from | |
134 | // Layer, Ladder and detector numbers (counted from 1) | |
135 | Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(nLay,nLad,nDet); | |
136 | PlotSDDRawData(datafil,modIndex,firstEv,lastEv); | |
137 | ||
138 | } |