1 |
/** |
/** |
2 |
* Header Scan |
* Header_Scan |
3 |
* Author Nagni |
* Author Nagni |
4 |
* version 1.0 |
* version 1.0 |
5 |
* |
* |
43 |
* There is no default value, without this input the program will not run |
* There is no default value, without this input the program will not run |
44 |
* TString outDir - the path where to save the output image (Default = ./) |
* TString outDir - the path where to save the output image (Default = ./) |
45 |
* TString format - the format which will be used fo rsave the produced images (Default = "jpg") |
* TString format - the format which will be used fo rsave the produced images (Default = "jpg") |
46 |
|
* |
47 |
|
* |
48 |
|
* Version 1.7 |
49 |
|
* Date 16 June 2006 - Malvezzi |
50 |
|
* |
51 |
|
* Description of changes: |
52 |
|
* Implementation of the case: numebr of events <= 0. |
53 |
|
* 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 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 |
|
|
64 |
|
|
65 |
|
#include <fstream> |
66 |
|
#include <math.h> |
67 |
|
#include "TLatex.h" |
68 |
|
#include "TF1.h" |
69 |
|
#include "TPaveText.h" |
70 |
|
#include "TMultiGraph.h" |
71 |
#include <sstream> |
#include <sstream> |
72 |
#include <iostream> |
#include <iostream> |
73 |
#include "TString.h" |
#include "TString.h" |
83 |
#include "EventHeader.h" |
#include "EventHeader.h" |
84 |
#include "PscuHeader.h" |
#include "PscuHeader.h" |
85 |
|
|
|
|
|
86 |
using namespace std; |
using namespace std; |
87 |
|
|
88 |
void HeaderScan(TString base, TString outDir, TString format) |
void HeaderScan(TString base, TString outDir, TString format) |
89 |
{ |
{ |
90 |
|
|
91 |
TList *list = new TList; |
//------------------- Variables initilization -------------------------// |
92 |
Int_t numkey; |
Long64_t nevents=0; |
93 |
TObject *key = new TObject; |
ULong_t lastime, firstime, primotempo, ultimotempo, primoffset=500000000, ultimoffset; |
94 |
const char *name; |
double obmin=0.; |
95 |
TTree* tr = new TTree; |
double obmax=0.; |
96 |
Long64_t totevents=0, totphysevents=0; |
stringstream oss, oss1, oss2, oss3, noentries, stringa; |
|
Float_t id; |
|
|
Long64_t nevents=0; |
|
|
|
|
97 |
//------- load root file -------------- |
//------- load root file -------------- |
|
|
|
98 |
TFile *file = new TFile(base.Data()); |
TFile *file = new TFile(base.Data()); |
|
|
|
99 |
if (!file){ |
if (!file){ |
100 |
printf("No such file in the directory has been found"); |
printf("No such file in the directory has been found"); |
101 |
return; |
return; |
102 |
} |
} |
|
if (outDir == "" ) outDir = "."; |
|
|
|
|
|
list = file->GetListOfKeys(); |
|
103 |
|
|
104 |
numkey = file->GetNkeys(); |
TTree *PhysicsTr = (TTree*)file->Get("Physics"); |
105 |
|
TBranch *headBr = PhysicsTr->GetBranch("Header"); |
106 |
pamela::EventHeader *eh=0; |
|
107 |
pamela::PscuHeader *ph=0; |
pamela::EventHeader *eh = 0; |
108 |
|
pamela::PscuHeader *ph = 0; |
109 |
///-----to know the total number f events end of physics events----////// |
|
110 |
|
PhysicsTr->SetBranchAddress("Header", &eh); |
111 |
for (Int_t i=0; i<numkey; i++){ |
|
112 |
key = list->At(i); |
nevents = headBr->GetEntries(); |
|
name=(key->GetName()); |
|
|
//cout<<name<<"\n"; |
|
|
tr = (TTree*)file->Get(name); |
|
|
if (tr->IsZombie()) continue; |
|
|
nevents = tr->GetEntries(); |
|
|
totevents+=nevents; |
|
|
tr->SetBranchAddress("Header", &eh); |
|
|
for (Int_t j = 0; j < nevents; j++){ |
|
|
tr->GetEntry(j); |
|
|
ph = eh->GetPscuHeader(); |
|
|
if(ph->GetPacketId1() == 0x10) ++totphysevents; |
|
|
} |
|
|
|
|
|
} |
|
113 |
|
|
|
const Long64_t totalevents=totevents; |
|
|
const Long64_t totalphysevents=totphysevents; |
|
|
|
|
|
///////////////////////////////////////////////// |
|
|
|
|
114 |
TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString(); |
TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString(); |
115 |
filename = ((TObjString*)filename.Tokenize('.')->First())->GetString(); |
filename = ((TObjString*)filename.Tokenize('.')->First())->GetString(); |
|
stringstream oss; |
|
|
oss.str(""); |
|
|
oss << filename.Data(); |
|
|
|
|
|
Float_t obt[totalevents], pcktId[totalevents], pcktLenght[totalphysevents], pcktCounter[totalphysevents], offset[totalevents], allCounter[totalevents]; |
|
|
Float_t obtphysevents=0; |
|
|
|
|
116 |
|
|
117 |
totphysevents=0; |
//----------- If nevents < = 0 ---------------------------------/ |
118 |
totevents=0; |
if (nevents<=0) { |
119 |
for (Int_t i=0; i<numkey; i++){ |
printf("nevents = %i \n", nevents); |
120 |
key = list->At(i); |
printf(" \n"); |
121 |
name=(char *)(key->GetName()); |
|
122 |
tr = (TTree*)file->Get(name); |
TCanvas *canv = new TCanvas("No entries", "No entries ", 400, 200); |
123 |
if (tr->IsZombie()) continue; |
canv->SetFillColor(10); |
124 |
tr->SetBranchAddress("Header", &eh); |
canv->cd(); |
125 |
nevents = tr->GetEntries(); |
|
126 |
for (Int_t j = 0; j < nevents; j++){ |
TLatex *l = new TLatex(); |
127 |
tr->GetEntry(j); |
l->SetTextAlign(12); |
128 |
ph = eh->GetPscuHeader(); |
l->SetTextSize(0.15); |
129 |
obt[j+totevents]=ph->GetOrbitalTime() ; |
l->SetTextColor(2); |
130 |
pcktId[j+totevents]=ph->GetPacketId1(); |
noentries.str(""); |
131 |
offset[j+totevents]=ph->GetFileOffset(); |
noentries<< "HeaderScan_QL:"; |
132 |
if(pcktId[j+totevents]==16){ |
l->DrawLatex(0.05, 0.7, noentries.str().c_str()); |
133 |
pcktLenght[totphysevents]=ph->GetPacketLenght(); |
noentries.str(""); |
134 |
pcktCounter[totphysevents]=ph->GetCounter(); |
noentries<< "No Physics entries for this files"; |
135 |
totphysevents=totphysevents+1; |
l->DrawLatex(0.05, 0.5, noentries.str().c_str()); |
136 |
} |
|
137 |
offset[j+totevents]=ph->GetFileOffset(); |
if (outDir == "./") { |
138 |
allCounter[j+totevents]= ph->GetCounter(); |
oss.str(""); |
139 |
} |
oss << filename.Data() << "_HeaderScan_QL." << format.Data(); |
140 |
totevents=totevents+nevents; |
} else { |
141 |
} |
oss.str(""); |
142 |
|
oss << outDir.Data() << filename.Data() << "_HeaderScan_QL." << format.Data(); |
143 |
|
} |
|
Float_t mintime=obt[0], maxtime=obt[0], minlen=pcktLenght[0], maxlen=pcktLenght[0], mincount=pcktCounter[0], maxcount=pcktCounter[0]; |
|
|
|
|
144 |
|
|
145 |
for (Int_t t=0; t<totalevents; t++){ |
canv->Update(); |
146 |
if(obt[t]<mintime) mintime=obt[t]; |
canv->SaveAs(oss.str().c_str()); |
147 |
if(obt[t]>maxtime) maxtime=obt[t]; |
|
148 |
} |
return; |
|
for (Int_t t=0; t<totalphysevents; t++){ |
|
|
if(pcktLenght[t]<=minlen) minlen=pcktLenght[t]; |
|
|
if(pcktLenght[t]>=maxlen) maxlen=pcktLenght[t]; |
|
|
if(pcktCounter[t]<=mincount) mincount=pcktCounter[t]; |
|
|
if(pcktCounter[t]>=maxcount) maxcount=pcktCounter[t]; |
|
149 |
} |
} |
150 |
|
|
151 |
|
//-------------- to know the max and min OBT ----------------------------// |
152 |
|
headBr->GetEntry(0); |
153 |
|
ph = eh->GetPscuHeader(); |
154 |
|
firstime = ph->GetOrbitalTime(); |
155 |
|
|
156 |
|
for (Int_t i = 0; i < nevents; i++){ |
157 |
|
headBr->GetEntry(i); |
158 |
|
ph = eh->GetPscuHeader(); |
159 |
|
if((ph->GetOrbitalTime()) <= firstime) firstime=ph->GetOrbitalTime(); |
160 |
|
if((ph->GetOrbitalTime()) >= lastime) lastime=ph->GetOrbitalTime(); |
161 |
|
} |
162 |
|
|
163 |
|
//------------------------ First histogram -----------------------------------// |
164 |
|
|
165 |
|
obmin=firstime; |
166 |
|
obmax=lastime; |
167 |
|
|
168 |
Float_t nbintime = (maxtime-mintime)/1000; |
oss1.str(""); |
169 |
Float_t nbinlen = (maxlen-minlen)/100; |
oss1 << filename.Data() <<": Physics Packet per minute. Start time = " << obmin << ", End time = "<< obmax <<" ms"; |
170 |
Float_t nbincount = (maxcount-mincount)/100; |
Int_t nbin = (lastime-firstime)/60000; |
171 |
|
TH1F *h1 = new TH1F ("histo1", oss1.str().c_str(), nbin, obmin, obmax); |
172 |
|
|
173 |
///---------------------------TO GRAPH---------------------------------------------/// |
oss2.str(""); |
174 |
TCanvas *finalCanv1 = new TCanvas("Header_1", base, 1280, 1024); |
oss2 << filename.Data() <<": Lenght of Physic packets"; |
175 |
TCanvas *finalCanv2 = new TCanvas("Header_2", base, 1280, 1024); |
Int_t nbin2 =(lastime-firstime); |
176 |
finalCanv1->Divide(3); |
TH1F *packetLength = new TH1F ("packetLength", oss2.str().c_str(), nbin2, obmin, obmax); |
177 |
|
|
178 |
|
oss3.str(""); |
179 |
|
oss3 << filename.Data() <<": Physics Counter"; |
180 |
|
TH1F *packeCounter = new TH1F ("packeCounter", oss3.str().c_str(), nbin2, obmin, obmax); |
181 |
|
//---------------------------------------------------- |
182 |
|
TCanvas *finalCanv1 = new TCanvas("Header_1", base, 1280, 1150); |
183 |
|
finalCanv1->Divide(1,3); |
184 |
finalCanv1->SetFillColor(10); |
finalCanv1->SetFillColor(10); |
185 |
finalCanv2->Divide(2); |
TPad *all2= new TPad ("","", 0, 0, 1, 1); |
186 |
|
all2->SetFillColor(10); |
187 |
|
TPad *all3= new TPad ("","", 0, 0, 1, 1); |
188 |
|
all3->SetFillColor(10); |
189 |
|
TPad *all4= new TPad ("","", 0, 0, 1, 1); |
190 |
|
all4->SetFillColor(10); |
191 |
|
//---------------------------------------------------- |
192 |
|
TCanvas *finalCanv2 = new TCanvas("Header_2", base, 1280, 1150); |
193 |
|
finalCanv2->Divide(1,2); |
194 |
finalCanv2->SetFillColor(10); |
finalCanv2->SetFillColor(10); |
195 |
|
|
196 |
|
TMultiGraph *mg1 = new TMultiGraph(); |
197 |
TGraph *grPcktId1 = new TGraph(totalevents, obt, pcktId); |
oss1.str(""); |
198 |
TGraph *grPcktLenght = new TGraph(totalevents, obt, pcktLenght); |
oss1 << filename.Data() <<": PscuCounter vs FileOffset."; |
199 |
TGraph *grPcktCounter = new TGraph(totalevents, obt, pcktCounter); |
mg1->SetTitle(oss1.str().c_str()); |
200 |
TGraph *grFileOffset = new TGraph(totalevents, offset, allCounter); |
|
201 |
|
TMultiGraph *mg2 = new TMultiGraph(); |
202 |
TGaxis::SetMaxDigits(3); |
|
203 |
|
TPad *all= new TPad ("","", 0, 0, 1, 1); |
204 |
|
all->SetFillColor(10); |
205 |
|
TPad *all1= new TPad ("","", 0, 0, 1, 1); |
206 |
|
all1->SetFillColor(10); |
207 |
|
TPad *pad = new TPad("pad","pad", .80,.50,.90,.80); |
208 |
|
pad->SetFillColor(10); |
209 |
|
//-------------------------------------------------------------------------- |
210 |
|
for (Int_t l = 0; l < nevents; l++){ |
211 |
|
headBr->GetEntry(l); |
212 |
|
ph = eh->GetPscuHeader(); |
213 |
|
h1->Fill(ph->GetOrbitalTime()); |
214 |
|
packetLength->Fill(ph->GetOrbitalTime(),ph->GetPacketLenght()); |
215 |
|
packeCounter->Fill(ph->GetOrbitalTime(),ph->GetCounter()); |
216 |
|
} |
217 |
|
|
218 |
|
//------------ First Canvas ---------------------// |
219 |
|
|
|
//-----canvas 1-------------------------------/// |
|
220 |
finalCanv1->cd(1); |
finalCanv1->cd(1); |
221 |
|
all2->Draw(); |
222 |
|
all2->cd(); |
223 |
|
h1->SetStats(kFALSE); |
224 |
|
h1->GetXaxis()->SetTitle("OBT (ms)"); |
225 |
|
h1->GetXaxis()->CenterTitle(); |
226 |
|
h1->GetXaxis()->SetLabelSize(0.04); |
227 |
|
h1->GetYaxis()->SetTitle("Number of events "); |
228 |
|
h1->GetYaxis()->CenterTitle(); |
229 |
|
h1->GetYaxis()->SetTitleSize(0.06); |
230 |
|
h1->GetYaxis()->SetTitleOffset(0.8); |
231 |
|
h1->Draw(); |
232 |
|
|
233 |
stringstream oss1; |
|
|
oss1.str(""); |
|
|
oss1 << "OBT (ms) with t0 = " << mintime << "ms"; |
|
|
|
|
|
gStyle->SetTitleH(0.06); |
|
|
grPcktId1->SetTitle(oss.str().c_str()); |
|
|
grPcktId1->GetXaxis()->SetTitle(oss1.str().c_str()); |
|
|
grPcktId1->GetXaxis()->CenterTitle(); |
|
|
grPcktId1->GetXaxis()->SetLabelSize(0.03); |
|
|
grPcktId1->GetYaxis()->SetTitle("Packet ID"); |
|
|
grPcktId1->GetYaxis()->CenterTitle(); |
|
|
grPcktId1->SetMarkerSize(4); |
|
|
grPcktId1->Draw("AP"); |
|
|
|
|
|
|
|
234 |
finalCanv1->cd(2); |
finalCanv1->cd(2); |
235 |
oss1.str(""); |
all3->Draw(); |
236 |
oss1 << "OBT (min) with t0 = " << mintime << "ms"; |
all3->cd(); |
237 |
|
packetLength->SetStats(kFALSE); |
238 |
|
packetLength->SetMarkerColor(2); |
239 |
|
packetLength->SetMarkerSize(.5); |
240 |
|
packetLength->SetMarkerStyle(21); |
241 |
|
packetLength->GetXaxis()->SetTitle("OBT (ms)"); |
242 |
|
packetLength->GetXaxis()->CenterTitle(); |
243 |
|
packetLength->GetXaxis()->SetLabelSize(0.04); |
244 |
|
packetLength->GetYaxis()->SetTitle("Lenght (byte)"); |
245 |
|
packetLength->GetYaxis()->CenterTitle(); |
246 |
|
packetLength->GetYaxis()->SetLabelSize(0.04); |
247 |
|
packetLength->GetYaxis()->SetTitleSize(0.06); |
248 |
|
packetLength->GetYaxis()->SetTitleOffset(0.8); |
249 |
|
packetLength->Draw("9p"); |
250 |
|
|
251 |
|
finalCanv1->cd(3); |
252 |
|
all4->Draw(); |
253 |
|
all4->cd(); |
254 |
|
packeCounter->SetStats(kFALSE); |
255 |
|
packeCounter->SetMarkerColor(4); |
256 |
|
packeCounter->SetMarkerSize(.5); |
257 |
|
packeCounter->SetMarkerStyle(21); |
258 |
|
packeCounter->GetXaxis()->SetTitle("OBT (ms)"); |
259 |
|
packeCounter->GetXaxis()->SetTitleSize(0.05); |
260 |
|
packeCounter->GetXaxis()->CenterTitle(); |
261 |
|
packeCounter->GetXaxis()->SetLabelSize(0.04); |
262 |
|
packeCounter->GetYaxis()->SetTitle("Counter"); |
263 |
|
packeCounter->GetYaxis()->SetTitleSize(0.05); |
264 |
|
packeCounter->GetYaxis()->CenterTitle(); |
265 |
|
packeCounter->GetYaxis()->SetLabelSize(0.04); |
266 |
|
packeCounter->GetYaxis()->SetTitleSize(0.06); |
267 |
|
packeCounter->GetYaxis()->SetTitleOffset(0.8); |
268 |
|
Double_t min = 500000000.; |
269 |
|
for (Int_t l = 0; l < nevents; l++){ |
270 |
|
if((packeCounter->GetBinContent(l))<= min && (packeCounter->GetBinContent(l))!= 0) min = packeCounter->GetBinContent(l); |
271 |
|
} |
272 |
|
packeCounter->SetMinimum(min); |
273 |
|
packeCounter->Draw("9p"); |
274 |
|
|
275 |
TH1F *h1 = new TH1F ("h1", oss.str().c_str(), (int)(nbintime/60), mintime, maxtime); |
oss.str(""); |
276 |
|
oss << outDir.Data() << filename.Data(); |
277 |
|
oss << "_HeaderScan_1." << format.Data(); |
278 |
|
finalCanv1->SaveAs(oss.str().c_str()); |
279 |
|
|
280 |
|
//------------------------------------------------- |
281 |
|
TList *list = new TList; |
282 |
|
Int_t numkey; |
283 |
|
TObject *key = new TObject; |
284 |
|
const char *name; |
285 |
|
TTree* tr = new TTree; |
286 |
|
Long64_t nevntskey=0; |
287 |
|
list = file->GetListOfKeys(); |
288 |
|
numkey = file->GetNkeys(); |
289 |
|
|
290 |
|
const Int_t size1 = 10000; |
291 |
|
Int_t ev1=0; |
292 |
|
Double_t PscuCounter1[size1], FileOffset1[size1], tempo1[size1], salto[size1]; |
293 |
|
Int_t pag1=0; |
294 |
|
Int_t m1=0; |
295 |
|
Int_t ll=0; |
296 |
|
|
297 |
for (Int_t i=0; i<numkey; i++){ |
for (Int_t i=0; i<numkey; i++){ |
298 |
key = list->At(i); |
key = list->At(i); |
299 |
name=(char *)(key->GetName()); |
name=(char *)(key->GetName()); |
300 |
tr = (TTree*)file->Get(name); |
tr = (TTree*)file->Get(name); |
301 |
if (tr->IsZombie()) continue; |
if (tr->IsZombie()) continue; |
302 |
tr->SetBranchAddress("Header", &eh); |
tr->SetBranchAddress("Header", &eh); |
303 |
nevents = tr->GetEntries(); |
TBranch *Br = tr->GetBranch("Header"); |
304 |
for (Int_t j = 0; j < nevents; j++){ |
nevntskey = tr->GetEntries(); |
305 |
tr->GetEntry(j); |
m1=0; |
306 |
ph = eh->GetPscuHeader(); |
ev1=0; |
307 |
if((ph->GetPacketId1()) == 16){ |
pag1=0; |
308 |
obtphysevents=ph->GetOrbitalTime(); |
pag1= (nevntskey/10000)+1; |
309 |
h1->Fill(obtphysevents); |
/////ciclo sulle pagine//////////////////// |
310 |
} |
for (Int_t interval1=0; interval1<pag1; interval1++){ |
311 |
} |
|
312 |
|
for (Int_t l = 0; l < size1; l++){ //ciclo su un sottogruppo |
313 |
|
Br->GetEntry(ev1+l); |
314 |
|
ph = eh->GetPscuHeader(); |
315 |
|
PscuCounter1[l]= ph->GetCounter(); // = PcktCounter[l] |
316 |
|
FileOffset1[l]=ph->GetFileOffset(); |
317 |
|
tempo1[l]=ph->GetOrbitalTime(); |
318 |
|
if(ph->GetFileOffset()<= primoffset){ |
319 |
|
primoffset =ph->GetFileOffset(); |
320 |
|
primotempo=ph->GetOrbitalTime(); |
321 |
|
} |
322 |
|
if(ph->GetFileOffset()>= ultimoffset){ |
323 |
|
ultimoffset = ph->GetFileOffset(); |
324 |
|
ultimotempo = ph->GetOrbitalTime(); |
325 |
|
} |
326 |
|
if(l>0){ |
327 |
|
if(tempo1[l] < tempo1[l-1]){ |
328 |
|
salto[ll]= ph->GetOrbitalTime(); |
329 |
|
ll=ll+1; |
330 |
|
} |
331 |
|
} |
332 |
|
|
333 |
|
m1=l; |
334 |
|
} |
335 |
|
|
336 |
|
TGraph *graph3= new TGraph(m1, FileOffset1, PscuCounter1); |
337 |
|
graph3->SetMarkerColor(3); |
338 |
|
graph3->SetMarkerSize(.5); |
339 |
|
graph3->SetMarkerStyle(21); |
340 |
|
mg1->Add(graph3); |
341 |
|
|
342 |
|
TGraph *graph4= new TGraph(m1, FileOffset1, tempo1); |
343 |
|
graph4->SetMarkerColor(kBlue); |
344 |
|
graph4->SetMarkerSize(.5); |
345 |
|
graph4->SetMarkerStyle(21); |
346 |
|
mg2->Add(graph4); |
347 |
|
|
348 |
|
ev1=ev1+10000; |
349 |
} |
} |
350 |
|
|
351 |
|
} |
352 |
|
|
353 |
|
|
354 |
h1->SetMarkerStyle(6); |
TLatex *lat = new TLatex(); |
355 |
h1->GetXaxis()->SetTitle(oss1.str().c_str()); |
lat->SetTextAlign(12); |
356 |
h1->GetXaxis()->CenterTitle(); |
lat->SetTextSize(0.15); |
357 |
h1->GetXaxis()->SetLabelSize(0.03); |
lat->SetTextColor(kBlue); |
358 |
h1->GetYaxis()->SetTitle("number of Physic packets"); |
|
359 |
h1->GetYaxis()->CenterTitle(); |
|
360 |
h1->Draw(); |
//------------ Second Canvas ---------------------// |
361 |
|
finalCanv2->cd(1); |
362 |
|
all1->Draw(); |
363 |
finalCanv1->cd(3); |
all1->cd(); |
364 |
oss1.str(""); |
mg1->Draw("AP"); |
365 |
oss1 << "OBT (ms) with t0 = " << mintime << "ms"; |
mg1->GetXaxis()->SetTitle("File Offset"); |
366 |
|
mg1->GetXaxis()->CenterTitle(); |
367 |
grPcktLenght->SetTitle(oss.str().c_str()); |
mg1->GetXaxis()->SetTitleSize(0.05); |
368 |
grPcktLenght->GetXaxis()->SetTitle(oss1.str().c_str()); |
mg1->GetXaxis()->SetLabelSize(0.04); |
369 |
grPcktLenght->GetXaxis()->CenterTitle(); |
mg1->GetYaxis()->SetTitle("Counter"); |
370 |
grPcktLenght->GetXaxis()->SetLabelSize(0.03); |
mg1->GetYaxis()->CenterTitle(); |
371 |
grPcktLenght->GetYaxis()->SetTitle("Lenght of Physic packets (byte)"); |
mg1->GetYaxis()->SetTitleSize(0.05); |
372 |
grPcktLenght->GetYaxis()->CenterTitle(); |
mg1->GetYaxis()->SetLabelSize(0.03); |
373 |
grPcktLenght->GetYaxis()->SetLabelSize(0.03); |
|
374 |
grPcktLenght->SetMarkerSize(4); |
finalCanv2->cd(2); |
375 |
grPcktLenght->Draw("AP"); |
all->Draw(); |
376 |
|
all->cd(); |
|
|
|
|
finalCanv1->cd(2); |
|
|
h1->Draw(); |
|
|
|
|
|
finalCanv1->Update(); |
|
|
|
|
|
|
|
|
///---------canvas 2-----------------------------// |
|
|
finalCanv2->cd(1); |
|
|
|
|
|
grPcktCounter->SetTitle(oss.str().c_str()); |
|
|
grPcktCounter->GetXaxis()->SetTitle(oss1.str().c_str()); |
|
|
grPcktCounter->GetXaxis()->SetTitleSize(0.04); |
|
|
grPcktCounter->GetXaxis()->CenterTitle(); |
|
|
grPcktCounter->GetXaxis()->SetLabelSize(0.03); |
|
|
grPcktCounter->GetYaxis()->SetTitle("PacketCounter of Physic packets"); |
|
|
grPcktCounter->GetYaxis()->SetTitleSize(0.04); |
|
|
grPcktCounter->GetYaxis()->CenterTitle(); |
|
|
grPcktCounter->GetYaxis()->SetLabelSize(0.03); |
|
|
grPcktCounter->SetMarkerSize(4); |
|
|
grPcktCounter->SetMinimum(mincount); |
|
|
grPcktCounter->SetMaximum(maxcount); |
|
|
grPcktCounter->Draw("AP"); |
|
377 |
|
|
378 |
finalCanv2->cd(2); |
oss3.str(""); |
379 |
|
oss3 << filename.Data() <<" OBT vs FileOffset. First packet = "<<primotempo <<" ms, Last packet = "<<ultimotempo<<" ms."; |
380 |
grFileOffset->SetTitle(oss.str().c_str()); |
mg2->SetTitle(oss3.str().c_str()); |
381 |
grFileOffset->GetXaxis()->SetTitle("File Offset"); |
mg2->Draw("AP"); |
382 |
grFileOffset->GetXaxis()->CenterTitle(); |
mg2->GetXaxis()->SetTitle("File Offset"); |
383 |
grFileOffset->GetXaxis()->SetTitleSize(0.04); |
mg2->GetXaxis()->CenterTitle(); |
384 |
grFileOffset->GetXaxis()->SetLabelSize(0.03); |
mg2->GetXaxis()->SetTitleSize(0.05); |
385 |
grFileOffset->GetYaxis()->SetTitle("Packet counter"); |
mg2->GetXaxis()->SetLabelSize(0.04); |
386 |
grFileOffset->GetYaxis()->CenterTitle(); |
mg2->GetYaxis()->SetTitle("OBT"); |
387 |
grFileOffset->GetYaxis()->SetTitleSize(0.04); |
mg2->GetYaxis()->CenterTitle(); |
388 |
grFileOffset->GetYaxis()->SetLabelSize(0.03); |
mg2->GetYaxis()->SetTitleSize(0.05); |
389 |
grFileOffset->SetMarkerSize(4); |
mg2->GetYaxis()->SetLabelSize(0.03); |
390 |
grFileOffset->Draw("AP"); |
double min2 = 0.8; |
391 |
|
if(ll-1 > 0){ |
392 |
finalCanv1->Update(); |
pad->Draw(); |
393 |
|
pad->cd(); |
394 |
|
stringa.str(""); |
395 |
//-------to save---------------------------/// |
stringa << "jump back at:"; |
396 |
oss.str(""); |
lat->DrawLatex(0.08, min2, stringa.str().c_str()); |
397 |
oss1.str(""); |
for(Int_t kk=0; kk <(ll-1); kk++){ |
398 |
|
stringa.str(""); |
399 |
oss << outDir.Data() << filename.Data(); |
stringa << salto[kk]; |
400 |
oss1 << outDir.Data() << filename.Data(); |
min2=min2-0.1; |
401 |
|
lat->DrawLatex(0.08, min2,stringa.str().c_str()); |
402 |
|
//cout<<salto[kk]<<";\n"; |
403 |
|
} |
404 |
|
} |
405 |
|
|
406 |
oss << "_HeaderScan_1." << format.Data(); |
finalCanv2->Update(); |
407 |
oss1 << "_HeaderScan_2." << format.Data(); |
|
408 |
|
|
409 |
finalCanv1->SaveAs(oss.str().c_str()); |
|
410 |
finalCanv2->SaveAs(oss1.str().c_str()); |
|
411 |
|
|
412 |
|
oss1.str(""); |
413 |
|
oss1 << outDir.Data() << filename.Data(); |
414 |
|
oss1 << "_HeaderScan_2"<<"." << format.Data(); |
415 |
|
|
416 |
|
finalCanv2->SaveAs(oss1.str().c_str()); |
417 |
|
|
418 |
file->Close(); |
file->Close(); |
419 |
|
|
420 |
} |
} |
421 |
|
|
|
|
|
|
|
|
422 |
int main(int argc, char* argv[]){ |
int main(int argc, char* argv[]){ |
423 |
TString path; |
TString path; |
424 |
TString outDir = "./"; |
TString outDir = "./"; |
425 |
TString format = "jpg"; |
TString format = "jpg"; |
|
|
|
426 |
if (argc < 2){ |
if (argc < 2){ |
427 |
printf("You have to insert at least the file to analyze \n"); |
printf("You have to insert at least the file to analyze \n"); |
428 |
printf("Try '--help' for more information. \n"); |
printf("Try '--help' for more information. \n"); |
429 |
exit(1); |
exit(1); |
430 |
} |
} |
|
|
|
431 |
if (!strcmp(argv[1], "--help")){ |
if (!strcmp(argv[1], "--help")){ |
432 |
printf( "Usage: HeaderScan FILE [OPTION] \n"); |
printf( "Usage: HeaderScan FILE [OPTION] \n"); |
433 |
printf( "\t --help Print this help and exit \n"); |
printf( "\t --help Print this help and exit \n"); |
435 |
printf( "\t -format[jpg|ps|gif] Format for output files [default 'jpg'] \n"); |
printf( "\t -format[jpg|ps|gif] Format for output files [default 'jpg'] \n"); |
436 |
exit(1); |
exit(1); |
437 |
} |
} |
|
|
|
|
|
|
438 |
path=argv[1]; |
path=argv[1]; |
439 |
|
for (int i = 2; i < argc; i++){ |
|
for (int i = 2; i < argc; i++){ |
|
|
|
|
440 |
if (!strcmp(argv[i], "-outDir")){ |
if (!strcmp(argv[i], "-outDir")){ |
441 |
if (++i >= argc){ |
if (++i >= argc){ |
442 |
printf( "-outDir needs arguments. \n"); |
printf( "-outDir needs arguments. \n"); |
447 |
outDir = argv[i]; |
outDir = argv[i]; |
448 |
continue; |
continue; |
449 |
} |
} |
450 |
} |
} |
|
|
|
451 |
if (!strcmp(argv[i], "-format")){ |
if (!strcmp(argv[i], "-format")){ |
452 |
if (++i >= argc){ |
if (++i >= argc){ |
453 |
printf( "-format needs arguments. \n"); |
printf( "-format needs arguments. \n"); |
459 |
continue; |
continue; |
460 |
} |
} |
461 |
} |
} |
|
|
|
|
|
|
462 |
} |
} |
|
|
|
463 |
HeaderScan(argv[1], outDir, format); |
HeaderScan(argv[1], outDir, format); |
|
|
|
464 |
} |
} |
465 |
|
|