Changeset 1036 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
11/06/01 14:00:17 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MReadMarsFile.cc

    r1035 r1036  
    2727// MReadMarsFile                                                           //
    2828//                                                                         //
    29 // This tasks opens all branches in a specified tree and creates the       //
    30 // corresponding parameter containers if not already existing in the       //
    31 // parameter list.                                                         //
     29// This task works more or less like MReadTree, but in addition PreProcess //
     30// reads all the information from the 'RunHeader' tree.                    //
    3231//                                                                         //
    33 // The Process function reads one events from the tree. To go through the  //
    34 // events of one tree make sure that the event number is increased from    //
    35 // outside. It makes also possible to go back by decreasing the number.    //
    36 //                                                                         //
    37 // If you don't want to start reading the first event you have to call     //
    38 // MReadMarsFile::SetEventNum after instantiating your                     //
    39 // MReadMarsFile-object.                                                   //
    40 //                                                                         //
    41 // To make reading much faster (up to a factor of 10 to 20) you can        //
    42 // ensure that only the data you are really processing is enabled by       //
    43 // calling MReadMarsFile::UseLeaf.                                         //
    44 //                                                                         //
    45 // FIXME: An automatic enabeling scheme would be nice.                     //
    46 //        Can we use TBranch::SetAutoDelete?                               //
    47 //                                                                         //
    48 // Later we'll use TChain::SetNotify to notify MReadMarsFile if the TChain //
    49 // starts to read a new file.                                              //
     32// Warning: Until now this works only for 'one run header per file'        //
    5033//                                                                         //
    5134/////////////////////////////////////////////////////////////////////////////
     
    5942// --------------------------------------------------------------------------
    6043//
    61 //  Default constructor. It creates an TChain instance which represents the
    62 //  the Tree you want to read and adds the given file (if you gave one).
    63 //  More files can be added using MReadMarsFile::AddFile.
    64 //  Also an empty veto list is created. This list is used if you want to
    65 //  veto (disable or "don't enable") a branch in the tree.
     44//  Default constructor. It creates a MReadTree object to read the
     45//  RunHeaders and disables Auto Scheme for this tree.
    6646//
    6747MReadMarsFile::MReadMarsFile(const char *tname, const char *fname,
     
    8161// --------------------------------------------------------------------------
    8262//
    83 // Destructor. It deletes the TChain and veto list object
     63// Destructor. Deleted the MReadTree object for the RunHeaders
    8464//
    8565MReadMarsFile::~MReadMarsFile()
     
    9070// --------------------------------------------------------------------------
    9171//
    92 //  If you want to read the given tree over several files you must add
    93 //  the files here before PreProcess is called. Be careful: If the tree
    94 //  doesn't have the same contents (branches) it may confuse your
    95 //  program (trees which are are not existing in later files are not read
    96 //  anymore, tree wich are not existing in the first file are never read)
    97 //
    98 //  Name may use the wildcarding notation, eg "xxx*.root" means all files
    99 //  starting with xxx in the current file system directory.
     72//  see MReadTree::AddFile, too. The file is also added to the chain for
     73//  the run headers. If adding file gives a different result for both
     74//  chains -1 is returned, otherwise the number of files which were added.
    10075//
    10176Int_t MReadMarsFile::AddFile(const char *fname)
     
    11388}
    11489
     90// --------------------------------------------------------------------------
     91//
     92//  This overload MReadTree::Notify. Before the MReadTree Notify
     93//  TObjects are called the RunHeaders of the next files are read.
     94// 
     95//  WARNING: This doesn't work correctly yet, if the files are not read in
     96//           increasing order.
     97//
    11598Bool_t MReadMarsFile::Notify()
    11699{
     
    129112// --------------------------------------------------------------------------
    130113//
    131 //  The PreProcess loops (till now) over the branches in the given tree.
    132 //  It checks if the corresponding containers (containers with the same
    133 //  name than the branch name) are existing in the Parameter Container List.
    134 //  If not, a container of objec type 'branch-name' is created (everything
    135 //  after the last semicolon in the branch name is stripped). Only
    136 //  branches which don't have a veto (see VetoBranch) are enabled If the
    137 //  object isn't found in the root dictionary (a list of classes known by the
    138 //  root environment) the branch is skipped and an error message is printed
    139 //  out.
     114//  PreProcessed the MReadTree to read the run headers and its base class.
     115//  see MReadTree::PreProcess for more information
    140116//
    141117Bool_t MReadMarsFile::PreProcess(MParList *pList)
  • trunk/MagicSoft/Mars/mbase/MReadTree.cc

    r1035 r1036  
    4242// calling MReadTree::UseLeaf.                                             //
    4343//                                                                         //
    44 // FIXME: An automatic enabeling scheme would be nice.                     //
    45 //        Can we use TBranch::SetAutoDelete?                               //
    46 //                                                                         //
    47 // Later we'll use TChain::SetNotify to notify MReadTree if the TChain     //
    48 // starts to read a new file.                                              //
     44// If the chain switches from one file to another file all                 //
     45// TObject::Notify() functions are called of TObject objects which were    //
     46// added to the Notifier list view MReadTree::AddNotify. If MReadTree      //
     47// is the owner (viw MReadTree::SetOwner) all this objects are deleted     //
     48// by the destructor of MReadTree                                          //
    4949//                                                                         //
    5050/////////////////////////////////////////////////////////////////////////////
    51 
    5251#include "MReadTree.h"
    5352
     
    7574//  More files can be added using MReadTree::AddFile.
    7675//  Also an empty veto list is created. This list is used if you want to
    77 //  veto (disable or "don't enable") a branch in the tree.
     76//  veto (disable or "don't enable") a branch in the tree, it vetos also
     77//  the creation of the corresponding object.
     78//  An empty list of TObjects are also created. This objects are called
     79//  at any time the TChain starts to read from another file.
    7880//
    7981MReadTree::MReadTree(const char *tname, const char *fname,
     
    123125}
    124126
     127// --------------------------------------------------------------------------
     128//
     129//  If the owner flag is set all TObjects which are scheduled via
     130//  AddNotify are deleted by the destructor of MReadTree
     131//
    125132void MReadTree::SetOwner(Bool_t flag)
    126133{
     
    128135}
    129136
     137// --------------------------------------------------------------------------
     138//
     139//  This function is called each time MReadTree changes the file to read
     140//  from. It calls all TObject::Notify() functions which are scheduled
     141//  via AddNotify.
     142//
    130143Bool_t MReadTree::Notify()
    131144{
     
    145158//  starting with xxx in the current file system directory.
    146159//
     160//  AddFile returns the number of files added to the chain.
     161//
    147162Int_t MReadTree::AddFile(const char *fname)
    148163{
     
    156171}
    157172
     173// --------------------------------------------------------------------------
     174//
     175//  This function is called if Branch choosing method should get enabled.
     176//  Branch choosing means, that only the enabled branches are read into
     177//  memory. To use an enableing scheme we have to disable all branches first.
     178//  This is done, if this function is called the first time.
     179//
    158180void MReadTree::EnableBranchChoosing()
    159181{
     
    481503}
    482504
     505// --------------------------------------------------------------------------
     506//
     507//  Return the name of the file we are actually reading from.
     508//
    483509const char *MReadTree::GetFileName() const
    484510{
     
    486512}
    487513
     514// --------------------------------------------------------------------------
     515//
     516//  This schedules a TObject which Notify(9 function is called in case
     517//  of MReadTree (TChain) switches from one file in the chain to another
     518//  one.
     519//
    488520void MReadTree::AddNotify(TObject *obj)
    489521{
Note: See TracChangeset for help on using the changeset viewer.