]>
Commit | Line | Data |
---|---|---|
3f55c67a | 1 | #if !defined(__CINT__) || defined(__MAKECINT__) |
2 | #include <TH2F.h> | |
61105575 | 3 | #include <TFile.h> |
3f55c67a | 4 | #include <TGrid.h> |
5 | #include <TCanvas.h> | |
6 | #include <TStopwatch.h> | |
7 | #include <TStyle.h> | |
61105575 | 8 | #include <TProfile.h> |
9 | #include <TLegend.h> | |
10 | #include <TLegendEntry.h> | |
11 | #include <TLatex.h> | |
12 | #include <TGrid.h> | |
3f55c67a | 13 | #include "AliRawReaderDate.h" |
14 | #include "AliRawReaderRoot.h" | |
15 | #include "AliITSRawStreamSDD.h" | |
16 | #include "AliITSRawStreamSDDCompressed.h" | |
17 | #endif | |
18 | ||
19 | ||
61105575 | 20 | void CheckDataSizeSDD(TString datafil="12000188359004.16.root", |
3f55c67a | 21 | Int_t firstEv=0, |
22 | Int_t lastEv=123456){ | |
23 | ||
61105575 | 24 | if(datafil.Contains("alien:")) TGrid::Connect("alien:"); |
25 | printf("FILE: %s\n",datafil.Data()); | |
26 | ||
3f55c67a | 27 | gStyle->SetOptStat(0); |
28 | gStyle->SetTitleFont(42,"XY"); | |
29 | gStyle->SetLabelFont(42,"XYZ"); | |
30 | ||
31 | Double_t maxOcc=2500.; | |
61105575 | 32 | TH2F* hCellsOnMod=new TH2F("hCellsOnMod","",260,239.5,499.5,500,0.,maxOcc); |
3f55c67a | 33 | TH2F* hCellsOnDDL=new TH2F("hCellsOnDDL","",24,-0.5,23.5,500,0.,maxOcc*12); |
34 | TH1F* hMaxOccMod=new TH1F("hMaxOccMod","",260,239.5,499.5); | |
35 | TH1F* hMaxOccDDL=new TH1F("hMaxOccDDL","",24,-0.5,23.5); | |
36 | ||
37 | AliITSDDLModuleMapSDD* dmap=new AliITSDDLModuleMapSDD(); | |
38 | dmap->SetJun09Map(); | |
39 | ||
40 | ||
41 | Int_t iev=firstEv; | |
42 | AliRawReader *rd; | |
43 | if(datafil.Contains(".root")){ | |
44 | rd=new AliRawReaderRoot(datafil.Data(),iev); | |
45 | }else{ | |
46 | rd=new AliRawReaderDate(datafil.Data(),iev); | |
47 | } | |
48 | ||
49 | Bool_t writtenoutput=kFALSE; | |
50 | Int_t countMod[260],countDDL[24]; | |
51 | Int_t maxOccMod[260],maxOccDDL[24]; | |
52 | for(Int_t im=0; im<260; im++) maxOccMod[im]=0; | |
53 | for(Int_t id=0; id<24; id++) maxOccDDL[id]=0; | |
54 | ||
55 | do{ | |
56 | ||
57 | printf("Event # %d\n",iev); | |
58 | for(Int_t im=0; im<260; im++) countMod[im]=0; | |
59 | for(Int_t id=0; id<24; id++) countDDL[id]=0; | |
60 | rd->Reset(); | |
61 | UChar_t cdhAttr=AliITSRawStreamSDD::ReadBlockAttributes(rd); | |
62 | UInt_t amSamplFreq=AliITSRawStreamSDD::ReadAMSamplFreqFromCDH(cdhAttr); | |
63 | AliITSRawStream* s=AliITSRawStreamSDD::CreateRawStreamSDD(rd,cdhAttr); | |
64 | if(!writtenoutput){ | |
65 | printf("Use %s raw stream, sampling frequency %d MHz\n",s->ClassName(),amSamplFreq); | |
66 | writtenoutput=kTRUE; | |
67 | } | |
68 | ||
69 | while(s->Next()){ | |
70 | if(s->IsCompletedModule()==kFALSE && s->IsCompletedDDL()==kFALSE){ | |
71 | Int_t counts=s->GetSignal(); | |
72 | if(counts>0){ | |
73 | Int_t iDDL=rd->GetDDLID(); | |
74 | ++countDDL[iDDL]; | |
75 | Int_t iMod=s->GetCarlosId(); | |
76 | Int_t modInd=dmap->GetModuleNumber(iDDL,iMod)-240; | |
77 | if(modInd>=0 && modInd<260) ++countMod[modInd]; | |
78 | } | |
79 | } | |
80 | } | |
81 | for(Int_t im=0; im<260; im++){ | |
82 | hCellsOnMod->Fill(im+240,countMod[im]); | |
83 | if(countMod[im]>maxOccMod[im]) maxOccMod[im]=countMod[im]; | |
84 | } | |
61105575 | 85 | for(Int_t id=0; id<24; id++){ |
3f55c67a | 86 | hCellsOnDDL->Fill(id,countDDL[id]); |
87 | if(countDDL[id]>maxOccDDL[id]) maxOccDDL[id]=countDDL[id]; | |
88 | } | |
89 | iev++; | |
90 | ||
91 | }while(rd->NextEvent()&&iev<=lastEv); | |
92 | ||
93 | for(Int_t im=0; im<260; im++) hMaxOccMod->SetBinContent(im+1,maxOccMod[im]); | |
94 | for(Int_t id=0; id<24; id++) hMaxOccDDL->SetBinContent(id+1,maxOccDDL[id]); | |
95 | ||
61105575 | 96 | TProfile* hAveOccDDL=hCellsOnDDL->ProfileX(); |
97 | TProfile* hAveOccMod=hCellsOnMod->ProfileX(); | |
98 | TH1D* hOccDstDDL[24]; | |
99 | Int_t totEv=0; | |
100 | for(Int_t i=0; i<24;i++){ | |
101 | hOccDstDDL[i]=(TH1D*)hCellsOnDDL->ProjectionY(Form("hOccDstDDL%d",i),i+1,i+1); | |
102 | printf("DDL %d Entries %.0f\n",i,hOccDstDDL[i]->Integral()); | |
103 | totEv=hOccDstDDL[i]->Integral(); | |
104 | } | |
105 | Double_t xmax=hMaxOccDDL->GetMaximum()*1.1; | |
106 | Int_t ddlForPlot[4]={9,15,17,21}; | |
107 | ||
108 | TCanvas* c1= new TCanvas("c1","Module occupancy",1100,750); | |
109 | c1->Divide(2,2); | |
3f55c67a | 110 | c1->cd(1); |
111 | gPad->SetLogz(); | |
112 | hCellsOnMod->GetXaxis()->SetTitle("Module Id"); | |
113 | hCellsOnMod->GetYaxis()->SetTitle("Number of cells on per event"); | |
114 | hCellsOnMod->GetYaxis()->SetTitleOffset(1.3); | |
115 | hCellsOnMod->Draw("colz"); | |
61105575 | 116 | c1->cd(3); |
117 | hAveOccMod->GetXaxis()->SetTitle("Module Id"); | |
118 | hAveOccMod->GetYaxis()->SetTitle("<Occupancy>"); | |
119 | hAveOccMod->GetYaxis()->SetTitleOffset(1.3); | |
120 | hAveOccMod->Draw(); | |
121 | c1->cd(4); | |
3f55c67a | 122 | hMaxOccMod->GetXaxis()->SetTitle("Module Id"); |
123 | hMaxOccMod->GetYaxis()->SetTitle("Maximum Occupancy"); | |
124 | hMaxOccMod->GetYaxis()->SetTitleOffset(1.3); | |
125 | hMaxOccMod->Draw(); | |
126 | ||
61105575 | 127 | TCanvas* c2= new TCanvas("c2","DDL occupancy",1100,750); |
128 | c2->Divide(2,2); | |
3f55c67a | 129 | c2->cd(1); |
130 | gPad->SetLogz(); | |
131 | hCellsOnDDL->GetXaxis()->SetTitle("DDL Number"); | |
132 | hCellsOnDDL->GetYaxis()->SetTitle("Number of cells on per event"); | |
133 | hCellsOnDDL->GetYaxis()->SetTitleOffset(1.3); | |
134 | hCellsOnDDL->Draw("colz"); | |
61105575 | 135 | TLatex* textev=new TLatex(0.15,0.8,Form("%d events",totEv)); |
136 | textev->SetNDC(); | |
137 | textev->Draw(); | |
3f55c67a | 138 | c2->cd(2); |
61105575 | 139 | gPad->SetLogy(); |
140 | TLegend* leg=new TLegend(0.6,0.6,0.89,0.89); | |
141 | leg->SetFillColor(0); | |
142 | for(Int_t i=0; i<4; i++){ | |
143 | Int_t iddl=ddlForPlot[i]; | |
144 | hOccDstDDL[iddl]->GetXaxis()->SetTitle("Occupancy"); | |
145 | hOccDstDDL[iddl]->GetXaxis()->SetRangeUser(0.,xmax); | |
146 | hOccDstDDL[iddl]->SetLineColor(i+1); | |
147 | if(i==0) hOccDstDDL[iddl]->Draw(); | |
148 | else hOccDstDDL[iddl]->Draw("same"); | |
149 | leg->AddEntry(hOccDstDDL[iddl],Form("DDL %d",iddl),"L")->SetTextColor(hOccDstDDL[iddl]->GetLineColor()); | |
150 | } | |
151 | leg->Draw(); | |
152 | c2->cd(3); | |
153 | hAveOccDDL->GetXaxis()->SetTitle("DDL Number"); | |
154 | hAveOccDDL->GetYaxis()->SetTitle("<Occupancy>"); | |
155 | hAveOccDDL->GetYaxis()->SetTitleOffset(1.3); | |
156 | hAveOccDDL->Draw(); | |
157 | c2->cd(4); | |
3f55c67a | 158 | hMaxOccDDL->GetXaxis()->SetTitle("DDL Number"); |
159 | hMaxOccDDL->GetYaxis()->SetTitle("Maximum Occupancy"); | |
160 | hMaxOccDDL->GetYaxis()->SetTitleOffset(1.3); | |
161 | hMaxOccDDL->Draw(); | |
61105575 | 162 | |
163 | TString outfilname=datafil.Data(); | |
164 | if(outfilname.Contains("alien")){ | |
165 | outfilname.Remove(0,outfilname.Length()-22); | |
166 | } | |
167 | outfilname.Prepend("DataSize_"); | |
168 | printf("%s\n",outfilname.Data()); | |
169 | TFile* outf=new TFile(outfilname.Data(),"recreate"); | |
170 | hCellsOnMod->Write(); | |
171 | hMaxOccMod->Write(); | |
172 | hCellsOnDDL->Write(); | |
173 | hMaxOccDDL->Write(); | |
174 | outf->Close(); | |
3f55c67a | 175 | } |