Changeset 19338 for trunk/Mars/msim


Ignore:
Timestamp:
10/30/18 17:29:17 (6 years ago)
Author:
tbretz
Message:
This allows to distinguish between the thinning file format (8 floats per bunch) and the normal one (7 floats per bunch)
Location:
trunk/Mars/msim
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/msim/MPhotonEvent.cc

    r18549 r19338  
    613613}
    614614
    615 Int_t MPhotonEvent::ReadCorsikaEvt(Float_t * data, Int_t numEvents, Int_t arrayIdx)
    616 {
     615Int_t MPhotonEvent::ReadCorsikaEvt(const vector<Float_t> &data, const uint32_t &blockLength, const Int_t &arrayIdx)
     616{
     617    if (data.size()%blockLength)
     618    {
     619        gLog << err << "ERROR - Size mismatch in photon bunch data." << endl;
     620        return kERROR;   // Error occured
     621    }
     622
     623    const uint32_t N = data.size()/blockLength;
     624
    617625   Int_t n = 0;
    618626
    619    for (Int_t event = 0; event < numEvents; event++)
    620       {
    621       const Int_t rc = Add(n).FillCorsika(data + 7 * event, arrayIdx);
     627   for (const Float_t *ptr=data.data(); ptr<data.data()+data.size(); ptr+=blockLength)
     628   {
     629       const Int_t rc = blockLength==7 ?
     630           Add(n).FillCorsika(ptr, arrayIdx) :
     631           Add(n).FillCorsikaThin(ptr, arrayIdx);
    622632
    623633      switch (rc)
  • trunk/Mars/msim/MPhotonEvent.h

    r18541 r19338  
    6464    Int_t ReadEventIoEvt(MCorsikaFormat *fInFormat);
    6565    Int_t ReadEventIoEvtCompact(MCorsikaFormat *fInFormat);
    66     Int_t ReadCorsikaEvt(Float_t * data, Int_t numEvents, Int_t arrayIdx);
     66    Int_t ReadCorsikaEvt(const vector<Float_t> &data, const uint32_t &blocklength, const Int_t &arrayIdx);
    6767
    6868    // TObject
Note: See TracChangeset for help on using the changeset viewer.