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

Annotation of /quicklook/QLflightTmtc_Header/PacketScan.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations) (download)
Tue Oct 24 08:23:17 2006 UTC (18 years, 1 month 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 pam-rm2 1.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 pam-rm2 1.3 #include <stdio.h>
46     #include <string.h>
47 pam-rm2 1.1 #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 pam-rm2 1.3 void PacketScan(TString base, TString outDir, TString format){
65 pam-rm2 1.1
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 pam-rm2 1.2 TLegend *leg1b = new TLegend(0.80,0.67,0.99,0.99, "");
98 pam-rm2 1.1
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 pam-rm2 1.2 TLegend *leg2 = new TLegend(0.87,0.70,0.99,0.99, "");
105    
106 pam-rm2 1.1
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 pam-rm2 1.2 TLegend *leg3 = new TLegend(0.87,0.65,0.99,0.99, "");
113 pam-rm2 1.1
114 pam-rm2 1.3 TObject *key = new TObject;
115     const char *name;
116     char *SoftInfo="SoftInfo";
117 pam-rm2 1.1 for (Int_t i=0; i<numkey; i++){
118 pam-rm2 1.3 key = list->At(i);
119     name=(char *)(key->GetName());
120     if(strcmp(name,SoftInfo)==0)continue;
121 pam-rm2 1.1 TTree* tr = (TTree*)file->Get(name);
122 pam-rm2 1.3 if (tr->IsZombie()) continue;
123 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.6);
139 pam-rm2 1.1 mg1->Add(graph);
140 pam-rm2 1.2 if (cont[0]==0) leg1b->AddEntry(graph,"PhysEndRun (0x07)","p");
141 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.5);
149 pam-rm2 1.1 mg1->Add(graph);
150 pam-rm2 1.2 if (cont[1]==0) leg1b->AddEntry(graph,"Physics (0x10)","p");
151 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.9);
159 pam-rm2 1.1 mg1->Add(graph);
160 pam-rm2 1.2 if (cont[2]==0) leg1b->AddEntry(graph,"RunHeader/Trailer (0x20/21)","p");
161 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.9);
169 pam-rm2 1.1 mg1->Add(graph);
170 pam-rm2 1.2 if (cont[2]==0) leg1b->AddEntry(graph,"RunHeader/Trailer (0x20/21)","p");
171 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(1.2);
180 pam-rm2 1.1 mg1->Add(graph);
181 pam-rm2 1.2 if (cont[23]==0) leg1b->AddEntry(graph,"CalibCalPulse1 (0x08)","p");
182 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(1.2);
190 pam-rm2 1.1 mg1->Add(graph);
191 pam-rm2 1.2 if (cont[24]==0) leg1b->AddEntry(graph,"CalibCalPulse2 (0x09)","p");
192 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(1.2);
200 pam-rm2 1.1 mg1->Add(graph);
201 pam-rm2 1.2 if (cont[25]==0) leg1b->AddEntry(graph,"CalibTrkBoth (0x11)","p");
202 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(1.2);
210 pam-rm2 1.1 mg1->Add(graph);
211 pam-rm2 1.2 if (cont[26]==0) leg1b->AddEntry(graph,"CalibTrk1 (0x12)","p");
212 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(1.2);
220 pam-rm2 1.1 mg1->Add(graph);
221 pam-rm2 1.2 if (cont[27]==0) leg1b->AddEntry(graph,"CalibTrk2 (0x13)","p");
222 pam-rm2 1.1 cont[27]++;
223     break;
224     }
225 pam-rm2 1.2 case 29:{
226 pam-rm2 1.1 TGraph *graph = new TGraph(1, obt, id);
227     graph->SetMarkerColor(30);
228     graph->SetMarkerStyle(23);
229 pam-rm2 1.2 graph->SetMarkerSize(1.2);
230 pam-rm2 1.1 mg1->Add(graph);
231 pam-rm2 1.2 if (cont[28]==0) leg1b->AddEntry(graph,"Calib_Cal (0x1d)","p");
232 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(1.2);
240 pam-rm2 1.1 mg1->Add(graph);
241 pam-rm2 1.2 if (cont[29]==0) leg1b->AddEntry(graph,"CalibTof (0x16)","p");
242 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(1.2);
250 pam-rm2 1.1 mg1->Add(graph);
251 pam-rm2 1.2 if (cont[30]==0) leg1b->AddEntry(graph,"CalibS4 (0x17)","p");
252 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(1.2);
260 pam-rm2 1.1 mg1->Add(graph);
261 pam-rm2 1.2 if (cont[31]==0) leg1b->AddEntry(graph,"CalibCalPed (0x18)","p");
262 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(1.2);
270 pam-rm2 1.1 mg1->Add(graph);
271 pam-rm2 1.2 if (cont[32]==0) leg1b->AddEntry(graph,"Calib1_Ac1 (0x19)","p");
272 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(1.2);
280 pam-rm2 1.1 mg1->Add(graph);
281 pam-rm2 1.2 if (cont[33]==0) leg1b->AddEntry(graph,"Calib2_Ac1 (0x1a)","p");
282 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(1.2);
290 pam-rm2 1.1 mg1->Add(graph);
291 pam-rm2 1.2 if (cont[34]==0) leg1b->AddEntry(graph,"Calib1_Ac2 (0x1b)","p");
292 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(1.2);
300 pam-rm2 1.1 mg1->Add(graph);
301 pam-rm2 1.2 if (cont[35]==0) leg1b->AddEntry(graph,"Calib2_Ac2 (0x1c)","p");
302 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(1.2);
310 pam-rm2 1.1 mg1->Add(graph);
311 pam-rm2 1.2 if (cont[36]==0) leg1b->AddEntry(graph,"CalibHeader/Trailer (0x22/23)","p");
312 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(1.2);
320 pam-rm2 1.1 mg1->Add(graph);
321 pam-rm2 1.2 if (cont[36]==0) leg1b->AddEntry(graph,"CalibHeader/Trailer (0x22/23)","p");
322 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(1.2);
331 pam-rm2 1.1 mg1->Add(graph);
332 pam-rm2 1.2 if (cont[4]==0) leg1b->AddEntry(graph,"InitHeader/Trailer (0x24/25)","p");
333 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(1.2);
341 pam-rm2 1.1 mg1->Add(graph);
342 pam-rm2 1.2 if (cont[4]==0) leg1b->AddEntry(graph,"InitHeader/Trailer (0x24/25)","p");
343 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.9);
351 pam-rm2 1.1 mg2->Add(graph);
352 pam-rm2 1.2 if (cont[38]==0) leg2->AddEntry(graph,"EventTrk (0x30)","p");
353 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.9);
362 pam-rm2 1.1 mg2->Add(graph);
363 pam-rm2 1.2 if (cont[39]==0) leg2->AddEntry(graph,"Test_trk (0x40)","p");
364 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.9);
372 pam-rm2 1.1 mg2->Add(graph);
373 pam-rm2 1.2 if (cont[40]==0) leg2->AddEntry(graph,"Test_Tof (0x41)","p");
374 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.9);
383 pam-rm2 1.1 mg2->Add(graph);
384 pam-rm2 1.2 if (cont[41]==0) leg2->AddEntry(graph,"Log (0x50)","p");
385 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.9);
394 pam-rm2 1.1 mg2->Add(graph);
395 pam-rm2 1.2 if (cont[42]==0) leg2->AddEntry(graph,"VarDump (0X51)","p");
396 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.9);
404 pam-rm2 1.1 mg2->Add(graph);
405 pam-rm2 1.2 if (cont[43]==0) leg2->AddEntry(graph,"ArrDump (x52)","p");
406 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.9);
414 pam-rm2 1.1 mg2->Add(graph);
415 pam-rm2 1.2 if (cont[44]==0) leg2->AddEntry(graph,"TabDump (0x53)","p");
416 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.9);
425 pam-rm2 1.1 mg2->Add(graph);
426 pam-rm2 1.2 if (cont[45]==0) leg2->AddEntry(graph,"Tmtc (0x54)","p");
427 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.9);
436 pam-rm2 1.1 mg2->Add(graph);
437 pam-rm2 1.2 if (cont[46]==0) leg2->AddEntry(graph,"Mcmd (0x55)","p");
438 pam-rm2 1.1 cont[46]++;
439     break;
440     }
441 pam-rm2 1.2 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 pam-rm2 1.1 case 112:{
452     TGraph *graph = new TGraph(1, obt, id);
453     graph->SetMarkerColor(1);
454     graph->SetMarkerStyle(22);
455 pam-rm2 1.2 graph->SetMarkerSize(0.9);
456 pam-rm2 1.1 mg3->Add(graph);
457 pam-rm2 1.2 if (cont[6]==0) leg3->AddEntry(graph,"Ac1Init (0x70)","p");
458 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.9);
466 pam-rm2 1.1 mg3->Add(graph);
467 pam-rm2 1.2 if (cont[7]==0) leg3->AddEntry(graph,"CalInit (0x71)","p");
468 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.9);
476 pam-rm2 1.1 mg3->Add(graph);
477 pam-rm2 1.2 if (cont[8]==0) leg3->AddEntry(graph,"TrkInit (0x72)","p");
478 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.9);
486 pam-rm2 1.1 mg3->Add(graph);
487 pam-rm2 1.2 if (cont[9]==0) leg3->AddEntry(graph,"TofInit (0x73)","p");
488 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.9);
496 pam-rm2 1.1 mg3->Add(graph);
497 pam-rm2 1.2 if (cont[10]==0) leg3->AddEntry(graph,"TrgInit (0x74)","p");
498 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.9);
506 pam-rm2 1.1 mg3->Add(graph);
507 pam-rm2 1.2 if (cont[11]==0) leg3->AddEntry(graph,"NdInit (0x75)","p");
508 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.9);
516 pam-rm2 1.1 mg3->Add(graph);
517 pam-rm2 1.2 if (cont[12]==0) leg3->AddEntry(graph,"S4Init (0x76)","p");
518 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.9);
526 pam-rm2 1.1 mg3->Add(graph);
527 pam-rm2 1.2 if (cont[13]==0) leg3->AddEntry(graph,"Ac2Init (0x77)","p");
528 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.7);
537 pam-rm2 1.1 mg3->Add(graph);
538 pam-rm2 1.2 if (cont[14]==0) leg3->AddEntry(graph,"CalAlarm (0x81)","p");
539 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.7);
547 pam-rm2 1.1 mg3->Add(graph);
548 pam-rm2 1.2 if (cont[15]==0) leg3->AddEntry(graph,"Ac1Alarm (0x82)","p");
549 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.7);
557 pam-rm2 1.1 mg3->Add(graph);
558 pam-rm2 1.2 if (cont[16]==0) leg3->AddEntry(graph,"TrkAlarm (0x83)","p");
559 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.7);
567 pam-rm2 1.1 mg3->Add(graph);
568 pam-rm2 1.2 if (cont[17]==0) leg3->AddEntry(graph,"TrgAlarm (0x84)","p");
569 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.7);
577 pam-rm2 1.1 mg3->Add(graph);
578 pam-rm2 1.2 if (cont[18]==0) leg3->AddEntry(graph,"TofAlarm (0x85)","p");
579 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.7);
587 pam-rm2 1.1 mg3->Add(graph);
588 pam-rm2 1.2 if (cont[19]==0) leg3->AddEntry(graph,"S4Alarm (0x86)","p");
589 pam-rm2 1.1 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 pam-rm2 1.2 graph->SetMarkerSize(0.7);
597 pam-rm2 1.1 mg3->Add(graph);
598 pam-rm2 1.2 if (cont[20]==0) leg3->AddEntry(graph,"Ac2Alarm (0x88)","p");
599 pam-rm2 1.1 cont[20]++;
600     break;
601     }
602 pam-rm2 1.2 /*case 137:{
603 pam-rm2 1.1 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 pam-rm2 1.2 }
612 pam-rm2 1.1 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 pam-rm2 1.2 }*/
622 pam-rm2 1.1 case 161:{
623     TGraph *graph = new TGraph(1, obt, id);
624 pam-rm2 1.2 graph->SetMarkerColor(2);
625     graph->SetMarkerStyle(3);
626     graph->SetMarkerSize(1.1);
627 pam-rm2 1.1 mg3->Add(graph);
628 pam-rm2 1.2 if (cont[3]==0) leg3->AddEntry(graph,"TsbT (0xA1)","p");
629 pam-rm2 1.1 cont[3]++;
630     break;
631     }
632     case 171:{
633     TGraph *graph = new TGraph(1, obt, id);
634 pam-rm2 1.2 graph->SetMarkerColor(4);
635     graph->SetMarkerStyle(3);
636     graph->SetMarkerSize(1.1);
637 pam-rm2 1.1 mg3->Add(graph);
638 pam-rm2 1.2 if (cont[5]==0) leg3->AddEntry(graph,"TsbB (0xAB)","p");
639 pam-rm2 1.1 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 pam-rm2 1.2 mg1->SetMaximum(55);
654 pam-rm2 1.1 mg1->Draw("AP");
655 pam-rm2 1.2 mg1->GetXaxis()->SetTitle("OBT (ms)");
656     mg1->GetXaxis()->CenterTitle();
657     mg1->GetYaxis()->SetTitle("Packet ID");
658     mg1->GetYaxis()->CenterTitle();
659     leg1b->Draw();
660 pam-rm2 1.1 oss1.str("");
661     oss1 << outDir.Data() << filename.Data() << "_PacketScan_1." << format.Data();
662 pam-rm2 1.2 finalCanv1->Update();
663 pam-rm2 1.1 finalCanv1->SaveAs(oss1.str().c_str());
664    
665    
666     finalCanv2->cd();
667 pam-rm2 1.2 mg2->SetMinimum(60);
668     mg2->SetMaximum(100);
669 pam-rm2 1.1 mg2->Draw("AP");
670 pam-rm2 1.2 mg2->GetXaxis()->SetTitle("OBT (ms)");
671     mg2->GetXaxis()->CenterTitle();
672     mg2->GetYaxis()->SetTitle("Packet ID");
673     mg2->GetYaxis()->CenterTitle();
674 pam-rm2 1.1 leg2->Draw();
675     oss2.str("");
676     oss2 << outDir.Data() << filename.Data() << "_PacketScan_2." << format.Data();
677 pam-rm2 1.2 finalCanv2->Update();
678 pam-rm2 1.1 finalCanv2->SaveAs(oss2.str().c_str());
679    
680    
681     finalCanv3->cd();
682     mg3->SetMinimum(110);
683     mg3->SetMaximum(180);
684     mg3->Draw("AP");
685 pam-rm2 1.2 mg3->GetXaxis()->SetTitle("OBT (ms)");
686     mg3->GetXaxis()->CenterTitle();
687     mg3->GetYaxis()->SetTitle("Packet ID");
688     mg3->GetYaxis()->CenterTitle();
689 pam-rm2 1.1 leg3->Draw();
690     oss3.str("");
691     oss3 << outDir.Data() << filename.Data() << "_PacketScan_3." << format.Data();
692 pam-rm2 1.2 finalCanv3->Update();
693 pam-rm2 1.1 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