3#include "GaudiKernel/ISvcLocator.h"
4#include "GaudiKernel/Bootstrap.h"
5#include "GaudiKernel/IDataProviderSvc.h"
6#include "GaudiKernel/SmartDataPtr.h"
7#include "GaudiKernel/DataSvc.h"
8#include "GaudiKernel/PropertyMgr.h"
9#include "CLHEP/Units/PhysicalConstants.h"
11#include "G4DigiManager.hh"
12#include "Randomize.hh"
15#include "CLHEP/Units/PhysicalConstants.h"
36const static int electrons_select_method_threhold=2500;
38typedef std::vector<int>
Vint;
40static void checkMemorySize();
49 for(
int i = 0; i < Npx-1; i++){
50 if(
t>=
x[i]&&
t<
x[i+1]){
id = i;
break;}
52 if(
id != -1){
I=y[id]+(y[
id+1]-y[id])*(
t-
x[
id])/(
x[
id+1]-
x[id]);}
68 const int nbinsx=2000;
70 const double xmax=1000;
71 const double binWidth=(xmax-xmin)/nbinsx;
75 if (
t > xmin+binWidth/2 &&
t< xmax-binWidth/2){
76 id=(int)floor((
t-binWidth/2-xmin)/binWidth);
78#ifdef INDUCTIONGAR_DEBUG_RECTANGLE2_FAST_TEST
80 for (
int i = 0; i < Npx - 1; i++) {
81 if (
t >=
x[i] &&
t <
x[i + 1]) {
88 "CgemDigitizerSvc::InductionGar::rectangle2_fast: 2 method calced id doesnot correspond, "<<
89 "id new : "<< id2 <<
" id old : "<<
id<<
90 " t : "<<
t<<
" x at id old "<<
x[id2]<< endl;
94 I = y[id] + (y[
id + 1] - y[id]) * (
t -
x[
id]) / (
x[
id + 1] -
x[id]);
100double rectangle2(
double t, std::vector<double>& x,
const double *y,
int Npx)
105 for(
int i = 0; i < Npx-1; i++){
106 if(
t>=
x[i]&&
t<
x[i+1]){
id = i;
break;}
108 if(
id != -1){
I=y[id]+(y[
id+1]-y[id])*(
t-
x[
id])/(
x[
id+1]-
x[id]);}
118 result = 2000.*(0.00181928*
exp(-
t/3.)-0.0147059*
exp(-
t/20.)+0.0128866*
exp(-
t/100.));
128 result = 0.000627357*(1358.7*
exp(-
t*0.0385647)*
t+1358.7*
exp(-
t*0.0114353)*
t+100164.*
exp(-
t*0.0385647)-100164.*
exp(-0.0114353*
t));
136 TH1F h_signalT(
"h_signalT",
"",Npx,xmin,xmax);
137 std::vector<double> Input_Time_plot_001(Npx);
138 for(
int i=0; i<Npx; i++) Input_Time_plot_001[i]=h_signalT.GetBinCenter(i+1);
140 double xmin_f1(0.), xmax_f1(1000);
142 double step_f1=(xmax_f1-xmin_f1)/nStep_f1;
145 std::vector<double>
x(Npx);
146 std::vector<double> y_001(Npx);
148 for(
int i=0; i<Npx; i++)
150 x[i]=xmin+(xmax-xmin)/Npx*(i+0.5);
153 for(
int j=0; j<nStep_f1; j++)
155 x_f1=xmin_f1+step_f1*(j+0.5);
156 fun_001+=
rectangle2(x_f1,Input_Time_plot_001,Input_Curr_plot_001,Npx)*
T_branch2(
x[i]-x_f1)*step_f1;
162 for(
int init=0; init<Npx; init++){
163 h_signalT.SetBinContent(init+1,-y_001[init]);
171 double xmin(0), xmax(1000);
174 TH1F h_signalT(
"h_signalT",
"",Npx,xmin,xmax);
175 double Input_Time_plot_001[Npx];
176 for(
int i=0; i<Npx; i++) Input_Time_plot_001[i]=h_signalT.GetBinCenter(i+1);
178 double xmin_f1(0.), xmax_f1(1000);
180 double step_f1=(xmax_f1-xmin_f1)/nStep_f1;
186 for(
int i=0; i<Npx; i++)
188 x[i]=xmin+(xmax-xmin)/Npx*(i+0.5);
191 for(
int j=0; j<nStep_f1; j++)
193 x_f1=xmin_f1+step_f1*(j+0.5);
200 for(
int init=0; init<Npx; init++){
201 h_signalT.SetBinContent(init+1,-y_001[init]);
209 TH1F h_signalE(
"h_signalE",
"",Npx,xmin,xmax);
210 std::vector<double> Input_Time_plot_001(Npx);
211 for(
int i=0; i<Npx; i++) Input_Time_plot_001[i]=h_signalE.GetBinCenter(i+1);
213 double xmin_f1(0.), xmax_f1(1000);
215 double step_f1=(xmax_f1-xmin_f1)/nStep_f1;
218 std::vector<double>
x(Npx);
219 std::vector<double> y_001(Npx);
221 for(
int i=0; i<Npx; i++)
223 x[i]=xmin+(xmax-xmin)/Npx*(i+0.5);
226 for(
int j=0; j<nStep_f1; j++)
228 x_f1=xmin_f1+step_f1*(j+0.5);
229 fun_001+=
rectangle2(x_f1,Input_Time_plot_001,Input_Curr_plot_001,Npx)*
E_branch2(
x[i]-x_f1)*step_f1;
235 for(
int init=0; init<Npx; init++){
236 h_signalE.SetBinContent(init+1,-y_001[init]);
244 double xmin(0), xmax(1000);
247 TH1F h_signalE(
"h_signalE",
"",Npx,xmin,xmax);
248 double Input_Time_plot_001[Npx];
249 for(
int i=0; i<Npx; i++) Input_Time_plot_001[i]=h_signalE.GetBinCenter(i+1);
251 double xmin_f1(0.), xmax_f1(1000);
253 double step_f1=(xmax_f1-xmin_f1)/nStep_f1;
259 for(
int i=0; i<Npx; i++)
261 x[i]=xmin+(xmax-xmin)/Npx*(i+0.5);
264 for(
int j=0; j<nStep_f1; j++)
266 x_f1=xmin_f1+step_f1*(j+0.5);
273 for(
int init=0; init<Npx; init++){
274 h_signalE.SetBinContent(init+1,-y_001[init]);
280#ifdef INDUCTIONGAR_DEBUG_CONVOLUTION_TBRANCH_FFT_TEST
287TH1F Convolution_Tbranch_noskip(
const double *Input_Curr_plot_001)
289 double xmin(0), xmax(1000);
292 TH1F h_signalT(
"h_signalT",
"", Npx, xmin, xmax);
293 double Input_Time_plot_001[Npx];
294 for (
int i = 0; i < Npx; i++) Input_Time_plot_001[i] = h_signalT.GetBinCenter(i + 1);
296 double xmin_f1(0.), xmax_f1(1000);
298 double step_f1 = (xmax_f1 - xmin_f1) / nStep_f1;
304 for (
int i = 0; i < Npx; i++) {
305 x[i] = xmin + (xmax - xmin) / Npx * (i + 0.5);
306 double fun_001 = 0.0;
308 for (
int j = 0; j < nStep_f1; j++) {
309 x_f1 = xmin_f1 + step_f1 * (j + 0.5);
315 for (
int init = 0; init < Npx; init++) {
316 h_signalT.SetBinContent(init + 1, -y_001[init]);
322TH1F Convolution_Ebranch_noskip(
const double *Input_Curr_plot_001)
324 double xmin(0), xmax(1000);
327 TH1F h_signalE(
"h_signalE",
"",Npx,xmin,xmax);
328 double Input_Time_plot_001[Npx];
329 for(
int i=0; i<Npx; i++) Input_Time_plot_001[i]=h_signalE.GetBinCenter(i+1);
331 double xmin_f1(0.), xmax_f1(1000);
333 double step_f1=(xmax_f1-xmin_f1)/nStep_f1;
339 for(
int i=0; i<Npx; i++)
341 x[i]=xmin+(xmax-xmin)/Npx*(i+0.5);
344 for(
int j=0; j<nStep_f1; j++)
346 x_f1=xmin_f1+step_f1*(j+0.5);
353 for(
int init=0; init<Npx; init++){
354 h_signalE.SetBinContent(init+1,-y_001[init]);
361 double xmin(0), xmax(1000);
364 double *p_TBranch=&(
TBranch.front());
365 for (
int i = 0; i < Npx; i++) {
366 double x=xmin+(xmax-xmin)*i/Npx;
387 double xmin(0), xmax(1000);
390 TH1D h_signal(
"h_signal",
"", Npx, xmin, xmax);
391 double *p_signal=h_signal.GetArray()+1;
392 this->
conv->
convolve(p_signal,Input_Curr_plot_001,0,Npx,-0.5);
394#ifdef INDUCTIONGAR_DEBUG_CONVOLUTION_TBRANCH_FFT_TEST
395 const double dx_abs_threhold=1e-6;
396 const double dx_ref_threhold=1e-6;
397 TH1F h_signal_ref=Convolution_Tbranch_noskip(Input_Curr_plot_001);
398 bool found_mismatch=
false;
399 for (
int i=1; i<=Npx; i++){
400 if (
abs((h_signal[i]-h_signal_ref[i])/h_signal_ref[i]) > dx_ref_threhold
401 and
abs(h_signal[i]-h_signal_ref[i]) > dx_abs_threhold ) {
402 if (not found_mismatch){
403 std::cout<<
"CgemDigitizerSvc::InductionGar::Convolution_Tbranch_fft found results not match: ";
406 std::cout<<
"ref: "<<h_signal_ref[i]<<
"; this: "<<h_signal[i]<<
"; at i="<<i<<
";threhold abs="<<dx_abs_threhold<<
"; ref="<<dx_ref_threhold<<std::endl;
416 double xmin(0), xmax(1000);
419 double *p_EBranch=&(
EBranch.front());
420 for (
int i = 0; i < Npx; i++) {
421 double x=xmin+(xmax-xmin)*i/Npx;
442 double xmin(0), xmax(1000);
445 TH1D h_signal(
"h_signalE",
"", Npx, xmin, xmax);
446 double *p_signal=h_signal.GetArray()+1;
447 this->
conv->
convolve(p_signal,Input_Curr_plot_001,0,Npx,-0.5);
449#ifdef INDUCTIONGAR_DEBUG_CONVOLUTION_TBRANCH_FFT_TEST
450 const double dx_abs_threhold=1e-6;
451 const double dx_ref_threhold=1e-6;
452 TH1F h_signal_ref=Convolution_Ebranch_noskip(Input_Curr_plot_001);
453 bool found_mismatch=
false;
454 for (
int i=1; i<=Npx; i++){
455 if (
abs((h_signal[i]-h_signal_ref[i])/h_signal_ref[i]) > dx_ref_threhold
456 and
abs(h_signal[i]-h_signal_ref[i]) > dx_abs_threhold ) {
457 if (not found_mismatch){
458 std::cout<<
"CgemDigitizerSvc::InductionGar::Convolution_Ebranch_fft found results not match: ";
461 std::cout<<
"ref: "<<h_signal_ref[i]<<
"; this: "<<h_signal[i]<<
"; at i="<<i<<
";threhold abs="<<dx_abs_threhold<<
"; ref="<<dx_ref_threhold<<std::endl;
472 string testPath = getenv(
"CGEMDIGITIZERSVCROOT");
473 m_LUTFilePath =
"/bes3fs/cgemCosmic/data/CGEM_cosmic_look_up_table_from_10_to_17.root";
474 m_V2EfineFile = testPath +
"testFIle/V2Efine.root";
475 sample_delay = 162.5;
479 m_Ngaps_microSector=40;
480 m_gapShift_microSector[0][0]=0.;
481 m_gapShift_microSector[0][1]=0.;
482 m_gapShift_microSector[1][0]=0.;
483 m_gapShift_microSector[1][1]=0.;
484 m_gapShift_microSector[2][0]=0.;
485 m_gapShift_microSector[2][1]=0.;
486 m_microSector_width[0][0]=2*
M_PI/m_Ngaps_microSector;
487 m_microSector_width[0][1]=2*
M_PI/m_Ngaps_microSector;
488 m_microSector_width[1][0]=2*
M_PI/m_Ngaps_microSector/2;
489 m_microSector_width[1][1]=2*
M_PI/m_Ngaps_microSector/2;
490 m_microSector_width[2][0]=2*
M_PI/m_Ngaps_microSector/2;
491 m_microSector_width[2][1]=2*
M_PI/m_Ngaps_microSector/2;
494 m_gap_microSector=1.1;
502 m_magConfig = magConfig;
503 std::cout<<
"InductionGar sampling time : "<<sample_delay<<std::endl;
505 string filePath_ratio = getenv(
"CGEMDIGITIZERSVCROOT");
507 if(0==m_magConfig) fileName = filePath_ratio +
"/dat/par_InductionGar_0T.txt";
508 else fileName = filePath_ratio +
"/dat/par_InductionGar_1T.txt";
509 ifstream fin(fileName.c_str(), ios::in);
510 cout <<
"InductionGar fileName: " << fileName << endl;
514 if( ! fin.is_open() ){
515 cout <<
"ERROR: can not open file " << fileName << endl;
518 for(
int m=0; m<3; m++){
519 for(
int l=0; l<5; l++){
520 for(
int k=0; k<5; k++){
521 for(
int i=0; i<4; i++){
522 fin>>RatioX[m][l][k][i];
524 for(
int j=0; j<3; j++){
525 fin>>RatioV[m][l][k][j];
532 string fileName1 = filePath_ratio +
"/dat/VQ_relation.txt";
533 ifstream VQin(fileName1.c_str(), ios::in);
534 VQin>>VQ_slope>>VQ_const;
538 string filePath = getenv(
"CGEMDIGITIZERSVCROOT");
539 for(
int i=0; i<3; i++){
540 for(
int j=0; j<5; j++){
541 for(
int k=0; k<5; k++){
542 char temp1[1]; sprintf(temp1,
"%i", (i+1));
543 char temp2[2]; sprintf(temp2,
"%i", ((j+1)*10+k+1));
544 if(0==m_magConfig) fileName = filePath +
"/dat/InducedCurrent_Root_0T/layer" + temp1 +
"_" + temp2 +
".root";
545 else fileName = filePath +
"/dat/InducedCurrent_Root_1T/layer" + temp1 +
"_" + temp2 +
".root";
546 TFile* file_00 = TFile::Open(fileName.c_str(),
"read");
547 TH1* readThis_x3 = 0;
548 TH1* readThis_x4 = 0;
549 TH1* readThis_x5 = 0;
550 TH1* readThis_x6 = 0;
551 TH1* readThis_v5 = 0;
552 TH1* readThis_v6 = 0;
553 TH1* readThis_v7 = 0;
554 file_00->GetObject(
"readThis_x3", readThis_x3);
555 file_00->GetObject(
"readThis_x4", readThis_x4); file_00->GetObject(
"readThis_v5", readThis_v5);
556 file_00->GetObject(
"readThis_x5", readThis_x5); file_00->GetObject(
"readThis_v6", readThis_v6);
557 file_00->GetObject(
"readThis_x6", readThis_x6); file_00->GetObject(
"readThis_v7", readThis_v7);
559 double scaleX=m_ScaleSignalX;
560 double scaleV=(1-scaleX*(RatioX[i][j][k][0]+RatioX[i][j][k][1]+RatioX[i][j][k][2]+RatioX[i][j][k][3]))/(RatioV[i][j][k][0]+RatioV[i][j][k][1]+RatioV[i][j][k][2]);
562 SignalX[i][j][k][0][
init] = scaleX*readThis_x3->GetBinContent(
init+1);
563 SignalX[i][j][k][1][
init] = scaleX*readThis_x4->GetBinContent(
init+1);
564 SignalX[i][j][k][2][
init] = scaleX*readThis_x5->GetBinContent(
init+1);
565 SignalX[i][j][k][3][
init] = scaleX*readThis_x6->GetBinContent(
init+1);
566 SignalV[i][j][k][0][
init] = scaleV*readThis_v5->GetBinContent(
init+1);
567 SignalV[i][j][k][1][
init] = scaleV*readThis_v6->GetBinContent(
init+1);
568 SignalV[i][j][k][2][
init] = scaleV*readThis_v7->GetBinContent(
init+1);
572 temp[0][
init*2]=SignalX[i][j][k][0][
init];
573 temp[1][
init*2]=SignalX[i][j][k][1][
init];
574 temp[2][
init*2]=SignalX[i][j][k][2][
init];
575 temp[3][
init*2]=SignalX[i][j][k][3][
init];
576 temp[4][
init*2]=SignalV[i][j][k][0][
init];
577 temp[5][
init*2]=SignalV[i][j][k][1][
init];
578 temp[6][
init*2]=SignalV[i][j][k][2][
init];
579 temp[0][
init*2+1]=SignalX[i][j][k][0][
init];
580 temp[1][
init*2+1]=SignalX[i][j][k][1][
init];
581 temp[2][
init*2+1]=SignalX[i][j][k][2][
init];
582 temp[3][
init*2+1]=SignalX[i][j][k][3][
init];
583 temp[4][
init*2+1]=SignalV[i][j][k][0][
init];
584 temp[5][
init*2+1]=SignalV[i][j][k][1][
init];
585 temp[6][
init*2+1]=SignalV[i][j][k][2][
init];
588 Signal_ConvolverX[i][j][k][0].
init(temp[0]+2,160,2000);
589 Signal_ConvolverX[i][j][k][1].
init(temp[1]+2,160,2000);
590 Signal_ConvolverX[i][j][k][2].
init(temp[2]+2,160,2000);
591 Signal_ConvolverX[i][j][k][3].
init(temp[3]+2,160,2000);
592 Signal_ConvolverV[i][j][k][0].
init(temp[4]+2,160,2000);
593 Signal_ConvolverV[i][j][k][1].
init(temp[5]+2,160,2000);
594 Signal_ConvolverV[i][j][k][2].
init(temp[6]+2,160,2000);
601 TFile *LUTFile = TFile::Open(m_LUTFilePath.c_str(),
"read");
602 TTree *tree = (TTree*)LUTFile->Get(
"tree");
603 Float_t V_th_T,V_th_E,QDC_a,QDC_b,QDC_saturation;
604 Int_t layer,sheet,strip_v,strip_x;
605 tree->SetBranchAddress(
"strip_x_boss", &strip_x);
606 tree->SetBranchAddress(
"strip_v_boss", &strip_v);
607 tree->SetBranchAddress(
"layer", &layer);
608 tree->SetBranchAddress(
"sheet", &sheet);
609 tree->SetBranchAddress(
"calib_QDC_slope", &QDC_a);
610 tree->SetBranchAddress(
"calib_QDC_const", &QDC_b);
611 tree->SetBranchAddress(
"calib_QDC_saturation", &QDC_saturation);
612 tree->SetBranchAddress(
"v_thr_T_mV", &V_th_T);
613 tree->SetBranchAddress(
"v_thr_E_mV", &V_th_E);
615 double thresholdMin_X_T=999;
616 double thresholdMin_V_T=999;
617 double thresholdMin_X_Q=999;
618 double thresholdMin_V_Q=999;
619 for(
int i=0;i<tree->GetEntries();i++){
622 T_thr_V[layer][sheet][0][strip_x] = V_th_T;
623 if(V_th_T>0&&V_th_T<thresholdMin_X_T) thresholdMin_X_T=V_th_T;
625 E_thr_V[layer][sheet][0][strip_x] = V_th_E;
626 if(V_th_E>0&&V_th_E<thresholdMin_X_Q) thresholdMin_X_Q=V_th_E;
628 QDC_slope[layer][sheet][0][strip_x] = QDC_a;
629 QDC_const[layer][sheet][0][strip_x] = QDC_b;
630 Qsaturation[layer][sheet][0][strip_x] = QDC_saturation;
633 T_thr_V[layer][sheet][1][strip_v] = V_th_T;
634 if(V_th_T>0&&V_th_T<thresholdMin_V_T) thresholdMin_V_T=V_th_T;
636 E_thr_V[layer][sheet][1][strip_v] = V_th_E;
637 if(V_th_E>0&&V_th_E<thresholdMin_V_Q) thresholdMin_V_Q=V_th_E;
639 QDC_slope[layer][sheet][1][strip_v] = QDC_a;
640 QDC_const[layer][sheet][1][strip_v] = QDC_b;
641 Qsaturation[layer][sheet][1][strip_v] = QDC_saturation;
644 for(
int i=0;i<tree->GetEntries();i++){
647 if(V_th_T<=0) T_thr_V[layer][sheet][0][strip_x] = thresholdMin_X_T;
648 if(V_th_E<=0) E_thr_V[layer][sheet][0][strip_x] = thresholdMin_X_Q;
651 if(V_th_T<=0) T_thr_V[layer][sheet][1][strip_v] = thresholdMin_V_T;
652 if(V_th_E<=0) E_thr_V[layer][sheet][1][strip_v] = thresholdMin_V_Q;
657 for(
int i=0;i<832;i++){
658 T_thr_V[2][0][0][i] = 12.;
659 E_thr_V[2][0][0][i] = 12.;
660 QDC_slope[2][0][0][i] = -10.47;
661 QDC_const[2][0][0][i] = 482.3;
662 Qsaturation[2][0][0][i] = 45.;
663 T_thr_V[2][1][0][i] = 10.;
664 E_thr_V[2][1][0][i] = 10.;
665 QDC_slope[2][1][0][i] = -10.47;
666 QDC_const[2][1][0][i] = 482.3;
667 Qsaturation[2][1][0][i] = 45.;
670 for(
int i=0;i<1395;i++){
671 T_thr_V[2][0][1][i] = 12.;
672 E_thr_V[2][0][1][i] = 12.;
673 QDC_slope[2][0][1][i] = -10.47;
674 QDC_const[2][0][1][i] = 482.3;
675 Qsaturation[2][0][1][i] = 45.;
676 T_thr_V[2][1][1][i] = 10.;
677 E_thr_V[2][1][1][i] = 10.;
678 QDC_slope[2][1][1][i] = -10.47;
679 QDC_const[2][1][1][i] = 482.3;
680 Qsaturation[2][1][1][i] = 45.;
715 cout<<
"InductionGar: "<<endl;
716 cout<<
"m_Ngaps_microSector="<<m_Ngaps_microSector<<endl;
717 cout<<
"m_gap_microSector="<<m_gap_microSector<<endl;
718 cout<<
"m_gapShift_microSector: "<<m_gapShift_microSector[0][0]
719 <<
", "<<m_gapShift_microSector[0][1]
720 <<
", "<<m_gapShift_microSector[1][0]
721 <<
", "<<m_gapShift_microSector[1][1]
722 <<
", "<<m_gapShift_microSector[2][0]
723 <<
", "<<m_gapShift_microSector[2][1]
725 cout<<
"microSector_width="<<m_microSector_width[0]
726 <<
", "<<m_microSector_width[1]
727 <<
", "<<m_microSector_width[2]
728 <<
", "<<m_microSector_width[3]
729 <<
", "<<m_microSector_width[4]
730 <<
", "<<m_microSector_width[5]
732 cout<<
"QinGausSigma="<<m_QinGausSigma[0]
733 <<
", "<<m_QinGausSigma[1]
736 m_deadStrip[0][0][0].insert(40);
737 m_deadStrip[0][0][0].insert(189);
738 m_deadStrip[0][0][0].insert(322);
739 m_deadStrip[0][0][0].insert(350);
740 m_deadStrip[0][0][0].insert(457);
741 m_deadStrip[0][0][1].insert(282);
742 m_deadStrip[0][0][1].insert(467);
743 m_deadStrip[0][0][1].insert(715);
744 m_deadStrip[0][0][1].insert(773);
745 m_deadStrip[0][0][1].insert(795);
746 m_deadStrip[0][0][1].insert(803);
747 m_deadStrip[1][0][1].insert(305);
748 m_deadStrip[1][0][1].insert(307);
749 m_deadStrip[1][0][1].insert(381);
750 m_deadStrip[1][0][1].insert(443);
751 m_deadStrip[1][0][1].insert(486);
752 m_deadStrip[1][0][1].insert(550);
753 m_deadStrip[1][0][1].insert(620);
754 m_deadStrip[1][0][1].insert(631);
755 m_deadStrip[1][0][1].insert(660);
756 m_deadStrip[1][0][1].insert(681);
757 m_deadStrip[1][1][1].insert(425);
758 m_deadStrip[1][1][1].insert(455);
759 m_deadStrip[1][1][1].insert(459);
760 m_deadStrip[1][1][1].insert(461);
761 m_deadStrip[1][1][1].insert(535);
762 m_deadStrip[1][1][1].insert(536);
763 m_deadStrip[1][1][1].insert(614);
764 m_deadStrip[1][1][1].insert(672);
767void InductionGar::setMultiElectrons(
int layer,
int nElectrons,
const std::vector<Float_t>& x,
const std::vector<Float_t>& y,
const std::vector<Float_t> &z,
const std::vector<Float_t> &
t){
769 m_xstripSheet.clear();
771 m_vstripSheet.clear();
775 m_xstripT_Branch.clear();
776 m_vstripT_Branch.clear();
777 m_xstripQ_Branch.clear();
778 m_vstripQ_Branch.clear();
784 std::vector<int> m000_xstripSheet;
785 std::vector<int> m000_xstripID;
786 std::vector<int> m000_vstripSheet;
787 std::vector<int> m000_vstripID;
788 std::vector<double> m000_xstripQ;
789 std::vector<double> m000_vstripQ;
790 std::vector<double> m000_xstripT_Branch;
791 std::vector<double> m000_vstripT_Branch;
792 std::vector<double> m000_xstripQ_Branch;
793 std::vector<double> m000_vstripQ_Branch;
795 m000_xstripSheet.clear();
796 m000_xstripID.clear();
797 m000_vstripSheet.clear();
798 m000_vstripID.clear();
799 m000_xstripQ.clear();
800 m000_vstripQ.clear();
801 m000_xstripT_Branch.clear();
802 m000_vstripT_Branch.clear();
803 m000_xstripQ_Branch.clear();
804 m000_vstripQ_Branch.clear();
811 Vint Save_Sheetx, Save_Sheetv;
812 Vint Save_FinalstripIDx, Save_FinalstripIDv;
813 Vint Save_Gridx, Save_Gridv;
814 Vint Save_IDx, Save_IDv;
815 Vint Save_Tx, Save_Tv;
824 Save_FinalstripIDx.clear();
825 Save_FinalstripIDv.clear();
826 for(
int i=0; i<2; i++){
827 for(
int k=0; k<2; k++){
828 m_mapQ[i][k].clear();
835 for(
int i=0; i<nElectrons; i++){
837 double phi_electron = atan2(y[i],
x[i]);
838 double z_electron = z[i];
839 if(inMicroSectorGap(phi_electron,layer)) {
843 G4ThreeVector pos(
x[i], y[i], z[i]);
844 for(
int j=0; j<NSheet; j++)
847 if(CgemReadoutPlane->
OnThePlane(phi_electron,z_electron))
864 double L_XPitch = CgemReadoutPlane->
getXPitch();
865 double L_VPitch = CgemReadoutPlane->
getVPitch();
866 grid_v = floor(distX/L_XPitch*5.+2.5);
867 grid_x = floor(distV/L_VPitch*5.+2.5);
872 if(xID>=0 && vID>=0) {
873 map<int, double>::iterator itx = m_mapQ[j][0].find(xID);
874 map<int, double>::iterator itv = m_mapQ[j][1].find(vID);
875 if(RatioX[layer][grid_x][grid_v][2]!=0){
876 if(itx==m_mapQ[j][0].end())
878 m_mapQ[j][0][xID]=RatioX[layer][grid_x][grid_v][2];
879 Save_Gridx.push_back(grid_x*100+grid_v*10+2);
880 Save_IDx.push_back(j*10000+xID);
881 Save_Tx.push_back(
t[i]);
885 double Q = (itx->second) + RatioX[layer][grid_x][grid_v][2];
887 Save_Gridx.push_back(grid_x*100+grid_v*10+2);
888 Save_IDx.push_back(j*10000+xID);
889 Save_Tx.push_back(
t[i]);
892 vector<int>::iterator result_Sheetx = find(Save_Sheetx.begin(), Save_Sheetx.end(), j*10000+xID);
893 if(result_Sheetx==Save_Sheetx.end()){
894 Save_Sheetx.push_back(j*10000+xID);
897 if(RatioV[layer][grid_x][grid_v][1]!=0){
898 if(itv==m_mapQ[j][1].end())
900 m_mapQ[j][1][vID]=RatioV[layer][grid_x][grid_v][1];
901 Save_Gridv.push_back(grid_x*100+grid_v*10+1);
902 Save_IDv.push_back(j*10000+vID);
903 Save_Tv.push_back(
t[i]);
906 double Q = (itv->second) + RatioV[layer][grid_x][grid_v][1];
908 Save_Gridv.push_back(grid_x*100+grid_v*10+1);
909 Save_IDv.push_back(j*10000+vID);
910 Save_Tv.push_back(
t[i]);
912 vector<int>::iterator result_Sheetv = find(Save_Sheetv.begin(), Save_Sheetv.end(), j*10000+vID);
913 if(result_Sheetv==Save_Sheetv.end()){
914 Save_Sheetv.push_back(j*10000+vID);
919 if((xID>=0 && vID>=0) && (xID+1)<CgemReadoutPlane->
getNXstrips()) {
920 map<int, double>::iterator itx = m_mapQ[j][0].find(xID+1);
921 if(RatioX[layer][grid_x][grid_v][3]!=0){
922 if(itx==m_mapQ[j][0].end())
924 m_mapQ[j][0][xID+1]=RatioX[layer][grid_x][grid_v][3];
925 Save_Gridx.push_back(grid_x*100+grid_v*10+3);
926 Save_IDx.push_back(j*10000+xID+1);
927 Save_Tx.push_back(
t[i]);
931 double Q = (itx->second) + RatioX[layer][grid_x][grid_v][3];
932 m_mapQ[j][0][xID+1]=Q;
933 Save_Gridx.push_back(grid_x*100+grid_v*10+3);
934 Save_IDx.push_back(j*10000+xID+1);
935 Save_Tx.push_back(
t[i]);
938 vector<int>::iterator result_Sheetx = find(Save_Sheetx.begin(), Save_Sheetx.end(), j*10000+xID+1);
939 if(result_Sheetx==Save_Sheetx.end()){
940 Save_Sheetx.push_back(j*10000+xID+1);
945 if((xID>=0 && vID>=0) && (vID+1)<CgemReadoutPlane->
getNVstrips()) {
946 map<int, double>::iterator itv = m_mapQ[j][1].find(vID+1);
947 if(RatioV[layer][grid_x][grid_v][2]!=0){
948 if(itv==m_mapQ[j][1].end())
950 m_mapQ[j][1][vID+1]=RatioV[layer][grid_x][grid_v][2];
951 Save_Gridv.push_back(grid_x*100+grid_v*10+2);
952 Save_IDv.push_back(j*10000+vID+1);
953 Save_Tv.push_back(
t[i]);
956 double Q = (itv->second) + RatioV[layer][grid_x][grid_v][2];
957 m_mapQ[j][1][vID+1]=Q;
958 Save_Gridv.push_back(grid_x*100+grid_v*10+2);
959 Save_IDv.push_back(j*10000+vID+1);
960 Save_Tv.push_back(
t[i]);
963 vector<int>::iterator result_Sheetv = find(Save_Sheetv.begin(), Save_Sheetv.end(), j*10000+vID+1);
964 if(result_Sheetv==Save_Sheetv.end()){
965 Save_Sheetv.push_back(j*10000+vID+1);
970 if((xID>=0 && vID>=0) && (xID-2)>=0) {
971 map<int, double>::iterator itx = m_mapQ[j][0].find(xID-2);
972 if(RatioX[layer][grid_x][grid_v][0]!=0){
973 if(itx==m_mapQ[j][0].end())
975 m_mapQ[j][0][xID-2]=RatioX[layer][grid_x][grid_v][0];
976 Save_Gridx.push_back(grid_x*100+grid_v*10+0);
977 Save_IDx.push_back(j*10000+xID-2);
978 Save_Tx.push_back(
t[i]);
982 double Q = (itx->second) + RatioX[layer][grid_x][grid_v][0];
983 m_mapQ[j][0][xID-2]=Q;
984 Save_Gridx.push_back(grid_x*100+grid_v*10+0);
985 Save_IDx.push_back(j*10000+xID-2);
986 Save_Tx.push_back(
t[i]);
989 vector<int>::iterator result_Sheetx = find(Save_Sheetx.begin(), Save_Sheetx.end(), j*10000+xID-2);
990 if(result_Sheetx==Save_Sheetx.end()){
991 Save_Sheetx.push_back(j*10000+xID-2);
996 if((xID>=0 && vID>=0) && (xID-1)>=0) {
997 map<int, double>::iterator itx = m_mapQ[j][0].find(xID-1);
998 if(RatioX[layer][grid_x][grid_v][1]!=0){
999 if(itx==m_mapQ[j][0].end())
1001 m_mapQ[j][0][xID-1]=RatioX[layer][grid_x][grid_v][1];
1002 Save_Gridx.push_back(grid_x*100+grid_v*10+1);
1003 Save_IDx.push_back(j*10000+xID-1);
1004 Save_Tx.push_back(
t[i]);
1007 double Q = (itx->second) + RatioX[layer][grid_x][grid_v][1];
1008 m_mapQ[j][0][xID-1]=Q;
1009 Save_Gridx.push_back(grid_x*100+grid_v*10+1);
1010 Save_IDx.push_back(j*10000+xID-1);
1011 Save_Tx.push_back(
t[i]);
1014 vector<int>::iterator result_Sheetx = find(Save_Sheetx.begin(), Save_Sheetx.end(), j*10000+xID-1);
1015 if(result_Sheetx==Save_Sheetx.end()){
1016 Save_Sheetx.push_back(j*10000+xID-1);
1021 if((xID>=0 && vID>=0) && (vID-1)>=0) {
1022 map<int, double>::iterator itv = m_mapQ[j][1].find(vID-1);
1023 if(RatioV[layer][grid_x][grid_v][0]!=0){
1024 if(itv==m_mapQ[j][1].end())
1026 m_mapQ[j][1][vID-1]=RatioV[layer][grid_x][grid_v][0];
1027 Save_Gridv.push_back(grid_x*100+grid_v*10+0);
1028 Save_IDv.push_back(j*10000+vID-1);
1029 Save_Tv.push_back(
t[i]);
1032 double Q = (itv->second) + RatioV[layer][grid_x][grid_v][0];
1033 m_mapQ[j][1][vID-1]=Q;
1034 Save_Gridv.push_back(grid_x*100+grid_v*10+0);
1035 Save_IDv.push_back(j*10000+vID-1);
1036 Save_Tv.push_back(
t[i]);
1039 vector<int>::iterator result_Sheetv = find(Save_Sheetv.begin(), Save_Sheetv.end(), j*10000+vID-1);
1040 if(result_Sheetv==Save_Sheetv.end()){
1041 Save_Sheetv.push_back(j*10000+vID-1);
1055 double Q_threshold = 1.5e-15/1.602176565e-19;
1056 double Q_saturation= 45.e-15/1.602176565e-19;
1057 double Q_resolution= 0.256e-15/1.602176565e-19;
1058 double T_threshold = 12;
1104 m000_nXstrips = m_mapQ[0][0].size() + m_mapQ[1][0].size();
1105 m000_nVstrips = m_mapQ[0][1].size() + m_mapQ[1][1].size();
1110 for(
int i=0; i<Save_Sheetx.size(); i++){
1111 int sheetx_id = Save_Sheetx[i]/10000;
1112 int stripx_id = Save_Sheetx[i]%10000;
1114 Save_FinalstripIDx.push_back(Save_Sheetx[i]);
1116 m000_xstripSheet.push_back(sheetx_id);
1117 m000_xstripID.push_back(stripx_id);
1118 m000_xstripQ.push_back(m_mapQ[sheetx_id][0][stripx_id]);
1122 for(
int i=0; i<Save_Sheetv.size(); i++){
1123 int sheetv_id = Save_Sheetv[i]/10000;
1124 int stripv_id = Save_Sheetv[i]%10000;
1126 Save_FinalstripIDv.push_back(Save_Sheetv[i]);
1127 m000_vstripSheet.push_back(sheetv_id);
1128 m000_vstripID.push_back(stripv_id);
1129 m000_vstripQ.push_back(m_mapQ[sheetv_id][1][stripv_id]);
1238 std::vector<double> xTfirst;
1239 std::vector<double> vTfirst;
1241 for(
int h=0; h<Save_FinalstripIDx.size(); h++){
1242 std::map<int,std::vector<int> > electron_hit_tmp;
1244 const int _up = 1000;
1245 const int _nbins = 2000;
1246 double binsize = (double)(_up-_low)/_nbins;
1247 int sheetx_id = Save_FinalstripIDx[h]/10000;
1248 int stripx_id = Save_FinalstripIDx[h]%10000;
1249 double histX_bin_Content[_nbins];
1250 for(
int i=0; i<_nbins; i++){
1251 histX_bin_Content[i] = 0;
1255 if (isDeadStrip(layer,sheetx_id,0,stripx_id)) {
1256 xTfirst.push_back(Tmin);
1258 m000_xstripT_Branch.push_back(T_th);
1260 m000_xstripQ_Branch.push_back(Qin);
1264 for(
int i=0; i<Save_Gridx.size(); i++){
1268 int z_IDx = Save_IDx[i];
1269 int start_bin = Save_Tx[i]/binsize;
1272 if(z_IDx == Save_FinalstripIDx[h]){
1273 if(Save_Tx[i]<Tmin) Tmin = Save_Tx[i];
1274 if (start_bin<_nbins and start_bin>=0)electron_hit_tmp[Save_Gridx[i]].push_back(start_bin);
1285 for (std::map<
int, std::vector<int> >::iterator it = electron_hit_tmp.begin();
1286 it != electron_hit_tmp.end(); it++) {
1287 std::vector<int> &hitlist = it->second;
1288 const int &Save_Grid = it->first;
1290 if (hitlist.size() < electrons_select_method_threhold) {
1291 conv1PerGrid_legacy(Save_Grid, histX_bin_Content, hitlist, layer, 0);
1293 conv1PerGrid_fft(Save_Grid, histX_bin_Content, hitlist, layer, 0);
1297 xTfirst.push_back(Tmin);
1298 TH1F sig_current(
"current",
"",_nbins,_low,_up);
1299 for(
int i=0;i<_nbins;i++){
1300 sig_current.SetBinContent(i+1,histX_bin_Content[i]);
1309 T_threshold = T_thr_V[layer][sheetx_id][0][stripx_id];
1313 if(flg_xT==0 && fabs(h_signalT.GetBinContent(
init+1))>=fabs(T_threshold)){
1314 T_th = _low+binsize*(
init-1)+fabs(T_threshold-h_signalT.GetBinContent(
init))*binsize/fabs(h_signalT.GetBinContent(
init+1)-h_signalT.GetBinContent(
init))+gRandom->Gaus(0,2);
1315 m000_xstripT_Branch.push_back(T_th);
1321 m000_xstripT_Branch.push_back(T_th);
1323 double V_sampling = 0.;
1331 double T_sample = T_th+sample_delay;
1332 int sample_bin = T_sample/binsize;
1333 double sample_bin_ = T_sample/binsize;
1334 V_sampling = h_signalE.GetBinContent(sample_bin)+(h_signalE.GetBinContent(sample_bin+1)-h_signalE.GetBinContent(sample_bin))*
double(sample_bin_-sample_bin);
1343 if(h_signalE.GetMaximum()>E_thr_V[layer][sheetx_id][0][stripx_id]) over_th=1;
1363 Qin = V_sampling*VQ_slope + VQ_const+gRandom->Gaus(0,m_QinGausSigma[0]);
1364 if(m_saturation&&Qin>Qsaturation[layer][sheetx_id][0][stripx_id])
1366 Qin = Qsaturation[layer][sheetx_id][0][stripx_id];
1377 m000_xstripQ_Branch.push_back(Qin);
1389 for(
int h=0; h<Save_FinalstripIDv.size(); h++){
1390 std::map<int,std::vector<int> > electron_hit_tmp;
1392 const int _up = 1000;
1393 const int _nbins = 2000;
1394 double binsize = (double)(_up-_low)/_nbins;
1395 int sheetv_id = Save_FinalstripIDv[h]/10000;
1396 int stripv_id = Save_FinalstripIDv[h]%10000;
1397 double histV_bin_Content[_nbins];
1398 for(
int i=0; i<_nbins; i++){
1399 histV_bin_Content[i] = 0;
1403 if (isDeadStrip(layer,sheetv_id,1,stripv_id)) {
1404 vTfirst.push_back(Tmin);
1406 m000_vstripT_Branch.push_back(T_th);
1408 m000_vstripQ_Branch.push_back(Qin);
1412 for(
int i=0; i<Save_Gridv.size(); i++){
1416 int z_IDv = Save_IDv[i];
1417 int start_bin = Save_Tv[i]/binsize;
1420 if(z_IDv == Save_FinalstripIDv[h]){
1421 if(Save_Tv[i]<Tmin) Tmin = Save_Tv[i];
1422 if (start_bin<_nbins and start_bin>=0)
1423 electron_hit_tmp[Save_Gridv[i]].push_back(start_bin);
1433 for (std::map<
int,std::vector<int> >::iterator it=electron_hit_tmp.begin();
1434 it !=electron_hit_tmp.end(); it++){
1435 std::vector<int> & hitlist=it->second;
1436 const int & Save_Grid=it->first;
1438 if ( hitlist.size()< electrons_select_method_threhold){
1439 conv1PerGrid_legacy(Save_Grid,histV_bin_Content,hitlist,layer,1);
1442 conv1PerGrid_fft(Save_Grid,histV_bin_Content,hitlist,layer,1);
1448 vTfirst.push_back(Tmin);
1449 TH1F sig_current(
"current",
"",_nbins,_low,_up);
1450 for(
int i=0;i<_nbins;i++){
1451 sig_current.SetBinContent(i+1,histV_bin_Content[i]);
1459 T_threshold = T_thr_V[layer][sheetv_id][1][stripv_id];
1463 if(flg_vT==0 && fabs(h_signalT.GetBinContent(
init+1))>=fabs(T_threshold)){
1464 T_th = _low+binsize*(
init-1)+fabs(T_threshold-h_signalT.GetBinContent(
init))*binsize/fabs(h_signalT.GetBinContent(
init+1)-h_signalT.GetBinContent(
init))+gRandom->Gaus(0,2);
1465 m000_vstripT_Branch.push_back(T_th);
1471 m000_vstripT_Branch.push_back(T_th);
1473 double V_sampling = 0.;
1479 double T_sample = T_th+sample_delay;
1480 int sample_bin = T_sample/binsize;
1481 double sample_bin_ = T_sample/binsize;
1482 V_sampling = h_signalE.GetBinContent(sample_bin)+(h_signalE.GetBinContent(sample_bin+1)-h_signalE.GetBinContent(sample_bin))*
double(sample_bin_-sample_bin);
1490 if(h_signalE.GetMaximum()>E_thr_V[layer][sheetv_id][1][stripv_id]) over_th=1;
1510 Qin = V_sampling*VQ_slope + VQ_const+gRandom->Gaus(0,m_QinGausSigma[1]);
1511 if(m_saturation&&Qin>Qsaturation[layer][sheetv_id][1][stripv_id])
1512 Qin = Qsaturation[layer][sheetv_id][1][stripv_id];
1522 m000_vstripQ_Branch.push_back(Qin);
1537 double q_to_fC_factor = 1.602176565e-4;
1543 for(
int i=0; i<m000_nXstrips; i++){
1544 m_xstripSheet.push_back(m000_xstripSheet[i]);
1545 m_xstripID.push_back(m000_xstripID[i]);
1546 m_xstripQ.push_back(m000_xstripQ[i]*q_to_fC_factor);
1547 m_xstripT_Branch.push_back(m000_xstripT_Branch[i]);
1548 m_xstripQ_Branch.push_back(m000_xstripQ_Branch[i]);
1549 m_xTfirst.push_back(xTfirst[i]);
1554 for(
int i=0; i<m000_nVstrips; i++){
1555 m_vstripSheet.push_back(m000_vstripSheet[i]);
1556 m_vstripID.push_back(m000_vstripID[i]);
1557 m_vstripQ.push_back(m000_vstripQ[i]*q_to_fC_factor);
1558 m_vstripT_Branch.push_back(m000_vstripT_Branch[i]);
1559 m_vstripQ_Branch.push_back(m000_vstripQ_Branch[i]);
1560 m_vTfirst.push_back(vTfirst[i]);
1566 for(
int i=0; i<m000_nXstrips; i++){
1567 if(m000_xstripQ_Branch[i]>=0){
1568 m_xstripSheet.push_back(m000_xstripSheet[i]);
1569 m_xstripID.push_back(m000_xstripID[i]);
1570 m_xstripQ.push_back(m000_xstripQ[i]*q_to_fC_factor);
1571 m_xstripT_Branch.push_back(m000_xstripT_Branch[i]);
1572 m_xstripQ_Branch.push_back(m000_xstripQ_Branch[i]);
1573 m_xTfirst.push_back(xTfirst[i]);
1580 for(
int i=0; i<m000_nVstrips; i++){
1581 if(m000_vstripQ_Branch[i]>=0){
1582 m_vstripSheet.push_back(m000_vstripSheet[i]);
1583 m_vstripID.push_back(m000_vstripID[i]);
1584 m_vstripQ.push_back(m000_vstripQ[i]*q_to_fC_factor);
1585 m_vstripT_Branch.push_back(m000_vstripT_Branch[i]);
1586 m_vstripQ_Branch.push_back(m000_vstripQ_Branch[i]);
1587 m_vTfirst.push_back(vTfirst[i]);
1610void InductionGar::conv1PerGrid_legacy(
int Save_Grid,
double * hist_bin_Content,
1611 const std::vector<int> & hitlist ,
int layer,
int axis
1617 double(&Signal)[3][5][5][4][100] = axis ? SignalV : SignalX;
1621 const int _nbins = 2000;
1622 int z_grid_x = Save_Grid / 100;
1623 int z_grid_v = Save_Grid % 100 / 10;
1624 int z_index = Save_Grid % 10;
1625 for (std::vector<int>::const_iterator it_start_bin = hitlist.begin(); it_start_bin != hitlist.end(); it_start_bin++) {
1626 if (*it_start_bin <0 )
continue;
1627 for (
int addi = *it_start_bin; (addi < *it_start_bin + 160) and (addi < _nbins - 1); addi += 2) {
1628 hist_bin_Content[addi] += Signal[layer][z_grid_x][z_grid_v][z_index][(addi - *it_start_bin) / 2 + 1];
1629 hist_bin_Content[addi + 1] += Signal[layer][z_grid_x][z_grid_v][z_index][(addi - *it_start_bin) / 2 + 1];
1643void InductionGar::conv1PerGrid_fft(
int Save_Grid,
double * hist_bin_Content,
1644 const std::vector<int> & hitlist ,
int layer,
int axis
1646 ConvolveWithConst(&Signal_Convolver)[3][5][5][4] = axis ? Signal_ConvolverV : Signal_ConvolverX;
1648 const int _nbins = 2000;
1649 double hist_tmp[_nbins] = {0};
1650 int z_grid_x = Save_Grid / 100;
1651 int z_grid_v = Save_Grid % 100 / 10;
1652 int z_index = Save_Grid % 10;
1655 double electron_hit_tmp_hist[_nbins] = {0};
1657 for (std::vector<int>::const_iterator it_start_bin = hitlist.begin(); it_start_bin != hitlist.end(); it_start_bin++) {
1658 if(*it_start_bin<_nbins and *it_start_bin>=0) electron_hit_tmp_hist[*it_start_bin] += 1;
1660 Signal_Convolver[layer][z_grid_x][z_grid_v][z_index].
convolve(hist_tmp, electron_hit_tmp_hist, 0, _nbins);
1662#ifdef INDUCTIONGAR_DEBUG_CONV1PERGRID_FFT_TEST
1664 double hist_tmp2[_nbins] = {0};
1665 bool found_mismatch =
false;
1666 const double Accept_Threshold = 1e-5;
1667 const double Accept_Threshold_ref = 1e-5;
1668 conv1PerGrid_legacy(Save_Grid, hist_tmp2, hitlist, layer, axis);
1669 for (
int i = 0; i < _nbins; i++) {
1670 if (
abs(hist_tmp[i] - hist_tmp2[i]) >= Accept_Threshold
1671 and
abs((hist_tmp[i] - hist_tmp2[i]) / hist_tmp2[i]) >= Accept_Threshold_ref
1673 if (not found_mismatch) {
1674 std::cout <<
"CgemDigitizerSvc::InductionGar::conv1PerGrid_fft found results not match: " << endl;
1675 found_mismatch =
true;
1677 std::cout <<
" previous: " << hist_tmp[i] <<
"; new " << hist_tmp2[i] <<
"; at i=" << i << std::endl;
1684 for (
int i = 0; i < _nbins; i++) {
1685 hist_bin_Content[i] += hist_tmp[i];
1688static void checkMemorySize()
1691 gSystem->GetProcInfo(&info);
1692 double currentMemory = info.fMemResident/1024;
1693 cout<<
"CgemDigitizerSvc::InductionGar: current memory size "<<currentMemory<<
" MB"<<endl;
1696bool InductionGar::inMicroSectorGap(
double phi,
int layer)
1698 double dphi=phi+
M_PI;
1699 while(dphi<0) dphi+=2*
M_PI;
1705 if(dphi>
M_PI) i_sheet=1;
1707 double width=m_microSector_width[layer][i_sheet];
1708 int iSector=floor((phi-m_gapShift_microSector[layer][i_sheet])/width);
1711 double dist = ((iSector+1)*width-(phi-m_gapShift_microSector[layer][i_sheet]))*R;
1713 if(dist<m_gap_microSector) in=
true;
1717bool InductionGar::isDeadStrip(
int layer,
int sheet,
int XVview,
int strip)
1719 std::set<int> &deadStrips= m_deadStrip[layer][sheet][XVview];
1721 if (deadStrips.count(strip)==1){
EvtComplex exp(const EvtComplex &c)
double abs(const EvtComplex &c)
TH1F Convolution_Tbranch(const double *Input_Curr_plot_001, double xmin, double xmax, int Npx=2000)
double rectangle2(double t, double *x, double *y, int Npx)
TH1F Convolution_Ebranch(const double *Input_Curr_plot_001, double xmin, double xmax, int Npx=2000)
double rectangle2_fast(double t, double *x, const double *y, int Npx)
calc estimate using linear interpolation of curve {x,y} , at point t; mimic rectangle2() but faster v...
double E_branch2(double t)
double T_branch2(double t)
TH1D Convolution_Ebranch_fft(const double *Input_Curr_plot_001)
return convolve of Input_Curr_plot_001 and T_Branch2, a function; tries to mimic Convolution_Ebranch ...
std::vector< double > EBranch
std::vector< double > TBranch
TH1D Convolution_Tbranch_fft(const double *Input_Curr_plot_001)
return convolve of Input_Curr_plot_001 and T_Branch2, a function; tries to mimic Convolution_Tbranch ...
double getInnerROfGapI() const
int getNumberOfSheet() const
double getDist2ClosestXStripCenter(double phi, int &id)
bool OnThePlane(double phi, double z) const
double getDist2ClosestVStripCenter(G4ThreeVector pos, int &id)
basically, convolve with fft. convolves 1-d. if size of 2 inputs are fixed, it may yield optimal spee...
void init(const double *ConstArray, const int ConstArrayLength, const int Blength, TransformOptimOpt opt=opt_EX, TransformLengthOpt optL=opt_AsShortAsPsb)
void convolve(double *output, const double *B, const int leftIndex, const int sizeofOut, double factor=1) const
do a convolve of stored const A and B, and put results to output.
virtual CgemGeoReadoutPlane * getReadoutPlane(int iLayer, int iSheet) const =0
virtual CgemGeoLayer * getCgemLayer(int i) const =0
void init(ICgemGeomSvc *geomSvc, double magConfig)
void setMultiElectrons(int layer, int nElectrons, const std::vector< Float_t > &x, const std::vector< Float_t > &y, const std::vector< Float_t > &z, const std::vector< Float_t > &t)
complex_t R(double Q2, double M2, double G, double Mp2, double Mm2)