Changeset 2728 for trunk/MagicSoft/Mars/manalysis/MCalibrate.cc
- Timestamp:
- 12/20/03 13:46:17 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MCalibrate.cc
r2726 r2728 24 24 25 25 ////////////////////////////////////////////////////////////////////////////// 26 // // 27 // MCalibrate // 28 // // 29 // This task takes the integrated charge from MExtractedSignal and apply // 30 // the calibration constants from MCalibraitionCam to the charge. Then // 31 // stores number of photons obtained in MCerPhotEvt. // 32 // // 33 // Input Containers: // 34 // // 35 // MGeomCam // 36 // MExtractedSingal // 37 // MCalibrationCam // 38 // // 39 // Output Containers: // 40 // // 41 // MCerPhotEvt // 42 // // 26 // 27 // MCalibrate 28 // 29 // This task takes the integrated charge from MExtractedSignal and apply 30 // the calibration constants from MCalibraitionCam to the charge. Then 31 // stores number of photons obtained in MCerPhotEvt. 32 // 33 // Input Containers: 34 // MExtractedSingal 35 // MCalibrationCam 36 // 37 // Output Containers: 38 // MCerPhotEvt 39 // 43 40 ////////////////////////////////////////////////////////////////////////////// 44 45 41 #include "MCalibrate.h" 46 42 #include "MCalibrationConfig.h" … … 74 70 MCalibrate::MCalibrate(const char *name, const char *title) 75 71 { 76 77 72 fName = name ? name : "MCalibrate"; 78 73 fTitle = title ? title : "Task to calculate the number of photons in one event"; 79 80 74 } 81 75 … … 94 88 Int_t MCalibrate::PreProcess(MParList *pList) 95 89 { 96 97 fGeomCam = (MGeomCam*)pList->FindObject("MGeomCam");98 if (!fGeomCam)99 {100 *fLog << err << dbginf << "MGeomCam not found ... aborting." << endl;101 return kFALSE;102 }103 104 90 fSignals = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam"); 105 91 if (!fSignals) 106 107 *fLog << err << dbginf <<"MExtractedSignalCam not found ... aborting" << endl;92 { 93 *fLog << err << "MExtractedSignalCam not found ... aborting" << endl; 108 94 return kFALSE; 109 95 } 110 96 111 97 fCalibrations = (MCalibrationCam*)pList->FindObject("MCalibrationCam"); 112 98 if (!fCalibrations) 113 114 *fLog << err << dbginf << "MCalibrationCam not found ... aborting." << endl;99 { 100 *fLog << err << "MCalibrationCam not found ... aborting." << endl; 115 101 return kFALSE; 116 102 } 117 103 118 104 fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt"); 119 105 if (!fCerPhotEvt) 120 {121 *fLog << err << dbginf << "Cannot create MCerPhotEvt ... aborting" << endl;122 106 return kFALSE; 123 }124 107 125 108 return kTRUE; 126 109 } 127 128 110 129 111 // -------------------------------------------------------------------------- … … 132 114 Int_t MCalibrate::Process() 133 115 { 134 UInt_t imaxnumpix = fGeomCam->GetNumPixels(); 116 if (fCalibrations->GetNumPixels() != (UInt_t)fSignals->GetSize()) 117 { 118 // FIXME: MExtractedSignal must be of variable size - 119 // like MCerPhotEvt - because we must be able 120 // to reduce size by zero supression 121 // For the moment this check could be done in ReInit... 122 *fLog << err << "MExtractedSignal and MCalibrationCam have different sizes... abort." << endl; 123 return kFALSE; 124 } 125 126 const UInt_t imaxnumpix = fSignals->GetSize(); 135 127 136 for (UInt_t pixid = 0; pixid < imaxnumpix; pixid++)128 for (UInt_t pixidx=0; pixidx<imaxnumpix; pixidx++) 137 129 { 138 MCalibrationPix &pix = (*fCalibrations)[pixid];130 const MCalibrationPix &pix = (*fCalibrations)[pixidx]; 139 131 132 if (!pix.IsBlindPixelMethodValid()) 133 continue; 140 134 141 if (pix.IsBlindPixelMethodValid()) 142 { 143 MExtractedSignalPix &sig = (*fSignals)[pixid]; 135 MExtractedSignalPix &sig = (*fSignals)[pixidx]; 144 136 145 146 137 Float_t signal; 138 Float_t signalErr = 0.; 147 139 148 if (sig.IsLoGainUsed()) 149 { 150 signal = sig.GetExtractedSignalLoGain()*pix.GetConversionHiLo(); 151 signalErr = signal*pix.GetConversionHiLoError(); 152 } 153 else 154 { 155 signal = sig.GetExtractedSignalHiGain(); 156 } 157 158 // Float_t calibrationConvertionFactor = pix.GetMeanConversionFFactorMethod(); 159 Float_t calibrationConversionFactor = pix.GetMeanConversionBlindPixelMethod(); 160 Float_t calibrationConversionFactorError = pix.GetErrorConversionBlindPixelMethod(); 140 if (sig.IsLoGainUsed()) 141 { 142 signal = sig.GetExtractedSignalLoGain()*pix.GetConversionHiLo(); 143 signalErr = signal*pix.GetConversionHiLoError(); 144 } 145 else 146 { 147 signal = sig.GetExtractedSignalHiGain(); 148 } 161 149 162 Float_t nphot = signal*calibrationConversionFactor; 163 Float_t nphotErr = signal*calibrationConversionFactorError 164 *signal*calibrationConversionFactorError; 165 nphotErr += signalErr*calibrationConversionFactor 166 *signalErr*calibrationConversionFactor; 150 // Float_t calibrationConvertionFactor = pix.GetMeanConversionFFactorMethod(); 151 const Float_t calibrationConversionFactor = pix.GetMeanConversionBlindPixelMethod(); 152 const Float_t calibrationConversionFactorError = pix.GetErrorConversionBlindPixelMethod(); 167 153 168 nphotErr = TMath::Sqrt(nphotErr); 154 const Float_t nphot = signal*calibrationConversionFactor; 155 Float_t nphotErr = signal*calibrationConversionFactorError 156 *signal*calibrationConversionFactorError; 157 nphotErr += signalErr*calibrationConversionFactor 158 *signalErr*calibrationConversionFactor; 169 159 170 fCerPhotEvt->AddPixel(pixid, nphot, nphotErr); 171 } 172 else 173 { 174 fCerPhotEvt->AddPixel(pixid, 0., 0.); 175 (*fCerPhotEvt)[pixid].SetPixelUnused(); 176 } 160 nphotErr = TMath::Sqrt(nphotErr); 161 162 fCerPhotEvt->AddPixel(pixidx, nphot, nphotErr); 177 163 } 178 164 … … 182 168 return kTRUE; 183 169 } 184
Note:
See TracChangeset
for help on using the changeset viewer.