1 |
/** |
/** |
2 |
* Header Scan |
* Header_Scan |
3 |
* Author Nagni |
* Author Nagni |
4 |
* version 1.0 |
* version 1.0 |
5 |
* |
* |
49 |
* Date 16 June 2006 - Malvezzi |
* Date 16 June 2006 - Malvezzi |
50 |
* |
* |
51 |
* Description of changes: |
* Description of changes: |
52 |
* Implementation of case: numebr of events are <= 0. |
* Implementation of the case: numebr of events <= 0. |
53 |
* Remove of the graph "grPcktId1"; see PacketScan for the same information. |
* Remove graph "grPcktId1"; see PacketScan for the same information. |
54 |
* Fixed bugs: for a large namber of events is not possible to have vectors, so all graphs have been converted in histograms |
* Fixed bugs: for a large namber of events is not possible to have vectors, so I have subsituted graphs with histograms |
55 |
|
* or divided the graphs in more than one canvas. |
56 |
|
* |
57 |
|
* Version 1.8 |
58 |
|
* Date 8 August 2006 - Malvezzi |
59 |
|
* |
60 |
|
* Description: changed the scale in the second and third graph of the first canvas; added a pad of text in the second canvas |
61 |
* |
* |
62 |
*/ |
*/ |
63 |
|
|
82 |
#include "TGaxis.h" |
#include "TGaxis.h" |
83 |
#include "EventHeader.h" |
#include "EventHeader.h" |
84 |
#include "PscuHeader.h" |
#include "PscuHeader.h" |
85 |
|
#include "RunHeaderEvent.h" |
86 |
|
#include "TPaveText.h" |
87 |
|
|
88 |
using namespace std; |
using namespace std; |
89 |
|
|
90 |
void HeaderScan(TString base, TString outDir, TString format) |
void HeaderScan(TString base, TString outDir, TString format){ |
|
{ |
|
91 |
|
|
92 |
//------------------- Variables initilization -------------------------// |
//------------------- Variables initilization -------------------------// |
93 |
|
Long64_t nevents=0, runnevents; |
94 |
TList *list = new TList; |
ULong_t lastime, firstime, primotempo, ultimotempo, primoffset=500000000, ultimoffset; |
|
Int_t numkey; |
|
|
TObject *key = new TObject; |
|
|
const char *name; |
|
|
//TTree* tr = new TTree; |
|
|
//TTree* tr1 = new TTree; |
|
|
Long64_t nevents=0; // ev=0, events=0; |
|
|
ULong_t lastime, firstime; |
|
95 |
double obmin=0.; |
double obmin=0.; |
96 |
double obmax=0.; |
double obmax=0.; |
97 |
double obt; |
stringstream oss, oss1, oss2, oss3, noentries, stringa; |
98 |
ULong_t maxoffset, minoffset; |
|
99 |
Float_t pcktLenght =0., pcktCounter=0., offset=0., allCounter=0.; |
//-------------- Load root file, tree and branch -------------------// |
|
stringstream oss, oss1, oss2, oss3, noentries; |
|
|
//------- load root file -------------- |
|
100 |
TFile *file = new TFile(base.Data()); |
TFile *file = new TFile(base.Data()); |
101 |
if (!file){ |
if (!file){ |
102 |
printf("No such file in the directory has been found"); |
printf("No such file in the directory has been found"); |
103 |
return; |
return; |
104 |
} |
} |
105 |
if (outDir == "" ) outDir = "."; |
|
|
list = file->GetListOfKeys(); //get list of trees in the file |
|
|
numkey = file->GetNkeys(); //get number of trees in the file |
|
|
|
|
106 |
TTree *PhysicsTr = (TTree*)file->Get("Physics"); |
TTree *PhysicsTr = (TTree*)file->Get("Physics"); |
107 |
TBranch *headBr = PhysicsTr->GetBranch("Header"); |
TBranch *headBr = PhysicsTr->GetBranch("Header"); |
108 |
|
|
110 |
pamela::PscuHeader *ph = 0; |
pamela::PscuHeader *ph = 0; |
111 |
|
|
112 |
PhysicsTr->SetBranchAddress("Header", &eh); |
PhysicsTr->SetBranchAddress("Header", &eh); |
113 |
|
nevents = PhysicsTr->GetEntries(); |
114 |
nevents = headBr->GetEntries(); |
const Int_t size = nevents; |
115 |
const Int_t sizetot = nevents; |
|
116 |
|
TTree *RunHeadTr = (TTree*)file->Get("RunHeader"); ///run header tree |
117 |
|
pamela::EventHeader *eH=0; |
118 |
|
pamela::RunHeaderEvent *reh=0; |
119 |
|
|
120 |
|
RunHeadTr->SetBranchAddress("Header",&eH); |
121 |
|
RunHeadTr->SetBranchAddress("RunHeader",&reh); |
122 |
|
runnevents = RunHeadTr->GetEntries(); |
123 |
|
|
124 |
TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString(); |
TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString(); |
125 |
filename = ((TObjString*)filename.Tokenize('.')->First())->GetString(); |
filename = ((TObjString*)filename.Tokenize('.')->First())->GetString(); |
126 |
|
|
128 |
if (nevents<=0) { |
if (nevents<=0) { |
129 |
printf("nevents = %i \n", nevents); |
printf("nevents = %i \n", nevents); |
130 |
printf(" \n"); |
printf(" \n"); |
|
|
|
131 |
TCanvas *canv = new TCanvas("No entries", "No entries ", 400, 200); |
TCanvas *canv = new TCanvas("No entries", "No entries ", 400, 200); |
132 |
canv->SetFillColor(10); |
canv->SetFillColor(10); |
133 |
canv->cd(); |
canv->cd(); |
|
|
|
134 |
TLatex *l = new TLatex(); |
TLatex *l = new TLatex(); |
135 |
l->SetTextAlign(12); |
l->SetTextAlign(12); |
136 |
l->SetTextSize(0.15); |
l->SetTextSize(0.15); |
141 |
noentries.str(""); |
noentries.str(""); |
142 |
noentries<< "No Physics entries for this files"; |
noentries<< "No Physics entries for this files"; |
143 |
l->DrawLatex(0.05, 0.5, noentries.str().c_str()); |
l->DrawLatex(0.05, 0.5, noentries.str().c_str()); |
|
|
|
144 |
if (outDir == "./") { |
if (outDir == "./") { |
145 |
oss.str(""); |
oss.str(""); |
146 |
oss << filename.Data() << "_HeaderScan_QL." << format.Data(); |
oss << filename.Data() << "_HeaderScan_QL." << format.Data(); |
147 |
} else { |
} else { |
148 |
oss.str(""); |
oss.str(""); |
149 |
oss << outDir.Data() << filename.Data() << "_HeaderScan_QL." << format.Data(); |
oss << outDir.Data() << filename.Data() << "_HeaderScan_QL." << format.Data(); |
150 |
} |
} |
|
|
|
151 |
canv->Update(); |
canv->Update(); |
152 |
canv->SaveAs(oss.str().c_str()); |
canv->SaveAs(oss.str().c_str()); |
|
|
|
153 |
return; |
return; |
154 |
} |
} |
155 |
|
//-------------- to know the max and min OBT ----------------------------// |
156 |
|
headBr->GetEntry(0); |
157 |
///-------------- to know the max and min File Offset ----------------------------// |
ph = eh->GetPscuHeader(); |
158 |
/*for (Int_t i=0; i<numkey; i++){ |
firstime = ph->GetOrbitalTime(); |
159 |
key = list->At(i); |
headBr->GetEntry(nevents); |
160 |
name=(key->GetName()); |
ph = eh->GetPscuHeader(); |
161 |
tr = (TTree*)file->Get(name); |
lastime = ph->GetOrbitalTime(); |
162 |
if (tr->IsZombie()) continue; |
int i =0; |
163 |
events = tr->GetEntries(); |
while(i < nevents){ |
164 |
tr->SetBranchAddress("Header", &eh); |
headBr->GetEntry(i); |
165 |
for (Int_t j = 0; j < events; j++){ |
ph = eh->GetPscuHeader(); |
166 |
tr->GetEntry(j); |
if((ph->GetOrbitalTime()) <= firstime) firstime=ph->GetOrbitalTime(); |
167 |
ph = eh->GetPscuHeader(); |
if((ph->GetOrbitalTime()) >= lastime) lastime=ph->GetOrbitalTime(); |
168 |
ph->GetFileOffset(); |
i++; |
169 |
if(ph->GetFileOffset() <= minoffset) minoffset=ph->GetFileOffset(); |
} |
170 |
if(ph->GetFileOffset() >= maxoffset) maxoffset=ph->GetFileOffset(); |
|
|
} |
|
|
}*/ |
|
|
//*************************** Histograms ************************************************************// |
|
171 |
//------------------------ First histogram -----------------------------------// |
//------------------------ First histogram -----------------------------------// |
|
headBr->GetEntry(0); |
|
|
ph = eh->GetPscuHeader(); |
|
|
firstime = ph->GetOrbitalTime(); |
|
|
headBr->GetEntry(nevents-1); |
|
|
ph = eh->GetPscuHeader(); |
|
|
lastime = ph->GetOrbitalTime(); |
|
172 |
obmin=firstime; |
obmin=firstime; |
173 |
obmax=lastime; |
obmax=lastime; |
|
oss1.str(""); |
|
|
oss1 << filename.Data() << ": Physics Packet per minute;" <<" start @ " << firstime << ", end @ "<< lastime <<"ms"; |
|
174 |
Int_t nbin = (lastime-firstime)/60000; |
Int_t nbin = (lastime-firstime)/60000; |
175 |
TH1F *h1 = new TH1F ("histo1", oss1.str().c_str(), nbin, obmin, obmax); |
TH1F *h1 = new TH1F ("histo1", "" , nbin, obmin, obmax); |
176 |
|
|
177 |
//------------------------ Second histogram -----------------------------------// |
//------------------- fill vectors and histogram -----------------------------// |
178 |
|
Double_t *PscuCounter = new Double_t[size]; |
179 |
|
Double_t *PacketLenght = new Double_t[size]; |
180 |
|
Double_t *OBTime = new Double_t[size]; |
181 |
|
Double_t *Eventsperminute= new Double_t[nbin]; |
182 |
|
Double_t *Minute= new Double_t[nbin]; |
183 |
|
Int_t max=0; |
184 |
|
for (Int_t k = 0; k < nevents; k++){ |
185 |
|
headBr->GetEntry(k); |
186 |
|
ph = eh->GetPscuHeader(); |
187 |
|
h1->Fill(ph->GetOrbitalTime()); |
188 |
|
PscuCounter[k]= ph->GetCounter(); |
189 |
|
PacketLenght[k]=ph->GetPacketLenght(); |
190 |
|
OBTime[k]=ph->GetOrbitalTime(); |
191 |
|
} |
192 |
|
int l=0; |
193 |
|
while(l<nbin){ |
194 |
|
Eventsperminute[l]=h1->GetBinContent(l); |
195 |
|
Minute[l]=firstime+l*60000; |
196 |
|
if(h1->GetBinContent(l) >= max)max =(Int_t)h1->GetBinContent(l); |
197 |
|
l++; |
198 |
|
} |
199 |
|
|
200 |
|
//----------- Graph and MultiGraph -----------------------------------------------// |
201 |
|
TMultiGraph *rate = new TMultiGraph(); |
202 |
|
TMultiGraph *packetLength = new TMultiGraph(); |
203 |
|
TMultiGraph *packeCounter = new TMultiGraph(); |
204 |
|
|
205 |
|
oss1.str(""); |
206 |
|
oss1 << filename.Data() <<": Physics Packet per minute. Start time = " << obmin << ", End time = "<< obmax <<" ms"; |
207 |
|
TGraph *rate1= new TGraph(nbin, (const Double_t*)Minute, (const Double_t*)Eventsperminute); |
208 |
|
rate1->SetMarkerColor(kBlack); |
209 |
|
rate1->SetMarkerSize(.1); |
210 |
|
rate1->SetMarkerStyle(21); |
211 |
|
rate->Add(rate1); |
212 |
|
|
213 |
|
TGraph *packetLength1= new TGraph(nevents, (const Double_t*)OBTime, (const Double_t*)PacketLenght); |
214 |
oss2.str(""); |
oss2.str(""); |
215 |
oss2 << filename.Data() << ": Lenght of Physic packets;"; |
oss2 << filename.Data() <<": Lenght of Physic packets"; |
216 |
Int_t nint = (lastime-firstime); |
packetLength1->SetMarkerColor(2); |
217 |
TH1F *PcktLenght = new TH1F ("histo2", oss2.str().c_str(), nint, obmin, obmax); |
packetLength1->SetMarkerSize(.5); |
218 |
|
packetLength1->SetMarkerStyle(21); |
219 |
|
packetLength->Add(packetLength1); |
220 |
|
|
221 |
//------------------------ Third histogram -----------------------------------// |
TGraph *packeCounter1= new TGraph(nevents, (const Double_t*)OBTime, (const Double_t*)PscuCounter); |
222 |
oss3.str(""); |
oss3.str(""); |
223 |
oss3 << filename.Data() << ": Physics Counter"; |
oss3 << filename.Data() <<": Physics Counter vs. OBT"; |
224 |
TH1F *PcktCounter = new TH1F ("histo3", oss3.str().c_str(), nint, obmin, obmax); |
packeCounter1->SetMarkerColor(4); |
225 |
|
packeCounter1->SetMarkerSize(.2); |
226 |
//------------------------ Fourth histogram -----------------------------------// |
packeCounter1->SetMarkerStyle(21); |
227 |
/*oss3.str(""); |
packeCounter->Add(packeCounter1); |
228 |
oss3 << filename.Data() << ": Packet Counter"; |
|
229 |
Int_t nintoffset = (maxoffset-minoffset)/10; |
//------------ Create and Draw Canvas ---------------------// |
230 |
TH1F *FileOffset = new TH1F ("histo4", oss3.str().c_str(), nintoffset, minoffset, maxoffset); |
TCanvas *finalCanv = new TCanvas("Header", base, 1200, 1600); |
231 |
*/ |
finalCanv->Divide(1,5); |
232 |
//**************************************************************************************************// |
finalCanv->SetFillColor(10); |
233 |
//------- fill histograms ---------// |
|
234 |
|
TPad *all2= new TPad ("","", 0, 0, 1, 1); |
235 |
for (Int_t i = 0; i < nevents; i++){ |
all2->SetFillColor(10); |
236 |
headBr->GetEntry(i); |
TPad *all3= new TPad ("","", 0, 0, 1, 1); |
237 |
ph = eh->GetPscuHeader(); |
all3->SetFillColor(10); |
238 |
obt = ph->GetOrbitalTime(); |
TPad *all4= new TPad ("","", 0, 0, 1, 1); |
239 |
pcktLenght=ph->GetPacketLenght(); |
all4->SetFillColor(10); |
240 |
pcktCounter=ph->GetCounter(); |
TPad *all= new TPad ("","", 0, 0, 1, 1); |
241 |
h1->Fill(obt); |
all->SetFillColor(10); |
242 |
PcktLenght->Fill(obt,pcktLenght); |
TPad *all1= new TPad ("","", 0, 0, 1, 1); |
243 |
PcktCounter->Fill(obt,pcktCounter); |
all1->SetFillColor(10); |
244 |
|
TPad *pad = new TPad("pad","pad", .80,.45,.90,.75); |
245 |
|
pad->SetFillColor(10); |
246 |
|
|
247 |
|
TLine li; |
248 |
|
li.SetLineStyle(4); |
249 |
|
li.SetLineWidth(2); |
250 |
|
|
251 |
|
//----------- First PAD -------------------------------// |
252 |
|
finalCanv->cd(1); |
253 |
|
all2->Draw(); |
254 |
|
all2->cd(); |
255 |
|
rate->Draw("ALP"); |
256 |
|
rate->GetXaxis()->SetTitle("OBT (ms)"); |
257 |
|
rate->GetXaxis()->SetTitleSize(0.05); |
258 |
|
rate->GetXaxis()->CenterTitle(); |
259 |
|
rate->GetXaxis()->SetLabelSize(0.05); |
260 |
|
rate->GetYaxis()->SetTitle("Number of events "); |
261 |
|
rate->GetYaxis()->CenterTitle(); |
262 |
|
rate->GetYaxis()->SetLabelSize(0.05); |
263 |
|
rate->GetYaxis()->SetTitleSize(0.06); |
264 |
|
rate->GetYaxis()->SetTitleOffset(0.6); |
265 |
|
for (Int_t l = 0; l < runnevents; l++){ |
266 |
|
RunHeadTr->GetEntry(l); |
267 |
|
ph = eH->GetPscuHeader(); |
268 |
|
int ws= reh->RM_ACQ_SETTING_MODE; |
269 |
|
int id = ph->GetPacketId1(); |
270 |
|
Int_t obt = ph->GetOrbitalTime(); |
271 |
|
if (ws==1){ |
272 |
|
li.SetLineColor(3); |
273 |
|
li.DrawLine(obt,0,obt,max); |
274 |
|
} |
275 |
|
else if (ws==2){ |
276 |
|
li.SetLineColor(4); |
277 |
|
li.DrawLine(obt,0,obt,max); |
278 |
|
} |
279 |
} |
} |
280 |
|
|
281 |
|
finalCanv->cd(1); |
282 |
|
stringstream ws1, ws2; |
283 |
|
ws1.str(""); |
284 |
|
ws2.str(""); |
285 |
|
ws1<<"ACQ_SETTING_MODE = 1"; |
286 |
|
ws2<<"ACQ_SETTING_MODE = 2"; |
287 |
|
TPaveText *pt=0; |
288 |
|
pt = new TPaveText (.60,.92,.76,.98); |
289 |
|
pt->AddText(ws1.str().c_str()); |
290 |
|
pt->SetTextColor(3); |
291 |
|
pt->SetFillColor(10); |
292 |
|
pt->SetBorderSize(0); |
293 |
|
pt->Draw(); |
294 |
|
TPaveText *pt1=0; |
295 |
|
pt1 = new TPaveText (.76,.92,.92,.98); |
296 |
|
pt1->AddText(ws2.str().c_str()); |
297 |
|
pt1->SetTextColor(4); |
298 |
|
pt1->SetFillColor(10); |
299 |
|
pt1->SetBorderSize(0); |
300 |
|
pt1->Draw(); |
301 |
|
pt1 = new TPaveText (.05,.91,.6,1); |
302 |
|
pt1->AddText(oss1.str().c_str()); |
303 |
|
pt1->SetTextColor(1); |
304 |
|
pt1->SetFillColor(10); |
305 |
|
pt1->SetBorderSize(0); |
306 |
|
pt1->Draw(); |
307 |
|
|
308 |
|
//----------- Second PAD -------------------------------// |
309 |
|
finalCanv->cd(2); |
310 |
|
all3->Draw(); |
311 |
|
all3->cd(); |
312 |
|
packetLength->Draw("AP"); |
313 |
|
packetLength->GetXaxis()->SetTitle("OBT (ms)"); |
314 |
|
packetLength->GetXaxis()->SetTitleSize(0.05); |
315 |
|
packetLength->GetXaxis()->CenterTitle(); |
316 |
|
packetLength->GetXaxis()->SetLabelSize(0.05); |
317 |
|
packetLength->GetYaxis()->SetTitle("Lenght (byte)"); |
318 |
|
packetLength->GetYaxis()->CenterTitle(); |
319 |
|
packetLength->GetYaxis()->SetLabelSize(0.05); |
320 |
|
packetLength->GetYaxis()->SetTitleSize(0.06); |
321 |
|
packetLength->GetYaxis()->SetTitleOffset(0.6); |
322 |
|
|
323 |
|
|
324 |
|
finalCanv->cd(2); |
325 |
|
pt = new TPaveText (.6,.91,.90,1); |
326 |
|
pt->AddText(oss2.str().c_str()); |
327 |
|
pt->SetTextColor(2); |
328 |
|
pt->SetFillColor(10); |
329 |
|
pt->SetBorderSize(0); |
330 |
|
pt->Draw(); |
331 |
|
|
332 |
|
//----------- Third PAD -------------------------------// |
333 |
|
finalCanv->cd(3); |
334 |
|
all4->Draw(); |
335 |
|
all4->cd(); |
336 |
|
packeCounter->Draw("AP"); |
337 |
|
packeCounter->GetXaxis()->SetTitle("OBT (ms)"); |
338 |
|
packeCounter->GetXaxis()->SetTitleSize(0.05); |
339 |
|
packeCounter->GetXaxis()->CenterTitle(); |
340 |
|
packeCounter->GetXaxis()->SetLabelSize(0.05); |
341 |
|
packeCounter->GetYaxis()->SetTitle("Counter"); |
342 |
|
packeCounter->GetYaxis()->SetTitleSize(0.05); |
343 |
|
packeCounter->GetYaxis()->CenterTitle(); |
344 |
|
packeCounter->GetYaxis()->SetLabelSize(0.05); |
345 |
|
packeCounter->GetYaxis()->SetTitleSize(0.06); |
346 |
|
packeCounter->GetYaxis()->SetTitleOffset(0.6); |
347 |
|
|
348 |
|
|
349 |
|
finalCanv->cd(3); |
350 |
|
TPaveText *pt2=0; |
351 |
|
pt2 = new TPaveText (.6,.91,.90,1); |
352 |
|
pt2->AddText(oss3.str().c_str()); |
353 |
|
pt2->SetTextColor(4); |
354 |
|
pt2->SetFillColor(10); |
355 |
|
pt2->SetBorderSize(0); |
356 |
|
pt2->Draw(); |
357 |
|
|
358 |
|
/**********************************************************************************************/ |
359 |
|
|
360 |
/*for (Int_t i=0; i<numkey; i++){ |
TMultiGraph *mg1 = new TMultiGraph(); |
361 |
key = list->At(i); |
TMultiGraph *mg2 = new TMultiGraph(); |
362 |
|
//---------------------- fill vectors and histogram --------------------------------------------------// |
363 |
|
TList *list = new TList; |
364 |
|
Int_t numkey; |
365 |
|
TObject *key = new TObject; |
366 |
|
const char *name; |
367 |
|
TTree* tr = new TTree; |
368 |
|
Long64_t nevntskey=0; |
369 |
|
list = file->GetListOfKeys(); |
370 |
|
numkey = file->GetNkeys(); |
371 |
|
Double_t salto; |
372 |
|
for (Int_t m=0; m<numkey; m++){ |
373 |
|
key = list->At(m); |
374 |
name=(char *)(key->GetName()); |
name=(char *)(key->GetName()); |
375 |
tr1 = (TTree*)file->Get(name); |
tr = (TTree*)file->Get(name); |
376 |
if (tr1->IsZombie()) continue; |
if (tr->IsZombie()) continue; |
377 |
tr1->SetBranchAddress("Header", &eh); |
tr->SetBranchAddress("Header", &eh); |
378 |
ev = tr1->GetEntries(); |
TBranch *Br = tr->GetBranch("Header"); |
379 |
for (Int_t j = 0; j < ev; j++){ |
nevntskey = tr->GetEntries(); |
380 |
tr1->GetEntry(j); |
|
381 |
ph = eh->GetPscuHeader(); |
if(nevntskey !=0){ |
382 |
offset=ph->GetFileOffset(); |
Int_t size1=nevntskey; |
383 |
allCounter= ph->GetCounter(); |
Double_t *PscuCounter1 = new Double_t[size1]; |
384 |
FileOffset->Fill(offset,allCounter); |
Double_t *FileOffset1 = new Double_t[size1]; |
385 |
} |
Double_t *tempo1 = new Double_t[size1]; |
386 |
}*/ |
|
387 |
|
int n=0; |
388 |
//****************************** Canvases *******************************// |
while(n<nevntskey){ |
389 |
//TGaxis::SetMaxDigits(4); |
Br->GetEntry(n); |
390 |
//------------------- First Canvas --------------------------------// |
ph = eh->GetPscuHeader(); |
391 |
TCanvas *finalCanv1 = new TCanvas("Header_1", base, 1280, 1024); |
PscuCounter1[n]= ph->GetCounter(); |
392 |
finalCanv1->Divide(1,3); |
FileOffset1[n]=ph->GetFileOffset(); |
393 |
finalCanv1->SetFillColor(10); |
tempo1[n]=ph->GetOrbitalTime(); |
394 |
|
if((m==0) && (n==0)){ |
395 |
finalCanv1->cd(1); |
primotempo=ph->GetOrbitalTime(); |
396 |
h1->SetStats(kFALSE); |
salto=ph->GetOrbitalTime(); |
397 |
h1->GetXaxis()->SetTitle("OBT (ms)"); |
} |
398 |
h1->GetXaxis()->CenterTitle(); |
if(salto > ph->GetOrbitalTime())salto=ph->GetOrbitalTime(); |
399 |
h1->GetXaxis()->SetLabelSize(0.04); |
if(ph->GetFileOffset()<= primoffset){ |
400 |
h1->GetYaxis()->SetTitle("Number of events "); |
primoffset=ph->GetFileOffset(); |
401 |
h1->GetYaxis()->CenterTitle(); |
primotempo=ph->GetOrbitalTime(); |
402 |
h1->GetYaxis()->SetTitleSize(0.06); |
} |
403 |
h1->GetYaxis()->SetTitleOffset(0.8); |
if(ph->GetFileOffset()>=ultimoffset){ |
404 |
h1->Draw(); |
ultimotempo=ph->GetOrbitalTime(); |
405 |
|
ultimoffset=ph->GetFileOffset(); |
406 |
finalCanv1->cd(2); |
} |
407 |
PcktLenght->SetStats(kFALSE); |
n++; |
408 |
PcktLenght->GetXaxis()->SetTitle("OBT (ms)"); |
} |
409 |
PcktLenght->GetXaxis()->CenterTitle(); |
TGraph *graph3= new TGraph(nevntskey, (const Double_t*)FileOffset1, (const Double_t*)PscuCounter1); |
410 |
PcktLenght->GetXaxis()->SetLabelSize(0.04); |
graph3->SetMarkerColor(3); |
411 |
PcktLenght->GetYaxis()->SetTitle("Lenght (byte)"); |
graph3->SetMarkerSize(.2); |
412 |
PcktLenght->GetYaxis()->CenterTitle(); |
graph3->SetMarkerStyle(21); |
413 |
PcktLenght->GetYaxis()->SetLabelSize(0.04); |
mg1->Add(graph3); |
414 |
PcktLenght->GetYaxis()->SetTitleSize(0.06); |
|
415 |
PcktLenght->GetYaxis()->SetTitleOffset(0.8); |
TGraph *graph4= new TGraph(nevntskey, (const Double_t*)FileOffset1, (const Double_t*)tempo1); |
416 |
PcktLenght->SetMarkerColor(2); |
graph4->SetMarkerColor(kBlue); |
417 |
PcktLenght->SetMarkerSize(.5); |
graph4->SetMarkerSize(.2); |
418 |
PcktLenght->SetMarkerStyle(21); |
graph4->SetMarkerStyle(21); |
419 |
PcktLenght->Draw("9p"); |
mg2->Add(graph4); |
420 |
|
} |
421 |
finalCanv1->cd(3); |
} |
422 |
PcktCounter->SetStats(kFALSE); |
|
423 |
PcktCounter->GetXaxis()->SetTitle("OBT (ms)"); |
TLatex *lat = new TLatex(); |
424 |
PcktCounter->GetXaxis()->SetTitleSize(0.05); |
lat->SetTextAlign(12); |
425 |
PcktCounter->GetXaxis()->CenterTitle(); |
lat->SetTextSize(0.15); |
426 |
PcktCounter->GetXaxis()->SetLabelSize(0.04); |
lat->SetTextColor(kBlue); |
427 |
PcktCounter->GetYaxis()->SetTitle("Counter"); |
|
428 |
PcktCounter->GetYaxis()->SetTitleSize(0.05); |
//------------ Fourth PAD ---------------------// |
429 |
PcktCounter->GetYaxis()->CenterTitle(); |
finalCanv->cd(4); |
430 |
PcktCounter->GetYaxis()->SetLabelSize(0.04); |
all1->Draw(); |
431 |
PcktCounter->GetYaxis()->SetTitleSize(0.06); |
all1->cd(); |
432 |
PcktCounter->GetYaxis()->SetTitleOffset(0.8); |
|
433 |
PcktCounter->SetMarkerColor(4); |
oss1.str(""); |
434 |
PcktCounter->SetMarkerSize(.5); |
oss1 << filename.Data() <<": PscuCounter vs FileOffset."; |
435 |
PcktCounter->SetMarkerStyle(21); |
mg1->Draw("AP"); |
436 |
PcktCounter->Draw("9p"); |
mg1->GetXaxis()->SetTitle("File Offset"); |
437 |
//--------- Second Canvas -----------------------------// |
mg1->GetXaxis()->CenterTitle(); |
438 |
/*TCanvas *finalCanv2 = new TCanvas("Header_2", base, 1280, 1024); |
mg1->GetXaxis()->SetTitleOffset(0.8); |
439 |
finalCanv2->Divide(1,2); |
mg1->GetXaxis()->SetTitleSize(0.05); |
440 |
finalCanv2->SetFillColor(10); |
mg1->GetXaxis()->SetLabelSize(0.05); |
441 |
|
mg1->GetYaxis()->SetTitle("Counter"); |
442 |
finalCanv2->cd(1); |
mg1->GetYaxis()->CenterTitle(); |
443 |
PcktCounter->SetStats(kFALSE); |
mg1->GetYaxis()->SetTitleSize(0.06); |
444 |
PcktCounter->GetXaxis()->SetTitle("OBT (ms)"); |
mg1->GetYaxis()->SetLabelSize(0.06); |
445 |
PcktCounter->GetXaxis()->SetTitleSize(0.05); |
mg1->GetYaxis()->SetTitleOffset(0.6); |
446 |
PcktCounter->GetXaxis()->CenterTitle(); |
finalCanv->cd(4); |
447 |
PcktCounter->GetXaxis()->SetLabelSize(0.04); |
TPaveText *pt3=0; |
448 |
PcktCounter->GetYaxis()->SetTitle("Counter"); |
pt3 = new TPaveText (.60,.91,.90,1); |
449 |
PcktCounter->GetYaxis()->SetTitleSize(0.05); |
pt3->AddText(oss1.str().c_str()); |
450 |
PcktCounter->GetYaxis()->CenterTitle(); |
pt3->SetTextColor(3); |
451 |
PcktCounter->GetYaxis()->SetLabelSize(0.04); |
pt3->SetFillColor(10); |
452 |
PcktCounter->SetMarkerColor(4); |
pt3->SetBorderSize(0); |
453 |
PcktCounter->SetMarkerSize(.5); |
pt3->Draw(); |
454 |
PcktCounter->SetMarkerStyle(21); |
|
455 |
PcktCounter->Draw("9p"); |
//------------ Fifth PAD ---------------------// |
456 |
|
finalCanv->cd(5); |
457 |
|
all->Draw(); |
458 |
|
all->cd(); |
459 |
|
|
460 |
finalCanv2->cd(2); |
oss3.str(""); |
461 |
FileOffset->SetStats(kFALSE); |
oss3 << filename.Data() <<" OBT vs FileOffset. First packet at "<<primotempo <<" ms, last packet at "<<ultimotempo<<" ms."; |
462 |
FileOffset->GetXaxis()->SetTitle("File Offset"); |
mg2->Draw("AP"); |
463 |
FileOffset->GetXaxis()->CenterTitle(); |
mg2->GetXaxis()->SetTitle("File Offset"); |
464 |
FileOffset->GetXaxis()->SetTitleSize(0.05); |
mg2->GetXaxis()->CenterTitle(); |
465 |
FileOffset->GetXaxis()->SetLabelSize(0.04); |
mg2->GetXaxis()->SetTitleSize(0.05); |
466 |
FileOffset->GetYaxis()->SetTitle("Counter"); |
mg2->GetXaxis()->SetLabelSize(0.05); |
467 |
FileOffset->GetYaxis()->CenterTitle(); |
mg2->GetYaxis()->SetTitle("OBT"); |
468 |
FileOffset->GetYaxis()->SetTitleSize(0.05); |
mg2->GetYaxis()->CenterTitle(); |
469 |
FileOffset->GetYaxis()->SetLabelSize(0.04); |
mg2->GetYaxis()->SetTitleSize(0.06); |
470 |
FileOffset->SetMarkerColor(3); |
mg2->GetYaxis()->SetLabelSize(0.05); |
471 |
FileOffset->SetMarkerSize(.5); |
mg2->GetYaxis()->SetTitleOffset(0.6); |
472 |
FileOffset->SetMarkerStyle(21); |
pad->Draw(); |
473 |
FileOffset->Draw("9p");*/ |
pad->cd(); |
474 |
|
stringa.str(""); |
475 |
//-------to save---------------------------/// |
stringa << "jump at: "<<salto<<" ms \n"; |
476 |
oss.str(""); |
if(salto != primotempo) lat->DrawLatex(0.08, 0.8,stringa.str().c_str()); |
477 |
oss1.str(""); |
|
478 |
|
finalCanv->cd(5); |
479 |
oss << outDir.Data() << filename.Data(); |
TPaveText *pt4=0; |
480 |
oss1 << outDir.Data() << filename.Data(); |
pt4 = new TPaveText (.38 ,.91,.92,1); |
481 |
|
pt4->AddText(oss3.str().c_str()); |
482 |
|
pt4->SetTextColor(kBlue); |
483 |
|
pt4->SetFillColor(10); |
484 |
|
pt4->SetBorderSize(0); |
485 |
|
pt4->Draw(); |
486 |
|
|
487 |
|
finalCanv->Update(); |
488 |
|
|
489 |
|
oss1.str(""); |
490 |
|
oss1 << outDir.Data() << filename.Data(); |
491 |
|
oss1 << "_HeaderScan"<<"." << format.Data(); |
492 |
|
|
493 |
oss << "_HeaderScan_1." << format.Data(); |
finalCanv->SaveAs(oss1.str().c_str()); |
494 |
oss1 << "_HeaderScan_2." << format.Data(); |
|
495 |
|
file->Close(); |
|
finalCanv1->SaveAs(oss.str().c_str()); |
|
|
//finalCanv2->SaveAs(oss1.str().c_str()); |
|
|
|
|
|
file->Close(); |
|
496 |
|
|
497 |
} |
} |
498 |
|
|
|
|
|
|
|
|
499 |
int main(int argc, char* argv[]){ |
int main(int argc, char* argv[]){ |
500 |
TString path; |
TString path; |
501 |
TString outDir = "./"; |
TString outDir = "./"; |
539 |
} |
} |
540 |
HeaderScan(argv[1], outDir, format); |
HeaderScan(argv[1], outDir, format); |
541 |
} |
} |
542 |
|
|