Changeset 2123 for trunk/MagicSoft/Mars/mfileio
- Timestamp:
- 05/20/03 10:19:41 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mfileio
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfileio/MReadMarsFile.cc
r1965 r2123 142 142 } 143 143 144 *fLog << inf << "MReadMarsFile: Switching to #" << GetFileIndex(); 145 *fLog << " '" << GetFileName() << "' (before event #"; 146 *fLog << GetNumEntry()-1 << ")" << endl; 144 if (!MReadTree::Notify()) 145 return kFALSE; 147 146 148 147 if (fDisplay) -
trunk/MagicSoft/Mars/mfileio/MReadTree.cc
r2120 r2123 138 138 TChainElement *element = NULL; 139 139 while ((element=(TChainElement*)Next())) 140 delete (MParContainer**)element->GetBaddress(); 140 if (element->GetBaddress()) 141 delete (MParContainer**)element->GetBaddress(); 141 142 142 143 // … … 155 156 // -------------------------------------------------------------------------- 156 157 // 158 // This check whether all branches in the tree have the same size. If 159 // this is not the case the events in the different branches cannot 160 // be ordered correctly. 161 // 162 Bool_t MReadTree::CheckBranchSize() 163 { 164 TArrayI entries(fChain->GetStatus()->GetSize()); 165 Int_t num=0; 166 167 // Loop over all branches which have a corresponding container 168 TIter Next(fChain->GetStatus()); 169 170 TChainElement *element = NULL; 171 while ((element=(TChainElement*)Next())) 172 { 173 // Get branch name and find pointer to corresponding branch 174 const TString name = element->GetName(); 175 const TBranch *b = fChain->FindBranch(name); 176 177 // Skip element without corresponding branches (like "*") 178 if (!b) 179 continue; 180 181 entries[num++] = (Int_t)b->GetEntries(); 182 } 183 184 // Check the number of entries of the branches pair-wise 185 for (int i=0; i<num; i++) 186 for (int j=i; j<num; j++) 187 { 188 if (entries[i]==entries[j]) 189 continue; 190 191 *fLog << err << "ERROR - File corrupttion detected:" << endl; 192 *fLog << " Due to several circumstances (such at a bug in MReadTree or wrong" << endl; 193 *fLog << " usage of the file UPDATE mode) you may have produced a file in which" << endl; 194 *fLog << " at least two branches in the same tree (" << fChain->GetName() << ") have different" << endl; 195 *fLog << " number of entries. Sorry, but this file (" << GetFileName() << ")" << endl; 196 *fLog << " is unusable." << endl; 197 return kFALSE; 198 } 199 200 return kTRUE; 201 } 202 203 // -------------------------------------------------------------------------- 204 // 157 205 // If the owner flag is set all TObjects which are scheduled via 158 206 // AddNotify are deleted by the destructor of MReadTree … … 171 219 Bool_t MReadTree::Notify() 172 220 { 173 *fLog << inf << GetDescriptor() << ": Notify '" << fChain->GetName(); 174 *fLog << "' (before processing event #" << GetNumEntry()-1 << ")" << endl; 221 // 222 // Do a consistency check for all branches 223 // 224 if (!CheckBranchSize()) 225 return kFALSE; 226 227 *fLog << inf << GetDescriptor() << ": Switching to #" << GetFileIndex(); 228 *fLog << " '" << GetFileName() << "' (before event #"; 229 *fLog << GetNumEntry()-1 << ")" << endl; 175 230 176 231 //fNotify->Notify(); … … 542 597 543 598 Int_t num=0; 599 544 600 // 545 601 // loop over all tasks for processing … … 622 678 623 679 // 680 // Do a consistency check for all branches 681 // 682 // if (!CheckBranchSize()) 683 // return kFALSE; 684 685 // 624 686 // If auto enabling scheme isn't disabled, do auto enabling 625 687 // -
trunk/MagicSoft/Mars/mfileio/MReadTree.h
r2117 r2123 33 33 void EnableBranches(MParList *plist); 34 34 void EnableBranchChoosing(); 35 36 Bool_t CheckBranchSize(); 35 37 36 38 virtual void SetReadyToSave(Bool_t flag=kTRUE); -
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
r2120 r2123 140 140 void MWriteRootFile::Print(Option_t *) const 141 141 { 142 *fLog << all << underline << "File: " << GetFileName() << ":" << endl; 142 *fLog << all << underline << "File: " << GetFileName() << endl; 143 144 if (fTrees.GetEntries()==0) 145 { 146 *fLog << " No contents." << endl; 147 return; 148 } 143 149 144 150 TTree *t = NULL; 145 151 TIter Next(&fTrees); 146 152 while ((t=(TTree*)Next())) 147 *fLog << t->GetName() << ": \t" << t->GetEntries() << " entries." << endl;153 *fLog << " " << t->GetName() << ": \t" << t->GetEntries() << " entries." << endl; 148 154 *fLog << endl; 149 155 }
Note:
See TracChangeset
for help on using the changeset viewer.