]>
Commit | Line | Data |
---|---|---|
8d03668d | 1 | #if !defined(__CINT__) || defined(__MAKECINT__) |
2 | #include <Riostream.h> | |
3 | #include <TSystem.h> | |
4 | #include <TRandom.h> | |
5 | #include <TROOT.h> | |
6 | #include <TStyle.h> | |
7 | #include <TCanvas.h> | |
8 | #include <TGraphErrors.h> | |
9 | #include <TGrid.h> | |
10 | #include <TFile.h> | |
11 | #include "AliCDBEntry.h" | |
12 | #include "AliCDBGrid.h" | |
13 | #include "AliCDBId.h" | |
14 | #include "AliCDBLocal.h" | |
15 | #include "AliCDBManager.h" | |
16 | #include "AliCDBMetaData.h" | |
17 | #include "AliCDBPath.h" | |
18 | #include "AliCDBRunRange.h" | |
19 | #include "AliCDBStorage.h" | |
20 | #include "AliDCSValue.h" | |
21 | #include "AliZDC.h" | |
22 | #include "AliZDCv3.h" | |
23 | #include "AliZDCPedestals.h" | |
24 | #include "AliZDCEnCalib.h" | |
25 | #include "AliZDCTowerCalib.h" | |
26 | #include "AliZDCChMap.h" | |
27 | #include "AliZDCLaserCalib.h" | |
28 | #include "AliZDCMBCalib.h" | |
29 | #include "AliZDCDataDCS.h" | |
30 | ||
31 | #endif | |
32 | ||
33 | ||
34 | void PlotPedestalsvsTime(Int_t year=2010, Int_t firstRun=111000, | |
35 | Int_t lastRun=999999999) | |
36 | { | |
37 | ||
38 | ||
39 | TGrid::Connect("alien:",0,0,"t"); | |
40 | gSystem->Exec(Form("gbbox find \"/alice/data/%d/OCDB/ZDC/Calib/Pedestals/\" \"Run*.root\" > calibAlienFiles.txt",year)); | |
41 | FILE* listruns=fopen("calibAlienFiles.txt","r"); | |
42 | ||
43 | const int kNchannels=24; | |
44 | TGraphErrors* graph[24]; | |
45 | for(Int_t i=0; i<kNchannels; i++){ | |
46 | graph[i] = new TGraphErrors(0); | |
47 | char name[50], title[50]; | |
48 | sprintf(name,"graph%d",i); sprintf(title,"Pedestal ch.%d vs. run#",i); | |
49 | graph[i]->SetName("graph"); graph[i]->SetTitle("title"); | |
50 | } | |
51 | ||
52 | Char_t filnam[200], filnamalien[200]; | |
53 | Int_t iPoint=0; | |
54 | Int_t nrun, nrun2, nv, ns; | |
55 | ||
56 | while(!feof(listruns)){ | |
57 | int st = fscanf(listruns,"%s\n",filnam); | |
58 | Char_t directory[100]; | |
59 | sprintf(directory,"/alice/data/%d",year); | |
60 | if(!strstr(filnam,directory)) continue; | |
61 | sscanf(filnam,"/alice/data/%d/OCDB/ZDC/Calib/Pedestals/Run%d_%d_v%d_s%d.root",&year,&nrun,&nrun2,&nv,&ns); | |
62 | if(nrun<firstRun) continue; | |
63 | if(nrun>lastRun) continue; | |
64 | sprintf(filnamalien,"alien://%s",filnam); | |
65 | printf("Opening file: %s\n",filnam); | |
66 | TFile *f = TFile::Open(filnamalien); | |
67 | AliCDBEntry *entry = (AliCDBEntry*)f->Get("AliCDBEntry"); | |
68 | AliZDCPedestals *calibdata = dynamic_cast<AliZDCPedestals*> (entry->GetObject()); | |
69 | ||
70 | for(int i=0; i<kNchannels; i++){ | |
71 | graph[i]->SetPoint(iPoint, (Double_t)nrun, calibdata->GetMeanPed(i)); | |
72 | graph[i]->SetPointError(iPoint, 0., calibdata->GetMeanPedWidth(i)); | |
73 | /*printf("Filling graph %d for RUN %d: entry %d - pedValue %1.2f\n", | |
74 | i,nrun,iPoint,calibdata->GetMeanPed(i));*/ | |
75 | } | |
76 | iPoint++; | |
77 | f->Close(); | |
78 | } | |
79 | ||
80 | TFile *outfile=new TFile(Form("Calib%dVsTime.root",year),"recreate"); | |
81 | outfile->cd(); | |
82 | for(int i=0; i<kNchannels; i++) graph[i]->Write(); | |
83 | outfile->Close(); | |
84 | ||
85 | //*********************************************************** | |
86 | // #### ROOT initialization | |
87 | gROOT->Reset(); | |
88 | gStyle->SetCanvasColor(10); | |
89 | gStyle->SetFrameFillColor(10); | |
90 | gStyle->SetOptTitle(0); | |
91 | gStyle->SetOptStat(1111); | |
92 | gStyle->SetOptFit(0); | |
93 | gStyle->SetTitleTextColor(4); | |
94 | gStyle->SetStatTextColor(4); | |
95 | gStyle->SetStatX(0.92); | |
96 | gStyle->SetStatY(0.92); | |
97 | gStyle->SetLineColor(1); | |
98 | gStyle->SetPalette(1); | |
99 | gStyle->SetPadTopMargin(0.05); | |
100 | gStyle->SetPadRightMargin(0.05); | |
101 | gStyle->SetPadBottomMargin(0.09); | |
102 | gStyle->SetPadLeftMargin(0.09); | |
103 | gStyle->SetTitleOffset(1.1,"Y"); | |
104 | // ************************************************************* | |
105 | ||
106 | TCanvas *cHadPeds = new TCanvas("cHadPeds","Hadronic ZDC pedestals",0,0,900,700); | |
107 | cHadPeds->Divide(5,4); | |
108 | for(int ic=0; ic<5; ic++){ | |
109 | // *** ZNC pedestals | |
110 | cHadPeds->cd(ic+1); | |
111 | // | |
112 | TH1F *haxis1 = gPad->DrawFrame(firstRun-100, 20, lastRun+100, 90); | |
113 | haxis1->GetXaxis()->SetNoExponent(); | |
114 | haxis1->SetXTitle("RUN no."); | |
115 | haxis1->SetYTitle("ZNC pedestals"); | |
116 | // | |
117 | graph[ic]->SetMarkerStyle(20); | |
118 | graph[ic]->SetMarkerColor(kBlue); | |
119 | graph[ic]->Draw("P"); | |
120 | // *** ZPC pedestals | |
121 | cHadPeds->cd(ic+6); | |
122 | // | |
123 | TH1F *haxis2 = gPad->DrawFrame(firstRun-100, 20, lastRun+100, 90); | |
124 | haxis2->GetXaxis()->SetNoExponent(); | |
125 | haxis2->SetXTitle("RUN no."); | |
126 | haxis2->SetYTitle("ZPC pedestals"); | |
127 | // | |
128 | graph[ic+5]->SetMarkerStyle(21); | |
129 | graph[ic+5]->SetMarkerColor(kBlue+3); | |
130 | graph[ic+5]->Draw("P"); | |
131 | // *** ZNA pedestals | |
132 | cHadPeds->cd(ic+11); | |
133 | // | |
134 | TH1F *haxis3 = gPad->DrawFrame(firstRun-100, 20, lastRun+100, 90); | |
135 | haxis3->GetXaxis()->SetNoExponent(); | |
136 | haxis3->SetXTitle("RUN no."); | |
137 | haxis3->SetYTitle("ZNA pedestals"); | |
138 | // | |
139 | graph[ic+12]->SetMarkerStyle(20); | |
140 | graph[ic+12]->SetMarkerColor(kRed); | |
141 | graph[ic+12]->Draw("P"); | |
142 | // *** ZPA pedestals | |
143 | cHadPeds->cd(ic+16); | |
144 | // | |
145 | TH1F *haxis4 = gPad->DrawFrame(firstRun-100, 20, lastRun+100, 90); | |
146 | haxis4->GetXaxis()->SetNoExponent(); | |
147 | haxis4->SetXTitle("RUN no."); | |
148 | haxis4->SetYTitle("ZPA pedestals"); | |
149 | // | |
150 | graph[ic+17]->SetMarkerStyle(21); | |
151 | graph[ic+17]->SetMarkerColor(kRed+1); | |
152 | graph[ic+17]->Draw("P"); | |
153 | } | |
154 | cHadPeds->SaveAs("ZDCPedvsTime1.gif"); | |
155 | ||
156 | TCanvas *cothPeds = new TCanvas("cothPeds","ZEM + Ref. pedestals",800,0,600,600); | |
157 | cothPeds->Divide(2,2); | |
158 | for(int ic=0; ic<2; ic++){ | |
159 | // *** ZEM pedestals | |
160 | cothPeds->cd(ic+1); | |
161 | // | |
162 | TH1F *haxis5 = gPad->DrawFrame(firstRun-100, 20, lastRun+20, 90); | |
163 | haxis5->GetXaxis()->SetNoExponent(); | |
164 | haxis5->SetXTitle("RUN no."); | |
165 | haxis5->SetYTitle("ZEM pedestals"); | |
166 | // | |
4e7117ba | 167 | graph[ic+10]->SetMarkerStyle(22); |
168 | graph[ic+10]->SetMarkerColor(kGreen+1); | |
169 | graph[ic+10]->Draw("P"); | |
8d03668d | 170 | // *** Ref. pedestals |
171 | cothPeds->cd(ic+3); | |
172 | // | |
173 | TH1F *haxis6 = gPad->DrawFrame(firstRun-100, 20, lastRun+100, 90); | |
174 | haxis6->GetXaxis()->SetNoExponent(); | |
175 | haxis6->SetXTitle("RUN no."); | |
176 | haxis6->SetYTitle("PMRef. pedestals"); | |
177 | // | |
178 | graph[ic+22]->SetMarkerStyle(23); | |
179 | graph[ic+22]->SetMarkerColor(kGreen+4); | |
180 | graph[ic+22]->Draw("P"); | |
181 | } | |
182 | cothPeds->SaveAs("ZDCPedvsTime2.gif"); | |
183 | ||
184 | } |