CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/IOPool/Output/src/RootOutputFile.h

Go to the documentation of this file.
00001 #ifndef IOPool_Output_RootOutputFile_h
00002 #define IOPool_Output_RootOutputFile_h
00003 
00005 //
00006 // Class RootOutputFile
00007 //
00008 // Current Author: Bill Tanenbaum
00009 //
00011 
00012 #include <map>
00013 #include <string>
00014 #include <vector>
00015 
00016 #include "boost/array.hpp"
00017 #include "boost/shared_ptr.hpp"
00018 
00019 #include "FWCore/Framework/interface/Frameworkfwd.h"
00020 #include "FWCore/MessageLogger/interface/JobReport.h"
00021 #include "DataFormats/Provenance/interface/BranchListIndex.h"
00022 #include "DataFormats/Provenance/interface/EventSelectionID.h"
00023 #include "DataFormats/Provenance/interface/FileID.h"
00024 #include "DataFormats/Provenance/interface/IndexIntoFile.h"
00025 #include "DataFormats/Provenance/interface/LuminosityBlockAuxiliary.h"
00026 #include "DataFormats/Provenance/interface/ParentageID.h"
00027 #include "DataFormats/Provenance/interface/ProductProvenance.h"
00028 #include "DataFormats/Provenance/interface/RunAuxiliary.h"
00029 #include "DataFormats/Provenance/interface/Selections.h"
00030 #include "IOPool/Output/interface/PoolOutputModule.h"
00031 #include "IOPool/Output/src/RootOutputTree.h"
00032 
00033 class TTree;
00034 class TFile;
00035 
00036 namespace edm {
00037   class PoolOutputModule;
00038 
00039   class RootOutputFile {
00040   public:
00041     typedef PoolOutputModule::OutputItem OutputItem;
00042     typedef PoolOutputModule::OutputItemList OutputItemList;
00043     typedef boost::array<RootOutputTree*, NumBranchTypes> RootOutputTreePtrArray;
00044     explicit RootOutputFile(PoolOutputModule* om, std::string const& fileName,
00045                             std::string const& logicalFileName);
00046     ~RootOutputFile() {}
00047     void writeOne(EventPrincipal const& e);
00048     //void endFile();
00049     void writeLuminosityBlock(LuminosityBlockPrincipal const& lb);
00050     void writeRun(RunPrincipal const& r);
00051     void writeFileFormatVersion();
00052     void writeFileIdentifier();
00053     void writeIndexIntoFile();
00054     void writeProcessConfigurationRegistry();
00055     void writeProcessHistoryRegistry();
00056     void writeParameterSetRegistry();
00057     void writeProductDescriptionRegistry();
00058     void writeParentageRegistry();
00059     void writeBranchIDListRegistry();
00060     void writeProductDependencies();
00061 
00062     void finishEndFile();
00063     void beginInputFile(FileBlock const& fb, int remainingEvents);
00064     void respondToCloseInputFile(FileBlock const& fb);
00065     bool shouldWeCloseFile() const;
00066 
00067     std::string const& fileName() const {return file_;}
00068 
00069   private:
00070 
00071     //-------------------------------
00072     // Local types
00073     //
00074 
00075     //-------------------------------
00076     // Private functions
00077 
00078     void setBranchAliases(TTree* tree, Selections const& branches) const;
00079 
00080     void fillBranches(BranchType const& branchType,
00081                       Principal const& principal,
00082                       ProductProvenanceVector* productProvenanceVecPtr);
00083 
00084      void insertAncestors(ProductProvenance const& iGetParents,
00085                           Principal const& principal,
00086                           bool produced,
00087                           std::set<ProductProvenance>& oToFill);
00088 
00089     //-------------------------------
00090     // Member data
00091 
00092     std::string file_;
00093     std::string logicalFile_;
00094     JobReport::Token reportToken_;
00095     PoolOutputModule const* om_;
00096     int whyNotFastClonable_;
00097     bool canFastCloneAux_;
00098     boost::shared_ptr<TFile> filePtr_;
00099     FileID fid_;
00100     IndexIntoFile::EntryNumber_t eventEntryNumber_;
00101     IndexIntoFile::EntryNumber_t lumiEntryNumber_;
00102     IndexIntoFile::EntryNumber_t runEntryNumber_;
00103     IndexIntoFile indexIntoFile_;
00104     TTree* metaDataTree_;
00105     TTree* parameterSetsTree_;
00106     TTree* parentageTree_;
00107     LuminosityBlockAuxiliary  lumiAux_;
00108     RunAuxiliary              runAux_;
00109     EventAuxiliary const*           pEventAux_;
00110     LuminosityBlockAuxiliary const* pLumiAux_;
00111     RunAuxiliary const*             pRunAux_;
00112     ProductProvenanceVector eventEntryInfoVector_;
00113     ProductProvenanceVector lumiEntryInfoVector_;
00114     ProductProvenanceVector runEntryInfoVector_;
00115     ProductProvenanceVector*        pEventEntryInfoVector_;
00116     ProductProvenanceVector*        pLumiEntryInfoVector_;
00117     ProductProvenanceVector*        pRunEntryInfoVector_;
00118     BranchListIndexes const*        pBranchListIndexes_;
00119     EventSelectionIDVector const*   pEventSelectionIDs_;
00120     RootOutputTree eventTree_;
00121     RootOutputTree lumiTree_;
00122     RootOutputTree runTree_;
00123     RootOutputTreePtrArray treePointers_;
00124     bool dataTypeReported_;
00125     std::set<ParentageID> parentageIDs_;
00126     std::set<BranchID> branchesWithStoredHistory_;
00127   };
00128 
00129 }
00130 
00131 #endif