1 |
|
2 |
|
3 |
/** |
4 |
* TmtcTemperature |
5 |
* author Marcelli |
6 |
* version 1.1 - 10 December 2005 |
7 |
* |
8 |
* Version 1.2 - 28 December 2004 |
9 |
* If TFile does not exist the function exit to prompt |
10 |
* If nevents = 0 the function exit to promt |
11 |
* Initialize to 0 alla array dedicated to graphs |
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 - 25 February 2005 - Marcelli |
19 |
* Canvas of thermistors divided in 12 pads |
20 |
* |
21 |
* Version 1.5 |
22 |
* Date 08 March 2005 - Nagni |
23 |
* Added "format" parameter for saving the produced image in various formats |
24 |
* (for a complete list of types refer to TPad::SaveAs method) |
25 |
* |
26 |
* version 1.6 |
27 |
* Date 24 May 2005 - Marcelli |
28 |
* Added four thermistor (files after DW_050516_007 has 16 thermistors instead of 12) |
29 |
* |
30 |
* version 1.7 |
31 |
* Date 02 February 2006 - Marcelli |
32 |
* Modified to work with new version of YODA |
33 |
* |
34 |
* version 1.8 |
35 |
* Date March 2006 - Marcelli |
36 |
* For compilation: |
37 |
* Added function "int main(int argc, char* argv[])" |
38 |
* |
39 |
* Description : To monitor information from TMTC Packet (voltage, CC,....) |
40 |
* |
41 |
* Parameters: |
42 |
* TString base - the path to the root directory for the specific Pamela unpack session |
43 |
* TString outDir - the path where to save the output image (Default = base) |
44 |
* TString format - the format which will be used fo rsave the produced images (Default = "jpg") |
45 |
* |
46 |
*/ |
47 |
|
48 |
|
49 |
|
50 |
|
51 |
#include <iostream> |
52 |
#include <sstream> |
53 |
#include "TStyle.h" |
54 |
#include "TFile.h" |
55 |
#include "TAxis.h" |
56 |
#include "TLegend.h" |
57 |
#include "TF1.h" |
58 |
#include "TList.h" |
59 |
#include "TTree.h" |
60 |
#include "TObjString.h" |
61 |
#include "TCanvas.h" |
62 |
#include "TGraph.h" |
63 |
#include "TMultiGraph.h" |
64 |
#include "TH1F.h" |
65 |
#include "TGaxis.h" |
66 |
#include "TString.h" |
67 |
#include "TPaveText.h" |
68 |
#include "tmtc/TmtcEvent.h" |
69 |
#include "tmtc/TmtcRecord.h" |
70 |
|
71 |
|
72 |
using namespace std; |
73 |
|
74 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
75 |
/////////////////////////////////////FUNZIONI DI CONVERSIONE/////////////////////////////////// |
76 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
77 |
|
78 |
|
79 |
//reference: Laben Document, TL 18348, pag. 79 |
80 |
float convert_th(int TH) { |
81 |
|
82 |
float a,q,deltax,deltay; |
83 |
float gradi[111],grado=-1; |
84 |
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}; |
85 |
int maxpos=-1,minpos=-1,i; |
86 |
|
87 |
for (i=0;i<111;i++) |
88 |
{ |
89 |
gradi[i]=-35+i; |
90 |
} |
91 |
|
92 |
if (TH > 4095) |
93 |
{ |
94 |
grado=100.; |
95 |
return grado; |
96 |
} |
97 |
|
98 |
if (TH <= 34) |
99 |
{ |
100 |
grado=100.; |
101 |
return grado; |
102 |
} |
103 |
|
104 |
|
105 |
if (TH==4095) |
106 |
{ |
107 |
grado=-35.; |
108 |
return grado; |
109 |
} |
110 |
else |
111 |
{ |
112 |
|
113 |
for (i=1;i<111;i++) |
114 |
{ |
115 |
if (TH>=adc[i]) |
116 |
{ |
117 |
minpos=i; |
118 |
maxpos=i-1; |
119 |
break; |
120 |
} |
121 |
} |
122 |
deltax=adc[maxpos]-adc[minpos]; |
123 |
deltay=gradi[maxpos]-gradi[minpos]; |
124 |
a=deltay/deltax; |
125 |
q=gradi[maxpos]-a*adc[maxpos]; |
126 |
grado=a*TH+q; |
127 |
} |
128 |
return (grado); |
129 |
} |
130 |
|
131 |
|
132 |
|
133 |
//reference: Laben Document, TL 18348, pag. 76 |
134 |
float convert_volt(int in) { |
135 |
|
136 |
float a,q,deltax,deltay; |
137 |
float inputvoltage[52],voltage=-1; |
138 |
float adc[52]; |
139 |
int maxpos=-1,minpos=-1,i; |
140 |
|
141 |
for (i=0;i<52;i++) |
142 |
{ |
143 |
inputvoltage[i] = (i*0.10); |
144 |
} |
145 |
for (i=0;i<52;i++) |
146 |
{ |
147 |
adc[i] = (i*5); |
148 |
} |
149 |
|
150 |
if (in==0) |
151 |
{ |
152 |
voltage= 0.00; |
153 |
} |
154 |
else |
155 |
{ |
156 |
|
157 |
for (i=0;i<52;i++) |
158 |
{ |
159 |
if (in<=adc[i]) |
160 |
{ |
161 |
minpos=i; |
162 |
maxpos=i-1; |
163 |
break; |
164 |
} |
165 |
} |
166 |
deltax=adc[maxpos]-adc[minpos]; |
167 |
deltay=inputvoltage[maxpos]-inputvoltage[minpos]; |
168 |
a=deltay/deltax; |
169 |
q=inputvoltage[maxpos]-a*adc[maxpos]; |
170 |
voltage=a*in+q; |
171 |
} |
172 |
return (voltage); |
173 |
|
174 |
} |
175 |
|
176 |
|
177 |
//////////////////////////////////////////////////////////////////////////////// |
178 |
////////////////////////// TMTC TEMPERATURE ////////////////////////////////// |
179 |
////////////////////////////////////////////////////////////////////////////////// |
180 |
|
181 |
void TmtcTemperature(TString base, TString outDir, TString format){ |
182 |
|
183 |
//------- load root file -------------- |
184 |
TFile *file = new TFile(base.Data()); |
185 |
|
186 |
if ( outDir == "" ) outDir = "."; |
187 |
|
188 |
if (!file){ |
189 |
printf("No such file in the directory has been found"); |
190 |
return; |
191 |
} |
192 |
|
193 |
//--- Takes the tree of Tmtc ----------- |
194 |
TPaveText *pt=0; |
195 |
TPaveText *pt1=0; |
196 |
|
197 |
TTree *tr = (TTree*)file->Get("Tmtc"); |
198 |
TBranch *tmtcBr = tr->GetBranch("Tmtc"); |
199 |
|
200 |
pamela::TmtcEvent *tme=0; |
201 |
pamela::TmtcRecord *tmr=0; |
202 |
|
203 |
tr->SetBranchAddress("Tmtc", &tme); |
204 |
|
205 |
//////--------to analize data-----------------////// |
206 |
Long64_t nevents = tmtcBr->GetEntries(); |
207 |
if (nevents<=0) { |
208 |
file->Close(); |
209 |
printf("nevents = %i", nevents); |
210 |
return; |
211 |
} |
212 |
|
213 |
string titolocc[] ={"IPM1 input","IPM2 input","IPM3 input","IPM4 input","IPM5 input","IPM6 input","KHB_HOT","KHB_COLD","IDAQ_HOT","IDAQ_COLD","VCB_STANDBY","VRL_HOT","VRL_COLD","PSB","TOFHV_HOT","TOFHV_COLD"}; |
214 |
|
215 |
string titoloth[] ={"IPM_TH","S1_TH","S4_TH","S4_ND_PLATE_TH","TRK_TH1","TRK_TH2","FLUID_IN_TH","FLUID_OUT_TH","VME_TH1","DCDC_TH","CPU_TH1","CPU_TH2", "IPM_CPU_TH", "VRL_TH1", "VRL_TH2", "VME_TH2"}; |
216 |
|
217 |
|
218 |
const Int_t size = nevents; |
219 |
std::stringstream oss; |
220 |
Int_t recordstot=0; |
221 |
Int_t recordstotmax=0; |
222 |
Int_t records[size]; |
223 |
Int_t ev[size]; |
224 |
Double_t OBT[size]; |
225 |
Int_t tot=0; |
226 |
Int_t m=0; |
227 |
Int_t l=0; |
228 |
|
229 |
|
230 |
for (Int_t i = 0; i < size; i++){ ///ciclo per decidere le pagine |
231 |
tmtcBr->GetEntry(i); |
232 |
Long64_t tmpSize = tme->Records->GetEntries(); |
233 |
recordstot=recordstot+tmpSize; |
234 |
if (tmpSize>0){ |
235 |
tmr = (pamela::TmtcRecord*)tme->Records->At(0); |
236 |
if(i==0){ |
237 |
ev[0]=0; |
238 |
records[0]=0; |
239 |
OBT[0]=tmr->TM_RECORD_OBT; |
240 |
}else if (fmod(i, 30)==0 || ((tmr->TM_RECORD_OBT)<OBT[i-1]) || (i==(size-1)) ){ |
241 |
//}else if ((fmod(i, 20)==0) || (i==(size-1)) ){ |
242 |
tot=tot+1; |
243 |
if (recordstotmax<recordstot) recordstotmax=recordstot; |
244 |
records[tot]=recordstot; |
245 |
OBT[tot]=tmr->TM_RECORD_OBT; |
246 |
ev[tot]=i; |
247 |
recordstot=0; |
248 |
} |
249 |
} |
250 |
} |
251 |
|
252 |
|
253 |
const Int_t lungmax=16*recordstotmax; |
254 |
const Int_t lungmin=6*recordstotmax; |
255 |
|
256 |
Float_t xrecordobtcc[lungmax], yccdiagacq[lungmax], ythana[lungmax], xrecordobtth[lungmax], xrecordobtdea[lungmin], ydea[lungmin], xrecordobtcc_1[lungmax], xrecordobtcc_1d[lungmax], xrecordobtcc_1u[lungmax], yccdiagacq_1[lungmax], yccdiagacq_1d[lungmax], yccdiagacq_1u[lungmax], ythana_1[lungmax], xrecordobtth_1[lungmax], xrecordobtdea_1[lungmin], ydea_1[lungmin]; |
257 |
|
258 |
Float_t yccdiagacq_11u[lungmax], yccdiagacq_11d[lungmax], yccipm12u[lungmax], yccipm12d[lungmax], yccipmkk1u[lungmax], yccipmkk1d[lungmax], yccipmerror[lungmax], yccipmerror2[lungmax]; |
259 |
|
260 |
|
261 |
/////ciclo sulle pagine//////////////////// |
262 |
for (Int_t interval=0; interval<tot; interval++){ |
263 |
|
264 |
///-------to create canvas--------------------// |
265 |
TCanvas *Canvascc = new TCanvas("Tmtc_1", base, 2500, 2000); |
266 |
Canvascc->Divide(1,15); |
267 |
Canvascc->SetFillColor(10); |
268 |
|
269 |
TCanvas *Canvasthdea = new TCanvas("Tmtc_4", base, 1280, 1024); |
270 |
Canvasthdea->SetFillColor(10); |
271 |
Canvasthdea->Divide(4,4); |
272 |
|
273 |
TCanvas *Canvasvoltdea = new TCanvas("Tmtc_5", base, 1280, 1024); |
274 |
Canvasvoltdea->SetFillColor(10); |
275 |
Canvasvoltdea->Divide(2,3); |
276 |
|
277 |
|
278 |
recordstot=0; |
279 |
|
280 |
for (Int_t i = ev[interval]; i < ev[interval+1]; i++){ //ciclo su un sottogruppo |
281 |
// cout<<"ciclo da "<<ev[interval]<<" a "<< ev[interval+1]<<"\n"; |
282 |
|
283 |
tmtcBr->GetEntry(i); |
284 |
l=0; |
285 |
m=0; |
286 |
Long64_t tmpSize = tme->Records->GetEntries(); |
287 |
Int_t size_b = tmpSize; |
288 |
for (Int_t j = 0; j < size_b; j++){ |
289 |
tmr = (pamela::TmtcRecord*)tme->Records->At(j); |
290 |
|
291 |
for (Int_t k =0; k <16; k++){ |
292 |
yccdiagacq[16*recordstot+16*j+k] = (((tmr->TM_DIAG_AND_BILEVEL_ACQ)>>(15-k))&0x0001); |
293 |
xrecordobtcc[16*recordstot+16*j+k] = tmr->TM_RECORD_OBT; |
294 |
} |
295 |
|
296 |
for (Int_t k =0; k <16; k++){ |
297 |
ythana[16*recordstot+16*j+k] = convert_th(tmr->TM_TH_ANA[k]); |
298 |
xrecordobtth[16*recordstot+16*j+k] = tmr->TM_RECORD_OBT; |
299 |
} |
300 |
|
301 |
for (Int_t k =0; k <6; k++){ |
302 |
ydea[6*recordstot+6*j+k] = convert_volt(tmr->TM_DEA_ANA[k]); |
303 |
xrecordobtdea[6*recordstot+6*j+k] = tmr->TM_RECORD_OBT; |
304 |
} |
305 |
} |
306 |
recordstot=recordstot+tmpSize; |
307 |
} |
308 |
|
309 |
TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString(); |
310 |
filename = ((TObjString*)filename.Tokenize('.')->First())->GetString(); |
311 |
|
312 |
TLegend *leg1 = new TLegend(0.87,0.80,0.98,0.94, ""); |
313 |
leg1->SetFillColor(10); |
314 |
leg1->SetBorderSize(0); |
315 |
|
316 |
Canvascc->cd(); |
317 |
pt = new TPaveText (.87,.95,.98,.98); |
318 |
oss.str(""); |
319 |
oss<<filename.Data(); |
320 |
pt->AddText(oss.str().c_str()); |
321 |
pt->SetTextColor(1); |
322 |
//pt->SetTextSize(1); |
323 |
pt->SetFillColor(10); |
324 |
pt->SetBorderSize(0); |
325 |
pt->Draw(); |
326 |
|
327 |
/* |
328 |
TLine *line = new TLine; |
329 |
line->SetLineColor(4); |
330 |
line->SetLineWidth(2); |
331 |
line->DrawLine(0, 0.60, 1, 0.60); |
332 |
line->Draw(); |
333 |
line->DrawLine(0, 0.33, 1, 0.33); |
334 |
line->Draw(); |
335 |
line->DrawLine(0, 0.20, 1, 0.20); |
336 |
line->Draw(); |
337 |
line->DrawLine(0, 0.13, 1, 0.13); |
338 |
line->Draw(); |
339 |
*/ |
340 |
|
341 |
|
342 |
|
343 |
//CC Graph |
344 |
for (Int_t k =0; k<16; k++){ |
345 |
for (Int_t i = 0; i < recordstot; i++){ |
346 |
if (k>0) { |
347 |
yccdiagacq_11u[i]=yccdiagacq_1u[i]; |
348 |
yccdiagacq_11d[i]=yccdiagacq_1d[i]; |
349 |
} |
350 |
yccdiagacq_1d[i]=0; |
351 |
yccdiagacq_1u[i]=0; |
352 |
if (yccdiagacq[16*i+k]==0) { |
353 |
yccdiagacq_1d[i]=-1; |
354 |
xrecordobtcc_1[i]= xrecordobtcc[16*i+k]; |
355 |
} |
356 |
else if (yccdiagacq[16*i+k]==1){ |
357 |
yccdiagacq_1u[i]=1; |
358 |
xrecordobtcc_1[i]= xrecordobtcc[16*i+k]; |
359 |
} |
360 |
if (k==1) { |
361 |
if (yccdiagacq_11u[i]==1 && yccdiagacq_1u[i]==1) yccipm12u[i]=1; |
362 |
else yccipm12u[i]=0; |
363 |
if (yccdiagacq_11d[i]==-1 && yccdiagacq_1d[i]==-1) yccipm12d[i]=-1; |
364 |
else yccipm12d[i]=0; |
365 |
} |
366 |
if (k==1 || k==3 || k==5 || k==7 || k==9) { |
367 |
if (yccdiagacq_11u[i]==1 && yccdiagacq_1u[i]==1) yccipmkk1u[i]=1; |
368 |
else yccipmkk1u[i]=0; |
369 |
if (yccdiagacq_11d[i]==-1 && yccdiagacq_1d[i]==-1) yccipmkk1d[i]=-1; |
370 |
else yccipmkk1d[i]=0; |
371 |
if (k==7 || k==9) { |
372 |
/* if (yccipmkk1u[i]==1 && yccipm12d[i]==0 && yccipm12u[i]==0) yccipmerror[i]=1; |
373 |
else if (yccipmkk1d[i]==-1 && yccipm12d[i]==0 && yccipm12u[i]==0 || (yccipmkk1d[i]==-1 && yccipm12u[i]==1)) yccipmerror[i]=-1; |
374 |
else yccipmerror[i]=0;*/ |
375 |
if ((yccipmkk1u[i]==1 && ydea[6*i]<0.65 && ydea[6*i+1]>3.15 && ydea[6*i+1]<4.25) || (yccipmkk1u[i]==1 && ydea[6*i+1]<0.65 && ydea[6*i]>3.15 && ydea[6*i]<4.25)) yccipmerror[i]=1; |
376 |
else if ((yccipmkk1d[i]==-1 && ydea[6*i]<0.65 && ydea[6*i+1]>3.15 && ydea[6*i+1]<4.25) || (yccipmkk1d[i]==-1 && ydea[6*i+1]<0.65 && ydea[6*i]>3.15 && ydea[6*i]<4.25) || (yccipmkk1d[i]==-1 && ydea[6*i]<0.65 && ydea[6*i+1]<0.65)) yccipmerror[i]=-1; |
377 |
else yccipmerror[i]=0; |
378 |
} |
379 |
} |
380 |
if (k==6 || k==7 || k==8 || k==9) { |
381 |
/*if (yccdiagacq_1d[i]==-1 && yccipm12u[i]==1) yccipmerror2[i]=-1; |
382 |
else yccipmerror2[i]=0;*/ |
383 |
if (yccdiagacq_1d[i]==-1 && ydea[6*i]<0.65 && ydea[6*i+1]<0.65) yccipmerror2[i]=-1; |
384 |
else yccipmerror2[i]=0; |
385 |
} |
386 |
if (k==13) { |
387 |
if ((yccdiagacq_1d[i]==-1 && ydea[6*i]<0.65 && ydea[6*i+1]>3.15 && ydea[6*i+1]<4.25) || (yccdiagacq_1d[i]==-1 && ydea[6*i+1]<0.65 && ydea[6*i]>3.15 && ydea[6*i]<4.25)) yccdiagacq_1d[i]==-1; //psb on |
388 |
if (yccdiagacq_1u[i]==1 && ydea[6*i]<0.65 && ydea[6*i+1]<0.65) yccdiagacq_1u[i]==1; //psb off |
389 |
/*if (yccdiagacq_1d[i]==-1 && yccipm12d[i]==-1) yccipmerror[i]=-1; |
390 |
else if (yccdiagacq_1u[i]==1 && yccipm12d[i]==0 && yccipm12u[i]==0) yccipmerror[i]=1; |
391 |
else yccipmerror[i]=0;*/ |
392 |
if (yccdiagacq_1d[i]==-1 && ydea[6*i]<0.65 && ydea[6*i+1]<0.65) yccipmerror[i]=-1; |
393 |
else if ((yccdiagacq_1u[i]==1 && ydea[6*i]<0.65 && ydea[6*i+1]>3.15 && ydea[6*i+1]<4.25) || (yccdiagacq_1u[i]==1 && ydea[6*i+1]<0.65 && ydea[6*i]>3.15 && ydea[6*i]<4.25)) yccipmerror[i]=1; |
394 |
else yccipmerror[i]=0; //psb alarm |
395 |
} |
396 |
if (k==15) { |
397 |
yccdiagacq_11u[i]=0; |
398 |
yccdiagacq_11d[i]=0; |
399 |
} |
400 |
} |
401 |
|
402 |
//CC IPM |
403 |
if (k==0 || k==1 ||k==2 || k==3 || k==4 || k==5 ){ |
404 |
Canvascc->cd(m+1); |
405 |
Canvascc->cd(m+1)->SetGridx(); |
406 |
gPad->SetFillColor(10); |
407 |
gPad->SetFrameBorderSize(0); |
408 |
gPad->SetLineColor(1); |
409 |
gPad->SetFrameBorderMode(0); |
410 |
|
411 |
|
412 |
pt = new TPaveText (.01,.30,.10,.70); |
413 |
oss.str(""); |
414 |
oss<<titolocc[k]; |
415 |
pt->AddText(oss.str().c_str()); |
416 |
pt->SetFillColor(10); |
417 |
pt->SetBorderSize(0); |
418 |
pt->Draw(); |
419 |
|
420 |
|
421 |
TGraph *ccrecordd = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1d); |
422 |
ccrecordd->SetTitle(""); |
423 |
ccrecordd->SetFillColor(8); |
424 |
ccrecordd->GetXaxis()->SetLabelSize(0); |
425 |
ccrecordd->GetXaxis()->SetTickLength(0); |
426 |
ccrecordd->GetYaxis()->SetLabelSize(0); |
427 |
ccrecordd->GetYaxis()->SetTickLength(0); |
428 |
ccrecordd->SetMaximum(1.3); |
429 |
ccrecordd->SetMinimum(-1.3); |
430 |
ccrecordd->GetXaxis()->SetAxisColor(0); |
431 |
ccrecordd->Draw("AB"); |
432 |
if (k==0) leg1->AddEntry(ccrecordd,"ON","f"); |
433 |
|
434 |
TGraph *ccrecordu = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1u); |
435 |
ccrecordu->SetTitle(""); |
436 |
ccrecordu->SetFillColor(17); |
437 |
ccrecordu->GetXaxis()->SetLabelSize(0); |
438 |
ccrecordu->GetXaxis()->SetTickLength(0); |
439 |
ccrecordu->GetYaxis()->SetLabelSize(0); |
440 |
ccrecordu->GetYaxis()->SetTickLength(0); |
441 |
ccrecordu->GetXaxis()->SetAxisColor(0); |
442 |
ccrecordu->SetMaximum(1.3); |
443 |
ccrecordu->SetMinimum(-1.3); |
444 |
ccrecordu->Draw("Bsame"); |
445 |
if (k==0) leg1->AddEntry(ccrecordu,"OFF","f"); |
446 |
|
447 |
|
448 |
if (k==1 || k==3 || k==5){ |
449 |
Canvascc->cd(m); |
450 |
TGraph *ccrecorderrord = new TGraph(recordstot, xrecordobtcc_1, yccipmkk1d); |
451 |
ccrecorderrord->SetTitle(""); |
452 |
ccrecorderrord->SetFillColor(2); |
453 |
ccrecorderrord->GetXaxis()->SetLabelSize(0); |
454 |
ccrecorderrord->GetXaxis()->SetTickLength(0); |
455 |
ccrecorderrord->GetYaxis()->SetLabelSize(0); |
456 |
ccrecorderrord->GetYaxis()->SetTickLength(0); |
457 |
ccrecorderrord->SetMaximum(1.3); |
458 |
ccrecorderrord->SetMinimum(-1.3); |
459 |
ccrecorderrord->GetXaxis()->SetAxisColor(0); |
460 |
ccrecorderrord->Draw("Bsame"); |
461 |
|
462 |
TGraph *ccrecorderroru = new TGraph(recordstot, xrecordobtcc_1, yccipmkk1u); |
463 |
ccrecorderroru->SetTitle(""); |
464 |
ccrecorderroru->SetFillColor(2); |
465 |
ccrecorderroru->GetXaxis()->SetLabelSize(0); |
466 |
ccrecorderroru->GetXaxis()->SetTickLength(0); |
467 |
ccrecorderroru->GetYaxis()->SetLabelSize(0); |
468 |
ccrecorderroru->GetYaxis()->SetTickLength(0); |
469 |
ccrecorderroru->SetMaximum(1.3); |
470 |
ccrecorderroru->SetMinimum(-1.3); |
471 |
ccrecorderroru->GetXaxis()->SetAxisColor(0); |
472 |
ccrecorderroru->Draw("Bsame"); |
473 |
|
474 |
Canvascc->cd(m+1); |
475 |
ccrecorderrord->Draw("Bsame"); |
476 |
ccrecorderroru->Draw("Bsame"); |
477 |
} |
478 |
|
479 |
|
480 |
Double_t xmin; |
481 |
Double_t xmax; |
482 |
xmin=ccrecordu->GetXaxis()->GetXmin(); |
483 |
xmax=ccrecordu->GetXaxis()->GetXmax(); |
484 |
TGaxis *axis = new TGaxis (xmin, 0, xmax, 0, xmin, xmax, 510, "+-", 0); |
485 |
axis->Draw("same"); |
486 |
/*TF1 *func1 = new TF1("func1", "0"); |
487 |
func1->SetRange(xmin,xrecordobtcc_1[recordstot-1]); |
488 |
func1->SetLineColor(1); |
489 |
func1->SetLineStyle(1); |
490 |
func1->SetLineWidth(2); |
491 |
func1->Draw("same");*/ |
492 |
|
493 |
m=m+1; |
494 |
} |
495 |
|
496 |
//CC idaq-khb-tof |
497 |
if (k==6 || k==7 || k==8 || k==9 || k==14 || k==15){ |
498 |
Canvascc->cd(l+7); |
499 |
gPad->SetFillColor(10); |
500 |
gPad->SetFrameBorderSize(0); |
501 |
|
502 |
pt = new TPaveText (.00,.30,.09,.70); |
503 |
oss.str(""); |
504 |
oss<<titolocc[k]; |
505 |
pt->AddText(oss.str().c_str()); |
506 |
pt->SetFillColor(10); |
507 |
pt->SetBorderSize(0); |
508 |
pt->Draw(); |
509 |
|
510 |
|
511 |
TGraph *ccrecordd = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1d); |
512 |
ccrecordd->SetTitle(""); |
513 |
if (k==14 || k==15) ccrecordd->SetFillColor(2); |
514 |
else ccrecordd->SetFillColor(8); |
515 |
ccrecordd->GetXaxis()->SetLabelSize(0); |
516 |
ccrecordd->GetXaxis()->SetTickLength(0); |
517 |
ccrecordd->GetYaxis()->SetLabelSize(0); |
518 |
ccrecordd->GetYaxis()->SetTickLength(0); |
519 |
ccrecordd->SetMaximum(1.3); |
520 |
ccrecordd->SetMinimum(-1.3); |
521 |
ccrecordd->GetXaxis()->SetAxisColor(0); |
522 |
ccrecordd->Draw("AB"); |
523 |
|
524 |
TGraph *ccrecordu = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1u); |
525 |
ccrecordu->SetTitle(""); |
526 |
if (k==14 || k==15) { |
527 |
ccrecordu->SetFillColor(7); |
528 |
if (k==14) leg1->AddEntry(ccrecordu,"ON-OFF-LATCHUP","f"); |
529 |
} |
530 |
else ccrecordu->SetFillColor(17); |
531 |
ccrecordu->GetXaxis()->SetAxisColor(0); |
532 |
ccrecordu->GetXaxis()->SetLabelSize(0); |
533 |
ccrecordu->GetXaxis()->SetTickLength(0); |
534 |
ccrecordu->GetYaxis()->SetLabelSize(0); |
535 |
ccrecordu->GetYaxis()->SetTickLength(0); |
536 |
ccrecordu->SetMaximum(1.3); |
537 |
ccrecordu->SetMinimum(-1.3); |
538 |
ccrecordu->Draw("Bsame"); |
539 |
|
540 |
if (k==6 || k==7 || k==8 || k==9){ |
541 |
Canvascc->cd(l+7); |
542 |
TGraph *ccrecorderroru = new TGraph(recordstot, xrecordobtcc_1, yccipmerror2); |
543 |
ccrecorderroru->SetTitle(""); |
544 |
ccrecorderroru->SetFillColor(2); |
545 |
ccrecorderroru->GetXaxis()->SetLabelSize(0); |
546 |
ccrecorderroru->GetXaxis()->SetTickLength(0); |
547 |
ccrecorderroru->GetYaxis()->SetLabelSize(0); |
548 |
ccrecorderroru->GetYaxis()->SetTickLength(0); |
549 |
ccrecorderroru->SetMaximum(1.3); |
550 |
ccrecorderroru->SetMinimum(-1.3); |
551 |
ccrecorderroru->GetXaxis()->SetAxisColor(0); |
552 |
ccrecorderroru->Draw("Bsame"); |
553 |
} |
554 |
|
555 |
|
556 |
if (k==7 || k==9){ |
557 |
Canvascc->cd(l+7-1); |
558 |
TGraph *ccrecorderroru = new TGraph(recordstot, xrecordobtcc_1, yccipmerror); |
559 |
ccrecorderroru->SetTitle(""); |
560 |
ccrecorderroru->SetFillColor(2); |
561 |
ccrecorderroru->GetXaxis()->SetLabelSize(0); |
562 |
ccrecorderroru->GetXaxis()->SetTickLength(0); |
563 |
ccrecorderroru->GetYaxis()->SetLabelSize(0); |
564 |
ccrecorderroru->GetYaxis()->SetTickLength(0); |
565 |
ccrecorderroru->SetMaximum(1.3); |
566 |
ccrecorderroru->SetMinimum(-1.3); |
567 |
ccrecorderroru->GetXaxis()->SetAxisColor(0); |
568 |
if (k==7) leg1->AddEntry(ccrecorderroru,"ALARM","f"); |
569 |
ccrecorderroru->Draw("Bsame"); |
570 |
|
571 |
Canvascc->cd(l+7); |
572 |
ccrecorderroru->Draw("Bsame"); |
573 |
} |
574 |
|
575 |
|
576 |
Double_t xmin; |
577 |
Double_t xmax; |
578 |
xmin=ccrecordu->GetXaxis()->GetXmin(); |
579 |
xmax=ccrecordu->GetXaxis()->GetXmax(); |
580 |
TGaxis *axis = new TGaxis (xmin, 0, xmax, 0, xmin, xmax, 510, "+-", 1.5); |
581 |
axis->Draw("same"); |
582 |
/*TF1 *func1 = new TF1("func1", "0"); |
583 |
func1->SetRange(xmin,xrecordobtcc_1[recordstot-1]); |
584 |
func1->SetLineColor(1); |
585 |
func1->SetLineStyle(1); |
586 |
func1->SetLineWidth(2); |
587 |
func1->Draw("same");*/ |
588 |
l=l+1; |
589 |
|
590 |
} |
591 |
|
592 |
//CC vrl |
593 |
if (k==11 || k==12 || k==13 ){ |
594 |
if (k==13) Canvascc->cd(13); |
595 |
if (k==11) Canvascc->cd(14); |
596 |
if (k==12) Canvascc->cd(15); |
597 |
gPad->SetFillColor(10); |
598 |
gPad->SetFrameBorderSize(0); |
599 |
|
600 |
pt = new TPaveText (.01,.30,.09,.70); |
601 |
oss.str(""); |
602 |
oss<<titolocc[k]; |
603 |
pt->AddText(oss.str().c_str()); |
604 |
pt->SetFillColor(10); |
605 |
pt->SetBorderSize(0); |
606 |
pt->Draw(); |
607 |
|
608 |
if (k==11 || k==12){ |
609 |
TGraph *ccrecordd = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1d); |
610 |
ccrecordd->SetTitle(""); |
611 |
ccrecordd->SetFillColor(8); |
612 |
ccrecordd->GetXaxis()->SetAxisColor(0); |
613 |
ccrecordd->GetXaxis()->SetLabelSize(0); |
614 |
ccrecordd->GetXaxis()->SetTickLength(0); |
615 |
ccrecordd->GetYaxis()->SetLabelSize(0); |
616 |
ccrecordd->GetYaxis()->SetTickLength(0); |
617 |
ccrecordd->SetMaximum(1.3); |
618 |
ccrecordd->SetMinimum(-1.3); |
619 |
ccrecordd->Draw("AB"); |
620 |
|
621 |
|
622 |
TGraph *ccrecordu = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1u); |
623 |
ccrecordu->SetTitle(""); |
624 |
ccrecordu->SetFillColor(17); |
625 |
ccrecordu->GetXaxis()->SetAxisColor(0); |
626 |
ccrecordu->GetXaxis()->SetLabelSize(0); |
627 |
ccrecordu->GetXaxis()->SetTickLength(0); |
628 |
ccrecordu->GetYaxis()->SetLabelSize(0); |
629 |
ccrecordu->GetYaxis()->SetTickLength(0); |
630 |
ccrecordu->SetMaximum(1.3); |
631 |
ccrecordu->SetMinimum(-1.3); |
632 |
ccrecordu->Draw("Bsame"); |
633 |
|
634 |
Double_t xmin; |
635 |
Double_t xmax; |
636 |
xmin=ccrecordu->GetXaxis()->GetXmin(); |
637 |
xmax=ccrecordu->GetXaxis()->GetXmax(); |
638 |
if (k==12){ |
639 |
TGaxis *axis = new TGaxis (xmin, -1, xmax, -1, xmin, xmax, 510, "", 0); |
640 |
axis->SetLabelSize(0.24); |
641 |
axis->SetLabelColor(1); |
642 |
axis->SetTitle("OBT (ms)"); |
643 |
//axis->CenterTitle(); |
644 |
axis->SetTitleOffset(0.4); |
645 |
axis->SetTitleSize(0.21); |
646 |
axis->Draw(); |
647 |
TF1 *func1 = new TF1("func1", "0"); |
648 |
func1->SetRange(xmin,xmax); |
649 |
func1->SetLineColor(1); |
650 |
func1->SetLineStyle(1); |
651 |
func1->SetLineWidth(1); |
652 |
func1->Draw("same"); |
653 |
} |
654 |
if (k==11){ |
655 |
TGaxis *axis = new TGaxis (xmin, 0, xmax, 0, xmin, xmax, 510, "+-", 0); |
656 |
axis->SetLineWidth(1); |
657 |
axis->SetTickSize(2); |
658 |
axis->Draw("same"); |
659 |
} |
660 |
} |
661 |
|
662 |
if (k==13){ |
663 |
Canvascc->cd(13); |
664 |
|
665 |
TGraph *ccrecordd = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1d); |
666 |
ccrecordd->SetTitle(""); |
667 |
ccrecordd->SetFillColor(8); |
668 |
ccrecordd->GetXaxis()->SetAxisColor(0); |
669 |
ccrecordd->GetXaxis()->SetLabelSize(0); |
670 |
ccrecordd->GetXaxis()->SetTickLength(0); |
671 |
ccrecordd->GetYaxis()->SetLabelSize(0); |
672 |
ccrecordd->GetYaxis()->SetTickLength(0); |
673 |
ccrecordd->SetMaximum(1.3); |
674 |
ccrecordd->SetMinimum(-1.3); |
675 |
ccrecordd->Draw("AB"); |
676 |
|
677 |
TGraph *ccrecordu = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1u); |
678 |
ccrecordu->SetTitle(""); |
679 |
ccrecordu->SetFillColor(17); |
680 |
ccrecordu->GetXaxis()->SetAxisColor(0); |
681 |
ccrecordu->GetXaxis()->SetLabelSize(0); |
682 |
ccrecordu->GetXaxis()->SetTickLength(0); |
683 |
ccrecordu->GetYaxis()->SetLabelSize(0); |
684 |
ccrecordu->GetYaxis()->SetTickLength(0); |
685 |
ccrecordu->SetMaximum(1.3); |
686 |
ccrecordu->SetMinimum(-1.3); |
687 |
ccrecordu->Draw("Bsame"); |
688 |
|
689 |
TGraph *ccrecorderroru = new TGraph(recordstot, xrecordobtcc_1, yccipmerror); |
690 |
ccrecorderroru->SetTitle(""); |
691 |
ccrecorderroru->SetFillColor(2); |
692 |
ccrecorderroru->GetXaxis()->SetLabelSize(0); |
693 |
ccrecorderroru->GetXaxis()->SetTickLength(0); |
694 |
ccrecorderroru->GetYaxis()->SetLabelSize(0); |
695 |
ccrecorderroru->GetYaxis()->SetTickLength(0); |
696 |
ccrecorderroru->SetMaximum(1.3); |
697 |
ccrecorderroru->SetMinimum(-1.3); |
698 |
ccrecorderroru->GetXaxis()->SetAxisColor(0); |
699 |
ccrecorderroru->Draw("Bsame"); |
700 |
|
701 |
|
702 |
Double_t xmin=ccrecordu->GetXaxis()->GetXmin(); |
703 |
Double_t xmax=ccrecordu->GetXaxis()->GetXmax(); |
704 |
TGaxis *axis = new TGaxis (xmin, 0, xmax, 0, xmin, xmax, 510, "+-", 0); |
705 |
axis->SetLineWidth(1); |
706 |
axis->SetTickSize(2); |
707 |
axis->Draw("same"); |
708 |
} |
709 |
|
710 |
} |
711 |
|
712 |
} |
713 |
|
714 |
Canvascc->cd(); |
715 |
leg1->Draw(); |
716 |
Canvascc->Update(); |
717 |
|
718 |
// TH Graph |
719 |
Canvasthdea->cd(); |
720 |
//thermistors number=16 |
721 |
if (tr->GetBranch("Records.TM_TH_ANA[16]")){ |
722 |
for (Int_t k =0; k<16; k++){ |
723 |
for (Int_t i = 0; i < recordstot; i++){ |
724 |
ythana_1[i]= ythana[16*i+k]; |
725 |
xrecordobtth_1[i]= xrecordobtth[16*i+k]; |
726 |
} |
727 |
Canvasthdea->cd(k+1); |
728 |
|
729 |
TGraph *threcord = new TGraph(recordstot, xrecordobtth_1, ythana_1); |
730 |
// threcord->SetLineColor(kBlue); |
731 |
threcord->SetMarkerSize(0.2); |
732 |
threcord->SetMarkerColor(kBlue); |
733 |
threcord->SetMarkerStyle(21); |
734 |
threcord->SetMinimum(-10); |
735 |
threcord->SetMaximum(60); |
736 |
threcord->GetXaxis()->SetTitle("OBT"); |
737 |
threcord->GetXaxis()->CenterTitle(); |
738 |
threcord->GetYaxis()->SetTitle("Temperature value (°C)"); |
739 |
threcord->GetYaxis()->CenterTitle(); |
740 |
oss.str(""); |
741 |
oss << filename.Data() <<": " <<titoloth[k] ; |
742 |
threcord->SetTitle(oss.str().c_str()); |
743 |
|
744 |
Double_t xmin=threcord->GetXaxis()->GetXmin(); |
745 |
Double_t xmax=threcord->GetXaxis()->GetXmax(); |
746 |
if (k==10 || k==11 ) { |
747 |
TPaveText *pt = new TPaveText (.45,.75,.55,.82); |
748 |
pt->AddText("OFF"); |
749 |
pt->SetBorderSize(1); |
750 |
pt->Draw(); |
751 |
threcord->Draw("APsame"); |
752 |
TF1 *func1 = new TF1("func1", "50"); |
753 |
func1->SetRange(xmin,xmax); |
754 |
func1->SetLineColor(2); |
755 |
func1->SetLineStyle(1); |
756 |
func1->SetLineWidth(2); |
757 |
func1->Draw("same"); |
758 |
pt->Draw(); |
759 |
}else { |
760 |
TPaveText *pt = new TPaveText (.45,.7,.55,.77); |
761 |
pt->AddText("OFF"); |
762 |
pt->SetBorderSize(1); |
763 |
pt->Draw(); |
764 |
threcord->Draw("APsame"); |
765 |
TF1 *func1 = new TF1("func1", "45"); |
766 |
func1->SetRange(xmin,xmax); |
767 |
func1->SetLineColor(2); |
768 |
func1->SetLineStyle(1); |
769 |
func1->SetLineWidth(2); |
770 |
func1->Draw("same"); |
771 |
pt->Draw(); |
772 |
} |
773 |
|
774 |
|
775 |
|
776 |
} |
777 |
} |
778 |
|
779 |
// DEA Graph |
780 |
Canvasvoltdea->cd(); |
781 |
for (Int_t k =0; k<6; k++){ |
782 |
for (Int_t i = 0; i < recordstot; i++){ |
783 |
ydea_1[i]= ydea[6*i + k]; |
784 |
xrecordobtdea_1[i]= xrecordobtdea[6*i+k]; |
785 |
} |
786 |
Canvasvoltdea->cd(k+1); |
787 |
|
788 |
TPaveText *pt = new TPaveText (.84,.13,.92,.19); |
789 |
pt->AddText("OFF"); |
790 |
pt->SetBorderSize(1); |
791 |
pt->Draw(); |
792 |
TPaveText *pt1 = new TPaveText (.84,.67,.92,.73); |
793 |
pt1->AddText("ON"); |
794 |
pt1->SetBorderSize(1); |
795 |
pt1->Draw(); |
796 |
|
797 |
TGraph *dearecord = new TGraph(recordstot, xrecordobtdea_1, ydea_1); |
798 |
//dearecord->SetLineColor(kBlue); |
799 |
//dearecord->SetLineWidth(1); |
800 |
dearecord->SetMarkerStyle(21); |
801 |
dearecord->SetMarkerSize(0.5); |
802 |
dearecord->SetMarkerColor(kBlue); |
803 |
dearecord->SetMinimum(0.0); |
804 |
dearecord->SetMaximum(5.0); |
805 |
dearecord->GetXaxis()->SetTitle("OBT"); |
806 |
dearecord->GetXaxis()->CenterTitle(); |
807 |
dearecord->GetYaxis()->SetTitle("Voltage value (V)"); |
808 |
dearecord->GetYaxis()->CenterTitle(); |
809 |
oss.str(""); |
810 |
oss << filename.Data()<<": IPM "<<k+1<<" output"; |
811 |
dearecord->SetTitle(oss.str().c_str()); |
812 |
dearecord->Draw("APsame"); |
813 |
//dearecord->Draw("ACPLsame"); |
814 |
|
815 |
Double_t xmin=dearecord->GetXaxis()->GetXmin(); |
816 |
Double_t xmax=dearecord->GetXaxis()->GetXmax(); |
817 |
TF1 *func1 = new TF1("func1", "0.65"); |
818 |
func1->SetRange(xmin, xmax); |
819 |
func1->SetLineColor(2); |
820 |
func1->SetLineStyle(1); |
821 |
func1->SetLineWidth(2); |
822 |
func1->Draw("Csame"); |
823 |
|
824 |
TF1 *func2 = new TF1("func2", "3.15"); |
825 |
func2->SetRange(xmin, xmax); |
826 |
func2->SetLineColor(2); |
827 |
func2->SetLineStyle(1); |
828 |
func2->SetLineWidth(2); |
829 |
func2->Draw("Csame"); |
830 |
|
831 |
TF1 *func3 = new TF1("func3", "4.25"); |
832 |
func3->SetRange(xmin, xmax); |
833 |
func3->SetLineColor(2); |
834 |
func3->SetLineStyle(1); |
835 |
func3->SetLineWidth(2); |
836 |
func3->Draw("Csame"); |
837 |
|
838 |
|
839 |
pt1->Draw(); |
840 |
pt->Draw(); |
841 |
} |
842 |
|
843 |
|
844 |
stringstream oss1, oss2, oss3, oss4; |
845 |
oss.str(""); |
846 |
oss1.str(""); |
847 |
oss2.str(""); |
848 |
oss << outDir.Data() << filename.Data() << "_Tmtc_cc_"<<interval+1<<"." << format; |
849 |
oss1 << outDir.Data() << filename.Data() << "_Tmtc_th_dea_"<<interval+1<<"." << format; |
850 |
oss2 << outDir.Data() << filename.Data() << "_Tmtc_volt_dea_"<<interval+1<<"." << format; |
851 |
Canvascc->SaveAs(oss.str().c_str()); |
852 |
Canvasthdea->SaveAs(oss1.str().c_str()); |
853 |
Canvasvoltdea->SaveAs(oss2.str().c_str()); //// fine del lavoro sul sottogruppo |
854 |
|
855 |
Canvascc->Clear(); |
856 |
Canvasthdea->Clear(); |
857 |
Canvasvoltdea->Clear(); |
858 |
//gROOT->GetListOfCanvases()->Delete(); |
859 |
//gROOT->Reset(); |
860 |
|
861 |
} |
862 |
|
863 |
|
864 |
file->Close(); |
865 |
} |
866 |
|
867 |
|
868 |
////////////////////////////////////////////////////////////////////////////////// |
869 |
///////////////////////// MAIN /////////////////////////////////////////////// |
870 |
////////////////////////////////////////////////////////////////////////////////// |
871 |
|
872 |
|
873 |
int main(int argc, char* argv[]){ |
874 |
TString path; |
875 |
TString outDir = "./"; |
876 |
TString format = "jpg"; |
877 |
|
878 |
if (argc < 2){ |
879 |
printf("You have to insert at least the file to analyze \n"); |
880 |
printf("Try '--help' for more information. \n"); |
881 |
exit(1); |
882 |
} |
883 |
|
884 |
if (!strcmp(argv[1], "--help")){ |
885 |
printf( "Usage: TmtcTemperature FILE [OPTION] \n"); |
886 |
printf( "\t --help Print this help and exit \n"); |
887 |
printf( "\t -outDir[path] Path where to put the output [default ./] \n"); |
888 |
printf( "\t -format[jpg|ps|gif] Format for output files [default 'jpg'] \n"); |
889 |
exit(1); |
890 |
} |
891 |
|
892 |
path=argv[1]; |
893 |
|
894 |
for (int i = 2; i < argc; i++){ |
895 |
|
896 |
|
897 |
if (!strcmp(argv[i], "-outDir")){ |
898 |
if (++i >= argc){ |
899 |
printf( "-outDir needs arguments. \n"); |
900 |
printf( "Try '--help' for more information. \n"); |
901 |
exit(1); |
902 |
} |
903 |
else{ |
904 |
outDir = argv[i]; |
905 |
continue; |
906 |
} |
907 |
} |
908 |
|
909 |
if (!strcmp(argv[i], "-format")){ |
910 |
if (++i >= argc){ |
911 |
printf( "-format needs arguments. \n"); |
912 |
printf( "Try '--help' for more information. \n"); |
913 |
exit(1); |
914 |
} |
915 |
else{ |
916 |
format = argv[i]; |
917 |
continue; |
918 |
} |
919 |
} |
920 |
|
921 |
|
922 |
} |
923 |
|
924 |
TmtcTemperature(argv[1], outDir, format); |
925 |
|
926 |
} |