82 |
|
|
83 |
void CaloLevel0::SetCrossTalk(Bool_t ct){ |
void CaloLevel0::SetCrossTalk(Bool_t ct){ |
84 |
crosst = ct; |
crosst = ct; |
85 |
}; |
} |
86 |
|
|
87 |
void CaloLevel0::SetCrossTalkType(Bool_t ct){ |
void CaloLevel0::SetCrossTalkType(Bool_t ct){ |
88 |
ctground = ct; |
ctground = ct; |
89 |
}; |
} |
90 |
|
|
91 |
void CaloLevel0::SetVerbose(Bool_t ct){ |
void CaloLevel0::SetVerbose(Bool_t ct){ |
92 |
verbose = ct; |
verbose = ct; |
93 |
}; |
} |
94 |
|
|
95 |
|
/** |
96 |
|
* 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 |
* Initialize CaloLevel0 object |
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 |
// |
// |
761 |
}; |
}; |
762 |
// |
// |
763 |
return(0); |
return(0); |
764 |
}; |
} |
765 |
|
|
766 |
|
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++){ |
774 |
|
dexy[l][m][e] = dexyc[l][m][e]; |
775 |
|
}; |
776 |
|
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 |
|
// |
812 |
|
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]; |
|
|
}; |
|
821 |
}; |
}; |
822 |
if ( strip6s >= 9. ){ |
// |
823 |
Double_t arro = base[l][m][pre]/strip6s; |
// compression |
824 |
Float_t deci = 1000.*((float)arro - float(int(arro))); |
// |
825 |
if ( deci < 500. ) { |
// if ( abs((int)(dexy[l][m][e]-calped[l][m][e])) <= (minstrip+rms) ) { |
826 |
arro = double(int(arro)); |
// dexyc[l][m][e] = 0.; |
827 |
} else { |
// } else { |
828 |
arro = 1. + double(int(arro)); |
dexyc[l][m][e] = dexy[l][m][e]; |
829 |
}; |
// }; |
830 |
base[l][m][pre] = arro; |
}; |
831 |
|
// |
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){ |
886 |
// |
// |
887 |
// if it was not a selftrigger event, could it ever been a selftrigger event? if so trigty = 3. |
// if it was not a selftrigger event, could it ever been a selftrigger event? if so trigty = 3. |
888 |
// |
// |
889 |
|
clevel2->nsatstrip = 0.; |
890 |
Int_t val = 0; |
Int_t val = 0; |
891 |
Int_t del = 1100; |
Int_t del = 1100; |
892 |
for (Int_t sec = 0; sec < 4; sec++){ |
for (Int_t sec = 0; sec < 4; sec++){ |
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 |
base[l][m][pre] = de->base[l][m][pre] ; |
// |
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. ) { |
1034 |
|
base[l][m][pre] = de->base[l][m][pre] ; |
1035 |
|
} else { |
1036 |
|
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]; |
1111 |
if ( debug ) printf(" base0 = base l m pre = %f base2 = calbase l m pre = %f \n",base[l][m][pre],calbase[l][m][pre]); |
if ( debug ) printf(" base0 = base l%i m%i pre%i = %f base2 = calbase l m pre = %f \n",l,m,pre,base[l][m][pre],calbase[l][m][pre]); |
1112 |
break; |
break; |
1113 |
case 1: |
case 1: |
1114 |
base0 = base[l][m][ip[i]]; |
base0 = base[l][m][ip[i]]; |
1115 |
base2 = calbase[l][m][ip[i]]; |
base2 = calbase[l][m][ip[i]]; |
1116 |
if ( debug ) printf(" base0 = base l m ip(i) = %f base2 = calbase l m ip(i) = %f \n",base[l][m][ip[i]],calbase[l][m][ip[i]]); |
if ( debug ) printf(" base0 = base l%i m%i ip(i)%i = %f base2 = calbase l m ip(i) = %f \n",l,m,ip[i],base[l][m][ip[i]],calbase[l][m][ip[i]]); |
1117 |
break; |
break; |
1118 |
case 2: |
case 2: |
1119 |
base0 = sbase[l][m][pre]; |
base0 = sbase[l][m][pre]; |
1120 |
base2 = calbase[l][m][pre]; |
base2 = calbase[l][m][pre]; |
1121 |
if ( debug ) printf(" base0 = sbase l m pre = %f base2 = calbase l m pre = %f \n",sbase[l][m][pre],calbase[l][m][pre]); |
if ( debug ) printf(" base0 = sbase l%i m%i pre%i = %f base2 = calbase l m pre = %f \n",l,m,pre,sbase[l][m][pre],calbase[l][m][pre]); |
1122 |
break; |
break; |
1123 |
case 3: |
case 3: |
1124 |
base0 = calbase[l][m][pre]; |
base0 = calbase[l][m][pre]; |
1125 |
base2 = calbase[l][m][pre]; |
base2 = calbase[l][m][pre]; |
1126 |
if ( debug ) printf(" base0 = calbase l m pre = %f base2 = calbase l m pre = %f \n",calbase[l][m][pre],calbase[l][m][pre]); |
if ( debug ) printf(" base0 = calbase l%i m%i pre%i = %f base2 = calbase l m pre = %f \n",l,m,pre,calbase[l][m][pre],calbase[l][m][pre]); |
1127 |
break; |
break; |
1128 |
}; |
}; |
1129 |
base1 = calbase[l][m][pre]; |
base1 = 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 { |
1237 |
if ( clevel1->estrip[j4][m][l] > clevel1->emin ){ |
if ( clevel1->estrip[j4][m][l] > clevel1->emin ){ |
1238 |
// |
// |
1239 |
Float_t savel1 = clevel1->estrip[j4][m][l]; |
Float_t savel1 = clevel1->estrip[j4][m][l]; |
1240 |
if ( dexyc[j4][m][l] == 32767. ) savel1 += 5000.; |
if ( dexyc[l][m][j4] == 32767. ){ |
1241 |
|
savel1 += 5000.; |
1242 |
|
clevel2->nsatstrip += 1.; |
1243 |
|
}; |
1244 |
// |
// |
1245 |
tim = 100000.; |
tim = 100000.; |
1246 |
plo = m; |
plo = m; |
1392 |
memcpy(ca->swerr,clevel2->swerr,sizeof(clevel2->swerr)); |
memcpy(ca->swerr,clevel2->swerr,sizeof(clevel2->swerr)); |
1393 |
memcpy(ca->crc,clevel2->crc,sizeof(clevel2->crc)); |
memcpy(ca->crc,clevel2->crc,sizeof(clevel2->crc)); |
1394 |
ca->nstrip = (Int_t)clevel2->nstrip; |
ca->nstrip = (Int_t)clevel2->nstrip; |
1395 |
|
ca->nsatstrip = (Int_t)clevel2->nsatstrip; |
1396 |
ca->qtot = clevel2->qtot; |
ca->qtot = clevel2->qtot; |
1397 |
// ca->impx = clevel2->impx; |
// ca->impx = clevel2->impx; |
1398 |
// ca->impy = clevel2->impy; |
// ca->impy = clevel2->impy; |
1483 |
clevel2->wartrig = 0.; |
clevel2->wartrig = 0.; |
1484 |
clevel2->good = 0; |
clevel2->good = 0; |
1485 |
clevel2->nstrip = 0.; |
clevel2->nstrip = 0.; |
1486 |
|
clevel2->nsatstrip = 0.; |
1487 |
clevel2->qtot = 0.; |
clevel2->qtot = 0.; |
1488 |
// clevel2->impx = 0.; |
// clevel2->impx = 0.; |
1489 |
// clevel2->impy = 0.; |
// clevel2->impy = 0.; |