/[PAMELA software]/quicklook/QLflightTmtc_Header/PacketScan.cpp
ViewVC logotype

Contents of /quicklook/QLflightTmtc_Header/PacketScan.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Tue Oct 24 08:23:17 2006 UTC (18 years, 4 months ago) by pam-rm2
Branch: MAIN
CVS Tags: v3r03
Changes since 1.2: +10 -12 lines
aggiornato il PacketScan perche' sia compatibile con Yoda_3/14

1
2 /**
3 * Packet Scan
4 * author Marcelli
5 * version 1.0 - 2 February 2006
6 *
7 * Description: This script creates a Multigraph to show packetID variable (for all packets) vs. OBT with an axplicative legend
8 *
9 ** Version 1.25 - 13 January 2005
10 * Changed Int_t to Float because of variable range size
11 * (UInt_t has been excluded beacuse of uncompatibility with TGraph)
12 *
13 * version 1.3 - 22 February 2005 - Nagni
14 * For compatibility with batch mode excution:
15 * 1) Added "include <iostream>" and "using namespace std"
16 * 2) Removed gROOT->Reset()
17 *
18 * Version 1.4
19 * Date 08 March 2005 - Nagni
20 * Added "format" parameter for saving the produced image in various formats
21 * (for a complete list of types refer to TPad::SaveAs method)
22 *
23 * Version 1.5
24 * Date 09 February 2006 - Marcelli
25 * Update to work with new Yoda output
26 *
27 *
28 * Version 1.6
29 * Date 27 February 2006 - Marcelli
30 * For compilation:
31 * Added function "int main(int argc, char* argv[])"
32 *
33 *
34 * Description: To show packet type recorded by PAMELA (Packet type vs. OBT)
35 *
36 * Parameters:
37 * TSTring base - the path to the root directory for the specific Pamela unpack session
38 * There is no default value, without this input the program will not run
39 * TString outDir - the path where to save the output image (Default = ./)
40 * TString format - the format which will be used fo rsave the produced images (Default = "jpg")
41 *
42 */
43
44
45 #include <stdio.h>
46 #include <string.h>
47 #include <fstream>
48 #include <sstream>
49 #include <iostream>
50 #include "TString.h"
51 #include "TFile.h"
52 #include "TGraph.h"
53 #include "TTree.h"
54 #include "TMultiGraph.h"
55 #include "TCanvas.h"
56 #include "TLegend.h"
57 #include "TObjString.h"
58 #include "EventHeader.h"
59 #include "PscuHeader.h"
60
61
62 using namespace std;
63
64 void PacketScan(TString base, TString outDir, TString format){
65
66 TFile *file = new TFile(base.Data());
67
68 if (!file){
69 printf("No such file in the directory has been found");
70 return;
71 }
72 if (outDir == "" ) outDir = ".";
73
74 TList *list=file->GetListOfKeys();
75
76 Int_t numkey = file->GetNkeys();
77
78 pamela::EventHeader *eh = 0;
79 pamela::PscuHeader *ph = 0;
80
81 Float_t obt[1]={0};
82 Float_t id[1]={0};
83 Int_t cont[48]={0};
84 std::stringstream oss, oss1, oss2, oss3;
85
86
87 TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString();
88 filename = ((TObjString*)filename.Tokenize('.')->First())->GetString();
89 oss.str("");
90 oss << "PACKET ID - OBT: " << filename.Data();
91
92
93 TCanvas *finalCanv1 = new TCanvas("Packet_1", "PacketScan1", 1280, 1024);
94 finalCanv1->SetFillColor(10);
95 TMultiGraph *mg1 = new TMultiGraph();
96 mg1->SetTitle(oss.str().c_str());
97 TLegend *leg1b = new TLegend(0.80,0.67,0.99,0.99, "");
98
99
100 TCanvas *finalCanv2 = new TCanvas("Packet_2", "PacketScan2", 1280, 1024);
101 finalCanv2->SetFillColor(10);
102 TMultiGraph *mg2 = new TMultiGraph();
103 mg2->SetTitle(oss.str().c_str());
104 TLegend *leg2 = new TLegend(0.87,0.70,0.99,0.99, "");
105
106
107
108 TCanvas *finalCanv3 = new TCanvas("Packet_3", "PacketScan3", 1280, 1024);
109 finalCanv3->SetFillColor(10);
110 TMultiGraph *mg3 = new TMultiGraph();
111 mg3->SetTitle(oss.str().c_str());
112 TLegend *leg3 = new TLegend(0.87,0.65,0.99,0.99, "");
113
114 TObject *key = new TObject;
115 const char *name;
116 char *SoftInfo="SoftInfo";
117 for (Int_t i=0; i<numkey; i++){
118 key = list->At(i);
119 name=(char *)(key->GetName());
120 if(strcmp(name,SoftInfo)==0)continue;
121 TTree* tr = (TTree*)file->Get(name);
122 if (tr->IsZombie()) continue;
123 Long64_t nevents = tr->GetEntries();
124 const Int_t size = nevents;
125 tr->SetBranchAddress("Header", &eh);
126 for (Int_t j = 0; j < size; j++){
127 tr->GetEntry(j);
128 ph = eh->GetPscuHeader();
129 obt[0]= ph->GetOrbitalTime();
130 id[0]=(ph->GetPacketId1());
131 Int_t type = (int)id[0];
132 switch(type){
133 //physic block
134 case 7: {
135 TGraph *graph = new TGraph(1, obt, id);
136 graph->SetMarkerColor(2);
137 graph->SetMarkerStyle(21);
138 graph->SetMarkerSize(0.6);
139 mg1->Add(graph);
140 if (cont[0]==0) leg1b->AddEntry(graph,"PhysEndRun (0x07)","p");
141 cont[0]++;
142 break;
143 }
144 case 16:{
145 TGraph *graph = new TGraph(1, obt, id);
146 graph->SetMarkerColor(2);
147 graph->SetMarkerStyle(21);
148 graph->SetMarkerSize(0.5);
149 mg1->Add(graph);
150 if (cont[1]==0) leg1b->AddEntry(graph,"Physics (0x10)","p");
151 cont[1]++;
152 break;
153 }
154 case 32:{
155 TGraph *graph = new TGraph(1, obt, id);
156 graph->SetMarkerColor(4);
157 graph->SetMarkerStyle(21);
158 graph->SetMarkerSize(0.9);
159 mg1->Add(graph);
160 if (cont[2]==0) leg1b->AddEntry(graph,"RunHeader/Trailer (0x20/21)","p");
161 cont[2]++;
162 break;
163 }
164 case 33:{
165 TGraph *graph = new TGraph(1, obt, id);
166 graph->SetMarkerColor(4);
167 graph->SetMarkerStyle(21);
168 graph->SetMarkerSize(0.9);
169 mg1->Add(graph);
170 if (cont[2]==0) leg1b->AddEntry(graph,"RunHeader/Trailer (0x20/21)","p");
171 cont[2]++;
172 break;
173 }
174 //calibration block
175 case 8:{
176 TGraph *graph = new TGraph(1, obt, id);
177 graph->SetMarkerColor(2);
178 graph->SetMarkerStyle(23);
179 graph->SetMarkerSize(1.2);
180 mg1->Add(graph);
181 if (cont[23]==0) leg1b->AddEntry(graph,"CalibCalPulse1 (0x08)","p");
182 cont[23]++;
183 break;
184 }
185 case 9:{
186 TGraph *graph = new TGraph(1, obt, id);
187 graph->SetMarkerColor(3);
188 graph->SetMarkerStyle(23);
189 graph->SetMarkerSize(1.2);
190 mg1->Add(graph);
191 if (cont[24]==0) leg1b->AddEntry(graph,"CalibCalPulse2 (0x09)","p");
192 cont[24]++;
193 break;
194 }
195 case 17:{
196 TGraph *graph = new TGraph(1, obt, id);
197 graph->SetMarkerColor(4);
198 graph->SetMarkerStyle(23);
199 graph->SetMarkerSize(1.2);
200 mg1->Add(graph);
201 if (cont[25]==0) leg1b->AddEntry(graph,"CalibTrkBoth (0x11)","p");
202 cont[25]++;
203 break;
204 }
205 case 18:{
206 TGraph *graph = new TGraph(1, obt, id);
207 graph->SetMarkerColor(5);
208 graph->SetMarkerStyle(23);
209 graph->SetMarkerSize(1.2);
210 mg1->Add(graph);
211 if (cont[26]==0) leg1b->AddEntry(graph,"CalibTrk1 (0x12)","p");
212 cont[26]++;
213 break;
214 }
215 case 19:{
216 TGraph *graph = new TGraph(1, obt, id);
217 graph->SetMarkerColor(6);
218 graph->SetMarkerStyle(23);
219 graph->SetMarkerSize(1.2);
220 mg1->Add(graph);
221 if (cont[27]==0) leg1b->AddEntry(graph,"CalibTrk2 (0x13)","p");
222 cont[27]++;
223 break;
224 }
225 case 29:{
226 TGraph *graph = new TGraph(1, obt, id);
227 graph->SetMarkerColor(30);
228 graph->SetMarkerStyle(23);
229 graph->SetMarkerSize(1.2);
230 mg1->Add(graph);
231 if (cont[28]==0) leg1b->AddEntry(graph,"Calib_Cal (0x1d)","p");
232 cont[28]++;
233 break;
234 }
235 case 22:{
236 TGraph *graph = new TGraph(1, obt, id);
237 graph->SetMarkerColor(9);
238 graph->SetMarkerStyle(23);
239 graph->SetMarkerSize(1.2);
240 mg1->Add(graph);
241 if (cont[29]==0) leg1b->AddEntry(graph,"CalibTof (0x16)","p");
242 cont[29]++;
243 break;
244 }
245 case 23:{
246 TGraph *graph = new TGraph(1, obt, id);
247 graph->SetMarkerColor(7);
248 graph->SetMarkerStyle(23);
249 graph->SetMarkerSize(1.2);
250 mg1->Add(graph);
251 if (cont[30]==0) leg1b->AddEntry(graph,"CalibS4 (0x17)","p");
252 cont[30]++;
253 break;
254 }
255 case 24:{
256 TGraph *graph = new TGraph(1, obt, id);
257 graph->SetMarkerColor(49);
258 graph->SetMarkerStyle(23);
259 graph->SetMarkerSize(1.2);
260 mg1->Add(graph);
261 if (cont[31]==0) leg1b->AddEntry(graph,"CalibCalPed (0x18)","p");
262 cont[31]++;
263 break;
264 }
265 case 25:{
266 TGraph *graph = new TGraph(1, obt, id);
267 graph->SetMarkerColor(33);
268 graph->SetMarkerStyle(23);
269 graph->SetMarkerSize(1.2);
270 mg1->Add(graph);
271 if (cont[32]==0) leg1b->AddEntry(graph,"Calib1_Ac1 (0x19)","p");
272 cont[32]++;
273 break;
274 }
275 case 26:{
276 TGraph *graph = new TGraph(1, obt, id);
277 graph->SetMarkerColor(21);
278 graph->SetMarkerStyle(23);
279 graph->SetMarkerSize(1.2);
280 mg1->Add(graph);
281 if (cont[33]==0) leg1b->AddEntry(graph,"Calib2_Ac1 (0x1a)","p");
282 cont[33]++;
283 break;
284 }
285 case 27:{
286 TGraph *graph = new TGraph(1, obt, id);
287 graph->SetMarkerColor(16);
288 graph->SetMarkerStyle(23);
289 graph->SetMarkerSize(1.2);
290 mg1->Add(graph);
291 if (cont[34]==0) leg1b->AddEntry(graph,"Calib1_Ac2 (0x1b)","p");
292 cont[34]++;
293 break;
294 }
295 case 28:{
296 TGraph *graph = new TGraph(1, obt, id);
297 graph->SetMarkerColor(37);
298 graph->SetMarkerStyle(23);
299 graph->SetMarkerSize(1.2);
300 mg1->Add(graph);
301 if (cont[35]==0) leg1b->AddEntry(graph,"Calib2_Ac2 (0x1c)","p");
302 cont[35]++;
303 break;
304 }
305 case 34:{
306 TGraph *graph = new TGraph(1, obt, id);
307 graph->SetMarkerColor(41);
308 graph->SetMarkerStyle(23);
309 graph->SetMarkerSize(1.2);
310 mg1->Add(graph);
311 if (cont[36]==0) leg1b->AddEntry(graph,"CalibHeader/Trailer (0x22/23)","p");
312 cont[36]++;
313 break;
314 }
315 case 35:{
316 TGraph *graph = new TGraph(1, obt, id);
317 graph->SetMarkerColor(41);
318 graph->SetMarkerStyle(23);
319 graph->SetMarkerSize(1.2);
320 mg1->Add(graph);
321 if (cont[36]==0) leg1b->AddEntry(graph,"CalibHeader/Trailer (0x22/23)","p");
322 cont[36]++;
323 break;
324 }
325 //initialization block
326 case 36:{
327 TGraph *graph = new TGraph(1, obt, id);
328 graph->SetMarkerColor(20);
329 graph->SetMarkerStyle(22);
330 graph->SetMarkerSize(1.2);
331 mg1->Add(graph);
332 if (cont[4]==0) leg1b->AddEntry(graph,"InitHeader/Trailer (0x24/25)","p");
333 cont[4]++;
334 break;
335 }
336 case 37:{
337 TGraph *graph = new TGraph(1, obt, id);
338 graph->SetMarkerColor(20);
339 graph->SetMarkerStyle(22);
340 graph->SetMarkerSize(1.2);
341 mg1->Add(graph);
342 if (cont[4]==0) leg1b->AddEntry(graph,"InitHeader/Trailer (0x24/25)","p");
343 cont[4]++;
344 break;
345 }
346 case 48:{
347 TGraph *graph = new TGraph(1, obt, id);
348 graph->SetMarkerColor(3);
349 graph->SetMarkerStyle(21);
350 graph->SetMarkerSize(0.9);
351 mg2->Add(graph);
352 if (cont[38]==0) leg2->AddEntry(graph,"EventTrk (0x30)","p");
353 cont[38]++;
354 break;
355 }
356 //test block
357 case 64:{
358 TGraph *graph = new TGraph(1, obt, id);
359 graph->SetMarkerColor(2);
360 graph->SetMarkerStyle(22);
361 graph->SetMarkerSize(0.9);
362 mg2->Add(graph);
363 if (cont[39]==0) leg2->AddEntry(graph,"Test_trk (0x40)","p");
364 cont[39]++;
365 break;
366 }
367 case 65:{
368 TGraph *graph = new TGraph(1, obt, id);
369 graph->SetMarkerColor(3);
370 graph->SetMarkerStyle(22);
371 graph->SetMarkerSize(0.9);
372 mg2->Add(graph);
373 if (cont[40]==0) leg2->AddEntry(graph,"Test_Tof (0x41)","p");
374 cont[40]++;
375 break;
376 }
377 //Log block
378 case 80:{
379 TGraph *graph = new TGraph(1, obt, id);
380 graph->SetMarkerColor(3);
381 graph->SetMarkerStyle(21);
382 graph->SetMarkerSize(0.9);
383 mg2->Add(graph);
384 if (cont[41]==0) leg2->AddEntry(graph,"Log (0x50)","p");
385 cont[41]++;
386 break;
387 }
388 //Arrdump-Vardump-Tabdump block
389 case 81:{
390 TGraph *graph = new TGraph(1, obt, id);
391 graph->SetMarkerColor(2);
392 graph->SetMarkerStyle(23);
393 graph->SetMarkerSize(0.9);
394 mg2->Add(graph);
395 if (cont[42]==0) leg2->AddEntry(graph,"VarDump (0X51)","p");
396 cont[42]++;
397 break;
398 }
399 case 82:{
400 TGraph *graph = new TGraph(1, obt, id);
401 graph->SetMarkerColor(3);
402 graph->SetMarkerStyle(23);
403 graph->SetMarkerSize(0.9);
404 mg2->Add(graph);
405 if (cont[43]==0) leg2->AddEntry(graph,"ArrDump (x52)","p");
406 cont[43]++;
407 break;
408 }
409 case 83:{
410 TGraph *graph = new TGraph(1, obt, id);
411 graph->SetMarkerColor(4);
412 graph->SetMarkerStyle(23);
413 graph->SetMarkerSize(0.9);
414 mg2->Add(graph);
415 if (cont[44]==0) leg2->AddEntry(graph,"TabDump (0x53)","p");
416 cont[44]++;
417 break;
418 }
419 //Tmtc Block
420 case 84:{
421 TGraph *graph = new TGraph(1, obt, id);
422 graph->SetMarkerColor(2);
423 graph->SetMarkerStyle(21);
424 graph->SetMarkerSize(0.9);
425 mg2->Add(graph);
426 if (cont[45]==0) leg2->AddEntry(graph,"Tmtc (0x54)","p");
427 cont[45]++;
428 break;
429 }
430 //Mcmd Block
431 case 85:{
432 TGraph *graph = new TGraph(1, obt, id);
433 graph->SetMarkerColor(4);
434 graph->SetMarkerStyle(21);
435 graph->SetMarkerSize(0.9);
436 mg2->Add(graph);
437 if (cont[46]==0) leg2->AddEntry(graph,"Mcmd (0x55)","p");
438 cont[46]++;
439 break;
440 }
441 case 96:{
442 TGraph *graph = new TGraph(1, obt, id);
443 graph->SetMarkerColor(20);
444 graph->SetMarkerStyle(21);
445 graph->SetMarkerSize(0.9);
446 mg2->Add(graph);
447 if (cont[22]==0) leg2->AddEntry(graph,"ForceFECmd (0x60)","p");
448 cont[22]++;
449 break;
450 }
451 case 112:{
452 TGraph *graph = new TGraph(1, obt, id);
453 graph->SetMarkerColor(1);
454 graph->SetMarkerStyle(22);
455 graph->SetMarkerSize(0.9);
456 mg3->Add(graph);
457 if (cont[6]==0) leg3->AddEntry(graph,"Ac1Init (0x70)","p");
458 cont[6]++;
459 break;
460 }
461 case 113:{
462 TGraph *graph = new TGraph(1, obt, id);
463 graph->SetMarkerColor(2);
464 graph->SetMarkerStyle(22);
465 graph->SetMarkerSize(0.9);
466 mg3->Add(graph);
467 if (cont[7]==0) leg3->AddEntry(graph,"CalInit (0x71)","p");
468 cont[7]++;
469 break;
470 }
471 case 114:{
472 TGraph *graph = new TGraph(1, obt, id);
473 graph->SetMarkerColor(3);
474 graph->SetMarkerStyle(22);
475 graph->SetMarkerSize(0.9);
476 mg3->Add(graph);
477 if (cont[8]==0) leg3->AddEntry(graph,"TrkInit (0x72)","p");
478 cont[8]++;
479 break;
480 }
481 case 115:{
482 TGraph *graph = new TGraph(1, obt, id);
483 graph->SetMarkerColor(4);
484 graph->SetMarkerStyle(22);
485 graph->SetMarkerSize(0.9);
486 mg3->Add(graph);
487 if (cont[9]==0) leg3->AddEntry(graph,"TofInit (0x73)","p");
488 cont[9]++;
489 break;
490 }
491 case 116:{
492 TGraph *graph = new TGraph(1, obt, id);
493 graph->SetMarkerColor(5);
494 graph->SetMarkerStyle(22);
495 graph->SetMarkerSize(0.9);
496 mg3->Add(graph);
497 if (cont[10]==0) leg3->AddEntry(graph,"TrgInit (0x74)","p");
498 cont[10]++;
499 break;
500 }
501 case 117:{
502 TGraph *graph = new TGraph(1, obt, id);
503 graph->SetMarkerColor(6);
504 graph->SetMarkerStyle(22);
505 graph->SetMarkerSize(0.9);
506 mg3->Add(graph);
507 if (cont[11]==0) leg3->AddEntry(graph,"NdInit (0x75)","p");
508 cont[11]++;
509 break;
510 }
511 case 118:{
512 TGraph *graph = new TGraph(1, obt, id);
513 graph->SetMarkerColor(7);
514 graph->SetMarkerStyle(22);
515 graph->SetMarkerSize(0.9);
516 mg3->Add(graph);
517 if (cont[12]==0) leg3->AddEntry(graph,"S4Init (0x76)","p");
518 cont[12]++;
519 break;
520 }
521 case 119:{
522 TGraph *graph = new TGraph(1, obt, id);
523 graph->SetMarkerColor(32);
524 graph->SetMarkerStyle(22);
525 graph->SetMarkerSize(0.9);
526 mg3->Add(graph);
527 if (cont[13]==0) leg3->AddEntry(graph,"Ac2Init (0x77)","p");
528 cont[13]++;
529 break;
530 }
531 //Alarm block
532 case 129:{
533 TGraph *graph = new TGraph(1, obt, id);
534 graph->SetMarkerColor(1);
535 graph->SetMarkerStyle(21);
536 graph->SetMarkerSize(0.7);
537 mg3->Add(graph);
538 if (cont[14]==0) leg3->AddEntry(graph,"CalAlarm (0x81)","p");
539 cont[14]++;
540 break;
541 }
542 case 130:{
543 TGraph *graph = new TGraph(1, obt, id);
544 graph->SetMarkerColor(42);
545 graph->SetMarkerStyle(21);
546 graph->SetMarkerSize(0.7);
547 mg3->Add(graph);
548 if (cont[15]==0) leg3->AddEntry(graph,"Ac1Alarm (0x82)","p");
549 cont[15]++;
550 break;
551 }
552 case 131:{
553 TGraph *graph = new TGraph(1, obt, id);
554 graph->SetMarkerColor(3);
555 graph->SetMarkerStyle(21);
556 graph->SetMarkerSize(0.7);
557 mg3->Add(graph);
558 if (cont[16]==0) leg3->AddEntry(graph,"TrkAlarm (0x83)","p");
559 cont[16]++;
560 break;
561 }
562 case 132:{
563 TGraph *graph = new TGraph(1, obt, id);
564 graph->SetMarkerColor(4);
565 graph->SetMarkerStyle(21);
566 graph->SetMarkerSize(0.7);
567 mg3->Add(graph);
568 if (cont[17]==0) leg3->AddEntry(graph,"TrgAlarm (0x84)","p");
569 cont[17]++;
570 break;
571 }
572 case 133:{
573 TGraph *graph = new TGraph(1, obt, id);
574 graph->SetMarkerColor(5);
575 graph->SetMarkerStyle(21);
576 graph->SetMarkerSize(0.7);
577 mg3->Add(graph);
578 if (cont[18]==0) leg3->AddEntry(graph,"TofAlarm (0x85)","p");
579 cont[18]++;
580 break;
581 }
582 case 134:{
583 TGraph *graph = new TGraph(1, obt, id);
584 graph->SetMarkerColor(6);
585 graph->SetMarkerStyle(21);
586 graph->SetMarkerSize(0.7);
587 mg3->Add(graph);
588 if (cont[19]==0) leg3->AddEntry(graph,"S4Alarm (0x86)","p");
589 cont[19]++;
590 break;
591 }
592 case 136:{
593 TGraph *graph = new TGraph(1, obt, id);
594 graph->SetMarkerColor(7);
595 graph->SetMarkerStyle(21);
596 graph->SetMarkerSize(0.7);
597 mg3->Add(graph);
598 if (cont[20]==0) leg3->AddEntry(graph,"Ac2Alarm (0x88)","p");
599 cont[20]++;
600 break;
601 }
602 /*case 137:{
603 TGraph *graph = new TGraph(1, obt, id);
604 graph->SetMarkerColor(32);
605 graph->SetMarkerStyle(21);
606 graph->SetMarkerSize(1.3);
607 mg3->Add(graph);
608 if (cont[21]==0) leg3->AddEntry(graph,"ac2_alarm (137=0x89)","p");
609 cont[21]++;
610 break;
611 }
612 case 138:{
613 TGraph *graph = new TGraph(1, obt, id);
614 graph->SetMarkerColor(20);
615 graph->SetMarkerStyle(21);
616 graph->SetMarkerSize(1.3);
617 mg3->Add(graph);
618 if (cont[22]==0) leg3->AddEntry(graph,"s4_adc_ac_2 (138=0x8a)","p");
619 cont[22]++;
620 break;
621 }*/
622 case 161:{
623 TGraph *graph = new TGraph(1, obt, id);
624 graph->SetMarkerColor(2);
625 graph->SetMarkerStyle(3);
626 graph->SetMarkerSize(1.1);
627 mg3->Add(graph);
628 if (cont[3]==0) leg3->AddEntry(graph,"TsbT (0xA1)","p");
629 cont[3]++;
630 break;
631 }
632 case 171:{
633 TGraph *graph = new TGraph(1, obt, id);
634 graph->SetMarkerColor(4);
635 graph->SetMarkerStyle(3);
636 graph->SetMarkerSize(1.1);
637 mg3->Add(graph);
638 if (cont[5]==0) leg3->AddEntry(graph,"TsbB (0xAB)","p");
639 cont[5]++;
640 break;
641 }
642 }
643
644 }
645 }
646
647
648 //*******************************TO DRAW AND SAVE*****************************************************///
649
650
651 finalCanv1->cd();
652 mg1->SetMinimum(0);
653 mg1->SetMaximum(55);
654 mg1->Draw("AP");
655 mg1->GetXaxis()->SetTitle("OBT (ms)");
656 mg1->GetXaxis()->CenterTitle();
657 mg1->GetYaxis()->SetTitle("Packet ID");
658 mg1->GetYaxis()->CenterTitle();
659 leg1b->Draw();
660 oss1.str("");
661 oss1 << outDir.Data() << filename.Data() << "_PacketScan_1." << format.Data();
662 finalCanv1->Update();
663 finalCanv1->SaveAs(oss1.str().c_str());
664
665
666 finalCanv2->cd();
667 mg2->SetMinimum(60);
668 mg2->SetMaximum(100);
669 mg2->Draw("AP");
670 mg2->GetXaxis()->SetTitle("OBT (ms)");
671 mg2->GetXaxis()->CenterTitle();
672 mg2->GetYaxis()->SetTitle("Packet ID");
673 mg2->GetYaxis()->CenterTitle();
674 leg2->Draw();
675 oss2.str("");
676 oss2 << outDir.Data() << filename.Data() << "_PacketScan_2." << format.Data();
677 finalCanv2->Update();
678 finalCanv2->SaveAs(oss2.str().c_str());
679
680
681 finalCanv3->cd();
682 mg3->SetMinimum(110);
683 mg3->SetMaximum(180);
684 mg3->Draw("AP");
685 mg3->GetXaxis()->SetTitle("OBT (ms)");
686 mg3->GetXaxis()->CenterTitle();
687 mg3->GetYaxis()->SetTitle("Packet ID");
688 mg3->GetYaxis()->CenterTitle();
689 leg3->Draw();
690 oss3.str("");
691 oss3 << outDir.Data() << filename.Data() << "_PacketScan_3." << format.Data();
692 finalCanv3->Update();
693 finalCanv3->SaveAs(oss3.str().c_str());
694
695
696 file->Close();
697
698 }
699
700
701
702 int main(int argc, char* argv[]){
703 TString path;
704 TString outDir = "./";
705 TString format = "jpg";
706
707
708 if (argc < 2){
709 printf("You have to insert at least the file to analyze \n");
710 printf("Try '--help' for more information. \n");
711 exit(1);
712 }
713
714 if (!strcmp(argv[1], "--help")){
715 printf( "Usage: PacketScan FILE [OPTION] \n");
716 printf( "\t --help Print this help and exit \n");
717 printf( "\t -outDir[path] Path where to put the output [default ./] \n");
718 printf( "\t -format[ps|gif|jpg] Format for output files [default 'jpg'] \n");
719 exit(1);
720 }
721
722 path=argv[1];
723
724
725
726 for (int i = 2; i < argc; i++){
727
728 if (!strcmp(argv[i], "-outDir")){
729 if (++i >= argc){
730 printf( "-outDir needs arguments. \n");
731 printf( "Try '--help' for more information. \n");
732 exit(1);
733 }
734 else{
735 outDir = argv[i];
736 continue;
737 }
738 }
739
740 if (!strcmp(argv[i], "-format")){
741 if (++i >= argc){
742 printf( "-format needs arguments. \n");
743 printf( "Try '--help' for more information. \n");
744 exit(1);
745 }
746 else{
747 format = argv[i];
748 continue;
749 }
750 }
751
752
753 }
754
755 PacketScan(argv[1], outDir, format);
756
757 }

  ViewVC Help
Powered by ViewVC 1.1.23