Ignore:
Timestamp:
12/02/08 11:23:24 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mcorsika
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mcorsika/MCorsikaEvtHeader.cc

    r9182 r9186  
    3737
    3838#include "MMcEvt.hxx"
    39 #include "MCorsikaRunHeader.h"
    4039
    4140ClassImp(MCorsikaEvtHeader);
     
    7877// return FALSE if there is no  header anymore, else TRUE
    7978//
    80 Int_t MCorsikaEvtHeader::ReadEvt(std::istream &fin, MCorsikaRunHeader &header)
     79Int_t MCorsikaEvtHeader::ReadEvt(std::istream &fin)
    8180{
    8281    char evth[4];
     
    125124    fX =  f[117];
    126125    fY = -f[97];
    127 
     126/*
    128127    if (fEvtNumber==1)
    129128    {
     
    138137        header.Print();
    139138    }
    140 
     139 */
    141140    fin.seekg(1088-273*4, ios::cur);
    142141
  • trunk/MagicSoft/Mars/mcorsika/MCorsikaEvtHeader.h

    r9182 r9186  
    1313//class ifstream;
    1414#include <iosfwd>
    15 
    16 class MCorsikaRunHeader;
    1715
    1816class MCorsikaEvtHeader : public MParContainer
     
    5755    Float_t GetY() const { return fY; }
    5856
    59     Int_t ReadEvt(istream& fin, MCorsikaRunHeader &header);    // read in event header block
     57    Int_t  ReadEvt(istream& fin);    // read in event header block
    6058    Bool_t ReadEvtEnd(istream& fin); // read in event end block
    6159
  • trunk/MagicSoft/Mars/mcorsika/MCorsikaRead.cc

    r9182 r9186  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    19 !
    20 !   Copyright: MAGIC Software Development, 2000-2007
     18!   Author(s): Thomas Bretz  11/2008 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: Software Development, 2000-2008
    2121!
    2222!
     
    2626//
    2727//  MCorsikaRead
    28 //
    29 //  This tasks reads the raw binary file like specified in the TDAS???
    30 //  and writes the data in the corresponding containers which are
    31 //  either retrieved from the parameter list or created and added.
    32 //
    33 //  Use SetInterleave() if you don't want to read all events, eg
    34 //    SetInterleave(5) reads only each 5th event.
    3528//
    3629//  Input Containers:
     
    3831//
    3932//  Output Containers:
    40 //   MCorsikaRunHeader, MCorsikaEvtHeader, MCorsikaEvtData, MCorsikaCrateArray, MCorsikaEvtTime
     33//   MCorsikaRunHeader
     34//   MCorsikaEvtHeader
     35//   MPhotonEvent
    4136//
    4237//////////////////////////////////////////////////////////////////////////////
     
    5146#include "MLogManip.h"
    5247
    53 //#include "MZlib.h"
    54 //#include "MTime.h"
    5548#include "MParList.h"
    5649#include "MStatusDisplay.h"
     
    5952#include "MCorsikaEvtHeader.h"
    6053
    61 //#include "MPhotonData.h"
    6254#include "MPhotonEvent.h"
    6355
     
    10395//
    10496MCorsikaRead::MCorsikaRead(const char *fname, const char *name, const char *title)
    105     : fRunHeader(0), fEvtHeader(0), fEvent(0), fEvtData(0), fForceMode(kFALSE),
     97    : fRunHeader(0), fEvtHeader(0), fEvent(0), /*fEvtData(0),*/ fForceMode(kFALSE),
    10698    fFileNames(0), fNumFile(0), fNumEvents(0), fNumTotalEvents(0),
    10799    fIn(0), fParList(0)
     
    212204
    213205    const char *expname = gSystem->ExpandPathName(name);
    214     fIn = new fstream(expname);
     206    fIn = new ifstream(expname);
    215207
    216208    const Bool_t noexist = !(*fIn);
     
    245237    if (!fRunHeader->ReadEvt(*fIn))
    246238        return kERROR;
    247 
    248     if (!(*fIn))
    249     {
    250         *fLog << err << "Error: Accessing file '" << name << "'" << endl;
    251         return kERROR;
    252     }
     239//    if (!fEvtHeader->ReadRunHeader(*fIn, *fRunHeader))
     240//        return kERROR;
    253241
    254242    const streampos pos = fIn->tellg();
    255 
    256243    if (!ReadEvtEnd())
    257244        return kERROR;
    258 
    259245    fIn->seekg(pos, ios::beg);
    260246
     
    267253    //  We print it after the first event was read because
    268254    //  we still miss information which is stored in the event header?!?
    269     //if (print)
    270     //    fRunHeader->Print();
     255    if (print)
     256        fRunHeader->Print();
    271257
    272258    if (!fParList)
     
    386372        return kFALSE;
    387373
    388     fEvtData = (MPhotonData*)pList->FindCreateObj("MPhotonData");
    389     if (!fEvtData)
    390         return kFALSE;
    391 
    392374    fEvent = (MPhotonEvent*)pList->FindCreateObj("MPhotonEvent");
    393375    if (!fEvent)
    394376        return kFALSE;
    395377
    396     //*fLog << inf << "Maintaining " << fEvent->GetClassName() << " found in MCorsikaEvent." << endl;
    397 
    398378    *fLog << inf << "Calculating number of total events..." << flush;
    399379    if (!CalcNumTotalEvents())
     
    419399    // if there is no next event anymore stop eventloop
    420400    //
    421     Int_t rc = fEvtHeader->ReadEvt(fin, *fRunHeader); //read event header block
     401    Int_t rc = fEvtHeader->ReadEvt(fin); //read event header block
    422402    if (!rc)
    423403        return kFALSE;
  • trunk/MagicSoft/Mars/mcorsika/MCorsikaRead.h

    r9182 r9186  
    1212class MCorsikaRunHeader;
    1313class MCorsikaEvtHeader;
    14 class MPhotonData;
    1514class MPhotonEvent;
    1615
     
    1817{
    1918private:
    20     MCorsikaRunHeader  *fRunHeader;  // run header information container to fill from file
    21     MCorsikaEvtHeader  *fEvtHeader;  // event header information container to fill from file
     19    MCorsikaRunHeader *fRunHeader;  // run header information container to fill from file
     20    MCorsikaEvtHeader *fEvtHeader;  // event header information container to fill from file
    2221    MPhotonEvent      *fEvent;      // event information
    23     MPhotonData       *fEvtData;    // raw evt data information container to fill from file
    2422
    25     Bool_t          fForceMode;     // Force mode skipping defect events
     23    Bool_t          fForceMode;     // Force mode skipping defect RUNE
    2624
    2725    TList    *fFileNames;      // list of file names
     
    3028    UInt_t    fNumTotalEvents; //! total number of events in all files
    3129
    32     fstream *fIn;             //! input stream (file to read from)
     30    ifstream *fIn;             //! input stream (file to read from)
    3331
    3432    MParList *fParList;        //! tasklist to call ReInit from
  • trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.cc

    r9182 r9186  
    170170    fin.seekg(1020, ios::cur);     // skip the remaining data of this block
    171171
    172     return kTRUE;
     172    // -------------------- Read first event header -------------------
     173
     174    char evth[4];
     175    fin.read(evth, 4);
     176    if (memcmp(evth, "EVTH", 4))
     177    {
     178        *fLog << err << "ERROR - Wrong identifier: EVTH expected." << endl;
     179        return kFALSE;
     180    }
     181
     182    Float_t g[273];
     183    fin.read((char*)&g, 273*4);
     184    if (fin.eof())
     185        return kFALSE;
     186
     187    fin.seekg(-274*4, ios::cur);
     188
     189    const Int_t n = TMath::Nint(g[96]);
     190    if (n!=1)
     191    {
     192        *fLog << err << "ERROR - Currently only one impact parameter per event is supported." << endl;
     193        return kFALSE;
     194    }
     195
     196    //fImpactMax = g[86];
     197
     198    fZdMin = g[79];
     199    fZdMax = g[80];
     200    fAzMin = 180-g[81];
     201    fAzMax = 180-g[82];
     202
     203    fViewConeInnerAngle = g[151];
     204    fViewConeOuterAngle = g[152];
     205
     206    return kTRUE;;
    173207}
    174208
  • trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.h

    r9182 r9186  
    3333    Float_t  fAzMax;                     // [rad] Azimuth (north=0; west=90)
    3434
     35    //Float_t  fImpactMax;              // [cm] Maximum simulated impact
     36
    3537    Float_t fViewConeInnerAngle;      // [deg]
    3638    Float_t fViewConeOuterAngle;      // [deg]
     
    4850    Float_t GetAzMax() const { return fAzMax; }
    4951
     52    //Float_t GetImpactMax() const { return fImpactMax; }
     53
     54    Float_t GetViewConeOuterAngle() const { return fViewConeOuterAngle; }
     55
    5056    UInt_t GetNumEvents() const { return fNumEvents; }
    5157
Note: See TracChangeset for help on using the changeset viewer.