Changeset 3687 for trunk/MagicSoft/Mars
- Timestamp:
- 04/08/04 20:36:48 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3686 r3687 83 83 * mcalib/MCalibrate.[h,cc] 84 84 * mcalib/MCalibrateData.[h,cc] 85 * mcalib/MMcCalibrationCalc.[h,cc] 85 86 - conversion factors now separated into FADC2phe and then into 86 87 call to average Quantum efficiency. -
trunk/MagicSoft/Mars/mcalib/MCalibrate.cc
r3638 r3687 70 70 #include "MCalibrationChargePix.h" 71 71 72 #include "MCalibrationQECam.h" 73 #include "MCalibrationQEPix.h" 74 72 75 #include "MExtractedSignalCam.h" 73 76 #include "MExtractedSignalPix.h" … … 86 89 // 87 90 MCalibrate::MCalibrate(CalibrationMode_t calmode,const char *name, const char *title) 88 : fGeomCam(NULL), fCalibrations(NULL), f BadPixels(NULL), fSignals(NULL),91 : fGeomCam(NULL), fCalibrations(NULL), fQEs(NULL), fBadPixels(NULL), fSignals(NULL), 89 92 fCerPhotEvt(NULL), fCalibrationMode(calmode) 90 93 { … … 131 134 } 132 135 136 fQEs = (MCalibrationQECam*)pList->FindObject(AddSerialNumber("MCalibrationQECam")); 137 if (!fQEs) 138 { 139 *fLog << err << AddSerialNumber("MCalibrationQECam") << " not found ... aborting." << endl; 140 return kFALSE; 141 } 142 133 143 } 134 144 … … 148 158 { 149 159 150 if(fCalibrationMode == kBlindPixel && !fCalibrations->IsBlindPixelMethodValid()) 151 { 152 *fLog << warn << GetDescriptor() << "Warning: Blind pixel calibration method not valid, switching to F-factor method" << endl; 160 if(fCalibrationMode == kBlindPixel && !fQEs->IsBlindPixelMethodValid()) 161 { 162 *fLog << warn << GetDescriptor() 163 << "Warning: Blind pixel calibration method not valid, switching to F-factor method" << endl; 153 164 fCalibrationMode = kFfactor; 154 165 } 155 156 if(fCalibrationMode == kPinDiode && !f Calibrations->IsPINDiodeMethodValid())166 167 if(fCalibrationMode == kPinDiode && !fQEs->IsPINDiodeMethodValid()) 157 168 { 158 *fLog << warn << GetDescriptor() << "Warning: PIN diode calibration method not valid, switching to F-factor method" << endl; 169 *fLog << warn << GetDescriptor() 170 << "Warning: PIN diode calibration method not valid, switching to F-factor method" << endl; 171 fCalibrationMode = kFfactor; 172 } 173 174 if(fCalibrationMode == kCombined && !fQEs->IsCombinedMethodValid()) 175 { 176 *fLog << warn << GetDescriptor() 177 << "Warning: Combined calibration method not valid, switching to F-factor method" << endl; 159 178 fCalibrationMode = kFfactor; 160 179 } … … 200 219 Int_t MCalibrate::Process() 201 220 { 221 222 // 223 // For the moment, we use only a dummy zenith for the calibration: 224 // 225 const Float_t zenith = 0; 226 202 227 /* 203 228 if (fCalibrations->GetNumPixels() != (UInt_t)fSignals->GetSize()) … … 216 241 Float_t hiloconv = 0.; 217 242 Float_t hiloconverr = 0.; 218 Float_t calibrationConversionFactor = 0.; 219 Float_t calibrationConversionFactorErr = 0.; 243 Float_t calibConv = 0.; 244 Float_t calibConvVar = 0.; 245 Float_t calibFFactor = 0.; 246 Float_t calibQE = 0.; 247 Float_t calibQEVar = 0.; 220 248 221 249 for (UInt_t pixidx=0; pixidx<npix; pixidx++) … … 227 255 228 256 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCalibrations)[pixidx]; 257 MCalibrationQEPix &qe = (MCalibrationQEPix&) (*fQEs )[pixidx]; 229 258 MBadPixelsPix &bad = (*fBadPixels)[pixidx]; 230 259 … … 233 262 continue; 234 263 264 calibConv = pix.GetMeanConvFADC2Phe(); 265 calibConvVar = pix.GetMeanConvFADC2PheVar(); 266 calibFFactor = pix.GetMeanFFactorFADC2Phot(); 267 235 268 switch(fCalibrationMode) 236 269 { 237 270 case kBlindPixel: 238 if (pix.IsBlindPixelMethodValid())271 if (qe.IsBlindPixelMethodValid()) 239 272 { 240 calibrationConversionFactor = pix.GetMeanConversionBlindPixelMethod(); 241 calibrationConversionFactorErr = pix.GetConversionBlindPixelMethodErr(); 273 calibQE = qe.GetQECascadesBlindPixel ( zenith ); 274 calibQEVar = qe.GetQECascadesBlindPixelVar( zenith ); 275 } 276 else 277 continue; 278 break; 279 case kPinDiode: 280 if (qe.IsPINDiodeMethodValid()) 281 { 282 calibQE = qe.GetQECascadesPINDiode ( zenith ); 283 calibQEVar = qe.GetQECascadesPINDiodeVar( zenith ); 242 284 } 243 285 else 244 continue; 245 break; 246 case kPinDiode: 247 if (pix.IsPINDiodeMethodValid()) 248 { 249 calibrationConversionFactor = pix.GetMeanConversionPINDiodeMethod(); 250 calibrationConversionFactorErr = pix.GetConversionPINDiodeMethodErr(); 251 } 252 else 253 continue; 286 continue; 254 287 break; 255 288 case kFfactor: 256 289 if (pix.IsFFactorMethodValid()) 257 290 { 258 calibrationConversionFactor = pix.GetMeanConversionFFactorMethod();259 calibrationConversionFactorErr = pix.GetConversionFFactorMethodErr();291 calibQE = qe.GetQECascadesFFactor ( zenith ); 292 calibQEVar = qe.GetQECascadesFFactorVar( zenith ); 260 293 } 261 262 294 else 295 continue; 263 296 break; 264 297 case kCombined: 265 if (pix.IsCombinedMethodValid())298 if (qe.IsCombinedMethodValid()) 266 299 { 267 calibrationConversionFactor = pix.GetMeanConversionCombinedMethod();268 calibrationConversionFactorErr = pix.GetConversionCombinedMethodErr();300 calibQE = qe.GetQECascadesCombined ( zenith ); 301 calibQEVar = qe.GetQECascadesCombinedVar( zenith ); 269 302 } 270 271 272 303 else 304 continue; 305 break; 273 306 case kDummy: 274 hiloconv 275 hiloconverr 276 calib rationConversionFactor= 1.;277 calib rationConversionFactorErr = 0.;307 hiloconv = 1.; 308 hiloconverr = 0.; 309 calibQE = 1.; 310 calibQEVar = 0.; 278 311 break; 279 312 280 313 } /* switch calibration mode */ 281 314 282 hiloconv = pix.GetConversionHiLo ();315 hiloconv = pix.GetConversionHiLo (); 283 316 hiloconverr= pix.GetConversionHiLoErr(); 284 317 … … 286 319 else 287 320 { 288 hiloconv = 1.; 289 hiloconverr = 0.; 290 calibrationConversionFactor = 1.; 291 calibrationConversionFactorErr = 0.; 321 hiloconv = 1.; 322 hiloconverr = 0.; 323 calibConv = 1.; 324 calibConvVar = 0.; 325 calibFFactor = 0.; 326 calibQE = 1.; 327 calibQEVar = 0.; 292 328 } 293 329 MExtractedSignalPix &sig = (*fSignals)[pixidx]; … … 306 342 if (sig.GetExtractedSignalHiGain() > 9999.) 307 343 { 308 signal = 0.;344 signal = 0.; 309 345 signalErr = 0.; 310 346 } … … 313 349 } 314 350 315 nphot = signal*calibrationConversionFactor; 316 nphotErr = signal*calibrationConversionFactorErr 317 *signal*calibrationConversionFactorErr 318 + signalErr*calibrationConversionFactor 319 *signalErr*calibrationConversionFactor; 320 321 nphotErr = TMath::Sqrt(nphotErr); 322 351 nphot = signal*calibConv/calibQE; 352 nphotErr = calibFFactor*TMath::Sqrt(nphot); 353 354 // 355 // The following part is the outcommented first version of the error calculation 356 // Contact Markus Gaug for questions (or wait for the next documentation update...) 357 // 358 /* 359 nphotErr = signal > 0 ? signalErr*signalErr / (signal * signal) : 0. 360 + calibConv > 0 ? calibConvVar / (calibConv * calibConv ) : 0. 361 + calibQE > 0 ? calibQEVar / (calibQE * calibQE ) : 0.; 362 nphotErr = TMath::Sqrt(nphotErr) * nphot; 363 */ 364 323 365 MCerPhotPix *cpix = fCerPhotEvt->AddPixel(pixidx, nphot, nphotErr); 324 366 -
trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc
r3638 r3687 19 19 ! Author(s): Javier Rico 01/2004 <mailto:jrico@ifae.es> 20 20 ! Author(s): Wolfgang Wittek 02/2004 <mailto:wittek@mppmu.mpg.de> 21 ! Author(s): Markus Gaug 04/2004 <mailto:markus@ifae.es> 21 22 ! 22 23 ! Copyright: MAGIC Software Development, 2000-2004 … … 40 41 // MPedestalCam 41 42 // MExtractedSingalCam 42 // MCalibrationCam 43 // MCalibrationChargeCam 44 // MCalibrationQECam 43 45 // 44 46 // Output Containers: … … 62 64 #include "MCalibrationChargeCam.h" 63 65 #include "MCalibrationChargePix.h" 66 67 #include "MCalibrationQECam.h" 68 #include "MCalibrationQEPix.h" 64 69 65 70 #include "MExtractedSignalCam.h" … … 95 100 // - MPedestalCam 96 101 // - MCalibrationChargeCam 102 // - MCalibrationQECam 97 103 // - MExtractedSignalCam 98 104 // … … 136 142 return kFALSE; 137 143 } 144 fQEs = (MCalibrationQECam*)pList->FindObject(AddSerialNumber("MCalibrationQECam")); 145 if (!fQEs) 146 { 147 *fLog << err << AddSerialNumber("MCalibrationQECam") << " not found ... aborting." << endl; 148 return kFALSE; 149 } 138 150 } 139 151 … … 161 173 { 162 174 163 if(fCalibrationMode == kBlindPixel && !f Calibrations->IsBlindPixelMethodValid())175 if(fCalibrationMode == kBlindPixel && !fQEs->IsBlindPixelMethodValid()) 164 176 { 165 177 *fLog << warn << GetDescriptor() << "Warning: Blind pixel calibration method not valid, switching to F-factor method" << endl; … … 167 179 } 168 180 169 if(fCalibrationMode == kPinDiode && !f Calibrations->IsPINDiodeMethodValid())181 if(fCalibrationMode == kPinDiode && !fQEs->IsPINDiodeMethodValid()) 170 182 { 171 183 *fLog << warn << GetDescriptor() << "Warning: PIN diode calibration method not valid, switching to F-factor method" << endl; … … 201 213 202 214 //---------------------------------- 203 // get ph oton/ADC conversion factor215 // get phe/ADC conversion factor 204 216 205 217 Float_t hiloconv; 206 218 Float_t hiloconverr; 207 Float_t calib rationConversionFactor;208 Float_t calib rationConversionFactorErr;219 Float_t calibConv; 220 Float_t calibFFactor; 209 221 210 222 if ( !GetConversionFactor(pixid, hiloconv, hiloconverr, 211 calib rationConversionFactor, calibrationConversionFactorErr ))223 calibConv, calibFFactor )) 212 224 continue; 213 225 … … 215 227 216 228 // pedestals/(used FADC slices) in [number of photons] 217 Float_t pedphot = pedes * calib rationConversionFactor;218 Float_t pedphotrms = pedrms * calib rationConversionFactor;229 Float_t pedphot = pedes * calibConv; 230 Float_t pedphotrms = pedrms * calibConv; 219 231 220 232 (*fPedPhot)[pixid].Set(pedphot, pedphotrms); 221 233 222 *fLog << all << pixid << ", " << calib rationConversionFactor<< ", "234 *fLog << all << pixid << ", " << calibConv << ", " 223 235 << ped.GetPedestal() << ", " << ped.GetPedestalRms() << ", " 224 236 << pedphot << ", " << pedphotrms << endl; … … 239 251 Bool_t MCalibrateData::GetConversionFactor(UInt_t pixidx, 240 252 Float_t &hiloconv, Float_t &hiloconverr, 241 Float_t &calibrationConversionFactor, Float_t &calibrationConversionFactorErr) 242 { 243 hiloconv = 1.; 244 hiloconverr = 0.; 245 calibrationConversionFactor = 1.; 246 calibrationConversionFactorErr = 0.; 253 Float_t &calibConv, Float_t &calibFFactor) 254 { 255 256 // 257 // For the moment, we use only a dummy zenith for the calibration: 258 // 259 const Float_t zenith = -1.; 260 261 hiloconv = 1.; 262 hiloconverr = 0.; 263 calibConv = 1.; 264 calibFFactor = 0.; 247 265 248 266 if(fCalibrationMode!=kNone) 249 267 { 250 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCalibrations)[pixidx]; 251 MBadPixelsPix &bad = (*fBadPixels)[pixidx]; 268 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCalibrations)[pixidx]; 269 MCalibrationQEPix &qepix = (MCalibrationQEPix&) (*fQEs) [pixidx]; 270 MBadPixelsPix &bad = (*fBadPixels)[pixidx]; 252 271 253 272 if (!bad.IsCalibrationResultOK()) … … 256 275 hiloconv = pix.GetConversionHiLo(); 257 276 hiloconverr= pix.GetConversionHiLoErr(); 258 277 278 const Float_t pheConv = pix.GetMeanConvFADC2Phe(); 279 calibFFactor = pix.GetMeanFFactorFADC2Phot(); 280 Float_t calibQE = 1.; 281 259 282 switch(fCalibrationMode) 260 283 { 261 284 case kBlindPixel: 262 calibrationConversionFactor = pix.GetMeanConversionBlindPixelMethod();263 calibrationConversionFactorErr = pix.GetConversionBlindPixelMethodErr();285 calibQE = qepix.GetQECascadesBlindPixel ( zenith ); 286 // calibQEVar = qepix.GetQECascadesBlindPixelVar( zenith ); 264 287 break; 265 288 case kFfactor: 266 calibrationConversionFactor = pix.GetMeanConversionFFactorMethod();267 calibrationConversionFactorErr = pix.GetConversionFFactorMethodErr();289 calibQE = qepix.GetQECascadesFFactor ( zenith ); 290 // calibQEVar = qepix.GetQECascadesFFactorVar( zenith ); 268 291 break; 269 292 default: … … 271 294 break; 272 295 } 296 calibConv = pheConv / calibQE; 297 273 298 } 274 299 275 300 return kTRUE; 276 301 } 302 277 303 278 304 // -------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/mcalib/MCalibrateData.h
r3437 r3687 26 26 class MPedestalCam; 27 27 class MCalibrationChargeCam; 28 class MCalibrationQECam; 28 29 class MExtractedSignalCam; 29 30 … … 37 38 MPedestalCam *fPedestal; // Pedestals/slice [ADC counts] 38 39 MBadPixelsCam *fBadPixels; // Bad Pixels information 39 MCalibrationChargeCam *fCalibrations; // Calibration constants 40 MCalibrationChargeCam *fCalibrations; // Calibration constants 41 MCalibrationQECam *fQEs; // Quantum efficiencies 40 42 MExtractedSignalCam *fSignals; // Integrated charge in FADCs counts 41 43 -
trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.h
r3249 r3687 7 7 8 8 class MCalibrationChargeCam; 9 class MCalibrationQECam; 9 10 class MGeomCam; 10 11 class MHillas; … … 19 20 private: 20 21 MCalibrationChargeCam *fCalCam; 22 MCalibrationQECam *fQECam; 21 23 MGeomCam *fGeom; 22 24 MHillas *fHillas;
Note:
See TracChangeset
for help on using the changeset viewer.