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 |
|
|
93 |
|
|
94 |
//------------------- Variables initilization -------------------------// |
//------------------- Variables initilization -------------------------// |
95 |
|
Long64_t nevents=0, runnevents; |
96 |
TList *list = new TList; |
ULong_t lastime, firstime, primotempo, ultimotempo, primoffset=500000000, ultimoffset; |
97 |
Int_t numkey; |
double obmin=0., time=0.; |
|
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; |
|
|
double obmin=0.; |
|
98 |
double obmax=0.; |
double obmax=0.; |
99 |
double obt; |
stringstream oss, oss1, oss2, oss3, noentries, stringa; |
|
ULong_t maxoffset, minoffset; |
|
|
Float_t pcktLenght =0., pcktCounter=0., offset=0., allCounter=0.; |
|
|
stringstream oss, oss1, oss2, oss3, noentries; |
|
100 |
//------- load root file -------------- |
//------- load root file -------------- |
101 |
TFile *file = new TFile(base.Data()); |
TFile *file = new TFile(base.Data()); |
102 |
if (!file){ |
if (!file){ |
103 |
printf("No such file in the directory has been found"); |
printf("No such file in the directory has been found"); |
104 |
return; |
return; |
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 |
|
|
107 |
TTree *PhysicsTr = (TTree*)file->Get("Physics"); |
TTree *PhysicsTr = (TTree*)file->Get("Physics"); |
108 |
TBranch *headBr = PhysicsTr->GetBranch("Header"); |
TBranch *headBr = PhysicsTr->GetBranch("Header"); |
111 |
pamela::PscuHeader *ph = 0; |
pamela::PscuHeader *ph = 0; |
112 |
|
|
113 |
PhysicsTr->SetBranchAddress("Header", &eh); |
PhysicsTr->SetBranchAddress("Header", &eh); |
|
|
|
114 |
nevents = headBr->GetEntries(); |
nevents = headBr->GetEntries(); |
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 |
|
|
125 |
TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString(); |
TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString(); |
126 |
filename = ((TObjString*)filename.Tokenize('.')->First())->GetString(); |
filename = ((TObjString*)filename.Tokenize('.')->First())->GetString(); |
159 |
return; |
return; |
160 |
} |
} |
161 |
|
|
162 |
|
//-------------- to know the max and min OBT ----------------------------// |
163 |
///-------------- to know the max and min File Offset ----------------------------// |
headBr->GetEntry(0); |
164 |
/*for (Int_t i=0; i<numkey; i++){ |
ph = eh->GetPscuHeader(); |
165 |
key = list->At(i); |
firstime = ph->GetOrbitalTime(); |
166 |
name=(key->GetName()); |
|
167 |
tr = (TTree*)file->Get(name); |
int iii =0; |
168 |
if (tr->IsZombie()) continue; |
while(iii < nevents){ |
169 |
events = tr->GetEntries(); |
headBr->GetEntry(iii); |
170 |
tr->SetBranchAddress("Header", &eh); |
ph = eh->GetPscuHeader(); |
171 |
for (Int_t j = 0; j < events; j++){ |
if((ph->GetOrbitalTime()) <= firstime) firstime=ph->GetOrbitalTime(); |
172 |
tr->GetEntry(j); |
if((ph->GetOrbitalTime()) >= lastime) lastime=ph->GetOrbitalTime(); |
173 |
ph = eh->GetPscuHeader(); |
iii++; |
174 |
ph->GetFileOffset(); |
} |
175 |
if(ph->GetFileOffset() <= minoffset) minoffset=ph->GetFileOffset(); |
|
|
if(ph->GetFileOffset() >= maxoffset) maxoffset=ph->GetFileOffset(); |
|
|
} |
|
|
}*/ |
|
|
//*************************** Histograms ************************************************************// |
|
176 |
//------------------------ First histogram -----------------------------------// |
//------------------------ First histogram -----------------------------------// |
177 |
headBr->GetEntry(0); |
|
|
ph = eh->GetPscuHeader(); |
|
|
firstime = ph->GetOrbitalTime(); |
|
|
headBr->GetEntry(nevents-1); |
|
|
ph = eh->GetPscuHeader(); |
|
|
lastime = ph->GetOrbitalTime(); |
|
178 |
obmin=firstime; |
obmin=firstime; |
179 |
obmax=lastime; |
obmax=lastime; |
180 |
|
|
181 |
oss1.str(""); |
oss1.str(""); |
182 |
oss1 << filename.Data() << ": Physics Packet per minute;" <<" start @ " << firstime << ", end @ "<< lastime <<"ms"; |
oss1 << filename.Data() <<": Physics Packet per minute. Start time = " << obmin << ", End time = "<< obmax <<" ms"; |
183 |
Int_t nbin = (lastime-firstime)/60000; |
Int_t nbin = (lastime-firstime)/60000; |
184 |
TH1F *h1 = new TH1F ("histo1", oss1.str().c_str(), nbin, obmin, obmax); |
//TH1F *h1 = new TH1F ("histo1", oss1.str().c_str(), nbin, obmin, obmax); |
185 |
|
TH1F *h1 = new TH1F ("histo1", "" , nbin, obmin, obmax); |
186 |
//------------------------ Second histogram -----------------------------------// |
|
187 |
oss2.str(""); |
oss2.str(""); |
188 |
oss2 << filename.Data() << ": Lenght of Physic packets;"; |
oss2 << filename.Data() <<": Lenght of Physic packets"; |
189 |
Int_t nint = (lastime-firstime); |
Int_t nbin2 =(lastime-firstime); |
190 |
TH1F *PcktLenght = new TH1F ("histo2", oss2.str().c_str(), nint, obmin, obmax); |
//TH1F *packetLength = new TH1F ("packetLength", oss2.str().c_str(), nbin2, obmin, obmax); |
191 |
|
TH1F *packetLength = new TH1F ("packetLength", "", nbin2, obmin, obmax); |
192 |
|
|
|
//------------------------ Third histogram -----------------------------------// |
|
193 |
oss3.str(""); |
oss3.str(""); |
194 |
oss3 << filename.Data() << ": Physics Counter"; |
oss3 << filename.Data() <<": Physics Counter vs. OBT"; |
195 |
TH1F *PcktCounter = new TH1F ("histo3", oss3.str().c_str(), nint, obmin, obmax); |
// TH1F *packeCounter = new TH1F ("packeCounter", oss3.str().c_str(), nbin2, obmin, obmax); |
196 |
|
TH1F *packeCounter = new TH1F ("packeCounter", "", nbin2, obmin, obmax); |
197 |
|
//---------------------------------------------------- |
198 |
|
TCanvas *finalCanv = new TCanvas("Header", base, 1200, 1600); |
199 |
|
finalCanv->Divide(1,5); |
200 |
|
finalCanv->SetFillColor(10); |
201 |
|
|
202 |
|
TPad *all2= new TPad ("","", 0, 0, 1, 1); |
203 |
|
all2->SetFillColor(10); |
204 |
|
TPad *all3= new TPad ("","", 0, 0, 1, 1); |
205 |
|
all3->SetFillColor(10); |
206 |
|
TPad *all4= new TPad ("","", 0, 0, 1, 1); |
207 |
|
all4->SetFillColor(10); |
208 |
|
TPad *all= new TPad ("","", 0, 0, 1, 1); |
209 |
|
all->SetFillColor(10); |
210 |
|
TPad *all1= new TPad ("","", 0, 0, 1, 1); |
211 |
|
all1->SetFillColor(10); |
212 |
|
TPad *pad = new TPad("pad","pad", .80,.50,.90,.80); |
213 |
|
pad->SetFillColor(10); |
214 |
|
//---------------------------------------------------- |
215 |
|
|
216 |
//------------------------ Fourth histogram -----------------------------------// |
TMultiGraph *mg1 = new TMultiGraph(); |
217 |
/*oss3.str(""); |
|
|
oss3 << filename.Data() << ": Packet Counter"; |
|
|
Int_t nintoffset = (maxoffset-minoffset)/10; |
|
|
TH1F *FileOffset = new TH1F ("histo4", oss3.str().c_str(), nintoffset, minoffset, maxoffset); |
|
|
*/ |
|
|
//**************************************************************************************************// |
|
|
//------- fill histograms ---------// |
|
|
|
|
|
for (Int_t i = 0; i < nevents; i++){ |
|
|
headBr->GetEntry(i); |
|
|
ph = eh->GetPscuHeader(); |
|
|
obt = ph->GetOrbitalTime(); |
|
|
pcktLenght=ph->GetPacketLenght(); |
|
|
pcktCounter=ph->GetCounter(); |
|
|
h1->Fill(obt); |
|
|
PcktLenght->Fill(obt,pcktLenght); |
|
|
PcktCounter->Fill(obt,pcktCounter); |
|
|
} |
|
218 |
|
|
219 |
/*for (Int_t i=0; i<numkey; i++){ |
TMultiGraph *mg2 = new TMultiGraph(); |
|
key = list->At(i); |
|
|
name=(char *)(key->GetName()); |
|
|
tr1 = (TTree*)file->Get(name); |
|
|
if (tr1->IsZombie()) continue; |
|
|
tr1->SetBranchAddress("Header", &eh); |
|
|
ev = tr1->GetEntries(); |
|
|
for (Int_t j = 0; j < ev; j++){ |
|
|
tr1->GetEntry(j); |
|
|
ph = eh->GetPscuHeader(); |
|
|
offset=ph->GetFileOffset(); |
|
|
allCounter= ph->GetCounter(); |
|
|
FileOffset->Fill(offset,allCounter); |
|
|
} |
|
|
}*/ |
|
220 |
|
|
221 |
//****************************** Canvases *******************************// |
|
222 |
//TGaxis::SetMaxDigits(4); |
//-------------------------------------------------------------------------- |
223 |
//------------------- First Canvas --------------------------------// |
for (Int_t l = 0; l < nevents; l++){ |
224 |
TCanvas *finalCanv1 = new TCanvas("Header_1", base, 1280, 1024); |
headBr->GetEntry(l); |
225 |
finalCanv1->Divide(1,3); |
ph = eh->GetPscuHeader(); |
226 |
finalCanv1->SetFillColor(10); |
h1->Fill(ph->GetOrbitalTime()); |
227 |
|
packetLength->Fill(ph->GetOrbitalTime(),ph->GetPacketLenght()); |
228 |
|
packeCounter->Fill(ph->GetOrbitalTime(),ph->GetCounter()); |
229 |
|
} |
230 |
|
|
231 |
|
//------------ First Canvas ---------------------// |
232 |
|
TLine li; |
233 |
|
li.SetLineStyle(4); |
234 |
|
li.SetLineWidth(2); |
235 |
|
|
236 |
|
finalCanv->cd(1); |
237 |
|
all2->Draw(); |
238 |
|
all2->cd(); |
239 |
|
|
|
finalCanv1->cd(1); |
|
240 |
h1->SetStats(kFALSE); |
h1->SetStats(kFALSE); |
241 |
h1->GetXaxis()->SetTitle("OBT (ms)"); |
h1->GetXaxis()->SetTitle("OBT (ms)"); |
242 |
h1->GetXaxis()->CenterTitle(); |
h1->GetXaxis()->CenterTitle(); |
243 |
h1->GetXaxis()->SetLabelSize(0.04); |
h1->GetXaxis()->SetLabelSize(0.04); |
244 |
h1->GetYaxis()->SetTitle("Number of events "); |
h1->GetYaxis()->SetTitle("Number of events "); |
245 |
h1->GetYaxis()->CenterTitle(); |
h1->GetYaxis()->CenterTitle(); |
246 |
|
h1->GetYaxis()->SetLabelSize(0.06); |
247 |
h1->GetYaxis()->SetTitleSize(0.06); |
h1->GetYaxis()->SetTitleSize(0.06); |
248 |
h1->GetYaxis()->SetTitleOffset(0.8); |
h1->GetYaxis()->SetTitleOffset(0.6); |
249 |
h1->Draw(); |
h1->Draw(); |
250 |
|
for (Int_t l = 0; l < runnevents; l++){ |
251 |
|
RunHeadTr->GetEntry(l); |
252 |
|
ph = eH->GetPscuHeader(); |
253 |
|
int ws= reh->RM_ACQ_SETTING_MODE; |
254 |
|
int id = ph->GetPacketId1(); |
255 |
|
Int_t obt = ph->GetOrbitalTime(); |
256 |
|
if (ws==1){ |
257 |
|
li.SetLineColor(3); |
258 |
|
li.DrawLine(obt,0,obt,h1->GetMaximum()); |
259 |
|
} |
260 |
|
else if (ws==2){ |
261 |
|
li.SetLineColor(4); |
262 |
|
li.DrawLine(obt,0,obt,h1->GetMaximum()); |
263 |
|
} |
264 |
|
} |
265 |
|
|
266 |
|
finalCanv->cd(1); |
267 |
|
stringstream ws1, ws2; |
268 |
|
ws1.str(""); |
269 |
|
ws2.str(""); |
270 |
|
ws1<<"ACQ_SETTING_MODE = 1"; |
271 |
|
ws2<<"ACQ_SETTING_MODE = 2"; |
272 |
|
TPaveText *pt=0; |
273 |
|
pt = new TPaveText (.60,.92,.76,.98); |
274 |
|
pt->AddText(ws1.str().c_str()); |
275 |
|
pt->SetTextColor(3); |
276 |
|
pt->SetFillColor(10); |
277 |
|
pt->SetBorderSize(0); |
278 |
|
pt->Draw(); |
279 |
|
TPaveText *pt1=0; |
280 |
|
pt1 = new TPaveText (.76,.92,.92,.98); |
281 |
|
pt1->AddText(ws2.str().c_str()); |
282 |
|
pt1->SetTextColor(4); |
283 |
|
pt1->SetFillColor(10); |
284 |
|
pt1->SetBorderSize(0); |
285 |
|
pt1->Draw(); |
286 |
|
// TPaveText *pt1=0; |
287 |
|
pt1 = new TPaveText (.05,.91,.6,1); |
288 |
|
pt1->AddText(oss1.str().c_str()); |
289 |
|
pt1->SetTextColor(1); |
290 |
|
pt1->SetFillColor(10); |
291 |
|
pt1->SetBorderSize(0); |
292 |
|
pt1->Draw(); |
293 |
|
|
294 |
|
finalCanv->cd(2); |
295 |
|
all3->Draw(); |
296 |
|
all3->cd(); |
297 |
|
packetLength->SetStats(kFALSE); |
298 |
|
packetLength->SetMarkerColor(2); |
299 |
|
packetLength->SetMarkerSize(.5); |
300 |
|
packetLength->SetMarkerStyle(21); |
301 |
|
packetLength->GetXaxis()->SetTitle("OBT (ms)"); |
302 |
|
packetLength->GetXaxis()->CenterTitle(); |
303 |
|
packetLength->GetXaxis()->SetLabelSize(0.05); |
304 |
|
packetLength->GetYaxis()->SetTitle("Lenght (byte)"); |
305 |
|
packetLength->GetYaxis()->CenterTitle(); |
306 |
|
packetLength->GetYaxis()->SetLabelSize(0.05); |
307 |
|
packetLength->GetYaxis()->SetTitleSize(0.06); |
308 |
|
packetLength->GetYaxis()->SetTitleOffset(0.6); |
309 |
|
packetLength->Draw("9p"); |
310 |
|
finalCanv->cd(2); |
311 |
|
//TPaveText *pt=0; |
312 |
|
pt = new TPaveText (.6,.91,.90,1); |
313 |
|
pt->AddText(oss2.str().c_str()); |
314 |
|
pt->SetTextColor(2); |
315 |
|
pt->SetFillColor(10); |
316 |
|
pt->SetBorderSize(0); |
317 |
|
pt->Draw(); |
318 |
|
|
319 |
|
finalCanv->cd(3); |
320 |
|
all4->Draw(); |
321 |
|
all4->cd(); |
322 |
|
packeCounter->GetTitle(); |
323 |
|
packeCounter->SetStats(kFALSE); |
324 |
|
packeCounter->SetMarkerColor(4); |
325 |
|
packeCounter->SetMarkerSize(.2); |
326 |
|
packeCounter->SetMarkerStyle(21); |
327 |
|
packeCounter->GetXaxis()->SetTitle("OBT (ms)"); |
328 |
|
packeCounter->GetXaxis()->SetTitleSize(0.05); |
329 |
|
packeCounter->GetXaxis()->CenterTitle(); |
330 |
|
packeCounter->GetXaxis()->SetLabelSize(0.05); |
331 |
|
packeCounter->GetYaxis()->SetTitle("Counter"); |
332 |
|
packeCounter->GetYaxis()->SetTitleSize(0.05); |
333 |
|
packeCounter->GetYaxis()->CenterTitle(); |
334 |
|
packeCounter->GetYaxis()->SetLabelSize(0.05); |
335 |
|
packeCounter->GetYaxis()->SetTitleSize(0.06); |
336 |
|
packeCounter->GetYaxis()->SetTitleOffset(0.6); |
337 |
|
Double_t min = 500000000.; |
338 |
|
for (Int_t l = 0; l < nevents; l++){ |
339 |
|
if((packeCounter->GetBinContent(l))<= min && (packeCounter->GetBinContent(l))!= 0) min = packeCounter->GetBinContent(l); |
340 |
|
} |
341 |
|
packeCounter->SetMinimum(min); |
342 |
|
packeCounter->Draw("9p"); |
343 |
|
finalCanv->cd(3); |
344 |
|
TPaveText *pt2=0; |
345 |
|
pt2 = new TPaveText (.6,.91,.90,1); |
346 |
|
pt2->AddText(oss3.str().c_str()); |
347 |
|
pt2->SetTextColor(4); |
348 |
|
pt2->SetFillColor(10); |
349 |
|
pt2->SetBorderSize(0); |
350 |
|
pt2->Draw(); |
351 |
|
|
|
finalCanv1->cd(2); |
|
|
PcktLenght->SetStats(kFALSE); |
|
|
PcktLenght->GetXaxis()->SetTitle("OBT (ms)"); |
|
|
PcktLenght->GetXaxis()->CenterTitle(); |
|
|
PcktLenght->GetXaxis()->SetLabelSize(0.04); |
|
|
PcktLenght->GetYaxis()->SetTitle("Lenght (byte)"); |
|
|
PcktLenght->GetYaxis()->CenterTitle(); |
|
|
PcktLenght->GetYaxis()->SetLabelSize(0.04); |
|
|
PcktLenght->GetYaxis()->SetTitleSize(0.06); |
|
|
PcktLenght->GetYaxis()->SetTitleOffset(0.8); |
|
|
PcktLenght->SetMarkerColor(2); |
|
|
PcktLenght->SetMarkerSize(.5); |
|
|
PcktLenght->SetMarkerStyle(21); |
|
|
PcktLenght->Draw("9p"); |
|
|
|
|
|
finalCanv1->cd(3); |
|
|
PcktCounter->SetStats(kFALSE); |
|
|
PcktCounter->GetXaxis()->SetTitle("OBT (ms)"); |
|
|
PcktCounter->GetXaxis()->SetTitleSize(0.05); |
|
|
PcktCounter->GetXaxis()->CenterTitle(); |
|
|
PcktCounter->GetXaxis()->SetLabelSize(0.04); |
|
|
PcktCounter->GetYaxis()->SetTitle("Counter"); |
|
|
PcktCounter->GetYaxis()->SetTitleSize(0.05); |
|
|
PcktCounter->GetYaxis()->CenterTitle(); |
|
|
PcktCounter->GetYaxis()->SetLabelSize(0.04); |
|
|
PcktCounter->GetYaxis()->SetTitleSize(0.06); |
|
|
PcktCounter->GetYaxis()->SetTitleOffset(0.8); |
|
|
PcktCounter->SetMarkerColor(4); |
|
|
PcktCounter->SetMarkerSize(.5); |
|
|
PcktCounter->SetMarkerStyle(21); |
|
|
PcktCounter->Draw("9p"); |
|
|
//--------- Second Canvas -----------------------------// |
|
|
/*TCanvas *finalCanv2 = new TCanvas("Header_2", base, 1280, 1024); |
|
|
finalCanv2->Divide(1,2); |
|
|
finalCanv2->SetFillColor(10); |
|
|
|
|
|
finalCanv2->cd(1); |
|
|
PcktCounter->SetStats(kFALSE); |
|
|
PcktCounter->GetXaxis()->SetTitle("OBT (ms)"); |
|
|
PcktCounter->GetXaxis()->SetTitleSize(0.05); |
|
|
PcktCounter->GetXaxis()->CenterTitle(); |
|
|
PcktCounter->GetXaxis()->SetLabelSize(0.04); |
|
|
PcktCounter->GetYaxis()->SetTitle("Counter"); |
|
|
PcktCounter->GetYaxis()->SetTitleSize(0.05); |
|
|
PcktCounter->GetYaxis()->CenterTitle(); |
|
|
PcktCounter->GetYaxis()->SetLabelSize(0.04); |
|
|
PcktCounter->SetMarkerColor(4); |
|
|
PcktCounter->SetMarkerSize(.5); |
|
|
PcktCounter->SetMarkerStyle(21); |
|
|
PcktCounter->Draw("9p"); |
|
|
|
|
|
finalCanv2->cd(2); |
|
|
FileOffset->SetStats(kFALSE); |
|
|
FileOffset->GetXaxis()->SetTitle("File Offset"); |
|
|
FileOffset->GetXaxis()->CenterTitle(); |
|
|
FileOffset->GetXaxis()->SetTitleSize(0.05); |
|
|
FileOffset->GetXaxis()->SetLabelSize(0.04); |
|
|
FileOffset->GetYaxis()->SetTitle("Counter"); |
|
|
FileOffset->GetYaxis()->CenterTitle(); |
|
|
FileOffset->GetYaxis()->SetTitleSize(0.05); |
|
|
FileOffset->GetYaxis()->SetLabelSize(0.04); |
|
|
FileOffset->SetMarkerColor(3); |
|
|
FileOffset->SetMarkerSize(.5); |
|
|
FileOffset->SetMarkerStyle(21); |
|
|
FileOffset->Draw("9p");*/ |
|
|
|
|
|
//-------to save---------------------------/// |
|
|
oss.str(""); |
|
|
oss1.str(""); |
|
352 |
|
|
353 |
oss << outDir.Data() << filename.Data(); |
//------------------------------------------------- |
354 |
oss1 << outDir.Data() << filename.Data(); |
TList *list = new TList; |
355 |
|
Int_t numkey; |
356 |
|
TObject *key = new TObject; |
357 |
|
const char *name; |
358 |
|
TTree* tr = new TTree; |
359 |
|
Long64_t nevntskey=0; |
360 |
|
list = file->GetListOfKeys(); |
361 |
|
numkey = file->GetNkeys(); |
362 |
|
int ll=0; |
363 |
|
int kk=0; |
364 |
|
|
365 |
|
for (Int_t i=0; i<numkey; i++){ |
366 |
|
key = list->At(i); |
367 |
|
name=(char *)(key->GetName()); |
368 |
|
tr = (TTree*)file->Get(name); |
369 |
|
if (tr->IsZombie()) continue; |
370 |
|
tr->SetBranchAddress("Header", &eh); |
371 |
|
TBranch *Br = tr->GetBranch("Header"); |
372 |
|
nevntskey = tr->GetEntries(); |
373 |
|
|
374 |
|
if(nevntskey !=0){ |
375 |
|
Int_t size1=nevntskey; |
376 |
|
Double_t *PscuCounter1 = new Double_t[size1]; |
377 |
|
Double_t *FileOffset1 = new Double_t[size1]; |
378 |
|
Double_t *tempo1 = new Double_t[size1]; |
379 |
|
//Double_t *salto= new Double_t[100]; |
380 |
|
//Double_t *salto1= new Double_t[100]; |
381 |
|
|
382 |
|
int l=0; |
383 |
|
while(l<nevntskey){ |
384 |
|
Br->GetEntry(l); |
385 |
|
ph = eh->GetPscuHeader(); |
386 |
|
PscuCounter1[l]= ph->GetCounter(); |
387 |
|
FileOffset1[l]=ph->GetFileOffset(); |
388 |
|
tempo1[l]=ph->GetOrbitalTime(); |
389 |
|
if(ph->GetFileOffset()<= primoffset){ |
390 |
|
primoffset =ph->GetFileOffset(); |
391 |
|
primotempo=ph->GetOrbitalTime(); |
392 |
|
} |
393 |
|
if(ph->GetFileOffset()>= ultimoffset){ |
394 |
|
ultimoffset = ph->GetFileOffset(); |
395 |
|
ultimotempo = ph->GetOrbitalTime(); |
396 |
|
} |
397 |
|
/*if(l>0){ |
398 |
|
if(tempo1[l] < tempo1[l-1]){ |
399 |
|
salto1[kk] =(const Double_t*)tempo1[l-1]; |
400 |
|
salto[ll]= ph->GetOrbitalTime(); |
401 |
|
ll=ll+1; |
402 |
|
kk=kk+1; |
403 |
|
} |
404 |
|
}*/ |
405 |
|
l++; |
406 |
|
} |
407 |
|
|
408 |
|
TGraph *graph3= new TGraph(nevntskey, (const Double_t*)FileOffset1, (const Double_t*)PscuCounter1); |
409 |
|
graph3->SetMarkerColor(3); |
410 |
|
graph3->SetMarkerSize(.2); |
411 |
|
graph3->SetMarkerStyle(21); |
412 |
|
mg1->Add(graph3); |
413 |
|
|
414 |
|
TGraph *graph4= new TGraph(nevntskey, (const Double_t*)FileOffset1, (const Double_t*)tempo1); |
415 |
|
graph4->SetMarkerColor(kBlue); |
416 |
|
graph4->SetMarkerSize(.2); |
417 |
|
graph4->SetMarkerStyle(21); |
418 |
|
mg2->Add(graph4); |
419 |
|
} |
420 |
|
} |
421 |
|
|
422 |
|
kk=kk-1; |
423 |
|
ll=ll-1; |
424 |
|
|
425 |
|
TLatex *lat = new TLatex(); |
426 |
|
lat->SetTextAlign(12); |
427 |
|
lat->SetTextSize(0.15); |
428 |
|
lat->SetTextColor(kBlue); |
429 |
|
//------------ Second Canvas ---------------------// |
430 |
|
finalCanv->cd(4); |
431 |
|
all1->Draw(); |
432 |
|
all1->cd(); |
433 |
|
|
434 |
|
oss1.str(""); |
435 |
|
oss1 << filename.Data() <<": PscuCounter vs FileOffset."; |
436 |
|
//mg1->SetTitle(oss1.str().c_str()); |
437 |
|
mg1->Draw("AP"); |
438 |
|
mg1->GetXaxis()->SetTitle("File Offset"); |
439 |
|
mg1->GetXaxis()->CenterTitle(); |
440 |
|
mg1->GetXaxis()->SetTitleSize(0.045); |
441 |
|
mg1->GetXaxis()->SetLabelSize(0.05); |
442 |
|
mg1->GetYaxis()->SetTitle("Counter"); |
443 |
|
mg1->GetYaxis()->CenterTitle(); |
444 |
|
mg1->GetYaxis()->SetTitleSize(0.05); |
445 |
|
mg1->GetYaxis()->SetLabelSize(0.06); |
446 |
|
mg1->GetYaxis()->SetTitleOffset(0.7); |
447 |
|
finalCanv->cd(4); |
448 |
|
TPaveText *pt3=0; |
449 |
|
pt3 = new TPaveText (.60,.91,.90,1); |
450 |
|
pt3->AddText(oss1.str().c_str()); |
451 |
|
pt3->SetTextColor(3); |
452 |
|
pt3->SetFillColor(10); |
453 |
|
pt3->SetBorderSize(0); |
454 |
|
pt3->Draw(); |
455 |
|
|
456 |
|
|
457 |
|
finalCanv->cd(5); |
458 |
|
all->Draw(); |
459 |
|
all->cd(); |
460 |
|
|
461 |
|
oss3.str(""); |
462 |
|
oss3 << filename.Data() <<" OBT vs FileOffset. First packet = "<<primotempo <<" ms, Last packet = "<<ultimotempo<<" ms."; |
463 |
|
//mg2->SetTitle(oss3.str().c_str()); |
464 |
|
mg2->Draw("AP"); |
465 |
|
mg2->GetXaxis()->SetTitle("File Offset"); |
466 |
|
mg2->GetXaxis()->CenterTitle(); |
467 |
|
mg2->GetXaxis()->SetTitleSize(0.045); |
468 |
|
mg2->GetXaxis()->SetLabelSize(0.05); |
469 |
|
mg2->GetYaxis()->SetTitle("OBT"); |
470 |
|
mg2->GetYaxis()->CenterTitle(); |
471 |
|
mg2->GetYaxis()->SetTitleSize(0.05); |
472 |
|
mg2->GetYaxis()->SetLabelSize(0.055); |
473 |
|
mg2->GetYaxis()->SetTitleOffset(0.6); |
474 |
|
/*pad->Draw(); |
475 |
|
pad->cd(); |
476 |
|
stringa.str(""); |
477 |
|
stringa << "new data from "<< primotempo;//<<" to "<< salto1; |
478 |
|
lat->DrawLatex(0.08, 0.8, stringa.str().c_str()); |
479 |
|
double min2 = 0.8; |
480 |
|
if(ll > 0){ |
481 |
|
pad->Draw(); |
482 |
|
pad->cd(); |
483 |
|
for(Int_t k=0; k <(kk); k++){ |
484 |
|
stringa.str(""); |
485 |
|
stringa << "old data from "<< salto[kk]<< " to "<<salto1[kk+1]; |
486 |
|
min2=min2-0.1; |
487 |
|
lat->DrawLatex(0.08, min2,stringa.str().c_str()); |
488 |
|
//cout<<salto[kk]<<";\n"; |
489 |
|
} |
490 |
|
}*/ |
491 |
|
|
492 |
|
finalCanv->cd(5); |
493 |
|
TPaveText *pt4=0; |
494 |
|
pt4 = new TPaveText (.38 ,.91,.92,1); |
495 |
|
pt4->AddText(oss3.str().c_str()); |
496 |
|
pt4->SetTextColor(kBlue); |
497 |
|
pt4->SetFillColor(10); |
498 |
|
pt4->SetBorderSize(0); |
499 |
|
pt4->Draw(); |
500 |
|
|
501 |
|
// finalCanv->Draw(); |
502 |
|
finalCanv->Update(); |
503 |
|
|
504 |
|
oss1.str(""); |
505 |
|
oss1 << outDir.Data() << filename.Data(); |
506 |
|
oss1 << "_HeaderScan"<<"." << format.Data(); |
507 |
|
|
508 |
|
finalCanv->SaveAs(oss1.str().c_str()); |
509 |
|
|
|
oss << "_HeaderScan_1." << format.Data(); |
|
|
oss1 << "_HeaderScan_2." << format.Data(); |
|
|
|
|
|
finalCanv1->SaveAs(oss.str().c_str()); |
|
|
//finalCanv2->SaveAs(oss1.str().c_str()); |
|
510 |
|
|
511 |
file->Close(); |
|
512 |
|
file->Close(); |
513 |
|
|
514 |
} |
} |
515 |
|
|
|
|
|
|
|
|
516 |
int main(int argc, char* argv[]){ |
int main(int argc, char* argv[]){ |
517 |
TString path; |
TString path; |
518 |
TString outDir = "./"; |
TString outDir = "./"; |
556 |
} |
} |
557 |
HeaderScan(argv[1], outDir, format); |
HeaderScan(argv[1], outDir, format); |
558 |
} |
} |
559 |
|
|