Changeset 19332 for trunk/Mars/mcorsika


Ignore:
Timestamp:
10/30/18 15:39:36 (6 years ago)
Author:
tbretz
Message:
Implemented variable block length to support thinning option, read more data values from the headers and store and print them.
Location:
trunk/Mars/mcorsika
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mcorsika/MCorsikaRunHeader.cc

    r18546 r19332  
    4747//  + UInt_t  fNumReuse
    4848//
     49// Class Version 4:
     50// ----------------
     51//  + UInt_t  fCerenkovFileOption
     52//  + Float_t fEnergyCutoffHadrons
     53//  + Float_t fEnergyCutoffMuons
     54//  + Float_t fEnergyCutoffElectrons
     55//  + Float_t fEnergyCutoffPhotons
     56//  + Float_t fThinningEnergyFractionH
     57//  + Float_t fThinningEnergyFractionEM
     58//  + Float_t fThinningWeightLimitH
     59//  + Float_t fThinningWeightLimitEM
     60//  + Float_t fThinningMaxRadius
     61//
    4962////////////////////////////////////////////////////////////////////////////
    5063
     
    8396// Read in one run header from the binary file
    8497//
    85 Bool_t MCorsikaRunHeader::ReadEvt(MCorsikaFormat * fInFormat)
    86 {
    87     Float_t f[272];
    88     if (!fInFormat->Read(f, 272 * sizeof(Float_t)))
     98Bool_t MCorsikaRunHeader::ReadEvt(MCorsikaFormat * fInFormat, const uint32_t &blockLength)
     99{
     100    vector<Float_t> f(blockLength);
     101    if (!fInFormat->Read(f.data(), blockLength))
    89102        return kFALSE;
    90103
     
    104117
    105118    memset(fObsLevel, 0, 10*4);
    106     memcpy(fObsLevel, f+4, fNumObsLevel*4);
     119    memcpy(fObsLevel, f.data()+4, fNumObsLevel*4);
    107120
    108121    fSlopeSpectrum  = f[14];
     
    110123    fEnergyMax      = f[16];
    111124
     125    fEnergyCutoffHadrons   = f[17];
     126    fEnergyCutoffMuons     = f[18];
     127    fEnergyCutoffElectrons = f[19];
     128    fEnergyCutoffPhotons   = f[20];
     129
    112130    // Implemented in CORSIKA Version >= 6.822
    113131    fImpactMax = -1;
     
    129147
    130148    // Implemented in CORSIKA Version >= 6.822
    131     memcpy(fAtmosphericLayers, f+248, 5*4);
    132 
    133     memcpy(fAtmosphericCoeffA, f+253, 5*4);
    134     memcpy(fAtmosphericCoeffB, f+258, 5*4);
    135     memcpy(fAtmosphericCoeffC, f+263, 5*4);
     149    memcpy(fAtmosphericLayers, f.data()+248, 5*4);
     150
     151    memcpy(fAtmosphericCoeffA, f.data()+253, 5*4);
     152    memcpy(fAtmosphericCoeffB, f.data()+258, 5*4);
     153    memcpy(fAtmosphericCoeffC, f.data()+263, 5*4);
    136154
    137155    return kTRUE;
     
    178196    // WITH rounding: unbelievable!
    179197    fCerenkovFlag = TMath::Nint(g[75]);
     198    fCerenkovFileOption = TMath::Nint(g[90]);
    180199
    181200    fZdMin = g[79];                // lower edge of theta in °
     
    207226    fWavelengthMax = g[95];        // Cherenkov bandwidth upper end in nm
    208227
     228    fThinningEnergyFractionH  = g[146]; // EFRCTHN
     229    fThinningEnergyFractionEM = g[147]; // EFRCTHN*THINRAT
     230    fThinningWeightLimitH     = g[148]; // WMAX
     231    fThinningWeightLimitEM    = g[149]; // WMAX*WEITRAT
     232    fThinningMaxRadius        = g[150]; // Max radial radius for thinning
     233
    209234    fViewConeInnerAngle = g[151];  // inner angle of view cone (°)
    210235    fViewConeOuterAngle = g[152];  // outer angle of view cone (°)
     
    285310    if (fImpactMax>0)
    286311        *fLog << "Max.sim.Impact: " << fImpactMax << "cm" << endl;
     312
     313    *fLog << "Energy cutoff:  ";
     314    *fLog << fEnergyCutoffHadrons   << "GeV (hadrons), ";
     315    *fLog << fEnergyCutoffMuons     << "GeV (muons), ";
     316    *fLog << fEnergyCutoffElectrons << "GeV (electrons), ";
     317    *fLog << fEnergyCutoffPhotons   << "GeV (photons)";
     318    *fLog << endl;
     319
     320    *fLog << "Thinning:       ";
     321    if (fThinningWeightLimitH>0)
     322    {
     323        *fLog << "HADRONIC: E/Eth>" << fThinningEnergyFractionH  << " (w>" << fThinningWeightLimitH  << "), ";
     324        *fLog << "EM: E/Eth>"       << fThinningEnergyFractionEM << " (w>" << fThinningWeightLimitEM << "), ";
     325        *fLog << "R>" << fThinningMaxRadius << "cm";
     326        *fLog << endl;
     327    }
     328    else
     329        *fLog << "<off>" << endl;
    287330
    288331    *fLog << "Options used:  ";
     
    305348    *fLog << " [" << hex << fCerenkovFlag << "]" << dec << endl;
    306349
     350    if (Has(kCerenkov))
     351    {
     352        *fLog << "File format:    ";
     353        switch (fCerenkovFileOption)
     354        {
     355        case 0:
     356            *fLog << "Cerenkov photons written to DAT-file.";
     357            break;
     358        case 1:
     359            *fLog << "Cerenkov photons written to CER-file";
     360            break;
     361        case 2:
     362            *fLog << "Cerenkov photons written to CER-file / Wavelength as 8th item in THIN option";
     363            break;
     364        default:
     365            *fLog << "Cerenkov photons written to CER-file / Prod. height replaced by distance to array center.";
     366            break;
     367        }
     368        *fLog << " [MCERFI=" << fCerenkovFileOption << "]" << endl;
     369    }
     370
    307371    if (HasLayers())
    308372    {
  • trunk/Mars/mcorsika/MCorsikaRunHeader.h

    r19088 r19332  
    6969
    7070    UInt_t fCerenkovFlag;
     71    UInt_t fCerenkovFileOption;       // MCERFI
     72
     73    Float_t fEnergyCutoffHadrons;     // [GeV]
     74    Float_t fEnergyCutoffMuons;       // [GeV]
     75    Float_t fEnergyCutoffElectrons;   // [GeV]
     76    Float_t fEnergyCutoffPhotons;     // [GeV]
     77
     78    Float_t fThinningEnergyFractionH;  // Hadronic energy limit: EFRCTHN
     79    Float_t fThinningEnergyFractionEM; // EM energy limit: EFRCTHN*THINRAT
     80    Float_t fThinningWeightLimitH;     // Hadronic weight limit: WMAX
     81    Float_t fThinningWeightLimitEM;    // EM weight limit: WMAX*WEITRAT
     82    Float_t fThinningMaxRadius;        // [cm] Max radial raius for thinning
    7183
    7284public:
     
    110122    Bool_t Has(CerenkovFlag_t opt) const { return fCerenkovFlag&opt ? 1 : 0; }
    111123
     124    UInt_t GetCerenkovFileOption() const { return fCerenkovFileOption; }
     125
    112126    static Double_t EarthRadius() { return fgEarthRadius; }
    113127
     
    123137
    124138    // I/O
    125     Bool_t ReadEvt(MCorsikaFormat * fInFormat);
     139    Bool_t ReadEvt(MCorsikaFormat * fInFormat, const uint32_t &blockLength);
    126140    Bool_t ReadEventHeader(Float_t * g);
    127141    Bool_t ReadEvtEnd(MCorsikaFormat * fInFormat, Bool_t runNumberVerify);
     
    130144    void Print(Option_t *t=NULL) const;
    131145
    132     ClassDef(MCorsikaRunHeader, 3)      // storage container for general info
     146    ClassDef(MCorsikaRunHeader, 4)      // storage container for general info
    133147};
    134148#endif
Note: See TracChangeset for help on using the changeset viewer.