32#include "GaudiKernel/AlgFactory.h"
33#include "GaudiKernel/DataObject.h"
34#include "GaudiKernel/IEventProcessor.h"
36#include "GaudiKernel/Incident.h"
37#include "GaudiKernel/IIncidentSvc.h"
38#include "GaudiKernel/Memory.h"
42#include "GaudiKernel/ISvcLocator.h"
43#include "GaudiKernel/IDataProviderSvc.h"
44#include "GaudiKernel/Bootstrap.h"
45#include "GaudiKernel/RegistryEntry.h"
46#include "GaudiKernel/MsgStream.h"
75TCanvas *
c1 =
new TCanvas(
"c1",
"c1",800,600);
83inline double fitfunctionFD(
double *x,
double *par){
return (par[0]+ par[1]/(1+TMath::Exp(-(
x[0]-par[2])/par[3])));}
84int east[11]={2,3,8,9,10,11,17,18,19,20,21};
85int sheet1[32]={23,24,25,26,27,28,29,37,38,39,40,41,42,43,53,54,55,56,57,58,59,60,61,71,72,73,74,75,76,77,78,79};
88 Algorithm(name,pSvcLocator){
89 declareProperty(
"InputFileData" , InputFileData =
"ciao.root");
90 declareProperty(
"InputFileMapping" , InputFileMapping =
"mapping.txt");
91 declareProperty(
"InputFileTiger" , InputFileTiger =
"tiger.txt");
92 declareProperty(
"InputFileHvSetting", InputFileHvSetting=
"hv_setting.txt");
93 declareProperty(
"PrintCanvas" , PrintCanvas =
false);
94 declareProperty(
"OutputPdf" , OutputPdf =
"Output.pdf");
95 declareProperty(
"OutputRoot" , OutputRoot =
"Output.root");
96 declareProperty(
"DisableMeasures" , DisableMeasures =
false);
97 declareProperty(
"DisableLowEntries" , DisableLowEntries =
false);
98 declareProperty(
"MinEntries" , MinEntries = 100);
99 declareProperty(
"Debug" , Debug =
false);
105 MsgStream log(
msgSvc(), name());
106 bool print_here = (
false || Debug);
107 log << MSG::INFO <<
"CgemLUTWriter initialize()" << endreq;
112 std::ifstream inStream(
inFile_name, std::ios::binary);
115 std::cerr <<
"File " <<
inFile_name <<
" not found" << std::endl;
116 return StatusCode::FAILURE;
119 TTree *tree1 = (TTree*)file1->Get(
"t1");
120 bool b1(0),b2(0),b3(0);
123 if(b2) b3=tree1->IsFolder();
125 std::cerr <<
"ERROR in file "<<
inFile_name<<
" "<<b1<<
" "<<b2<<
" "<<b3<<endl;
126 return StatusCode::FAILURE;
129 mapping_file.open(InputFileMapping.c_str());
130 if(!mapping_file.is_open()){
131 std::cerr <<
"File " << InputFileMapping<<
" not found"<<endl;
132 return StatusCode::FAILURE;
134 int nlines_mapping=0;
136 while(getline(mapping_file,line_mapping)) nlines_mapping++;
137 if(print_here)cout<<
"The number of lines in "<<InputFileMapping<<
" is: "<<nlines_mapping<<endl;
138 mapping_file.clear();
139 mapping_file.seekg (0, ios_base::beg);
140 getline(mapping_file,line_mapping);
142 tiger_file.open(InputFileTiger.c_str());
143 if(!tiger_file.is_open()){
144 std::cerr <<
"File " << InputFileTiger<<
" not found"<<endl;
145 return StatusCode::FAILURE;
149 while(getline(tiger_file,line_tiger)) nlines_tiger++;
150 if(print_here)cout<<
"The number of lines in "<<InputFileTiger<<
" is: "<<nlines_tiger<<endl;
152 tiger_file.seekg (0, ios_base::beg);
153 getline(tiger_file,line_tiger);
155 if(nlines_tiger!=10241 && nlines_mapping!=10241){
156 std::cerr <<
" The number of lines in the files "<<InputFileMapping<<
" and "<<InputFileTiger<<
" is not correct"<<endl;
157 return StatusCode::FAILURE;
160 hv_file.open(InputFileHvSetting.c_str());
161 if(!hv_file.is_open()){
162 std::cerr <<
"File " << InputFileHvSetting<<
" not found"<<endl;
163 return StatusCode::FAILURE;
167 while(getline(hv_file,line_hv)) nlines_hv++;
168 if(print_here)cout<<
"The number of lines in "<<InputFileHvSetting<<
" is: "<<nlines_hv<<endl;
170 hv_file.seekg (0, ios_base::beg);
171 getline(hv_file,line_hv);
173 std::cerr <<
" The number of lines in the file "<<InputFileHvSetting<<
" is not correct"<<endl;
174 return StatusCode::FAILURE;
178 if(
ch.GetEntries()==0){
179 std::cerr <<
"No entries in the event file "<<
inFile_name<<endl;
180 return StatusCode::FAILURE;
185 canvas =
new TCanvas(
"canvas",
"canvas",800,600);
187 TString OutputPdf1 = OutputPdf+
"[";
188 canvas->Print(OutputPdf1);
199 return StatusCode::SUCCESS;
203 MsgStream log(
msgSvc(), name());
204 log << MSG::INFO <<
"CgemLUTWriter execute()" << endreq;
206 while(mapping_file.peek()!=EOF){
216 if(PrintCanvas) canvas->Print((TString)OutputPdf);
217 if(is_failing)
return StatusCode::FAILURE;
218 if(FEB_i==79 && chip_i==1 && ch_i==63)
return StatusCode::SUCCESS;
220 return StatusCode::SUCCESS;
224 MsgStream log(
msgSvc(), name());
225 log << MSG::INFO <<
"CgemLUTWriter finalize()" << endreq;
227 TString OutputPdf2 = OutputPdf+
"]";
228 canvas->Print(OutputPdf2);
233 return StatusCode::SUCCESS;
236void CgemLUTWriter::Measure_Noise(){
237 bool print_here = (
false || Debug);
238 if(print_here) cout<<
" --- Start of Measure_Noise ---"<<endl;
239 if(DisableMeasures || (DisableLowEntries &&
ch.GetEntries(Get_Cut(4))<MinEntries)){
240 LUT_digi_coll[FEB_i][chip_i][ch_i].noise_rate=0;
241 LUT_digi_coll[FEB_i][chip_i][ch_i].noise_charge=0;
247 TString name_noise_rate = Form(
"h_noise_rate_%i_%i_%i",FEB_i,chip_i,ch_i);
248 TString command_noise_rate =
"GemHit_time>>"+name_noise_rate;
249 TString cut_noise_rate = Get_Cut(4);
251 if(print_here)cout<<command_noise_rate<<endl;
252 if(print_here)cout<<cut_noise_rate<<endl;
253 ch.Draw(command_noise_rate,cut_noise_rate,DrawOption);
254 double nhitsofnoise = h_noise_rate->GetEntries();
257 if(print_here)cout<<
ch.GetEntries()<<endl;
258 if(print_here)cout<<nhitsofnoise<<
" "<<
time_window_noise<<
" "<<
ch.GetEntries()<<
" "<<rate<<endl;
262 TString name_noise_charge = Form(
"h_noise_charge_%i_%i_%i",FEB_i,chip_i,ch_i);
263 TString command_noise_charge =
"GemHit_q>>"+name_noise_charge;
264 TString cut_noise_charge = Get_Cut(4);
265 TH1D *h_noise_charge =
new TH1D(name_noise_charge,name_noise_charge,n_bin_charge,
charge_cut,
charge_max);
266 if(print_here)cout<<command_noise_charge<<endl;
267 if(print_here)cout<<cut_noise_charge<<endl;
268 ch.Draw(command_noise_charge,cut_noise_charge,DrawOption);
269 double noise_charge = h_noise_charge->GetMean();
271 LUT_digi_coll[FEB_i][chip_i][ch_i].noise_rate=rate;
272 LUT_digi_coll[FEB_i][chip_i][ch_i].noise_charge=noise_charge;
274 cout<<
" --- End of Measure_Noise ---"<<endl;
279void CgemLUTWriter::Measure_Threshold(){
280 bool print_here = (
false || Debug);
281 if(DisableMeasures || (DisableLowEntries &&
ch.GetEntries(Get_Cut(1))<MinEntries)){
282 LUT_digi_coll[FEB_i][chip_i][ch_i].thr_effective = 0;
283 LUT_digi_coll[FEB_i][chip_i][ch_i].thr_width = 0;
286 if(print_here)cout<<
" --- Start of Measure_Threshold ---"<<endl;
288 int min_charge_hist=0;
289 int max_charge_hist=30;
290 double charge_resolution = 1;
291 int n_bin = (max_charge_hist-min_charge_hist)/charge_resolution;
292 TString h_name=Form(
"h_sginal_charge_thr_fit_%i_%i_%i",FEB_i,chip_i,ch_i);
293 TH1D *h_charge =
new TH1D(h_name,h_name,n_bin,min_charge_hist,max_charge_hist);
294 if(print_here) cout<<
"Histo: "<<n_bin<<
" "<<min_charge_hist<<
" "<<max_charge_hist<<endl;
295 TF1 *f_thr =
new TF1(
"f_thr",
"[0]/(1+exp(-(x-[1])/[2]))",-5,30);
296 TString command_thr =
"GemHit_q>>"+h_name;
297 TString cut_thr = Get_Cut(1);
298 if(print_here)cout<<command_thr<<endl;
299 if(print_here)cout<<cut_thr<<endl;
300 ch.Draw(command_thr,cut_thr,DrawOption);
301 double threshold = 0;
303 if(h_charge->GetEntries()){
304 f_thr->SetParameters(h_charge->GetMaximum(),0.5*h_charge->GetMaximumBin()*charge_resolution,0.2);
305 f_thr->FixParameter(0,h_charge->GetMaximum());
306 f_thr->SetParLimits(1,0,h_charge->GetMaximumBin()*charge_resolution+1);
307 f_thr->SetParLimits(2,0,5);
309 cout<<0<<
" "<<0<<
" "<<1.5*h_charge->GetMaximum()<<endl;
310 cout<<1<<
" "<<0<<
" "<<h_charge->GetMaximumBin()*charge_resolution<<endl;
311 cout<<2<<
" "<<0<<
" "<<2<<endl;
312 cout<<h_charge->GetMaximumBin()<<
" "<<h_charge->GetMaximumBin()*charge_resolution<<endl;
313 for(
int i=0;i<n_bin;i++)cout<<h_charge->GetBinContent(i+1)<<
" ";
317 h_charge->Fit(
"f_thr",
"W",
"",-5,h_charge->GetMaximumBin()*charge_resolution+1*charge_resolution);
320 h_charge->Fit(
"f_thr",
"WQ",
"",-5,h_charge->GetMaximumBin()*charge_resolution+1*charge_resolution);
322 threshold=f_thr->GetParameter(1);
323 thr_wid =f_thr->GetParameter(2);
326 LUT_digi_coll[FEB_i][chip_i][ch_i].thr_effective = threshold;
327 LUT_digi_coll[FEB_i][chip_i][ch_i].thr_width = thr_wid;
329 cout<<
" --- End of Measure_Threshold ---"<<endl;
335void CgemLUTWriter::Measure_Signal(){
336 bool print_here = (
false || Debug);
337 if(DisableMeasures || (DisableLowEntries &&
ch.GetEntries(Get_Cut(5))<MinEntries)){
338 LUT_digi_coll[FEB_i][chip_i][ch_i].signal_rate = 0;
339 LUT_digi_coll[FEB_i][chip_i][ch_i].signal_charge_mean = 0;
340 LUT_digi_coll[FEB_i][chip_i][ch_i].signal_charge_saturation = 0;
341 LUT_digi_coll[FEB_i][chip_i][ch_i].signal_saturation_ratio = 0;
344 if(print_here)cout<<
" --- Start of Measure_Signal ---"<<endl;
347 int min_charge_hist = -5;
348 int max_charge_hist = 70;
349 int charge_resolution = 2;
350 int n_bin = (max_charge_hist-min_charge_hist)/charge_resolution;
351 TString h_name2=Form(
"h_signal_charge_%i_%i_%i",FEB_i,chip_i,ch_i);
352 TH1D *h_charge2 =
new TH1D(h_name2,h_name2,n_bin,min_charge_hist,max_charge_hist);
353 TString command_signal_charge =
"GemHit_q>>"+h_name2;
354 TString cut_signal_charge = Get_Cut(5);
355 if(print_here)cout<<
"Histo2: "<<n_bin<<
" "<<min_charge_hist<<
" "<<max_charge_hist<<endl;
356 if(print_here)cout<<command_signal_charge<<endl;
357 if(print_here)cout<<cut_signal_charge<<endl;
358 ch.Draw(command_signal_charge,cut_signal_charge,DrawOption);
359 double mean_charge = 0;
360 double max_charge = 0;
361 double saturation_bin_content=0;
362 double maximum_bin_content=-1;
363 if(h_charge2->GetEntries()){
364 mean_charge=h_charge2->GetMean();
365 for(
int i=n_bin;i>1;i--){
366 if(h_charge2->GetBinContent(i)>0) {
367 max_charge = h_charge2->GetBinCenter(i);
368 saturation_bin_content=h_charge2->GetBinContent(i);
369 for(
int j=i-1;j>1;j--){
370 if(h_charge2->GetBinContent(j)>maximum_bin_content) maximum_bin_content=h_charge2->GetBinContent(j);
376 double rate_sat_max = 0;
377 if(maximum_bin_content) rate_sat_max = saturation_bin_content/maximum_bin_content;
380 TString name_rate = Form(
"h_signal_rate_%i_%i_%i",FEB_i,chip_i,ch_i);
383 TString command_signal_rate =
"GemHit_time>>"+name_rate;
384 TString cut_signal_rate = Get_Cut(5);
386 if(print_here)cout<<command_signal_rate<<endl;
387 if(print_here)cout<<cut_signal_rate<<endl;
388 ch.Draw(command_signal_rate,cut_signal_rate,DrawOption);
389 double nhitsofsignal = h_rate->GetEntries();
392 if(print_here)cout<<
"Sig Rate: "<<sig_rate<<endl;
393 cout<<
"Preparing LUT for FEB: "<<FEB_i<<
" \t chip: "<<chip_i<<
" \t channel: "<<ch_i<<endl;
394 if(print_here) cout<<sig_rate<<
" "<<mean_charge<<
" "<<max_charge<<
" "<<rate_sat_max<<endl;
396 LUT_digi_coll[FEB_i][chip_i][ch_i].signal_rate = sig_rate;
397 LUT_digi_coll[FEB_i][chip_i][ch_i].signal_charge_mean = mean_charge;
398 LUT_digi_coll[FEB_i][chip_i][ch_i].signal_charge_saturation = max_charge;
399 LUT_digi_coll[FEB_i][chip_i][ch_i].signal_saturation_ratio = rate_sat_max;
401 cout<<
" --- End of Measure_Signal ---"<<endl;
406void CgemLUTWriter::Read_Mapping(){
407 bool print_here = (
false || Debug);
408 if(print_here)cout<<
" --- Start of Read_Mapping ---"<<endl;
409 int layer_ID, channel_ID, gemroc_ID, SW_FEB_ID, FEB_label, HW_FEB_ID, chip_ID;
411 float slope, constant;
413 mapping_file>>layer_ID>>channel_ID>>gemroc_ID>>SW_FEB_ID>>FEB_label>>HW_FEB_ID>>chip_ID>>strip>>slope>>constant;
419 std::istringstream iss(strip);
423 LUT_digi_coll[FEB_i][chip_i][ch_i].layer=layer_ID;
424 LUT_digi_coll[FEB_i][chip_i][ch_i].gemroc=gemroc_ID;
425 LUT_digi_coll[FEB_i][chip_i][ch_i].sw_feb=SW_FEB_ID;
426 LUT_digi_coll[FEB_i][chip_i][ch_i].HW_FEB_ID=HW_FEB_ID;
427 LUT_digi_coll[FEB_i][chip_i][ch_i].qdc_slope=slope;
428 LUT_digi_coll[FEB_i][chip_i][ch_i].qdc_constant=constant;
431 for (
size_t i = 0; i <
sizeof(
east) /
sizeof(
east[0]); ++i){
432 if(
east[i]==gemroc_ID) side=-1;
434 LUT_digi_coll[FEB_i][chip_i][ch_i].side=side;
437 for (
size_t i = 0; i <
sizeof(
sheet1) /
sizeof(
sheet1[0]); ++i){
438 if(
sheet1[i]==FEB_label) sheet=1;
440 LUT_digi_coll[FEB_i][chip_i][ch_i].sheet=sheet;
442 float saturation = 0;
443 if(slope!=0 && constant!=0){
444 saturation=-slope/constant;
446 LUT_digi_coll[FEB_i][chip_i][ch_i].qdc_saturation=saturation;
448 if(strip.at(0)==
'X'){
449 std::istringstream iss(strip.erase(0,1));
453 if(layer_ID==1 && strip_i>=630) strip_i -= 630;
454 if(layer_ID==2 && strip_i>=832) strip_i -= 832;
455 LUT_digi_coll[FEB_i][chip_i][ch_i].strip_x = strip_i;
456 LUT_digi_coll[FEB_i][chip_i][ch_i].strip_v = -1;
458 else if(strip.at(0)==
'V'){
459 std::istringstream iss(strip.erase(0,1));
463 if(layer_ID==1 && strip_i>=1077) strip_i -= 1077;
464 if(layer_ID==2 && strip_i>=1395) strip_i -= 1395;
465 LUT_digi_coll[FEB_i][chip_i][ch_i].strip_x = -1;
466 LUT_digi_coll[FEB_i][chip_i][ch_i].strip_v = strip_i;
469 LUT_digi_coll[FEB_i][chip_i][ch_i].strip_x = -1;
470 LUT_digi_coll[FEB_i][chip_i][ch_i].strip_v = -1;
473 cout<<
" --- End of Read_Mapping ---"<<endl;
478void CgemLUTWriter::Read_Tiger(){
479 bool print_here = (
false || Debug);
480 if(print_here)cout<<
" --- Start of Read_Tiger ---"<<endl;
481 int layer_ID, gemroc_ID, SW_FEB_ID, channel_ID;
482 float baseline_e, baseline_t, vth1, vth2, delta_vth1_baseline, delta_vth2_baseline, thr_t_fC, thr_e_fC;
484 tiger_file>>layer_ID>>gemroc_ID>>SW_FEB_ID>>channel_ID>>baseline_e>>baseline_t>>vth1>>vth2>>delta_vth1_baseline>>delta_vth2_baseline>>thr_t_fC>>thr_e_fC;
486 if(LUT_digi_coll[FEB_i][chip_i][ch_i].gemroc==gemroc_ID &&
487 LUT_digi_coll[FEB_i][chip_i][ch_i].sw_feb==SW_FEB_ID &&
490 LUT_digi_coll[FEB_i][chip_i][ch_i].baseline_e=0;
491 LUT_digi_coll[FEB_i][chip_i][ch_i].baseline_t=0;
492 LUT_digi_coll[FEB_i][chip_i][ch_i].vth1=thr_t_fC*12.5;
493 LUT_digi_coll[FEB_i][chip_i][ch_i].vth2=thr_e_fC*12.5;
494 LUT_digi_coll[FEB_i][chip_i][ch_i].delta_vth1_baseline=0;
495 LUT_digi_coll[FEB_i][chip_i][ch_i].delta_vth2_baseline=0;
496 LUT_digi_coll[FEB_i][chip_i][ch_i].thr_t_fC=thr_t_fC;
497 LUT_digi_coll[FEB_i][chip_i][ch_i].thr_e_fC=thr_e_fC;
500 cout<<
"Mismap mapping-tiger in ROC: "<<LUT_digi_coll[FEB_i][chip_i][ch_i].gemroc<<
" "<<gemroc_ID<<endl;
501 cout<<
"Mismap mapping-tiger in FEB: "<<LUT_digi_coll[FEB_i][chip_i][ch_i].sw_feb<<
" "<<SW_FEB_ID<<endl;
502 cout<<
"Mismap mapping-tiger in ch : "<<ch_i<<
" "<<channel_ID<<endl;
503 cerr<<
"Error while reading Read_Tiger"<<endl;
506 cout<<
" --- End of Read_Tiger ---"<<endl;
511void CgemLUTWriter::Read_HV_Setting(){
512 bool print_here = (
false || Debug);
513 if(print_here)cout<<
" --- Start of Read_HV_Setting"<<endl;
515 hv_file>>t_First_RUN>>t_Last_RUN>>t_Integration_time>>t_Energy_mode>>t_HV_L1_G3>>t_HV_L1_G2>>t_HV_L1_G1>>t_HV_L2_G3>>t_HV_L2_G2>>t_HV_L2_G1>>t_HV_L3_G3>>t_HV_L3_G2>>t_HV_L3_G1>>t_HV_L1_Dr>>t_HV_L2_Dr>>t_HV_L3_Dr>>t_HV_L1_T1>>t_HV_L2_T1>>t_HV_L3_T1>>t_HV_L1_T2>>t_HV_L2_T2>>t_HV_L3_T2>>t_HV_L1_In>>t_HV_L2_In>>t_HV_L3_In;
518void CgemLUTWriter::Define_TTree(){
519 ofile_name= OutputRoot;
520 ofile =
new TFile(ofile_name,
"RECREATE");
521 otree =
new TTree(
"tree",
"tree");
523 otree->Branch(
"ROC" ,&t_roc ,
"ROC/I");
524 otree->Branch(
"SW_FEB" ,&t_sw_feb ,
"SW_FEB/I");
525 otree->Branch(
"FEB" ,&t_feb ,
"FEB/I");
526 otree->Branch(
"chip" ,&t_chip ,
"chip/I");
527 otree->Branch(
"channel" ,&t_ch ,
"channel/I");
528 otree->Branch(
"layer" ,&t_layer ,
"layer/I");
529 otree->Branch(
"side" ,&t_side ,
"side/I");
530 otree->Branch(
"sheet" ,&t_sheet ,
"sheet/I");
532 otree->Branch(
"strip_x_graal" ,&t_strip_x_graal ,
"strip_x_graal/I");
533 otree->Branch(
"strip_v_graal" ,&t_strip_v_graal ,
"strip_v_graal/I");
534 otree->Branch(
"strip_x_boss" ,&t_strip_x_boss ,
"strip_x_boss/I");
535 otree->Branch(
"strip_v_boss" ,&t_strip_v_boss ,
"strip_v_boss/I");
537 otree->Branch(
"calib_QDC_slope" ,&t_qdc_slope ,
"calib_QDC_slope/F");
538 otree->Branch(
"calib_QDC_const" ,&t_qdc_constant ,
"calib_QDC_const/F");
539 otree->Branch(
"calib_QDC_saturation" ,&t_qdc_saturation,
"calib_QDC_saturation/F");
540 otree->Branch(
"baseline_T_mV" ,&t_baseline_e ,
"baseline_T_mV/F");
541 otree->Branch(
"baseline_E_mV" ,&t_baseline_t ,
"baseline_E_mV/F");
542 otree->Branch(
"delta_vth1_baseline" ,&t_delta_vth1_baseline ,
"delta_vth1_baseline/F");
543 otree->Branch(
"delta_vth2_baseline" ,&t_delta_vth2_baseline ,
"delta_vth2_baseline/F");
544 otree->Branch(
"v_thr_T_mV" ,&t_vth1 ,
"v_thr_T_mV/F");
545 otree->Branch(
"v_thr_E_mV" ,&t_vth2 ,
"v_thr_E_mV/F");
546 otree->Branch(
"thr_T_fC" ,&t_thr_t_fC ,
"thr_T_fC/F");
547 otree->Branch(
"thr_E_fC" ,&t_thr_e_fC ,
"thr_E_fC/F");
548 otree->Branch(
"thr_fC" ,&t_thr ,
"thr_fC/F");
549 otree->Branch(
"thr_width_fC" ,&t_thr_wid ,
"thr_width_fC/F");
551 otree->Branch(
"noise_rate_Hz" ,&t_noise_Hz ,
"noise_rate_Hz/F");
552 otree->Branch(
"noise_meanQ_fC" ,&t_noise_Q ,
"noise_meanQ_fC/F");
554 otree->Branch(
"signal_meanQ_fC" ,&t_sig_meanQ ,
"signal_meanQ_fC/F");
555 otree->Branch(
"signal_maxQ_fC" ,&t_sig_maxQ ,
"signal_maxQ_fC/F");
556 otree->Branch(
"signal_rate_Hz" ,&t_sig_Hz ,
"signal_rate_Hz/F");
557 otree->Branch(
"ratio_satutaion" ,&t_rate_sat_max ,
"ratio_satutaion/F");
559 otree->Branch(
"signal_startTime_ns" ,&t_time_start ,
"signal_startTime_ns/F");
560 otree->Branch(
"signal_stopTime_ns" ,&t_time_stop ,
"signal_stopTime_ns/F");
561 otree->Branch(
"signal_sigmaTime_ns" ,&t_time_sigma ,
"signal_sigmaTime_ns/F");
562 otree->Branch(
"signal_FEBstartTime_ns" ,&t_time_startFEB ,
"signal_FEBstartTime_ns/F");
563 otree->Branch(
"signal_FEBstopTime_ns" ,&t_time_stopFEB ,
"signal_FEBstopTime_ns/F");
564 otree->Branch(
"signal_FEBsigmaTime_ns" ,&t_time_sigmaFEB ,
"signal_FEBsigmaTime_ns/F");
566 otree->Branch(
"quality" ,&t_quality ,
"quality/I");
569 ootree =
new TTree(
"general",
"general");
570 ootree->Branch(
"First_RUN" ,&t_First_RUN ,
"First_RUN/I");
571 ootree->Branch(
"Last_RUN" ,&t_Last_RUN ,
"Last_RUN/I");
572 ootree->Branch(
"Integration_time",&t_Integration_time,
"Integration_time/I");
573 ootree->Branch(
"Energy_mode" ,&t_Energy_mode ,
"Energy_mode/I");
574 ootree->Branch(
"HV_L1_G3" ,&t_HV_L1_G3 ,
"HV_L1_G3/I");
575 ootree->Branch(
"HV_L2_G3" ,&t_HV_L2_G3 ,
"HV_L2_G3/I");
576 ootree->Branch(
"HV_L3_G3" ,&t_HV_L3_G3 ,
"HV_L3_G3/I");
577 ootree->Branch(
"HV_L1_G2" ,&t_HV_L1_G2 ,
"HV_L1_G2/I");
578 ootree->Branch(
"HV_L2_G2" ,&t_HV_L2_G2 ,
"HV_L2_G2/I");
579 ootree->Branch(
"HV_L3_G2" ,&t_HV_L3_G2 ,
"HV_L3_G2/I");
580 ootree->Branch(
"HV_L1_G1" ,&t_HV_L1_G1 ,
"HV_L1_G1/I");
581 ootree->Branch(
"HV_L2_G1" ,&t_HV_L2_G1 ,
"HV_L2_G1/I");
582 ootree->Branch(
"HV_L3_G1" ,&t_HV_L3_G1 ,
"HV_L3_G1/I");
583 ootree->Branch(
"HV_L1_In" ,&t_HV_L1_In ,
"HV_L1_In/I");
584 ootree->Branch(
"HV_L2_In" ,&t_HV_L2_In ,
"HV_L2_In/I");
585 ootree->Branch(
"HV_L3_In" ,&t_HV_L3_In ,
"HV_L3_In/I");
586 ootree->Branch(
"HV_L1_T2" ,&t_HV_L1_T2 ,
"HV_L1_T2/I");
587 ootree->Branch(
"HV_L2_T2" ,&t_HV_L2_T2 ,
"HV_L2_T2/I");
588 ootree->Branch(
"HV_L3_T2" ,&t_HV_L3_T2 ,
"HV_L3_T2/I");
589 ootree->Branch(
"HV_L1_T1" ,&t_HV_L1_T1 ,
"HV_L1_T1/I");
590 ootree->Branch(
"HV_L2_T1" ,&t_HV_L2_T1 ,
"HV_L2_T1/I");
591 ootree->Branch(
"HV_L3_T1" ,&t_HV_L3_T1 ,
"HV_L3_T1/I");
592 ootree->Branch(
"HV_L1_Dr" ,&t_HV_L1_Dr ,
"HV_L1_Dr/I");
593 ootree->Branch(
"HV_L2_Dr" ,&t_HV_L2_Dr ,
"HV_L2_Dr/I");
594 ootree->Branch(
"HV_L3_Dr" ,&t_HV_L3_Dr ,
"HV_L3_Dr/I");
599void CgemLUTWriter::Fill_TTree(){
600 bool print_here = (
false || Debug);
601 if(print_here)cout<<
" --- Start of Fill_TTree ---"<<endl;
602 t_roc =LUT_digi_coll[FEB_i][chip_i][ch_i].gemroc;
603 t_sw_feb=LUT_digi_coll[FEB_i][chip_i][ch_i].sw_feb;
607 t_layer=LUT_digi_coll[FEB_i][chip_i][ch_i].layer;
608 t_side=LUT_digi_coll[FEB_i][chip_i][ch_i].side;
609 t_sheet=LUT_digi_coll[FEB_i][chip_i][ch_i].sheet;
612 t_strip_x_boss=LUT_digi_coll[FEB_i][chip_i][ch_i].strip_x;
613 t_strip_v_boss=LUT_digi_coll[FEB_i][chip_i][ch_i].strip_v;
614 t_qdc_slope=LUT_digi_coll[FEB_i][chip_i][ch_i].qdc_slope;
615 t_qdc_constant=LUT_digi_coll[FEB_i][chip_i][ch_i].qdc_constant;
616 t_qdc_saturation=LUT_digi_coll[FEB_i][chip_i][ch_i].qdc_saturation;
617 t_baseline_e=LUT_digi_coll[FEB_i][chip_i][ch_i].baseline_e;
618 t_baseline_t=LUT_digi_coll[FEB_i][chip_i][ch_i].baseline_t;
619 t_delta_vth1_baseline=LUT_digi_coll[FEB_i][chip_i][ch_i].delta_vth1_baseline;
620 t_delta_vth2_baseline=LUT_digi_coll[FEB_i][chip_i][ch_i].delta_vth2_baseline;
621 t_vth1=LUT_digi_coll[FEB_i][chip_i][ch_i].vth1;
622 t_vth2=LUT_digi_coll[FEB_i][chip_i][ch_i].vth2;
623 t_thr_t_fC=LUT_digi_coll[FEB_i][chip_i][ch_i].thr_t_fC;
624 t_thr_e_fC=LUT_digi_coll[FEB_i][chip_i][ch_i].thr_e_fC;
625 t_thr=LUT_digi_coll[FEB_i][chip_i][ch_i].thr_effective;
626 t_thr_wid=LUT_digi_coll[FEB_i][chip_i][ch_i].thr_width;
627 t_noise_Hz=LUT_digi_coll[FEB_i][chip_i][ch_i].noise_rate;
628 t_noise_Q=LUT_digi_coll[FEB_i][chip_i][ch_i].noise_charge;
629 t_sig_meanQ=LUT_digi_coll[FEB_i][chip_i][ch_i].signal_charge_mean;
630 t_sig_maxQ=LUT_digi_coll[FEB_i][chip_i][ch_i].signal_charge_saturation;
631 t_sig_Hz=LUT_digi_coll[FEB_i][chip_i][ch_i].signal_rate;
632 t_rate_sat_max=LUT_digi_coll[FEB_i][chip_i][ch_i].signal_saturation_ratio;
642 cout<<
" --- End of Fill_TTree ---"<<endl;
648TString CgemLUTWriter::Get_Cut(
int cut){
649 bool print_cuts = (
false || Debug);
651 TString cut_tiger = Form(
"GemHit_FEB==%d && GemHit_chip==%d && GemHit_q>%d",FEB_i,chip_i,
charge_cut);
652 TString cut_channel = cut_tiger + Form(
" && GemHit_channel==%d",ch_i);
655 TString cut_tiger_noise_out_of_time = cut_tiger + cut_out_of_time;
656 TString cut_tiger_signal_in_time = cut_tiger + cut_in_time;
657 TString cut_channel_noise_out_of_time = cut_channel + cut_out_of_time;
658 TString cut_channel_signal_in_time = cut_channel + cut_in_time;
660 cout<<
"N° entries: "<<
ch.GetEntries()<<endl;
661 cout<<cut_tiger_noise_out_of_time<<endl;
662 cout<<cut_tiger_signal_in_time<<endl;
663 cout<<cut_channel_noise_out_of_time<<endl;
664 cout<<cut_channel_signal_in_time<<endl;
665 cout<<cut_channel<<endl;
668 case 0:
return cut_tiger;
669 case 1:
return cut_channel;
670 case 2:
return cut_tiger_noise_out_of_time;
671 case 3:
return cut_tiger_signal_in_time;
672 case 4:
return cut_channel_noise_out_of_time;
673 case 5:
return cut_channel_signal_in_time;
const double min_saturation_value
double expected_noise_rate
bool error_counter_type[N_FEB][N_CHIP][3]
const int noise_time_cut_min_left
const int signal_time_cut_min
const int noise_time_cut_max_left
const double min_average_efficiency
const double min_efficiency
int error_counter[N_FEB][N_CHIP]
const int noise_time_cut_max_right
const int signal_time_cut_max
const double failure_rate_efficienct
const double time_window_noise
const double time_window_signal
const double max_noise_charge
double expected_noise_per_chip
const int noise_time_cut_min_right
double fitfunctionFD(double *x, double *par)
const double max_threshold
*********Class see also m_nmax DOUBLE PRECISION m_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared cut
CgemLUTWriter(const std::string &name, ISvcLocator *pSvcLocator)