- Timestamp:
- 02/25/04 06:31:32 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3291 r3292 20 20 21 21 2004/02/24: Markus Gaug 22 23 * mcalib/MHCalibrationChargeBlindPix.[h,cc] 24 25 - receives a pointer to MCalibrationChargePINDiode which is filled 26 with the results and told to calculate the fluxes in the 27 Finalize function 28 - is filled via MFillH from MExtractBlindPixel 29 30 * mcalib/MCalibrationChargeBlindPix.[h,cc] 31 - new storage container of the blind pxiel resutls, replaces 32 MCalibrationBlindPix 33 34 * mcalib/MCalibrationChargeCalc.[h,cc] 35 36 - does not fill the histograms any more, but does ony the 37 calculations in the postprocess. No pointer to MExtractPINDidoe 38 or MExtractBlindPixel any more. 22 39 23 40 * mcalib/MCalibrationChargePix.cc -
trunk/MagicSoft/Mars/mcalib/CalibLinkDef.h
r3284 r3292 9 9 10 10 #pragma link C++ class MCalibrationChargePix+; 11 #pragma link C++ class MCalibration BlindPix+;11 #pragma link C++ class MCalibrationChargeBlindPix+; 12 12 #pragma link C++ class MCalibrationChargeCam+; 13 13 #pragma link C++ class MCalibrationChargeCalc+; 14 14 #pragma link C++ class MCalibrationChargePINDiode+; 15 15 16 #pragma link C++ class MHCalibrationBlindPixel+; 16 #pragma link C++ class MHCalibrationChargeBlindPix+; 17 #pragma link C++ class MHCalibrationChargeBlindPix+; 17 18 #pragma link C++ class MHCalibrationChargePix+; 18 19 #pragma link C++ class MHCalibrationChargeCam+; -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r3264 r3292 96 96 97 97 #include "MCalibrationChargeCam.h" 98 #include "MCalibrationChargePix.h" 98 99 #include "MCalibrationChargePINDiode.h" 99 #include "MCalibrationCharge Pix.h"100 #include "MCalibrationChargeBlindPix.h" 100 101 101 102 #include "MExtractedSignalCam.h" 102 103 #include "MExtractedSignalPix.h" 103 #include "MExtractedSignalBlindPixel.h" 104 105 #include "MCalibrationBlindPix.h" 104 106 105 107 106 ClassImp(MCalibrationChargeCalc); 108 107 109 108 using namespace std; 110 111 const UInt_t MCalibrationChargeCalc::fgBlindPixelIdx = 559;112 const UInt_t MCalibrationChargeCalc::fgPINDiodeIdx = 9999;113 const UInt_t MCalibrationChargeCalc::fgBlindPixelSinglePheCut = 400;114 109 115 110 // -------------------------------------------------------------------------- … … 120 115 : fPedestals(NULL), fCam(NULL), 121 116 fRawEvt(NULL), fRunHeader(NULL), fEvtTime(NULL), 122 fSignals(NULL), f BlindPixel(NULL), fPINDiode(NULL)117 fSignals(NULL), fPINDiode(NULL), fBlindPixel(NULL) 123 118 { 124 119 … … 132 127 133 128 Clear(); 134 SetBlindPixelIdx();135 SetPINDiodeIdx();136 129 } 137 130 … … 139 132 { 140 133 141 SETBIT(fFlags, kUseBlindPixelFit);142 134 SETBIT(fFlags, kUseQualityChecks); 143 135 SETBIT(fFlags, kHiLoGainCalibration); 144 145 fNumBlindPixelSinglePhe = 0;146 fNumBlindPixelPedestal = 0;147 136 148 137 fNumHiGainSamples = 0; … … 163 152 // they were not found: 164 153 // 165 // - MHCalibrationBlindPixel166 154 // - MCalibrationCam 167 155 // … … 205 193 fCam->SetPINDiode(fPINDiode); 206 194 195 fBlindPixel = (MCalibrationChargeBlindPix*)pList->FindCreateObj("MCalibrationChargeBlindPix"); 196 if (!fBlindPixel) 197 { 198 *fLog << err << dbginf << "MCalibrationChargeBlindPix could not be created ... aborting." << endl; 199 return kFALSE; 200 } 201 202 fCam->SetBlindPixel(fBlindPixel); 203 207 204 fEvtTime = (MTime*)pList->FindObject("MTime"); 208 205 … … 222 219 } 223 220 224 fBlindPixel = (MExtractedSignalBlindPixel*)pList->FindObject("MExtractedSignalBlindPixel");225 if (!fBlindPixel)226 {227 *fLog << err << dbginf << "Cannot find MExtractedSignalBlindPixel ... aborting" << endl;228 return kFALSE;229 }230 231 221 return kTRUE; 232 222 } … … 275 265 fSignals->GetLastUsedSliceLoGain()); 276 266 277 278 // Exclude the blind pixel and the PIN Diode from normal pixel calibration:279 if (i == fBlindPixelIdx)280 pix.SetExcluded();281 282 if (i == fPINDiodeIdx)283 pix.SetExcluded();284 285 267 } 286 268 … … 354 336 Int_t MCalibrationChargeCalc::Process() 355 337 { 356 357 358 MRawEvtPixelIter pixel(fRawEvt);359 360 //361 // Create a loop to fill the calibration histograms362 // Search for: a signal in MExtractedSignalCam363 // Search for: a signal in MExtractedSignalBlindPixel364 // Fill histograms with:365 // charge366 // charge vs. event nr.367 //368 //369 // Initialize pointers to blind pixel and individual pixels370 //371 // FIXME: filling the bind pixel histograms in this class is preliminary372 // and will be replaced soon to fill them with MFillH373 //374 MCalibrationBlindPix &blindpixel = *(fCam->GetBlindPixel());375 MExtractedSignalBlindPixel &blindsig = (*fBlindPixel);376 377 const UInt_t signal = blindsig.GetExtractedSignal();378 379 if (!blindpixel.FillCharge(signal))380 *fLog << warn <<381 "Overflow or Underflow occurred filling Blind Pixel sum = " << signal << endl;382 383 blindpixel.FillGraphs(signal,0);384 385 TH1I *hist;386 387 if (signal > fBlindPixelSinglePheCut)388 {389 hist = (blindpixel.GetHist())->GetHSinglePheFADCSlices();390 fNumBlindPixelSinglePhe++;391 }392 else393 {394 hist = (blindpixel.GetHist())->GetHPedestalFADCSlices();395 fNumBlindPixelPedestal++;396 }397 398 pixel.Jump(fBlindPixelIdx);399 400 const Byte_t *ptr = pixel.GetHiGainSamples();401 402 for (Int_t i=1;i<16;i++)403 hist->Fill(i,*ptr++);404 405 ptr = pixel.GetLoGainSamples();406 for (Int_t i=16;i<31;i++)407 hist->Fill(i,*ptr++);408 409 338 return kTRUE; 410 339 } … … 412 341 Int_t MCalibrationChargeCalc::PostProcess() 413 342 { 414 *fLog << inf << GetDescriptor() << ": Cut Histogram Edges" << endl;415 416 //417 // Fit the blind pixel418 //419 if (TESTBIT(fFlags,kUseBlindPixelFit))420 {421 //422 // Get pointer to blind pixel423 //424 MCalibrationBlindPix &blindpixel = *(fCam->GetBlindPixel());425 426 *fLog << inf << GetDescriptor() << ": Fitting the Blind Pixel" << endl;427 428 //429 // retrieve the histogram containers430 //431 MHCalibrationBlindPixel *hist = blindpixel.GetHist();432 433 //434 // retrieve mean and sigma of the blind pixel pedestal,435 // so that we can use it for the fit436 //437 // FIXME: This part has to be migrated into the future MHCalibrationChargeBlindPix class438 //439 const UInt_t nentries = fPedestals->GetTotalEntries();440 const UInt_t nslices = 12;441 const Float_t sqrslice = TMath::Sqrt((Float_t)nslices);442 443 MPedestalPix &pedpix = (*fPedestals)[fBlindPixelIdx];444 if (&pedpix)445 {446 const Float_t pedestal = pedpix.GetPedestal()*nslices;447 const Float_t pederr = pedpix.GetPedestalRms()*nslices/nentries;448 const Float_t pedsigma = pedpix.GetPedestalRms()*sqrslice;449 const Float_t pedsigmaerr = pederr/2.;450 451 hist->SetMeanPedestal(pedestal);452 hist->SetMeanPedestalErr(pederr);453 hist->SetSigmaPedestal(pedsigma);454 hist->SetSigmaPedestalErr(pedsigmaerr);455 }456 457 if (!blindpixel.FitCharge())458 {459 *fLog << warn << "Could not fit the blind pixel! " << endl;460 *fLog << warn << "Setting bit kBlindPixelMethodValid to FALSE in MCalibrationCam" << endl;461 fCam->SetBlindPixelMethodValid(kFALSE);462 }463 else464 fCam->SetBlindPixelMethodValid(kTRUE);465 466 if (blindpixel.CheckOscillations())467 fCam->SetBlindPixelMethodValid(kFALSE);468 469 TH1I *sphehist = hist->GetHSinglePheFADCSlices();470 TH1I *pedhist = hist->GetHPedestalFADCSlices();471 472 if (fNumBlindPixelSinglePhe > 1)473 sphehist->Scale(1./fNumBlindPixelSinglePhe);474 if (fNumBlindPixelPedestal > 1)475 pedhist->Scale(1./fNumBlindPixelPedestal);476 477 blindpixel.DrawClone();478 }479 else480 *fLog << inf << GetDescriptor() << ": Skipping Blind Pixel Fit " << endl;481 482 *fLog << inf << "total: " << GetNumExecutions() << " sphe: " << fNumBlindPixelSinglePhe << " ped: " << fNumBlindPixelPedestal << endl;483 484 485 *fLog << inf << GetDescriptor() << ": Fitting the Normal Pixels" << endl;486 343 487 344 // 488 345 // loop over the pedestal events and check if we have calibration 489 346 // 347 Int_t nvalid = 0; 490 348 for (Int_t pixid=0; pixid<fPedestals->GetSize(); pixid++) 491 349 { … … 504 362 const Float_t ped = (*fPedestals)[pixid].GetPedestal(); 505 363 const Float_t prms = (*fPedestals)[pixid].GetPedestalRms(); 506 const Int_t num = fPedestals->GetTotalEntries();364 const Float_t num = TMath::Sqrt((Float_t)fPedestals->GetTotalEntries()); 507 365 508 366 // … … 511 369 if (pix.IsHiGainSaturation()) 512 370 { 513 pix.SetPedestal(ped * (Float_t)fNumLoGainSamples,371 pix.SetPedestal(ped * fNumLoGainSamples, 514 372 prms * TMath::Sqrt((Float_t)fNumLoGainSamples), 515 prms * (Float_t)fNumLoGainSamples / num);373 prms * fNumLoGainSamples / num); 516 374 pix.SetNumLoGainSamples((Float_t)fNumLoGainSamples); 517 375 pix.ApplyLoGainConversion(); … … 519 377 else 520 378 { 521 pix.SetPedestal(ped * (Float_t)fNumHiGainSamples,379 pix.SetPedestal(ped * fNumHiGainSamples, 522 380 prms * TMath::Sqrt((Float_t)fNumHiGainSamples), 523 prms * (Float_t)fNumHiGainSamples / num);381 prms * fNumHiGainSamples / num); 524 382 } 525 383 … … 527 385 continue; 528 386 387 nvalid++; 388 529 389 if (!pix.CalcReducedSigma()) 530 390 continue; … … 534 394 } 535 395 536 if (TESTBIT(fFlags,kUseBlindPixelFit) && fCam->IsBlindPixelMethodValid()) 396 // 397 // The Michele check ... 398 // 399 if (nvalid == 0) 537 400 { 538 if (!fCam->CalcFluxInsidePlexiglass()) 539 { 540 *fLog << warn << "Could not calculate the number of photons from the blind pixel " << endl; 541 *fLog << "You can try to calibrate using the MCalibrationChargeCalc::SkipBlindPixelFit()" << endl; 542 fCam->SetBlindPixelMethodValid(kFALSE); 543 } 401 *fLog << err << GetDescriptor() << ": Dear Michele! All pixels have non-valid calibration. " 402 << "Did you forget to fill the histograms (filling MHCalibrationChargeCam from MExtractedSignalCam using MFillH) ? " << endl; 403 return kFALSE; 404 } 405 406 if (!fBlindPixel->CheckChargeFitValidity()) 407 { 408 *fLog << warn << "Could not calculate the flux of photons from the PIN Diode, charge fit not valid " << endl; 409 fCam->SetBlindPixelMethodValid(kFALSE); 544 410 } 545 411 else 546 *fLog << inf << GetDescriptor() << ": Skipping Blind Pixel Calibration! " << endl; 412 { 413 if (!fBlindPixel->CalcFluxInsidePlexiglass()) 414 { 415 *fLog << warn << "Could not calculate the flux of photons from the PIN Diode, will skip PIN Diode Calibration " << endl; 416 fCam->SetBlindPixelMethodValid(kFALSE); 417 } 418 else 419 { 420 fCam->SetBlindPixelMethodValid(kTRUE); 421 fCam->ApplyBlindPixelCalibration(); 422 } 423 } 547 424 548 425 if (!fPINDiode->CheckChargeFitValidity() || !fPINDiode->CheckTimeFitValidity()) … … 561 438 { 562 439 fCam->SetPINDiodeMethodValid(kTRUE); 440 fCam->ApplyPINDiodeCalibration(); 563 441 } 564 442 } … … 571 449 572 450 451 452 453 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h
r3264 r3292 21 21 class MPedestalCam; 22 22 class MCalibrationChargePINDiode; 23 class MCalibrationChargeBlindPix; 23 24 class MCalibrationChargeCam; 24 25 class MGeomCam; 25 26 class MExtractedSignalCam; 26 class MExtractedSignalBlindPixel;27 27 class MTime; 28 28 class MCalibrationChargeCalc : public MTask … … 31 31 private: 32 32 33 static const UInt_t fgBlindPixelIdx; // ID of the blind pixel34 static const UInt_t fgPINDiodeIdx; // ID of the PIN Diode35 static const UInt_t fgBlindPixelSinglePheCut; // FADC sum from which on an event is considered as a S.ph. one.36 37 33 MPedestalCam *fPedestals; //! Pedestals of all pixels in the camera 38 34 MCalibrationChargeCam *fCam; // Calibration events of all pixels in the camera … … 43 39 44 40 MExtractedSignalCam *fSignals; // Extracted signal of all pixels in the camera 45 M ExtractedSignalBlindPixel *fBlindPixel; // Extracted signal of the blind pixel46 MCalibrationCharge PINDiode *fPINDiode; // Calibration events of all pixels in the camera41 MCalibrationChargePINDiode *fPINDiode; // Calibration results of the PIN Diode 42 MCalibrationChargeBlindPix *fBlindPixel; // Calibration results of the Blind Pixel 47 43 48 49 UInt_t fBlindPixelIdx;50 UInt_t fPINDiodeIdx;51 44 52 45 Byte_t fNumHiGainSamples; 53 46 Byte_t fNumLoGainSamples; 54 47 Float_t fSqrtHiGainSamples; 55 56 UInt_t fBlindPixelSinglePheCut;57 58 Int_t fNumBlindPixelSinglePhe;59 Int_t fNumBlindPixelPedestal;60 48 61 49 Float_t fConversionHiLo; … … 65 53 UInt_t fNumExcludedPixels; 66 54 67 enum { kUseBlindPixelFit, 68 kUseQualityChecks, 55 enum { kUseQualityChecks, 69 56 kHiLoGainCalibration }; 70 57 … … 80 67 void Clear(const Option_t *o=""); 81 68 82 void SkipBlindPixelFit(Bool_t b=kTRUE)83 {b ? CLRBIT(fFlags, kUseBlindPixelFit) : SETBIT(fFlags, kUseBlindPixelFit);}84 69 void SkipQualityChecks(Bool_t b=kTRUE) 85 70 {b ? CLRBIT(fFlags, kUseQualityChecks) : SETBIT(fFlags, kUseQualityChecks);} … … 87 72 {b ? CLRBIT(fFlags, kHiLoGainCalibration) : SETBIT(fFlags, kHiLoGainCalibration);} 88 73 89 90 // Setters91 void SetBlindPixelSinglePheCut ( const Int_t cut=fgBlindPixelSinglePheCut)92 { fBlindPixelSinglePheCut = cut; }93 94 void SetPINDiodeIdx( const UInt_t idx=fgPINDiodeIdx ) { fPINDiodeIdx = idx; }95 void SetBlindPixelIdx( const UInt_t idx=fgBlindPixelIdx ) { fBlindPixelIdx = idx; }96 74 97 75 // Exclude pixels from configuration file -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc
r3264 r3292 37 37 // 38 38 // The calculated values (types of GetPixelContent) are: 39 // 40 // -------------------------------------------------------------------------- 41 // 42 // The types are as follows: 39 43 // 40 44 // Fitted values: … … 82 86 // 27: Excluded Pixels 83 87 // 28: Pixels where the fit did not succeed --> results obtained only from the histograms 84 // 29: Pixels with succeeded fit, but apparently wrong results 85 // 30: Pixels with un-expected behavior in the fourier spectrum (e.g. oscillations) 88 // 29: Pixels with apparently wrong results 89 // 30: Pixels with un-expected behavior in the Hi Gain fourier spectrum (e.g. oscillations) 90 // 31: Pixels with un-expected behavior in the Lo Gain fourier spectrum (e.g. oscillations)a 91 // 32: Number of probable pickup events in the Hi Gain 92 // 33: Number of probable pickup events in the Lo Gain 86 93 // 87 94 // Other classifications of pixels: 88 95 // ================================ 89 96 // 90 // 3 1: Pixels with saturated Hi-Gain97 // 34: Pixels with saturated Hi-Gain 91 98 // 92 99 // Classification of validity of the calibrations: 93 100 // =============================================== 94 101 // 95 // 3 2: Pixels with valid calibration by the F-Factor-Method96 // 3 3: Pixels with valid calibration by the Blind Pixel-Method97 // 3 4: Pixels with valid calibration by the PIN Diode-Method102 // 35: Pixels with valid calibration by the F-Factor-Method 103 // 36: Pixels with valid calibration by the Blind Pixel-Method 104 // 37: Pixels with valid calibration by the PIN Diode-Method 98 105 // 99 106 // Used Pedestals: 100 107 // =============== 101 108 // 102 // 3 5: Mean Pedestal over the entire range of signal extraction103 // 3 6: Error on the Mean Pedestal over the entire range of signal extraction104 // 37: Pedestal RMS over the entire range of signal extraction105 // 38: Error on the Pedestal RMS over the entire range of signal extraction109 // 38: Mean Pedestal over the entire range of signal extraction 110 // 39: Error on the Mean Pedestal over the entire range of signal extraction 111 // 40: Pedestal RMS over the entire range of signal extraction 112 // 41: Error on the Pedestal RMS over the entire range of signal extraction 106 113 // 107 114 // Calculated absolute arrival times (very low precision!): 108 115 // ======================================================== 109 116 // 110 // 39: Absolute Arrival time of the signal 111 // 40: Error on the Absolute Arrival time of the signal 112 // 41: RMS of the Absolute Arrival time of the signal 113 // 42: Error on the RMS of the Absolute Arrival time of the signal 117 // 42: Absolute Arrival time of the signal 118 // 43: RMS of the Absolute Arrival time of the signal 114 119 // 115 120 ///////////////////////////////////////////////////////////////////////////// … … 127 132 128 133 #include "MCalibrationChargePix.h" 129 #include "MCalibration BlindPix.h"134 #include "MCalibrationChargeBlindPix.h" 130 135 #include "MCalibrationChargePINDiode.h" 131 136 … … 137 142 const Int_t MCalibrationChargeCam::gkBlindPixelId = 559; 138 143 const Int_t MCalibrationChargeCam::gkPINDiodeId = 9999; 139 const Float_t MCalibrationChargeCam::gkBlindPixelArea = 100;140 // Average QE of Blind Pixel (three colours)141 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelQEGreen = 0.154;142 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelQEBlue = 0.226;143 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelQEUV = 0.247;144 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelQECT1 = 0.247;145 // Average QE Error of Blind Pixel (three colours)146 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelQEGreenErr = 0.015;147 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelQEBlueErr = 0.02;148 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelQEUVErr = 0.02;149 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelQECT1Err = 0.02;150 // Attenuation factor Blind Pixel (three colours)151 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelAttGreen = 1.97;152 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelAttBlue = 1.96;153 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelAttUV = 1.95;154 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelAttCT1 = 1.95;155 144 156 145 // -------------------------------------------------------------------------- … … 174 163 175 164 fPixels = new TClonesArray("MCalibrationChargePix",1); 176 fBlindPixel = new MCalibrationBlindPix();177 165 178 166 Clear(); … … 193 181 // 194 182 delete fPixels; 195 delete fBlindPixel;196 183 197 184 if (fOffsets) … … 272 259 273 260 fPixels->ForEach(TObject, Clear)(); 274 fBlindPixel->Clear();275 276 fMeanFluxInsidePlexiglass = -1.;277 fMeanFluxErrInsidePlexiglass = -1.;278 261 279 262 fNumExcludedPixels = 0; … … 281 264 CLRBIT(fFlags,kBlindPixelMethodValid); 282 265 CLRBIT(fFlags,kPINDiodeMethodValid); 283 CLRBIT(fFlags,kFluxInsidePlexiglassAvailable);284 266 285 267 return; … … 304 286 { 305 287 return TESTBIT(fFlags,kPINDiodeMethodValid); 306 }307 308 309 Bool_t MCalibrationChargeCam::IsFluxInsidePlexiglassAvailable() const310 {311 return TESTBIT(fFlags,kFluxInsidePlexiglassAvailable);312 288 } 313 289 … … 335 311 { 336 312 337 *fLog << all << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- " 338 << pix->GetPedRms() << " Reduced Charge: " << pix->GetMeanCharge() << " +- " 339 << pix->GetSigmaCharge() << " Reduced Sigma: " << pix->GetRSigmaCharge() 340 << " Nr Phe's: " << pix->GetPheFFactorMethod() << endl; 313 *fLog << all << "Pix " << pix->GetPixId() 314 << ": Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr() 315 << " Mean signal: " << pix->GetMeanCharge() << " +- " << pix->GetSigmaCharge() 316 << " Reduced Sigma: " << pix->GetRSigmaCharge() 317 << " Nr Phe's: " << pix->GetPheFFactorMethod() 318 << endl; 341 319 id++; 342 320 } … … 357 335 { 358 336 359 *fLog << all << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- " 360 << pix->GetPedRms() << " Reduced Charge: " << pix->GetMeanCharge() << " +- " 361 << pix->GetSigmaCharge() << " Reduced Sigma: " << pix->GetRSigmaCharge() << endl; 337 338 *fLog << all << "Pix " << pix->GetPixId() 339 << ": Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr() 340 << " Mean signal: " << pix->GetMeanCharge() << " +- " << pix->GetSigmaCharge() 341 << " Reduced Sigma: " << pix->GetRSigmaCharge() 342 << " Nr Phe's: " << pix->GetPheFFactorMethod() 343 << endl; 362 344 id++; 363 345 } … … 377 359 if ( pix->IsOscillating() && !pix->IsExcluded()) 378 360 { 379 380 *fLog << all << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- " 381 << pix->GetPedRms() << " Reduced Charge: " << pix->GetMeanCharge() << " +- " 382 << pix->GetSigmaCharge() << " Reduced Sigma: " << pix->GetRSigmaCharge() << endl; 383 id++; 361 362 *fLog << all << "Pix " << pix->GetPixId() 363 << ": Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr() 364 << " Mean signal: " << pix->GetMeanCharge() << " +- " << pix->GetSigmaCharge() 365 << " Reduced Sigma: " << pix->GetRSigmaCharge() 366 << " Nr Phe's: " << pix->GetPheFFactorMethod() 367 << endl; 368 id++; 384 369 } 385 370 } … … 406 391 407 392 408 // --------------------------------------------------------------------------409 //410 // Sets the user ranges of all histograms such that411 // empty bins at the edges are not used. Additionally, it rebins the412 // histograms such that in total, 50 bins are used.413 //414 void MCalibrationChargeCam::CutEdges()415 {416 417 fBlindPixel->GetHist()->CutAllEdges();418 419 return;420 }421 422 393 // -------------------------------------------------------------------------- 423 394 // … … 468 439 // 27: Excluded Pixels 469 440 // 28: Pixels where the fit did not succeed --> results obtained only from the histograms 470 // 29: Pixels with succeeded fit, butapparently wrong results441 // 29: Pixels with apparently wrong results 471 442 // 30: Pixels with un-expected behavior in the Hi Gain fourier spectrum (e.g. oscillations) 472 443 // 31: Pixels with un-expected behavior in the Lo Gain fourier spectrum (e.g. oscillations)a … … 600 571 if ((*this)[idx].IsExcluded()) 601 572 return kFALSE; 602 val = GetMeanFluxInsidePlexiglass()*area;573 val = fBlindPixel->GetMeanFluxInsidePlexiglass()*area; 603 574 break; 604 575 case 16: 605 576 if ((*this)[idx].IsExcluded()) 606 577 return kFALSE; 607 val = GetMeanFluxInsidePlexiglass()*area;578 val = fBlindPixel->GetMeanFluxErrInsidePlexiglass()*area; 608 579 break; 609 580 case 17: … … 635 606 if ((*this)[idx].IsExcluded()) 636 607 return kFALSE; 637 val = fPINDiode->GetMeanFlux OutsidePlexiglass()*area;608 val = fPINDiode->GetMeanFluxErrOutsidePlexiglass()*area; 638 609 break; 639 610 case 23: … … 673 644 case 29: 674 645 if ((*this)[idx].IsExcluded()) 675 return kFALSE;676 if (!(*this)[idx].IsFitted())677 646 return kFALSE; 678 647 if (!(*this)[idx].IsChargeValid()) … … 784 753 } 785 754 786 787 // -------------------------------------------------------------------------- 788 // 789 // 790 // 791 Bool_t MCalibrationChargeCam::CalcFluxInsidePlexiglass() 792 { 793 794 if (!fBlindPixel->IsFitOK()) 795 return kFALSE; 796 797 const Float_t mean = fBlindPixel->GetLambda(); 798 const Float_t merr = fBlindPixel->GetErrLambda(); 799 800 // 801 // Start calculation of number of photons 802 // 803 // The blind pixel has exactly 100 mm^2 area (with negligible error), 804 // 805 fMeanFluxInsidePlexiglass = mean*gkBlindPixelArea; 806 807 // Start calculation of number of photons relative Variance (!!) 808 fMeanFluxErrInsidePlexiglass = merr*merr/mean/mean; 809 810 switch (fColor) 811 { 812 case kEGreen: 813 fMeanFluxInsidePlexiglass /= gkCalibrationBlindPixelQEGreen; 814 fMeanFluxErrInsidePlexiglass += gkCalibrationBlindPixelQEGreenErr*gkCalibrationBlindPixelQEGreenErr 815 / gkCalibrationBlindPixelQEGreen / gkCalibrationBlindPixelQEGreen; 816 817 fMeanFluxInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttGreen); // correct for absorption 818 // attenuation has negligible error 819 break; 820 case kEBlue: 821 fMeanFluxInsidePlexiglass /= gkCalibrationBlindPixelQEBlue; 822 fMeanFluxErrInsidePlexiglass += gkCalibrationBlindPixelQEBlueErr*gkCalibrationBlindPixelQEBlueErr 823 / gkCalibrationBlindPixelQEBlue / gkCalibrationBlindPixelQEBlue; 824 825 fMeanFluxInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttBlue); // correct for absorption 826 // attenuation has negligible error 827 break; 828 case kEUV: 829 fMeanFluxInsidePlexiglass /= gkCalibrationBlindPixelQEUV; 830 fMeanFluxErrInsidePlexiglass += gkCalibrationBlindPixelQEUVErr*gkCalibrationBlindPixelQEUVErr 831 / gkCalibrationBlindPixelQEUV / gkCalibrationBlindPixelQEUV; 832 833 fMeanFluxInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttUV); // correct for absorption 834 // attenuation has negligible error 835 break; 836 case kECT1: 837 default: 838 fMeanFluxInsidePlexiglass /= gkCalibrationBlindPixelQECT1; 839 fMeanFluxErrInsidePlexiglass += gkCalibrationBlindPixelQECT1Err*gkCalibrationBlindPixelQECT1Err 840 / gkCalibrationBlindPixelQECT1 / gkCalibrationBlindPixelQECT1; 841 842 fMeanFluxInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttCT1); // correct for absorption 843 // attenuation has negligible error 844 break; 845 } 846 847 *fLog << inf << endl; 848 *fLog << inf << " Photon flux [ph/mm^2] inside Plexiglass: " 849 << fMeanFluxInsidePlexiglass << endl; 850 851 if (fMeanFluxInsidePlexiglass > 0.) 852 SETBIT(fFlags,kFluxInsidePlexiglassAvailable); 853 else 854 { 855 CLRBIT(fFlags,kFluxInsidePlexiglassAvailable); 856 return kFALSE; 857 } 858 859 if (fMeanFluxErrInsidePlexiglass < 0.) 860 { 861 *fLog << warn << " Relative Variance on Photon flux inside Plexiglass: " 862 << fMeanFluxErrInsidePlexiglass << endl; 863 CLRBIT(fFlags,kFluxInsidePlexiglassAvailable); 864 return kFALSE; 865 } 866 867 // Finish calculation of errors -> convert from relative variance to absolute error 868 fMeanFluxErrInsidePlexiglass = TMath::Sqrt(fMeanFluxErrInsidePlexiglass); 869 fMeanFluxErrInsidePlexiglass *= fMeanFluxInsidePlexiglass; 870 871 *fLog << inf << " Error on photon flux [ph/mm^2] inside Plexiglass: " 872 << fMeanFluxErrInsidePlexiglass << endl; 873 *fLog << inf << endl; 755 void MCalibrationChargeCam::ApplyBlindPixelCalibration() 756 { 757 758 Float_t flux = fBlindPixel->GetMeanFluxInsidePlexiglass(); 759 Float_t fluxerr = fBlindPixel->GetMeanFluxErrInsidePlexiglass(); 874 760 875 761 TIter Next(fPixels); … … 887 773 const Float_t chargeerr = pix->GetMeanChargeErr(); 888 774 889 const Float_t nphot = f MeanFluxInsidePlexiglass*area;890 const Float_t nphoterr = f MeanFluxErrInsidePlexiglass*area;775 const Float_t nphot = flux * area; 776 const Float_t nphoterr = fluxerr * area; 891 777 const Float_t conversion = nphot/charge; 892 778 Float_t conversionerr; … … 907 793 } 908 794 } 909 return kTRUE;910 795 } 911 796 … … 960 845 Bool_t MCalibrationChargeCam::GetConversionFactorBlindPixel(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma) 961 846 { 962 963 964 if (!IsFluxInsidePlexiglassAvailable())965 if (!CalcFluxInsidePlexiglass())966 return kFALSE;967 847 968 848 mean = (*this)[ipx].GetMeanConversionBlindPixelMethod(); -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h
r3264 r3292 13 13 class TClonesArray; 14 14 15 class MCalibration BlindPix;15 class MCalibrationChargeBlindPix; 16 16 class MCalibrationChargePINDiode; 17 17 class MCalibrationChargePix; … … 22 22 static const Int_t gkBlindPixelId; 23 23 static const Int_t gkPINDiodeId; 24 static const Float_t gkBlindPixelArea; // The Blind Pixel area in mm^225 26 static const Float_t gkCalibrationBlindPixelQEGreen;27 static const Float_t gkCalibrationBlindPixelQEBlue ;28 static const Float_t gkCalibrationBlindPixelQEUV ;29 static const Float_t gkCalibrationBlindPixelQECT1 ;30 31 static const Float_t gkCalibrationBlindPixelQEGreenErr;32 static const Float_t gkCalibrationBlindPixelQEBlueErr ;33 static const Float_t gkCalibrationBlindPixelQEUVErr ;34 static const Float_t gkCalibrationBlindPixelQECT1Err ;35 36 static const Float_t gkCalibrationBlindPixelAttGreen;37 static const Float_t gkCalibrationBlindPixelAttBlue ;38 static const Float_t gkCalibrationBlindPixelAttUV ;39 static const Float_t gkCalibrationBlindPixelAttCT1 ;40 24 41 25 Int_t fNumPixels; 42 26 TClonesArray *fPixels; //-> Array of MCalibrationPix with fit results 43 27 44 MCalibrationBlindPix *fBlindPixel; //->Pointer to the Blind Pixel with fit results28 const MCalibrationChargeBlindPix *fBlindPixel; //! Pointer to the Blind Pixel with fit results 45 29 const MCalibrationChargePINDiode *fPINDiode; //! Pointer to the PIN Diode with fit results 46 30 … … 52 36 TH2D* fOffvsSlope; //! 53 37 54 Float_t fMeanFluxInsidePlexiglass; // The mean number of photons in an INNER PIXEL inside the plexiglass55 Float_t fMeanFluxErrInsidePlexiglass; // The uncertainty about the number of photons in an INNER PIXEL56 57 38 UInt_t fNumExcludedPixels; 58 39 59 40 Byte_t fFlags; 60 41 61 enum { kBlindPixelMethodValid, kPINDiodeMethodValid, kCombinedMethodValid, 62 kFluxInsidePlexiglassAvailable }; 42 enum { kBlindPixelMethodValid, kPINDiodeMethodValid, kCombinedMethodValid }; 63 43 64 44 public: … … 82 62 void SetNumPixelsExcluded( const UInt_t n ) { fNumExcludedPixels = n; } 83 63 void SetGeomCam( const MGeomCam *geom) { fGeomCam = geom; } 84 void SetPINDiode( const MCalibrationChargePINDiode *d ) { fPINDiode = d; } 64 65 void SetPINDiode ( const MCalibrationChargePINDiode *d ) { fPINDiode = d; } 66 void SetBlindPixel( const MCalibrationChargeBlindPix *b ) { fBlindPixel = b; } 85 67 86 68 // Setters only for MC!! … … 89 71 90 72 // Getters 91 Int_t GetSize() const; 92 UInt_t GetNumPixels() const { return fNumPixels; } 93 94 MCalibrationBlindPix *GetBlindPixel() { return fBlindPixel; } 95 const MCalibrationBlindPix *GetBlindPixel() const { return fBlindPixel; } 96 97 Float_t GetMeanFluxInsidePlexiglass() const { return fMeanFluxInsidePlexiglass; } 98 Float_t GetMeanFluxErrInsidePlexiglass() const { return fMeanFluxErrInsidePlexiglass; } 73 Int_t GetSize() const; 74 UInt_t GetNumPixels() const { return fNumPixels; } 99 75 100 76 Bool_t GetConversionFactorFFactor( Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma ); … … 106 82 Bool_t IsPINDiodeMethodValid() const; 107 83 108 Bool_t IsFluxInsidePlexiglassAvailable() const;109 110 84 // Others 111 85 MCalibrationChargePix &operator[](UInt_t i); 112 86 const MCalibrationChargePix &operator[](UInt_t i) const; 113 87 114 void CutEdges();115 88 Bool_t CheckBounds(Int_t i) const; 116 89 … … 125 98 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const; 126 99 127 Bool_t CalcFluxInsidePlexiglass();128 100 void ApplyPINDiodeCalibration(); 101 void ApplyBlindPixelCalibration(); 129 102 130 103 ClassDef(MCalibrationChargeCam, 1) // Container for calibration information of the camera … … 135 108 136 109 110 111 -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.cc
r3289 r3292 317 317 318 318 if (FitSinglePhe()) 319 fBlindPix->Set Fitted(kTRUE);319 fBlindPix->SetSinglePheFitOK(); 320 320 321 321 fBlindPix->SetLambda ( fLambda ); -
trunk/MagicSoft/Mars/mcalib/Makefile
r3284 r3292 41 41 MCalibrationChargeCalc.cc \ 42 42 MCalibrationChargePix.cc \ 43 MCalibration BlindPix.cc \43 MCalibrationChargeBlindPix.cc \ 44 44 MCalibrationChargePINDiode.cc \ 45 45 MCalibrationChargeCam.cc \ 46 MHCalibrationBlindPixel.cc \ 46 MHCalibrationChargeBlindPix.cc \ 47 MHCalibrationChargeBlindPix.cc \ 47 48 MHCalibrationChargePix.cc \ 48 49 MHCalibrationChargeCam.cc \
Note:
See TracChangeset
for help on using the changeset viewer.