Ignore:
Timestamp:
05/16/03 13:11:23 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mfileio
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc

    r2091 r2117  
    549549    // Check for the existence of a next file to read
    550550    //
    551     TNamed *file = (TNamed*)fFileNames->First();
    552     if (!file)
    553         return kFALSE;
     551    if (fNumFile >= (UInt_t)fFileNames->GetSize())
     552        return kFALSE;
     553
     554    TNamed *file = (TNamed*)fFileNames->At(fNumFile);
     555
     556    //TNamed *file = (TNamed*)fFileNames->GetFirst();
     557    //if (!file)
     558    //    return kFALSE;
    554559
    555560    //
     
    565570    // Remove this file from the list of pending files
    566571    //
    567     fFileNames->Remove(file);
     572    //fFileNames->Remove(file);
    568573
    569574    *fLog << inf << "Open file: '" << name << "'" << endl;
    570575
    571576    if (!CheckHeader(fname))
    572     {
    573         *fLog << "OpenNextFile : CheckHeader(fname) is FALSE" << endl;
    574         return kFALSE;
    575     }
     577        return kFALSE;
     578
     579    fNumFile++;
    576580
    577581    fIn = new ifstream(fname);
    578582
    579583    *fLog << inf << "-----------------------------------------------------------------------" << endl;
    580 
    581584
    582585    switch (ReadRunHeader())
     
    690693}
    691694
    692 // --------------------------------------------------------------------------
    693 //
    694 // Open the first file in the list. Check for the output containers or create
    695 // them if they don't exist.
    696 //
    697 // Initialize the size of the MPedestalCam container to 127 pixels (CT1 camera)
    698 //
    699 Bool_t MCT1ReadPreProc::PreProcess(MParList *pList)
    700 {
    701 
    702     fParList = pList;
    703 
    704     //
    705     //  look for the HourAngle container in the plist
    706     //
    707     fHourAngle = (MParameterD*)pList->FindCreateObj("MParameterD", "HourAngle");
    708     if (!fHourAngle)
    709         return kFALSE;
    710     fHourAngle->SetTitle("Store the CT1 hour angle [deg]");
    711 
    712     //
    713     //  look for the ThetaOrig container in the plist
    714     //
    715     fThetaOrig = (MParameterD*)pList->FindCreateObj("MParameterD", "ThetaOrig");
    716     if (!fThetaOrig)
    717         return kFALSE;
    718     fThetaOrig->SetTitle("Store the original CT1 zenith angle [rad]");
    719 
    720     //
    721     //  look for the MCerPhotEvt class in the plist
    722     //
    723     fNphot = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt");
    724     if (!fNphot)
    725         return kFALSE;
    726 
    727     //
    728     //  look for the pedestal class in the plist
    729     //
    730     fPedest = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
    731     if (!fPedest)
    732         return kFALSE;
    733 
    734     //
    735     //  look for the time class in the plist
    736     //
    737     fTime = (MTime*)pList->FindCreateObj("MTime");
    738     if (!fTime)
    739         return kFALSE;
    740 
    741     //
    742     //  look for the pedestal class in the plist
    743     //
    744     fBlinds = (MBlindPixels*)pList->FindCreateObj("MBlindPixels");
    745     if (!fBlinds)
    746         return kFALSE;
    747 
    748     //
    749     //  look for the source position in the camera
    750     //
    751     fSrcPos = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam");
    752     if (!fSrcPos)
    753         return kFALSE;
    754 
    755     //
    756     //  look for the camera geometry
    757     //
    758     fGeom = (MGeomCam*)pList->FindCreateObj("MGeomCamCT1", "MGeomCam");
    759     if (!fGeom)
    760         return kFALSE;
    761 
    762     //
    763     //  look for the mc event class
    764     //
    765     fMcEvt = (MMcEvt*)pList->FindCreateObj("MMcEvt");
    766     if (!fMcEvt)
    767         return kFALSE;
    768 
    769     //
    770     //  look for the mc trigger class
    771     //
    772     fMcTrig = (MMcTrig*)pList->FindCreateObj("MMcTrig");
    773     if (!fMcTrig)
    774         return kFALSE;
    775 
    776     //
    777     //  look for the raw run header class
    778     //
    779     fRawRunHeader = (MRawRunHeader*)pList->FindCreateObj("MRawRunHeader");
    780     if (!fRawRunHeader)
    781         return kFALSE;
    782 
    783     fBinningT = (MBinning*)pList->FindObject("BinningTheta");
    784 
     695Bool_t MCT1ReadPreProc::Rewind()
     696{
    785697    fNumFilterEvts = 0;
    786698    fNumEvents     = 0;
    787699    fNumRuns       = 0;
     700    fNumFile       = 0;
     701    if (fIn)
     702        delete fIn;
     703
     704    fIn=NULL;
     705
     706    return kTRUE;
     707}
     708
     709// --------------------------------------------------------------------------
     710//
     711// Open the first file in the list. Check for the output containers or create
     712// them if they don't exist.
     713//
     714// Initialize the size of the MPedestalCam container to 127 pixels (CT1 camera)
     715//
     716Bool_t MCT1ReadPreProc::PreProcess(MParList *pList)
     717{
     718    fParList = pList;
     719
     720    //
     721    //  look for the HourAngle container in the plist
     722    //
     723    fHourAngle = (MParameterD*)pList->FindCreateObj("MParameterD", "HourAngle");
     724    if (!fHourAngle)
     725        return kFALSE;
     726    fHourAngle->SetTitle("Store the CT1 hour angle [deg]");
     727
     728    //
     729    //  look for the ThetaOrig container in the plist
     730    //
     731    fThetaOrig = (MParameterD*)pList->FindCreateObj("MParameterD", "ThetaOrig");
     732    if (!fThetaOrig)
     733        return kFALSE;
     734    fThetaOrig->SetTitle("Store the original CT1 zenith angle [rad]");
     735
     736    //
     737    //  look for the MCerPhotEvt class in the plist
     738    //
     739    fNphot = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt");
     740    if (!fNphot)
     741        return kFALSE;
     742
     743    //
     744    //  look for the pedestal class in the plist
     745    //
     746    fPedest = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
     747    if (!fPedest)
     748        return kFALSE;
     749
     750    //
     751    //  look for the time class in the plist
     752    //
     753    fTime = (MTime*)pList->FindCreateObj("MTime");
     754    if (!fTime)
     755        return kFALSE;
     756
     757    //
     758    //  look for the pedestal class in the plist
     759    //
     760    fBlinds = (MBlindPixels*)pList->FindCreateObj("MBlindPixels");
     761    if (!fBlinds)
     762        return kFALSE;
     763
     764    //
     765    //  look for the source position in the camera
     766    //
     767    fSrcPos = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam");
     768    if (!fSrcPos)
     769        return kFALSE;
     770
     771    //
     772    //  look for the camera geometry
     773    //
     774    fGeom = (MGeomCam*)pList->FindCreateObj("MGeomCamCT1", "MGeomCam");
     775    if (!fGeom)
     776        return kFALSE;
     777
     778    //
     779    //  look for the mc event class
     780    //
     781    fMcEvt = (MMcEvt*)pList->FindCreateObj("MMcEvt");
     782    if (!fMcEvt)
     783        return kFALSE;
     784
     785    //
     786    //  look for the mc trigger class
     787    //
     788    fMcTrig = (MMcTrig*)pList->FindCreateObj("MMcTrig");
     789    if (!fMcTrig)
     790        return kFALSE;
     791
     792    //
     793    //  look for the raw run header class
     794    //
     795    fRawRunHeader = (MRawRunHeader*)pList->FindCreateObj("MRawRunHeader");
     796    if (!fRawRunHeader)
     797        return kFALSE;
     798
     799    fBinningT = (MBinning*)pList->FindObject("BinningTheta");
     800
     801    Rewind();
    788802
    789803    fPedest->InitSize(iMAXNUMPIX);
     
    11151129    }
    11161130
     1131    delete fIn;
     1132    fIn = NULL;
     1133
    11171134    return GetSelector() ? GetSelector()->CallPostProcess() : kTRUE;
    11181135}
  • trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.h

    r1952 r2117  
    5050    Bool_t fIsMcFile;       // Flag whether current run is a MC run
    5151
     52    UInt_t fNumFile;
    5253    UInt_t fNumEvents;      // number of events counted in all runs in all files
    5354    UInt_t fNumEventsInRun; // number of events in the counted in th ecurrent run
     
    7677    Bool_t PostProcess();
    7778
     79    Bool_t Rewind();
     80
    7881public:
    7982    MCT1ReadPreProc(const char *filename=NULL,
  • trunk/MagicSoft/Mars/mfileio/MRead.cc

    r1902 r2117  
    4141
    4242ClassImp(MRead);
     43
     44Bool_t MRead::Rewind()
     45{
     46    *fLog << err << "ERROR - Rewind() not implemented for " << GetDescriptor() << endl;
     47    return kFALSE;
     48}
    4349
    4450// --------------------------------------------------------------------------
  • trunk/MagicSoft/Mars/mfileio/MRead.h

    r1880 r2117  
    1717
    1818    virtual UInt_t GetEntries() = 0;
     19    virtual Bool_t Rewind();
    1920
    2021    void SetSelector(MFilter *f) { fSelector = f; }
  • trunk/MagicSoft/Mars/mfileio/MReadMarsFile.h

    r1668 r2117  
    2626    Int_t AddFile(const char *fname, Int_t entries=-1);
    2727
     28    Bool_t Rewind() { if (fRun) fRun->Rewind(); MReadTree::Rewind(); return kTRUE; }
     29
    2830    ClassDef(MReadMarsFile, 1)  // Reads a tree from file(s) and the information from the 'RunHeader'-tree
    2931};
  • trunk/MagicSoft/Mars/mfileio/MReadTree.cc

    r2106 r2117  
    131131    //
    132132    // Delete all the pointers to pointers to the objects where the
    133     // branche data gets stored.
     133    // branche data gets stored. FIXME: When PreProcessed twice this
     134    // creates a memory leak!
    134135    //
    135136    TIter Next(fChain->GetStatus());
     
    239240    if (numfiles>0)
    240241        SetBit(kChainWasChanged);
    241 
    242     *fLog << warn << "WARNING: '" << fname << "' not added to " << GetDescriptor() << endl;
     242    else
     243        *fLog << warn << "WARNING: '" << fname << "' not added to " << GetDescriptor() << endl;
    243244
    244245    return numfiles;
  • trunk/MagicSoft/Mars/mfileio/MReadTree.h

    r1836 r2117  
    5757    UInt_t GetEntries();
    5858
    59     TString    GetFileName() const;
    60     Int_t      GetFileIndex() const;
     59    TString GetFileName() const;
     60    Int_t   GetFileIndex() const;
    6161
    62     virtual void   AddNotify(TObject *obj);
    63     virtual void   SetOwner(Bool_t flag=kTRUE);
    64     virtual void   Print(Option_t *opt="") const;
     62    virtual void AddNotify(TObject *obj);
     63    virtual void SetOwner(Bool_t flag=kTRUE);
    6564
    66     virtual Int_t  AddFile(const char *fname, Int_t entries=-1);
    67     virtual Int_t  AddFiles(const MReadTree &read);
     65    virtual Int_t AddFile(const char *fname, Int_t entries=-1);
     66    virtual Int_t AddFiles(const MReadTree &read);
    6867
    69     virtual Bool_t PreProcess(MParList *pList);
    70     virtual Bool_t Process();
    71     virtual Bool_t PostProcess();
     68    Bool_t PreProcess(MParList *pList);
     69    Bool_t Process();
     70    Bool_t PostProcess();
    7271
    73     virtual Bool_t Notify();
     72    Bool_t Notify();
     73    Bool_t Rewind() { SetEventNum(0); return kTRUE; }
     74    void   Print(Option_t *opt="") const;
    7475
    7576    ClassDef(MReadTree, 1)      // Reads a tree from file(s)
Note: See TracChangeset for help on using the changeset viewer.