Changeset 9991 for trunk/Mars/msimcamera/MSimRandomPhotons.cc
- Timestamp:
- 09/30/10 15:34:56 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/msimcamera/MSimRandomPhotons.cc
r9932 r9991 150 150 } 151 151 152 Bool_t MSimRandomPhotons::CheckWavelengthRange(const MParSpline &sp, const char *txt) const153 {154 const Float_t min = sp.GetXmin();155 const Float_t max = sp.GetXmax();156 157 if (min>fRunHeader->GetWavelengthMin())158 {159 *fLog << err << "ERROR - Minimum wavelength (" << min << "nm)";160 *fLog << " defined for " << txt;161 *fLog << " exceeds minimum wavelength simulated (";162 *fLog << fRunHeader->GetWavelengthMin() << "nm)." << endl;163 return kFALSE;164 }165 if (max<fRunHeader->GetWavelengthMax())166 {167 *fLog << err << "ERROR - Maximum wavelength (" << max << "nm)";168 *fLog << " defined for " << txt;169 *fLog << " undershoots maximum wavelength simulated (";170 *fLog << fRunHeader->GetWavelengthMax() << "nm)." << endl;171 return kFALSE;172 }173 174 return kTRUE;175 }176 177 152 // -------------------------------------------------------------------------- 178 153 // … … 221 196 222 197 fRunHeader = (MCorsikaRunHeader*)pList->FindObject("MCorsikaRunHeader"); 223 if ( !fRunHeader)198 if (fSimulateWavelength && !fRunHeader) 224 199 { 225 200 *fLog << err << "MCorsikaRunHeader not found... aborting." << endl; … … 239 214 const MParSpline *s4 = (MParSpline*)pList->FindObject("ConesAngularAcceptance", "MParSpline"); 240 215 241 // Check if all splines are defined in the relevant range 242 if (!CheckWavelengthRange(*s1, "PhotonDetectionEfficiency [MParSpline]")) 243 return kFALSE; 244 if (!CheckWavelengthRange(*s2, "ConesTransmission [MParSpline]")) 245 return kFALSE; 246 if (!CheckWavelengthRange(*s3, "MirrorReflectivity [MParSpline]")) 247 return kFALSE; 248 249 const Float_t wmin = fRunHeader->GetWavelengthMin(); 250 const Float_t wmax = fRunHeader->GetWavelengthMax(); 216 // Ensure that all efficiencies are at least defined in the raneg of the 217 // photon detection efficiency. We assume that this is the limiting factor 218 // and has to be zero at both ends. 219 if (s2->GetXmin()>s1->GetXmin()) 220 { 221 *fLog << err << "ERROR - ConeTransmission range must be defined down to " << s1->GetXmin() << "nm (PhotonDetectionEffciency)." << endl; 222 return kFALSE; 223 } 224 if (s2->GetXmax()<s1->GetXmax()) 225 { 226 *fLog << err << "ERROR - ConeTransmission range must be defined up to " << s1->GetXmax() << "nm (PhotonDetectionEffciency)." << endl; 227 return kFALSE; 228 } 229 if (s3->GetXmin()>s1->GetXmin()) 230 { 231 *fLog << err << "ERROR - MirrorReflectivity range must be defined down to " << s1->GetXmin() << "nm (PhotonDetectionEffciency)." << endl; 232 return kFALSE; 233 } 234 if (s3->GetXmax()<s1->GetXmax()) 235 { 236 *fLog << err << "ERROR - MirrorReflectivity range must be defined up to " << s1->GetXmax() << "nm (PhotonDetectionEffciency)." << endl; 237 return kFALSE; 238 } 239 240 // If the simulated wavelenth range exists and is smaller reduce the 241 // range to it. Later it is checked that at both edges the transmission 242 // is 0. This must be true in both cases: The simulated wavelength range 243 // exceed the PDE or the PDE range exceeds the simulated waveband. 244 const Float_t wmin = fRunHeader && fRunHeader->GetWavelengthMin()>s1->GetXmin() ? fRunHeader->GetWavelengthMin() : s1->GetXmin(); 245 const Float_t wmax = fRunHeader && fRunHeader->GetWavelengthMax()<s1->GetXmax() ? fRunHeader->GetWavelengthMax() : s1->GetXmax(); 251 246 252 247 const Int_t min = TMath::FloorNint(wmin); … … 316 311 return kFALSE; 317 312 318 if (!CheckWavelengthRange(flux, TString("night sky background flux from ")+fFileNameNSB)) 319 return kFALSE; 313 if (flux.GetXmin()>wmin) 314 { 315 *fLog << err << "ERROR - NSB flux from " << fFileNameNSB << " must be defined down to " << wmin << "nm." << endl; 316 return kFALSE; 317 } 318 if (flux.GetXmax()<wmax) 319 { 320 *fLog << err << "ERROR - NSB flux from " << fFileNameNSB << " must be defined up to " << wmax << "nm." << endl; 321 return kFALSE; 322 } 320 323 321 324 MParSpline nsb; … … 334 337 if (eff.GetSpline()->Eval(min)>1e-5) 335 338 { 336 *fLog << warn << "WARNING - Total transmission efficiency at detector at";339 *fLog << warn << "WARNING - Total transmission efficiency at "; 337 340 *fLog << min << "nm is not zero, but " << nsb.GetSpline()->Eval(min) << "... abort." << endl; 338 341 } 339 342 if (eff.GetSpline()->Eval(max)>1e-5) 340 343 { 341 *fLog << warn << "WARNING - Total transmission efficiency at detector at";344 *fLog << warn << "WARNING - Total transmission efficiency at "; 342 345 *fLog << max << "nm is not zero, but " << nsb.GetSpline()->Eval(max) << "... abort." << endl; 343 346 } … … 346 349 if (eff.GetSpline()->Eval(wmin)>1e-5) 347 350 { 348 *fLog << err << "ERROR - Total transmission efficiency at detector at minimum simulated wavelength";351 *fLog << err << "ERROR - Total transmission efficiency at "; 349 352 *fLog << wmin << "nm is not zero... abort." << endl; 350 353 *fLog << " PhotonDetectionEfficency: " << s1->GetSpline()->Eval(wmin) << endl; … … 356 359 if (eff.GetSpline()->Eval(wmax)>1e-5) 357 360 { 358 *fLog << err << "ERROR - Total transmission efficiency at detector at maximum simulated wavelength";361 *fLog << err << "ERROR - Total transmission efficiency at "; 359 362 *fLog << wmax << "nm is not zero... abort." << endl; 360 363 *fLog << " PhotonDetectionEfficency: " << s1->GetSpline()->Eval(wmax) << endl;
Note:
See TracChangeset
for help on using the changeset viewer.