Changeset 2945 for trunk/MagicSoft/Mars
- Timestamp:
- 01/28/04 15:05:30 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2944 r2945 4 4 5 5 -*-*- END OF LINE -*-*- 6 2004/01/28: Javier Rico 7 8 * mcalib/MCalibrate.[h.cc] 9 - include possibility to select the calibration method to be used 10 11 6 12 2004/01/28: Markus Gaug 7 13 -
trunk/MagicSoft/Mars/mcalib/MCalibrate.cc
r2908 r2945 17 17 ! 18 18 ! Author(s): Javier Lopez 12/2003 <mailto:jlopez@ifae.es> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2001 19 ! Modified by: Javier Rico 01/2004 <mailto:jrico@ifae.es> 20 ! 21 ! Copyright: MAGIC Software Development, 2000-2004 21 22 ! 22 23 ! … … 29 30 // This task takes the integrated charge from MExtractedSignal and apply 30 31 // the calibration constants from MCalibraitionCam to the charge. Then 31 // stores number of photons obtained in MCerPhotEvt. 32 // stores number of photons obtained in MCerPhotEvt. Selection of different 33 // calibration methods is allowed through SetCalibrationMode member function 32 34 // 33 35 // Input Containers: … … 65 67 // Default constructor. 66 68 // 67 MCalibrate::MCalibrate( const char *name, const char *title)69 MCalibrate::MCalibrate(CalibrationMode_t calmode,const char *name, const char *title) : fCalibrationMode(calmode) 68 70 { 69 71 fName = name ? name : "MCalibrate"; … … 85 87 Int_t MCalibrate::PreProcess(MParList *pList) 86 88 { 89 87 90 fSignals = (MExtractedSignalCam*)pList->FindObject(AddSerialNumber("MExtractedSignalCam")); 91 88 92 if (!fSignals) 89 93 { … … 92 96 } 93 97 94 fCalibrations = (MCalibrationCam*)pList->FindObject(AddSerialNumber("MCalibrationCam")); 95 if (!fCalibrations) 96 { 97 *fLog << err << AddSerialNumber("MCalibrationCam") << " not found ... aborting." << endl; 98 return kFALSE; 99 } 98 if(fCalibrationMode>kNone) 99 { 100 101 fCalibrations = (MCalibrationCam*)pList->FindObject(AddSerialNumber("MCalibrationCam")); 102 if (!fCalibrations) 103 { 104 *fLog << err << AddSerialNumber("MCalibrationCam") << " not found ... aborting." << endl; 105 return kFALSE; 106 } 107 108 } 100 109 101 110 fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj(AddSerialNumber("MCerPhotEvt")); … … 108 117 // -------------------------------------------------------------------------- 109 118 // 119 // Check for validity of the selected calibration method, switch to a 120 // different one in case of need 121 // 122 Int_t MCalibrate::ReInit() 123 { 124 if(fCalibrationMode == kBlindPixel && !fCalibrations->IsBlindPixelMethodValid()) 125 { 126 *fLog << warn << GetDescriptor() << "Warning: Blind pixel calibration method not valid, switching to F-factor method" << endl; 127 fCalibrationMode = kFfactor; 128 } 129 130 if(fCalibrationMode == kPinDiode && !fCalibrations->IsPINDiodeMethodValid()) 131 { 132 *fLog << warn << GetDescriptor() << "Warning: PIN diode calibration method not valid, switching to F-factor method" << endl; 133 fCalibrationMode = kFfactor; 134 } 135 return kTRUE; 136 } 137 // -------------------------------------------------------------------------- 138 // 139 // Apply the calibration factors to the extracted signal according to the 140 // selected calibration method 110 141 // 111 142 Int_t MCalibrate::Process() … … 123 154 */ 124 155 125 UInt_t numpix = fSignals->GetSize(); 126 127 for (UInt_t pixid=0; pixid< numpix; pixid++) 128 { 129 const MCalibrationPix &pix = (*fCalibrations)[pixid]; 130 131 if (!pix.IsFitValid()) 132 continue; 133 134 MExtractedSignalPix &sig = (*fSignals)[pixid]; 156 UInt_t npix = fSignals->GetSize(); 157 158 Float_t hiloconv = 1.; 159 Float_t hiloconverr= 0.; 160 Float_t calibrationConversionFactor = 1.; 161 Float_t calibrationConversionFactorError = 0.; 162 163 for (UInt_t pixidx=0; pixidx<npix; pixidx++) 164 { 165 if(fCalibrationMode!=kNone) 166 { 167 const MCalibrationPix &pix = (*fCalibrations)[pixidx]; 168 169 if (!pix.IsFitValid()) 170 continue; 171 172 hiloconv = pix.GetConversionHiLo(); 173 hiloconverr= pix.GetConversionHiLoError(); 174 175 switch(fCalibrationMode) 176 { 177 case kBlindPixel: 178 calibrationConversionFactor = pix.GetMeanConversionBlindPixelMethod(); 179 calibrationConversionFactorError = pix.GetErrorConversionBlindPixelMethod(); 180 break; 181 case kFfactor: 182 calibrationConversionFactor = pix.GetMeanConversionFFactorMethod(); 183 calibrationConversionFactorError = pix.GetErrorConversionFFactorMethod(); 184 break; 185 default: 186 *fLog << warn << "MCalibrate::Process Warning: Calibration mode value ("<<fCalibrationMode<<") not known" << endl; 187 break; 188 } 189 } 190 191 MExtractedSignalPix &sig = (*fSignals)[pixidx]; 135 192 136 193 Float_t signal; 137 194 Float_t signalErr = 0.; 138 195 Float_t nphot,nphotErr; 196 139 197 if (sig.IsLoGainUsed()) 140 198 { 141 signal = sig.GetExtractedSignalLoGain()* pix.GetConversionHiLo();142 signalErr = signal* pix.GetConversionHiLoError();199 signal = sig.GetExtractedSignalLoGain()*hiloconv; 200 signalErr = signal*hiloconverr; 143 201 } 144 202 else … … 152 210 signal = sig.GetExtractedSignalHiGain(); 153 211 } 154 155 // Float_t calibrationConversionFactor = pix.GetMeanConversionFFactorMethod(); 156 const Float_t calibrationConversionFactor = pix.GetMeanConversionBlindPixelMethod(); 157 const Float_t calibrationConversionFactorError = pix.GetErrorConversionBlindPixelMethod(); 158 159 const Float_t nphot = signal*calibrationConversionFactor; 160 161 Float_t nphotErr = signal*calibrationConversionFactorError 162 *signal*calibrationConversionFactorError; 163 164 nphotErr += signalErr*calibrationConversionFactor 165 *signalErr*calibrationConversionFactor; 212 213 nphot = signal*calibrationConversionFactor; 214 nphotErr = signal*calibrationConversionFactorError 215 *signal*calibrationConversionFactorError 216 +signalErr*calibrationConversionFactor 217 *signalErr*calibrationConversionFactor; 166 218 167 219 nphotErr = TMath::Sqrt(nphotErr); 168 220 169 MCerPhotPix *cpix = fCerPhotEvt->AddPixel(pixid , nphot, nphotErr);221 MCerPhotPix *cpix = fCerPhotEvt->AddPixel(pixidx, nphot, nphotErr); 170 222 171 223 if (sig.GetNumLoGainSaturated() > 0) 172 224 cpix->SetPixelSaturated(); 173 225 } 174 226 -
trunk/MagicSoft/Mars/mcalib/MCalibrate.h
r2885 r2945 27 27 28 28 Float_t fConversionHiLo; 29 UShort_t fCalibrationMode; 29 30 30 31 Int_t PreProcess(MParList *pList); 31 32 Int_t Process(); 33 Int_t ReInit(); 32 34 33 35 public: 34 36 35 MCalibrate(const char *name=NULL, const char *title=NULL); 37 enum CalibrationMode_t{kNone=0,kBlindPixel,kFfactor,kPinDiode,kCombined}; 38 static const CalibrationMode_t kDefault = kBlindPixel; 36 39 37 void SetConversionHiLo(Float_t conv) { fConversionHiLo = conv; } 40 MCalibrate(CalibrationMode_t calmode = kDefault,const char *name=NULL, const char *title=NULL); 41 42 void SetConversionHiLo(Float_t conv) { fConversionHiLo = conv; }; 43 void SetCalibrationMode(CalibrationMode_t calmode=kDefault){ fCalibrationMode=calmode;}; 38 44 39 45 ClassDef(MCalibrate, 0) // Task to calculate cerenkov photons using calibration constants
Note:
See TracChangeset
for help on using the changeset viewer.