Ignore:
Timestamp:
12/02/03 15:38:59 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mfileio
Files:
2 edited

Legend:

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

    r2560 r2590  
    2525/////////////////////////////////////////////////////////////////////////////
    2626//
    27 // MReadReports                                                                   //
     27// MReadReports
     28//
     29// Read from a file events from different trees ordered in time, eg:
     30//
     31// Having a file with:
     32//
     33//      Tree1         Tree2         Tree3
     34//      ------------  ------------  -----------
     35//      (0) MTime[0]
     36//                    (0) MTime[1]
     37//      (1) MTime[2]
     38//      (2) MTime[3]
     39//                                  (0) MTime[1]
     40//      (3) MTime[4]
     41//
     42// MReadReports will read the events in the tree in the following order:
     43//   <0> (0) from Tree1
     44//   <1> (0) from Tree2
     45//   <2> (1) from Tree1
     46//   <3> (2) from Tree1
     47//   <4> (0) from Tree3
     48//   <5> (3) from Tree1
     49//   ...
     50//
     51// To tell MReadReports which Trees to read use: MReadReports::AddTree()
     52// To schedule a file for reading use MReadReports::AddFile()
     53//
     54// All calls to AddTree _must_ be before the calls to AddFile!
     55//
     56// After reading from a tree with the name 'TreeName' the stream id of
     57// the main tasklist ('MTaskList' found in MParList in PreProcess) is
     58// set to this name. This means that only tasks having this stream id
     59// are executed.
    2860//
    2961/////////////////////////////////////////////////////////////////////////////
     
    4577using namespace std;
    4678
     79// --------------------------------------------------------------------------
     80//
     81// Default constructor. Set fName and fTitle. Instatiate fTrees and fChains.
     82// Call SetOwner for fTrees and fChains
     83//
    4784MReadReports::MReadReports()
    4885{
    49     fName = "MRead";
    50     fTitle = "MReadReports";
     86    fName  = "MRead";
     87    fTitle = "Reads events and reports from a root file ordered in time";
    5188
    5289    fTrees  = new MTaskList("MReadReports");
     
    5794}
    5895
     96// --------------------------------------------------------------------------
     97//
     98// Destructor, delete everything which was allocated by this task...
     99//
    59100MReadReports::~MReadReports()
    60101{
     
    76117}
    77118
     119// --------------------------------------------------------------------------
     120//
     121// Schedule the contents of this tree for reading. As a default the time
     122// branch which is used for the ordering is assumed to by "MTime"+tree.
     123// If this is not the case you can overwrite the default specifying the
     124// name in time.
     125//
     126// All calls to AddTree _must_ be before the calls to AddFile!
     127//
    78128void MReadReports::AddTree(const char *tree, const char *time)
    79129{
     
    97147}
    98148
     149// --------------------------------------------------------------------------
     150//
     151// Schedule a file or several files (using widcards) for reading.
     152//
     153// All calls to AddTree _must_ be before the calls to AddFile!
     154//
    99155Int_t MReadReports::AddFile(const char *fname, Int_t entries)
    100156{
     
    109165}
    110166
     167// --------------------------------------------------------------------------
     168//
     169// Find MTaskList and store a pointer to it in fList.
     170// Delete all entries in fChains.
     171// Create all chains to read the time in the trees in advance.
     172// Enable only the time-branch in this chains.
     173// PreProcess fTrees (a MTaskList storing MReadTree tasks for reading)
     174//
    111175Int_t MReadReports::PreProcess(MParList *plist)
    112176{
     
    162226}
    163227
     228// --------------------------------------------------------------------------
     229//
     230// Return the MTime corresponding to this TChain...
     231//
    164232MTime** MReadReports::GetTime(TChain *c) const
    165233{
     
    168236}
    169237
     238// --------------------------------------------------------------------------
     239//
     240// Check which is the next tree to read from. Read an event from this tree.
     241// Sets the StreamId accordingly.
     242//
    170243Int_t MReadReports::Process()
    171244{
     
    226299}
    227300
     301// --------------------------------------------------------------------------
     302//
     303// PostProcess all MReadTree tasks in fTrees.
     304//
    228305Int_t MReadReports::PostProcess()
    229306{
     
    231308}
    232309
     310// --------------------------------------------------------------------------
     311//
     312// PrintStatistics of this task and of the MReadTree tasks in fTress
     313//
    233314void MReadReports::PrintStatistics(const Int_t lvl, Bool_t title) const
    234315{
  • trunk/MagicSoft/Mars/mfileio/MReadReports.h

    r2556 r2590  
    1717{
    1818private:
    19     MTaskList *fTrees;
    20     TList *fChains;
     19    MTaskList *fTrees;  // Hold the trees which are scheduled for reading
     20    TList     *fChains; // Hold TChains to read the times in advance
    2121
    22     TArrayL fPos;
     22    TArrayL    fPos;    // Store the position in each tree/chain
    2323
    24     MTask *fList;
     24    MTask     *fList;   // pointer to the task list to set the stream id
    2525
    2626    MTime** GetTime(TChain *c) const;
    2727
    28     UInt_t GetEntries() { return 0; }
     28    UInt_t  GetEntries() { return 0; }
     29
     30    Int_t   PreProcess(MParList *plist);
     31    Int_t   Process();
     32    Int_t   PostProcess();
    2933
    3034public:
     
    3640    void  AddToBranchList(const char *name);
    3741
    38     void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE) const;
     42    void  PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE) const;
    3943
    40     Int_t PreProcess(MParList *plist);
    41     Int_t Process();
    42     Int_t PostProcess();
    43 
    44     ClassDef(MReadReports, 0)   // Base class for a reading task
     44    ClassDef(MReadReports, 0) // Reads events and reports from a root file ordered in time
    4545};
    4646
Note: See TracChangeset for help on using the changeset viewer.