- Timestamp:
- 12/18/03 17:26:36 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2715 r2716 12 12 * manalysis/MCalibrationPix.cc 13 13 - introduced error calculation for the F-Factor method 14 14 15 * macros/calibration.C 16 - display now the errors in the F-Factor method correctly 15 17 16 18 2003/12/18: Abelardo Moralejo -
trunk/MagicSoft/Mars/manalysis/MCalibrationCam.h
r2679 r2716 99 99 UInt_t GetNumPixels() const { return fNumPixels; } 100 100 101 Bool_t IsPixelUsed(Int_t idx) const; 102 Bool_t IsPixelFitted(Int_t idx) const; 101 Bool_t IsPixelUsed(Int_t idx) const; 102 Bool_t IsPixelFitted(Int_t idx) const; 103 Bool_t IsPixelFitValid(Int_t idx) const; 103 104 104 105 MCalibrationPix &operator[](Int_t i); … … 114 115 void DrawPixelContent(Int_t num) const; 115 116 116 MCalibrationPix *GetCalibrationPix(Int_t idx) const; 117 MCalibrationBlindPix *GetBlindPixel() const { return fBlindPixel; } 118 MCalibrationPINDiode *GetPINDiode() const { return fPINDiode; } 117 MCalibrationBlindPix *GetBlindPixel() const { return fBlindPixel; } 118 MCalibrationPINDiode *GetPINDiode() const { return fPINDiode; } 119 119 120 120 void SetColor(CalibrationColor_t color) { fColor = color; } -
trunk/MagicSoft/Mars/manalysis/MCalibrationConfig.h
r2679 r2716 17 17 18 18 // The conversion factor between High Gain and Low Gain 19 const Float_t gkConversionHiLo = 10.; 19 const Float_t gkConversionHiLo = 10.; 20 const Float_t gkConversionHiLoError = 2.5; 20 21 21 22 // The penalty constant to produce overflow in the histogram … … 40 41 41 42 // 42 // Area of Inner Pixel w.r.t. Blind Pixel (which is 1 cm²)43 // Area of Inner Pixel w.r.t. Blind Pixel (which is 1 sq. cm) 43 44 // 44 45 // Hexagone of diagonal axis b = 3.5 cm 45 46 // straight axis a = 3.0 cm +- 2% 46 // Area = sqrt(3)*a ²/2 = 7.79 cm² +- 4% = 7.8 +- 0.3 cm²47 // Area = sqrt(3)*a*a/2 = 7.79 sq.cm +- 4% = 7.8 +- 0.3 sq.cm 47 48 // 48 49 const Float_t gkCalibrationInnerPixelArea = 7.8; … … 53 54 // Hexagone of diagonal axis b = 7.0 cm 54 55 // straight axis a = 6.0 cm +- 1% 55 // Area = sqrt(3)*a ²/2 =56 // Area = sqrt(3)*a*a/2 = 56 57 // 57 58 const Float_t gkCalibrationOutervsInnerPixelArea = 4.00; … … 68 69 // Hexagone of diagonal axis b = 3.5 cm 69 70 // straight axis a = 3.0 cm +- 2% 70 // Area = sqrt(3)*a ²/2 = 7.79 cm² +- 4% = 7.8 +- 0.3 cm²71 // Area = sqrt(3)*a*a/2 = 7.79 sq.cm +- 4% = 7.8 +- 0.3 sq.cm 71 72 // 72 73 // Distance of PIN Diode to pulser D1: 1.5 +- 0.3 m … … 74 75 // 75 76 // 76 // A(Inner Pixel) D1 ²77 // conversion C = -------------- * ----- = 0.05478 // A(PIN Diode) D2 ²77 // A(Inner Pixel) D1*D1 78 // conversion C = -------------- * ------ = 0.054 79 // A(PIN Diode) D2*D2 79 80 // 80 81 // Delta C / C = sqrt((Delta A(IP)/A(IP))² + 4 * ( (Delta D1/D1)² + (Delta D2/D2)² ) -
trunk/MagicSoft/Mars/manalysis/MCalibrationPix.cc
r2699 r2716 32 32 ///////////////////////////////////////////////////////////////////////////// 33 33 #include "MCalibrationPix.h" 34 #include "MCalibrationConfig.h" 34 35 35 36 #include "MLog.h" … … 54 55 fPed(-1.), 55 56 fPedRms(-1.), 57 fErrPedRms(0.), 58 fElectronicPedRms(1.5), 59 fErrElectronicPedRms(0.3), 56 60 fTime(-1.), 57 61 fSigmaTime(-1.), … … 68 72 fConversionSigmaBlindPixelMethod(-1.), 69 73 fConversionSigmaPINDiodeMethod(-1.), 70 fHiGainSaturation(kFALSE), 71 fElectronicPedRms(1.5) 74 fHiGainSaturation(kFALSE) 72 75 { 73 76 … … 103 106 } 104 107 108 109 Bool_t MCalibrationPix::IsFitted() 110 { 111 return (fCharge > 0.) && (fErrCharge > 0.) ; 112 } 113 114 // -------------------------------------------------------------------------- 115 // 116 // Return TRUE if: 117 // 118 // 1) Pixel has a fitted charge greater than 3*PedRMS 119 // 2) Pixel has a fit error greater than 0. 120 // 3) Pixel has a fit Probability greater than 0.0001 121 // 4) Pixel has a charge sigma bigger than its Pedestal RMS 122 // 5) If FitTimes is used, 123 // the mean arrival time is at least 1.5 slices from the edge 124 // 125 Bool_t MCalibrationPix::IsFitValid() 126 { 127 128 if (fCharge < 3.*GetPedRms()) 129 return kFALSE; 130 131 if (fErrCharge <= 0.) 132 return kFALSE; 133 134 if (!fHist->IsFitOK()) 135 return kFALSE; 136 137 if (fSigmaCharge <= fPedRms) 138 return kFALSE; 139 140 if (fHist->GetTimeLowerFitRange() < fTime < fHist->GetTimeLowerFitRange()+1.) 141 return kFALSE; 142 143 if (fHist->GetTimeUpperFitRange()-1. < fTime < fHist->GetTimeUpperFitRange()) 144 return kFALSE; 145 146 return kTRUE; 147 148 } 149 150 // -------------------------------------------------------------------------- 151 // 152 // Return TRUE if: 153 // 154 // 1) Pixel is FitValid 155 // 2) Conversion Factor is bigger than 0. 156 // 3) The error of the conversion factor is smaller than 10% 157 // 158 Bool_t MCalibrationPix::IsBlindPixelMethodValid() 159 { 160 161 if (!IsFitValid()) 162 return kFALSE; 163 164 if (fConversionBlindPixelMethod <= 0.) 165 return kFALSE; 166 167 if (fConversionErrorBlindPixelMethod/fConversionBlindPixelMethod > 0.1) 168 return kFALSE; 169 170 return kTRUE; 171 } 172 173 // -------------------------------------------------------------------------- 174 // 175 // Return TRUE if: 176 // 177 // 1) Pixel is FitValid 178 // 2) Conversion Factor is bigger than 0. 179 // 3) The error of the conversion factor is smaller than 10% 180 // 181 Bool_t MCalibrationPix::IsFFactorMethodValid() 182 { 183 184 if (!IsFitValid()) 185 return kFALSE; 186 187 if (fConversionFFactorMethod <= 0.) 188 return kFALSE; 189 190 if (fConversionErrorFFactorMethod/fConversionFFactorMethod > 0.1) 191 return kFALSE; 192 193 return kTRUE; 194 } 195 196 // -------------------------------------------------------------------------- 197 // 198 // Return TRUE if: 199 // 200 // 1) Pixel is FitValid 201 // 2) Conversion Factor is bigger than 0. 202 // 3) The error of the conversion factor is smaller than 10% 203 // 204 Bool_t MCalibrationPix::IsPINDiodeMethodValid() 205 { 206 207 if (!IsFitValid()) 208 return kFALSE; 209 210 if (fConversionPINDiodeMethod <= 0.) 211 return kFALSE; 212 213 if (fConversionErrorPINDiodeMethod/fConversionPINDiodeMethod > 0.1) 214 return kFALSE; 215 216 return kTRUE; 217 } 218 219 // -------------------------------------------------------------------------- 220 // 221 // 1) Return if the charge distribution is already succesfully fitted 222 // 2) Set a lower Fit range according to 1.5 Pedestal RMS in order to avoid 223 // possible remaining cosmics to spoil the fit. 224 // 3) Decide if the LoGain Histogram is fitted or the HiGain Histogram 225 // 4) Fit the histograms with a Gaussian 226 // 5) In case of failure print out the fit results 227 // 6) Retrieve the results and store them in this class 228 // 7) Calculate the number of photo-electrons after the F-Factor method 229 // 8) Calculate the errors of the F-Factor method 230 // 105 231 Bool_t MCalibrationPix::FitCharge() 106 232 { … … 123 249 *fLog << warn << "Could not fit Lo Gain charges of pixel " << fPixId << endl; 124 250 fHist->PrintChargeFitResult(); 125 // return kFALSE;126 251 } 127 252 } … … 132 257 *fLog << warn << "Could not fit Hi Gain charges of pixel " << fPixId << endl; 133 258 fHist->PrintChargeFitResult(); 134 // return kFALSE;135 259 } 136 260 } … … 143 267 fChargeProb = fHist->GetChargeProb(); 144 268 269 if (fCharge <= 0.) 270 { 271 *fLog << warn << "Cannot apply calibration: Mean Fitted Charges are smaller than 0 in pixel " 272 << fPixId << endl; 273 return kFALSE; 274 } 275 276 277 // 278 // Apply the F-Factor Method 279 // 145 280 if ((fPed > 0.) && (fPedRms > 0.)) 146 281 { 147 282 148 Float_t pedrmssquare = fPedRms*fPedRms; 149 Float_t sigmasquare = fSigmaCharge*fSigmaCharge; 283 // 284 // Square all variables in order to avoid applications of square root 285 // 286 const Float_t chargesquare = fCharge*fCharge; 287 const Float_t chargessquarerelerrsquare = 4.*fErrCharge*fErrCharge/chargesquare; 288 289 const Float_t sigmasquare = fSigmaCharge*fSigmaCharge; 290 const Float_t sigmasquareerr = 2.*fErrSigmaCharge*fSigmaCharge; 291 292 const Float_t pedrmssquare = fPedRms*fPedRms; 293 const Float_t pedrmssquareerr = 2.*fErrPedRms*fPedRms; 294 295 const Float_t elecrmssquare = fElectronicPedRms*fElectronicPedRms; 296 const Float_t elecrmssquareerr = 2.*fErrElectronicPedRms*fElectronicPedRms; 297 298 const Float_t conversionsquare = gkConversionHiLo *gkConversionHiLo; 299 const Float_t conversionsquareerr = 2.*gkConversionHiLoError*gkConversionHiLo; 300 301 const Float_t ffactorrelerrsquare = fFactorError * fFactorError / fFactor / fFactor; 302 303 Float_t rsigmasquarerelerrsquare = 0.; 304 Float_t pheffactorrelerrsquare = 0.; 150 305 151 306 if (fHiGainSaturation) 152 307 { 308 309 // 310 // We do not know the Lo Gain Pedestal RMS, so we have to retrieve it 311 // from the Hi Gain: 312 // 313 // We extract the pure NSB contribution: 314 // 315 Float_t nsbsquare = pedrmssquare - elecrmssquare; 316 Float_t nsbsquareerrsquare = pedrmssquareerr * pedrmssquareerr + 317 elecrmssquareerr * elecrmssquareerr; 318 319 if (nsbsquare < 0.) 320 nsbsquare = 0.; 153 321 154 Float_t logainrmssquare = fElectronicPedRms*fElectronicPedRms; 155 Float_t nsbsquare = pedrmssquare - logainrmssquare; 156 // Float_t logainrms = fElectronicPedRms + (TMath::Sqrt(fPedRms*fPedRms - fElectronicPedRms*fElectronicPedRms)); 157 158 if (nsbsquare > 0.) 159 logainrmssquare = nsbsquare/100. + logainrmssquare; 160 161 fRSigmaSquare = sigmasquare - logainrmssquare; 322 // 323 // Now, we divide the NSB by the conversion factor and 324 // add it quadratically to the electronic noise 325 // 326 Float_t logainrmssquare = nsbsquare/conversionsquare + elecrmssquare; 327 Float_t logainrmssquareerrsquare = nsbsquareerrsquare/conversionsquare/conversionsquare 328 + elecrmssquareerr * elecrmssquareerr ; 329 // 330 // Calculate the reduced sigma with the new "Pedestal RMS" 331 // 332 fRSigmaSquare = sigmasquare - logainrmssquare; 333 rsigmasquarerelerrsquare = (sigmasquareerr * sigmasquareerr + logainrmssquareerrsquare) 334 / (fRSigmaSquare * fRSigmaSquare); 162 335 163 336 if (fRSigmaSquare > 0.) 164 fPheFFactorMethod = fFactor*(fCharge*fCharge/100.) / fRSigmaSquare; 165 166 } 167 else /* if (fHiGainSaturation) */ 337 { 338 fPheFFactorMethod = fFactor * chargesquare / fRSigmaSquare; 339 pheffactorrelerrsquare = ffactorrelerrsquare 340 + chargessquarerelerrsquare 341 + rsigmasquarerelerrsquare ; 342 } 343 344 } /* if (fHiGainSaturation) */ 345 else 168 346 { 169 fRSigmaSquare = sigmasquare - pedrmssquare; 170 fPheFFactorMethod = fFactor * fCharge*fCharge / fRSigmaSquare; 347 fRSigmaSquare = sigmasquare - pedrmssquare; 348 rsigmasquarerelerrsquare = ( sigmasquareerr * sigmasquareerr 349 + pedrmssquareerr * pedrmssquareerr) 350 / (fRSigmaSquare * fRSigmaSquare); 351 352 fPheFFactorMethod = fFactor * chargesquare / fRSigmaSquare; 353 // 354 // We first calculate the squared relative error in order to save the 355 // TMath::Sqrt 356 // 357 pheffactorrelerrsquare = ( ffactorrelerrsquare 358 + chargessquarerelerrsquare 359 + rsigmasquarerelerrsquare ); 360 361 362 } /* if (fHiGainSaturation) */ 363 364 365 if (fPheFFactorMethod <= 0.) 366 { 367 *fLog << warn << "Cannot apply F-Factor calibration: Number of PhE smaller than 0 in pixel " 368 << fPixId << endl; 369 return kFALSE; 171 370 } 172 371 173 174 if (fCharge > 0.) 175 fConversionFFactorMethod = fPheFFactorMethod / fCharge ; 176 177 else 178 *fLog << warn << "Cannot apply F-Factor method: Reduced Sigmas are smaller than 0 in pixel: " 179 << fPixId << endl; 372 fConversionFFactorMethod = fPheFFactorMethod / fCharge ; 373 fConversionErrorFFactorMethod = fConversionFFactorMethod * 374 ( pheffactorrelerrsquare + 375 (fErrCharge * fErrCharge / chargesquare ) ); 376 377 fPheFFactorMethodError = TMath::Sqrt(pheffactorrelerrsquare) * fPheFFactorMethod; 180 378 181 379 } /* if ((fPed > 0.) && (fPedRms > 0.)) */ … … 186 384 187 385 386 // -------------------------------------------------------------------------- 387 // 388 // Set the pedestals from outside 389 // 188 390 void MCalibrationPix::SetPedestal(Float_t ped, Float_t pedrms) 189 391 { … … 194 396 } 195 397 398 // -------------------------------------------------------------------------- 399 // 400 // 1) Fit the arrival times 401 // 2) Retrieve the results 402 // 3) Note that because of the low number of bins, the NDf is sometimes 0, so 403 // Root does not give a reasonable Probability, the Chisquare is more significant 404 // 405 // This fit has to be done AFTER the Charges fit, 406 // otherwise only the Hi Gain will be fitted, even if there are no entries 407 // 408 // 196 409 Bool_t MCalibrationPix::FitTime() 197 410 { 198 411 412 // 413 // Fit the Low Gain 414 // 199 415 if (fHiGainSaturation) 200 416 { … … 206 422 } 207 423 } 424 425 // 426 // Fit the High Gain 427 // 208 428 else 209 429 { -
trunk/MagicSoft/Mars/manalysis/MCalibrationPix.h
r2699 r2716 23 23 Float_t fPed; // The mean pedestal (from MPedestalPix) 24 24 Float_t fPedRms; // The pedestal RMS (from MPedestalPix) 25 Float_t fErrPedRms; // The error of the pedestal RMS (from MPedestalPix) 26 Float_t fElectronicPedRms; // The pure electronic component of the RMS 27 Float_t fErrElectronicPedRms; // The error of the pure electronic component of the RMS 25 28 26 29 Float_t fTime; // The mean arrival time after the fit … … 29 32 30 33 Float_t fFactor; // The laboratory F-factor 34 Float_t fFactorError; // The laboratory F-factor Error 31 35 Float_t fPheFFactorMethod; // The number of Phe's calculated after the F-factor method 36 Float_t fPheFFactorMethodError; // The error on the number of Phe's calculated after the F-factor method 32 37 33 Float_t fConversionFFactorMethod; // The conversion factor to Ph's calculated after the F-factor method38 Float_t fConversionFFactorMethod; // The conversion factor to Ph's calculated after the F-factor method 34 39 Float_t fConversionBlindPixelMethod; // The conversion factor to Ph's calculated after the Blind Pixel method 35 40 Float_t fConversionPINDiodeMethod; // The conversion factor to Ph's calculated after the PIN Diode method 36 41 37 Float_t fConversionErrorFFactorMethod; // The conversion factor to Phe's calculated after the F-factor method42 Float_t fConversionErrorFFactorMethod; // The conversion factor to Phe's calculated after the F-factor method 38 43 Float_t fConversionErrorBlindPixelMethod; // The conversion factor to Phe's calculated after the Blind Pixel method 39 44 Float_t fConversionErrorPINDiodeMethod; // The conversion factor to Phe's calculated after the PIN Diode method 40 45 41 Float_t fConversionSigmaFFactorMethod; // The conversion factor to Ph's calculated after the F-factor method46 Float_t fConversionSigmaFFactorMethod; // The conversion factor to Ph's calculated after the F-factor method 42 47 Float_t fConversionSigmaBlindPixelMethod; // The conversion factor to Ph's calculated after the Blind Pixel method 43 48 Float_t fConversionSigmaPINDiodeMethod; // The conversion factor to Phd's calculated after the PIN Diode method 44 49 45 50 Bool_t fHiGainSaturation; // Is Lo-Gain used at all? 46 47 Float_t fElectronicPedRms;48 51 49 52 MHCalibrationPixel *fHist; //! Pointer to the histograms performing the fits, etc. … … 98 101 Float_t GetSigmaConversionBlindPixelMethod() const { return fConversionSigmaBlindPixelMethod ; } 99 102 100 Float_t GetMeanConversionFFactorMethod() const { return fConversionFFactorMethod ; } 101 Float_t GetErrorConversionFFactorMethod() const { return fConversionErrorFFactorMethod ; } 102 Float_t GetSigmaConversionFFactorMethod() const { return fConversionSigmaFFactorMethod ; } 103 Float_t GetPheFFactorMethod() const { return fPheFFactorMethod; } 103 Float_t GetMeanConversionFFactorMethod() const { return fConversionFFactorMethod ; } 104 Float_t GetErrorConversionFFactorMethod() const { return fConversionErrorFFactorMethod ; } 105 Float_t GetSigmaConversionFFactorMethod() const { return fConversionSigmaFFactorMethod ; } 106 107 Float_t GetPheFFactorMethod() const { return fPheFFactorMethod; } 108 Float_t GetPheFFactorMethodError() const { return fPheFFactorMethodError; } 104 109 105 Float_t GetMeanConversionPINDiodeMethod() const { return fConversionPINDiodeMethod ; }110 Float_t GetMeanConversionPINDiodeMethod() const { return fConversionPINDiodeMethod ; } 106 111 Float_t GetErrorConversionPINDiodeMethod() const { return fConversionErrorPINDiodeMethod ; } 107 112 Float_t GetSigmaConversionPINDiodeMethod() const { return fConversionSigmaPINDiodeMethod ; } … … 117 122 Bool_t FillRChargevsTimeLoGain(Float_t rq, Int_t t) { return fHist->FillChargevsNLoGain(rq,t); } 118 123 119 Bool_t IsValid() const { return fCharge >= 3.*GetPedRms() || fErrCharge >= 0; } 124 Bool_t IsFitValid(); 125 Bool_t IsFitted(); 126 Bool_t IsBlindPixelMethodValid(); 127 Bool_t IsFFactorMethodValid(); 128 Bool_t IsPINDiodeMethodValid(); 129 120 130 Int_t GetPixId() const { return fPixId; } 121 131 void DefinePixId(Int_t i);
Note:
See TracChangeset
for help on using the changeset viewer.