| 872 |
Float_t ener; |
Float_t ener; |
| 873 |
Int_t doneb = 0; |
Int_t doneb = 0; |
| 874 |
Int_t donec = 0; |
Int_t donec = 0; |
| 875 |
Int_t ck = 0; |
Int_t ck[6] = {0,0,0,0,0,0}; |
| 876 |
Int_t ipre = 0; |
Int_t ipre = 0; |
| 877 |
Int_t ip[3] = {0}; |
// Int_t ip[3] = {0}; |
| 878 |
|
Int_t ip[3] = {0,0,0}; |
| 879 |
Float_t base0, base1, base2; |
Float_t base0, base1, base2; |
| 880 |
base0 = 0.; |
base0 = 0.; |
| 881 |
base1 = 0.; |
base1 = 0.; |
| 964 |
// baseline check and calculation |
// baseline check and calculation |
| 965 |
// |
// |
| 966 |
if ( !isRAW ){ |
if ( !isRAW ){ |
| 967 |
|
// |
| 968 |
|
// if it is a compress event with fully transmitted pre try to calculate the baseline |
| 969 |
|
// |
| 970 |
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. ) { |
| 971 |
base[l][m][pre] = de->base[l][m][pre] ; |
base[l][m][pre] = de->base[l][m][pre] ; |
| 972 |
} else { |
} else { |
| 1003 |
ip[i] = 0; |
ip[i] = 0; |
| 1004 |
for (Int_t n = i*32 ; n < (i+1)*32 ; n++){ |
for (Int_t n = i*32 ; n < (i+1)*32 ; n++){ |
| 1005 |
if (n%16 == 0) { |
if (n%16 == 0) { |
|
ck = 0; |
|
| 1006 |
done = 0; |
done = 0; |
| 1007 |
doneb = 0; |
doneb = 0; |
| 1008 |
donec = 0; |
donec = 0; |
| 1009 |
pre++; |
pre++; |
| 1010 |
|
ck[pre] = 0; |
| 1011 |
qpre[pre] = 0.; |
qpre[pre] = 0.; |
| 1012 |
}; |
}; |
| 1013 |
// |
// |
| 1017 |
// |
// |
| 1018 |
if ( !done ){ |
if ( !done ){ |
| 1019 |
if ( (base[l][m][pre] == 31000. || base[l][m][pre] == 0.) ){ |
if ( (base[l][m][pre] == 31000. || base[l][m][pre] == 0.) ){ |
| 1020 |
ck = 1; |
ck[pre] = 1; |
| 1021 |
if (pre%2 == 0) { |
if (pre%2 == 0) { |
| 1022 |
ip[i] = pre + 1; |
ip[i] = pre + 1; |
| 1023 |
} else { |
} else { |
| 1025 |
}; |
}; |
| 1026 |
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 ) ){ |
| 1027 |
// |
// |
| 1028 |
ck = 2; |
ck[pre] = 2; |
| 1029 |
if ( sbase[l][m][pre] == 31000. || sbase[l][m][pre] == 0. ) { |
if ( sbase[l][m][pre] == 31000. || sbase[l][m][pre] == 0. ) { |
| 1030 |
ck = 3; |
ck[pre] = 3; |
| 1031 |
}; |
}; |
| 1032 |
}; |
}; |
| 1033 |
done = 1; |
done = 1; |
| 1037 |
// CALIBRATION ALGORITHM |
// CALIBRATION ALGORITHM |
| 1038 |
// |
// |
| 1039 |
if ( !doneb ){ |
if ( !doneb ){ |
| 1040 |
if ( debug ) printf(" ck is %i \n",ck); |
if ( debug ) printf(" ck[pre] is %i \n",ck[pre]); |
| 1041 |
switch (ck) { |
switch (ck[pre]) { |
| 1042 |
case 0: |
case 0: |
| 1043 |
base0 = base[l][m][pre]; |
base0 = base[l][m][pre]; |
| 1044 |
base2 = calbase[l][m][pre]; |
base2 = calbase[l][m][pre]; |
| 1085 |
}; |
}; |
| 1086 |
}; |
}; |
| 1087 |
if ( crosst ){ |
if ( crosst ){ |
| 1088 |
if (ck == 1){ |
if (ck[pre] == 1 || ck[pre-1] == 1){ |
| 1089 |
if (ip[i]%2 == 0) { |
if (ck[pre] == 1){ |
| 1090 |
ipre = ip[i] + 1; |
ipre = pre; |
| 1091 |
|
ip[i] = pre - 1; |
| 1092 |
} else { |
} else { |
| 1093 |
ipre = ip[i] - 1; |
ipre = pre - 1; |
| 1094 |
|
ip[i] = pre; |
| 1095 |
}; |
}; |
| 1096 |
|
// if (ip[i]%2 == 0) { |
| 1097 |
|
// ipre = ip[i] + 1; |
| 1098 |
|
// } else { |
| 1099 |
|
// ipre = ip[i] - 1; |
| 1100 |
|
// }; |
| 1101 |
for (Int_t j = ipre*16 ; j < (ipre+1)*16 ; j++){ |
for (Int_t j = ipre*16 ; j < (ipre+1)*16 ; j++){ |
| 1102 |
if ( !ctground ){ |
if ( !ctground ){ |
| 1103 |
clevel1->estrip[j][m][l] += (qpre[ipre] - qpre[ip[i]]) * ctprecor[l][m][ipre]; |
clevel1->estrip[j][m][l] += (qpre[ipre] - qpre[ip[i]]) * ctprecor[l][m][ip[i]]; |
| 1104 |
} else { |
} else { |
| 1105 |
clevel1->estrip[j][m][l] += (qpre[ipre] - qpre[ip[i]]) * 0.00478; |
clevel1->estrip[j][m][l] += (qpre[ipre] - qpre[ip[i]]) * 0.00478; |
| 1106 |
}; |
}; |
| 1107 |
}; |
}; |
| 1108 |
}; |
}; |
| 1109 |
if (ck == 2){ |
if (ck[pre] == 2 && ck[pre-1] == 2){ |
| 1110 |
for (Int_t j = i*32 ; j < (i+1)*32 ; j++){ |
for (Int_t j = i*32 ; j < (i+1)*32 ; j++){ |
| 1111 |
ipre = j/16 + 1; |
ipre = j/16 + 1; |
| 1112 |
if ( !ctground ){ |
if ( !ctground ){ |