Changeset 4639 for trunk/MagicSoft
- Timestamp:
- 08/17/04 09:39:23 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r4637 r4639 21 21 22 22 23 2004/08/17: Thomas Bretz 24 25 * mcalib/MCalibrateData.[h,cc]: 26 - unrolled some if-else statements to accelerate the algorithm a 27 bit (it is just the bottelneck of calibrating the signal) 28 - made sure that code which in not needed is not executed in 29 this case 30 31 32 23 33 2004/08/16: Thomas Bretz 24 34 … … 26 36 - change to support also 'No calibration of data' 27 37 - removed obsolete dependancie on *'FromData' containers 38 39 * mcalib/MCalibrateData.[h,cc], mbadpixels/MBadPixelsCalc.[h,cc]: 28 40 - added member function ReadEnv 29 41 -
trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc
r4635 r4639 331 331 // MPedestalCam, MExtractedSignalCam and MCalibrationCam 332 332 // 333 const Float_t slices = fSignals->GetNumUsedHiGainFADCSlices(); 333 const Float_t slices = fSignals->GetNumUsedHiGainFADCSlices(); 334 const Float_t sqrtslices = TMath::Sqrt(slices); 334 335 335 336 // is pixid equal to pixidx ? … … 347 348 // pedestals/(used FADC slices) in [ADC] counts 348 349 const Float_t pedes = ped.GetPedestal() * slices; 349 const Float_t pedrms = ped.GetPedestalRms() * TMath::Sqrt(slices);350 const Float_t pedrms = ped.GetPedestalRms() * sqrtslices; 350 351 351 352 // … … 382 383 Float_t &calibConv, Float_t &calibConvVar, Float_t &calibFFactor) 383 384 { 384 // 385 // For the moment, we use only a dummy zenith for the calibration: 386 // 387 const Float_t zenith = -1.; 388 389 hiloconv = 1.; 390 hiloconverr = 0.; 391 calibConv = 1.; 392 calibConvVar = 0.; 393 calibFFactor = 0.; 394 Float_t calibQE = 1.; 395 Float_t calibQEVar = 0.; 396 Float_t avMean = 1.; 397 Float_t avMeanRelVar = 0.; 398 399 if (fCalibrationMode == kFlatCharge) 400 { 401 MCalibrationChargePix &avpix = (MCalibrationChargePix&)fCalibrations->GetAverageArea(0); 402 avMean = avpix.GetMean(); 403 avMeanRelVar = avpix.GetMeanRelVar(); 404 } 405 406 407 if(fCalibrationMode!=kNone) 408 { 409 410 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCalibrations)[pixidx]; 411 412 hiloconv = pix.GetConversionHiLo (); 413 hiloconverr= pix.GetConversionHiLoErr(); 414 415 if (fBadPixels) 416 { 417 MBadPixelsPix &bad = (*fBadPixels)[pixidx]; 418 if (bad.IsUnsuitable()) 419 return kFALSE; 420 } 421 422 calibConv = pix.GetMeanConvFADC2Phe(); 423 calibConvVar = pix.GetMeanConvFADC2PheVar(); 424 calibFFactor = pix.GetMeanFFactorFADC2Phot(); 425 426 MCalibrationQEPix &qe = (MCalibrationQEPix&) (*fQEs)[pixidx]; 427 428 switch(fCalibrationMode) 385 // 386 // For the moment, we use only a dummy zenith for the calibration: 387 // 388 const Float_t zenith = -1.; 389 390 hiloconv = 1.; 391 hiloconverr = 0.; 392 calibConv = 1.; 393 calibConvVar = 0.; 394 calibFFactor = 0.; 395 396 Float_t calibQE = 1.; 397 Float_t calibQEVar = 0.; 398 399 if(fCalibrationMode!=kNone) 400 { 401 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCalibrations)[pixidx]; 402 403 hiloconv = pix.GetConversionHiLo (); 404 hiloconverr= pix.GetConversionHiLoErr(); 405 406 if (fBadPixels) 407 { 408 MBadPixelsPix &bad = (*fBadPixels)[pixidx]; 409 if (bad.IsUnsuitable()) 410 return kFALSE; 411 } 412 413 calibConv = pix.GetMeanConvFADC2Phe(); 414 calibConvVar = pix.GetMeanConvFADC2PheVar(); 415 calibFFactor = pix.GetMeanFFactorFADC2Phot(); 416 417 MCalibrationQEPix &qe = (MCalibrationQEPix&) (*fQEs)[pixidx]; 418 419 switch(fCalibrationMode) 429 420 { 430 421 case kFlatCharge: 431 calibConv = avMean / pix.GetMean() / fGeomCam->GetPixRatio(pixidx) ;432 calibConvVar = (avMeanRelVar + pix.GetMeanRelVar()) * calibConv * calibConv;433 if (pix.IsFFactorMethodValid())434 422 { 435 const Float_t convmin1 = qe.GetQECascadesFFactor(zenith)/pix.GetMeanConvFADC2Phe(); 436 if (convmin1 > 0) 437 calibFFactor *= TMath::Sqrt(convmin1); 438 else 439 calibFFactor = -1.; 423 MCalibrationChargePix &avpix = (MCalibrationChargePix&)fCalibrations->GetAverageArea(0); 424 calibConv = avpix.GetMean() / (pix.GetMean() * fGeomCam->GetPixRatio(pixidx)); 425 calibConvVar = (avpix.GetMeanRelVar() + pix.GetMeanRelVar()) * calibConv * calibConv; 426 if (pix.IsFFactorMethodValid()) 427 { 428 const Float_t convmin1 = qe.GetQECascadesFFactor(zenith)/pix.GetMeanConvFADC2Phe(); 429 if (convmin1 > 0) 430 calibFFactor *= TMath::Sqrt(convmin1); 431 else 432 calibFFactor = -1.; 433 } 440 434 } 441 break; 435 break; 436 442 437 case kBlindPixel: 443 if (qe.IsBlindPixelMethodValid()) 444 { 445 calibQE = qe.GetQECascadesBlindPixel ( zenith ); 446 calibQEVar = qe.GetQECascadesBlindPixelVar( zenith ); 447 } 448 else 449 return kFALSE; 450 break; 438 if (!qe.IsBlindPixelMethodValid()) 439 return kFALSE; 440 calibQE = qe.GetQECascadesBlindPixel ( zenith ); 441 calibQEVar = qe.GetQECascadesBlindPixelVar( zenith ); 442 break; 443 451 444 case kPinDiode: 452 if (qe.IsPINDiodeMethodValid()) 453 { 454 calibQE = qe.GetQECascadesPINDiode ( zenith ); 455 calibQEVar = qe.GetQECascadesPINDiodeVar( zenith ); 456 } 457 else 458 return kFALSE; 459 break; 445 if (!qe.IsPINDiodeMethodValid()) 446 return kFALSE; 447 calibQE = qe.GetQECascadesPINDiode ( zenith ); 448 calibQEVar = qe.GetQECascadesPINDiodeVar( zenith ); 449 break; 450 460 451 case kFfactor: 461 if (pix.IsFFactorMethodValid()) 462 { 463 calibQE = qe.GetQECascadesFFactor ( zenith ); 464 calibQEVar = qe.GetQECascadesFFactorVar( zenith ); 465 } 466 else 467 return kFALSE; 468 break; 452 if (!pix.IsFFactorMethodValid()) 453 return kFALSE; 454 calibQE = qe.GetQECascadesFFactor ( zenith ); 455 calibQEVar = qe.GetQECascadesFFactorVar( zenith ); 456 break; 457 469 458 case kCombined: 470 if (qe.IsCombinedMethodValid()) 471 { 472 calibQE = qe.GetQECascadesCombined ( zenith ); 473 calibQEVar = qe.GetQECascadesCombinedVar( zenith ); 474 } 475 else 476 return kFALSE; 477 break; 459 if (!qe.IsCombinedMethodValid()) 460 return kFALSE; 461 calibQE = qe.GetQECascadesCombined ( zenith ); 462 calibQEVar = qe.GetQECascadesCombinedVar( zenith ); 463 break; 464 478 465 case kDummy: 479 hiloconv = 1.; 480 hiloconverr = 0.; 481 break; 482 466 hiloconv = 1.; 467 hiloconverr = 0.; 468 break; 483 469 } /* switch calibration mode */ 484 470 } /* if(fCalibrationMode!=kNone) */ 485 else 486 { 487 calibConv = 1./fGeomCam->GetPixRatio(pixidx); 488 } 489 490 calibConv /= calibQE; 491 492 if (calibConv != 0. && calibQE != 0.) 493 { 494 calibConvVar = calibConvVar/calibConv/calibConv + calibQEVar/calibQE/calibQE; 495 calibConvVar *= calibConv*calibConv; 496 } 497 498 return kTRUE; 471 else 472 { 473 calibConv = 1./fGeomCam->GetPixRatio(pixidx); 474 } 475 476 calibConv /= calibQE; 477 478 if (calibConv != 0. && calibQE != 0.) 479 { 480 const Float_t calibConv2 = calibConv*calibConv; 481 calibConvVar = calibConvVar/calibConv2 + calibQEVar/(calibQE*calibQE); 482 calibConvVar *= calibConv2; 483 } 484 485 return kTRUE; 499 486 } 500 487 501 488 void MCalibrateData::CalibrateData() 502 489 { 503 UInt_t npix = fSignals->GetSize();490 const UInt_t npix = fSignals->GetSize(); 504 491 505 492 Float_t hiloconv; … … 515 502 continue; 516 503 517 MExtractedSignalPix &sig = (*fSignals)[pixidx];518 519 Float_t signal ;504 const MExtractedSignalPix &sig = (*fSignals)[pixidx]; 505 506 Float_t signal = 0; 520 507 Float_t signalErr = 0.; 521 Float_t nphot,nphotErr;522 508 523 509 if (sig.IsLoGainUsed()) … … 528 514 else 529 515 { 530 if (sig.GetExtractedSignalHiGain() > 9999.) 531 { 532 signal = 0.; 533 signalErr = 0.; 534 } 535 else 516 if (sig.GetExtractedSignalHiGain() <= 9999.) 536 517 signal = sig.GetExtractedSignalHiGain(); 537 518 } 538 519 539 nphot = signal*calibrationConversionFactor;540 nphotErr = calibFFactor*TMath::Sqrt(TMath::Abs(nphot));520 const Float_t nphot = signal*calibrationConversionFactor; 521 const Float_t nphotErr = calibFFactor*TMath::Sqrt(TMath::Abs(nphot)); 541 522 542 523 //
Note:
See TracChangeset
for help on using the changeset viewer.