1 |
/** |
2 |
* TmtcTemperature |
3 |
* author Marcelli |
4 |
* version 1.1 - 10 December 2005 |
5 |
* |
6 |
* Version 1.2 - 28 December 2004 |
7 |
* If TFile does not exist the function exit to prompt |
8 |
* If nevents = 0 the function exit to promt |
9 |
* Initialize to 0 alla array dedicated to graphs |
10 |
* |
11 |
* version 1.3 - 22 February 2005 - Nagni |
12 |
* For compatibility with batch mode excution: |
13 |
* 1) Added "include <iostream>" and "using namespace std" |
14 |
* 2) Removed gROOT->Reset() |
15 |
* |
16 |
* version 1.4 - 25 February 2005 - Marcelli |
17 |
* Canvas of thermistors divided in 12 pads |
18 |
* |
19 |
* Version 1.5 |
20 |
* Date 08 March 2005 - Nagni |
21 |
* Added "format" parameter for saving the produced image in various formats |
22 |
* (for a complete list of types refer to TPad::SaveAs method) |
23 |
* |
24 |
* version 1.6 |
25 |
* Date 24 May 2005 - Marcelli |
26 |
* Added four thermistor (files after DW_050516_007 has 16 thermistors instead of 12) |
27 |
* |
28 |
* version 1.7 |
29 |
* Date 02 February 2006 - Marcelli |
30 |
* Modified to work with new version of YODA |
31 |
* |
32 |
* version 1.8 |
33 |
* Date March 2006 - Marcelli |
34 |
* For compilation: |
35 |
* Added function "int main(int argc, char* argv[])" |
36 |
* |
37 |
* Description : To monitor information from TMTC Packet (voltage, CC,....) |
38 |
* |
39 |
* Parameters: |
40 |
* TString base - the path to the root directory for the specific Pamela unpack session |
41 |
* TString outDir - the path where to save the output image (Default = base) |
42 |
* TString format - the format which will be used fo rsave the produced images (Default = "jpg") |
43 |
* |
44 |
*/ |
45 |
|
46 |
|
47 |
|
48 |
|
49 |
#include <iostream> |
50 |
#include <sstream> |
51 |
#include "TStyle.h" |
52 |
#include "TFile.h" |
53 |
#include "TList.h" |
54 |
#include "TTree.h" |
55 |
#include "TObjString.h" |
56 |
#include "TCanvas.h" |
57 |
#include "TGraph.h" |
58 |
#include "TH1F.h" |
59 |
#include "TGaxis.h" |
60 |
#include "TString.h" |
61 |
#include "TPaveText.h" |
62 |
#include "tmtc/TmtcEvent.h" |
63 |
#include "tmtc/TmtcRecord.h" |
64 |
|
65 |
|
66 |
using namespace std; |
67 |
|
68 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
69 |
/////////////////////////////////////FUNZIONI DI CONVERSIONE/////////////////////////////////// |
70 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
71 |
|
72 |
|
73 |
//reference: Laben Document, TL 18348, pag. 79 |
74 |
float convert_th(int TH) { |
75 |
|
76 |
float a,q,deltax,deltay; |
77 |
float gradi[111],grado=-1; |
78 |
int adc[111]={4095, 3868, 3654, 3454, 3265, 3088, 2922, 2765, 2618, 2479, 2348, 2225, 2110, 2000, 1897, 1800, 1709, 1622, 1541, 1464, 1391, 1322, 1257, 1196, 1138, 1083, 1031, 981, 935, 890, 849, 809, 771, 736, 702, 670, 639, 610, 583, 557, 532, 508, 486, 464, 444, 425, 406, 389, 372, 356, 341, 327, 313, 300, 288, 276, 264, 254, 243, 233, 224, 215, 206, 198, 190, 183, 175, 169, 162, 156, 150, 144, 138, 133, 128, 123, 118, 114, 110, 106, 102, 98, 94, 91, 87, 84, 81, 78, 75, 73, 70, 67, 65, 63, 60, 58, 56, 54, 52, 50, 49, 47, 45, 44, 42, 41, 39, 38, 37, 35, 34}; |
79 |
int maxpos=-1,minpos=-1,i; |
80 |
|
81 |
for (i=0;i<111;i++) |
82 |
{ |
83 |
gradi[i]=-35+i; |
84 |
} |
85 |
|
86 |
if (TH > 4095) |
87 |
{ |
88 |
grado=100.; |
89 |
return grado; |
90 |
} |
91 |
|
92 |
if (TH <= 34) |
93 |
{ |
94 |
grado=100.; |
95 |
return grado; |
96 |
} |
97 |
|
98 |
|
99 |
if (TH==4095) |
100 |
{ |
101 |
grado=-35.; |
102 |
return grado; |
103 |
} |
104 |
else |
105 |
{ |
106 |
|
107 |
for (i=1;i<111;i++) |
108 |
{ |
109 |
if (TH>=adc[i]) |
110 |
{ |
111 |
minpos=i; |
112 |
maxpos=i-1; |
113 |
break; |
114 |
} |
115 |
} |
116 |
deltax=adc[maxpos]-adc[minpos]; |
117 |
deltay=gradi[maxpos]-gradi[minpos]; |
118 |
a=deltay/deltax; |
119 |
q=gradi[maxpos]-a*adc[maxpos]; |
120 |
grado=a*TH+q; |
121 |
} |
122 |
return (grado); |
123 |
} |
124 |
|
125 |
|
126 |
|
127 |
//reference: Laben Document, TL 18348, pag. 76 |
128 |
float convert_volt(int in) { |
129 |
|
130 |
float a,q,deltax,deltay; |
131 |
float inputvoltage[52],voltage=-1; |
132 |
float adc[52]; |
133 |
int maxpos=-1,minpos=-1,i; |
134 |
|
135 |
for (i=0;i<52;i++) |
136 |
{ |
137 |
inputvoltage[i] = (i*0.10); |
138 |
} |
139 |
for (i=0;i<52;i++) |
140 |
{ |
141 |
adc[i] = (i*5); |
142 |
} |
143 |
|
144 |
if (in==0) |
145 |
{ |
146 |
voltage= 0.00; |
147 |
} |
148 |
else |
149 |
{ |
150 |
|
151 |
for (i=0;i<52;i++) |
152 |
{ |
153 |
if (in<=adc[i]) |
154 |
{ |
155 |
minpos=i; |
156 |
maxpos=i-1; |
157 |
break; |
158 |
} |
159 |
} |
160 |
deltax=adc[maxpos]-adc[minpos]; |
161 |
deltay=inputvoltage[maxpos]-inputvoltage[minpos]; |
162 |
a=deltay/deltax; |
163 |
q=inputvoltage[maxpos]-a*adc[maxpos]; |
164 |
voltage=a*in+q; |
165 |
} |
166 |
return (voltage); |
167 |
|
168 |
} |
169 |
|
170 |
|
171 |
|
172 |
//////////////////////////////////////////////////////////////////////////////// |
173 |
////////////////////////// TMTC TEMPERATURE ////////////////////////////////// |
174 |
////////////////////////////////////////////////////////////////////////////////// |
175 |
|
176 |
void TmtcTemperature(TString base, TString outDir, TString format){ |
177 |
|
178 |
//------- load root file -------------- |
179 |
TFile *file = new TFile(base.Data()); |
180 |
|
181 |
if ( outDir == "" ) outDir = "."; |
182 |
|
183 |
if (!file){ |
184 |
printf("No such file in the directory has been found"); |
185 |
return; |
186 |
} |
187 |
|
188 |
//--- Takes the tree of Tmtc ----------- |
189 |
TPaveText *pt=0; |
190 |
TPaveText *pt1=0; |
191 |
|
192 |
TTree *tr = (TTree*)file->Get("Tmtc"); |
193 |
TBranch *tmtcBr = tr->GetBranch("Tmtc"); |
194 |
|
195 |
pamela::TmtcEvent *tme=0; |
196 |
pamela::TmtcRecord *tmr=0; |
197 |
|
198 |
tr->SetBranchAddress("Tmtc", &tme); |
199 |
|
200 |
///-------to create canvas--------------------// |
201 |
TCanvas *Canvascchot = new TCanvas("Tmtc_1", base, 1280, 1024); |
202 |
Canvascchot->Divide(2,3); |
203 |
Canvascchot->SetFillColor(10); |
204 |
|
205 |
TCanvas *Canvascccold = new TCanvas("Tmtc_2", base, 1280,1024); |
206 |
Canvascccold->Divide(2,3); |
207 |
Canvascccold->SetFillColor(10); |
208 |
|
209 |
TCanvas *Canvasccvrl = new TCanvas("Tmtc_3", base, 1280, 1024); |
210 |
Canvasccvrl->Divide(1,3); |
211 |
Canvasccvrl->SetFillColor(10); |
212 |
|
213 |
|
214 |
TCanvas *Canvasthdea = new TCanvas("Tmtc_4", base, 1280, 1024); |
215 |
if (tr->GetBranch("Records.TM_TH_ANA[12]")){ |
216 |
Canvasthdea->SetFillColor(10); |
217 |
Canvasthdea->Divide(3,4); |
218 |
} |
219 |
else if (tr->GetBranch("Records.TM_TH_ANA[16]")){ |
220 |
Canvasthdea->SetFillColor(10); |
221 |
Canvasthdea->Divide(4,4); |
222 |
} |
223 |
|
224 |
TCanvas *Canvasvoltdea = new TCanvas("Tmtc_5", base, 1280, 1024); |
225 |
Canvasvoltdea->SetFillColor(10); |
226 |
Canvasvoltdea->Divide(2,3); |
227 |
|
228 |
//////--------to analize data-----------------////// |
229 |
Long64_t nevents = tmtcBr->GetEntries(); |
230 |
if (nevents<=0) { |
231 |
file->Close(); |
232 |
printf("nevents = %i", nevents); |
233 |
return; |
234 |
} |
235 |
|
236 |
|
237 |
const Int_t size = nevents; |
238 |
std::stringstream oss; |
239 |
Int_t recordstot=0; |
240 |
Int_t m=0; |
241 |
Int_t l=0; |
242 |
Int_t n=0; |
243 |
|
244 |
for (Int_t i = 0; i < size; i++){ |
245 |
tmtcBr->GetEntry(i); |
246 |
Long64_t tmpSize = tme->Records->GetEntries(); |
247 |
//Int_t size_b = tmpSize; |
248 |
recordstot=recordstot+tmpSize; |
249 |
} |
250 |
|
251 |
const Int_t lungmax=16*recordstot; |
252 |
const Int_t lungmin=6*recordstot; |
253 |
|
254 |
Double_t xrecordobtcc[lungmax], yccdiagacq[lungmax], ythana[lungmax], xrecordobtth[lungmax], xrecordobtdea[lungmin], ydea[lungmin], xrecordobtcc_1[lungmax], yccdiagacq_1[lungmax], ythana_1[lungmax], xrecordobtth_1[lungmax], xrecordobtdea_1[lungmin], ydea_1[lungmin], limth[lungmax], limvolt1[lungmin], limvolt2[lungmin], limvolt3[lungmin]; |
255 |
|
256 |
|
257 |
string titolocc[] ={"IPM1","IPM2","IPM3","IPM4","IPM5","IPM6","KHB_HOT_LATCHUP","KHB_COLD_LATCHUP","IDAQ_HOT_ALARM","IDAQ_COLD_ALARM","VCB_STANDBY","VRL_HOT","VRL_COLD","PSB_ALARM","TOFHV_HOT_ALARM","TOFHV_COLD_ALARM"}; |
258 |
|
259 |
string titoloth[] ={"IPM_TH","S1_TH","S4_TH","S4_ND_PLATE_TH","TRK_TH1","TRK_TH2","FLUID_IN_TH","FLUID_OUT_TH","VME_TH","DCDC_TH","CPU_TH1","CPU_TH2", "", "", "", ""}; |
260 |
|
261 |
|
262 |
recordstot=0; |
263 |
for (Int_t i = 0; i < size; i++){ |
264 |
tmtcBr->GetEntry(i); |
265 |
Long64_t tmpSize = tme->Records->GetEntries(); |
266 |
Int_t size_b = tmpSize; |
267 |
for (Int_t j = 0; j < size_b; j++){ |
268 |
tmr = (pamela::TmtcRecord*)tme->Records->At(j); |
269 |
|
270 |
for (Int_t k =0; k <16; k++){ |
271 |
yccdiagacq[16*recordstot+16*j+k] = (((tmr->TM_DIAG_AND_BILEVEL_ACQ)>>(15-k))&0x0001); |
272 |
xrecordobtcc[16*recordstot+16*j+k] = tmr->TM_RECORD_OBT; |
273 |
} |
274 |
|
275 |
if (tr->GetBranch("Records.TM_TH_ANA[12]")){ |
276 |
for (Int_t k =0; k <12; k++){ |
277 |
ythana[12*recordstot+12*j+k] = convert_th(tmr->TM_TH_ANA[k]); |
278 |
xrecordobtth[12*recordstot+12*j+k] = tmr->TM_RECORD_OBT; |
279 |
} |
280 |
} |
281 |
else if (tr->GetBranch("Records.TM_TH_ANA[16]")){ |
282 |
for (Int_t k =0; k <16; k++){ |
283 |
ythana[16*recordstot+16*j+k] = convert_th(tmr->TM_TH_ANA[k]); |
284 |
xrecordobtth[16*recordstot+16*j+k] = tmr->TM_RECORD_OBT; |
285 |
} |
286 |
} |
287 |
|
288 |
for (Int_t k =0; k <6; k++){ |
289 |
ydea[6*recordstot+6*j+k] = convert_volt(tmr->TM_DEA_ANA[k]); |
290 |
xrecordobtdea[6*recordstot+6*j+k] = tmr->TM_RECORD_OBT; |
291 |
} |
292 |
} |
293 |
recordstot=recordstot+tmpSize; |
294 |
} |
295 |
|
296 |
TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString(); |
297 |
filename = ((TObjString*)filename.Tokenize('.')->First())->GetString(); |
298 |
|
299 |
//CC Graph |
300 |
for (Int_t k =0; k<16; k++){ |
301 |
for (Int_t i = 0; i < recordstot; i++){ |
302 |
yccdiagacq_1[i]= yccdiagacq[16*i+k]; |
303 |
xrecordobtcc_1[i]= xrecordobtcc[16*i+k]; |
304 |
} |
305 |
//CC IPM |
306 |
if (k==0 || k==1 ||k==2 || k==3 || k==4 || k==5 ){ |
307 |
Canvascchot->cd(m+1); |
308 |
gPad->SetFillColor(10); |
309 |
TGraph *ccrecord = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1); |
310 |
|
311 |
pt = new TPaveText (.01,.07,.09,.13); |
312 |
pt->AddText("ON"); |
313 |
pt->SetBorderSize(1); |
314 |
pt->Draw(); |
315 |
pt1 = new TPaveText (.01,.47,.09,.53); |
316 |
pt1->AddText("OFF"); |
317 |
pt1->SetBorderSize(1); |
318 |
pt1->Draw(); |
319 |
oss.str(""); |
320 |
oss<<filename.Data()<<": "<<titolocc[k]; |
321 |
ccrecord->SetTitle(oss.str().c_str()); |
322 |
ccrecord->SetMaximum(1.5); |
323 |
ccrecord->SetMinimum(0); |
324 |
ccrecord->SetFillColor(8); |
325 |
ccrecord->GetXaxis()->SetTitle("OBT"); |
326 |
ccrecord->GetXaxis()->CenterTitle(); |
327 |
ccrecord->GetYaxis()->SetTitle(""); |
328 |
ccrecord->GetYaxis()->CenterTitle(); |
329 |
ccrecord->GetYaxis()->SetNdivisions(3,-1); |
330 |
ccrecord->GetYaxis()->SetLabelSize(0); |
331 |
ccrecord->SetMaximum(2); |
332 |
ccrecord->SetMinimum(0); |
333 |
ccrecord->Draw("AB"); |
334 |
pt->Draw(); |
335 |
pt1->Draw(); |
336 |
m=m+1; |
337 |
} |
338 |
//CC idaq-khb-tof |
339 |
if (k==6 || k==7 || k==8 || k==9 || k==14 || k==15){ |
340 |
Canvascccold->cd(l+1); |
341 |
gPad->SetFillColor(10); |
342 |
TGraph *ccrecord = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1); |
343 |
if (k==6 || k==7){ |
344 |
TPaveText *pt = new TPaveText (.01,.07,.09,.13); |
345 |
pt->AddText("ON"); |
346 |
pt->SetBorderSize(1); |
347 |
pt->Draw(); |
348 |
TPaveText *pt1 = new TPaveText (.01,.47,.15,.53); |
349 |
pt1->AddText("OFF/LATCHUP"); |
350 |
pt1->SetBorderSize(1); |
351 |
pt1->Draw(); |
352 |
} |
353 |
if (k==8 || k==9 || k==14 || k==15){ |
354 |
TPaveText *pt = new TPaveText (.01,.07,.09,.13); |
355 |
pt->AddText("ON"); |
356 |
pt->SetBorderSize(1); |
357 |
pt->Draw(); |
358 |
TPaveText *pt1 = new TPaveText (.01,.47,.13,.53); |
359 |
pt1->AddText("OFF/ALARM"); |
360 |
pt1->SetBorderSize(1); |
361 |
pt1->Draw(); |
362 |
} |
363 |
oss.str(""); |
364 |
oss<<filename.Data()<<": "<<titolocc[k]; |
365 |
ccrecord->SetTitle(oss.str().c_str()); |
366 |
ccrecord->SetMaximum(1.5); |
367 |
ccrecord->SetMinimum(0); |
368 |
ccrecord->SetFillColor(8); |
369 |
ccrecord->GetXaxis()->SetTitle("OBT"); |
370 |
ccrecord->GetXaxis()->CenterTitle(); |
371 |
ccrecord->GetYaxis()->SetTitle(""); |
372 |
ccrecord->GetYaxis()->CenterTitle(); |
373 |
ccrecord->GetYaxis()->SetNdivisions(3,-1); |
374 |
ccrecord->GetYaxis()->SetLabelSize(0); |
375 |
ccrecord->SetMaximum(2); |
376 |
ccrecord->SetMinimum(0); |
377 |
ccrecord->Draw("AB"); |
378 |
l=l+1; |
379 |
} |
380 |
//CC vrl |
381 |
if (k==11 || k==12 || k==13 ){ |
382 |
Canvasccvrl->cd(n+1); |
383 |
gPad->SetFillColor(10); |
384 |
TGraph *ccrecord = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1); |
385 |
if (k==11 || k==12){ |
386 |
TPaveText *pt = new TPaveText (.05,.07,.09,.13); |
387 |
pt->AddText("ON"); |
388 |
pt->SetBorderSize(1); |
389 |
pt->Draw(); |
390 |
TPaveText *pt1 = new TPaveText (.05,.47,.09,.53); |
391 |
pt1->AddText("OFF"); |
392 |
pt1->SetBorderSize(1); |
393 |
pt1->Draw(); |
394 |
} |
395 |
if (k==13){ |
396 |
TPaveText *pt = new TPaveText (.05,.07,.09,.13); |
397 |
pt->AddText("ON"); |
398 |
pt->SetBorderSize(1); |
399 |
pt->Draw(); |
400 |
TPaveText *pt1 = new TPaveText (.03,.47,.11,.53); |
401 |
pt1->AddText("OFF/ALARM"); |
402 |
pt1->SetBorderSize(1); |
403 |
pt1->Draw(); |
404 |
} |
405 |
oss.str(""); |
406 |
oss<<filename.Data()<<": "<<titolocc[k]; |
407 |
ccrecord->SetTitle(oss.str().c_str()); |
408 |
ccrecord->SetMaximum(1.5); |
409 |
ccrecord->SetMinimum(0); |
410 |
ccrecord->SetFillColor(8); |
411 |
ccrecord->GetXaxis()->SetTitle("OBT"); |
412 |
ccrecord->GetXaxis()->CenterTitle(); |
413 |
ccrecord->GetYaxis()->SetTitle(""); |
414 |
ccrecord->GetYaxis()->CenterTitle(); |
415 |
ccrecord->GetYaxis()->SetNdivisions(3,-1); |
416 |
ccrecord->GetYaxis()->SetLabelSize(0); |
417 |
ccrecord->SetMaximum(2); |
418 |
ccrecord->SetMinimum(0); |
419 |
ccrecord->Draw("AB"); |
420 |
n=n+1; |
421 |
} |
422 |
} |
423 |
|
424 |
|
425 |
// TH Graph |
426 |
Canvasthdea->cd(); |
427 |
//thermistors number 12 |
428 |
if (tr->GetBranch("Records.TM_TH_ANA[12]")){ |
429 |
for (Int_t k =0; k<12; k++){ |
430 |
for (Int_t i = 0; i < recordstot; i++){ |
431 |
ythana_1[i]= ythana[12*i+k]; |
432 |
xrecordobtth_1[i]= xrecordobtth[12*i+k]; |
433 |
limth[i] = 45; |
434 |
} |
435 |
Canvasthdea->cd(k+1); |
436 |
TGraph *graph = new TGraph(recordstot, xrecordobtth_1, limth); |
437 |
graph->SetMarkerColor(50); |
438 |
graph->SetLineColor(50); |
439 |
graph->SetMarkerStyle(21); |
440 |
graph->SetMarkerSize(0.3); |
441 |
graph->SetMinimum(-10); |
442 |
graph->SetMaximum(60); |
443 |
graph->GetXaxis()->SetTitle("OBT"); |
444 |
graph->GetXaxis()->CenterTitle(); |
445 |
graph->GetYaxis()->SetTitle("Temperature value (°C)"); |
446 |
graph->GetYaxis()->CenterTitle(); |
447 |
oss.str(""); |
448 |
oss << filename.Data() <<": " <<titoloth[k] ; |
449 |
graph->SetTitle(oss.str().c_str()); |
450 |
|
451 |
TPaveText *pt = new TPaveText (.45,.7,.55,.77); |
452 |
pt->AddText("OFF"); |
453 |
pt->SetBorderSize(1); |
454 |
pt->Draw(); |
455 |
graph->Draw("ACP"); |
456 |
pt->Draw(); |
457 |
|
458 |
TGraph *threcord = new TGraph(recordstot, xrecordobtth_1, ythana_1); |
459 |
threcord->SetLineColor(kBlue); |
460 |
threcord->SetMarkerColor(kBlue); |
461 |
threcord->SetMarkerStyle(21); |
462 |
threcord->Draw("C"); |
463 |
} |
464 |
} |
465 |
//thermistors number=16 |
466 |
if (tr->GetBranch("Records.TM_TH_ANA[16]")){ |
467 |
for (Int_t k =0; k<16; k++){ |
468 |
for (Int_t i = 0; i < recordstot; i++){ |
469 |
ythana_1[i]= ythana[16*i+k]; |
470 |
xrecordobtth_1[i]= xrecordobtth[16*i+k]; |
471 |
limth[i] = 45; |
472 |
} |
473 |
Canvasthdea->cd(k+1); |
474 |
TGraph *graph = new TGraph(recordstot, xrecordobtth_1, limth); |
475 |
graph->SetMarkerColor(50); |
476 |
graph->SetLineColor(50); |
477 |
graph->SetMarkerStyle(21); |
478 |
graph->SetMarkerSize(0.3); |
479 |
graph->SetMinimum(-10); |
480 |
graph->SetMaximum(60); |
481 |
graph->GetXaxis()->SetTitle("OBT"); |
482 |
graph->GetXaxis()->CenterTitle(); |
483 |
graph->GetYaxis()->SetTitle("Temperature value (°C)"); |
484 |
graph->GetYaxis()->CenterTitle(); |
485 |
oss.str(""); |
486 |
oss << filename.Data() <<": " <<titoloth[k] ; |
487 |
graph->SetTitle(oss.str().c_str()); |
488 |
|
489 |
TPaveText *pt = new TPaveText (.45,.7,.55,.77); |
490 |
pt->AddText("OFF"); |
491 |
pt->SetBorderSize(1); |
492 |
pt->Draw(); |
493 |
graph->Draw("ACP"); |
494 |
pt->Draw(); |
495 |
|
496 |
TGraph *threcord = new TGraph(recordstot, xrecordobtth_1, ythana_1); |
497 |
threcord->SetLineColor(kBlue); |
498 |
threcord->SetMarkerColor(kBlue); |
499 |
threcord->SetMarkerStyle(21); |
500 |
threcord->Draw("C"); |
501 |
} |
502 |
} |
503 |
|
504 |
// DEA Graph |
505 |
Canvasvoltdea->cd(); |
506 |
for (Int_t k =0; k<6; k++){ |
507 |
for (Int_t i = 0; i < recordstot; i++){ |
508 |
ydea_1[i]= ydea[6*i + k]; |
509 |
xrecordobtdea_1[i]= xrecordobtdea[6*i+k]; |
510 |
limvolt1[i]= 0.65; |
511 |
limvolt2[i]= 3.15; |
512 |
limvolt3[i]= 4.25; |
513 |
} |
514 |
Canvasvoltdea->cd(k+1); |
515 |
TGraph *graph1 = new TGraph(recordstot, xrecordobtth_1, limvolt1); |
516 |
TPaveText *pt = new TPaveText (.84,.13,.92,.19); |
517 |
pt->AddText("OFF"); |
518 |
pt->SetBorderSize(1); |
519 |
pt->Draw(); |
520 |
TPaveText *pt1 = new TPaveText (.84,.67,.92,.73); |
521 |
pt1->AddText("ON"); |
522 |
pt1->SetBorderSize(1); |
523 |
pt1->Draw(); |
524 |
graph1->SetMarkerColor(50); |
525 |
graph1->SetLineColor(50); |
526 |
graph1->SetMarkerStyle(21); |
527 |
graph1->SetMarkerSize(0.3); |
528 |
graph1->SetMinimum(0.0); |
529 |
graph1->SetMaximum(5.0); |
530 |
graph1->GetXaxis()->SetTitle("OBT"); |
531 |
graph1->GetXaxis()->CenterTitle(); |
532 |
graph1->GetYaxis()->SetTitle("Voltage value (V)"); |
533 |
graph1->GetYaxis()->CenterTitle(); |
534 |
oss.str(""); |
535 |
oss << filename.Data()<<": IPM "<<k+1<<" Voltage"; |
536 |
graph1->SetTitle(oss.str().c_str()); |
537 |
graph1->Draw("ACP"); |
538 |
pt1->Draw(); |
539 |
pt->Draw(); |
540 |
|
541 |
TGraph *graph2 = new TGraph(recordstot, xrecordobtth_1, limvolt2); |
542 |
graph2->SetMarkerColor(50); |
543 |
graph2->SetLineColor(50); |
544 |
graph2->SetMarkerStyle(21); |
545 |
graph2->SetMarkerSize(0.2); |
546 |
graph2->SetMinimum(0.0); |
547 |
graph2->SetMaximum(5.0); |
548 |
graph2->Draw("CP"); |
549 |
|
550 |
TGraph *graph3 = new TGraph(recordstot, xrecordobtth_1, limvolt3); |
551 |
graph3->SetMarkerColor(50); |
552 |
graph3->SetLineColor(50); |
553 |
graph3->SetMarkerStyle(21); |
554 |
graph3->SetMarkerSize(0.2); |
555 |
graph3->SetMinimum(0.0); |
556 |
graph3->SetMaximum(5.0); |
557 |
graph3->Draw("CP"); |
558 |
|
559 |
TGraph *dearecord = new TGraph(recordstot, xrecordobtdea_1, ydea_1); |
560 |
dearecord->SetLineColor(kBlue); |
561 |
dearecord->SetLineWidth(1); |
562 |
dearecord->SetMarkerStyle(21); |
563 |
dearecord->SetMarkerSize(0.5); |
564 |
dearecord->SetMarkerColor(kBlue); |
565 |
dearecord->Draw("CPL"); |
566 |
} |
567 |
|
568 |
|
569 |
stringstream oss1, oss2, oss3, oss4; |
570 |
oss.str(""); |
571 |
oss1.str(""); |
572 |
oss2.str(""); |
573 |
oss3.str(""); |
574 |
oss4.str(""); |
575 |
oss << outDir.Data() << filename.Data() << "_Tmtc_cc_hot." << format; |
576 |
oss3 << outDir.Data() << filename.Data() << "_Tmtc_cc_cold." << format; |
577 |
oss4 << outDir.Data() << filename.Data() << "_Tmtc_cc_vrl." << format; |
578 |
oss1 << outDir.Data() << filename.Data() << "_Tmtc_th_dea." << format; |
579 |
oss2 << outDir.Data() << filename.Data() << "_Tmtc_volt_dea." << format; |
580 |
Canvascchot->SaveAs(oss.str().c_str()); |
581 |
Canvascccold->SaveAs(oss3.str().c_str()); |
582 |
Canvasccvrl->SaveAs(oss4.str().c_str()); |
583 |
Canvasthdea->SaveAs(oss1.str().c_str()); |
584 |
Canvasvoltdea->SaveAs(oss2.str().c_str()); |
585 |
|
586 |
file->Close(); |
587 |
} |
588 |
|
589 |
|
590 |
////////////////////////////////////////////////////////////////////////////////// |
591 |
///////////////////////// MAIN /////////////////////////////////////////////// |
592 |
////////////////////////////////////////////////////////////////////////////////// |
593 |
|
594 |
|
595 |
int main(int argc, char* argv[]){ |
596 |
TString path; |
597 |
TString outDir = "./"; |
598 |
TString format = "jpg"; |
599 |
|
600 |
if (argc < 2){ |
601 |
printf("You have to insert at least the file to analyze \n"); |
602 |
printf("Try '--help' for more information. \n"); |
603 |
exit(1); |
604 |
} |
605 |
|
606 |
if (!strcmp(argv[1], "--help")){ |
607 |
printf( "Usage: TmtcTemperature FILE [OPTION] \n"); |
608 |
printf( "\t --help Print this help and exit \n"); |
609 |
printf( "\t -outDir[path] Path where to put the output [default ./] \n"); |
610 |
printf( "\t -format[jpg|ps|gif] Format for output files [default 'jpg'] \n"); |
611 |
exit(1); |
612 |
} |
613 |
|
614 |
path=argv[1]; |
615 |
|
616 |
for (int i = 2; i < argc; i++){ |
617 |
|
618 |
|
619 |
if (!strcmp(argv[i], "-outDir")){ |
620 |
if (++i >= argc){ |
621 |
printf( "-outDir needs arguments. \n"); |
622 |
printf( "Try '--help' for more information. \n"); |
623 |
exit(1); |
624 |
} |
625 |
else{ |
626 |
outDir = argv[i]; |
627 |
continue; |
628 |
} |
629 |
} |
630 |
|
631 |
if (!strcmp(argv[i], "-format")){ |
632 |
if (++i >= argc){ |
633 |
printf( "-format needs arguments. \n"); |
634 |
printf( "Try '--help' for more information. \n"); |
635 |
exit(1); |
636 |
} |
637 |
else{ |
638 |
format = argv[i]; |
639 |
continue; |
640 |
} |
641 |
} |
642 |
|
643 |
|
644 |
} |
645 |
|
646 |
TmtcTemperature(argv[1], outDir, format); |
647 |
|
648 |
} |