/[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.2 - (show annotations) (download)
Wed Aug 9 09:01:23 2006 UTC (18 years, 3 months ago) by pam-rm2
Branch: MAIN
CVS Tags: v2r04, v2r03, v2r02, v3r00, v3r01, v3r02
Changes since 1.1: +135 -109 lines
HeaderScan: aggiunta pad di testo nella seconda canvas, uniformata la scala tra i grafici nella prima canvas

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

  ViewVC Help
Powered by ViewVC 1.1.23