20 declareInterface<ICscStripFitter>(
this);
43 ATH_MSG_DEBUG(
" noiseOption is not among rms/sigma/f001. rms is used for default!!");
60 return StatusCode::SUCCESS;
76 if (
m_idHelperSvc->cscIdHelper().get_channel_hash(stripId, stripHash)) {
78 <<
" the identifier is ");
83 int phisec =
m_idHelperSvc->cscIdHelper().stationPhi(stripId);
84 int station =
m_idHelperSvc->cscIdHelper().stationName(stripId) - 49;
86 int sector = zsec * (2 * phisec - station + 1);
89 int measphi =
m_idHelperSvc->cscIdHelper().measuresPhi(stripId);
107 bool showDetail =
false;
110 ATH_MSG_DEBUG(
" Noise is zero!! DB needs to be fixed for this channel. 4151.06 (3.5ADC) is assigned.");
118 ATH_MSG_DEBUG(
" Pedestal is zero!! DB needs to be fixed for this channel. 2048*1013 (2048ADC) is assigned.");
125 <<
" strHash= " << (
unsigned int)stripHash <<
" zsec:phisec:istation sector " << zsec <<
":"
126 << phisec <<
":" << station <<
" " << sector <<
" wlay:measphi:istr = " << wlay <<
" " << measphi
127 <<
" " << istrip <<
" Charges: " << chgs <<
" (Sample time: " <<
period <<
" ns)");
130 res.phase = samplingPhase;
141 res.charge_beforeBPCorr =
res.charge;
142 res.time_beforeBPCorr =
res.time;
144 if (samplingPhase == 1)
149 bool doPositionCorrection =
false;
154 double parabolapTime[150];
155 for (
int i = 0;
i < 150; ++
i) { parabolapTime[
i] = 0.5 +
i; }
157 double bipolarpTime[150] = {
158 7.2767, 14.6497, 14.9118, 15.3129, 15.5765, 15.8889, 16.2474, 16.6022, 16.9897, 17.3629, 17.7400, 18.2157,
159 18.6235, 19.0662, 19.4730, 19.9940, 20.4652, 20.9776, 21.4932, 22.0852, 22.6554, 23.2433, 23.8237, 24.5097,
160 25.1759, 25.8815, 26.6378, 27.4112, 28.2157, 29.0271, 29.9248, 30.7977, 31.7510, 32.7041, 33.7583, 34.8513,
161 35.9103, 37.1485, 38.3861, 39.7035, 41.0022, 42.3003, 43.6234, 45.0080, 46.3782, 47.7918, 49.1901, 50.6580,
162 52.0537, 53.4410, 54.8608, 56.2165, 57.5229, 58.8066, 60.0287, 61.2283, 62.3879, 63.5055, 64.5241, 65.5107,
163 66.4050, 67.3491, 68.2172, 68.9896, 69.8158, 70.4611, 71.1646, 71.7663, 72.4042, 73.0496, 73.5342, 74.1307,
164 74.5450, 75.0907, 75.6212, 76.0865, 76.8541, 77.6080, 78.4420, 79.2248, 80.0880, 81.0277, 81.9300, 82.9188,
165 83.9960, 85.0072, 86.1661, 87.2706, 88.4430, 89.6940, 90.9562, 92.2918, 93.6533, 95.0087, 96.3996, 97.7745,
166 99.1749, 100.6474, 102.0441, 103.4479, 104.8626, 106.2086, 107.5305, 108.8386, 110.0599, 111.2366, 112.4078, 113.4710,
167 114.5671, 115.5359, 116.4890, 117.3761, 118.1778, 119.0282, 119.7657, 120.4136, 121.1364, 121.8754, 122.4186, 123.0246,
168 123.5694, 124.1640, 124.5444, 125.1546, 125.5514, 126.0263, 126.4062, 126.8301, 127.1727, 127.5432, 127.7796, 128.2254,
169 128.4639, 128.7937, 129.1810, 129.3844, 129.6880, 129.9609, 130.1609, 130.4174, 130.6324, 130.8404, 131.0484, 131.3148,
170 131.5413, 131.6463, 131.8371, 132.1471, 132.1629, 132.3846};
172 double amplCorrValue[150] = {
173 0.0011, 0.0019, 0.0028, 0.0047, 0.0077, 0.0111, 0.0145, 0.0207, 0.0261, 0.0322, 0.0412, 0.0491, 0.0576, 0.0663,
174 0.0749, 0.0830, 0.0875, 0.0912, 0.0929, 0.0931, 0.0920, 0.0901, 0.0875, 0.0841, 0.0800, 0.0756, 0.0711, 0.0663,
175 0.0609, 0.0557, 0.0506, 0.0453, 0.0402, 0.0351, 0.0299, 0.0260, 0.0216, 0.0173, 0.0141, 0.0109, 0.0076, 0.0049,
176 0.0022, 0.0003, -0.0014, -0.0021, -0.0029, -0.0029, -0.0025, -0.0023, -0.0013, 0.0004, 0.0017, 0.0043, 0.0072, 0.0104,
177 0.0141, 0.0181, 0.0232, 0.0277, 0.0338, 0.0387, 0.0451, 0.0514, 0.0582, 0.0648, 0.0720, 0.0787, 0.0855, 0.0924,
178 0.0992, 0.1064, 0.1125, 0.1187, 0.1232, 0.1079, 0.0779, 0.0672, 0.0622, 0.0570, 0.0515, 0.0463, 0.0415, 0.0362,
179 0.0314, 0.0266, 0.0221, 0.0181, 0.0143, 0.0103, 0.0073, 0.0047, 0.0021, 0.0003, -0.0010, -0.0024, -0.0027, -0.0030,
180 -0.0026, -0.0022, -0.0012, 0.0003, 0.0019, 0.0045, 0.0071, 0.0108, 0.0141, 0.0186, 0.0233, 0.0285, 0.0340, 0.0388,
181 0.0451, 0.0512, 0.0575, 0.0645, 0.0715, 0.0788, 0.0856, 0.0924, 0.0992, 0.1064, 0.1126, 0.1186, 0.1236, 0.1283,
182 0.1320, 0.1346, 0.1360, 0.1351, 0.1318, 0.1253, 0.1148, 0.1030, 0.0908, 0.0796, 0.0702, 0.0597, 0.0506, 0.0424,
183 0.0345, 0.0283, 0.0220, 0.0165, 0.0122, 0.0082, 0.0051, 0.0027, 0.0013, 0.0004};
186 for (j = 0; j < 150; j++) {
187 if (
res.time < parabolapTime[j]) {
193 if (j > 0 && j < 149) {
198 double a1 = (bipolarpTime[j] - bipolarpTime[j - 1]);
200 double a2 = (parabolapTime[j - 1] + parabolapTime[j]);
202 double a3 = ((
std::pow(parabolapTime[j + 1], 2) -
std::pow(parabolapTime[j - 1], 2)) * (bipolarpTime[j] - bipolarpTime[j - 1]) -
203 (bipolarpTime[j + 1] - bipolarpTime[j - 1]) * (
std::pow(parabolapTime[j], 2) -
std::pow(parabolapTime[j - 1], 2)));
205 double a4 = (parabolapTime[j - 1] + parabolapTime[j + 1]) *
206 ((parabolapTime[j - 1] - parabolapTime[j + 1]) * (parabolapTime[j - 1] + parabolapTime[j]) +
209 double a5 =
std::pow(parabolapTime[j], 2) -
std::pow(parabolapTime[j - 1], 2);
213 a = (a1 + (a2 * a3 / a4)) / a5;
216 double b1 = (bipolarpTime[j + 1] - bipolarpTime[j - 1]);
217 double b2 =
std::pow(parabolapTime[j], 2) -
std::pow(parabolapTime[j - 1], 2);
218 double b3 =
std::pow(parabolapTime[j + 1], 2) -
std::pow(parabolapTime[j - 1], 2);
219 double b4 = (bipolarpTime[j] - bipolarpTime[j - 1]);
220 double b5 = (parabolapTime[j - 1] + parabolapTime[j + 1]);
221 double b6 = (parabolapTime[j - 1] - parabolapTime[j + 1]) * (parabolapTime[j - 1] + parabolapTime[j]) +
224 b = (b1 * b2 - b3 * b4) / (b5 * b6);
228 c = bipolarpTime[j - 1] -
a *
std::pow(parabolapTime[j - 1], 2) +
b * parabolapTime[j - 1];
232 double correctedTime =
a *
res.time *
res.time +
b *
res.time +
c;
234 if (correctedTime != 0.0) {
235 doPositionCorrection =
true;
237 if (samplingPhase == 0)
res.time = correctedTime;
238 if (samplingPhase == 1)
res.time = correctedTime - 25;
244 if (doPositionCorrection) {
246 for (
l = 0;
l < 150;
l++) {
247 if (
res.time < parabolapTime[
l]) {
253 if (
l > 0 &&
l < 149) {
254 double a_1 = (amplCorrValue[
l] - amplCorrValue[
l - 1]);
255 double a_2 = (parabolapTime[
l - 1] + parabolapTime[
l]);
257 ((
std::pow(parabolapTime[
l + 1], 2) -
std::pow(parabolapTime[
l - 1], 2)) * (amplCorrValue[
l] - amplCorrValue[
l - 1]) -
258 (amplCorrValue[
l + 1] - amplCorrValue[
l - 1]) * (
std::pow(parabolapTime[
l], 2) -
std::pow(parabolapTime[
l - 1], 2)));
259 double a_4 = (parabolapTime[
l - 1] + parabolapTime[
l + 1]) *
260 ((parabolapTime[
l - 1] - parabolapTime[
l + 1]) * (parabolapTime[
l - 1] + parabolapTime[
l]) +
264 double aConst = (a_1 + (a_2 * a_3 / a_4)) / a_5;
266 double b_1 = (amplCorrValue[
l + 1] - amplCorrValue[
l - 1]);
269 double b_4 = (amplCorrValue[
l] - amplCorrValue[
l - 1]);
270 double b_5 = (parabolapTime[
l - 1] + parabolapTime[
l + 1]);
271 double b_6 = (parabolapTime[
l - 1] - parabolapTime[
l + 1]) * (parabolapTime[
l - 1] + parabolapTime[
l]) +
274 double bConst = (b_1 * b_2 - b_3 * b_4) / (b_5 * b_6);
277 double cConst = amplCorrValue[
l - 1] - aConst *
std::pow(parabolapTime[
l - 1], 2) + bConst * parabolapTime[
l - 1];
288 res.time_beforeT0Corr =
res.time;
293 res.time =
res.time_beforeT0Corr - t0base - 12.5 * t0phase;
296 for (
unsigned int i = 0;
i < chgs.size(); ++
i) {
297 if (
m_cscCalibTool->numberOfElectronsToADCCount(stripHash,
int(
ped + chgs[
i])) >= 4090) {
303 if (stripStatusWord & 0
x1) {
306 }
else if ((stripStatusWord >> 1) & 0
x1) {
311 float max = -4090000;
313 for (
unsigned int i = 0;
i < chgs.size(); ++
i) {
322 if (
res.time < -500) {
324 }
else if (
res.time > 500) {
345 res.dcharge = sqrt(
res.dcharge *
res.dcharge + dqprop * dqprop);