Changeset 3662
- Timestamp:
- 04/05/04 23:10:30 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3658 r3662 30 30 (instead of inside the containers) 31 31 32 * mcalib/MCalibrationChargeBlindPix.[h,cc] 33 * mcalib/MCalibrationChargePINDiode.[h,cc] 34 - updated and enlarged documentation 32 35 33 36 2004/04/05: Nadia Tonello -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindPix.cc
r3620 r3662 24 24 25 25 ///////////////////////////////////////////////////////////////////////////// 26 // // 27 // MCalibrationChargeBlindPix // 28 // // 29 // This is the storage container to hold informations about the calibration// 30 // blind pixel // 31 // // 26 // 27 // MCalibrationChargeBlindPix 28 // 29 // Storage container of the fit results of the Blind Pixel signal 30 // (from MHCalibrationChargeBlindPix). 31 // 32 // The Flux is calculated in photons per mm^2 in the camera plane. 33 // 34 // Currently, the following numbers are implemented: 35 // - gkBlindPixelArea: 100 mm^2 36 // - Average QE of Blind Pixel: 37 // gkBlindPixelQEGreen: 0.154 38 // gkBlindPixelQEBlue : 0.226 39 // gkBlindPixelQEUV : 0.247 40 // gkBlindPixelQECT1 : 0.247 41 // - Average QE Error of Blind Pixel: 42 // gkBlindPixelQEGreenErr: 0.015; 43 // gkBlindPixelQEBlueErr : 0.02; 44 // gkBlindPixelQEUVErr : 0.02; 45 // gkBlindPixelQECT1Err : 0.02; 46 // - Attenuation factor Blind Pixel: 47 // gkBlindPixelAttGreen : 1.97; 48 // gkBlindPixelAttBlue : 1.96; 49 // gkBlindPixelAttUV : 1.95; 50 // gkBlindPixelAttCT1 : 1.95; 51 // 52 // 32 53 ///////////////////////////////////////////////////////////////////////////// 33 54 #include "MCalibrationChargeBlindPix.h" … … 41 62 42 63 using namespace std; 43 const Float_t MCalibrationChargeBlindPix::gkBlindPixelArea = 100; 44 // Average QE of Blind Pixel (three colours) 45 const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEGreen = 0.154; 46 const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEBlue = 0.226; 47 const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEUV = 0.247; 48 const Float_t MCalibrationChargeBlindPix::gkBlindPixelQECT1 = 0.247; 49 // Average QE Error of Blind Pixel (three colours) 64 const Float_t MCalibrationChargeBlindPix::gkBlindPixelArea = 100; 65 const Float_t MCalibrationChargeBlindPix::gkBlindPixelAttGreen = 1.97; 66 const Float_t MCalibrationChargeBlindPix::gkBlindPixelAttBlue = 1.96; 67 const Float_t MCalibrationChargeBlindPix::gkBlindPixelAttUV = 1.95; 68 const Float_t MCalibrationChargeBlindPix::gkBlindPixelAttCT1 = 1.95; 69 const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEGreen = 0.154; 70 const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEBlue = 0.226; 71 const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEUV = 0.247; 72 const Float_t MCalibrationChargeBlindPix::gkBlindPixelQECT1 = 0.247; 50 73 const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEGreenErr = 0.015; 51 74 const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEBlueErr = 0.02; 52 75 const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEUVErr = 0.02; 53 76 const Float_t MCalibrationChargeBlindPix::gkBlindPixelQECT1Err = 0.02; 54 // Attenuation factor Blind Pixel (three colours)55 const Float_t MCalibrationChargeBlindPix::gkBlindPixelAttGreen = 1.97;56 const Float_t MCalibrationChargeBlindPix::gkBlindPixelAttBlue = 1.96;57 const Float_t MCalibrationChargeBlindPix::gkBlindPixelAttUV = 1.95;58 const Float_t MCalibrationChargeBlindPix::gkBlindPixelAttCT1 = 1.95;59 60 const Float_t MCalibrationChargeBlindPix::fgLambdaCheckLimit = 0.2;61 const Float_t MCalibrationChargeBlindPix::fgLambdaErrLimit = 0.2;62 77 // -------------------------------------------------------------------------- 63 78 // 64 79 // Default Constructor. 80 // 81 // Calls: 82 // - Clear() 65 83 // 66 84 MCalibrationChargeBlindPix::MCalibrationChargeBlindPix(const char *name, const char *title) … … 70 88 fTitle = title ? title : "Container of the fit results of the blind pixel"; 71 89 72 SetLambdaCheckLimit();73 SetLambdaErrLimit();74 75 90 Clear(); 76 91 } … … 79 94 // ------------------------------------------------------------------------ 80 95 // 81 // Invalidate values 96 // Sets: 97 // - all flags to kFALSE 98 // - all variables to -1. 99 // 100 // Calls: 101 // - MCalibrationChargePix::Clear() 82 102 // 83 103 void MCalibrationChargeBlindPix::Clear(Option_t *o) 84 104 { 85 105 86 fLambda = -1.; 87 fLambdaCheck = -1.; 88 fMu0 = -1.; 89 fMu1 = -1.; 90 fSigma0 = -1.; 91 fSigma1 = -1.; 92 fLambdaErr = -1.; 93 fMu0Err = -1.; 94 fMu1Err = -1.; 95 fSigma0Err = -1.; 96 fSigma1Err = -1.; 97 98 fMeanFluxInsidePlexiglass = -1.; 99 fMeanFluxErrInsidePlexiglass = -1.; 106 fFluxInsidePlexiglass = -1.; 107 fFluxInsidePlexiglassVar = -1.; 108 fLambda = -1.; 109 fLambdaCheck = -1.; 110 fLambdaVar = -1.; 111 fMu0 = -1.; 112 fMu0Err = -1.; 113 fMu1 = -1.; 114 fMu1Err = -1.; 115 fSigma0 = -1.; 116 fSigma0Err = -1.; 117 fSigma1 = -1.; 118 fSigma1Err = -1.; 100 119 101 120 SetOscillating ( kFALSE ); … … 105 124 SetSinglePheFitOK ( kFALSE ); 106 125 SetFluxInsidePlexiglassAvailable ( kFALSE ); 107 126 127 MCalibrationChargePix::Clear(); 108 128 } 109 129 … … 113 133 } 114 134 135 // -------------------------------------------------------------------------- 136 // 137 // Set the Oscillating Bit from outside 138 // 115 139 void MCalibrationChargeBlindPix::SetOscillating( const Bool_t b) 116 140 { … … 118 142 } 119 143 144 // -------------------------------------------------------------------------- 145 // 146 // Set the ChargeFitValid Bit from outside 147 // 120 148 void MCalibrationChargeBlindPix::SetChargeFitValid( const Bool_t b) 121 149 { 122 150 b ? SETBIT(fFlags,kChargeFitValid) : CLRBIT(fFlags,kChargeFitValid); 123 151 } 152 153 // -------------------------------------------------------------------------- 154 // 155 // Set the PedestalFitValid Bit from outside 156 // 124 157 void MCalibrationChargeBlindPix::SetPedestalFitOK( const Bool_t b) 125 158 { … … 127 160 } 128 161 162 // -------------------------------------------------------------------------- 163 // 164 // Set the SinglePheFitValid Bit from outside 165 // 129 166 void MCalibrationChargeBlindPix::SetSinglePheFitOK( const Bool_t b) 130 167 { … … 132 169 } 133 170 134 void MCalibrationChargeBlindPix::SetExcluded( const Bool_t b) 135 { 136 b ? SETBIT(fFlags,kExcluded) : CLRBIT(fFlags,kExcluded); 137 } 138 139 Bool_t MCalibrationChargeBlindPix::IsExcluded() const 140 { 141 return TESTBIT(fFlags,kExcluded); 142 } 143 171 // -------------------------------------------------------------------------- 172 // 173 // Return -1 if fFluxInsidePlexiglassVar is smaller than 0. 174 // Return square root of fFluxInsidePlexiglassVar 175 // 176 Float_t MCalibrationChargeBlindPix::GetFluxInsidePlexiglassErr() const 177 { 178 if (fFluxInsidePlexiglassVar < 0.) 179 return -1.; 180 181 return TMath::Sqrt(fFluxInsidePlexiglassVar); 182 } 183 184 // -------------------------------------------------------------------------- 185 // 186 // Return -1 if fLambdaVar is smaller than 0. 187 // Return square root of fLambdaVar 188 // 189 Float_t MCalibrationChargeBlindPix::GetLambdaErr() const 190 { 191 if (fLambdaVar < 0.) 192 return -1.; 193 194 return TMath::Sqrt(fLambdaVar); 195 } 196 197 // -------------------------------------------------------------------------- 198 // 199 // Test bit kChargeFitValid 200 // 201 Bool_t MCalibrationChargeBlindPix::IsChargeFitValid() const 202 { 203 return TESTBIT(fFlags,kChargeFitValid); 204 } 205 206 // -------------------------------------------------------------------------- 207 // 208 // Test bit kOscillating 209 // 144 210 Bool_t MCalibrationChargeBlindPix::IsOscillating() const 145 211 { … … 147 213 } 148 214 149 Bool_t MCalibrationChargeBlindPix::IsChargeFitValid() const 150 { 151 return TESTBIT(fFlags,kChargeFitValid); 152 } 153 215 // -------------------------------------------------------------------------- 216 // 217 // Test bit kPedestalFitValid 218 // 154 219 Bool_t MCalibrationChargeBlindPix::IsPedestalFitOK() const 155 220 { … … 157 222 } 158 223 224 // -------------------------------------------------------------------------- 225 // 226 // Test bit kSinglePheFitValid 227 // 159 228 Bool_t MCalibrationChargeBlindPix::IsSinglePheFitOK() const 160 229 { … … 162 231 } 163 232 233 // -------------------------------------------------------------------------- 234 // 235 // Test bit kFluxInsidePlexiglassAvailable 236 // 164 237 Bool_t MCalibrationChargeBlindPix::IsFluxInsidePlexiglassAvailable() const 165 238 { … … 168 241 169 242 170 // 171 // The check return kTRUE if: 172 // 173 // 1) fLambda and fLambdaCheck are separated relatively by fLambdaCheckLimit 174 // 2) BlindPixel has an fLambdaErr smaller than fLambdaErrLimit 175 // 176 Bool_t MCalibrationChargeBlindPix::CheckChargeFitValidity() 177 { 178 179 if (2.*(fLambdaCheck-fLambda)/(fLambdaCheck+fLambda) < fLambdaCheckLimit) 180 { 181 *fLog << warn << "WARNING: Lambda and Lambda-Check differ by more than " 182 << fLambdaCheckLimit << " in the Blind Pixel " << endl; 183 return kFALSE; 184 } 185 186 if (fLambdaErr < fLambdaErrLimit) 187 { 188 *fLog << warn << "WARNING: Error of Fitted Lambda is greater than " 189 << fLambdaErrLimit << " in Blind Pixel " << endl; 190 return kFALSE; 191 } 192 193 return kTRUE; 194 } 195 196 // -------------------------------------------------------------------------- 197 // 198 // 243 // -------------------------------------------------------------------------- 244 // 245 // Return kFALSE if IsChargeFitValid() is kFALSE 246 // 247 // Calculate fFluxInsidePlexiglass with the formula: 248 // - fFluxInsidePlexiglass = fLambda * gkBlindPixelArea / gkBlindPixelQE * 10**gkBlindPixelAtt 249 // - fFluxInsidePlexiglassVar = sqrt( fLambdaVar / ( fLambda * fLambda ) 250 // + ( gkBlindPixelQEErr * gkBlindPixelQEErr / gkBlindPixelQE / gkBlindPixelQE ) 251 // ) * fFluxInsidePlexiglass * * fFluxInsidePlexiglass 252 // 253 // If the fFluxInsidePlexiglass is smaller than 0., return kFALSE 254 // If the Variance is smaller than 0., return kFALSE 255 // 256 // SetFluxInsidePlexiglassAvailable() and return kTRUE 199 257 // 200 258 Bool_t MCalibrationChargeBlindPix::CalcFluxInsidePlexiglass() … … 207 265 // 208 266 // Start calculation of number of photons 209 //210 267 // The blind pixel has exactly 100 mm^2 area (with negligible error), 211 268 // 212 fMeanFluxInsidePlexiglass = fLambda*gkBlindPixelArea; 213 269 fFluxInsidePlexiglass = fLambda*gkBlindPixelArea; 270 271 // 214 272 // Start calculation of number of photons relative Variance 215 fMeanFluxErrInsidePlexiglass = fLambdaErr*fLambdaErr/fLambda/fLambda; 216 273 // 274 const Float_t lambdaRelVar = fLambdaVar / ( fLambda * fLambda ); 275 fFluxInsidePlexiglassVar = lambdaRelVar; 276 217 277 switch (fColor) 218 278 { 219 279 case kGREEN: 220 f MeanFluxInsidePlexiglass /=gkBlindPixelQEGreen;221 f MeanFluxErrInsidePlexiglass += gkBlindPixelQEGreenErr*gkBlindPixelQEGreenErr222 / gkBlindPixelQEGreen / gkBlindPixelQEGreen;223 224 f MeanFluxInsidePlexiglass *= TMath::Power(10,gkBlindPixelAttGreen); // correct for absorption280 fFluxInsidePlexiglass /= gkBlindPixelQEGreen; 281 fFluxInsidePlexiglassVar += gkBlindPixelQEGreenErr * gkBlindPixelQEGreenErr 282 / ( gkBlindPixelQEGreen * gkBlindPixelQEGreen ); 283 284 fFluxInsidePlexiglass *= TMath::Power(10,gkBlindPixelAttGreen); // correct for absorption 225 285 // attenuation has negligible error 226 286 break; 227 287 case kBLUE: 228 f MeanFluxInsidePlexiglass /=gkBlindPixelQEBlue;229 f MeanFluxErrInsidePlexiglass += gkBlindPixelQEBlueErr*gkBlindPixelQEBlueErr230 / gkBlindPixelQEBlue / gkBlindPixelQEBlue;231 232 f MeanFluxInsidePlexiglass *= TMath::Power(10,gkBlindPixelAttBlue); // correct for absorption288 fFluxInsidePlexiglass /= gkBlindPixelQEBlue; 289 fFluxInsidePlexiglassVar += gkBlindPixelQEBlueErr * gkBlindPixelQEBlueErr 290 / ( gkBlindPixelQEBlue * gkBlindPixelQEBlue ); 291 292 fFluxInsidePlexiglass *= TMath::Power(10,gkBlindPixelAttBlue); // correct for absorption 233 293 // attenuation has negligible error 234 294 break; 235 295 case kUV: 236 f MeanFluxInsidePlexiglass /=gkBlindPixelQEUV;237 f MeanFluxErrInsidePlexiglass += gkBlindPixelQEUVErr*gkBlindPixelQEUVErr238 / gkBlindPixelQEUV / gkBlindPixelQEUV;239 240 f MeanFluxInsidePlexiglass *= TMath::Power(10,gkBlindPixelAttUV); // correct for absorption296 fFluxInsidePlexiglass /= gkBlindPixelQEUV; 297 fFluxInsidePlexiglassVar += gkBlindPixelQEUVErr* gkBlindPixelQEUVErr 298 / ( gkBlindPixelQEUV * gkBlindPixelQEUV ); 299 300 fFluxInsidePlexiglass *= TMath::Power(10,gkBlindPixelAttUV); // correct for absorption 241 301 // attenuation has negligible error 242 302 break; 243 303 case kCT1: 244 304 default: 245 f MeanFluxInsidePlexiglass /=gkBlindPixelQECT1;246 f MeanFluxErrInsidePlexiglass += gkBlindPixelQECT1Err*gkBlindPixelQECT1Err247 / gkBlindPixelQECT1 / gkBlindPixelQECT1;248 249 f MeanFluxInsidePlexiglass *= TMath::Power(10,gkBlindPixelAttCT1); // correct for absorption305 fFluxInsidePlexiglass /= gkBlindPixelQECT1; 306 fFluxInsidePlexiglassVar += gkBlindPixelQECT1Err * gkBlindPixelQECT1Err 307 / ( gkBlindPixelQECT1 * gkBlindPixelQECT1 ); 308 309 fFluxInsidePlexiglass *= TMath::Power(10,gkBlindPixelAttCT1); // correct for absorption 250 310 // attenuation has negligible error 251 311 break; … … 254 314 *fLog << inf << endl; 255 315 *fLog << inf << " Photon flux [ph/mm^2] inside Plexiglass: " 256 << f MeanFluxInsidePlexiglass << endl;257 258 if (f MeanFluxInsidePlexiglass < 0.)316 << fFluxInsidePlexiglass << endl; 317 318 if (fFluxInsidePlexiglass < 0.) 259 319 return kFALSE; 260 320 261 if (f MeanFluxErrInsidePlexiglass< 0.)321 if (fFluxInsidePlexiglassVar < 0.) 262 322 return kFALSE; 263 323 264 324 SetFluxInsidePlexiglassAvailable(kTRUE); 265 325 266 // Finish calculation of errors -> convert from relative variance to absolute error 267 fMeanFluxErrInsidePlexiglass = TMath::Sqrt(fMeanFluxErrInsidePlexiglass); 268 fMeanFluxErrInsidePlexiglass *= fMeanFluxInsidePlexiglass; 326 // 327 // Finish calculation of errors -> convert from relative variance to absolute variance 328 // 329 fFluxInsidePlexiglassVar *= fFluxInsidePlexiglass * fFluxInsidePlexiglass; 269 330 270 331 *fLog << inf << " Error on photon flux [ph/mm^2] inside Plexiglass: " 271 << fMeanFluxErrInsidePlexiglass<< endl;332 << GetFluxInsidePlexiglass() << endl; 272 333 *fLog << inf << endl; 273 334 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindPix.h
r3315 r3662 10 10 private: 11 11 12 static const Float_t fgLambdaCheckLimit; // The default limit (in units of PedRMS) for acceptance of the fitted mean charge 13 static const Float_t fgLambdaErrLimit; // The default limit (in units of PedRMS) for acceptance of the fitted charge sigma 12 static const Float_t gkBlindPixelArea; //! The Blind Pixel area in mm^2 13 static const Float_t gkBlindPixelAttGreen; //! Attenuation Filter at 520 nm 14 static const Float_t gkBlindPixelAttBlue ; //! Attenuation Filter at 460 nm 15 static const Float_t gkBlindPixelAttUV ; //! Attenuation Filter at 370 nm 16 static const Float_t gkBlindPixelAttCT1 ; //! Attenuation Filter at 370 nm 17 static const Float_t gkBlindPixelQEGreen; //! Quantum Efficiency at 520 nm 18 static const Float_t gkBlindPixelQEBlue ; //! Quantum Efficiency at 460 nm 19 static const Float_t gkBlindPixelQEUV ; //! Quantum Efficiency at 370 nm 20 static const Float_t gkBlindPixelQECT1 ; //! Quantum Efficiency at 370 nm 21 static const Float_t gkBlindPixelQEGreenErr; //! Uncertainty QE at 520 nm 22 static const Float_t gkBlindPixelQEBlueErr ; //! Uncertainty QE at 460 nm 23 static const Float_t gkBlindPixelQEUVErr ; //! Uncertainty QE at 370 nm 24 static const Float_t gkBlindPixelQECT1Err ; //! Uncertainty QE at 370 nmu 14 25 15 static const Float_t gkBlindPixelArea; // The Blind Pixel area in mm^2 26 Float_t fLambda; // Mean Poisson fit 27 Float_t fLambdaCheck; // Mean Pedestal Check (Gauss) fit 28 Float_t fLambdaCheckErr; // Error mean pedestal Check fit 29 Float_t fLambdaVar; // Variance lambda Poisson fit 30 Float_t fFluxInsidePlexiglass; // Number photons in INNER PIXEL inside the plexiglass 31 Float_t fFluxInsidePlexiglassVar; // Variance number of photons in INNER PIXEL 32 Float_t fMu0; // Position pedestal peak 33 Float_t fMu0Err; // Error pos. pedestal-peak 34 Float_t fMu1; // Position first photo-electron peak 35 Float_t fMu1Err; // Error pos. first photo-electon peak 36 Float_t fSigma0; // Width pedestal peak 37 Float_t fSigma0Err; // Error width pedestal peak 38 Float_t fSigma1; // Width first photo-electron peak 39 Float_t fSigma1Err; // Error width first photo-electron peak 16 40 17 static const Float_t gkBlindPixelQEGreen; 18 static const Float_t gkBlindPixelQEBlue ; 19 static const Float_t gkBlindPixelQEUV ; 20 static const Float_t gkBlindPixelQECT1 ; 21 22 static const Float_t gkBlindPixelQEGreenErr; 23 static const Float_t gkBlindPixelQEBlueErr ; 24 static const Float_t gkBlindPixelQEUVErr ; 25 static const Float_t gkBlindPixelQECT1Err ; 26 27 static const Float_t gkBlindPixelAttGreen; 28 static const Float_t gkBlindPixelAttBlue ; 29 static const Float_t gkBlindPixelAttUV ; 30 static const Float_t gkBlindPixelAttCT1 ; 31 32 Float_t fLambdaCheckLimit; // The rel. limit for the rel difference between lambda and lambda check 33 Float_t fLambdaErrLimit; // The limit for acceptance of the fitted lambda 34 35 Float_t fLambda; // The mean of the Poisson fit 36 Float_t fLambdaCheck; // The mean of the pedestal Check fit 37 Float_t fMu0; // The position of the pedestal-peak 38 Float_t fMu1; // The position of the first phe-peak 39 Float_t fSigma0; // The width of the pedestal-peak 40 Float_t fSigma1; // The width of the first phe-peak 41 42 Float_t fLambdaErr; // The error of the mean charge after the fit 43 Float_t fLambdaCheckErr; // The error of the mean of the pedestal Check fit 44 Float_t fMu0Err; // The error of the position of the pedestal-peak 45 Float_t fMu1Err; // The error of the position of the first phe-peak 46 Float_t fSigma0Err; // The error of the width of the pedestal-peak 47 Float_t fSigma1Err; // The error of the width of the first phe-peak 48 49 Float_t fProb; // The probability of the fit 50 51 Float_t fMeanFluxInsidePlexiglass; // The mean number of photons in an INNER PIXEL inside the plexiglass 52 Float_t fMeanFluxErrInsidePlexiglass; // The uncertainty about the number of photons in an INNER PIXEL 53 54 Byte_t fFlags; 55 56 enum { kOscillating, kPedestalFitOK, kSinglePheFitOK, kChargeFitValid, kExcluded, 41 enum { kOscillating, kPedestalFitOK, kSinglePheFitOK, kChargeFitValid, 57 42 kFluxInsidePlexiglassAvailable }; 58 43 … … 67 52 68 53 // Setters 69 void SetColor ( const PulserColor_t color ) { fColor = color; } 54 void SetColor ( const PulserColor_t color ) { fColor = color; } 55 void SetLambda ( const Float_t f ) { fLambda = f; } 56 void SetLambdaErr ( const Float_t f ) { fLambdaVar = f*f; } 57 void SetLambdaCheck ( const Float_t f ) { fLambdaCheck = f; } 58 void SetLambdaCheckErr ( const Float_t f ) { fLambdaCheckErr = f; } 59 void SetMu0 ( const Float_t f ) { fMu0 = f; } 60 void SetMu0Err ( const Float_t f ) { fMu0Err = f; } 61 void SetMu1 ( const Float_t f ) { fMu1 = f; } 62 void SetMu1Err ( const Float_t f ) { fMu1Err = f; } 63 void SetSigma0 ( const Float_t f ) { fSigma0 = f; } 64 void SetSigma0Err ( const Float_t f ) { fSigma0Err = f; } 65 void SetSigma1 ( const Float_t f ) { fSigma1 = f; } 66 void SetSigma1Err ( const Float_t f ) { fSigma1Err = f; } 70 67 71 void SetLambda ( const Float_t f ) { fLambda = f; } 72 void SetLambdaCheck ( const Float_t f ) { fLambdaCheck = f; } 73 void SetMu0 ( const Float_t f ) { fMu0 = f; } 74 void SetMu1 ( const Float_t f ) { fMu1 = f; } 75 void SetSigma0 ( const Float_t f ) { fSigma0 = f; } 76 void SetSigma1 ( const Float_t f ) { fSigma1 = f; } 77 78 void SetLambdaErr ( const Float_t f ) { fLambdaErr = f; } 79 void SetLambdaCheckErr ( const Float_t f ) { fLambdaCheck = f; } 80 void SetMu0Err ( const Float_t f ) { fMu0Err = f; } 81 void SetMu1Err ( const Float_t f ) { fMu1Err = f; } 82 void SetSigma0Err ( const Float_t f ) { fSigma0Err = f; } 83 void SetSigma1Err ( const Float_t f ) { fSigma1Err = f; } 84 85 void SetProb ( const Float_t f ) { fProb = f; } 86 87 void SetLambdaCheckLimit ( const Float_t f=fgLambdaCheckLimit ) { fLambdaCheckLimit = f; } 88 void SetLambdaErrLimit ( const Float_t f=fgLambdaErrLimit ) { fLambdaErrLimit = f; } 89 90 void SetOscillating ( const Bool_t b=kTRUE); 91 void SetChargeFitValid ( const Bool_t b=kTRUE); 92 void SetPedestalFitOK ( const Bool_t b=kTRUE); 93 void SetSinglePheFitOK ( const Bool_t b=kTRUE); 94 void SetFluxInsidePlexiglassAvailable ( const Bool_t b=kTRUE); 95 void SetExcluded ( const Bool_t b=kTRUE); 68 void SetOscillating ( const Bool_t b=kTRUE); 69 void SetChargeFitValid ( const Bool_t b=kTRUE); 70 void SetPedestalFitOK ( const Bool_t b=kTRUE); 71 void SetSinglePheFitOK ( const Bool_t b=kTRUE); 72 void SetFluxInsidePlexiglassAvailable( const Bool_t b=kTRUE); 96 73 97 74 // Getters 98 Float_t GetLambda() const { return fLambda; } 99 Float_t GetLambdaCheck() const { return fLambdaCheck; } 100 Float_t GetMu0() const { return fMu0; } 101 Float_t GetMu1() const { return fMu1; } 102 Float_t GetSigma0() const { return fSigma0; } 103 Float_t GetSigma1() const { return fSigma1; } 104 105 Float_t GetLambdaErr() const { return fLambdaErr; } 106 Float_t GetLambdaCheckErr() const { return fLambdaCheckErr; } 107 Float_t GetMu0Err() const { return fMu0Err; } 108 Float_t GetMu1Err() const { return fMu1Err; } 109 Float_t GetSigma0Err() const { return fSigma0Err; } 110 Float_t GetSigma1Err() const { return fSigma1Err; } 111 112 Float_t GetMeanFluxInsidePlexiglass() const { return fMeanFluxInsidePlexiglass; } 113 Float_t GetMeanFluxErrInsidePlexiglass() const { return fMeanFluxErrInsidePlexiglass; } 75 Float_t GetLambda() const { return fLambda; } 76 Float_t GetLambdaErr() const; 77 Float_t GetLambdaCheck() const { return fLambdaCheck; } 78 Float_t GetLambdaCheckErr() const { return fLambdaCheckErr; } 79 Float_t GetFluxInsidePlexiglass() const { return fFluxInsidePlexiglass; } 80 Float_t GetFluxInsidePlexiglassErr() const; 81 Float_t GetMu0() const { return fMu0; } 82 Float_t GetMu0Err() const { return fMu0Err; } 83 Float_t GetMu1() const { return fMu1; } 84 Float_t GetMu1Err() const { return fMu1Err; } 85 Float_t GetSigma0() const { return fSigma0; } 86 Float_t GetSigma0Err() const { return fSigma0Err; } 87 Float_t GetSigma1() const { return fSigma1; } 88 Float_t GetSigma1Err() const { return fSigma1Err; } 114 89 115 90 Bool_t IsOscillating() const; … … 117 92 Bool_t IsPedestalFitOK() const; 118 93 Bool_t IsSinglePheFitOK() const; 119 Bool_t IsExcluded() const;120 94 Bool_t IsFluxInsidePlexiglassAvailable() const; 121 95 122 96 Bool_t CalcFluxInsidePlexiglass(); 123 Bool_t CheckChargeFitValidity();124 97 125 ClassDef(MCalibrationChargeBlindPix, 1) // Container for Calibration ChargeBlind Pixel98 ClassDef(MCalibrationChargeBlindPix, 1) // Container Charge Calibration Results Blind Pixel 126 99 }; 127 100 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r3655 r3662 213 213 using namespace std; 214 214 215 const Float_t MCalibrationChargeCalc::fgChargeLimit = 3.; 216 const Float_t MCalibrationChargeCalc::fgChargeErrLimit = 0.; 217 const Float_t MCalibrationChargeCalc::fgChargeRelErrLimit = 1.; 218 const Float_t MCalibrationChargeCalc::fgTimeLowerLimit = 1.; 219 const Float_t MCalibrationChargeCalc::fgTimeUpperLimit = 2.; 215 const Float_t MCalibrationChargeCalc::fgChargeLimit = 3.; 216 const Float_t MCalibrationChargeCalc::fgChargeErrLimit = 0.; 217 const Float_t MCalibrationChargeCalc::fgChargeRelErrLimit = 1.; 218 const Float_t MCalibrationChargeCalc::fgLambdaCheckLimit = 0.2; 219 const Float_t MCalibrationChargeCalc::fgLambdaErrLimit = 0.2; 220 const Float_t MCalibrationChargeCalc::fgTimeLowerLimit = 1.; 221 const Float_t MCalibrationChargeCalc::fgTimeUpperLimit = 2.; 220 222 // -------------------------------------------------------------------------- 221 223 // 222 224 // Default constructor. 225 // 226 // Sets all pointers to NULL 227 // 228 // Calls AddToBranchList for: 229 // - MRawEvtData.fHiGainPixId 230 // - MRawEvtData.fLoGainPixId 231 // - MRawEvtData.fHiGainFadcSamples 232 // - MRawEvtData.fLoGainFadcSamples 233 // 234 // Initializes: 235 // - fChargeLimit to fgChargeLimit 236 // - fChargeErrLimit to fgChargeErrLimit 237 // - fChargeRelErrLimit to fgChargeRelErrLimit 238 // - fLambdaCheckLimit to fgLambdaCheckLimit 239 // - fLambdaErrLimit to fgLambdaErrLimit 240 // - fTimeLowerLimit to fgTimeLowerLimit 241 // - fTimeUpperLimit to fgTimeUpperLimit 242 // 243 // Calls: 244 // - Clear() 223 245 // 224 246 MCalibrationChargeCalc::MCalibrationChargeCalc(const char *name, const char *title) … … 230 252 { 231 253 232 fName = name ? name : "MCalibrationChargeCalc"; 233 fTitle = title ? title : "Task to calculate the calibration constants and MCalibrationCam "; 234 235 AddToBranchList("MRawEvtData.fHiGainPixId"); 236 AddToBranchList("MRawEvtData.fLoGainPixId"); 237 AddToBranchList("MRawEvtData.fHiGainFadcSamples"); 238 AddToBranchList("MRawEvtData.fLoGainFadcSamples"); 239 240 Clear(); 241 242 SetChargeLimit(); 243 SetChargeErrLimit(); 244 245 SetChargeRelErrLimit(); 246 SetTimeLowerLimit(); 247 SetTimeUpperLimit(); 254 fName = name ? name : "MCalibrationChargeCalc"; 255 fTitle = title ? title : "Task to calculate the calibration constants and MCalibrationCam "; 256 257 AddToBranchList("MRawEvtData.fHiGainPixId"); 258 AddToBranchList("MRawEvtData.fLoGainPixId"); 259 AddToBranchList("MRawEvtData.fHiGainFadcSamples"); 260 AddToBranchList("MRawEvtData.fLoGainFadcSamples"); 261 262 SetChargeLimit(); 263 SetChargeErrLimit(); 264 SetChargeRelErrLimit(); 265 SetLambdaCheckLimit(); 266 SetLambdaErrLimit(); 267 SetTimeLowerLimit(); 268 SetTimeUpperLimit(); 269 270 Clear(); 271 248 272 } 249 273 … … 254 278 SETBIT(fFlags, kHiLoGainCalibration); 255 279 256 fNumHiGainSamples = 0.;257 fNumLoGainSamples = 0.;258 fSqrtHiGainSamples = 0.;259 fSqrtLoGainSamples = 0.;260 fConversionHiLo = 0;280 fNumHiGainSamples = 0.; 281 fNumLoGainSamples = 0.; 282 fSqrtHiGainSamples = 0.; 283 fSqrtLoGainSamples = 0.; 284 fConversionHiLo = 0 ; 261 285 SkipQualityChecks ( kFALSE ); 262 286 SkipHiLoGainCalibration( kFALSE ); 263 264 287 } 265 288 … … 611 634 // Returns kFALSE if pointer to MCalibrationChargePINDiode is NULL 612 635 // 613 // The check return kTRUE if:614 // 615 // 1) PINDiode has a fitted charge greater than fChargeLimit*PedRMS616 // 2) PINDiode has a fit error greater than fChargeErrLimit617 // 3) PINDiode has a fitted charge greater its fChargeRelErrLimit times its charge error618 // 4) PINDiode has a charge sigma bigger than its Pedestal RMS619 // 5) The mean arrival time is at leastfTimeLowerLimit slices from the lower edge636 // The check returns kFALSE if: 637 // 638 // 1) PINDiode has a fitted charge smaller than fChargeLimit*PedRMS 639 // 2) PINDiode has a fit error smaller than fChargeErrLimit 640 // 3) PINDiode has a fitted charge smaller its fChargeRelErrLimit times its charge error 641 // 4) PINDiode has a charge sigma smaller than its Pedestal RMS 642 // 5) The mean arrival time is in fTimeLowerLimit slices from the lower edge 620 643 // and fUpperLimit slices from the upper edge 621 644 // 645 // Calls: 646 // - MCalibrationChargePINDiode::CalcFluxOutsidePlexiglass() 647 // 622 648 Bool_t MCalibrationChargeCalc::FinalizePINDiode() 623 649 { … … 686 712 return kTRUE; 687 713 } 714 715 // ------------------------------------------------------------------------ 716 // 717 // Returns kFALSE if pointer to MExtractedSignalBlindPixel is NULL 718 // Returns kFALSE if pointer to MCalibrationChargeBlindPix is NULL 719 // 720 // The check returns kFALSE if: 721 // 722 // 1) fLambda and fLambdaCheck are separated relatively to each other by more than fLambdaCheckLimit 723 // 2) BlindPixel has an fLambdaErr greater than fLambdaErrLimit 724 // 725 // Calls: 726 // - MCalibrationChargeBlindPix::CalcFluxInsidePlexiglass() 727 // 728 Bool_t MCalibrationChargeCalc::FinalizeBlindPixel() 729 { 730 731 if (!fSigBlind) 732 return kFALSE; 733 734 if (!fBlindPixel) 735 return kFALSE; 736 737 const Float_t lambda = fBlindPixel->GetLambda(); 738 const Float_t lambdaerr = fBlindPixel->GetLambdaErr(); 739 const Float_t lambdacheck = fBlindPixel->GetLambdaCheck(); 740 741 if (2.*(lambdacheck-lambda)/(lambdacheck+lambda) < fLambdaCheckLimit) 742 { 743 *fLog << warn << "WARNING: Lambda and Lambda-Check differ by more than " 744 << fLambdaCheckLimit << " in the Blind Pixel " << endl; 745 return kFALSE; 746 } 747 748 if (lambdaerr < fLambdaErrLimit) 749 { 750 *fLog << warn << "WARNING: Error of Fitted Lambda is greater than " 751 << fLambdaErrLimit << " in Blind Pixel " << endl; 752 return kFALSE; 753 } 754 755 if (!fBlindPixel->CalcFluxInsidePlexiglass()) 756 { 757 *fLog << warn << "Could not calculate the flux of photons from the Blind Pixel, " 758 << "will skip Blind Pixel Calibration " << endl; 759 return kFALSE; 760 } 761 762 return kTRUE; 763 } 764 688 765 689 766 … … 788 865 // Blind Pixel calibration 789 866 // 790 if (!fBlindPixel->CheckChargeFitValidity()) 791 { 792 *fLog << warn << "Could not calculate the flux of photons from the Blind Pixel, " 793 << "charge fit not valid " << endl; 794 fCam->SetBlindPixelMethodValid(kFALSE); 795 } 867 if (!FinalizeBlindPixel()) 868 fCam->SetBlindPixelMethodValid(kFALSE); 796 869 else 797 { 798 if (!fBlindPixel->CalcFluxInsidePlexiglass()) 799 { 800 *fLog << warn << "Could not calculate the flux of photons from the Blind Pixel, " 801 << "will skip PIN Diode Calibration " << endl; 802 fCam->SetBlindPixelMethodValid(kFALSE); 803 } 804 else 805 { 806 fCam->SetBlindPixelMethodValid(kTRUE); 807 fCam->ApplyBlindPixelCalibration(*fGeom,*fBadPixels, *fBlindPixel); 808 } 809 } 870 { 871 fCam->SetBlindPixelMethodValid(kTRUE); 872 fCam->ApplyBlindPixelCalibration(*fGeom,*fBadPixels, *fBlindPixel); 873 } 810 874 811 875 // -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h
r3655 r3662 39 39 private: 40 40 41 static const Float_t fgChargeLimit; // Default for fChargeLimit (now set to: 3.) 42 static const Float_t fgChargeErrLimit; // Default for fChargeErrLimit (now set to: 0.) 43 static const Float_t fgChargeRelErrLimit; // Default for fChargeRelErrLimit (now set to: 1.) 44 static const Float_t fgTimeLowerLimit; // Default for fTimeLowerLimit (now set to: 1.) 45 static const Float_t fgTimeUpperLimit; // Default for fTimeUpperLimit (now set to: 2.) 41 static const Float_t fgChargeLimit; //! Default for fChargeLimit (now set to: 3.) 42 static const Float_t fgChargeErrLimit; //! Default for fChargeErrLimit (now set to: 0.) 43 static const Float_t fgChargeRelErrLimit; //! Default for fChargeRelErrLimit (now set to: 1.) 44 static const Float_t fgLambdaCheckLimit; //! Default for fLambdaCheckLimit (now set to: 0.2) 45 static const Float_t fgLambdaErrLimit; //! Default for fLabmdaErrLimit (now set to: 0.2) 46 static const Float_t fgTimeLowerLimit; //! Default for fTimeLowerLimit (now set to: 1.) 47 static const Float_t fgTimeUpperLimit; //! Default for fTimeUpperLimit (now set to: 2.) 46 48 47 49 Float_t fChargeLimit; // Limit (in units of PedRMS) for acceptance of mean charge 48 50 Float_t fChargeErrLimit; // Limit (in units of PedRMS) for acceptance of charge sigma square 49 51 Float_t fChargeRelErrLimit; // Limit (in units of Sigma of fitted charge) for acceptance of mean 52 Float_t fLambdaCheckLimit; // Limit for rel. diff. lambda and lambdacheck blind pixel 53 Float_t fLambdaErrLimit; // Limit for acceptance of lambda error blind pixel 50 54 Float_t fTimeLowerLimit; // Limit (in units of FADC slices) for dist. to first signal slice 51 55 Float_t fTimeUpperLimit; // Limit (in units of FADC slices) for dist. to last signal slice … … 89 93 Bool_t FinalizeCharges(MCalibrationChargePix &cal, MBadPixelsPix &bad); 90 94 Bool_t FinalizePINDiode(); 95 Bool_t FinalizeBlindPixel(); 91 96 92 97 void PrintUnsuitable(MBadPixelsPix::UnsuitableType_t typ, const char *text) const; … … 102 107 void SetChargeErrLimit ( const Float_t f=fgChargeErrLimit ) { fChargeErrLimit = f; } 103 108 void SetChargeRelErrLimit( const Float_t f=fgChargeRelErrLimit ) { fChargeRelErrLimit = f; } 109 void SetLambdaErrLimit ( const Float_t f=fgLambdaErrLimit ) { fLambdaErrLimit = f; } 110 void SetLambdaCheckLimit ( const Float_t f=fgLambdaCheckLimit ) { fLambdaCheckLimit = f; } 104 111 105 112 void SetTimeLowerLimit ( const Float_t f=fgTimeLowerLimit ) { fTimeLowerLimit = f; } -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc
r3660 r3662 994 994 { 995 995 996 Float_t flux = blindpix.Get MeanFluxInsidePlexiglass();997 Float_t fluxerr = blindpix.Get MeanFluxErrInsidePlexiglass();996 Float_t flux = blindpix.GetFluxInsidePlexiglass(); 997 Float_t fluxerr = blindpix.GetFluxInsidePlexiglassErr(); 998 998 999 999 TIter Next(fPixels); -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargePINDiode.cc
r3661 r3662 31 31 // is the documentation for the moment. 32 32 // 33 // The Flux is calculated in photons per mm^2 in the camera plane. 34 // 33 35 // Currently, the following numbers are implemented: 34 36 // 35 // Area of Inner Pixel Ai: 779.423 +- 0 mm^236 37 // Area of PIN Diode Ap: 100.000 +- 10 mm^2 37 38 // … … 41 42 // Distance of Inner Pixel to pulser D2: 18.0 +- 0.5 m 42 43 // 43 // Ai*D1*D144 // gkSolidAngleRatio = -------- = 0.0 5444 // D1*D1 45 // gkSolidAngleRatio = -------- = 0.00007 45 46 // Ap*D2*D2 46 47 // 47 // gkSolidAngleRatioErr = 0.01 48 // 49 // 48 // gkSolidAngleRatioErr = 0.00002 49 // 50 50 ///////////////////////////////////////////////////////////////////////////// 51 51 #include "MCalibrationChargePINDiode.h" … … 61 61 const Float_t MCalibrationChargePINDiode::fgChargeToPhotons = -1.; 62 62 const Float_t MCalibrationChargePINDiode::fgChargeToPhotonsErr = -1.; 63 const Float_t MCalibrationChargePINDiode::gkSolidAngleRatio = 0.055; 64 const Float_t MCalibrationChargePINDiode::gkSolidAngleRatioErr = 0.01; 65 // 66 // Average QE of the PIN Diode 67 // 63 const Float_t MCalibrationChargePINDiode::gkSolidAngleRatio = 0.00007; 64 const Float_t MCalibrationChargePINDiode::gkSolidAngleRatioErr = 0.00002; 68 65 const Float_t MCalibrationChargePINDiode::gkPINDiodeQEGreen = -1.0; 69 66 const Float_t MCalibrationChargePINDiode::gkPINDiodeQEBlue = -1.0; 70 67 const Float_t MCalibrationChargePINDiode::gkPINDiodeQEUV = -1.0; 71 68 const Float_t MCalibrationChargePINDiode::gkPINDiodeQECT1 = -1.0; 72 //73 // Average QE of the PIN Diode74 //75 69 const Float_t MCalibrationChargePINDiode::gkPINDiodeQEGreenErr = -1.0; 76 70 const Float_t MCalibrationChargePINDiode::gkPINDiodeQEBlueErr = -1.0; … … 211 205 // -------------------------------------------------------------------------- 212 206 // 207 // Test bit kFluxOutsidePlexiglassAvailable 208 // 209 Bool_t MCalibrationChargePINDiode::IsFluxOutsidePlexiglassAvailable() const 210 { 211 return TESTBIT(fFlags,kFluxOutsidePlexiglassAvailable); 212 } 213 214 215 // -------------------------------------------------------------------------- 216 // 213 217 // Test bit kTimeFitValid 214 218 // … … 216 220 { 217 221 return TESTBIT(fCalibFlags, kTimeFitValid); 222 } 223 224 // -------------------------------------------------------------------------- 225 // 226 // Test bit kOscillating 227 // 228 Bool_t MCalibrationChargePINDiode::IsOscillating() const 229 { 230 return TESTBIT(fCalibFlags, kOscillating); 218 231 } 219 232 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargePINDiode.h
r3661 r3662 82 82 Bool_t IsChargeFitValid() const; 83 83 Bool_t IsTimeFitValid() const; 84 84 Bool_t IsOscillating() const; 85 Bool_t IsFluxOutsidePlexiglassAvailable() const; 86 85 87 Bool_t CalcFluxOutsidePlexiglass(); 86 88
Note:
See TracChangeset
for help on using the changeset viewer.