Changeset 5294
- Timestamp:
- 10/20/04 11:48:20 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r5293 r5294 25 25 - fixed a small bug concerning the way the second derivatives are 26 26 calculated. The effect is less than 1% on the time resolution 27 28 * msignal/MExtractTimeFastSpline.cc 29 - comment the search for the half maximum and use the maximum again. 30 The half maximum fails sometimes by 0.5 slices which seems to be 31 some intrinsic behavior of the calibration pulses. 32 The maximum seems to be OK, though. 27 33 28 34 -
trunk/MagicSoft/Mars/msignal/MExtractTimeFastSpline.cc
r4752 r5294 53 53 const Byte_t MExtractTimeFastSpline::fgLoGainLast = 14; 54 54 const Float_t MExtractTimeFastSpline::fgResolution = 0.003; 55 const Float_t MExtractTimeFastSpline::fgRiseTime = 1.5;55 const Float_t MExtractTimeFastSpline::fgRiseTime = 2.; 56 56 57 57 // -------------------------------------------------------------------------- … … 168 168 // Check for saturation in all other slices 169 169 // 170 while ( ++p<end)170 while (p<end) 171 171 { 172 172 if (*p > max) … … 176 176 } 177 177 178 if (*p >= fSaturationLimit)178 if (*p++ >= fSaturationLimit) 179 179 { 180 180 sat++; … … 183 183 } 184 184 185 if (sat) 185 // 186 // allow one saturated slice 187 // 188 if (sat > 1) 186 189 return; 187 190 188 if (maxpos < 2) 189 return; 191 if (maxpos < 1) 192 { 193 time = -999.; 194 return; 195 } 190 196 191 197 Float_t pp; … … 200 206 pp = fHiGainSecondDeriv[i-1] + 4.; 201 207 fHiGainSecondDeriv[i] = -1.0/pp; 202 const Double_t deriv= *(p+1) - 2.* *(p) + *(p-1);203 fHiGainFirstDeriv [i] = (6.0* deriv-fHiGainFirstDeriv[i-1])/pp;208 fHiGainFirstDeriv [i] = *(p+1) - 2.* *(p) + *(p-1); 209 fHiGainFirstDeriv [i] = (6.0*fHiGainFirstDeriv[i]-fHiGainFirstDeriv[i-1])/pp; 204 210 } 205 211 … … 229 235 230 236 // 231 // Search for the maximum, starting in interval maxpos-1. If no maximum is found, go to 232 // interval maxpos+1. 233 // 234 237 // Search for the maximum, starting in interval maxpos-1 in steps of 0.2 till maxpos-0.2. 238 // If no maximum is found, go to interval maxpos+1. 239 // 235 240 Float_t higainklo = fHiGainSecondDeriv[klo]; 236 241 Float_t higainkhi = fHiGainSecondDeriv[khi]; 237 while (x<upper-0.3) 242 243 while ( x < upper - 0.3 ) 238 244 { 239 245 … … 254 260 } 255 261 256 257 if (time > upper-0.1) 262 // 263 // Search for the absolute maximum from maxpos to maxpos+1 in steps of 0.2 264 // 265 if (time > upper-0.1) 258 266 { 259 267 … … 270 278 higainklo = fHiGainSecondDeriv[klo]; 271 279 higainkhi = fHiGainSecondDeriv[khi]; 280 272 281 while (x<upper-0.3) 273 282 { … … 289 298 } 290 299 } 291 292 const Float_t up = time+step-0.055; 293 const Float_t lo = time-step+0.055; 300 301 // 302 // Now, the time, abmax and khicont and klocont are set correctly within the previous precision. 303 // Try a better precision. 304 // 305 const Float_t up = time+step-0.035; 306 const Float_t lo = time-step+0.035; 294 307 const Float_t maxpossave = time; 295 308 296 309 x = time; 297 310 a = upper - x; 298 311 b = x - lower; 299 312 300 step = 0.0 4; // step size of 83 ps313 step = 0.025; // step size of 83 ps 301 314 302 315 higainklo = fHiGainSecondDeriv[klo]; 303 316 higainkhi = fHiGainSecondDeriv[khi]; 304 while (x<up) 317 318 // 319 // First, try from time up to time+0.2 in steps of 83ps. 320 // 321 while ( x < up ) 305 322 { 306 323 … … 322 339 } 323 340 324 if (time < klo + 0.02) 341 342 // 343 // Second, try from time down to time-0.2 in steps of 0.04. 344 // 345 x = maxpossave; 346 // 347 // Test the possibility that the absolute maximum has not been found between 348 // maxpos and maxpos+0.02, then we have to look between maxpos-0.02 and maxpos 349 // which requires new setting of klocont and khicont 350 // 351 if (x < klo + 0.02) 325 352 { 326 353 klo--; … … 332 359 } 333 360 334 x = maxpossave;335 361 a = upper - x; 336 362 b = x - lower; … … 338 364 higainklo = fHiGainSecondDeriv[klo]; 339 365 higainkhi = fHiGainSecondDeriv[khi]; 340 while (x>lo) 366 367 while ( x > lo ) 341 368 { 342 369 … … 360 387 const Float_t halfmax = pedes + (abmax - pedes)/2.; 361 388 389 #if 0 362 390 // 363 391 // Now, loop from the maximum bin leftward down in order to find the position of the half maximum. … … 381 409 klocont = (Float_t)*(first+klo); 382 410 khicont = (Float_t)*(first+klo+1); 383 time = x;384 411 385 412 step = 0.5; … … 415 442 416 443 } 417 418 444 time = (Float_t)fHiGainFirst + x; 419 dtime = fResolution; 445 446 #endif 447 dtime = 0.035; 448 420 449 } 421 450 … … 431 460 const Int_t range = fLoGainLast - fLoGainFirst + 1; 432 461 const Byte_t *end = first + range; 433 Byte_t *p= first;462 Byte_t *p = first; 434 463 Byte_t max = 0; 435 464 Byte_t maxpos = 0; … … 438 467 // Check for saturation in all other slices 439 468 // 440 while ( ++p<end)469 while (p<end) 441 470 { 442 471 if (*p > max) … … 446 475 } 447 476 448 if (*p >= fSaturationLimit)477 if (*p++ >= fSaturationLimit) 449 478 { 450 479 sat++; … … 456 485 return; 457 486 458 if (maxpos < 2)487 if (maxpos < 1) 459 488 return; 460 489
Note:
See TracChangeset
for help on using the changeset viewer.