95 |
/** |
/** |
96 |
* Initialize CaloLevel0 object |
* Initialize CaloLevel0 object |
97 |
**/ |
**/ |
98 |
|
void CaloLevel0::ProcessingInit(TSQLServer *dbc, UInt_t hs, Int_t &sgnl, TTree *l0tree, Bool_t isdeb, Bool_t isverb){ |
99 |
|
if ( !dbc->IsConnected() ) throw -116; |
100 |
|
this->InitDo(dbc,hs,sgnl,l0tree,isdeb,isverb); |
101 |
|
} |
102 |
|
|
103 |
|
/** |
104 |
|
* Initialize CaloLevel0 object |
105 |
|
**/ |
106 |
void CaloLevel0::ProcessingInit(GL_TABLES *glt, UInt_t hs, Int_t &sgnl, TTree *l0tree, Bool_t isdeb, Bool_t isverb){ |
void CaloLevel0::ProcessingInit(GL_TABLES *glt, UInt_t hs, Int_t &sgnl, TTree *l0tree, Bool_t isdeb, Bool_t isverb){ |
107 |
// |
// |
108 |
const TString host = glt->CGetHost(); |
const TString host = glt->CGetHost(); |
110 |
const TString psw = glt->CGetPsw(); |
const TString psw = glt->CGetPsw(); |
111 |
TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
112 |
if ( !dbc->IsConnected() ) throw -116; |
if ( !dbc->IsConnected() ) throw -116; |
113 |
|
this->InitDo(dbc,hs,sgnl,l0tree,isdeb,isverb); |
114 |
|
dbc->Close(); |
115 |
|
delete dbc; |
116 |
|
} |
117 |
|
|
118 |
|
|
119 |
|
void CaloLevel0::InitDo(TSQLServer *dbc, UInt_t hs, Int_t &sgnl, TTree *l0tree, Bool_t isdeb, Bool_t isverb){ |
120 |
stringstream myquery; |
stringstream myquery; |
121 |
myquery.str(""); |
myquery.str(""); |
122 |
myquery << "SET time_zone='+0:00'"; |
myquery << "SET time_zone='+0:00'"; |
197 |
// |
// |
198 |
delete glcalo; |
delete glcalo; |
199 |
delete glroot; |
delete glroot; |
|
dbc->Close(); |
|
|
delete dbc; |
|
200 |
// |
// |
201 |
return; |
return; |
202 |
// |
// |
213 |
return(sgnl); |
return(sgnl); |
214 |
} |
} |
215 |
|
|
216 |
|
Int_t CaloLevel0::ChkParam(TSQLServer *dbc, UInt_t runheader, Bool_t mechal){ |
217 |
|
Int_t sig = this->ChkParamDo(dbc,runheader,mechal); |
218 |
|
return(sig); |
219 |
|
} |
220 |
|
|
221 |
Int_t CaloLevel0::ChkParam(GL_TABLES *glt, UInt_t runheader, Bool_t mechal){ |
Int_t CaloLevel0::ChkParam(GL_TABLES *glt, UInt_t runheader, Bool_t mechal){ |
222 |
const TString host = glt->CGetHost(); |
const TString host = glt->CGetHost(); |
223 |
const TString user = glt->CGetUser(); |
const TString user = glt->CGetUser(); |
229 |
myquery << "SET time_zone='+0:00'"; |
myquery << "SET time_zone='+0:00'"; |
230 |
dbc->Query(myquery.str().c_str()); |
dbc->Query(myquery.str().c_str()); |
231 |
// |
// |
232 |
|
Int_t sig = this->ChkParamDo(dbc,runheader,mechal); |
233 |
|
dbc->Close(); |
234 |
|
delete dbc; |
235 |
|
return(sig); |
236 |
|
} |
237 |
|
|
238 |
|
Int_t CaloLevel0::ChkParamDo(TSQLServer *dbc, UInt_t runheader, Bool_t mechal){ |
239 |
|
// |
240 |
stringstream calfile; |
stringstream calfile; |
241 |
stringstream bmfile; |
stringstream bmfile; |
242 |
stringstream aligfile; |
stringstream aligfile; |
247 |
// |
// |
248 |
if ( calopar1 || ( ttcalopar1 != 0 && ttcalopar1 < runheader ) ){ |
if ( calopar1 || ( ttcalopar1 != 0 && ttcalopar1 < runheader ) ){ |
249 |
// |
// |
|
// |
|
|
// |
|
250 |
if ( debug ) printf(" calopar1 %i ftcalopar1 %u ttcalopar1 %u runheader %u \n",calopar1,ftcalopar1,ttcalopar1,runheader); |
if ( debug ) printf(" calopar1 %i ftcalopar1 %u ttcalopar1 %u runheader %u \n",calopar1,ftcalopar1,ttcalopar1,runheader); |
251 |
// |
// |
252 |
calopar1 = false; |
calopar1 = false; |
284 |
}; |
}; |
285 |
// |
// |
286 |
if ( calopar2 || ( ttcalopar2 != 0 && ttcalopar2 < runheader ) ){ |
if ( calopar2 || ( ttcalopar2 != 0 && ttcalopar2 < runheader ) ){ |
287 |
|
// |
288 |
if ( debug ) printf(" calopar2 %i ftcalopar2 %u ttcalopar2 %u runheader %u \n",calopar2,ftcalopar2,ttcalopar2,runheader); |
if ( debug ) printf(" calopar2 %i ftcalopar2 %u ttcalopar2 %u runheader %u \n",calopar2,ftcalopar2,ttcalopar2,runheader); |
289 |
calopar2 = false; |
calopar2 = false; |
290 |
// |
// |
392 |
}; |
}; |
393 |
// |
// |
394 |
delete glparam; |
delete glparam; |
|
dbc->Close(); |
|
|
delete dbc; |
|
395 |
// |
// |
396 |
return(0); |
return(0); |
397 |
} |
} |
398 |
|
|
399 |
|
Int_t CaloLevel0::CalcCrossTalkCorr(TSQLServer *dbc, UInt_t runheader){ |
400 |
|
Int_t sig = CalcCrossTalkCorrDo(dbc,runheader); |
401 |
|
return(sig); |
402 |
|
} |
403 |
|
|
404 |
Int_t CaloLevel0::CalcCrossTalkCorr(GL_TABLES *glt, UInt_t runheader){ |
Int_t CaloLevel0::CalcCrossTalkCorr(GL_TABLES *glt, UInt_t runheader){ |
|
// |
|
|
if ( ctground ) return(0); |
|
|
// |
|
405 |
const TString host = glt->CGetHost(); |
const TString host = glt->CGetHost(); |
406 |
const TString user = glt->CGetUser(); |
const TString user = glt->CGetUser(); |
407 |
const TString psw = glt->CGetPsw(); |
const TString psw = glt->CGetPsw(); |
412 |
myquery << "SET time_zone='+0:00'"; |
myquery << "SET time_zone='+0:00'"; |
413 |
dbc->Query(myquery.str().c_str()); |
dbc->Query(myquery.str().c_str()); |
414 |
// |
// |
415 |
|
Int_t sig = CalcCrossTalkCorrDo(dbc,runheader); |
416 |
|
dbc->Close(); |
417 |
|
delete dbc; |
418 |
|
// |
419 |
|
return(sig); |
420 |
|
// |
421 |
|
} |
422 |
|
|
423 |
|
Int_t CaloLevel0::CalcCrossTalkCorrDo(TSQLServer *dbc, UInt_t runheader){ |
424 |
|
// |
425 |
|
if ( ctground ) return(0); |
426 |
|
// |
427 |
stringstream bmfile; |
stringstream bmfile; |
428 |
Int_t error = 0; |
Int_t error = 0; |
429 |
ifstream badfile; |
ifstream badfile; |
651 |
// |
// |
652 |
// |
// |
653 |
delete glp; |
delete glp; |
|
dbc->Close(); |
|
|
delete dbc; |
|
654 |
// |
// |
655 |
// Ok, now we can try to calculate the cross-talk correction for each pre-amplifier |
// Ok, now we can try to calculate the cross-talk correction for each pre-amplifier |
656 |
// |
// |
764 |
} |
} |
765 |
|
|
766 |
void CaloLevel0::FindBaseCompress(Int_t l, Int_t m, Int_t pre){ |
void CaloLevel0::FindBaseCompress(Int_t l, Int_t m, Int_t pre){ |
767 |
|
Int_t n = 0; |
768 |
|
Float_t q = 0; |
769 |
|
this->FindBaseCompress(l,m,pre,n,q); |
770 |
|
} |
771 |
|
|
772 |
|
void CaloLevel0::FindBaseCompress(Int_t l, Int_t m, Int_t pre, Int_t &nst, Float_t &qp){ |
773 |
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
774 |
dexy[l][m][e] = dexyc[l][m][e]; |
dexy[l][m][e] = dexyc[l][m][e]; |
775 |
}; |
}; |
776 |
this->FindBaseRaw(l,m,pre); |
this->FindBaseRaw(l,m,pre,nst,qp); |
777 |
} |
} |
778 |
|
|
779 |
void CaloLevel0::FindBaseRaw(Int_t l, Int_t m, Int_t pre){ |
void CaloLevel0::FindBaseRaw(Int_t l, Int_t m, Int_t pre){ |
780 |
Float_t minstrip = 100000.; |
Int_t n = 0; |
781 |
Float_t rms = 0.; |
Float_t q = 0; |
782 |
|
this->FindBaseRaw(l,m,pre,n,q); |
783 |
|
} |
784 |
|
|
785 |
|
void CaloLevel0::FindBaseRaw(Int_t l, Int_t m, Int_t pre, Int_t &nst, Float_t &qp){ |
786 |
|
// |
787 |
|
Float_t minstrip = 100000.; |
788 |
|
Float_t rms = 0.; |
789 |
|
Int_t process = 0; |
790 |
|
Int_t onlmask[16]; |
791 |
|
memset(onlmask, 0, 16*sizeof(Int_t)); |
792 |
|
// |
793 |
|
while ( process < 2 ){ |
794 |
|
// |
795 |
|
minstrip = 100000.; |
796 |
|
rms = 0.; |
797 |
base[l][m][pre] = 0.; |
base[l][m][pre] = 0.; |
798 |
|
qp = 0.; |
799 |
|
// |
800 |
|
Int_t spos = -1; |
801 |
|
Int_t ee = 0; |
802 |
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
803 |
if ( calgood[l][m][e] == 0. && obadmask[l][m][e] == 0 && dexy[l][m][e]-calped[l][m][e] < minstrip && dexy[l][m][e] > 0.) { |
if ( calgood[l][m][e] == 0. && obadmask[l][m][e] == 0 && dexy[l][m][e]-calped[l][m][e] < minstrip && dexy[l][m][e] > 0. && onlmask[ee] == 0 ) { |
804 |
minstrip = dexy[l][m][e]-calped[l][m][e]; |
minstrip = dexy[l][m][e]-calped[l][m][e]; |
805 |
rms = calthr[l][m][pre]; |
rms = calthr[l][m][pre]; |
806 |
}; |
spos = ee; |
807 |
|
}; |
808 |
|
ee++; |
809 |
|
qp += (dexy[l][m][e]-calped[l][m][e]-sbase[l][m][e]); |
810 |
}; |
}; |
811 |
if ( debug && l==1 ){ |
// |
812 |
printf("\n BASELINE CALCULATION for view %i pl %i pre %i: \n => minstrip %f rms %f \n",l,m,pre,minstrip,rms); |
if ( debug && l==0 ){ |
813 |
|
printf("\n BASELINE CALCULATION for view %i pl %i pre %i: \n => minstrip %f rms %f \n => qp = %f \n",l,m,pre,minstrip,rms,qp); |
814 |
}; |
}; |
815 |
if ( minstrip != 100000. ) { |
if ( minstrip != 100000. ) { |
816 |
Float_t strip6s = 0.; |
Float_t strip6s = 0.; |
817 |
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
818 |
if ( (dexy[l][m][e]-calped[l][m][e]) >= minstrip && (dexy[l][m][e]-calped[l][m][e]) <= (minstrip+rms) ) { |
if ( (dexy[l][m][e]-calped[l][m][e]) >= minstrip && (dexy[l][m][e]-calped[l][m][e]) <= (minstrip+rms) ) { |
819 |
strip6s += 1.; |
strip6s += 1.; |
820 |
base[l][m][pre] += (dexy[l][m][e] - calped[l][m][e]); |
base[l][m][pre] += (dexy[l][m][e] - calped[l][m][e]); |
|
}; |
|
|
// |
|
|
// compression |
|
|
// |
|
|
if ( abs((int)(dexy[l][m][e]-calped[l][m][e])) <= (minstrip+rms) ) { |
|
|
dexyc[l][m][e] = 0.; |
|
|
} else { |
|
|
dexyc[l][m][e] = dexy[l][m][e]; |
|
|
}; |
|
|
}; |
|
|
if ( debug && l==1 ){ |
|
|
printf(" strip6s %f \n",strip6s); |
|
821 |
}; |
}; |
822 |
// if ( strip6s >= 9. ){ |
// |
823 |
if ( strip6s >= 2. ){ |
// compression |
824 |
Double_t arro = base[l][m][pre]/strip6s; |
// |
825 |
Float_t deci = 1000.*((float)arro - float(int(arro))); |
// if ( abs((int)(dexy[l][m][e]-calped[l][m][e])) <= (minstrip+rms) ) { |
826 |
if ( deci < 500. ) { |
// dexyc[l][m][e] = 0.; |
827 |
arro = double(int(arro)); |
// } else { |
828 |
} else { |
dexyc[l][m][e] = dexy[l][m][e]; |
829 |
arro = 1. + double(int(arro)); |
// }; |
830 |
}; |
}; |
831 |
base[l][m][pre] = arro; |
// |
832 |
|
if ( strip6s == 1. && process < 1 ){ |
833 |
|
onlmask[spos] = 1; |
834 |
|
process++; |
835 |
|
continue; |
836 |
|
}; |
837 |
|
process += 2; |
838 |
|
nst = (Int_t)strip6s; |
839 |
|
// |
840 |
|
if ( debug && l==1 ){ |
841 |
|
printf(" strip6s %f \n",strip6s); |
842 |
|
}; |
843 |
|
// if ( strip6s >= 9. ){ |
844 |
|
if ( (strip6s >= 2. && process == 2) || (strip6s >= 9. && process > 2) ){ |
845 |
|
Double_t arro = base[l][m][pre]/strip6s; |
846 |
|
Float_t deci = 1000.*((float)arro - float(int(arro))); |
847 |
|
if ( deci < 500. ) { |
848 |
|
arro = double(int(arro)); |
849 |
} else { |
} else { |
850 |
base[l][m][pre] = 31000.; |
arro = 1. + double(int(arro)); |
|
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
|
|
dexyc[l][m][e] = dexy[l][m][e]; |
|
|
}; |
|
851 |
}; |
}; |
852 |
} else { |
base[l][m][pre] = arro; |
853 |
|
// |
854 |
|
// if too few strips were used to determine the baseline check if it is comparable with the previous event, if not mark it as bad |
855 |
|
// |
856 |
|
if ( debug && l==1 ) printf(" Calculated baseline: base %f sbase*1.02 %f \n",base[l][m][pre],1.02*sbase[l][m][pre]); |
857 |
|
// |
858 |
|
if ( strip6s < 4 && base[l][m][pre] > 1.02*sbase[l][m][pre] && sbase[l][m][pre] > 0. ){ |
859 |
|
if ( debug ) printf(" Suspicious calculated baseline: base %f sbase*1.02 %f strip6s %i \n",base[l][m][pre],1.02*sbase[l][m][pre],(Int_t)strip6s); |
860 |
|
base[l][m][pre] = 31000.; |
861 |
|
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
862 |
|
dexyc[l][m][e] = dexy[l][m][e]; |
863 |
|
}; |
864 |
|
}; |
865 |
|
} else { |
866 |
base[l][m][pre] = 31000.; |
base[l][m][pre] = 31000.; |
867 |
|
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
868 |
|
dexyc[l][m][e] = dexy[l][m][e]; |
869 |
|
}; |
870 |
|
}; |
871 |
|
} else { |
872 |
|
process += 2; |
873 |
|
base[l][m][pre] = 31000.; |
874 |
|
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
875 |
|
dexyc[l][m][e] = dexy[l][m][e]; |
876 |
|
}; |
877 |
}; |
}; |
878 |
|
}; |
879 |
} |
} |
880 |
|
|
881 |
Int_t CaloLevel0::Calibrate(Int_t ei){ |
Int_t CaloLevel0::Calibrate(Int_t ei){ |
933 |
Float_t ener; |
Float_t ener; |
934 |
Int_t doneb = 0; |
Int_t doneb = 0; |
935 |
Int_t donec = 0; |
Int_t donec = 0; |
936 |
Int_t ck = 0; |
Int_t ck[6] = {0,0,0,0,0,0}; |
937 |
Int_t ipre = 0; |
Int_t ipre = 0; |
938 |
Int_t ip[3] = {0}; |
// Int_t ip[3] = {0}; |
939 |
|
Int_t ip[3] = {0,0,0}; |
940 |
Float_t base0, base1, base2; |
Float_t base0, base1, base2; |
941 |
base0 = 0.; |
base0 = 0.; |
942 |
base1 = 0.; |
base1 = 0.; |
1012 |
// |
// |
1013 |
pre = -1; |
pre = -1; |
1014 |
cbase0 = 0.; |
cbase0 = 0.; |
1015 |
|
Int_t nstt[2]; |
1016 |
|
Float_t rqp[2]; |
1017 |
for (Int_t i = 0; i < 3; i++){ |
for (Int_t i = 0; i < 3; i++){ |
1018 |
|
// nstt[0] = 0; // BUG |
1019 |
|
// nstt[1] = 0; // BUG |
1020 |
|
nstt[0] = 1000; |
1021 |
|
nstt[1] = 1000; |
1022 |
|
rqp[0] = 0.; |
1023 |
|
rqp[1] = 0.; |
1024 |
for (Int_t j = 0; j < 2; j++){ |
for (Int_t j = 0; j < 2; j++){ |
1025 |
pre = j + i*2; |
pre = j + i*2; |
1026 |
// |
// |
1027 |
// baseline check and calculation |
// baseline check and calculation |
1028 |
// |
// |
1029 |
if ( !isRAW ){ |
if ( !isRAW ){ |
1030 |
|
// |
1031 |
|
// if it is a compress event with fully transmitted pre try to calculate the baseline |
1032 |
|
// |
1033 |
if ( de->base[l][m][pre] != 0. && de->base[l][m][pre]<31000. ) { |
if ( de->base[l][m][pre] != 0. && de->base[l][m][pre]<31000. ) { |
1034 |
base[l][m][pre] = de->base[l][m][pre] ; |
base[l][m][pre] = de->base[l][m][pre] ; |
1035 |
} else { |
} else { |
1036 |
FindBaseCompress(l,m,pre); |
FindBaseCompress(l,m,pre,nstt[j],rqp[j]); |
1037 |
}; |
}; |
1038 |
cbase0 += base[l][m][pre]; |
cbase0 += base[l][m][pre]; |
1039 |
} else { |
} else { |
1040 |
// |
// |
1041 |
// if it is a raw event and we haven't checked |
// if it is a raw event calculate the baseline. |
|
// yet, calculate the baseline. |
|
1042 |
// |
// |
1043 |
FindBaseRaw(l,m,pre); |
FindBaseRaw(l,m,pre,nstt[j],rqp[j]); |
1044 |
cbase0 += base[l][m][pre]; |
cbase0 += base[l][m][pre]; |
1045 |
}; |
}; |
1046 |
}; |
}; |
1047 |
|
// |
1048 |
|
// if we are able to calculate the baseline with more than 3 strips on one pre and not in the other one choose the pre with more calculated strips |
1049 |
|
// |
1050 |
|
if ( nstt[0] < 4 && nstt[1] >= 4 && nstt[0] != 1000 && nstt[1] != 1000 ) base[l][m][pre-1] = 31000.; |
1051 |
|
if ( nstt[0] >= 4 && nstt[1] < 4 && nstt[0] != 1000 && nstt[1] != 1000 ) base[l][m][pre] = 31000.; |
1052 |
|
// if ( nstt[0] < 4 && nstt[1] >= 4 ) base[l][m][pre-1] = 31000.; // BUG |
1053 |
|
// if ( nstt[0] >= 4 && nstt[1] < 4 ) base[l][m][pre] = 31000.; // BUG |
1054 |
|
// // |
1055 |
|
// // if we are NOT able to calculate the baseline with more than 3 strips on both pres take the baseline (if any) of the one which has less energy |
1056 |
|
// // |
1057 |
|
// if ( nstt[0] < 4 && nstt[1] < 4 ){ |
1058 |
|
// if ( rqp[0] >= rqp[1] ) base[l][m][pre-1] = 31000.; |
1059 |
|
// if ( rqp[0] < rqp[1] ) base[l][m][pre] = 31000.; |
1060 |
|
// }; |
1061 |
}; |
}; |
1062 |
// |
// |
1063 |
// run over strips |
// run over strips |
1068 |
ip[i] = 0; |
ip[i] = 0; |
1069 |
for (Int_t n = i*32 ; n < (i+1)*32 ; n++){ |
for (Int_t n = i*32 ; n < (i+1)*32 ; n++){ |
1070 |
if (n%16 == 0) { |
if (n%16 == 0) { |
|
ck = 0; |
|
1071 |
done = 0; |
done = 0; |
1072 |
doneb = 0; |
doneb = 0; |
1073 |
donec = 0; |
donec = 0; |
1074 |
pre++; |
pre++; |
1075 |
|
ck[pre] = 0; |
1076 |
qpre[pre] = 0.; |
qpre[pre] = 0.; |
1077 |
}; |
}; |
1078 |
// |
// |
1082 |
// |
// |
1083 |
if ( !done ){ |
if ( !done ){ |
1084 |
if ( (base[l][m][pre] == 31000. || base[l][m][pre] == 0.) ){ |
if ( (base[l][m][pre] == 31000. || base[l][m][pre] == 0.) ){ |
1085 |
ck = 1; |
ck[pre] = 1; |
1086 |
if (pre%2 == 0) { |
if (pre%2 == 0) { |
1087 |
ip[i] = pre + 1; |
ip[i] = pre + 1; |
1088 |
} else { |
} else { |
1090 |
}; |
}; |
1091 |
if ( (base[l][m][ip[i]] == 31000. || base[l][m][ip[i]] == 0. || !crosst ) ){ |
if ( (base[l][m][ip[i]] == 31000. || base[l][m][ip[i]] == 0. || !crosst ) ){ |
1092 |
// |
// |
1093 |
ck = 2; |
ck[pre] = 2; |
1094 |
if ( sbase[l][m][pre] == 31000. || sbase[l][m][pre] == 0. ) { |
if ( sbase[l][m][pre] == 31000. || sbase[l][m][pre] == 0. ) { |
1095 |
ck = 3; |
ck[pre] = 3; |
1096 |
}; |
}; |
1097 |
}; |
}; |
1098 |
done = 1; |
// done = 1; |
1099 |
}; |
}; |
1100 |
|
done = 1; |
1101 |
}; |
}; |
1102 |
// |
// |
1103 |
// CALIBRATION ALGORITHM |
// CALIBRATION ALGORITHM |
1104 |
// |
// |
1105 |
if ( !doneb ){ |
if ( !doneb ){ |
1106 |
if ( debug ) printf(" ck is %i \n",ck); |
if ( debug ) printf(" ck[pre] is %i \n",ck[pre]); |
1107 |
switch (ck) { |
switch (ck[pre]) { |
1108 |
case 0: |
case 0: |
1109 |
base0 = base[l][m][pre]; |
base0 = base[l][m][pre]; |
1110 |
base2 = calbase[l][m][pre]; |
base2 = calbase[l][m][pre]; |
1151 |
}; |
}; |
1152 |
}; |
}; |
1153 |
if ( crosst ){ |
if ( crosst ){ |
1154 |
if (ck == 1){ |
if (ck[pre] == 1 || ck[pre-1] == 1){ |
1155 |
if (ip[i]%2 == 0) { |
if (ck[pre] == 1){ |
1156 |
ipre = ip[i] + 1; |
ipre = pre; |
1157 |
|
ip[i] = pre - 1; |
1158 |
} else { |
} else { |
1159 |
ipre = ip[i] - 1; |
ipre = pre - 1; |
1160 |
|
ip[i] = pre; |
1161 |
}; |
}; |
1162 |
|
// if (ip[i]%2 == 0) { |
1163 |
|
// ipre = ip[i] + 1; |
1164 |
|
// } else { |
1165 |
|
// ipre = ip[i] - 1; |
1166 |
|
// }; |
1167 |
for (Int_t j = ipre*16 ; j < (ipre+1)*16 ; j++){ |
for (Int_t j = ipre*16 ; j < (ipre+1)*16 ; j++){ |
1168 |
if ( !ctground ){ |
if ( !ctground ){ |
1169 |
clevel1->estrip[j][m][l] += (qpre[ipre] - qpre[ip[i]]) * ctprecor[l][m][ipre]; |
clevel1->estrip[j][m][l] += qpre[ipre] * ctprecor[l][m][ipre] - qpre[ip[i]] * ctprecor[l][m][ip[i]]; |
1170 |
} else { |
} else { |
1171 |
clevel1->estrip[j][m][l] += (qpre[ipre] - qpre[ip[i]]) * 0.00478; |
clevel1->estrip[j][m][l] += (qpre[ipre] - qpre[ip[i]]) * 0.00478; |
1172 |
}; |
}; |
1173 |
}; |
}; |
1174 |
}; |
}; |
1175 |
if (ck == 2){ |
if (ck[pre] == 2 && ck[pre-1] == 2){ |
1176 |
for (Int_t j = i*32 ; j < (i+1)*32 ; j++){ |
for (Int_t j = i*32 ; j < (i+1)*32 ; j++){ |
1177 |
ipre = j/16 + 1; |
// ipre = j/16 + 1; |
1178 |
|
ipre = j/16 ; |
1179 |
if ( !ctground ){ |
if ( !ctground ){ |
1180 |
clevel1->estrip[j][m][l] += qpre[ipre] * ctprecor[l][m][ipre]; |
clevel1->estrip[j][m][l] += qpre[ipre] * ctprecor[l][m][ipre]; |
1181 |
} else { |
} else { |