70 |
#include "TMultiGraph.h" |
#include "TMultiGraph.h" |
71 |
#include <sstream> |
#include <sstream> |
72 |
#include <iostream> |
#include <iostream> |
73 |
|
#include <stdio.h> |
74 |
|
#include <string.h> |
75 |
#include "TString.h" |
#include "TString.h" |
76 |
#include "TStyle.h" |
#include "TStyle.h" |
77 |
#include "TFile.h" |
#include "TFile.h" |
108 |
TTree *PhysicsTr = (TTree*)file->Get("Physics"); |
TTree *PhysicsTr = (TTree*)file->Get("Physics"); |
109 |
TBranch *headBr = PhysicsTr->GetBranch("Header"); |
TBranch *headBr = PhysicsTr->GetBranch("Header"); |
110 |
|
|
111 |
pamela::EventHeader *eh = 0; |
pamela::EventHeader *eh = new pamela::EventHeader; |
112 |
pamela::PscuHeader *ph = 0; |
pamela::PscuHeader *ph = new pamela::PscuHeader; |
113 |
|
|
114 |
PhysicsTr->SetBranchAddress("Header", &eh); |
PhysicsTr->SetBranchAddress("Header", &eh); |
115 |
nevents = PhysicsTr->GetEntries(); |
nevents = PhysicsTr->GetEntries(); |
116 |
const Int_t size = nevents; |
const Int_t size = nevents; |
117 |
|
|
118 |
TTree *RunHeadTr = (TTree*)file->Get("RunHeader"); ///run header tree |
TTree *RunHeadTr = (TTree*)file->Get("RunHeader"); ///run header tree |
119 |
pamela::EventHeader *eH=0; |
pamela::EventHeader *eH= new pamela::EventHeader; |
120 |
pamela::RunHeaderEvent *reh=0; |
pamela::RunHeaderEvent *reh=new pamela::RunHeaderEvent; |
121 |
|
|
122 |
RunHeadTr->SetBranchAddress("Header",&eH); |
RunHeadTr->SetBranchAddress("Header",&eH); |
123 |
RunHeadTr->SetBranchAddress("RunHeader",&reh); |
RunHeadTr->SetBranchAddress("RunHeader",&reh); |
124 |
runnevents = RunHeadTr->GetEntries(); |
runnevents = RunHeadTr->GetEntries(); |
125 |
|
|
126 |
TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString(); |
TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString(); |
127 |
filename = ((TObjString*)filename.Tokenize('.')->First())->GetString(); |
filename = ((TObjString*)filename.Tokenize('.')->First())->GetString(); |
128 |
|
|
205 |
TMultiGraph *packeCounter = new TMultiGraph(); |
TMultiGraph *packeCounter = new TMultiGraph(); |
206 |
|
|
207 |
oss1.str(""); |
oss1.str(""); |
208 |
oss1 << filename.Data() <<": Physics Packet per minute. Start time = " << obmin << ", End time = "<< obmax <<" ms"; |
oss1 << "Physics Packet per minute. Start time = " << obmin << ", End time = "<< obmax <<" ms"; |
209 |
TGraph *rate1= new TGraph(nbin, (const Double_t*)Minute, (const Double_t*)Eventsperminute); |
TGraph *rate1= new TGraph(nbin, (const Double_t*)Minute, (const Double_t*)Eventsperminute); |
210 |
rate1->SetMarkerColor(kBlack); |
rate1->SetMarkerColor(kBlack); |
211 |
rate1->SetMarkerSize(.1); |
rate1->SetMarkerSize(.1); |
214 |
|
|
215 |
TGraph *packetLength1= new TGraph(nevents, (const Double_t*)OBTime, (const Double_t*)PacketLenght); |
TGraph *packetLength1= new TGraph(nevents, (const Double_t*)OBTime, (const Double_t*)PacketLenght); |
216 |
oss2.str(""); |
oss2.str(""); |
217 |
oss2 << filename.Data() <<": Lenght of Physic packets"; |
oss2 <<"Lenght of Physic packets"; |
218 |
packetLength1->SetMarkerColor(2); |
packetLength1->SetMarkerColor(2); |
219 |
packetLength1->SetMarkerSize(.5); |
packetLength1->SetMarkerSize(.3); |
220 |
packetLength1->SetMarkerStyle(21); |
packetLength1->SetMarkerStyle(21); |
221 |
packetLength->Add(packetLength1); |
packetLength->Add(packetLength1); |
222 |
|
|
223 |
TGraph *packeCounter1= new TGraph(nevents, (const Double_t*)OBTime, (const Double_t*)PscuCounter); |
TGraph *packeCounter1= new TGraph(nevents, (const Double_t*)OBTime, (const Double_t*)PscuCounter); |
224 |
oss3.str(""); |
oss3.str(""); |
225 |
oss3 << filename.Data() <<": Physics Counter vs. OBT"; |
oss3 <<"Physics Counter vs. OBT"; |
226 |
packeCounter1->SetMarkerColor(4); |
packeCounter1->SetMarkerColor(4); |
227 |
packeCounter1->SetMarkerSize(.2); |
packeCounter1->SetMarkerSize(.2); |
228 |
packeCounter1->SetMarkerStyle(21); |
packeCounter1->SetMarkerStyle(21); |
230 |
|
|
231 |
//------------ Create and Draw Canvas ---------------------// |
//------------ Create and Draw Canvas ---------------------// |
232 |
TCanvas *finalCanv = new TCanvas("Header", base, 1200, 1600); |
TCanvas *finalCanv = new TCanvas("Header", base, 1200, 1600); |
233 |
finalCanv->Divide(1,5); |
finalCanv->Divide(1,6); |
234 |
finalCanv->SetFillColor(10); |
finalCanv->SetFillColor(10); |
235 |
|
|
236 |
TPad *all2= new TPad ("","", 0, 0, 1, 1); |
TPad *all2= new TPad ("","", 0, 0, 1, 1); |
243 |
all->SetFillColor(10); |
all->SetFillColor(10); |
244 |
TPad *all1= new TPad ("","", 0, 0, 1, 1); |
TPad *all1= new TPad ("","", 0, 0, 1, 1); |
245 |
all1->SetFillColor(10); |
all1->SetFillColor(10); |
|
TPad *pad = new TPad("pad","pad", .80,.45,.90,.75); |
|
|
pad->SetFillColor(10); |
|
246 |
|
|
247 |
TLine li; |
TLine li; |
248 |
li.SetLineStyle(4); |
li.SetLineStyle(4); |
278 |
} |
} |
279 |
} |
} |
280 |
|
|
281 |
|
RunHeadTr->GetEntry(0); |
282 |
|
ph = eH->GetPscuHeader(); |
283 |
|
ULong_t TimeSync = reh->LAST_TIME_SYNC_INFO; |
284 |
|
ULong_t ObtSync = reh->OBT_TIME_SYNC; |
285 |
|
//cout<<"TimeSync "<<reh->LAST_TIME_SYNC_INFO<<"\n"; |
286 |
|
//cout<<"ObtSync "<<reh->OBT_TIME_SYNC<<"\n"; |
287 |
|
|
288 |
finalCanv->cd(1); |
finalCanv->cd(1); |
289 |
stringstream ws1, ws2; |
stringstream ws1, ws2; |
290 |
ws1.str(""); |
ws1.str(""); |
371 |
Int_t numkey; |
Int_t numkey; |
372 |
TObject *key = new TObject; |
TObject *key = new TObject; |
373 |
const char *name; |
const char *name; |
374 |
|
char *SoftInfo="SoftInfo"; |
375 |
TTree* tr = new TTree; |
TTree* tr = new TTree; |
376 |
Long64_t nevntskey=0; |
Long64_t nevntskey=0; |
377 |
list = file->GetListOfKeys(); |
list = file->GetListOfKeys(); |
378 |
numkey = file->GetNkeys(); |
numkey = file->GetNkeys(); |
379 |
Double_t salto; |
ULong_t salto; |
380 |
for (Int_t m=0; m<numkey; m++){ |
for (Int_t m=0; m<numkey; m++){ |
381 |
|
if(m==numkey)continue; |
382 |
key = list->At(m); |
key = list->At(m); |
383 |
name=(char *)(key->GetName()); |
name=(char *)(key->GetName()); |
384 |
|
if(strcmp(name,SoftInfo)==0)continue; |
385 |
tr = (TTree*)file->Get(name); |
tr = (TTree*)file->Get(name); |
386 |
if (tr->IsZombie()) continue; |
if (tr->IsZombie()) continue; |
387 |
|
|
388 |
tr->SetBranchAddress("Header", &eh); |
tr->SetBranchAddress("Header", &eh); |
389 |
TBranch *Br = tr->GetBranch("Header"); |
TBranch *Br = tr->GetBranch("Header"); |
390 |
nevntskey = tr->GetEntries(); |
nevntskey = tr->GetEntries(); |
|
|
|
391 |
if(nevntskey !=0){ |
if(nevntskey !=0){ |
392 |
Int_t size1=nevntskey; |
Int_t size1=nevntskey; |
393 |
Double_t *PscuCounter1 = new Double_t[size1]; |
Double_t *PscuCounter1 = new Double_t[size1]; |
416 |
} |
} |
417 |
n++; |
n++; |
418 |
} |
} |
419 |
|
|
420 |
TGraph *graph3= new TGraph(nevntskey, (const Double_t*)FileOffset1, (const Double_t*)PscuCounter1); |
TGraph *graph3= new TGraph(nevntskey, (const Double_t*)FileOffset1, (const Double_t*)PscuCounter1); |
421 |
graph3->SetMarkerColor(3); |
graph3->SetMarkerColor(3); |
422 |
graph3->SetMarkerSize(.2); |
graph3->SetMarkerSize(.2); |
442 |
all1->cd(); |
all1->cd(); |
443 |
|
|
444 |
oss1.str(""); |
oss1.str(""); |
445 |
oss1 << filename.Data() <<": PscuCounter vs FileOffset."; |
oss1 <<"PscuCounter vs FileOffset."; |
446 |
mg1->Draw("AP"); |
mg1->Draw("AP"); |
447 |
mg1->GetXaxis()->SetTitle("File Offset"); |
mg1->GetXaxis()->SetTitle("File Offset"); |
448 |
mg1->GetXaxis()->CenterTitle(); |
mg1->GetXaxis()->CenterTitle(); |
467 |
finalCanv->cd(5); |
finalCanv->cd(5); |
468 |
all->Draw(); |
all->Draw(); |
469 |
all->cd(); |
all->cd(); |
|
|
|
470 |
oss3.str(""); |
oss3.str(""); |
471 |
oss3 << filename.Data() <<" OBT vs FileOffset. First packet at "<<primotempo <<" ms, last packet at "<<ultimotempo<<" ms."; |
oss3 << "OBT vs FileOffset"; |
472 |
mg2->Draw("AP"); |
mg2->Draw("AP"); |
473 |
mg2->GetXaxis()->SetTitle("File Offset"); |
mg2->GetXaxis()->SetTitle("File Offset"); |
474 |
mg2->GetXaxis()->CenterTitle(); |
mg2->GetXaxis()->CenterTitle(); |
479 |
mg2->GetYaxis()->SetTitleSize(0.06); |
mg2->GetYaxis()->SetTitleSize(0.06); |
480 |
mg2->GetYaxis()->SetLabelSize(0.05); |
mg2->GetYaxis()->SetLabelSize(0.05); |
481 |
mg2->GetYaxis()->SetTitleOffset(0.6); |
mg2->GetYaxis()->SetTitleOffset(0.6); |
|
pad->Draw(); |
|
|
pad->cd(); |
|
|
stringa.str(""); |
|
|
stringa << "jump at: "<<salto<<" ms \n"; |
|
|
if(salto != primotempo) lat->DrawLatex(0.08, 0.8,stringa.str().c_str()); |
|
482 |
|
|
483 |
finalCanv->cd(5); |
finalCanv->cd(5); |
484 |
TPaveText *pt4=0; |
TPaveText *pt4=0; |
485 |
pt4 = new TPaveText (.38 ,.91,.92,1); |
pt4 = new TPaveText (.70,.91,.90,1); |
486 |
pt4->AddText(oss3.str().c_str()); |
pt4->AddText(oss3.str().c_str()); |
487 |
pt4->SetTextColor(kBlue); |
pt4->SetTextColor(kBlue); |
488 |
pt4->SetFillColor(10); |
pt4->SetFillColor(10); |
489 |
pt4->SetBorderSize(0); |
pt4->SetBorderSize(0); |
490 |
pt4->Draw(); |
pt4->Draw(); |
491 |
|
|
492 |
|
finalCanv->cd(6); |
493 |
|
ULong_t primotempoABS=TimeSync+((primotempo/1000)-ObtSync); |
494 |
|
ULong_t obmaxABS=TimeSync+((lastime/1000)-ObtSync); |
495 |
|
ULong_t saltoABS=TimeSync+((salto/1000)-ObtSync); |
496 |
|
ULong_t ultimotempoABS=TimeSync+((ultimotempo/1000)-ObtSync); |
497 |
|
|
498 |
|
TPaveText *pt5=0; |
499 |
|
pt5 = new TPaveText (0,0,1,1); |
500 |
|
stringa.str(""); |
501 |
|
stringa << " Filename: "<<filename.Data()<<"\n"; |
502 |
|
TText *t1=pt5->AddText(0.25,0.95,stringa.str().c_str()); |
503 |
|
t1->SetTextSize(0.1); |
504 |
|
stringa.str(""); |
505 |
|
stringa << " OBT (ms) ABS TIME (s)"; |
506 |
|
TText *t2=pt5->AddText(0.32,0.75,stringa.str().c_str()); |
507 |
|
t2->SetTextSize(0.07); |
508 |
|
stringa.str(""); |
509 |
|
stringa << "New data start at: "<<primotempo<<" "<<primotempoABS; |
510 |
|
TText *t3=pt5->AddText(0.25,0.60,stringa.str().c_str()); |
511 |
|
t3->SetTextSize(0.08); |
512 |
|
stringa.str(""); |
513 |
|
stringa << "New data end at: "<<lastime<<" "<<obmaxABS; |
514 |
|
TText *t4=pt5->AddText(0.25,0.50,stringa.str().c_str()); |
515 |
|
t4->SetTextSize(0.08); |
516 |
|
if(primotempo!=salto || lastime!=ultimotempo){ |
517 |
|
stringa.str(""); |
518 |
|
stringa << "Old data start at: "<<salto<<" "<<saltoABS; |
519 |
|
TText *t5=pt5->AddText(0.65,0.60,stringa.str().c_str()); |
520 |
|
t5->SetTextSize(0.08); |
521 |
|
stringa.str(""); |
522 |
|
stringa << "Old data end at: "<<ultimotempo<<" "<<ultimotempoABS; |
523 |
|
TText *t6=pt5->AddText(0.65,0.50,stringa.str().c_str()); |
524 |
|
t6->SetTextSize(0.08); |
525 |
|
stringa.str(""); |
526 |
|
stringa << " OBT (ms) ABS TIME (s)"; |
527 |
|
TText *t2=pt5->AddText(0.72,0.75,stringa.str().c_str()); |
528 |
|
t2->SetTextSize(0.07); |
529 |
|
} |
530 |
|
pt5->SetTextColor(kBlack); |
531 |
|
pt5->SetFillColor(10); |
532 |
|
pt5->SetBorderSize(0); |
533 |
|
pt5->Draw(); |
534 |
|
|
535 |
finalCanv->Update(); |
finalCanv->Update(); |
536 |
|
|
537 |
oss1.str(""); |
oss1.str(""); |