Changeset 9991 for trunk


Ignore:
Timestamp:
09/30/10 15:34:56 (14 years ago)
Author:
tbretz
Message:
Changed the checks in MSimRandomPhotons which didn't allow pedestal and calibration runs to be produced
Location:
trunk/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/Changelog

    r9949 r9991  
    3535   * msim/MPhotonEvent.cc:
    3636     - don't loop over all (mostly empty) slots in Print()
     37
     38   * msimcamera/MSimRandomPhotons.[h,cc]:
     39     - changed again the checks to also allow pedestal and calibration
     40       runs to be produced without having a MCorsikaRunHeader available
    3741
    3842
  • trunk/Mars/msimcamera/MSimRandomPhotons.cc

    r9932 r9991  
    150150}
    151151
    152 Bool_t MSimRandomPhotons::CheckWavelengthRange(const MParSpline &sp, const char *txt) const
    153 {
    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 
    177152// --------------------------------------------------------------------------
    178153//
     
    221196
    222197    fRunHeader = (MCorsikaRunHeader*)pList->FindObject("MCorsikaRunHeader");
    223     if (!fRunHeader)
     198    if (fSimulateWavelength && !fRunHeader)
    224199    {
    225200        *fLog << err << "MCorsikaRunHeader not found... aborting." << endl;
     
    239214    const MParSpline *s4 = (MParSpline*)pList->FindObject("ConesAngularAcceptance",    "MParSpline");
    240215
    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();
    251246
    252247    const Int_t min = TMath::FloorNint(wmin);
     
    316311        return kFALSE;
    317312
    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    }
    320323
    321324    MParSpline nsb;
     
    334337    if (eff.GetSpline()->Eval(min)>1e-5)
    335338    {
    336         *fLog << warn << "WARNING - Total transmission efficiency at detector at ";
     339        *fLog << warn << "WARNING - Total transmission efficiency at ";
    337340        *fLog << min << "nm is not zero, but " << nsb.GetSpline()->Eval(min) << "... abort." << endl;
    338341    }
    339342    if (eff.GetSpline()->Eval(max)>1e-5)
    340343    {
    341         *fLog << warn << "WARNING - Total transmission efficiency at detector at ";
     344        *fLog << warn << "WARNING - Total transmission efficiency at ";
    342345        *fLog << max << "nm is not zero, but " << nsb.GetSpline()->Eval(max) << "... abort." << endl;
    343346    }
     
    346349    if (eff.GetSpline()->Eval(wmin)>1e-5)
    347350    {
    348         *fLog << err << "ERROR - Total transmission efficiency at detector at minimum simulated wavelength ";
     351        *fLog << err << "ERROR - Total transmission efficiency at ";
    349352        *fLog << wmin << "nm is not zero... abort." << endl;
    350353        *fLog << "        PhotonDetectionEfficency: " << s1->GetSpline()->Eval(wmin) << endl;
     
    356359    if (eff.GetSpline()->Eval(wmax)>1e-5)
    357360    {
    358         *fLog << err << "ERROR - Total transmission efficiency at detector at maximum simulated wavelength ";
     361        *fLog << err << "ERROR - Total transmission efficiency at ";
    359362        *fLog << wmax << "nm is not zero... abort." << endl;
    360363        *fLog << "        PhotonDetectionEfficency: " << s1->GetSpline()->Eval(wmax) << endl;
  • trunk/Mars/msimcamera/MSimRandomPhotons.h

    r9913 r9991  
    4343    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
    4444
    45     // MSimRandomPhotons
    46     Bool_t CheckWavelengthRange(const MParSpline &sp, const char *txt) const;
    47 
    4845public:
    4946    MSimRandomPhotons(const char *name=NULL, const char *title=NULL);
Note: See TracChangeset for help on using the changeset viewer.