CMS 3D CMS Logo

PoolOutputModule.h

Go to the documentation of this file.
00001 #ifndef IOPool_Output_PoolOutputModule_h
00002 #define IOPool_Output_PoolOutputModule_h
00003 
00005 //
00006 // Class PoolOutputModule. Output module to POOL file
00007 //
00008 // Oringinal Author: Luca Lista
00009 // Current Author: Bill Tanenbaum
00010 //
00012 
00013 #include <string>
00014 #include "boost/scoped_ptr.hpp"
00015 
00016 #include "IOPool/Common/interface/RootServiceChecker.h"
00017 #include "FWCore/Framework/interface/Frameworkfwd.h"
00018 #include "FWCore/Framework/interface/OutputModule.h"
00019 
00020 class TTree;
00021 namespace edm {
00022   class ParameterSet;
00023   class RootOutputFile;
00024 
00025   class PoolOutputModule : public OutputModule {
00026   public:
00027     friend class RootOutputFile;
00028     explicit PoolOutputModule(ParameterSet const& ps);
00029     virtual ~PoolOutputModule();
00030     std::string const& fileName() const {return fileName_;}
00031     std::string const& logicalFileName() const {return logicalFileName_;}
00032     int const& compressionLevel() const {return compressionLevel_;}
00033     int const& basketSize() const {return basketSize_;}
00034     int const& splitLevel() const {return splitLevel_;}
00035     int const& treeMaxVirtualSize() const {return treeMaxVirtualSize_;}
00036     bool const& fastCloning() const {return fastCloning_;}
00037     bool const& dropMetaData() const {return dropMetaDataForDroppedData_;}
00038 
00039     struct OutputItem {
00040       class Sorter {
00041       public:
00042         explicit Sorter(TTree * tree);
00043         bool operator() (OutputItem const& lh, OutputItem const& rh) const;
00044       private:
00045         std::map<std::string, int> treeMap_;
00046       };
00047 
00048       OutputItem() : branchDescription_(0), product_(0) {}
00049 
00050       explicit OutputItem(BranchDescription const* bd) :
00051         branchDescription_(bd), product_(0) {}
00052 
00053       ~OutputItem() {}
00054 
00055       BranchID branchID() const { return branchDescription_->branchID(); }
00056       std::string const& branchName() const { return branchDescription_->branchName(); }
00057 
00058       BranchDescription const* branchDescription_;
00059       mutable void const* product_;
00060 
00061       bool operator <(OutputItem const& rh) const {
00062         return *branchDescription_ < *rh.branchDescription_;
00063       }
00064     };
00065 
00066     typedef std::vector<OutputItem> OutputItemList;
00067 
00068     typedef boost::array<OutputItemList, NumBranchTypes> OutputItemListArray;
00069 
00070     OutputItemListArray const& selectedOutputItemList() const {return selectedOutputItemList_;}
00071 
00072   private:
00073     virtual void openFile(FileBlock const& fb);
00074     virtual void respondToOpenInputFile(FileBlock const& fb);
00075     virtual void respondToCloseInputFile(FileBlock const& fb);
00076     virtual void write(EventPrincipal const& e);
00077     virtual void writeLuminosityBlock(LuminosityBlockPrincipal const& lb);
00078     virtual void writeRun(RunPrincipal const& r);
00079 
00080     virtual bool isFileOpen() const;
00081     virtual bool shouldWeCloseFile() const;
00082     virtual void doOpenFile();
00083 
00084 
00085     virtual void startEndFile();
00086     virtual void writeFileFormatVersion();
00087     virtual void writeFileIdentifier();
00088     virtual void writeFileIndex();
00089     virtual void writeEventHistory();
00090     virtual void writeProcessConfigurationRegistry();
00091     virtual void writeProcessHistoryRegistry();
00092     virtual void writeModuleDescriptionRegistry();
00093     virtual void writeParameterSetRegistry();
00094     virtual void writeProductDescriptionRegistry();
00095     virtual void writeProductDependencies();
00096     virtual void writeEntryDescriptions();
00097     virtual void finishEndFile();
00098 
00099     void fillSelectedItemList(BranchType branchtype, TTree *theTree);
00100 
00101     RootServiceChecker rootServiceChecker_;
00102     OutputItemListArray selectedOutputItemList_;
00103     std::string const fileName_;
00104     std::string const logicalFileName_;
00105     std::string const catalog_;
00106     unsigned int const maxFileSize_;
00107     int const compressionLevel_;
00108     int const basketSize_;
00109     int const splitLevel_;
00110     int const treeMaxVirtualSize_;
00111     bool fastCloning_;
00112     bool dropMetaDataForDroppedData_;
00113     std::string const moduleLabel_;
00114     int outputFileCount_;
00115     int inputFileCount_;
00116     boost::scoped_ptr<RootOutputFile> rootOutputFile_;
00117   };
00118 }
00119 
00120 #endif

Generated on Tue Jun 9 17:39:14 2009 for CMSSW by  doxygen 1.5.4