1 |
/** |
/** |
2 |
* Header Scan |
* Header_Scan |
3 |
* Author Nagni |
* Author Nagni |
4 |
* version 1.0 |
* version 1.0 |
5 |
* |
* |
85 |
|
|
86 |
//------------------- Variables initilization -------------------------// |
//------------------- Variables initilization -------------------------// |
87 |
Long64_t nevents=0; |
Long64_t nevents=0; |
88 |
ULong_t lastime, firstime,obt, offset, lastoffset, firstoffset; |
ULong_t lastime, firstime,obt;// offset, lastoffset, firstoffset; |
89 |
double obmin=0.; |
double obmin=0.; |
90 |
double obmax=0.; |
double obmax=0.; |
91 |
stringstream oss, oss1, oss2, oss3, noentries; |
stringstream oss, oss1, oss2, oss3, noentries; |
144 |
} |
} |
145 |
|
|
146 |
//-------------- to know the max and min OBT ----------------------------// |
//-------------- to know the max and min OBT ----------------------------// |
147 |
for (Int_t i = 0; i < nevents; i++){ |
for (Int_t i = 0; i < nevents; i++){ |
148 |
headBr->GetEntry(i); |
headBr->GetEntry(i); |
149 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
150 |
obt = ph->GetOrbitalTime(); |
obt = ph->GetOrbitalTime(); |
151 |
offset=ph->GetFileOffset(); |
//if(obt <= firstime) firstime=obt; |
|
if(obt <= firstime) firstime=obt; |
|
152 |
if(obt >= lastime) lastime=obt; |
if(obt >= lastime) lastime=obt; |
153 |
} |
} |
154 |
|
|
|
//*************************** Histograms ************************************************************// |
|
155 |
//------------------------ First histogram -----------------------------------// |
//------------------------ First histogram -----------------------------------// |
156 |
obmin=firstime; |
headBr->GetEntry(0); |
157 |
obmax=lastime; |
ph = eh->GetPscuHeader(); |
158 |
|
firstime = ph->GetOrbitalTime(); |
159 |
|
obmin=firstime; |
160 |
|
obmax=lastime; |
161 |
|
|
162 |
oss1.str(""); |
oss1.str(""); |
163 |
oss1 <<"File name= "<< filename.Data() <<". Start time= " << obmin << ", end time= "<< obmax <<" ms"<<". Physics Packet per minute"; |
oss1 <<"File name= "<< filename.Data() <<". Start time= " << obmin << ", end time= "<< obmax <<" ms"<<". Physics Packet per minute"; |
164 |
Int_t nbin = (lastime-firstime)/60000; |
Int_t nbin = (lastime-firstime)/60000; |
165 |
TH1F *h1 = new TH1F ("histo1", oss1.str().c_str(), nbin, obmin, obmax); |
TH1F *h1 = new TH1F ("histo1", oss1.str().c_str(), nbin, obmin, obmax); |
166 |
|
|
167 |
//------------------------ Second histogram -----------------------------------// |
//------------- Graph PscuCounter vs FileOffset --------------------------------- |
168 |
|
const Int_t size = 10000; |
169 |
|
Int_t ev=0; |
170 |
|
Double_t PscuCounter[size], FileOffset[size], tempo[size], PcktLenght[size]; |
171 |
|
Int_t m=0; |
172 |
|
Int_t pag= (nevents/10000)+1; |
173 |
|
|
174 |
|
TMultiGraph *mg1 = new TMultiGraph(); |
175 |
|
oss1.str(""); |
176 |
|
oss1 << filename.Data() <<": PscuCounter vs FileOffset."; |
177 |
|
mg1->SetTitle(oss1.str().c_str()); |
178 |
|
|
179 |
|
TMultiGraph *mg2 = new TMultiGraph(); |
180 |
|
oss1.str(""); |
181 |
|
oss1 << filename.Data() <<": OBT vs FileOffset."; |
182 |
|
mg2->SetTitle(oss1.str().c_str()); |
183 |
|
|
184 |
|
TMultiGraph *mg3 = new TMultiGraph(); |
185 |
oss2.str(""); |
oss2.str(""); |
186 |
oss2 << " Lenght of Physic packets;"; |
oss2 << filename.Data() <<": Lenght of Physic packets"; |
187 |
Int_t nint = (lastime-firstime); |
mg3->SetTitle(oss2.str().c_str()); |
|
TH1F *PcktLenght = new TH1F ("histo2", oss2.str().c_str(), nint, obmin, obmax); |
|
188 |
|
|
189 |
//------------------------ Third histogram -----------------------------------// |
TMultiGraph *mg4 = new TMultiGraph(); |
190 |
oss3.str(""); |
oss3.str(""); |
191 |
oss3 << " Physics Counter"; |
oss3 << filename.Data() <<": Physics Counter"; |
192 |
TH1F *PcktCounter = new TH1F ("histo3", oss3.str().c_str(), nint, obmin, obmax); |
mg4->SetTitle(oss3.str().c_str()); |
193 |
|
|
|
//**************************************************************************************************// |
|
|
//------- fill histograms ---------// |
|
|
Int_t l=0; |
|
|
for (Int_t i = 0; i < nevents; i++){ |
|
|
headBr->GetEntry(i); |
|
|
ph = eh->GetPscuHeader(); |
|
|
h1->Fill(ph->GetOrbitalTime()); |
|
|
PcktLenght->Fill(ph->GetOrbitalTime(),ph->GetPacketLenght()); |
|
|
PcktCounter->Fill(ph->GetOrbitalTime(),ph->GetCounter()); |
|
|
} |
|
|
|
|
|
//****************************** Canvases *******************************// |
|
|
//TGaxis::SetMaxDigits(4); |
|
|
//------------------- First Canvas --------------------------------// |
|
194 |
TCanvas *finalCanv1 = new TCanvas("Header_1", base, 1280, 1024); |
TCanvas *finalCanv1 = new TCanvas("Header_1", base, 1280, 1024); |
195 |
finalCanv1->Divide(1,3); |
finalCanv1->Divide(1,3); |
196 |
finalCanv1->SetFillColor(10); |
finalCanv1->SetFillColor(10); |
197 |
|
|
198 |
|
TCanvas *finalCanv2 = new TCanvas("Header_2", base, 1280, 1024); |
199 |
|
finalCanv2->Divide(1,2); |
200 |
|
finalCanv2->SetFillColor(10); |
201 |
|
|
202 |
|
/////ciclo sulle pagine//////////////////// |
203 |
|
for (Int_t interval=0; interval<pag; interval++){ |
204 |
|
|
205 |
|
for (Int_t l = 0; l < size; l++){ //ciclo su un sottogruppo |
206 |
|
headBr->GetEntry(ev+l); |
207 |
|
ph = eh->GetPscuHeader(); |
208 |
|
PscuCounter[l]= ph->GetCounter(); // = PcktCounter[l] |
209 |
|
FileOffset[l]=ph->GetFileOffset(); |
210 |
|
tempo[l]=ph->GetOrbitalTime(); |
211 |
|
PcktLenght[l]=ph->GetPacketLenght(); |
212 |
|
h1->Fill(ph->GetOrbitalTime()); |
213 |
|
m=l; |
214 |
|
} |
215 |
|
|
216 |
|
TGraph *graph1= new TGraph(m, tempo, PcktLenght); |
217 |
|
graph1->SetMarkerColor(2); |
218 |
|
graph1->SetMarkerSize(.5); |
219 |
|
graph1->SetMarkerStyle(21); |
220 |
|
mg3->Add(graph1); |
221 |
|
|
222 |
|
TGraph *graph2= new TGraph(m, tempo, PscuCounter); |
223 |
|
graph2->SetMarkerColor(4); |
224 |
|
graph2->SetMarkerSize(.5); |
225 |
|
graph2->SetMarkerStyle(21); |
226 |
|
mg4->Add(graph2); |
227 |
|
|
228 |
|
TGraph *graph3= new TGraph(m, FileOffset, PscuCounter); |
229 |
|
graph3->SetMarkerColor(3); |
230 |
|
graph3->SetMarkerSize(.5); |
231 |
|
graph3->SetMarkerStyle(21); |
232 |
|
mg1->Add(graph3); |
233 |
|
|
234 |
|
TGraph *graph4= new TGraph(m, FileOffset, tempo); |
235 |
|
graph4->SetMarkerColor(kBlue); |
236 |
|
graph4->SetMarkerSize(.5); |
237 |
|
graph4->SetMarkerStyle(21); |
238 |
|
mg2->Add(graph4); |
239 |
|
|
240 |
|
ev=ev+10000; |
241 |
|
} |
242 |
|
//------------ First Canvas ---------------------// |
243 |
|
|
244 |
finalCanv1->cd(1); |
finalCanv1->cd(1); |
245 |
h1->SetStats(kFALSE); |
h1->SetStats(kFALSE); |
246 |
h1->GetXaxis()->SetTitle("OBT (ms)"); |
h1->GetXaxis()->SetTitle("OBT (ms)"); |
253 |
h1->Draw(); |
h1->Draw(); |
254 |
|
|
255 |
finalCanv1->cd(2); |
finalCanv1->cd(2); |
256 |
PcktLenght->SetStats(kFALSE); |
mg3->Draw("AP"); |
257 |
PcktLenght->GetXaxis()->SetTitle("OBT (ms)"); |
mg3->GetXaxis()->SetTitle("OBT (ms)"); |
258 |
PcktLenght->GetXaxis()->CenterTitle(); |
mg3->GetXaxis()->CenterTitle(); |
259 |
PcktLenght->GetXaxis()->SetLabelSize(0.04); |
mg3->GetXaxis()->SetLabelSize(0.04); |
260 |
PcktLenght->GetYaxis()->SetTitle("Lenght (byte)"); |
mg3->GetYaxis()->SetTitle("Lenght (byte)"); |
261 |
PcktLenght->GetYaxis()->CenterTitle(); |
mg3->GetYaxis()->CenterTitle(); |
262 |
PcktLenght->GetYaxis()->SetLabelSize(0.04); |
mg3->GetYaxis()->SetLabelSize(0.04); |
263 |
PcktLenght->GetYaxis()->SetTitleSize(0.06); |
mg3->GetYaxis()->SetTitleSize(0.06); |
264 |
PcktLenght->GetYaxis()->SetTitleOffset(0.8); |
mg3->GetYaxis()->SetTitleOffset(0.8); |
265 |
PcktLenght->SetMarkerColor(2); |
|
|
PcktLenght->SetMarkerSize(.5); |
|
|
PcktLenght->SetMarkerStyle(21); |
|
|
PcktLenght->Draw("9p"); |
|
266 |
|
|
267 |
finalCanv1->cd(3); |
finalCanv1->cd(3); |
268 |
PcktCounter->SetStats(kFALSE); |
mg4->Draw("AP"); |
269 |
PcktCounter->GetXaxis()->SetTitle("OBT (ms)"); |
mg4->GetXaxis()->SetTitle("OBT (ms)"); |
270 |
PcktCounter->GetXaxis()->SetTitleSize(0.05); |
mg4->GetXaxis()->SetTitleSize(0.05); |
271 |
PcktCounter->GetXaxis()->CenterTitle(); |
mg4->GetXaxis()->CenterTitle(); |
272 |
PcktCounter->GetXaxis()->SetLabelSize(0.04); |
mg4->GetXaxis()->SetLabelSize(0.04); |
273 |
PcktCounter->GetYaxis()->SetTitle("Counter"); |
mg4->GetYaxis()->SetTitle("Counter"); |
274 |
PcktCounter->GetYaxis()->SetTitleSize(0.05); |
mg4->GetYaxis()->SetTitleSize(0.05); |
275 |
PcktCounter->GetYaxis()->CenterTitle(); |
mg4->GetYaxis()->CenterTitle(); |
276 |
PcktCounter->GetYaxis()->SetLabelSize(0.04); |
mg4->GetYaxis()->SetLabelSize(0.04); |
277 |
PcktCounter->GetYaxis()->SetTitleSize(0.06); |
mg4->GetYaxis()->SetTitleSize(0.06); |
278 |
PcktCounter->GetYaxis()->SetTitleOffset(0.8); |
mg4->GetYaxis()->SetTitleOffset(0.8); |
|
PcktCounter->SetMarkerColor(4); |
|
|
PcktCounter->SetMarkerSize(.5); |
|
|
PcktCounter->SetMarkerStyle(21); |
|
|
PcktCounter->Draw("9p"); |
|
279 |
|
|
280 |
|
finalCanv1->Update(); |
281 |
|
|
282 |
oss.str(""); |
oss.str(""); |
283 |
oss << outDir.Data() << filename.Data(); |
oss << outDir.Data() << filename.Data(); |
284 |
oss << "_HeaderScan_1." << format.Data(); |
oss << "_HeaderScan_1." << format.Data(); |
285 |
finalCanv1->SaveAs(oss.str().c_str()); |
finalCanv1->SaveAs(oss.str().c_str()); |
286 |
|
|
287 |
|
|
|
//------------- Graph PscuCounter vs FileOffset --------------------------------- |
|
|
const Int_t size = 100000; |
|
|
Int_t ev=0; |
|
|
Double_t PscuCounter[size], FileOffset[size]; |
|
|
Int_t m=0; |
|
|
Int_t pag= (nevents/100000)+1; |
|
|
|
|
|
TMultiGraph *mg1 = new TMultiGraph(); |
|
|
oss1.str(""); |
|
|
oss1 << filename.Data() <<": PscuCounter vs FileOffset."; |
|
|
mg1->SetTitle(oss1.str().c_str()); |
|
|
|
|
|
TCanvas *finalCanv2 = new TCanvas("Header_2", base, 1280, 1024); |
|
|
finalCanv2->SetFillColor(10); |
|
|
|
|
|
/////ciclo sulle pagine//////////////////// |
|
|
for (Int_t interval=0; interval<pag; interval++){ |
|
|
|
|
|
for (Int_t l = 0; l < size; l++){ //ciclo su un sottogruppo |
|
|
headBr->GetEntry(ev+l); |
|
|
ph = eh->GetPscuHeader(); |
|
|
PscuCounter[l]= ph->GetCounter(); |
|
|
FileOffset[l]=ph->GetFileOffset(); |
|
|
m=l; |
|
|
} |
|
|
|
|
|
TGraph *graph= new TGraph(m, FileOffset, PscuCounter); |
|
|
graph->SetMarkerColor(3); |
|
|
graph->SetMarkerSize(.5); |
|
|
graph->SetMarkerStyle(21); |
|
|
mg1->Add(graph); |
|
288 |
|
|
289 |
ev=ev+100000; |
//------------ Second Canvas ---------------------// |
290 |
} |
finalCanv2->cd(1); |
|
finalCanv2->cd(); |
|
291 |
mg1->Draw("AP"); |
mg1->Draw("AP"); |
|
mg1->SetTitle(oss1.str().c_str()); |
|
292 |
mg1->GetXaxis()->SetTitle("File Offset"); |
mg1->GetXaxis()->SetTitle("File Offset"); |
293 |
mg1->GetXaxis()->CenterTitle(); |
mg1->GetXaxis()->CenterTitle(); |
294 |
mg1->GetXaxis()->SetTitleSize(0.04); |
mg1->GetXaxis()->SetTitleSize(0.05); |
295 |
mg1->GetXaxis()->SetLabelSize(0.02); |
mg1->GetXaxis()->SetLabelSize(0.04); |
296 |
mg1->GetYaxis()->SetTitle("Counter"); |
mg1->GetYaxis()->SetTitle("Counter"); |
297 |
mg1->GetYaxis()->CenterTitle(); |
mg1->GetYaxis()->CenterTitle(); |
298 |
mg1->GetYaxis()->SetTitleSize(0.04); |
mg1->GetYaxis()->SetTitleSize(0.05); |
299 |
mg1->GetYaxis()->SetLabelSize(0.02); |
mg1->GetYaxis()->SetLabelSize(0.04); |
300 |
|
|
301 |
|
finalCanv2->cd(2); |
302 |
|
mg2->Draw("AP"); |
303 |
|
mg2->GetXaxis()->SetTitle("File Offset"); |
304 |
|
mg2->GetXaxis()->CenterTitle(); |
305 |
|
mg2->GetXaxis()->SetTitleSize(0.05); |
306 |
|
mg2->GetXaxis()->SetLabelSize(0.04); |
307 |
|
mg2->GetYaxis()->SetTitle("OBT"); |
308 |
|
mg2->GetYaxis()->CenterTitle(); |
309 |
|
mg2->GetYaxis()->SetTitleSize(0.05); |
310 |
|
mg2->GetYaxis()->SetLabelSize(0.04); |
311 |
|
|
|
|
|
312 |
finalCanv2->Update(); |
finalCanv2->Update(); |
313 |
|
|
314 |
oss1.str(""); |
oss1.str(""); |
316 |
oss1 << "_HeaderScan_2"<<"." << format.Data(); |
oss1 << "_HeaderScan_2"<<"." << format.Data(); |
317 |
|
|
318 |
finalCanv2->SaveAs(oss1.str().c_str()); |
finalCanv2->SaveAs(oss1.str().c_str()); |
319 |
|
|
320 |
file->Close(); |
file->Close(); |
321 |
|
|
322 |
} |
} |