Changeset 604 for trunk


Ignore:
Timestamp:
02/21/01 15:23:18 (24 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r603 r604  
    11                                                                  -*-*- END -*-*-
     2 
     3 2000/02/21: Thomas Bretz
     4
     5   * MRawEvtData.cc: Changed ReadEvt according to the new
     6     raw binary format 2001/02/20
     7     
     8   * Added MLog.[h,cc], MLogManip.[h,cc]
     9   
     10   * Adde SetStreamer and fLog to the MParContainer base class
     11   
     12   * Derived MEvtLoop from MParContainer
     13
     14   * Makefile: added 'tar'
     15
     16   * mbase/BaseIncl.h: added fstream.h, TGListBox.h
     17 
     18   * mbase/BaseLinkDef.h: added pragma for gLog and MLog
     19 
     20   * mbase/MAGIC.h: added forward definition for gLog
     21 
     22   * mbase/MEvtLoop.cc: exchanged cout with *fLog, added statements
     23     to provide log-facility to all tasks als parameter containers
     24   
     25   * mbase/MEvtLoop.h: Small changes
     26 
     27   * mbase/MParContainer.h: Added definitions necessary for use of Log-Facility
     28 
     29   * mbase/MParList.[h,cc]: Added SetLogStream
     30 
     31   * mbase/MTask.h: added fLog
     32 
     33   * mbase/MTaskList.[h,cc]: added SetLogStream
     34 
     35   * mbase/Makefile: Added MLog.cc, MLogManip.cc
     36
     37
    238 2000/02/19: Harald Kornmayer   
    339
     
    1248        macros/readCT1.C
    1349 
     50
    1451 2000/02/19: Thomas Bretz
    1552
  • trunk/MagicSoft/Mars/Makefile

    r599 r604  
    101101        @echo "cd .."
    102102
     103tar:    mrproper
     104        @echo "Making tar-file"
     105        @tar -cvf ../mars.tar *
     106        @gzip -9 ../mars.tar
    103107
    104108# @endcode
  • trunk/MagicSoft/Mars/mbase/BaseIncl.h

    r454 r604  
    11#ifndef __CINT__
     2
     3#include <fstream.h>
    24
    35#include <TFile.h>
    46#include <TTree.h>
    57
     8#include <TGListBox.h>
     9
    610#endif // __CINT__
  • trunk/MagicSoft/Mars/mbase/BaseLinkDef.h

    r590 r604  
    44#pragma link off all classes;
    55#pragma link off all functions;
     6
     7#pragma link C++ global gLog;
     8
     9#pragma link C++ class MLog;
    610
    711#pragma link C++ class MTask;
  • trunk/MagicSoft/Mars/mbase/MAGIC.h

    r454 r604  
    3030const Int_t kIRON   = 5626;
    3131
     32//
     33// This is the definition of a global output stream, which by
     34// default pipes all output to the stdout
     35//
     36class MLog;
     37extern MLog gLog;
     38
    3239#endif
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r599 r604  
    2828#include <TStopwatch.h>
    2929
     30#include "MLog.h"
    3031#include "MParList.h"
    3132#include "MTaskList.h"
     
    3334ClassImp(MEvtLoop)
    3435
    35 MEvtLoop::MEvtLoop() : fParlist(NULL)
     36MEvtLoop::MEvtLoop() : fParList(NULL)
    3637{
    3738}
     
    3940MEvtLoop::~MEvtLoop()
    4041{
    41 }
    42 
    43 void MEvtLoop::SetParList(MParList *p)
    44 {
    45     fParlist = p;
    4642}
    4743
     
    5652    // check if the needed parameter list is set.
    5753    //
    58     if (!fParlist)
     54    if (!fParList)
    5955    {
    60         cout << "MEvtLoop::Eventloop - Error: Parlist not initialized." << endl;
     56        *fLog << "MEvtLoop::Eventloop - Error: Parlist not initialized." << endl;
    6157        return kFALSE;
    6258    }
     
    6662    //  the default name is "MTaskList"
    6763    //
    68     fTaskList = (MTaskList*)fParlist->FindObject(tlist);
     64    fTaskList = (MTaskList*)fParList->FindObject(tlist);
    6965    if (!fTaskList)
    7066    {
    71         cout << "MEvtLoop::Eventloop - Error: Cannot find tasklist '" << tlist << "' in parameter list." << endl;
     67        *fLog << "MEvtLoop::Eventloop - Error: Cannot find tasklist '" << tlist << "' in parameter list." << endl;
    7268        return kFALSE;
     69    }
     70
     71    if (fLog != &gLog)
     72    {
     73        fParList ->SetLogStream(fLog);
     74        fTaskList->SetLogStream(fLog);
    7375    }
    7476
     
    7880    //  the parameter list
    7981    //
    80     if (!fTaskList->PreProcess(fParlist))
     82    if (!fTaskList->PreProcess(fParList))
    8183    {
    82         cout << "Error detected while PreProcessing" << endl;
     84        *fLog << "Error detected while PreProcessing" << endl;
    8385        return kFALSE;
    8486    }
     
    98100    //   each event
    99101    //
    100     cout << endl << "Eventloop running (";
     102    *fLog << endl << "Eventloop running (";
    101103
    102104    if (maxcnt<0)
    103         cout << "all";
     105        *fLog << "all";
    104106    else
    105         cout << dec << maxcnt;
     107        *fLog << dec << maxcnt;
    106108
    107     cout << " events)..." << flush;
     109    *fLog << " events)..." << flush;
    108110
    109111    Int_t dummy = maxcnt<0 ? 0 : maxcnt;
     
    130132    clock.Stop();
    131133
    132     cout << "Ready!" << endl << endl;
     134    *fLog << "Ready!" << endl << endl;
    133135
    134136    clock.Print();
    135137
    136     cout << dec << endl
     138    *fLog << dec << endl
    137139        << "Time: " << clock.CpuTime() << "s"
    138140        << " for " << (maxcnt<0?dummy:maxcnt) << " Events"
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.h

    r599 r604  
    1414#endif
    1515
     16#ifndef MPARCONTAINER_H
     17#include "MParContainer.h"
     18#endif
     19
    1620class MParList;
    1721class MTaskList;
    1822
    19 class MEvtLoop
     23class MEvtLoop : public MParContainer
    2024{
    2125private:
    22     MParList  *fParlist;
     26    MParList  *fParList;
    2327    MTaskList *fTaskList;
    2428
     
    2731    virtual ~MEvtLoop();
    2832
    29     void SetParList(MParList *p);
     33    void SetParList(MParList *p)  { fParList = p; }
    3034
    3135    Bool_t PreProcess(const char *tlist="MTaskList");
  • trunk/MagicSoft/Mars/mbase/MParContainer.h

    r600 r604  
    99//                                                                      //
    1010//////////////////////////////////////////////////////////////////////////
    11 
    12 #include <fstream.h>
     11#ifndef MAGIC_H
     12#include "MAGIC.h"
     13#endif
    1314
    1415#ifndef ROOT_TObject
     
    1819#include <TString.h>
    1920#endif
     21
     22class MLog;
     23class ofstream;
     24class ifstream;
    2025
    2126class MParContainer : public TObject
     
    3136
    3237protected:
    33     TString   *fName;            //! parameter container identifier (name)
    34     TString   *fTitle;           //! parameter container title
     38    MLog    *fLog;    //! The general log facility for this object, initialized with the global object
     39
     40    TString *fName;   //! parameter container identifier (name)
     41    TString *fTitle;  //! parameter container title
    3542
    3643public:
    37     MParContainer(const char *name="", const char *title="") { Init(name, title); }
    38     MParContainer(const TString &name, const TString &title) { Init(name, title); }
     44    MParContainer(const char *name="", const char *title="") : fLog(&gLog) { Init(name, title); }
     45    MParContainer(const TString &name, const TString &title) : fLog(&gLog) { Init(name, title); }
    3946    MParContainer(const MParContainer &named);
    4047    MParContainer& operator=(const MParContainer& rhs);
     48
     49    void SetLogStream(MLog *log) { fLog = log; }
     50
    4151    virtual ~MParContainer() {
    4252      //delete fName; delete fTitle;
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r463 r604  
    4242}
    4343
     44void MParList::SetLogStream(MLog *log)
     45{
     46    //
     47    //  create the Iterator over the tasklist
     48    //
     49    TIter Next(&fContainer);
     50
     51    MParContainer *cont=NULL;
     52
     53    //
     54    // loop over all tasks for preproccesing
     55    //
     56    while ( (cont=(MParContainer*)Next()) )
     57        cont->SetLogStream(log);
     58}
    4459
    4560Bool_t MParList::AddToList(MParContainer *obj, MParContainer *where)
  • trunk/MagicSoft/Mars/mbase/MParList.h

    r458 r604  
    2020#endif
    2121
     22class MLog;
    2223class MParContainer;
    2324
     
    4041    Bool_t AddToList(MParContainer *obj, MParContainer *where = NULL);
    4142
     43    void SetLogStream(MLog *log);
     44
    4245    TObject *FindObject(const char *name) const;
    4346
  • trunk/MagicSoft/Mars/mbase/MTask.h

    r458 r604  
    1818class MTask : public MInputStreamID
    1919{
     20    MLog *fLog; //!
    2021
    2122public:
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r458 r604  
    4141}
    4242
     43void MTaskList::SetLogStream(MLog *log)
     44{
     45    //
     46    //  create the Iterator over the tasklist
     47    //
     48    TIter Next(&fTasks);
     49
     50    MTask *task=NULL;
     51
     52    //
     53    // loop over all tasks for preproccesing
     54    //
     55    while ( (task=(MTask*)Next()) )
     56        task->SetLogStream(log);
     57}
     58
     59
    4360Bool_t MTaskList::AddToList(MTask *task, const char *type, MTask *where)
    4461{
     
    94111    //  create the Iterator over the tasklist
    95112    //
    96     TIter next(&fTasks);
     113    TIter Next(&fTasks);
    97114
    98115    MTask *task=NULL;
     
    101118    // loop over all tasks for preproccesing
    102119    //
    103     while ( (task=(MTask*)next()) )
     120    while ( (task=(MTask*)Next()) )
    104121    {
    105122        cout << task->GetName() << "... " << flush;
     
    123140  //  create the Iterator for the TaskList
    124141  //
    125   TIter next(&fTasks);
     142  TIter Next(&fTasks);
    126143  MTask *task=NULL;
    127144   
     
    129146  // loop over all tasks for processing
    130147  //
    131   while ( (task=(MTask*)next()) )
     148  while ( (task=(MTask*)Next()) )
    132149  {
    133150      if (!strcmp(GetStreamId(), task->GetStreamId()) ||
     
    170187  //  create the Iterator for the TaskList
    171188  //
    172   TIter next(&fTasks);
     189  TIter Next(&fTasks);
    173190 
    174191  MTask *task=NULL;
     
    177194  //  loop over all tasks for postprocessing
    178195  // 
    179   while ( (task=(MTask*)next()) )
     196  while ( (task=(MTask*)Next()) )
    180197  {
    181198      cout << task->GetName() << "... " << flush;
  • trunk/MagicSoft/Mars/mbase/MTaskList.h

    r458 r604  
    1717#endif
    1818
     19class MLog;
    1920class MParList;
    2021class MInputStreamID;
     
    3132    MTaskList(MTaskList &ts);
    3233
     34    void SetLogStream(MLog *log);
     35
    3336    Bool_t AddToList(MTask *task, const char *tType="All", MTask *where = NULL);
    3437
  • trunk/MagicSoft/Mars/mbase/Makefile

    r546 r604  
    4141           MArrayB.cc \
    4242           MArrayS.cc \
    43            MTime.cc
     43           MTime.cc \
     44           MLog.cc \
     45           MLogManip.cc
    4446
    4547SRCS    = $(SRCFILES)
  • trunk/MagicSoft/Mars/mraw/MRawEvtData.cc

    r585 r604  
    317317        const UShort_t npix = fRunHeader->GetPixAssignment(i);
    318318
     319        fin.read((Byte_t*)hi.GetArray(), nhi);
     320        AddPixel(npix, &hi, kFALSE);
     321
    319322        // FIXME: Not implemented in the raw files yet
    320323        //if (IsLoGainOn(i, j))
     
    323326        AddPixel(npix, &lo, kTRUE);
    324327        //}
    325 
    326         fin.read((Byte_t*)hi.GetArray(), nhi);
    327         AddPixel(npix, &hi, kFALSE);
    328328    }
    329329}
Note: See TracChangeset for help on using the changeset viewer.