/[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.1 - (show annotations) (download)
Fri Jun 16 10:11:54 2006 UTC (18 years, 6 months ago) by pam-rm2
Branch: MAIN
Branch point for: QLflightTmtc_Header
Initial revision

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

  ViewVC Help
Powered by ViewVC 1.1.23