]>
Commit | Line | Data |
---|---|---|
91282711 | 1 | #if !defined(__CINT__) || defined(__MAKECINT__) |
2 | #include <TH2F.h> | |
3 | #include <TCanvas.h> | |
4 | #include <TGraphErrors.h> | |
5 | #include <TStopwatch.h> | |
6 | #include <TStyle.h> | |
7 | #include <TLatex.h> | |
8 | #include <TFile.h> | |
880253ca | 9 | #include <TMath.h> |
91282711 | 10 | #include <TGrid.h> |
11 | #include <TF1.h> | |
12 | #include <TLine.h> | |
13 | #include "AliRawReader.h" | |
14 | #include "AliRawReaderDate.h" | |
15 | #include "AliRawReaderRoot.h" | |
16 | #include "AliITSOnlineSDDInjectors.h" | |
17 | #include "AliITSRawStreamSDD.h" | |
18 | #include "AliITSDDLModuleMapSDD.h" | |
19 | #endif | |
20 | ||
21 | // Macro for the analysis of PULSER runs (equivalent to ITSSDDINJda.cxx) | |
22 | // Two functions named AnalyzeSDDInjectorsAllModules: | |
23 | // The first is for analyzing a local raw data file and takes as agrument the file name. | |
24 | // The second is for running on ALIEN | |
25 | // All DDLs are analyzed, the argument nDDL selects the DDL to be plotted | |
26 | // Origin: F. Prino (prino@to.infn.it) | |
27 | ||
28 | ||
880253ca | 29 | void AnalyzeSDDInjectorsAllMod(Char_t *datafil, Int_t nDDL, Int_t firstEv=10, Int_t lastEv=15,Int_t jpad=16, Int_t statuscut=7){ |
5a4e63d5 | 30 | |
91282711 | 31 | const Int_t kTotDDL=24; |
32 | const Int_t kModPerDDL=12; | |
33 | const Int_t kSides=2; | |
34 | ||
35 | AliITSDDLModuleMapSDD* dmap=new AliITSDDLModuleMapSDD(); | |
36 | dmap->SetJun08Map(); | |
37 | ||
38 | TH2F** histo = new TH2F*[kTotDDL*kModPerDDL*kSides]; | |
39 | Int_t nWrittenEv[kTotDDL*kModPerDDL*kSides]; | |
40 | TGraphErrors** gvel = new TGraphErrors*[kTotDDL*kModPerDDL*kSides]; | |
41 | AliITSOnlineSDDInjectors **anal=new AliITSOnlineSDDInjectors*[kTotDDL*kModPerDDL*kSides]; | |
880253ca | 42 | TH1F** hvdriftl=new TH1F*[260]; |
43 | TH1F** hvdriftr=new TH1F*[260]; | |
91282711 | 44 | Char_t hisnam[20]; |
880253ca | 45 | for(Int_t idet=0; idet<260;idet++){ |
46 | sprintf(hisnam,"vdriftl%03d",idet); | |
47 | hvdriftl[idet]=new TH1F(hisnam,"",500,5.5,8.0); | |
48 | sprintf(hisnam,"vdriftr%03d",idet); | |
49 | hvdriftr[idet]=new TH1F(hisnam,"",500,5.5,8.0); | |
50 | } | |
91282711 | 51 | for(Int_t iddl=0; iddl<kTotDDL;iddl++){ |
52 | for(Int_t imod=0; imod<kModPerDDL;imod++){ | |
53 | for(Int_t isid=0;isid<kSides;isid++){ | |
54 | Int_t index=kSides*(kModPerDDL*iddl+imod)+isid; | |
55 | sprintf(hisnam,"h%02dc%02ds%d",iddl,imod,isid); | |
56 | histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5); | |
57 | anal[index]=new AliITSOnlineSDDInjectors(iddl,imod,isid); | |
5a4e63d5 | 58 | /* Uncomment these lines for analysis of runs with 40 MHz sapling */ |
59 | // anal[index]->SetInjLineRange(0,20,50); | |
60 | // anal[index]->SetInjLineRange(1,90,160); | |
61 | // anal[index]->SetInjLineRange(2,170,240); | |
62 | // anal[index]->SetTimeStep(25.); | |
63 | /* END of lines to be uncommented */ | |
91282711 | 64 | nWrittenEv[index]=0; |
65 | } | |
66 | } | |
67 | } | |
880253ca | 68 | TGraphErrors *gvvsmod0=new TGraphErrors(0); |
69 | TGraphErrors *gvvsmod1=new TGraphErrors(0); | |
70 | TGraphErrors *gtvsmod0=new TGraphErrors(0); | |
71 | TGraphErrors *gtvsmod1=new TGraphErrors(0); | |
72 | Float_t gvmin=6.0, gvmax=7.5; | |
73 | Float_t gtmin=288., gtmax=308.; | |
a7996467 | 74 | TH1F* hanst=new TH1F("hanst","",8,-0.5,7.5); |
880253ca | 75 | TH1F* hpad7l=new TH1F("hpad7l","",33,-0.5,32.5); |
76 | TH1F* hpad7r=new TH1F("hpad7r","",33,-0.5,32.5); | |
91282711 | 77 | |
a7996467 | 78 | TCanvas* c0 = new TCanvas("c0","Event display",900,900); |
91282711 | 79 | gStyle->SetPalette(1); |
a7996467 | 80 | TCanvas* c1 = new TCanvas("c1","Drift Speed vs. anode",900,900); |
91282711 | 81 | Char_t text[50]; |
82 | ||
83 | Int_t iev=firstEv; | |
84 | AliRawReader *rd; | |
85 | if(strstr(datafil,".root")!=0){ | |
86 | rd=new AliRawReaderRoot(datafil,iev); | |
87 | }else{ | |
88 | rd=new AliRawReaderDate(datafil,iev); | |
89 | } | |
90 | ||
91 | Char_t gname[15]; | |
92 | TF1 *funz=new TF1("funz","[0]+[1]*x+[2]*x*x+[3]*x*x*x",0.,255.); | |
93 | TLatex *t0=new TLatex(); | |
94 | t0->SetNDC(); | |
95 | t0->SetTextSize(0.06); | |
96 | t0->SetTextColor(4); | |
880253ca | 97 | Int_t readEv=0; |
91282711 | 98 | do{ |
99 | c0->Clear(); | |
100 | c0->Divide(4,6,0.001,0.001); | |
101 | c1->Clear(); | |
102 | c1->Divide(4,6,0.001,0.001); | |
103 | printf("Event # %d\n",iev); | |
104 | UInt_t timeSt=rd->GetTimestamp(); | |
91282711 | 105 | rd->Reset(); |
106 | for(Int_t iddl=0; iddl<kTotDDL;iddl++){ | |
107 | for(Int_t imod=0; imod<kModPerDDL;imod++){ | |
108 | for(Int_t isid=0;isid<kSides;isid++){ | |
109 | Int_t index=kSides*(kModPerDDL*iddl+imod)+isid; | |
110 | histo[index]->Reset(); | |
111 | } | |
112 | } | |
113 | } | |
114 | ||
115 | AliITSRawStreamSDD s(rd); | |
91282711 | 116 | while(s.Next()){ |
117 | Int_t iDDL=rd->GetDDLID(); | |
118 | Int_t iCarlos=s.GetCarlosId(); | |
de075dae | 119 | if(s.IsCompletedModule()) continue; |
120 | if(s.IsCompletedDDL()) continue; | |
121 | if(iDDL>=0 && iDDL<kTotDDL){ | |
91282711 | 122 | Int_t index=kSides*(kModPerDDL*iDDL+iCarlos)+s.GetChannel(); |
123 | histo[index]->Fill(s.GetCoord2(),s.GetCoord1(),s.GetSignal()); | |
124 | } | |
125 | } | |
126 | ||
127 | for(Int_t iddl=0; iddl<kTotDDL;iddl++){ | |
128 | for(Int_t imod=0; imod<kModPerDDL;imod++){ | |
129 | for(Int_t isid=0;isid<kSides;isid++){ | |
130 | Int_t index=kSides*(kModPerDDL*iddl+imod)+isid; | |
131 | anal[index]->AnalyzeEvent(histo[index]); | |
132 | anal[index]->WriteToASCII(iev,timeSt,nWrittenEv[index]); | |
133 | nWrittenEv[index]++; | |
a7996467 | 134 | Int_t iMod=dmap->GetModuleNumber(iddl,imod); |
880253ca | 135 | if(iMod!=-1){ |
a7996467 | 136 | for(Int_t ipad=0;ipad<33;ipad++){ |
137 | Int_t st=anal[index]->GetInjPadStatus(ipad); | |
138 | hanst->Fill(st); | |
880253ca | 139 | if(anal[index]->GetInjPadStatus(ipad)>=statuscut){ |
140 | if(isid==0) hpad7l->Fill(ipad); | |
141 | if(isid==1) hpad7r->Fill(ipad); | |
142 | } | |
a7996467 | 143 | } |
880253ca | 144 | if(anal[index]->GetInjPadStatus(jpad)>=statuscut){ |
145 | Float_t vel=anal[index]->GetDriftSpeed(jpad); | |
146 | if(isid==0) hvdriftl[iMod-240]->Fill(vel); | |
147 | if(isid==1) hvdriftr[iMod-240]->Fill(vel); | |
a7996467 | 148 | } |
91282711 | 149 | } |
150 | if(iddl==nDDL){ | |
151 | Int_t index2=kSides*imod+isid; | |
152 | c0->cd(index2+1); | |
153 | histo[index]->SetMaximum(100.); | |
154 | histo[index]->DrawCopy("colz"); | |
155 | sprintf(text,"DDL %d channel %d Side %d",nDDL,imod,isid); | |
156 | t0->DrawLatex(0.15,0.92,text); | |
157 | c0->Update(); | |
158 | c1->cd(index2+1); | |
159 | gvel[index]=anal[index]->GetDriftSpeedGraph(); | |
160 | gvel[index]->SetMarkerStyle(20); | |
161 | gvel[index]->SetTitle(""); | |
162 | sprintf(gname,"gvel%dev%d",index,iev); | |
163 | gvel[index]->SetName(gname); | |
164 | // gvel[index]->SetMinimum(0); | |
165 | //gvel[index]->SetMaximum(200); | |
166 | ||
167 | gvel[index]->GetXaxis()->SetLimits(0,256); | |
168 | gvel[index]->GetXaxis()->SetTitle("Anode"); | |
169 | gvel[index]->GetYaxis()->SetTitle("Drift vel."); | |
170 | gvel[index]->GetXaxis()->SetTitleSize(0.07); | |
171 | gvel[index]->GetYaxis()->SetTitleSize(0.07); | |
172 | gvel[index]->GetXaxis()->SetTitleOffset(0.6); | |
173 | gvel[index]->GetYaxis()->SetTitleOffset(0.6); | |
174 | if(gvel[index]->GetN()>0) gvel[index]->Draw("AP"); | |
175 | Float_t *param=anal[index]->GetDriftSpeedFitParam(); | |
176 | funz->SetParameters(param[0],param[1],param[2],param[3]); | |
177 | funz->SetLineColor(2); | |
178 | funz->DrawCopy("LSAME"); | |
179 | t0->DrawLatex(0.15,0.92,text); | |
180 | c1->Update(); | |
181 | } | |
182 | } | |
183 | } | |
184 | } | |
185 | iev++; | |
880253ca | 186 | readEv++; |
91282711 | 187 | printf(" --- OK\n"); |
188 | }while(rd->NextEvent()&&iev<=lastEv); | |
880253ca | 189 | printf("Total number of events = %d\n",readEv); |
190 | Float_t nfac=1./(Float_t)readEv/33./520.; | |
191 | hanst->Scale(nfac); | |
192 | nfac=1./(Float_t)readEv; | |
193 | hpad7l->Scale(nfac); | |
194 | hpad7r->Scale(nfac); | |
195 | ||
196 | Int_t ipt0=0, ipt1=0; | |
197 | Float_t Edrift=(1800-45)/291/0.012; | |
198 | TFile *outfil=new TFile("DriftSpeedHistos.root","recreate"); | |
199 | for(Int_t iMod=0; iMod<260; iMod++){ | |
200 | outfil->cd(); | |
201 | hvdriftl[iMod]->Write(); | |
202 | hvdriftr[iMod]->Write(); | |
203 | Float_t modid=iMod+240; | |
204 | if(hvdriftl[iMod]->GetEntries()>0){ | |
205 | Float_t avevell=hvdriftl[iMod]->GetMean(); | |
206 | Float_t rmsvell=hvdriftl[iMod]->GetRMS(); | |
207 | if(avevell > 5.5 && avevell < 8.5){ | |
208 | gvvsmod0->SetPoint(ipt0,modid,avevell); | |
209 | gvvsmod0->SetPointError(ipt0,0,rmsvell); | |
210 | Float_t mob=avevell*1.E5/Edrift; | |
211 | Float_t temper=293.15*TMath::Power((mob/1350.),-1/2.4); | |
212 | gtvsmod0->SetPoint(ipt0,modid,temper); | |
213 | ++ipt0; | |
214 | } | |
215 | } | |
216 | if(hvdriftr[iMod]->GetEntries()>0){ | |
217 | Float_t avevelr=hvdriftr[iMod]->GetMean(); | |
218 | Float_t rmsvelr=hvdriftr[iMod]->GetRMS(); | |
219 | if(avevelr > 5.5 && avevelr < 8.5){ | |
220 | gvvsmod1->SetPoint(ipt1,modid,avevelr); | |
221 | gvvsmod1->SetPointError(ipt1,0,rmsvelr); | |
222 | Float_t mob=avevelr*1.E5/Edrift; | |
223 | Float_t temper=293.15*TMath::Power((mob/1350.),-1./2.4); | |
224 | gtvsmod1->SetPoint(ipt1,modid,temper); | |
225 | ++ipt1; | |
226 | } | |
227 | } | |
228 | } | |
229 | gvvsmod0->SetName("gvvsmod0"); | |
230 | gvvsmod1->SetName("gvvsmod1"); | |
231 | gtvsmod0->SetName("gtvsmod0"); | |
232 | gtvsmod1->SetName("gtvsmod1"); | |
233 | outfil->cd(); | |
234 | gvvsmod0->Write(); | |
235 | gvvsmod1->Write(); | |
236 | gtvsmod0->Write(); | |
237 | gtvsmod1->Write(); | |
238 | outfil->Close(); | |
91282711 | 239 | |
a7996467 | 240 | TCanvas* c8=new TCanvas("c8","Drift Speed vs. mod"); |
91282711 | 241 | gvvsmod0->SetTitle(""); |
242 | gvvsmod1->SetTitle(""); | |
91282711 | 243 | gvvsmod0->SetMarkerStyle(20); |
244 | gvvsmod1->SetMarkerStyle(21); | |
245 | gvvsmod1->SetMarkerColor(2); | |
246 | gvvsmod0->Draw("AP"); | |
880253ca | 247 | gvvsmod0->SetMinimum(gvmin); |
248 | gvvsmod0->SetMaximum(gvmax); | |
91282711 | 249 | gvvsmod0->GetXaxis()->SetTitle("Module Number"); |
880253ca | 250 | Char_t title[25]; |
251 | sprintf(title,"Vdrift at injector pad %d",jpad); | |
252 | gvvsmod0->GetYaxis()->SetTitle(title); | |
91282711 | 253 | gvvsmod1->Draw("PSAME"); |
254 | TLatex* tleft=new TLatex(0.7,0.82,"Side 0"); | |
255 | tleft->SetNDC(); | |
256 | tleft->SetTextColor(1); | |
257 | tleft->Draw(); | |
258 | TLatex* tright=new TLatex(0.7,0.75,"Side 1"); | |
259 | tright->SetNDC(); | |
260 | tright->SetTextColor(2); | |
261 | tright->Draw(); | |
262 | ||
880253ca | 263 | TLine *lin=new TLine(323,gvmin,323,gvmax); |
91282711 | 264 | lin->SetLineColor(4); |
265 | lin->Draw(); | |
266 | c8->Update(); | |
880253ca | 267 | c8->SaveAs("VdriftVsMod.gif"); |
268 | ||
269 | TCanvas* c8t=new TCanvas("c8t","Temeprature vs. mod"); | |
270 | gtvsmod0->SetTitle(""); | |
271 | gtvsmod1->SetTitle(""); | |
272 | gtvsmod0->SetMarkerStyle(20); | |
273 | gtvsmod1->SetMarkerStyle(21); | |
274 | gtvsmod1->SetMarkerColor(2); | |
275 | gtvsmod0->Draw("AP"); | |
276 | gtvsmod0->SetMinimum(gtmin); | |
277 | gtvsmod0->SetMaximum(gtmax); | |
278 | gtvsmod0->GetXaxis()->SetTitle("Module Number"); | |
279 | sprintf(title,"Estimated Temperature (K)"); | |
280 | gtvsmod0->GetYaxis()->SetTitle(title); | |
281 | gtvsmod1->Draw("PSAME"); | |
282 | tleft->Draw(); | |
283 | tright->Draw(); | |
284 | TLine *lint=new TLine(323,gtmin,323,gtmax); | |
285 | lint->SetLineColor(4); | |
286 | lint->Draw(); | |
287 | c8t->Update(); | |
288 | c8t->SaveAs("TempVsMod.gif"); | |
a7996467 | 289 | |
290 | TCanvas* c9=new TCanvas("c9","Injector status"); | |
880253ca | 291 | hanst->SetStats(0); |
a7996467 | 292 | hanst->Draw(); |
293 | hanst->GetXaxis()->SetTitle("Injector pad status"); | |
294 | hanst->GetXaxis()->CenterTitle(); | |
880253ca | 295 | c9->SaveAs("InjStatus.gif"); |
296 | ||
297 | // TCanvas* c10=new TCanvas("c10","Pad status 7",1200,600); | |
298 | // hpad7l->SetStats(0); | |
299 | // hpad7r->SetStats(0); | |
300 | // c10->Divide(2,1); | |
301 | // c10->cd(1); | |
302 | // hpad7l->Draw(); | |
303 | // hpad7l->GetXaxis()->SetTitle("Side Left -- Pad number"); | |
304 | // hpad7l->GetXaxis()->CenterTitle(); | |
305 | // hpad7l->GetYaxis()->SetTitle("Number of status 7"); | |
306 | // c10->cd(2); | |
307 | // hpad7r->Draw(); | |
308 | // hpad7r->GetXaxis()->SetTitle("Side Right -- Pad number"); | |
309 | // hpad7r->GetXaxis()->CenterTitle(); | |
310 | // hpad7r->GetYaxis()->SetTitle("Number of status 7"); | |
311 | // printf("Side 0, maximum pad=%d\n",hpad7l->GetMaximumBin()); | |
312 | // printf("Side 1, maximum pad=%d\n",hpad7r->GetMaximumBin()); | |
313 | ||
314 | ||
91282711 | 315 | } |
316 | ||
a7996467 | 317 | void AnalyzeSDDInjectorsAllMod(Int_t nrun, Int_t n2, Char_t* dir="LHC08d_SDD", Int_t nDDL=0, Int_t firstEv=15, Int_t lastEv=15){ |
91282711 | 318 | TGrid::Connect("alien:",0,0,"t"); |
319 | Char_t filnam[200]; | |
a7996467 | 320 | sprintf(filnam,"alien:///alice/data/2008/%s/%09d/raw/08%09d%03d.10.root",dir,nrun,nrun,n2); |
91282711 | 321 | printf("Open file %s\n",filnam); |
322 | AnalyzeSDDInjectorsAllMod(filnam,nDDL,firstEv,lastEv); | |
323 | } | |
324 | ||
325 | ||
326 |