1 #if !defined(__CINT__) || defined(__MAKECINT__)
7 #include <TClassTable.h>
18 #include "AliRunLoader.h"
20 #include "STEER/AliESDEvent.h"
21 #include "STEER/AliESDZDC.h"
24 void CheckAlienZDCESD(Int_t year=2010, const char* period="10a",
25 Int_t nRun=0, Int_t recoPass=1, Int_t nMaxFiles=1,
26 Bool_t plot=kTRUE, Bool_t esdWordCut=kFALSE)
30 printf("\n\n YOU MUST PROVIDE A RUN NUMBER!!! \n\n");
34 // Histogram definition
35 // ----------------------------------------------------------------
36 /* TH2F *centroidZNsideC = new TH2F("centroidZNsideC","Impact point over ZNC",100,-5.,5.,100,-5.,5.);
37 centroidZNsideC->SetXTitle("X_{ZNC} (cm)");
38 centroidZNsideC->SetYTitle("Y_{ZNC} (cm)");
39 TH2F * centroidZNsideA = new TH2F("centroidZNsideA","Impact point over ZNA",100,-5.,5.,100,-5.,5.);
40 centroidZNsideA->SetXTitle("X_{ZNA} (cm)");
41 centroidZNsideA->SetYTitle("Y_{ZNA} (cm)");
43 TH1F * enZNC = new TH1F("enZNC", "ZNC signal",100,0.,2000.);
44 enZNC->SetXTitle("E (GeV)");
45 TH1F * enZPC = new TH1F("enZPC", "ZPC signal",100,0.,2000.);
46 enZPC->SetXTitle("E (GeV)");
47 TH1F * enZNA = new TH1F("enZNA", "ZNA signal",100,0.,2000.);
48 enZNA->SetXTitle("E (GeV)");
49 TH1F * enZPA = new TH1F("enZPA", "ZPA signal",100,0.,2000.);
50 enZPA->SetXTitle("E (GeV)");
51 TH1D * enZEM1 = new TH1D("enZEM1", "Energy in ZEM1",100,0.,2000.);
52 enZEM1->SetXTitle("E (GeV)");
53 TH1D * enZEM2 = new TH1D("enZEM2", "Energy in ZEM2",100,0.,2000.);
54 enZEM2->SetXTitle("E (GeV)");
55 // ----------------------------------------------------------------
56 TH1D * hZNCTow[5]; TH1D * hZPCTow[5];
57 TH1D * hZNATow[5]; TH1D * hZPATow[5];
58 char nomehistznc[30], nomehistzpc[30], nomehistzna[30], nomehistzpa[30];
59 for(Int_t i=0; i<5; i++){
60 sprintf(nomehistznc,"ZNC-pm%d",i);
61 hZNCTow[i] = new TH1D(nomehistznc, nomehistznc, 100, 0.,1000.);
62 sprintf(nomehistzpc,"ZPC-pm%d",i);
63 hZPCTow[i] = new TH1D(nomehistzpc, nomehistzpc, 100, 0.,1000.);
64 sprintf(nomehistzna,"ZNA-pm%d",i);
65 hZNATow[i] = new TH1D(nomehistzna, nomehistzna, 100, 0.,1000.);
66 sprintf(nomehistzpa,"ZPA-pm%d",i);
67 hZPATow[i] = new TH1D(nomehistzpa, nomehistzpa, 100, 0.,1000.);
70 /* TH1D *hSumQZNC = new TH1D("hSumQZNC", "hSumQZNC", 100, 0., 1000.);
71 TH1D *hSumQZPC = new TH1D("hSumQZPC", "hSumQZPC", 100, 0., 1000.);
72 TH1D *hSumQZNA = new TH1D("hSumQZNA", "hSumQZNA", 100, 0., 1000.);
73 TH1D *hSumQZPA = new TH1D("hSumQZPA", "hSumQZPA", 100, 0., 1000.);
76 TH1F *hESDword = new TH1F("hESDword","hESDword",6,0.5,6.5);
77 hESDword->SetXTitle("ZDC trigger pattern");
79 TGrid::Connect("alien:",0,0,"t");
80 gSystem->Exec(Form("gbbox find \"/alice/data/%d/LHC%s/000%d/ESDs/pass%d\" \"AliESDs.root\" > ESDFiles.txt",
81 year, period, nRun, recoPass));
82 FILE* listruns=fopen("ESDFiles.txt","r");
84 char esdFileName[200], filnamalien[200];
87 Int_t nAnalyzedFiles=0;
88 Int_t nevPhys=0, nevZNC=0, nevZPC=0, nevZNA=0, nevZPA=0, nevZEM1=0, nevZEM2=0;
90 while(!feof(listruns)){
92 if(nAnalyzedFiles!=nMaxFiles){
94 int st = fscanf(listruns,"%s\n",esdFileName);
95 Char_t directory[100];
96 sprintf(directory,"/alice/data/%d",year);
97 if(!strstr(esdFileName,directory)) continue;
98 sscanf(esdFileName,"/alice/data/%d/LHC%s/000%d/ESDs/pass%d/%s/AliESDs.root",&year,&yperiod,&nRun,&recoPass,&dirESD);
99 sprintf(filnamalien,"alien://%s",esdFileName);
100 printf("\n Opening file: %s\n",filnamalien);
103 TFile* esdFile = TFile::Open(filnamalien);
105 Error("CheckZDCESD", "opening ESD file %s failed",filnamalien);
109 AliESDEvent* esd = new AliESDEvent();
110 TTree* tree = (TTree*) esdFile->Get("esdTree");
112 Error("CheckZDCESD", "No ESD tree found");
116 tree->SetBranchStatus("*", 0);
117 tree->SetBranchStatus("AliESDHeader*", 1);
118 tree->SetBranchStatus("AliESDRun*", 1);
119 tree->SetBranchStatus("AliESDZDC*", 1);
120 tree->SetBranchStatus("PrimaryVertex*", 1);
121 tree->SetBranchStatus("SPDVertex*", 1);
122 tree->SetBranchStatus("AliESDVZERO*", 1);
124 esd->ReadFromTree(tree);
126 Int_t nevents = (Int_t)tree->GetEntries();
127 printf("\n No. of events in ESD tree = %d\n", nevents);
128 for(Int_t iEvent=0; iEvent<nevents; iEvent++){
129 // get the event summary data
130 tree->GetEvent(iEvent);
132 //printf(" ev. type %d\n",esd->GetEventType());
134 if(esd->GetEventType() == 7){
137 Error("CheckESD", "no ESD object found for event %d", iEvent);
141 Double_t sumQznc=0., sumQzpc=0., sumQzna=0., sumQzpa=0.;
143 AliESDZDC *esdZDC = esd->GetESDZDC();
144 //Double_t centrZNC={-999.,-999.}, centrZNA={-999.,-999.};
145 //esdZDC->GetZNCentroidInpp(centrZNC, centrZNA);
146 //Short_t npart = esdZDC->GetZDCParticipants();
147 Double_t energyZNC = esdZDC->GetZDCN1Energy();
148 Double_t energyZPC = esdZDC->GetZDCP1Energy();
149 Double_t energyZNA = esdZDC->GetZDCN2Energy();
150 Double_t energyZPA = esdZDC->GetZDCP2Energy();
151 Double_t energyZEM1 = esdZDC->GetZDCEMEnergy(0);
152 Double_t energyZEM2 = esdZDC->GetZDCEMEnergy(1);
153 const Double_t * towZNC = esdZDC->GetZN1TowerEnergy();
154 const Double_t * towZPC = esdZDC->GetZP1TowerEnergy();
155 const Double_t * towZNA = esdZDC->GetZN2TowerEnergy();
156 const Double_t * towZPA = esdZDC->GetZP2TowerEnergy();
157 UInt_t iWord = esdZDC->GetESDQuality();
159 if((iWord & 0x00000001) == 0x00000001){
163 if((iWord & 0x00000002) == 0x00000002){
167 if((iWord & 0x00000004) == 0x00000004){
171 if((iWord & 0x00000008) == 0x00000008){
175 if((iWord & 0x00000010) == 0x00000010){
179 if((iWord & 0x00000020) == 0x00000020){
183 //if(centrZNC[0]!=-999. && centrZNC[1]!=-999) centroidZNsideC->Fill(centrZNC[0], centrZNC[1]);
184 //if(centrZNA[0]!=-999. && centrZNA[1]!=-999) centroidZNsideA->Fill(centrZNA[0], centrZNA[1]);
185 enZNC->Fill(energyZNC);
186 enZPC->Fill(energyZPC);
187 enZNA->Fill(energyZNA);
188 enZPA->Fill(energyZPA);
189 enZEM1->Fill(energyZEM1);
190 enZEM2->Fill(energyZEM2);
192 for(Int_t jj=0; jj<5; jj++){
194 if((iWord & 0x00000010) == 0x00000010) hZNCTow[jj]->Fill(towZNC[jj]);
195 if((iWord & 0x00000020) == 0x00000020) hZPCTow[jj]->Fill(towZPC[jj]);
196 if((iWord & 0x00000001) == 0x00000001) hZNATow[jj]->Fill(towZNA[jj]);
197 if((iWord & 0x00000002) == 0x00000002) hZPATow[jj]->Fill(towZPA[jj]);
200 hZNCTow[jj]->Fill(towZNC[jj]);
201 hZPCTow[jj]->Fill(towZPC[jj]);
202 hZNATow[jj]->Fill(towZNA[jj]);
203 hZPATow[jj]->Fill(towZPA[jj]);
208 if((iWord & 0x00000010) == 0x00000010) sumQznc += towZNC[jj];
209 if((iWord & 0x00000020) == 0x00000020) sumQzpc += towZPC[jj];
210 if((iWord & 0x00000001) == 0x00000001) sumQzna += towZNA[jj];
211 if((iWord & 0x00000002) == 0x00000002) sumQzpa += towZPA[jj];
214 sumQznc += towZNC[jj];
215 sumQzpc += towZPC[jj];
216 sumQzna += towZNA[jj];
217 sumQzpa += towZPA[jj];
223 if((iWord & 0x00000010) == 0x00000010) {
224 hSumQZNC->Fill(sumQznc);
226 //if(centrZNA[0]!=-999. && centrZNA[1]!=-999) centroidZNsideC->Fill(centrZNA[0], centrZNA[1]);
229 if((iWord & 0x00000020) == 0x00000020) {
230 hSumQZPC->Fill(sumQzpc);
235 hSumQZNC->Fill(sumQznc);
237 hSumQZPC->Fill(sumQzpc);
240 hSumQZNA->Fill(sumQzna);
241 hSumQZPA->Fill(sumQzpa);
249 }//if(nAnalyzedFiles<=nMaxFiles)
251 printf("\t %d files analyzed\n\n",nMaxFiles);
256 printf(" No. of events over threshold: ZNA: %d ZPA: %d ZEM1: %d "
257 " ZEM2: %d ZNC: %d ZPC: %d\n\n",
258 nevZNA, nevZPA, nevZEM1, nevZEM2, nevZNC, nevZPC);
261 //***********************************************************
262 // #### ROOT initialization
264 gStyle->SetCanvasColor(10);
265 gStyle->SetFrameFillColor(10);
266 gStyle->SetOptTitle(1);
267 if(esdWordCut) gStyle->SetOptStat(1111111);
268 else gStyle->SetOptStat(1111);
269 gStyle->SetOptFit(0);
270 gStyle->SetTitleTextColor(4);
271 gStyle->SetStatTextColor(4);
272 gStyle->SetStatX(0.92);
273 gStyle->SetStatY(0.92);
274 gStyle->SetLineColor(1);
275 gStyle->SetPalette(1);
276 gStyle->SetPadTopMargin(0.04);
277 gStyle->SetPadRightMargin(0.04);
278 gStyle->SetPadBottomMargin(0.14);
279 gStyle->SetPadLeftMargin(0.16);
282 //-------------------------------------------------
283 TCanvas *c1 = new TCanvas("c1","ZDCs + ZEMs signals",400,0,500,800);
288 enZNC->SetLineColor(kBlue);
289 enZNC->SetFillColor(kBlue);
293 enZPC->SetLineColor(kBlue+3);
294 enZPC->SetFillColor(kBlue+3);
297 enZEM1->SetLineColor(kRed);
298 enZEM1->SetFillColor(kRed);
302 enZEM2->SetLineColor(kRed);
303 enZEM2->SetFillColor(kRed);
308 enZNA->SetLineColor(kRed);
309 enZNA->SetFillColor(kRed);
313 enZPA->SetLineColor(kRed+1);
314 enZPA->SetFillColor(kRed+1);
316 //-------------------------------------------------
317 TCanvas *c3 = new TCanvas("c3","Side C ZDCs",0,0,800,400);
321 hZNCTow[0]->SetLineColor(kBlue);
322 hZNCTow[0]->SetFillColor(kBlue);
323 hZNCTow[0]->Draw("");
326 hZNCTow[1]->SetLineColor(kBlue);
327 hZNCTow[1]->SetFillColor(kBlue);
328 hZNCTow[1]->Draw("");
331 hZNCTow[2]->SetLineColor(kBlue);
332 hZNCTow[2]->SetFillColor(kBlue);
333 hZNCTow[2]->Draw("");
336 hZNCTow[3]->SetLineColor(kBlue);
337 hZNCTow[3]->SetFillColor(kBlue);
338 hZNCTow[3]->Draw("");
341 hZNCTow[4]->SetLineColor(kBlue);
342 hZNCTow[4]->SetFillColor(kBlue);
343 hZNCTow[4]->Draw("");
347 hZPCTow[0]->SetLineColor(kBlue+3);
348 hZPCTow[0]->SetFillColor(kBlue+3);
349 hZPCTow[0]->Draw("");
352 hZPCTow[1]->SetLineColor(kBlue+3);
353 hZPCTow[1]->SetFillColor(kBlue+3);
354 hZPCTow[1]->Draw("");
357 hZPCTow[2]->SetLineColor(kBlue+3);
358 hZPCTow[2]->SetFillColor(kBlue+3);
359 hZPCTow[2]->Draw("");
362 hZPCTow[3]->SetLineColor(kBlue+3);
363 hZPCTow[3]->SetFillColor(kBlue+3);
364 hZPCTow[3]->Draw("");
367 hZPCTow[4]->SetLineColor(kBlue+3);
368 hZPCTow[4]->SetFillColor(kBlue+3);
369 hZPCTow[4]->Draw("");
372 //-------------------------------------------------
373 TCanvas *c32 = new TCanvas("c32","side A ZDCs",700,0,800,400);
377 hZNATow[0]->SetLineColor(kRed);
378 hZNATow[0]->SetFillColor(kRed);
379 hZNATow[0]->Draw("");
382 hZNATow[1]->SetLineColor(kRed);
383 hZNATow[1]->SetFillColor(kRed);
384 hZNATow[1]->Draw("");
387 hZNATow[2]->SetLineColor(kRed);
388 hZNATow[2]->SetFillColor(kRed);
389 hZNATow[2]->Draw("");
392 hZNATow[3]->SetLineColor(kRed);
393 hZNATow[3]->SetFillColor(kRed);
394 hZNATow[3]->Draw("");
397 hZNATow[4]->SetLineColor(kRed);
398 hZNATow[4]->SetFillColor(kRed);
399 hZNATow[4]->Draw("");
403 hZPATow[0]->SetLineColor(kRed+1);
404 hZPATow[0]->SetFillColor(kRed+1);
405 hZPATow[0]->Draw("");
408 hZPATow[1]->SetLineColor(kRed+1);
409 hZPATow[1]->SetFillColor(kRed+1);
410 hZPATow[1]->Draw("");
413 hZPATow[2]->SetLineColor(kRed+1);
414 hZPATow[2]->SetFillColor(kRed+1);
415 hZPATow[2]->Draw("");
418 hZPATow[3]->SetLineColor(kRed+1);
419 hZPATow[3]->SetFillColor(kRed+1);
420 hZPATow[3]->Draw("");
423 hZPATow[4]->SetLineColor(kRed+1);
424 hZPATow[4]->SetFillColor(kRed+1);
425 hZPATow[4]->Draw("");
428 TFile * fileout = new TFile("ESDhistos.root","recreate");
430 //centroidZNsideC->Write();
431 //centroidZNsideA->Write();
438 for(Int_t jj=0; jj<5; jj++){
439 hZNCTow[jj]->Write();
440 hZPCTow[jj]->Write();
441 hZNATow[jj]->Write();
442 hZPATow[jj]->Write();