Changeset 2590 for trunk/MagicSoft/Mars/mfileio
- Timestamp:
- 12/02/03 15:38:59 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mfileio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfileio/MReadReports.cc
r2560 r2590 25 25 ///////////////////////////////////////////////////////////////////////////// 26 26 // 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. 28 60 // 29 61 ///////////////////////////////////////////////////////////////////////////// … … 45 77 using namespace std; 46 78 79 // -------------------------------------------------------------------------- 80 // 81 // Default constructor. Set fName and fTitle. Instatiate fTrees and fChains. 82 // Call SetOwner for fTrees and fChains 83 // 47 84 MReadReports::MReadReports() 48 85 { 49 fName = "MRead";50 fTitle = " MReadReports";86 fName = "MRead"; 87 fTitle = "Reads events and reports from a root file ordered in time"; 51 88 52 89 fTrees = new MTaskList("MReadReports"); … … 57 94 } 58 95 96 // -------------------------------------------------------------------------- 97 // 98 // Destructor, delete everything which was allocated by this task... 99 // 59 100 MReadReports::~MReadReports() 60 101 { … … 76 117 } 77 118 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 // 78 128 void MReadReports::AddTree(const char *tree, const char *time) 79 129 { … … 97 147 } 98 148 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 // 99 155 Int_t MReadReports::AddFile(const char *fname, Int_t entries) 100 156 { … … 109 165 } 110 166 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 // 111 175 Int_t MReadReports::PreProcess(MParList *plist) 112 176 { … … 162 226 } 163 227 228 // -------------------------------------------------------------------------- 229 // 230 // Return the MTime corresponding to this TChain... 231 // 164 232 MTime** MReadReports::GetTime(TChain *c) const 165 233 { … … 168 236 } 169 237 238 // -------------------------------------------------------------------------- 239 // 240 // Check which is the next tree to read from. Read an event from this tree. 241 // Sets the StreamId accordingly. 242 // 170 243 Int_t MReadReports::Process() 171 244 { … … 226 299 } 227 300 301 // -------------------------------------------------------------------------- 302 // 303 // PostProcess all MReadTree tasks in fTrees. 304 // 228 305 Int_t MReadReports::PostProcess() 229 306 { … … 231 308 } 232 309 310 // -------------------------------------------------------------------------- 311 // 312 // PrintStatistics of this task and of the MReadTree tasks in fTress 313 // 233 314 void MReadReports::PrintStatistics(const Int_t lvl, Bool_t title) const 234 315 { -
trunk/MagicSoft/Mars/mfileio/MReadReports.h
r2556 r2590 17 17 { 18 18 private: 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 21 21 22 TArrayL fPos;22 TArrayL fPos; // Store the position in each tree/chain 23 23 24 MTask *fList;24 MTask *fList; // pointer to the task list to set the stream id 25 25 26 26 MTime** GetTime(TChain *c) const; 27 27 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(); 29 33 30 34 public: … … 36 40 void AddToBranchList(const char *name); 37 41 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; 39 43 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 45 45 }; 46 46
Note:
See TracChangeset
for help on using the changeset viewer.