ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TAM/src/TAMOutput.cxx
(Generate patch)

Comparing UserCode/MitAna/TAM/src/TAMOutput.cxx (file contents):
Revision 1.2 by loizides, Sat Sep 27 06:03:36 2008 UTC vs.
Revision 1.3 by loizides, Wed Nov 26 17:08:36 2008 UTC

# Line 35 | Line 35
35   #ifndef TAM_TAModule
36   #include "TAModule.h"
37   #endif
38 <
38 > #ifndef TAM_TDirectory
39 > #include "TDirectory.h"
40 > #endif
41  
42   //////////////////////////////////////////////////////////////////////////
43   //                                                                      //
# Line 761 | Line 763 | Int_t TAMOutput::Write(const char* name,
763     // write all the output objects, flattening the module hierarchy.
764     // If the 'TObject::kSingleKey' option is specified, the TAMOutput
765     // objects themselves will be written, thus preserving the module hierarchy.
766 <  
767 <   if ( (option & TObject::kSingleKey) ) {
766 >   // If option==-99, the module hierarchy will be preserved, but TDirectories
767 >   // will be used instead of TAMOutput objects.
768 >
769 >   if (option == -99) {
770 >      Int_t nbytes = fOutput.Write(name, 0, bsize);
771 >      TIter nextMod(MakeIterator());
772 >      TObject* obj=0;
773 >      while ( (obj = nextMod()) ) {
774 >         TDirectory *newdir = gDirectory->mkdir(obj->GetName());
775 >         TDirectory::TContext context(newdir);
776 >         nbytes += obj->Write(name, option, bsize);
777 >      }
778 >      return nbytes;
779 >   } else if ( (option & TObject::kSingleKey) ) {
780        // here, the TList write will work just fine since it will actually
781        // call the streamer on the module output objects
782        // (through TObject::Write)
783        return TList::Write(name, option, bsize);
784     } else {
785        // flatten the module hierarchy and dump all output objects to the file
786 <      Int_t nbytes = 0;
773 <      fOutput.Write(name, option, bsize);
786 >      Int_t nbytes = fOutput.Write(name, option, bsize);
787        TIter nextMod(MakeIterator());
788        TObject* obj=0;
789        while ( (obj = nextMod()) ) {
# Line 779 | Line 792 | Int_t TAMOutput::Write(const char* name,
792        return nbytes;
793     }
794   }
782

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines