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]);