Changeset 1036
- Timestamp:
- 11/06/01 14:00:17 (23 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MReadMarsFile.cc
r1035 r1036 27 27 // MReadMarsFile // 28 28 // // 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. // 32 31 // // 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' // 50 33 // // 51 34 ///////////////////////////////////////////////////////////////////////////// … … 59 42 // -------------------------------------------------------------------------- 60 43 // 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. 66 46 // 67 47 MReadMarsFile::MReadMarsFile(const char *tname, const char *fname, … … 81 61 // -------------------------------------------------------------------------- 82 62 // 83 // Destructor. It deletes the TChain and veto list object63 // Destructor. Deleted the MReadTree object for the RunHeaders 84 64 // 85 65 MReadMarsFile::~MReadMarsFile() … … 90 70 // -------------------------------------------------------------------------- 91 71 // 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. 100 75 // 101 76 Int_t MReadMarsFile::AddFile(const char *fname) … … 113 88 } 114 89 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 // 115 98 Bool_t MReadMarsFile::Notify() 116 99 { … … 129 112 // -------------------------------------------------------------------------- 130 113 // 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 140 116 // 141 117 Bool_t MReadMarsFile::PreProcess(MParList *pList) -
trunk/MagicSoft/Mars/mbase/MReadTree.cc
r1035 r1036 42 42 // calling MReadTree::UseLeaf. // 43 43 // // 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 // 49 49 // // 50 50 ///////////////////////////////////////////////////////////////////////////// 51 52 51 #include "MReadTree.h" 53 52 … … 75 74 // More files can be added using MReadTree::AddFile. 76 75 // 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. 78 80 // 79 81 MReadTree::MReadTree(const char *tname, const char *fname, … … 123 125 } 124 126 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 // 125 132 void MReadTree::SetOwner(Bool_t flag) 126 133 { … … 128 135 } 129 136 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 // 130 143 Bool_t MReadTree::Notify() 131 144 { … … 145 158 // starting with xxx in the current file system directory. 146 159 // 160 // AddFile returns the number of files added to the chain. 161 // 147 162 Int_t MReadTree::AddFile(const char *fname) 148 163 { … … 156 171 } 157 172 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 // 158 180 void MReadTree::EnableBranchChoosing() 159 181 { … … 481 503 } 482 504 505 // -------------------------------------------------------------------------- 506 // 507 // Return the name of the file we are actually reading from. 508 // 483 509 const char *MReadTree::GetFileName() const 484 510 { … … 486 512 } 487 513 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 // 488 520 void MReadTree::AddNotify(TObject *obj) 489 521 {
Note:
See TracChangeset
for help on using the changeset viewer.