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