Changeset 3336 for trunk/MagicSoft/Mars/mfileio
- Timestamp:
- 02/26/04 17:22:46 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mfileio
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfileio/MWriteAsciiFile.cc
r3238 r3336 188 188 // a warning message is print. 189 189 // 190 voidMWriteAsciiFile::CheckAndWrite() const190 Bool_t MWriteAsciiFile::CheckAndWrite() const 191 191 { 192 192 Bool_t written = kFALSE; … … 219 219 } 220 220 221 if (!written) 222 return; 223 224 *fOut << endl; 225 226 if (num!=0) 227 *fLog << warn << "Warning - given number of objects doesn't fit number of written objects." << endl; 221 if (written) 222 { 223 *fOut << endl; 224 225 if (num!=0) 226 *fLog << warn << "Warning - given number of objects doesn't fit number of written objects." << endl; 227 } 228 return kTRUE; 228 229 } 229 230 -
trunk/MagicSoft/Mars/mfileio/MWriteAsciiFile.h
r1664 r3336 21 21 TObjArray fAutoDel; //! List of object to be deleted in the destructor 22 22 23 virtual voidCheckAndWrite() const;23 virtual Bool_t CheckAndWrite() const; 24 24 virtual Bool_t IsFileOpen() const; 25 25 virtual Bool_t GetContainer(MParList *pList); -
trunk/MagicSoft/Mars/mfileio/MWriteFile.cc
r2958 r3336 78 78 // write the container if it is already in changed state 79 79 // 80 CheckAndWrite(); 81 82 return kTRUE; 80 return CheckAndWrite(); 83 81 } 84 82 … … 90 88 Bool_t MWriteFile::ReInit(MParList *pList) 91 89 { 92 CheckAndWrite(); 93 return kTRUE; 90 return CheckAndWrite(); 94 91 } 95 92 … … 101 98 Int_t MWriteFile::Process() 102 99 { 103 CheckAndWrite(); 104 return kTRUE; 100 return CheckAndWrite(); 105 101 } 106 102 … … 115 111 // check if the container changed state is set 116 112 // 117 CheckAndWrite(); 118 return kTRUE; 113 return CheckAndWrite(); 119 114 } -
trunk/MagicSoft/Mars/mfileio/MWriteFile.h
r2959 r3336 15 15 16 16 virtual Bool_t IsFileOpen() const = 0; 17 virtual voidCheckAndWrite() const = 0;17 virtual Bool_t CheckAndWrite() const = 0; 18 18 virtual Bool_t GetContainer(MParList *pList) = 0; 19 19 virtual const char *GetFileName() const = 0; -
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
r3199 r3336 338 338 entry->SetTree(tree); 339 339 340 TString branchname(cname); 341 branchname.Append("."); 342 340 343 // 341 344 // Try to get the branch from the file. 342 345 // If the branch already exists the user specified one branch twice. 343 346 // 344 TBranch *branch = tree->GetBranch( cname);347 TBranch *branch = tree->GetBranch(branchname); 345 348 if (branch) 346 349 { 347 *fLog << err << "Branch '" << cname << "' already existing." << endl;348 return kFALSE;349 } 350 351 //352 // Create a new branch in the actual tree. The branch has the name353 // container name. The type of the container is given by the354 // ClassName entry in the container. The Address is the address of a355 // pointer to the container (gotten from the branch entry). As356 // Basket size we specify a (more or less) common default value.357 // The containers should be written in Splitlevel=1358 //359 *fLog << inf << "Creating Branch " << cname << " of " << cont->ClassName() << "... " << flush;360 361 TString branchname(cname);362 branchname.Append("."); 363 branch = tree->Branch(branchname, cont->ClassName(), entry->GetAddress());364 365 //366 // If the branch couldn't be created we have a problem.367 //368 if (!branch)369 {370 *fLog<< endl;371 *fLog << err << "Unable to create branch '" << cname << "'." << endl;372 return kFALSE;373 } 374 375 *fLog << "done." << endl;350 *fLog << inf << "Branch '" << cname << "' already existing... updating." << endl; 351 branch->SetAddress(entry->GetAddress()); 352 } 353 else 354 { 355 // 356 // Create a new branch in the actual tree. The branch has the name 357 // container name. The type of the container is given by the 358 // ClassName entry in the container. The Address is the address of a 359 // pointer to the container (gotten from the branch entry). As 360 // Basket size we specify a (more or less) common default value. 361 // The containers should be written in Splitlevel=1 362 // 363 *fLog << inf << "Creating Branch " << cname << " of " << cont->ClassName(); 364 *fLog << " in tree " << tree->GetName() << "... " << flush; 365 366 branch = tree->Branch(branchname, cont->ClassName(), entry->GetAddress()); 367 // 368 // If the branch couldn't be created we have a problem. 369 // 370 if (!branch) 371 { 372 *fLog << endl; 373 *fLog << err << "Unable to create branch '" << cname << "'." << endl; 374 return kFALSE; 375 } 376 377 *fLog << "done." << endl; 378 } 376 379 377 380 // … … 398 401 // has the write flag, all containers in this tree are filled! 399 402 // 400 voidMWriteRootFile::CheckAndWrite() const403 Bool_t MWriteRootFile::CheckAndWrite() const 401 404 { 402 405 TObject *obj; … … 423 426 b->GetTree()->SetBit(kFillTree); 424 427 else 425 b->GetBranch()->Fill(); 428 { 429 if (!b->GetBranch()->Fill()) 430 { 431 *fLog << err << "ERROR - Zero bytes written to branch '" << b->GetBranch()->GetName() << "'... abort." << endl; 432 return kFALSE; 433 } 434 } 426 435 } 427 436 … … 445 454 // of written/filled entries. 446 455 // 447 t->Fill();448 456 t->ResetBit(kFillTree); 449 } 457 if (!t->Fill()) 458 { 459 *fLog << err << "ERROR - Zero bytes written to tree '" << t->GetName() << "'... abort." << endl; 460 return kFALSE; 461 } 462 } 463 return kTRUE; 450 464 } 451 465 -
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h
r2604 r3336 75 75 //UInt_t fNumEvents; //! Number of events written in a run 76 76 77 voidCheckAndWrite() const;77 Bool_t CheckAndWrite() const; 78 78 Bool_t IsFileOpen() const; 79 79 Bool_t GetContainer(MParList *pList);
Note:
See TracChangeset
for help on using the changeset viewer.