18 |
* Fixed bugs: for a large namber of events is not possible to initialize vectors, so all graphs have been converted in histograms |
* 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 |
* Known bugs: it is no possible to choise the figure format |
21 |
|
* |
22 |
|
* Version 1.2 - August 2006 |
23 |
|
* Fixed bugs: is possible to choise figure format; all calibration are drown |
24 |
**************/ |
**************/ |
25 |
|
|
26 |
#include <fstream> |
#include <fstream> |
177 |
TH1F *calibS4_1 =new TH1F("calibS4_1", "calibS4_1", channels, 0, channels); |
TH1F *calibS4_1 =new TH1F("calibS4_1", "calibS4_1", channels, 0, channels); |
178 |
TH1F *calibS4_2 =new TH1F("calibS4_2", "calibS4_2", channels, 0, channels); |
TH1F *calibS4_2 =new TH1F("calibS4_2", "calibS4_2", channels, 0, channels); |
179 |
TH1F *calibS4_4 =new TH1F("calibS4_4", "calibS4_4", channels, 0, channels); |
TH1F *calibS4_4 =new TH1F("calibS4_4", "calibS4_4", channels, 0, channels); |
180 |
ULong_t lastime, firstime; |
ULong_t lastime, firstime, obt1; |
181 |
double obmin=0.; |
double obmin=0.; |
182 |
double obmax=0.; |
double obmax=0.; |
183 |
|
double limitdown=0; |
184 |
|
double limitup=0; |
185 |
const Int_t size = nevents; |
const Int_t size = nevents; |
186 |
|
cout<<"size "<<size <<"\n"; |
187 |
|
|
188 |
headBr->GetEntry(0); |
headBr->GetEntry(0); |
189 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
190 |
firstime = ph->GetOrbitalTime(); |
firstime = ph->GetOrbitalTime(); |
193 |
lastime = ph->GetOrbitalTime(); |
lastime = ph->GetOrbitalTime(); |
194 |
obmin=firstime; |
obmin=firstime; |
195 |
obmax=lastime; |
obmax=lastime; |
196 |
|
if(nevents < 2){ |
197 |
|
for(Int_t kk = 0; kk<nevents; kk++){ |
198 |
|
headBr->GetEntry(kk); |
199 |
|
ph = eh->GetPscuHeader(); |
200 |
|
if(obmin >= ph->GetOrbitalTime())obmin=ph->GetOrbitalTime(); |
201 |
|
if(obmax <= ph->GetOrbitalTime())obmax=ph->GetOrbitalTime(); |
202 |
|
} |
203 |
|
limitdown= obmin - 1000000; |
204 |
|
limitup= obmax + 1000000; |
205 |
|
}else{ |
206 |
|
for(Int_t kk = 0; kk<nevents; kk++){ |
207 |
|
headBr->GetEntry(kk); |
208 |
|
ph = eh->GetPscuHeader(); |
209 |
|
cout<<"OrbitalTime()"<<ph->GetOrbitalTime()<<"\n"; |
210 |
|
if(obmin >= ph->GetOrbitalTime())obmin=ph->GetOrbitalTime(); |
211 |
|
if(obmax <= ph->GetOrbitalTime())obmax=ph->GetOrbitalTime(); |
212 |
|
} |
213 |
|
limitdown=obmin; |
214 |
|
limitup=obmax; |
215 |
|
} |
216 |
stringstream oss; |
stringstream oss; |
217 |
oss.str(""); |
oss.str(""); |
218 |
oss << "S4_Calibration_QL: "<< filename.Data(); |
oss << "S4_Calibration_QL: "<< filename.Data(); |
219 |
TH1F *cal1 =new TH1F("calibS4_1", oss.str().c_str(), size, obmin, obmax); |
TH1F *cal1 =new TH1F("calibS4_1", oss.str().c_str(), size, obmin-1000000, obmax+ 1000000); |
220 |
TH1F *cal2 =new TH1F("calibS4_2", oss.str().c_str(), size, obmin, obmax); |
TH1F *cal2 =new TH1F("calibS4_2", oss.str().c_str(), size, obmin-1000000, obmax+ 1000000); |
221 |
TH1F *cal4 =new TH1F("calibS4_4", oss.str().c_str(), size, obmin, obmax); |
TH1F *cal4 =new TH1F("calibS4_4", oss.str().c_str(), size, obmin-1000000, obmax+ 1000000); |
222 |
|
|
223 |
for(Int_t k = 0; k<nevents; k++){ |
for(Int_t k = 0; k<nevents; k++){ |
224 |
headBr->GetEntry(k); |
headBr->GetEntry(k); |
245 |
} |
} |
246 |
} |
} |
247 |
|
|
248 |
obt=ph->GetOrbitalTime(); |
//obt=ph->GetOrbitalTime(); |
249 |
calib_1=calibS4_1->GetMean(1); |
calib_1=calibS4_1->GetMean(1); |
250 |
//calib_1_RMS=calibS4_1->GetRMS(1); |
//calib_1_RMS=calibS4_1->GetRMS(1); |
251 |
calib_2=calibS4_2->GetMean(1); |
calib_2=calibS4_2->GetMean(1); |
252 |
//calib_2_RMS=calibS4_2->GetRMS(1); |
//calib_2_RMS=calibS4_2->GetRMS(1); |
253 |
calib_4=calibS4_4->GetMean(1); |
calib_4=calibS4_4->GetMean(1); |
254 |
//calib_4_RMS=calibS4_4->GetRMS(1); |
//calib_4_RMS=calibS4_4->GetRMS(1); |
255 |
cal1->Fill(obt,calib_1); |
cal1->Fill(ph->GetOrbitalTime(),calib_1); |
256 |
cal2->Fill(obt,calib_2); |
cal2->Fill(ph->GetOrbitalTime(),calib_2); |
257 |
cal4->Fill(obt,calib_4); |
cal4->Fill(ph->GetOrbitalTime(),calib_4); |
258 |
|
cout<<"k"<<k<<"\n"; |
259 |
//cout<<calib_1_RMS<<"\n"; |
//cout<<calib_1_RMS<<"\n"; |
260 |
//cout<<calib_2_RMS<<"\n"; |
//cout<<calib_2_RMS<<"\n"; |
261 |
//cout<<calib_4_RMS<<"\n"; |
//cout<<calib_4_RMS<<"\n"; |
305 |
cal4->Draw("9psame"); |
cal4->Draw("9psame"); |
306 |
if (IPM1status==0 && IPM2status==1){ ////hot configuration |
if (IPM1status==0 && IPM2status==1){ ////hot configuration |
307 |
TF1 *func1 = new TF1("func1", "1560"); ///valore di riferimento 1300 |
TF1 *func1 = new TF1("func1", "1560"); ///valore di riferimento 1300 |
308 |
func1->SetRange(obmin, obmax); |
//func1->SetRange(obmin, obmax); |
309 |
|
func1->SetRange(limitdown, limitup); |
310 |
func1->SetLineColor(4); |
func1->SetLineColor(4); |
311 |
func1->SetLineStyle(4); |
func1->SetLineStyle(1); |
312 |
func1->SetLineWidth(4); |
func1->SetLineWidth(3); |
313 |
func1->Draw("same"); |
func1->Draw("same"); |
314 |
TF1 *func2 = new TF1("func2", "1040"); ///valore di riferimento 1300 |
TF1 *func2 = new TF1("func2", "1040"); ///valore di riferimento 1300 |
315 |
func2->SetRange(obmin, obmax); |
//func2->SetRange(obmin, obmax); |
316 |
|
func2->SetRange(limitdown, limitup); |
317 |
func2->SetLineColor(4); |
func2->SetLineColor(4); |
318 |
func2->SetLineStyle(4); |
func2->SetLineStyle(1); |
319 |
func2->SetLineWidth(4); |
func2->SetLineWidth(3); |
320 |
func2->Draw("same"); |
func2->Draw("same"); |
321 |
TF1 *func3 = new TF1("func3", "109"); ///valore di riferimento 95 |
TF1 *func3 = new TF1("func3", "109"); ///valore di riferimento 95 |
322 |
func3->SetRange(obmin, obmax); |
//func3->SetRange(obmin, obmax); |
323 |
|
func3->SetRange(limitdown, limitup); |
324 |
func3->SetLineColor(6); |
func3->SetLineColor(6); |
325 |
func3->SetLineStyle(4); |
func3->SetLineStyle(1); |
326 |
func3->SetLineWidth(4); |
func3->SetLineWidth(3); |
327 |
func3->Draw("same"); |
func3->Draw("same"); |
328 |
TF1 *func4 = new TF1("func4", "71"); ///valore di riferimento 95 |
TF1 *func4 = new TF1("func4", "71"); ///valore di riferimento 95 |
329 |
func4->SetRange(obmin, obmax); |
//func4->SetRange(obmin, obmax); |
330 |
|
func4->SetRange(limitdown, limitup); |
331 |
func4->SetLineColor(6); |
func4->SetLineColor(6); |
332 |
func4->SetLineStyle(4); |
func4->SetLineStyle(1); |
333 |
func4->SetLineWidth(4); |
func4->SetLineWidth(3); |
334 |
func4->Draw("same"); |
func4->Draw("same"); |
335 |
TF1 *func5 = new TF1("func5", "38.4"); //valore di riferimento 32 |
TF1 *func5 = new TF1("func5", "38.4"); //valore di riferimento 32 |
336 |
func5->SetRange(obmin, obmax); |
//func5->SetRange(obmin, obmax); |
337 |
func5->SetLineStyle(4); |
func5->SetRange(limitdown, limitup); |
338 |
|
func5->SetLineStyle(1); |
339 |
func5->SetLineColor(3); |
func5->SetLineColor(3); |
340 |
func5->SetLineWidth(4); |
func5->SetLineWidth(3); |
341 |
func5->Draw("same"); |
func5->Draw("same"); |
342 |
TF1 *func6 = new TF1("func6", "25.6"); //valore di riferimento 32 |
TF1 *func6 = new TF1("func6", "25.6"); //valore di riferimento 32 |
343 |
func6->SetRange(obmin, obmax); |
//func6->SetRange(obmin, obmax); |
344 |
func6->SetLineStyle(4); |
func6->SetRange(limitdown, limitup); |
345 |
|
func6->SetLineStyle(1); |
346 |
func6->SetLineColor(3); |
func6->SetLineColor(3); |
347 |
func6->SetLineWidth(4); |
func6->SetLineWidth(3); |
348 |
func6->Draw("same"); |
func6->Draw("same"); |
349 |
} |
} |
350 |
|
|
351 |
if (IPM1status==1 && IPM2status==0){ ////cold configuration |
if (IPM1status==1 && IPM2status==0){ ////cold configuration |
352 |
TF1 *func1 = new TF1("func1", "2400"); |
TF1 *func1 = new TF1("func1", "2400"); |
353 |
func1->SetRange(obmin, obmax); |
//func1->SetRange(obmin, obmax); |
354 |
|
func1->SetRange(limitdown, limitup); |
355 |
func1->SetLineColor(4); |
func1->SetLineColor(4); |
356 |
func1->SetLineStyle(4); |
func1->SetLineStyle(1); |
357 |
func1->SetLineWidth(4); |
func1->SetLineWidth(3); |
358 |
func1->Draw("same"); |
func1->Draw("same"); |
359 |
TF1 *func2 = new TF1("func2", "1600"); ///valore di riferimento 2000 |
TF1 *func2 = new TF1("func2", "1600"); ///valore di riferimento 2000 |
360 |
func2->SetRange(obmin, obmax); |
//func2->SetRange(obmin, obmax); |
361 |
|
func2->SetRange(limitdown, limitup); |
362 |
func2->SetLineColor(4); |
func2->SetLineColor(4); |
363 |
func2->SetLineStyle(4); |
func2->SetLineStyle(1); |
364 |
func2->SetLineWidth(4); |
func2->SetLineWidth(3); |
365 |
func2->Draw("same"); |
func2->Draw("same"); |
366 |
TF1 *func3 = new TF1("func3", "180"); |
TF1 *func3 = new TF1("func3", "180"); |
367 |
func3->SetRange(obmin, obmax); |
//func3->SetRange(obmin, obmax); |
368 |
|
func3->SetRange(limitdown, limitup); |
369 |
func3->SetLineColor(6); |
func3->SetLineColor(6); |
370 |
func3->SetLineStyle(4); |
func3->SetLineStyle(1); |
371 |
func3->SetLineWidth(4); |
func3->SetLineWidth(3); |
372 |
func3->Draw("same"); |
func3->Draw("same"); |
373 |
TF1 *func4 = new TF1("func4", "120"); ///valore di riferimento 150 |
TF1 *func4 = new TF1("func4", "120"); ///valore di riferimento 150 |
374 |
func4->SetRange(obmin, obmax); |
//func4->SetRange(obmin, obmax); |
375 |
|
func4->SetRange(limitdown, limitup); |
376 |
func4->SetLineColor(6); |
func4->SetLineColor(6); |
377 |
func4->SetLineStyle(4); |
func4->SetLineStyle(1); |
378 |
func4->SetLineWidth(4); |
func4->SetLineWidth(3); |
379 |
func4->Draw("same"); |
func4->Draw("same"); |
380 |
TF1 *func5 = new TF1("func5", "38.4"); |
TF1 *func5 = new TF1("func5", "38.4"); |
381 |
func5->SetRange(obmin, obmax); |
//func5->SetRange(obmin, obmax); |
382 |
func5->SetLineStyle(4); |
func5->SetRange(limitdown, limitup); |
383 |
|
func5->SetLineStyle(1); |
384 |
func5->SetLineColor(3); |
func5->SetLineColor(3); |
385 |
func5->SetLineWidth(4); |
func5->SetLineWidth(3); |
386 |
func5->Draw("same"); |
func5->Draw("same"); |
387 |
TF1 *func6 = new TF1("func6", "25.6"); //valore di riferimento 32 |
TF1 *func6 = new TF1("func6", "25.6"); //valore di riferimento 32 |
388 |
func6->SetRange(obmin, obmax); |
//func6->SetRange(obmin, obmax); |
389 |
func6->SetLineStyle(4); |
func6->SetRange(limitdown, limitup); |
390 |
|
func6->SetLineStyle(1); |
391 |
func6->SetLineColor(3); |
func6->SetLineColor(3); |
392 |
func6->SetLineWidth(4); |
func6->SetLineWidth(3); |
393 |
func6->Draw("same"); |
func6->Draw("same"); |
394 |
} |
} |
395 |
|
|
452 |
} |
} |
453 |
} |
} |
454 |
|
|
455 |
/* if (!strcmp(argv[i], "-format")){ |
if (!strcmp(argv[i], "-format")){ |
456 |
if (++i >= argc){ |
if (++i >= argc){ |
457 |
printf( "-format needs arguments. \n"); |
printf( "-format needs arguments. \n"); |
458 |
printf( "Try '--help' for more information. \n"); |
printf( "Try '--help' for more information. \n"); |
462 |
format = argv[i]; |
format = argv[i]; |
463 |
continue; |
continue; |
464 |
} |
} |
465 |
}*/ |
} |
466 |
|
|
467 |
|
|
468 |
} |
} |