Changeset 3374 for trunk/MagicSoft/Mars/manalysis
- Timestamp:
- 03/01/04 17:18:18 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/manalysis
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MCerPhotAnal.cc
r2942 r3374 103 103 return kFALSE; 104 104 105 fPedestals = NULL; 106 105 107 const MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader"); 106 108 if (!runheader) 107 109 *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl; 108 110 else 109 if (runheader->GetRunType() == kRTMonteCarlo) 110 { 111 fPedestals=NULL; 111 if (runheader->IsMonteCarloRun()) 112 112 return kTRUE; 113 }114 113 115 114 fPedestals = (MPedestalCam*)pList->FindCreateObj("MPedestalCam"); -
trunk/MagicSoft/Mars/manalysis/MCerPhotAnal2.cc
r2946 r3374 106 106 return kFALSE; 107 107 108 fPedestals=NULL; 109 108 110 const MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader"); 109 111 if (!runheader) 110 112 *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl; 111 113 else 112 if (runheader->GetRunType() == kRTMonteCarlo) 113 { 114 fPedestals=NULL; 114 if (runheader->IsMonteCarloRun()) 115 115 return kTRUE; 116 }117 116 118 117 fPedestals = (MPedPhotCam*)pList->FindCreateObj("MPedPhotCam"); -
trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc
r2942 r3374 154 154 } 155 155 156 Bool_t fIsMcFile = runheader->GetRunType() == kRTMonteCarlo; 157 if (!fIsMcFile) 156 if (!runheader->IsMonteCarloRun()) 158 157 return kTRUE; 159 158 -
trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.cc
r3344 r3374 99 99 } 100 100 101 return run->GetRunType() == kRTMonteCarlo;101 return run->IsMonteCarloRun(); 102 102 } 103 103 … … 108 108 Int_t MMcCalibrationUpdate::PreProcess(MParList *pList) 109 109 { 110 fCalCam = (MCalibrationChargeCam*) pList->FindObject(AddSerialNumber("MCalibrationChargeCam")); 111 if ( !fCalCam ) 112 { 113 *fLog << inf << dbginf << AddSerialNumber("MCalibrationChargeCam") << " does not exist... Creating." << endl; 114 115 fCalCam = (MCalibrationChargeCam*) pList->FindCreateObj(AddSerialNumber("MCalibrationChargeCam")); 116 if ( !fCalCam ) 117 { 118 *fLog << err << dbginf << "Cannot create " << AddSerialNumber("MCalibrationChargeCam") << "... aborting." << endl; 119 return kFALSE; 120 } 121 } 122 else 123 { 124 fFillCalibrationCam = kFALSE; 125 *fLog << inf << AddSerialNumber("MCalibrationChargeCam") << " already exists... " << endl; 126 } 127 128 fPedPhotCam = (MPedPhotCam*) pList->FindCreateObj(AddSerialNumber("MPedPhotCam")); 129 if ( ! fPedPhotCam) 130 { 131 *fLog << err << dbginf << "Cannot create " << AddSerialNumber("MPedPhotCam") << "... aborting." << endl; 132 return kFALSE; 133 } 134 135 fSignalCam = (MExtractedSignalCam*) pList->FindObject(AddSerialNumber("MExtractedSignalCam")); 136 if ( ! fSignalCam) 137 { 138 *fLog << err << dbginf << "Cannot find " << AddSerialNumber("MExtractedSignalCam") << "... aborting." << endl; 139 return kFALSE; 140 } 141 142 return kTRUE; 143 110 fCalCam = (MCalibrationChargeCam*) pList->FindObject(AddSerialNumber("MCalibrationChargeCam")); 111 if (!fCalCam) 112 { 113 fCalCam = (MCalibrationChargeCam*) pList->FindCreateObj(AddSerialNumber("MCalibrationChargeCam")); 114 if (!fCalCam) 115 return kFALSE; 116 } 117 else 118 { 119 fFillCalibrationCam = kFALSE; 120 *fLog << inf << AddSerialNumber("MCalibrationChargeCam") << " already exists... " << endl; 121 } 122 123 fPedPhotCam = (MPedPhotCam*) pList->FindCreateObj(AddSerialNumber("MPedPhotCam")); 124 if (!fPedPhotCam) 125 return kFALSE; 126 127 fSignalCam = (MExtractedSignalCam*) pList->FindObject(AddSerialNumber("MExtractedSignalCam")); 128 if (!fSignalCam) 129 { 130 *fLog << err << AddSerialNumber("MExtractedSignalCam") << " not found... aborting." << endl; 131 return kFALSE; 132 } 133 134 return kTRUE; 144 135 } 145 136 … … 156 147 // 157 148 if (!CheckRunType(pList)) 158 159 149 { 150 *fLog << inf << "This is no MC file... skipping." << endl; 160 151 return kTRUE; 161 152 } 162 153 163 154 // 164 155 // Now check the existence of all necessary containers. 165 156 // 166 167 157 fGeom = (MGeomCam*) pList->FindObject(AddSerialNumber("MGeomCam")); 168 if ( ! fGeom)169 170 *fLog << err << dbginf << "Cannot find " << AddSerialNumber("MGeomCam") << "... aborting." << endl;171 172 158 if (!fGeom) 159 { 160 *fLog << err << AddSerialNumber("MGeomCam") << " not found... aborting." << endl; 161 return kFALSE; 162 } 173 163 174 164 fHeaderFadc = (MMcFadcHeader*)pList->FindObject(AddSerialNumber("MMcFadcHeader")); 175 165 if (!fHeaderFadc) 176 166 { 177 *fLog << err << dbginf<< AddSerialNumber("MMcFadcHeader") << " not found... aborting." << endl;167 *fLog << err << AddSerialNumber("MMcFadcHeader") << " not found... aborting." << endl; 178 168 return kFALSE; 179 169 } … … 182 172 // Initialize Fadc simulation parameters: 183 173 // 184 if ( fAmplitude < 0.)185 174 if (fAmplitude < 0) 175 { 186 176 fAmplitude = fHeaderFadc->GetAmplitud(); 187 177 fAmplitudeOuter = fHeaderFadc->GetAmplitudOuter(); 188 178 fConversionHiLo = fHeaderFadc->GetLow2HighGain(); 189 179 } 190 180 else // Check that following files have all the same FADC parameters 191 192 if ( fabs(fHeaderFadc->GetAmplitud()-fAmplitude) > 1.e-6 ||181 { 182 if ( fabs(fHeaderFadc->GetAmplitud()-fAmplitude) > 1.e-6 || 193 183 fabs(fHeaderFadc->GetAmplitudOuter()-fAmplitudeOuter) > 1.e-6 || 194 fabs(fConversionHiLo-fHeaderFadc->GetLow2HighGain()) > 1.e-6 )184 fabs(fConversionHiLo-fHeaderFadc->GetLow2HighGain()) > 1.e-6 ) 195 185 { 196 *fLog << err << endl << endl << dbginf << "Parameters of MMcFadcHeader are not the same for all the read files. Aborting..." << endl<< endl;197 198 199 186 *fLog << err << "Parameters of MMcFadcHeader are not the same for all files... aborting." << endl; 187 return kFALSE; 188 } 189 } 200 190 201 191 // … … 205 195 // else has to be done in ReInit: 206 196 // 207 if ( !fFillCalibrationCam)208 return kTRUE;197 if (!fFillCalibrationCam) 198 return kTRUE; 209 199 210 200 // … … 278 268 // counts for the RMS per slice: 279 269 // 280 281 const Float_t pedestrms = sigpix.IsLoGainUsed()? 282 sqrt((Double_t)(fSignalCam->GetNumUsedLoGainFADCSlices())) * 283 (fHeaderFadc->GetPedestalRmsLow(i)>0.? fHeaderFadc->GetPedestalRmsLow(i): 0.01) 284 : 285 sqrt((Double_t)(fSignalCam->GetNumUsedHiGainFADCSlices())) * 286 (fHeaderFadc->GetPedestalRmsHigh(i)>0.? fHeaderFadc->GetPedestalRmsHigh(i) : 0.01); 270 const Double_t used = (Double_t)(sigpix.IsLoGainUsed() ? 271 fSignalCam->GetNumUsedLoGainFADCSlices() : 272 fSignalCam->GetNumUsedHiGainFADCSlices()); 273 274 const Float_t rms0 = sigpix.IsLoGainUsed() ? 275 fHeaderFadc->GetPedestalRmsLow(i) : 276 fHeaderFadc->GetPedestalRmsHigh(i); 277 278 const Float_t pedestrms = TMath::Sqrt(used) * (rms0>0 ? rms0 : 0.01); 287 279 288 280 // … … 297 289 298 290 if (sigpix.IsLoGainUsed()) 299 pedpix.Set(adc2phot*hi2lo*pedestmean, 300 adc2phot*hi2lo*pedestrms); 291 pedpix.Set(adc2phot*hi2lo*pedestmean, adc2phot*hi2lo*pedestrms); 301 292 else 302 293 pedpix.Set(adc2phot*pedestmean, adc2phot*pedestrms); 303 294 304 295 } -
trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc
r3004 r3374 86 86 } 87 87 88 return run-> GetRunType() == kRTMonteCarlo;88 return run->IsMonteCarloRun(); 89 89 } 90 90 -
trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc
r2470 r3374 106 106 } 107 107 108 return runheader-> GetRunType() == kRTMonteCarlo;108 return runheader->IsMonteCarloRun(); 109 109 } 110 110 -
trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.cc
r3199 r3374 175 175 } 176 176 else 177 if (runheader-> GetRunType() == kRTMonteCarlo)177 if (runheader->IsMonteCarloRun()) 178 178 return kTRUE; 179 179 -
trunk/MagicSoft/Mars/manalysis/MPedPhotCalc.cc
r2850 r3374 109 109 const MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader"); 110 110 if (!runheader) 111 111 { 112 112 *fLog << warn << dbginf; 113 113 *fLog << "Warning - cannot check file type, MRawRunHeader not found." << endl; 114 114 } 115 115 else 116 if (runheader->GetRunType() == kRTMonteCarlo)117 return kTRUE;116 if (runheader->IsMonteCarloRun()) 117 return kTRUE; 118 118 119 119 120 120 // Initialize arrays 121 121 if(fSumx.GetSize()==0) 122 123 122 { 123 const UShort_t num = fPedestals->GetSize(); 124 124 125 126 125 fSumx.Set(num); 126 fSumx2.Set(num); 127 127 128 129 130 128 memset(fSumx.GetArray(), 0, sizeof(Float_t)*num); 129 memset(fSumx2.GetArray(), 0, sizeof(Float_t)*num); 130 } 131 131 132 132 return kTRUE; 133 133 } 134 134 … … 140 140 Int_t MPedPhotCalc::Process() 141 141 { 142 for(UInt_t i=0;i<fCerPhot->GetNumPixels();i++)142 for(UInt_t i=0;i<fCerPhot->GetNumPixels();i++) 143 143 { 144 const MCerPhotPix &pix = (*fCerPhot)[i];144 const MCerPhotPix &pix = (*fCerPhot)[i]; 145 145 146 const Float_t nphot = pix.GetNumPhotons();147 const Int_t idx = pix.GetPixId();148 149 fSumx[idx] += nphot;150 fSumx2[idx] += nphot*nphot;146 const Float_t nphot = pix.GetNumPhotons(); 147 const Int_t idx = pix.GetPixId(); 148 149 fSumx[idx] += nphot; 150 fSumx2[idx] += nphot*nphot; 151 151 } 152 153 fPedestals->SetReadyToSave();154 155 return kTRUE;152 153 fPedestals->SetReadyToSave(); 154 155 return kTRUE; 156 156 } 157 157 … … 161 161 // 162 162 Int_t MPedPhotCalc::PostProcess() 163 163 { 164 164 // Compute pedestals and rms from fSumx and fSumx2 arrays 165 165 const Int_t n = GetNumExecutions(); … … 167 167 168 168 for(Int_t i=0; i<npix; i++) 169 169 { 170 170 const Float_t sum = fSumx[i]; 171 171 const Float_t sum2 = fSumx2[i]; 172 172 173 173 const Float_t photped = sum/n; 174 174 const Float_t photrms = TMath::Sqrt((sum2-sum*sum/n)/(n-1.)); 175 175 176 (*fPedestals)[i].Set(photped,photrms); 177 178 176 (*fPedestals)[i].Set(photped,photrms); 177 } 178 179 179 return kTRUE; 180 180 }
Note:
See TracChangeset
for help on using the changeset viewer.