/[PAMELA software]/quicklook/QLflightS4_ND/S4_Calibration_QL.cpp
ViewVC logotype

Annotation of /quicklook/QLflightS4_ND/S4_Calibration_QL.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations) (download)
Mon Mar 12 14:34:12 2007 UTC (17 years, 8 months ago) by pam-rm2
Branch: MAIN
CVS Tags: v2r04, HEAD
Changes since 1.4: +11 -9 lines
fixed OBT bug

1 pam-rm2 1.1 /**
2     * S4 Calibration Quick Look
3     * Author Marcelli-Malvezzi
4     * Version 1.00 - 27 February 2006
5     *
6     * Description: The aim of S4 Calibration QL software is to keep under control the bahaviour of S4 Calibration.
7     * It creates only one output canvas relative to the time behaviour of collected calibration data.
8     * See documentation for a more detailed description of the output.
9     *
10     * Parameters:
11     * TSTring base - the path to the root directory for the specific Pamela unpack session
12     * There is no default value, without this input the program will not run
13     * TString outDir - the path where to save the output image (Default = ./)
14     * TString format - the format which will be used fo rsave the produced images (Default = "jpg")
15     *
16     *
17     * Version 1.1 - June 2006
18     * Fixed bugs: for a large namber of events is not possible to initialize vectors, so all graphs have been converted in histograms
19     *
20     * Known bugs: it is no possible to choise the figure format
21 pam-rm2 1.3 *
22     * Version 1.2 - August 2006
23     * Fixed bugs: is possible to choise figure format; all calibration are drown
24 pam-rm2 1.1 **************/
25    
26     #include <fstream>
27     #include <iostream>
28     #include <iostream>
29     #include <sstream>
30     #include "TStyle.h"
31     #include "TFile.h"
32     #include "TList.h"
33     #include "TTree.h"
34     #include "TLatex.h"
35     #include "TObjString.h"
36     #include "TCanvas.h"
37     #include "TGraph.h"
38     #include "TH1F.h"
39     #include "TF1.h"
40     #include "TGaxis.h"
41     #include "TString.h"
42     #include "TPaveText.h"
43     #include "TMultiGraph.h"
44     #include "TGraphErrors.h"
45     #include "EventHeader.h"
46     #include "PscuHeader.h"
47     #include "physics/S4/S4Event.h"
48     #include "CalibS4Event.h"
49     #include "tmtc/TmtcEvent.h"
50     #include "tmtc/TmtcRecord.h"
51    
52     using namespace std;
53    
54     //--------------- root function ----------------------------------
55    
56     void S4_Calibration_QL(TString base, TString outDir, TString format){
57    
58     //--------------- Variables initialization -----------------------------------//
59     const Int_t channels = 4096;
60 pam-rm2 1.4 Double_t calib_1_MEAN;
61     Double_t calib_2_MEAN;
62     Double_t calib_4_MEAN;
63 pam-rm2 1.1 Double_t calib_1_RMS;
64     Double_t calib_2_RMS;
65     Double_t calib_4_RMS;
66 pam-rm2 1.4 Double_t calib_1=0, calib_2=0, calib_4=0;
67 pam-rm2 1.1 Double_t obt;
68     TString status;
69     Int_t IPM1status, IPM2status;
70 pam-rm2 1.5 ULong_t lastime, firstime, obt1, utile;
71 pam-rm2 1.4 double obmin=0.;
72     double obmax=0.;
73     double limitdown=0;
74     double limitup=0;
75    
76    
77 pam-rm2 1.1 //------------------------- Open data file -------------------------------------//
78     TFile *file =new TFile(base.Data()) ;
79     TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString();
80     filename = ((TObjString*)filename.Tokenize('.')->First())->GetString();
81    
82     if (!file){
83     printf("No such file in the directory has been found");
84     return;
85     }
86    
87     TTree *CalibS4tr = (TTree*)file->Get("CalibS4");
88     TBranch *S4Br = CalibS4tr->GetBranch("CalibS4");
89     TBranch *headBr = CalibS4tr->GetBranch("Header");
90     TTree *tmtcTr = (TTree*)file->Get("Tmtc");
91     TBranch *tmtcBr = tmtcTr->GetBranch("Tmtc");
92    
93     pamela::TmtcEvent *tme = 0;
94     pamela::TmtcRecord *tmr = 0;
95     pamela::S4::S4Event *s4Record;
96     pamela::CalibS4Event *s4Event = new pamela::CalibS4Event();
97     pamela::EventHeader *eh = 0;
98     pamela::PscuHeader *ph = 0;
99    
100     CalibS4tr->SetBranchAddress("CalibS4", &s4Event);
101     CalibS4tr->SetBranchAddress("Header", &eh);
102     tmtcTr->SetBranchAddress("Tmtc", &tme);
103     Long64_t nevents= CalibS4tr->GetEntries();
104     Long64_t neventstmtc = tmtcBr->GetEntries();
105    
106     if (neventstmtc<=0) {
107     printf("Tmtc packet: nevents = %i\n", nevents);
108     printf(" No info about kind of calibration (hot or cold) \n");
109     }
110     //----------------- if nevents = 0 ----------------------------------------------//
111     if (nevents<=0){
112     cout<<"WARNING: No Entries, RETURN"<<"\n";
113    
114     TCanvas *canvas4 = new TCanvas("No entries", "No entries ", 400, 200);
115     canvas4->SetFillColor(10);
116     canvas4->cd();
117    
118     TLatex *l = new TLatex();
119     l->SetTextAlign(12);
120     l->SetTextSize(0.15);
121     l->SetTextColor(2);
122     stringstream oss, noentries;
123     noentries.str("");
124     noentries<< "S4_Calibration_QL:";
125     l->DrawLatex(0.05, 0.7, noentries.str().c_str());
126     noentries.str("");
127     noentries<< "No entries for this files";
128     l->DrawLatex(0.05, 0.5, noentries.str().c_str());
129    
130     if (outDir== "./") {
131     oss.str("");
132     oss << filename.Data() << "_S4_Calibration_QL." << format.Data();
133     } else {
134     oss.str("");
135     oss << outDir.Data() << filename.Data() << "_S4_Calibration_QL." << format.Data();
136     }
137    
138     canvas4->Update();
139     canvas4->SaveAs(oss.str().c_str());
140     return;
141     }
142    
143     //---------------Look for configuration hot or cold -----------------------//
144 pam-rm2 1.4 if(neventstmtc!=0){
145     Int_t recordstot=0;
146     for (Int_t i = 0; i < neventstmtc; i++){
147     tmtcBr->GetEntry(i);
148     Long64_t tmpSizetmtc = tme->Records->GetEntries();
149     recordstot=recordstot+tmpSizetmtc;
150     }
151     const Int_t lungmax=16*recordstot;
152     Double_t xrecordobtcc[lungmax], yccdiagacq[lungmax], xrecordobtcc_1[lungmax], yccdiagacq_1[lungmax];
153     recordstot=0;
154     for (Int_t i = 0; i < neventstmtc; i++){
155     tmtcBr->GetEntry(i);
156     Long64_t tmpSizetmtc = tme->Records->GetEntries();
157     Int_t size_b = tmpSizetmtc;
158     for (Int_t j = 0; j < size_b; j++){
159     tmr = (pamela::TmtcRecord*)tme->Records->At(j);
160     for (Int_t k =0; k <16; k++){
161     yccdiagacq[16*recordstot+16*j+k] = (((tmr->TM_DIAG_AND_BILEVEL_ACQ)>>(15-k))&0x0001);
162     xrecordobtcc[16*recordstot+16*j+k] = tmr->TM_RECORD_OBT;
163     }
164     }
165     recordstot=recordstot+tmpSizetmtc;
166     }
167     Int_t riftime = recordstot/2;
168     //CC (0=IPM1=hot; 1=IPM2=cold for S4 calibration)
169     for (Int_t k =0; k<16; k++){
170     for (Int_t i = 0; i < recordstot; i++){
171     yccdiagacq_1[i]= yccdiagacq[16*i+k];
172     xrecordobtcc_1[i]= xrecordobtcc[16*i+k];
173 pam-rm2 1.1 }
174 pam-rm2 1.4 if (k==0) IPM1status=(Int_t)yccdiagacq_1[riftime];
175     if (k==1) IPM2status=(Int_t)yccdiagacq_1[riftime];
176 pam-rm2 1.1 }
177 pam-rm2 1.4 if (IPM1status==0 && IPM2status==1){
178     status="CONFIGURATION: HOT";
179     }
180     if (IPM1status==1 && IPM2status==0){
181     status="CONFIGURATION: COLD";
182 pam-rm2 1.1 }
183 pam-rm2 1.4 }else{
184     status=" No info about kind of calibration (hot or cold)";
185 pam-rm2 1.1 }
186    
187 pam-rm2 1.4 //----------- search max and min OBT -----------------------------------------------------//
188 pam-rm2 1.1 headBr->GetEntry(0);
189     ph = eh->GetPscuHeader();
190     firstime = ph->GetOrbitalTime();
191     headBr->GetEntry(nevents-1);
192     ph = eh->GetPscuHeader();
193     lastime = ph->GetOrbitalTime();
194     obmin=firstime;
195     obmax=lastime;
196 pam-rm2 1.2 if(nevents < 2){
197 pam-rm2 1.3 for(Int_t kk = 0; kk<nevents; kk++){
198     headBr->GetEntry(kk);
199     ph = eh->GetPscuHeader();
200 pam-rm2 1.5 utile=ph->GetOrbitalTime();
201     if(obmin >= utile)obmin=utile;
202     if(obmax <= utile)obmax=utile;
203 pam-rm2 1.3 }
204 pam-rm2 1.2 limitdown= obmin - 1000000;
205     limitup= obmax + 1000000;
206     }else{
207 pam-rm2 1.3 for(Int_t kk = 0; kk<nevents; kk++){
208     headBr->GetEntry(kk);
209     ph = eh->GetPscuHeader();
210 pam-rm2 1.5 utile=ph->GetOrbitalTime();
211 pam-rm2 1.4 //cout<<"OrbitalTime()"<<ph->GetOrbitalTime()<<"\n";
212 pam-rm2 1.5 if(obmin >= utile)obmin=utile;
213     if(obmax <= utile)obmax=utile;
214 pam-rm2 1.3 }
215 pam-rm2 1.2 limitdown=obmin;
216     limitup=obmax;
217     }
218 pam-rm2 1.4 //------------- Create and fill histograms -------------------------------------------//
219     stringstream oss1;
220     oss1.str("");
221     oss1 << "S4 Calibration: "<< filename.Data();
222     TH1F *calibS4_1 =new TH1F("S4-1", oss1.str().c_str(), channels, 0, channels);
223     TH1F *calibS4_2 =new TH1F("S4-2", oss1.str().c_str(), channels, 0, channels);
224     TH1F *calibS4_4 =new TH1F("S4-3", oss1.str().c_str(), channels, 0, channels);
225    
226 pam-rm2 1.1 stringstream oss;
227     oss.str("");
228     oss << "S4_Calibration_QL: "<< filename.Data();
229 pam-rm2 1.4 const Int_t size = nevents;
230     //cout<<"size "<<size <<"\n";
231 pam-rm2 1.3 TH1F *cal1 =new TH1F("calibS4_1", oss.str().c_str(), size, obmin-1000000, obmax+ 1000000);
232     TH1F *cal2 =new TH1F("calibS4_2", oss.str().c_str(), size, obmin-1000000, obmax+ 1000000);
233     TH1F *cal4 =new TH1F("calibS4_4", oss.str().c_str(), size, obmin-1000000, obmax+ 1000000);
234 pam-rm2 1.1
235     for(Int_t k = 0; k<nevents; k++){
236     headBr->GetEntry(k);
237     S4Br->GetEntry(k);
238     ph = eh->GetPscuHeader();
239     Int_t tmpSize = s4Event->Records->GetEntries();
240     for (Int_t j = 0; j < 4; j++){
241     for (Int_t i = 0; i < 128; i++){
242     s4Record = (pamela::S4::S4Event*)s4Event->Records->At((j*128 + i));
243     switch (j) {
244     case 0 :{
245     calibS4_1->Fill(s4Record->S4_DATA);
246 pam-rm2 1.4 calib_1 = calib_1+s4Record->S4_DATA;
247 pam-rm2 1.1 break;
248     }
249     case 1 :{
250     calibS4_2->Fill(s4Record->S4_DATA);
251 pam-rm2 1.4 calib_2 = calib_2+s4Record->S4_DATA;
252 pam-rm2 1.1 break;
253     }
254     case 3 :{
255     calibS4_4->Fill(s4Record->S4_DATA);
256 pam-rm2 1.4 calib_4 = calib_4+s4Record->S4_DATA;
257 pam-rm2 1.1 break;
258     }
259     }
260     }
261     }
262 pam-rm2 1.5 utile=ph->GetOrbitalTime();
263 pam-rm2 1.2 //obt=ph->GetOrbitalTime();
264 pam-rm2 1.4 calib_1_MEAN=calib_1/128;
265 pam-rm2 1.1 //calib_1_RMS=calibS4_1->GetRMS(1);
266 pam-rm2 1.4 calib_2_MEAN=calib_2/128;
267 pam-rm2 1.1 //calib_2_RMS=calibS4_2->GetRMS(1);
268 pam-rm2 1.4 calib_4_MEAN=calib_4/128;
269 pam-rm2 1.1 //calib_4_RMS=calibS4_4->GetRMS(1);
270 pam-rm2 1.5 cal1->Fill(utile,calib_1_MEAN);
271     cal2->Fill(utile,calib_2_MEAN);
272     cal4->Fill(utile,calib_4_MEAN);
273 pam-rm2 1.4 calib_1=calib_2=calib_4=0;
274 pam-rm2 1.1
275     }
276    
277     //----------------- Create and draw canvas -----------------------------------------//
278     TCanvas *finalCanv = new TCanvas("S4Calib","Calibration_QL", 1280, 1024);
279 pam-rm2 1.4 finalCanv->SetFillColor(10);
280     finalCanv->Divide(2,2);
281 pam-rm2 1.1
282 pam-rm2 1.4 finalCanv->cd(1);
283 pam-rm2 1.1 gPad->SetLogy();
284     cal1->SetStats(kFALSE);
285     cal1->SetMarkerSize(.5);
286     cal1->SetMarkerStyle(21);
287     cal1->SetMarkerColor(3);
288     cal1->SetMinimum(1);
289     cal1->SetMaximum(10000);
290     cal1->GetYaxis()->SetTitle("S4 mean value (ADC)");
291     cal1->GetYaxis()->SetTitleSize(0.03);
292     cal1->GetYaxis()->SetTitleOffset(1);
293     cal1->GetYaxis()->CenterTitle();
294     cal1->GetYaxis()->SetLabelSize(0.02);
295     cal1->GetXaxis()->CenterTitle();
296     cal1->GetXaxis()->SetTitleSize(0.03);
297     cal1->GetXaxis()->SetTitleOffset(1);
298     cal1->GetXaxis()->SetLabelSize(0.02);
299     cal1->GetXaxis()->SetTitle("OBT (ms)");
300     cal1->Draw("9p");
301    
302     cal2->SetStats(kFALSE);
303     cal2->SetMarkerSize(.5);
304     cal2->SetMarkerStyle(21);
305     cal2->SetMarkerColor(6);
306     cal2->SetMinimum(1);
307     cal2->SetMaximum(10000);
308     cal2->Draw("9psame");
309    
310     cal4->SetStats(kFALSE);
311     cal4->SetMarkerSize(.5);
312     cal4->SetMarkerStyle(21);
313     cal4->SetMarkerColor(4);
314     cal4->SetMinimum(1);
315     cal4->SetMaximum(10000);
316     cal4->Draw("9psame");
317     if (IPM1status==0 && IPM2status==1){ ////hot configuration
318     TF1 *func1 = new TF1("func1", "1560"); ///valore di riferimento 1300
319 pam-rm2 1.2 //func1->SetRange(obmin, obmax);
320     func1->SetRange(limitdown, limitup);
321 pam-rm2 1.1 func1->SetLineColor(4);
322 pam-rm2 1.2 func1->SetLineStyle(1);
323     func1->SetLineWidth(3);
324 pam-rm2 1.1 func1->Draw("same");
325     TF1 *func2 = new TF1("func2", "1040"); ///valore di riferimento 1300
326 pam-rm2 1.2 //func2->SetRange(obmin, obmax);
327     func2->SetRange(limitdown, limitup);
328 pam-rm2 1.1 func2->SetLineColor(4);
329 pam-rm2 1.2 func2->SetLineStyle(1);
330     func2->SetLineWidth(3);
331 pam-rm2 1.1 func2->Draw("same");
332     TF1 *func3 = new TF1("func3", "109"); ///valore di riferimento 95
333 pam-rm2 1.2 //func3->SetRange(obmin, obmax);
334     func3->SetRange(limitdown, limitup);
335 pam-rm2 1.1 func3->SetLineColor(6);
336 pam-rm2 1.2 func3->SetLineStyle(1);
337     func3->SetLineWidth(3);
338 pam-rm2 1.1 func3->Draw("same");
339     TF1 *func4 = new TF1("func4", "71"); ///valore di riferimento 95
340 pam-rm2 1.2 //func4->SetRange(obmin, obmax);
341     func4->SetRange(limitdown, limitup);
342 pam-rm2 1.1 func4->SetLineColor(6);
343 pam-rm2 1.2 func4->SetLineStyle(1);
344     func4->SetLineWidth(3);
345 pam-rm2 1.1 func4->Draw("same");
346     TF1 *func5 = new TF1("func5", "38.4"); //valore di riferimento 32
347 pam-rm2 1.2 //func5->SetRange(obmin, obmax);
348     func5->SetRange(limitdown, limitup);
349     func5->SetLineStyle(1);
350 pam-rm2 1.1 func5->SetLineColor(3);
351 pam-rm2 1.2 func5->SetLineWidth(3);
352 pam-rm2 1.1 func5->Draw("same");
353     TF1 *func6 = new TF1("func6", "25.6"); //valore di riferimento 32
354 pam-rm2 1.2 //func6->SetRange(obmin, obmax);
355     func6->SetRange(limitdown, limitup);
356     func6->SetLineStyle(1);
357 pam-rm2 1.1 func6->SetLineColor(3);
358 pam-rm2 1.2 func6->SetLineWidth(3);
359 pam-rm2 1.1 func6->Draw("same");
360     }
361    
362     if (IPM1status==1 && IPM2status==0){ ////cold configuration
363     TF1 *func1 = new TF1("func1", "2400");
364 pam-rm2 1.2 //func1->SetRange(obmin, obmax);
365     func1->SetRange(limitdown, limitup);
366 pam-rm2 1.1 func1->SetLineColor(4);
367 pam-rm2 1.2 func1->SetLineStyle(1);
368     func1->SetLineWidth(3);
369 pam-rm2 1.1 func1->Draw("same");
370     TF1 *func2 = new TF1("func2", "1600"); ///valore di riferimento 2000
371 pam-rm2 1.2 //func2->SetRange(obmin, obmax);
372     func2->SetRange(limitdown, limitup);
373 pam-rm2 1.1 func2->SetLineColor(4);
374 pam-rm2 1.2 func2->SetLineStyle(1);
375     func2->SetLineWidth(3);
376 pam-rm2 1.1 func2->Draw("same");
377     TF1 *func3 = new TF1("func3", "180");
378 pam-rm2 1.2 //func3->SetRange(obmin, obmax);
379     func3->SetRange(limitdown, limitup);
380 pam-rm2 1.1 func3->SetLineColor(6);
381 pam-rm2 1.2 func3->SetLineStyle(1);
382     func3->SetLineWidth(3);
383 pam-rm2 1.1 func3->Draw("same");
384     TF1 *func4 = new TF1("func4", "120"); ///valore di riferimento 150
385 pam-rm2 1.2 //func4->SetRange(obmin, obmax);
386     func4->SetRange(limitdown, limitup);
387 pam-rm2 1.1 func4->SetLineColor(6);
388 pam-rm2 1.2 func4->SetLineStyle(1);
389     func4->SetLineWidth(3);
390 pam-rm2 1.1 func4->Draw("same");
391     TF1 *func5 = new TF1("func5", "38.4");
392 pam-rm2 1.2 //func5->SetRange(obmin, obmax);
393     func5->SetRange(limitdown, limitup);
394     func5->SetLineStyle(1);
395 pam-rm2 1.1 func5->SetLineColor(3);
396 pam-rm2 1.2 func5->SetLineWidth(3);
397 pam-rm2 1.1 func5->Draw("same");
398     TF1 *func6 = new TF1("func6", "25.6"); //valore di riferimento 32
399 pam-rm2 1.2 //func6->SetRange(obmin, obmax);
400     func6->SetRange(limitdown, limitup);
401     func6->SetLineStyle(1);
402 pam-rm2 1.1 func6->SetLineColor(3);
403 pam-rm2 1.2 func6->SetLineWidth(3);
404 pam-rm2 1.1 func6->Draw("same");
405     }
406    
407 pam-rm2 1.4 //TPad *pad = new TPad("pad","pad", .75, .93, .99, .99);
408     TPad *pad = new TPad("pad","pad", .58, .85, .92, .94);
409 pam-rm2 1.1 pad->SetFillColor(10);
410     pad->Draw();
411     pad->cd();
412     TLatex *l = new TLatex();
413     l->SetTextAlign(12);
414 pam-rm2 1.4 l->SetTextSize(0.4);
415     l->SetTextColor(kRed);
416 pam-rm2 1.1 l->DrawLatex(0.05, 0.65, status.Data());
417    
418 pam-rm2 1.4
419     finalCanv->cd(2);
420     gPad->SetLogy();
421     gStyle->SetOptStat("nemrou");
422     calibS4_1->SetLineColor(kBlack);
423     calibS4_1->SetFillColor(kRed);
424     calibS4_1->GetYaxis()->SetTitle("Number of events");
425     calibS4_1->GetYaxis()->SetTitleSize(0.03);
426     calibS4_1->GetYaxis()->SetTitleOffset(1);
427     calibS4_1->GetYaxis()->CenterTitle();
428     calibS4_1->GetYaxis()->SetLabelSize(0.02);
429     calibS4_1->GetXaxis()->CenterTitle();
430     calibS4_1->GetXaxis()->SetTitleSize(0.03);
431     calibS4_1->GetXaxis()->SetTitleOffset(1);
432     calibS4_1->GetXaxis()->SetLabelSize(0.02);
433     calibS4_1->GetXaxis()->SetTitle("ADC (ch)");
434     calibS4_1->SetAxisRange(0,200);
435     calibS4_1->Draw();
436    
437     finalCanv->cd(3);
438     gPad->SetLogy();
439     gStyle->SetOptStat("nemrou");
440     calibS4_2->SetLineColor(kBlack);
441     calibS4_2->SetFillColor(kRed);
442     calibS4_2->GetYaxis()->SetTitle("Number of events");
443     calibS4_2->GetYaxis()->SetTitleSize(0.03);
444     calibS4_2->GetYaxis()->SetTitleOffset(1);
445     calibS4_2->GetYaxis()->CenterTitle();
446     calibS4_2->GetYaxis()->SetLabelSize(0.02);
447     calibS4_2->GetXaxis()->CenterTitle();
448     calibS4_2->GetXaxis()->SetTitleSize(0.03);
449     calibS4_2->GetXaxis()->SetTitleOffset(1);
450     calibS4_2->GetXaxis()->SetLabelSize(0.02);
451     calibS4_2->GetXaxis()->SetTitle("ADC (ch)");
452     calibS4_2->SetAxisRange(50,250);
453     calibS4_2->Draw();
454    
455     finalCanv->cd(4);
456     gPad->SetLogy();
457     gStyle->SetOptStat("nemrou");
458     calibS4_4->SetLineColor(kBlack);
459     calibS4_4->SetFillColor(kRed);
460     calibS4_4->GetYaxis()->SetTitle("Number of events");
461     calibS4_4->GetYaxis()->SetTitleSize(0.03);
462     calibS4_4->GetYaxis()->SetTitleOffset(1);
463     calibS4_4->GetYaxis()->CenterTitle();
464     calibS4_4->GetYaxis()->SetLabelSize(0.02);
465     calibS4_4->GetXaxis()->CenterTitle();
466     calibS4_4->GetXaxis()->SetTitleSize(0.03);
467     calibS4_4->GetXaxis()->SetTitleOffset(1);
468     calibS4_4->GetXaxis()->SetLabelSize(0.02);
469     calibS4_4->GetXaxis()->SetTitle("ADC (ch)");
470     calibS4_4->SetAxisRange(500,2500);
471     calibS4_4->Draw();
472    
473 pam-rm2 1.1 oss.str("");
474     if (outDir == "./") {
475     oss << filename.Data() << "_S4_Calibration_QL." << format.Data();
476     } else {
477     oss << outDir.Data() << filename.Data() << "_S4_Calibration_QL." << format.Data();
478     }
479 pam-rm2 1.4 finalCanv->SaveAs(oss.str().c_str());
480 pam-rm2 1.1 }
481    
482     int main(int argc, char* argv[]){
483     TString path;
484     TString outDir ="./";
485     TString format ="jpg";
486    
487     if (argc < 2){
488     printf("You have to insert at least the file to analyze \n");
489     printf("Try '--help' for more information. \n");
490     exit(1);
491     }
492    
493     if (!strcmp(argv[1], "--help")){
494     printf( "Usage: S4_Calibration_QL FILE [OPTION] \n");
495     printf( "\t --help Print this help and exit \n");
496     printf( "\t -outDir[path] Path where to put the output [default ./] \n");
497     // printf( "\t -format[] Format for output files [default 'jpg'] \n");
498     exit(1);
499     }
500    
501     path=argv[1];
502    
503     for (int i = 2; i < argc; i++){
504    
505     if (!strcmp(argv[i], "-outDir")){
506     if (++i >= argc){
507     printf( "-outDir needs arguments. \n");
508     printf( "Try '--help' for more information. \n");
509     exit(1);
510     }
511     else{
512     outDir = argv[i];
513     continue;
514     }
515     }
516    
517 pam-rm2 1.2 if (!strcmp(argv[i], "-format")){
518 pam-rm2 1.1 if (++i >= argc){
519     printf( "-format needs arguments. \n");
520     printf( "Try '--help' for more information. \n");
521     exit(1);
522     }
523     else{
524     format = argv[i];
525     continue;
526     }
527 pam-rm2 1.2 }
528 pam-rm2 1.1
529    
530     }
531    
532    
533     S4_Calibration_QL(argv[1], outDir, format);
534    
535     }
536    
537    

  ViewVC Help
Powered by ViewVC 1.1.23