Changeset 4581 for trunk/MagicSoft
- Timestamp:
- 08/11/04 16:52:59 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r4579 r4581 39 39 - add SetNamePedPhotEventContainer to change name of pedestal output 40 40 container for run pedestals 41 - add CalibratePedestal, function to calibrate the chosen pedestal 42 - added the calibration types kFlatCharge, kDummy as in MCalibrate 43 44 41 45 * mbadpixels/MBadPixelsCalc.cc: 42 46 - in MBadPixelsCalc::Process() called the MPedPhotCam::ReCalc to 43 calculate the mean values of the pedestal and RMS for the 44 areas 47 calculate the mean values of the pedestal and RMS for the areas 45 48 and sectors of the camera. 46 49 -
trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc
r4579 r4581 230 230 if (TestFlag(kRun)) 231 231 { 232 if (!CalibratePedestal(fPedestal,fPedPhot)) return kFALSE; 233 } 234 235 return kTRUE; 236 } 237 238 239 240 // -------------------------------------------------------------------------- 241 // 242 // Calibrate the Pedestal values 243 // 244 // 245 Bool_t MCalibrateData::CalibratePedestal(MPedestalCam *pedADCCam, MPedPhotCam *pedPhotCam) 246 { 232 247 //--------------------------------------------- 233 248 // fill MPedPhot container using the informations from … … 237 252 238 253 // is pixid equal to pixidx ? 239 if ( (Int_t)( fPedestal->GetSize()) != fSignals->GetSize())254 if ( (Int_t)(pedADCCam->GetSize()) != fSignals->GetSize()) 240 255 { 241 256 *fLog << err << "MCalibrateData::ReInit(); sizes of MPedestalCam and MCalibrationCam are different" … … 243 258 } 244 259 245 *fLog << all << "MCalibrateData::ReInit(); fill MPedPhotCam container" 246 << endl; 247 *fLog << all << " fNumUsedHiGainADCSlices = " 248 << fNumUsedHiGainFADCSlices << endl; 249 *fLog << all << " pixid, calibrationConversionFactor, ped, pedRMS, pedphot, pedphotRMS :" 250 << endl; 251 for (Int_t pixid=0; pixid<fPedestal->GetSize(); pixid++) 252 { 253 const MPedestalPix &ped = (*fPedestal)[pixid]; 260 261 262 for (Int_t pixid=0; pixid<pedADCCam->GetSize(); pixid++) 263 { 264 const MPedestalPix &ped = (*pedADCCam)[pixid]; 254 265 255 266 // pedestals/(used FADC slices) in [ADC] counts … … 263 274 Float_t hiloconverr; 264 275 Float_t calibConv; 276 Float_t calibConvVar; 265 277 Float_t calibFFactor; 266 278 267 279 if ( !GetConversionFactor(pixid, hiloconv, hiloconverr, 268 calibConv, calib FFactor ))280 calibConv, calibConvVar, calibFFactor )) 269 281 continue; 270 282 … … 275 287 Float_t pedphotrms = pedrms * calibConv; 276 288 277 (*fPedPhot)[pixid].Set(pedphot, pedphotrms); 278 279 *fLog << all << pixid << ", " << calibConv << ", " 280 << ped.GetPedestal() << ", " << ped.GetPedestalRms() << ", " 281 << pedphot << ", " << pedphotrms << endl; 289 (*pedPhotCam)[pixid].Set(pedphot, pedphotrms); 290 282 291 } 283 292 284 293 //--------------------------------------------- 285 294 286 fPedPhot->SetReadyToSave(); 287 } 295 pedPhotCam->SetReadyToSave(); 288 296 289 297 return kTRUE; 290 298 } 291 299 300 301 302 303 304 305 292 306 // -------------------------------------------------------------------------- 293 307 // … … 297 311 Bool_t MCalibrateData::GetConversionFactor(UInt_t pixidx, 298 312 Float_t &hiloconv, Float_t &hiloconverr, 299 Float_t &calibConv, Float_t &calib FFactor)313 Float_t &calibConv, Float_t &calibConvVar, Float_t &calibFFactor) 300 314 { 301 315 … … 308 322 hiloconverr = 0.; 309 323 calibConv = 1.; 324 calibConvVar = 0.; 310 325 calibFFactor = 0.; 326 Float_t calibQE = 1.; 327 Float_t calibQEVar = 0.; 328 329 Float_t avMean = 1.; 330 Float_t avMeanRelVar = 0.; 331 332 333 334 if (fCalibrationMode == kFlatCharge) 335 { 336 MCalibrationChargePix &avpix = (MCalibrationChargePix&)fCalibrations->GetAverageArea(0); 337 avMean = avpix.GetMean(); 338 avMeanRelVar = avpix.GetMeanRelVar(); 339 } 340 311 341 312 342 if(fCalibrationMode!=kNone) 313 343 { 314 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCalibrations)[pixidx]; 315 MCalibrationQEPix &qepix = (MCalibrationQEPix&) (*fQEs) [pixidx]; 316 MBadPixelsPix &bad = (*fBadPixels)[pixidx]; 317 318 if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun)) 319 return kFALSE; 320 321 hiloconv = pix.GetConversionHiLo(); 344 345 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCalibrations)[pixidx]; 346 347 hiloconv = pix.GetConversionHiLo (); 322 348 hiloconverr= pix.GetConversionHiLoErr(); 323 324 const Float_t pheConv = pix.GetMeanConvFADC2Phe(); 325 calibFFactor = pix.GetMeanFFactorFADC2Phot(); 326 Float_t calibQE = 1.; 327 349 350 if (fBadPixels) 351 { 352 MBadPixelsPix &bad = (*fBadPixels)[pixidx]; 353 if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun)) 354 return kFALSE; 355 } 356 357 calibConv = pix.GetMeanConvFADC2Phe(); 358 calibConvVar = pix.GetMeanConvFADC2PheVar(); 359 calibFFactor = pix.GetMeanFFactorFADC2Phot(); 360 361 MCalibrationQEPix &qe = (MCalibrationQEPix&) (*fQEs)[pixidx]; 362 328 363 switch(fCalibrationMode) 329 364 { 330 case kBlindPixel: 331 calibQE = qepix.GetQECascadesBlindPixel ( zenith ); 332 // calibQEVar = qepix.GetQECascadesBlindPixelVar( zenith ); 365 case kFlatCharge: 366 calibConv = avMean / pix.GetMean() / fCam->GetPixRatio(pixidx) ; 367 calibConvVar = (avMeanRelVar + pix.GetMeanRelVar()) * calibConv * calibConv; 368 if (pix.IsFFactorMethodValid()) 369 { 370 const Float_t convmin1 = qe.GetQECascadesFFactor(zenith)/pix.GetMeanConvFADC2Phe(); 371 if (convmin1 > 0) 372 calibFFactor *= TMath::Sqrt(convmin1); 373 else 374 calibFFactor = -1.; 375 } 333 376 break; 334 case kFfactor: 335 calibQE = qepix.GetQECascadesFFactor ( zenith ); 336 // calibQEVar = qepix.GetQECascadesFFactorVar( zenith ); 377 case kBlindPixel: 378 if (qe.IsBlindPixelMethodValid()) 379 { 380 calibQE = qe.GetQECascadesBlindPixel ( zenith ); 381 calibQEVar = qe.GetQECascadesBlindPixelVar( zenith ); 382 } 383 else 384 return kFALSE; 337 385 break; 338 default: 339 *fLog << warn << "MCalibrateData::GetConversionFactor; Warning: Calibration mode value ("<<fCalibrationMode<<") not known" << endl; 340 break; 341 } 342 calibConv = pheConv / calibQE; 343 344 } 386 case kPinDiode: 387 if (qe.IsPINDiodeMethodValid()) 388 { 389 calibQE = qe.GetQECascadesPINDiode ( zenith ); 390 calibQEVar = qe.GetQECascadesPINDiodeVar( zenith ); 391 } 392 else 393 return kFALSE; 394 break; 395 case kFfactor: 396 if (pix.IsFFactorMethodValid()) 397 { 398 calibQE = qe.GetQECascadesFFactor ( zenith ); 399 calibQEVar = qe.GetQECascadesFFactorVar( zenith ); 400 } 401 else 402 return kFALSE; 403 break; 404 case kCombined: 405 if (qe.IsCombinedMethodValid()) 406 { 407 calibQE = qe.GetQECascadesCombined ( zenith ); 408 calibQEVar = qe.GetQECascadesCombinedVar( zenith ); 409 } 410 else 411 return kFALSE; 412 break; 413 case kDummy: 414 hiloconv = 1.; 415 hiloconverr = 0.; 416 calibQE = 1.; 417 calibQEVar = 0.; 418 break; 419 420 } /* switch calibration mode */ 421 } /* if(fCalibrationMode!=kNone) */ 422 else 423 { 424 hiloconv = 1.; 425 hiloconverr = 0.; 426 calibConv = 1./fCam->GetPixRatio(pixidx); 427 calibConvVar = 0.; 428 calibFFactor = 0.; 429 calibQE = 1.; 430 calibQEVar = 0.; 431 } 432 433 calibConv /= calibQE; 434 calibConvVar /= calibQE; 435 345 436 346 437 return kTRUE; … … 373 464 Float_t calibrationConversionFactor; 374 465 Float_t calibrationConversionFactorErr; 375 466 Float_t calibFFactor; 467 376 468 for (UInt_t pixidx=0; pixidx<npix; pixidx++) 377 469 { 378 470 if ( !GetConversionFactor(pixidx, hiloconv, hiloconverr, 379 calibrationConversionFactor, calibrationConversionFactorErr ) )471 calibrationConversionFactor, calibrationConversionFactorErr, calibFFactor) ) 380 472 continue; 381 473 … … 403 495 404 496 nphot = signal*calibrationConversionFactor; 405 nphotErr = signal*calibrationConversionFactorErr406 *signal*calibrationConversionFactorErr407 +signalErr*calibrationConversionFactor408 *signalErr*calibrationConversionFactor; 409 410 nphotErr = TMath::Sqrt(nphotErr);497 nphotErr = calibFFactor*TMath::Sqrt(TMath::Abs(nphot)); 498 // nphotErr = signal*calibrationConversionFactorErr 499 // *signal*calibrationConversionFactorErr 500 // +signalErr*calibrationConversionFactor 501 // *signalErr*calibrationConversionFactor; 502 // nphotErr = TMath::Sqrt(nphotErr); 411 503 412 504 MCerPhotPix *cpix = fCerPhotEvt->AddPixel(pixidx, nphot, nphotErr); … … 426 518 if(TestFlag(kEvent)) 427 519 { 428 520 if (!CalibratePedestal(fPedestalFromData,fPedPhotFromData)) return kFALSE; 521 } 522 523 /* 429 524 //--------------------------------------------- 430 525 // fill MPedPhot(FromData) container using the informations from … … 438 533 *fLog << err << "MCalibrateData::ReInit(); sizes of MPedestalCam and MCalibrationCam are different" 439 534 << endl; 440 } 535 } */ 441 536 442 537 /* … … 447 542 *fLog << all << " pixid, calibrationConversionFactor, ped, pedRMS, pedphot, pedphotRMS :" 448 543 << endl; 449 */ 544 */ /* 450 545 for (Int_t pixid=0; pixid<fPedestalFromData->GetSize(); pixid++) 451 546 { … … 486 581 487 582 } 488 583 */ 489 584 490 585 return kTRUE; -
trunk/MagicSoft/Mars/mcalib/MCalibrateData.h
r4579 r4581 61 61 62 62 63 Bool_t CalibratePedestal(MPedestalCam *, MPedPhotCam *); 64 63 65 Bool_t GetConversionFactor(UInt_t, 64 Float_t &, Float_t &, Float_t &, Float_t &); 66 Float_t &, Float_t &, Float_t &, 67 Float_t &, Float_t &); 65 68 66 69 Int_t PreProcess(MParList *pList); … … 70 73 public: 71 74 72 enum CalibrationMode_t{kNone=0,k BlindPixel,kFfactor,kPinDiode,kCombined};75 enum CalibrationMode_t{kNone=0,kFlatCharge=1,kBlindPixel,kFfactor,kPinDiode,kCombined, kDummy}; 73 76 static const CalibrationMode_t kDefault = kBlindPixel; 74 77 … … 96 99 void SetNamePedPhotRunContainer(const char *name) { fNamePedPhotRunContainer = name; } 97 100 void SetNamePedPhotEventContainer(const char *name) { fNamePedPhotEventContainer = name; } 98 101 99 102 100 103 ClassDef(MCalibrateData, 0) // Task to calculate cerenkov photons using calibration constants
Note:
See TracChangeset
for help on using the changeset viewer.