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

Contents of /quicklook/QLflightTmtc_Header/TmtcTemperature.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Wed Jun 21 12:56:21 2006 UTC (18 years, 5 months ago) by pam-rm2
Branch: MAIN
CVS Tags: v1r06, v1r07, v1r04, v1r05
Changes since 1.3: +83 -103 lines
sistemati ultimi termistori

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
214 string titolocc[] ={"IPM1","IPM2","IPM3","IPM4","IPM5","IPM6","KHB_HOT","KHB_COLD","IDAQ_HOT","IDAQ_COLD","VCB_STANDBY","VRL_HOT","VRL_COLD","PSB","TOFHV_HOT","TOFHV_COLD"};
215
216 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"};
217
218
219 const Int_t size = nevents;
220 std::stringstream oss;
221 Int_t recordstot=0;
222 Int_t recordstotmax=0;
223 Int_t records[size];
224 Int_t ev[size];
225 Double_t OBT[size];
226 Int_t tot=0;
227 Int_t m=0;
228 Int_t l=0;
229
230
231 for (Int_t i = 0; i < size; i++){ ///ciclo per decidere le pagine
232 tmtcBr->GetEntry(i);
233 Long64_t tmpSize = tme->Records->GetEntries();
234 recordstot=recordstot+tmpSize;
235 if (tmpSize>0){
236 tmr = (pamela::TmtcRecord*)tme->Records->At(0);
237 if(i==0){
238 ev[0]=0;
239 records[0]=0;
240 OBT[0]=tmr->TM_RECORD_OBT;
241 }else if (fmod(i, 35)==0 || ((tmr->TM_RECORD_OBT)<OBT[i-1]) || (i==(size-1)) ){
242 //}else if ((fmod(i, 20)==0) || (i==(size-1)) ){
243 tot=tot+1;
244 if (recordstotmax<recordstot) recordstotmax=recordstot;
245 records[tot]=recordstot;
246 OBT[tot]=tmr->TM_RECORD_OBT;
247 ev[tot]=i;
248 recordstot=0;
249 }
250 }
251 }
252
253
254
255 const Int_t lungmax=16*recordstotmax;
256 const Int_t lungmin=6*recordstotmax;
257
258
259 Double_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];
260
261 Double_t yccdiagacq_11u[lungmax], yccdiagacq_11d[lungmax], yccipm12u[lungmax], yccipm12d[lungmax], yccipmkk1u[lungmax], yccipmkk1d[lungmax], yccipmerror[lungmax], yccipmerror2[lungmax];
262
263
264
265 /////ciclo sulle pagine////////////////////
266 for (Int_t interval=0; interval<tot; interval++){
267
268 ///-------to create canvas--------------------//
269 TCanvas *Canvascc = new TCanvas("Tmtc_1", base, 2500, 2000);
270 Canvascc->Divide(1,15);
271 Canvascc->SetFillColor(10);
272
273 TCanvas *Canvasthdea = new TCanvas("Tmtc_4", base, 1280, 1024);
274 Canvasthdea->SetFillColor(10);
275 Canvasthdea->Divide(4,4);
276
277
278 TCanvas *Canvasvoltdea = new TCanvas("Tmtc_5", base, 1280, 1024);
279 Canvasvoltdea->SetFillColor(10);
280 Canvasvoltdea->Divide(2,3);
281
282
283 recordstot=0;
284
285 for (Int_t i = ev[interval]; i < ev[interval+1]; i++){ //ciclo su un sottogruppo
286 // cout<<"ciclo da "<<ev[interval]<<" a "<< ev[interval+1]<<"\n";
287 tmtcBr->GetEntry(i);
288 l=0;
289 m=0;
290 Long64_t tmpSize = tme->Records->GetEntries();
291 Int_t size_b = tmpSize;
292 for (Int_t j = 0; j < size_b; j++){
293 tmr = (pamela::TmtcRecord*)tme->Records->At(j);
294
295 for (Int_t k =0; k <16; k++){
296 yccdiagacq[16*recordstot+16*j+k] = (((tmr->TM_DIAG_AND_BILEVEL_ACQ)>>(15-k))&0x0001);
297 xrecordobtcc[16*recordstot+16*j+k] = tmr->TM_RECORD_OBT;
298 }
299
300 for (Int_t k =0; k <16; k++){
301 ythana[16*recordstot+16*j+k] = convert_th(tmr->TM_TH_ANA[k]);
302 xrecordobtth[16*recordstot+16*j+k] = tmr->TM_RECORD_OBT;
303 }
304
305 for (Int_t k =0; k <6; k++){
306 ydea[6*recordstot+6*j+k] = convert_volt(tmr->TM_DEA_ANA[k]);
307 xrecordobtdea[6*recordstot+6*j+k] = tmr->TM_RECORD_OBT;
308 }
309 }
310 recordstot=recordstot+tmpSize;
311 }
312
313 TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString();
314 filename = ((TObjString*)filename.Tokenize('.')->First())->GetString();
315
316 TLegend *leg1 = new TLegend(0.87,0.80,0.98,0.94, "");
317 leg1->SetFillColor(10);
318 leg1->SetBorderSize(0);
319
320 Canvascc->cd();
321 pt = new TPaveText (.87,.95,.98,.98);
322 oss.str("");
323 oss<<filename.Data();
324 pt->AddText(oss.str().c_str());
325 pt->SetTextColor(1);
326 //pt->SetTextSize(1);
327 pt->SetFillColor(10);
328 pt->SetBorderSize(0);
329 pt->Draw();
330
331 /*
332 TLine *line = new TLine;
333 line->SetLineColor(4);
334 line->SetLineWidth(2);
335 line->DrawLine(0, 0.60, 1, 0.60);
336 line->Draw();
337 line->DrawLine(0, 0.33, 1, 0.33);
338 line->Draw();
339 line->DrawLine(0, 0.20, 1, 0.20);
340 line->Draw();
341 line->DrawLine(0, 0.13, 1, 0.13);
342 line->Draw();
343 */
344
345
346
347 //CC Graph
348 for (Int_t k =0; k<16; k++){
349 for (Int_t i = 0; i < recordstot; i++){
350 if (k>0) {
351 yccdiagacq_11u[i]=yccdiagacq_1u[i];
352 yccdiagacq_11d[i]=yccdiagacq_1d[i];
353 }
354 yccdiagacq_1d[i]=0;
355 yccdiagacq_1u[i]=0;
356 if (yccdiagacq[16*i+k]==0) {
357 yccdiagacq_1d[i]=-1;
358 xrecordobtcc_1[i]= xrecordobtcc[16*i+k];
359 }
360 else if (yccdiagacq[16*i+k]==1){
361 yccdiagacq_1u[i]=1;
362 xrecordobtcc_1[i]= xrecordobtcc[16*i+k];
363 }
364 if (k==1) {
365 if (yccdiagacq_11u[i]==1 && yccdiagacq_1u[i]==1) yccipm12u[i]=1;
366 else yccipm12u[i]=0;
367 if (yccdiagacq_11d[i]==-1 && yccdiagacq_1d[i]==-1) yccipm12d[i]=-1;
368 else yccipm12d[i]=0;
369 }
370 if (k==1 || k==3 || k==5 || k==7 || k==9) {
371 if (yccdiagacq_11u[i]==1 && yccdiagacq_1u[i]==1) yccipmkk1u[i]=1;
372 else yccipmkk1u[i]=0;
373 if (yccdiagacq_11d[i]==-1 && yccdiagacq_1d[i]==-1) yccipmkk1d[i]=-1;
374 else yccipmkk1d[i]=0;
375 if (k==7 || k==9) {
376 if (yccipmkk1u[i]==1 && yccipm12d[i]==0 && yccipm12u[i]==0) yccipmerror[i]=1;
377 else if (yccipmkk1d[i]==-1 && yccipm12d[i]==0 && yccipm12u[i]==0 || (yccipmkk1d[i]==-1 && yccipm12u[i]==1)) yccipmerror[i]=-1;
378 else yccipmerror[i]=0;
379 }
380 }
381 if (k==6 || k==7 || k==8 || k==9) {
382 if (yccdiagacq_1d[i]==-1 && yccipm12u[i]==1) yccipmerror2[i]=-1;
383 else yccipmerror2[i]=0;
384 }
385 if (k==13) {
386 if (yccdiagacq_1d[i]==-1 && yccipm12d[i]==0 && yccipm12u[i]==0) yccdiagacq_1d[i]==-1; //psb on
387 if (yccdiagacq_1u[i]==1 && yccipm12u[i]==1) yccdiagacq_1u[i]==1; //psb off
388 if (yccdiagacq_1d[i]==-1 && yccipm12d[i]==-1) yccipmerror[i]=-1;
389 else if (yccdiagacq_1u[i]==1 && yccipm12d[i]==0 && yccipm12u[i]==0) yccipmerror[i]=1;
390 else yccipmerror[i]=0; //psb alarm
391 }
392 if (k==15) {
393 yccdiagacq_11u[i]=0;
394 yccdiagacq_11d[i]=0;
395 }
396 }
397
398 //CC IPM
399 if (k==0 || k==1 ||k==2 || k==3 || k==4 || k==5 ){
400 Canvascc->cd(m+1);
401 Canvascc->cd(m+1)->SetGridx();
402 gPad->SetFillColor(10);
403 gPad->SetFrameBorderSize(0);
404 gPad->SetLineColor(1);
405 gPad->SetFrameBorderMode(0);
406
407
408 pt = new TPaveText (.01,.30,.10,.70);
409 oss.str("");
410 oss<<titolocc[k];
411 pt->AddText(oss.str().c_str());
412 pt->SetFillColor(10);
413 pt->SetBorderSize(0);
414 pt->Draw();
415
416
417 TGraph *ccrecordd = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1d);
418 ccrecordd->SetTitle("");
419 ccrecordd->SetFillColor(8);
420 ccrecordd->GetXaxis()->SetLabelSize(0);
421 ccrecordd->GetXaxis()->SetTickLength(0);
422 ccrecordd->GetYaxis()->SetLabelSize(0);
423 ccrecordd->GetYaxis()->SetTickLength(0);
424 ccrecordd->SetMaximum(1.3);
425 ccrecordd->SetMinimum(-1.3);
426 ccrecordd->GetXaxis()->SetAxisColor(0);
427 ccrecordd->Draw("AB");
428 if (k==0) leg1->AddEntry(ccrecordd,"ON","f");
429
430 TGraph *ccrecordu = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1u);
431 ccrecordu->SetTitle("");
432 ccrecordu->SetFillColor(17);
433 ccrecordu->GetXaxis()->SetLabelSize(0);
434 ccrecordu->GetXaxis()->SetTickLength(0);
435 ccrecordu->GetYaxis()->SetLabelSize(0);
436 ccrecordu->GetYaxis()->SetTickLength(0);
437 ccrecordu->GetXaxis()->SetAxisColor(0);
438 ccrecordu->SetMaximum(1.3);
439 ccrecordu->SetMinimum(-1.3);
440 ccrecordu->Draw("Bsame");
441 if (k==0) leg1->AddEntry(ccrecordu,"OFF","f");
442
443
444 if (k==1 || k==3 || k==5){
445 Canvascc->cd(m);
446 TGraph *ccrecorderrord = new TGraph(recordstot, xrecordobtcc_1, yccipmkk1d);
447 ccrecorderrord->SetTitle("");
448 ccrecorderrord->SetFillColor(2);
449 ccrecorderrord->GetXaxis()->SetLabelSize(0);
450 ccrecorderrord->GetXaxis()->SetTickLength(0);
451 ccrecorderrord->GetYaxis()->SetLabelSize(0);
452 ccrecorderrord->GetYaxis()->SetTickLength(0);
453 ccrecorderrord->SetMaximum(1.3);
454 ccrecorderrord->SetMinimum(-1.3);
455 ccrecorderrord->GetXaxis()->SetAxisColor(0);
456 ccrecorderrord->Draw("Bsame");
457
458 TGraph *ccrecorderroru = new TGraph(recordstot, xrecordobtcc_1, yccipmkk1u);
459 ccrecorderroru->SetTitle("");
460 ccrecorderroru->SetFillColor(2);
461 ccrecorderroru->GetXaxis()->SetLabelSize(0);
462 ccrecorderroru->GetXaxis()->SetTickLength(0);
463 ccrecorderroru->GetYaxis()->SetLabelSize(0);
464 ccrecorderroru->GetYaxis()->SetTickLength(0);
465 ccrecorderroru->SetMaximum(1.3);
466 ccrecorderroru->SetMinimum(-1.3);
467 ccrecorderroru->GetXaxis()->SetAxisColor(0);
468 ccrecorderroru->Draw("Bsame");
469
470 Canvascc->cd(m+1);
471 ccrecorderrord->Draw("Bsame");
472 ccrecorderroru->Draw("Bsame");
473 }
474
475
476 Double_t xmin;
477 Double_t xmax;
478 xmin=ccrecordu->GetXaxis()->GetXmin();
479 xmax=ccrecordu->GetXaxis()->GetXmax();
480 TGaxis *axis = new TGaxis (xmin, 0, xmax, 0, xmin, xmax, 510, "+-", 0);
481 axis->Draw("same");
482 /*TF1 *func1 = new TF1("func1", "0");
483 func1->SetRange(xmin,xrecordobtcc_1[recordstot-1]);
484 func1->SetLineColor(1);
485 func1->SetLineStyle(1);
486 func1->SetLineWidth(2);
487 func1->Draw("same");*/
488
489 m=m+1;
490 }
491
492 //CC idaq-khb-tof
493 if (k==6 || k==7 || k==8 || k==9 || k==14 || k==15){
494 Canvascc->cd(l+7);
495 gPad->SetFillColor(10);
496 gPad->SetFrameBorderSize(0);
497
498 pt = new TPaveText (.00,.30,.09,.70);
499 oss.str("");
500 oss<<titolocc[k];
501 pt->AddText(oss.str().c_str());
502 pt->SetFillColor(10);
503 pt->SetBorderSize(0);
504 pt->Draw();
505
506
507 TGraph *ccrecordd = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1d);
508 ccrecordd->SetTitle("");
509 if (k==14 || k==15) ccrecordd->SetFillColor(2);
510 else ccrecordd->SetFillColor(8);
511 ccrecordd->GetXaxis()->SetLabelSize(0);
512 ccrecordd->GetXaxis()->SetTickLength(0);
513 ccrecordd->GetYaxis()->SetLabelSize(0);
514 ccrecordd->GetYaxis()->SetTickLength(0);
515 ccrecordd->SetMaximum(1.3);
516 ccrecordd->SetMinimum(-1.3);
517 ccrecordd->GetXaxis()->SetAxisColor(0);
518 ccrecordd->Draw("AB");
519
520 TGraph *ccrecordu = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1u);
521 ccrecordu->SetTitle("");
522 if (k==14 || k==15) {
523 ccrecordu->SetFillColor(7);
524 if (k==14) leg1->AddEntry(ccrecordu,"ON-OFF-LATCHUP","f");
525 }
526 else ccrecordu->SetFillColor(17);
527 ccrecordu->GetXaxis()->SetAxisColor(0);
528 ccrecordu->GetXaxis()->SetLabelSize(0);
529 ccrecordu->GetXaxis()->SetTickLength(0);
530 ccrecordu->GetYaxis()->SetLabelSize(0);
531 ccrecordu->GetYaxis()->SetTickLength(0);
532 ccrecordu->SetMaximum(1.3);
533 ccrecordu->SetMinimum(-1.3);
534 ccrecordu->Draw("Bsame");
535
536 if (k==6 || k==7 || k==8 || k==9){
537 Canvascc->cd(l+7);
538 TGraph *ccrecorderroru = new TGraph(recordstot, xrecordobtcc_1, yccipmerror2);
539 ccrecorderroru->SetTitle("");
540 ccrecorderroru->SetFillColor(2);
541 ccrecorderroru->GetXaxis()->SetLabelSize(0);
542 ccrecorderroru->GetXaxis()->SetTickLength(0);
543 ccrecorderroru->GetYaxis()->SetLabelSize(0);
544 ccrecorderroru->GetYaxis()->SetTickLength(0);
545 ccrecorderroru->SetMaximum(1.3);
546 ccrecorderroru->SetMinimum(-1.3);
547 ccrecorderroru->GetXaxis()->SetAxisColor(0);
548 ccrecorderroru->Draw("Bsame");
549 }
550
551
552 if (k==7 || k==9){
553 Canvascc->cd(l+7-1);
554 TGraph *ccrecorderroru = new TGraph(recordstot, xrecordobtcc_1, yccipmerror);
555 ccrecorderroru->SetTitle("");
556 ccrecorderroru->SetFillColor(2);
557 ccrecorderroru->GetXaxis()->SetLabelSize(0);
558 ccrecorderroru->GetXaxis()->SetTickLength(0);
559 ccrecorderroru->GetYaxis()->SetLabelSize(0);
560 ccrecorderroru->GetYaxis()->SetTickLength(0);
561 ccrecorderroru->SetMaximum(1.3);
562 ccrecorderroru->SetMinimum(-1.3);
563 ccrecorderroru->GetXaxis()->SetAxisColor(0);
564 if (k==7) leg1->AddEntry(ccrecorderroru,"ALARM","f");
565 ccrecorderroru->Draw("Bsame");
566
567 Canvascc->cd(l+7);
568 ccrecorderroru->Draw("Bsame");
569 }
570
571
572 Double_t xmin;
573 Double_t xmax;
574 xmin=ccrecordu->GetXaxis()->GetXmin();
575 xmax=ccrecordu->GetXaxis()->GetXmax();
576 TGaxis *axis = new TGaxis (xmin, 0, xmax, 0, xmin, xmax, 510, "+-", 1.5);
577 axis->Draw("same");
578 /*TF1 *func1 = new TF1("func1", "0");
579 func1->SetRange(xmin,xrecordobtcc_1[recordstot-1]);
580 func1->SetLineColor(1);
581 func1->SetLineStyle(1);
582 func1->SetLineWidth(2);
583 func1->Draw("same");*/
584 l=l+1;
585
586 }
587
588 //CC vrl
589 if (k==11 || k==12 || k==13 ){
590 if (k==13) Canvascc->cd(13);
591 if (k==11) Canvascc->cd(14);
592 if (k==12) Canvascc->cd(15);
593 gPad->SetFillColor(10);
594 gPad->SetFrameBorderSize(0);
595
596 pt = new TPaveText (.01,.30,.09,.70);
597 oss.str("");
598 oss<<titolocc[k];
599 pt->AddText(oss.str().c_str());
600 pt->SetFillColor(10);
601 pt->SetBorderSize(0);
602 pt->Draw();
603
604 if (k==11 || k==12){
605 TGraph *ccrecordd = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1d);
606 ccrecordd->SetTitle("");
607 ccrecordd->SetFillColor(8);
608 ccrecordd->GetXaxis()->SetAxisColor(0);
609 ccrecordd->GetXaxis()->SetLabelSize(0);
610 ccrecordd->GetXaxis()->SetTickLength(0);
611 ccrecordd->GetYaxis()->SetLabelSize(0);
612 ccrecordd->GetYaxis()->SetTickLength(0);
613 ccrecordd->SetMaximum(1.3);
614 ccrecordd->SetMinimum(-1.3);
615 ccrecordd->Draw("AB");
616
617
618 TGraph *ccrecordu = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1u);
619 ccrecordu->SetTitle("");
620 ccrecordu->SetFillColor(17);
621 ccrecordu->GetXaxis()->SetAxisColor(0);
622 ccrecordu->GetXaxis()->SetLabelSize(0);
623 ccrecordu->GetXaxis()->SetTickLength(0);
624 ccrecordu->GetYaxis()->SetLabelSize(0);
625 ccrecordu->GetYaxis()->SetTickLength(0);
626 ccrecordu->SetMaximum(1.3);
627 ccrecordu->SetMinimum(-1.3);
628 ccrecordu->Draw("Bsame");
629
630 Double_t xmin;
631 Double_t xmax;
632 xmin=ccrecordu->GetXaxis()->GetXmin();
633 xmax=ccrecordu->GetXaxis()->GetXmax();
634 if (k==12){
635 TGaxis *axis = new TGaxis (xmin, -1, xmax, -1, xmin, xmax, 510, "", 0);
636 axis->SetLabelSize(0.24);
637 axis->SetLabelColor(1);
638 axis->SetTitle("OBT (ms)");
639 //axis->CenterTitle();
640 axis->SetTitleOffset(0.4);
641 axis->SetTitleSize(0.21);
642 axis->Draw();
643 TF1 *func1 = new TF1("func1", "0");
644 func1->SetRange(xmin,xmax);
645 func1->SetLineColor(1);
646 func1->SetLineStyle(1);
647 func1->SetLineWidth(1);
648 func1->Draw("same");
649 }
650 if (k==11){
651 TGaxis *axis = new TGaxis (xmin, 0, xmax, 0, xmin, xmax, 510, "+-", 0);
652 axis->SetLineWidth(1);
653 axis->SetTickSize(2);
654 axis->Draw("same");
655 }
656 }
657
658 if (k==13){
659 Canvascc->cd(13);
660
661 TGraph *ccrecordd = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1d);
662 ccrecordd->SetTitle("");
663 ccrecordd->SetFillColor(8);
664 ccrecordd->GetXaxis()->SetAxisColor(0);
665 ccrecordd->GetXaxis()->SetLabelSize(0);
666 ccrecordd->GetXaxis()->SetTickLength(0);
667 ccrecordd->GetYaxis()->SetLabelSize(0);
668 ccrecordd->GetYaxis()->SetTickLength(0);
669 ccrecordd->SetMaximum(1.3);
670 ccrecordd->SetMinimum(-1.3);
671 ccrecordd->Draw("AB");
672
673 TGraph *ccrecordu = new TGraph(recordstot, xrecordobtcc_1, yccdiagacq_1u);
674 ccrecordu->SetTitle("");
675 ccrecordu->SetFillColor(17);
676 ccrecordu->GetXaxis()->SetAxisColor(0);
677 ccrecordu->GetXaxis()->SetLabelSize(0);
678 ccrecordu->GetXaxis()->SetTickLength(0);
679 ccrecordu->GetYaxis()->SetLabelSize(0);
680 ccrecordu->GetYaxis()->SetTickLength(0);
681 ccrecordu->SetMaximum(1.3);
682 ccrecordu->SetMinimum(-1.3);
683 ccrecordu->Draw("Bsame");
684
685 TGraph *ccrecorderroru = new TGraph(recordstot, xrecordobtcc_1, yccipmerror);
686 ccrecorderroru->SetTitle("");
687 ccrecorderroru->SetFillColor(2);
688 ccrecorderroru->GetXaxis()->SetLabelSize(0);
689 ccrecorderroru->GetXaxis()->SetTickLength(0);
690 ccrecorderroru->GetYaxis()->SetLabelSize(0);
691 ccrecorderroru->GetYaxis()->SetTickLength(0);
692 ccrecorderroru->SetMaximum(1.3);
693 ccrecorderroru->SetMinimum(-1.3);
694 ccrecorderroru->GetXaxis()->SetAxisColor(0);
695 ccrecorderroru->Draw("Bsame");
696
697
698 Double_t xmin=ccrecordu->GetXaxis()->GetXmin();
699 Double_t xmax=ccrecordu->GetXaxis()->GetXmax();
700 TGaxis *axis = new TGaxis (xmin, 0, xmax, 0, xmin, xmax, 510, "+-", 0);
701 axis->SetLineWidth(1);
702 axis->SetTickSize(2);
703 axis->Draw("same");
704 }
705
706 }
707
708 }
709
710 Canvascc->cd();
711 leg1->Draw();
712 Canvascc->Update();
713
714 // TH Graph
715 Canvasthdea->cd();
716 //thermistors number=16
717 if (tr->GetBranch("Records.TM_TH_ANA[16]")){
718 for (Int_t k =0; k<16; k++){
719 for (Int_t i = 0; i < recordstot; i++){
720 ythana_1[i]= ythana[16*i+k];
721 xrecordobtth_1[i]= xrecordobtth[16*i+k];
722 }
723 Canvasthdea->cd(k+1);
724
725 TGraph *threcord = new TGraph(recordstot, xrecordobtth_1, ythana_1);
726 threcord->SetLineColor(kBlue);
727 threcord->SetMarkerColor(kBlue);
728 threcord->SetMarkerStyle(21);
729 threcord->SetMinimum(-10);
730 threcord->SetMaximum(60);
731 threcord->GetXaxis()->SetTitle("OBT");
732 threcord->GetXaxis()->CenterTitle();
733 threcord->GetYaxis()->SetTitle("Temperature value (°C)");
734 threcord->GetYaxis()->CenterTitle();
735 oss.str("");
736 oss << filename.Data() <<": " <<titoloth[k] ;
737 threcord->SetTitle(oss.str().c_str());
738
739 Double_t xmin=threcord->GetXaxis()->GetXmin();
740 Double_t xmax=threcord->GetXaxis()->GetXmax();
741 if (k==10 || k==11 ) {
742 TPaveText *pt = new TPaveText (.45,.75,.55,.82);
743 pt->AddText("OFF");
744 pt->SetBorderSize(1);
745 pt->Draw();
746 threcord->Draw("ACsame");
747 TF1 *func1 = new TF1("func1", "50");
748 func1->SetRange(xmin,xmax);
749 func1->SetLineColor(2);
750 func1->SetLineStyle(1);
751 func1->SetLineWidth(2);
752 func1->Draw("same");
753 pt->Draw();
754 }else {
755 TPaveText *pt = new TPaveText (.45,.7,.55,.77);
756 pt->AddText("OFF");
757 pt->SetBorderSize(1);
758 pt->Draw();
759 threcord->Draw("ACsame");
760 TF1 *func1 = new TF1("func1", "45");
761 func1->SetRange(xmin,xmax);
762 func1->SetLineColor(2);
763 func1->SetLineStyle(1);
764 func1->SetLineWidth(2);
765 func1->Draw("same");
766 pt->Draw();
767 }
768
769
770
771 }
772 }
773
774 // DEA Graph
775 Canvasvoltdea->cd();
776 for (Int_t k =0; k<6; k++){
777 for (Int_t i = 0; i < recordstot; i++){
778 ydea_1[i]= ydea[6*i + k];
779 xrecordobtdea_1[i]= xrecordobtdea[6*i+k];
780 }
781 Canvasvoltdea->cd(k+1);
782
783 TPaveText *pt = new TPaveText (.84,.13,.92,.19);
784 pt->AddText("OFF");
785 pt->SetBorderSize(1);
786 pt->Draw();
787 TPaveText *pt1 = new TPaveText (.84,.67,.92,.73);
788 pt1->AddText("ON");
789 pt1->SetBorderSize(1);
790 pt1->Draw();
791
792 TGraph *dearecord = new TGraph(recordstot, xrecordobtdea_1, ydea_1);
793 dearecord->SetLineColor(kBlue);
794 dearecord->SetLineWidth(1);
795 dearecord->SetMarkerStyle(21);
796 dearecord->SetMarkerSize(0.5);
797 dearecord->SetMarkerColor(kBlue);
798 dearecord->SetMinimum(0.0);
799 dearecord->SetMaximum(5.0);
800 dearecord->GetXaxis()->SetTitle("OBT");
801 dearecord->GetXaxis()->CenterTitle();
802 dearecord->GetYaxis()->SetTitle("Voltage value (V)");
803 dearecord->GetYaxis()->CenterTitle();
804 oss.str("");
805 oss << filename.Data()<<": IPM "<<k+1<<" Voltage";
806 dearecord->SetTitle(oss.str().c_str());
807 dearecord->Draw("ACPLsame");
808
809 Double_t xmin=dearecord->GetXaxis()->GetXmin();
810 Double_t xmax=dearecord->GetXaxis()->GetXmax();
811 TF1 *func1 = new TF1("func1", "0.65");
812 func1->SetRange(xmin, xmax);
813 func1->SetLineColor(2);
814 func1->SetLineStyle(1);
815 func1->SetLineWidth(2);
816 func1->Draw("Csame");
817
818 TF1 *func2 = new TF1("func2", "3.15");
819 func2->SetRange(xmin, xmax);
820 func2->SetLineColor(2);
821 func2->SetLineStyle(1);
822 func2->SetLineWidth(2);
823 func2->Draw("Csame");
824
825 TF1 *func3 = new TF1("func3", "4.25");
826 func3->SetRange(xmin, xmax);
827 func3->SetLineColor(2);
828 func3->SetLineStyle(1);
829 func3->SetLineWidth(2);
830 func3->Draw("Csame");
831
832
833 pt1->Draw();
834 pt->Draw();
835 }
836
837
838 stringstream oss1, oss2, oss3, oss4;
839 oss.str("");
840 oss1.str("");
841 oss2.str("");
842 oss << outDir.Data() << filename.Data() << "_Tmtc_cc_"<<interval+1<<"." << format;
843 oss1 << outDir.Data() << filename.Data() << "_Tmtc_th_dea_"<<interval+1<<"." << format;
844 oss2 << outDir.Data() << filename.Data() << "_Tmtc_volt_dea_"<<interval+1<<"." << format;
845 Canvascc->SaveAs(oss.str().c_str());
846 Canvasthdea->SaveAs(oss1.str().c_str());
847 Canvasvoltdea->SaveAs(oss2.str().c_str()); //// fine del lavoro sul sottogruppo
848
849 Canvascc->Clear();
850 Canvasthdea->Clear();
851 Canvasvoltdea->Clear();
852 //gROOT->GetListOfCanvases()->Delete();
853 //gROOT->Reset();
854
855 }
856
857
858 file->Close();
859 }
860
861
862 //////////////////////////////////////////////////////////////////////////////////
863 ///////////////////////// MAIN ///////////////////////////////////////////////
864 //////////////////////////////////////////////////////////////////////////////////
865
866
867 int main(int argc, char* argv[]){
868 TString path;
869 TString outDir = "./";
870 TString format = "jpg";
871
872 if (argc < 2){
873 printf("You have to insert at least the file to analyze \n");
874 printf("Try '--help' for more information. \n");
875 exit(1);
876 }
877
878 if (!strcmp(argv[1], "--help")){
879 printf( "Usage: TmtcTemperature FILE [OPTION] \n");
880 printf( "\t --help Print this help and exit \n");
881 printf( "\t -outDir[path] Path where to put the output [default ./] \n");
882 printf( "\t -format[jpg|ps|gif] Format for output files [default 'jpg'] \n");
883 exit(1);
884 }
885
886 path=argv[1];
887
888 for (int i = 2; i < argc; i++){
889
890
891 if (!strcmp(argv[i], "-outDir")){
892 if (++i >= argc){
893 printf( "-outDir needs arguments. \n");
894 printf( "Try '--help' for more information. \n");
895 exit(1);
896 }
897 else{
898 outDir = argv[i];
899 continue;
900 }
901 }
902
903 if (!strcmp(argv[i], "-format")){
904 if (++i >= argc){
905 printf( "-format needs arguments. \n");
906 printf( "Try '--help' for more information. \n");
907 exit(1);
908 }
909 else{
910 format = argv[i];
911 continue;
912 }
913 }
914
915
916 }
917
918 TmtcTemperature(argv[1], outDir, format);
919
920 }

  ViewVC Help
Powered by ViewVC 1.1.23