/[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.4 - (hide annotations) (download)
Thu Mar 8 09:53:45 2007 UTC (17 years, 8 months ago) by pam-rm2
Branch: MAIN
CVS Tags: v3r04, v3r05, HEAD
Changes since 1.3: +11 -5 lines
fixed bug on OBT

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

  ViewVC Help
Powered by ViewVC 1.1.23