Ignore:
Timestamp:
06/03/02 10:10:21 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MAGIC.h

    r1278 r1337  
    2222//     ParticleId for Monte Carlo simulation
    2323//
    24 const Int_t kGAMMA  =    0;
     24const Int_t kGAMMA  =    1;
    2525const Int_t kPROTON =   14;
    2626const Int_t kHELIUM =  402;
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r1320 r1337  
    215215// --------------------------------------------------------------------------
    216216//
     217//  Find an object with the same name in the list and replace it with
     218//  the new one. If the kIsOwner flag is set and the object was not
     219//  created automatically, the object is deleted.
     220//
     221Bool_t MParList::Replace(MParContainer *cont)
     222{
     223    //
     224    //  check if the object (you want to add) exists
     225    //
     226    if (!cont)
     227        return kFALSE;
     228
     229    TObject *obj = FindObject(cont->GetName());
     230    if (!obj)
     231    {
     232        *fLog << warn << "No object with the same name '";
     233        *fLog << cont->GetName() << "' in list... ignored." << endl;
     234        return kFALSE;
     235    }
     236
     237    fContainer->Remove(obj);
     238
     239    if (TestBit(kIsOwner) && !fAutodelete->FindObject(obj))
     240        delete obj;
     241
     242    *fLog << inf << "MParContainer '" << obj->GetName() << "' found and replaced..." << endl;
     243
     244    return AddToList(cont);
     245}
     246
     247// --------------------------------------------------------------------------
     248//
    217249//  Find an object in the list.
    218250//  'name' is the name of the object you are searching for.
  • trunk/MagicSoft/Mars/mbase/MParList.h

    r1186 r1337  
    4242    void   AddToList(TObjArray *list);
    4343
     44    Bool_t Replace(MParContainer *obj);
     45
    4446    void SetLogStream(MLog *log);
    4547
  • trunk/MagicSoft/Mars/mbase/MReadMarsFile.cc

    r1332 r1337  
    108108Bool_t MReadMarsFile::Notify()
    109109{
     110    Int_t runtype = -1;
     111/*
     112    const MRawRunHeader *runheader = (MRawRunHeader*)fParList->FindObject("MRawRunHeader");
     113    if (runheader)
     114        runtype = runheader->GetRunType();
     115*/
    110116    //
    111117    // Try to read the new run headers. If reading the new run header
    112118    // was successfull call the ReInits
    113119    //
     120    const Int_t idx = GetFileIndex();
     121    fRun->SetEventNum(idx<0?0:idx); // Assumption: One Entry per File!
    114122    if (fRun->Process())
    115123    {
    116         *fLog << inf << "MReadMarsFile: Switching to '" << GetFileName() << "' ";
    117         *fLog << "(before event #" << GetEventNum()-1 << ")" << endl;
    118 
     124        *fLog << inf << "MReadMarsFile: Switching to #" << GetFileIndex();
     125        *fLog << " '" << GetFileName() << "' (before event #";
     126        *fLog << GetEventNum()-1 << ")" << endl;
     127/*
     128        if (runheader)
     129            if (runtype != runheader->GetRunType())
     130                *fLog << warn << "Warning - You are mixing files with different run types!" << endl;
     131*/
    119132        if (fTaskList->ReInit())
    120133            return kTRUE;
     
    137150Bool_t MReadMarsFile::PreProcess(MParList *pList)
    138151{
     152    fParList  = pList;
    139153    fTaskList = (MTaskList*)pList->FindObject("MTaskList");
    140154
    141155    if (!fRun->PreProcess(pList))
     156    {
     157        *fLog << err << "Error - PreProcessing MReadMarsFile::fRun... aborting." << endl;
    142158        return kFALSE;
     159    }
    143160
     161    const Int_t idx = GetFileIndex();
     162    fRun->SetEventNum(idx<0?0:idx); // Assumption: One Entry per File!
    144163    if (!fRun->Process())
     164    {
     165        *fLog << err << "Error - Processing MReadMarsFile::fRun... aborting." << endl;
    145166        return kFALSE;
    146 
    147     fRun->SetEventNum(0);
     167    }
    148168
    149169    return MReadTree::PreProcess(pList);
  • trunk/MagicSoft/Mars/mbase/MReadMarsFile.h

    r1114 r1337  
    66#endif
    77
     8class MParList;
    89class MTaskList;
    910
     
    1213private:
    1314    MReadTree *fRun;
     15    MParList  *fParList;  //! Parlist for reinitialization
    1416    MTaskList *fTaskList; //! Tasklist for reinitialization
    1517
  • trunk/MagicSoft/Mars/mbase/MReadTree.cc

    r1333 r1337  
    5555#include <TFile.h>           // TFile::GetName
    5656#include <TChain.h>
     57#include <TSystem.h>         // gSystem->ExpandPath
    5758#include <TGProgressBar.h>
    5859#include <TChainElement.h>
     
    746747// --------------------------------------------------------------------------
    747748//
     749//  Return the number of the file in the chain, -1 in case of an error
     750//
     751Int_t MReadTree::GetFileIndex() const
     752{
     753    return fChain->GetTreeNumber();
     754    /*
     755    const TString filename = fChain->GetFile()->GetName();
     756
     757    int i=0;
     758    TObject *file = NULL;
     759
     760    TIter Next(fChain->GetListOfFiles());
     761    while ((file=Next()))
     762    {
     763        if (filename==gSystem->ExpandPathName(file->GetTitle()))
     764            return i;
     765        i++;
     766    }
     767    return -1;
     768    */
     769}
     770
     771// --------------------------------------------------------------------------
     772//
    748773//  This schedules a TObject which Notify(9 function is called in case
    749774//  of MReadTree (TChain) switches from one file in the chain to another
     
    759784    *fLog << all << GetDescriptor() << dec << endl;
    760785    *fLog << setfill('-') << setw(strlen(GetDescriptor())) << "" << endl;
    761     *fLog << " Files:" << endl;
     786    *fLog << " Files [Tree]:" << endl;
    762787
    763788    int i = 0;
     
    765790    TObject *obj = NULL;
    766791    while ((obj=Next()))
    767         *fLog << " " << i++ << ") " << obj->GetName() << endl;
    768 
    769     *fLog << " Entries: " << fNumEntries << endl;
    770     *fLog << " Next Entry: " << fNumEntry << endl;
    771 }
     792        *fLog << " " << i++ << ") " << obj->GetTitle() << " [" << obj->GetName() << "]" << endl;
     793
     794    *fLog << " Total Number of Entries: " << fNumEntries << endl;
     795    *fLog << " Next Entry to read: " << fNumEntry << endl;
     796}
  • trunk/MagicSoft/Mars/mbase/MReadTree.h

    r1203 r1337  
    5959
    6060    TString GetFileName() const;
     61    Int_t   GetFileIndex() const;
    6162
    6263    virtual void   AddNotify(TObject *obj);
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r1332 r1337  
    303303    fParList = pList;
    304304
    305     fTasksProcess.Delete();
     305    fTasksProcess.Clear();
    306306
    307307    //
     
    317317    while ((task=(MTask*)Next()))
    318318    {
     319        *fLog << all << task->GetName() << "... " << flush;
     320
    319321        if (CheckClassForProcess(task->IsA()))
    320322            fTasksProcess.Add(task);
     
    457459    while ( (task=(MTask*)Next()) )
    458460    {
     461        *fLog << all << task->GetName() << "... " << flush;
     462
    459463        if (!task->CallPostProcess())
    460464            return kFALSE;
    461 
    462         *fLog << all << task->GetName() << "... " << flush;
    463465    }
    464466
  • trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc

    r1331 r1337  
    263263}
    264264
     265/*
     266Bool_t MWriteAsciiFile::PreProcess(MParList *plist)
     267{
     268    MDataChain *chain=NULL;
     269
     270    TIter Next(&fList);
     271    while (((MDataChain*)chain=Next()))
     272        if (!chain->PreProcess(plist))
     273            return kFALSE;
     274
     275    return MWriteFile::PreProcess(plist);
     276}
     277
     278void MWriteAsciiFile::Add(const char *rule)
     279{
     280    MDataChain *chain = new MDataChain(rule);
     281    fList.Add(chain);
     282}
     283*/
  • trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.h

    r1236 r1337  
    2929
    3030    TString fNameFile;
    31 
     31/*
     32    TList fList;
     33*/
    3234    virtual void   CheckAndWrite() const;
    3335    virtual Bool_t IsFileOpen() const;
     
    4749    void AddContainer(MParContainer *cont, const char *member="", Double_t scale=1);
    4850
     51    /*
     52     Bool_t PreProcess(MParList *plist);
     53     void Add(const char *rule);
     54     */
     55
    4956    ClassDef(MWriteAsciiFile, 0) // Class to write one container to an ascii file
    5057};
Note: See TracChangeset for help on using the changeset viewer.