CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PoolOutputModule.h
Go to the documentation of this file.
1 #ifndef IOPool_Output_PoolOutputModule_h
2 #define IOPool_Output_PoolOutputModule_h
3 
5 //
6 // Class PoolOutputModule. Output module to POOL file
7 //
8 // Oringinal Author: Luca Lista
9 // Current Author: Bill Tanenbaum
10 //
12 
13 #include <array>
14 #include <memory>
15 #include <string>
16 #include "boost/shared_ptr.hpp"
17 
21 
22 class TTree;
23 namespace edm {
24  class ParameterSet;
25  class RootOutputFile;
27 
28  class PoolOutputModule : public OutputModule {
29  public:
31  explicit PoolOutputModule(ParameterSet const& ps);
32  virtual ~PoolOutputModule();
33  PoolOutputModule(PoolOutputModule const&) = delete; // Disallow copying and moving
34  PoolOutputModule& operator=(PoolOutputModule const&) = delete; // Disallow copying and moving
35  std::string const& fileName() const {return fileName_;}
36  std::string const& logicalFileName() const {return logicalFileName_;}
37  int const& compressionLevel() const {return compressionLevel_;}
39  int const& basketSize() const {return basketSize_;}
41  int const& splitLevel() const {return splitLevel_;}
42  std::string const& basketOrder() const {return basketOrder_;}
43  int const& treeMaxVirtualSize() const {return treeMaxVirtualSize_;}
45  DropMetaData const& dropMetaData() const {return dropMetaData_;}
46  std::string const& catalog() const {return catalog_;}
47  std::string const& moduleLabel() const {return moduleLabel_;}
48  unsigned int const& maxFileSize() const {return maxFileSize_;}
49  int const& inputFileCount() const {return inputFileCount_;}
50  int const& whyNotFastClonable() const {return whyNotFastClonable_;}
51 
52  std::string const& currentFileName() const;
53 
54  static void fillDescriptions(ConfigurationDescriptions& descriptions);
55 
57 
58  struct AuxItem {
59  AuxItem();
60  ~AuxItem() {}
62  };
63  typedef std::array<AuxItem, NumBranchTypes> AuxItemArray;
64  AuxItemArray const& auxItems() const {return auxItems_;}
65 
66  struct OutputItem {
67  class Sorter {
68  public:
69  explicit Sorter(TTree* tree);
70  bool operator() (OutputItem const& lh, OutputItem const& rh) const;
71  private:
72  boost::shared_ptr<std::map<std::string, int> > treeMap_;
73  };
74 
75  OutputItem();
76 
77  explicit OutputItem(BranchDescription const* bd, int splitLevel, int basketSize);
78 
80 
82  std::string const& branchName() const { return branchDescription_->branchName(); }
83 
84  bool operator <(OutputItem const& rh) const {
86  }
87 
89  mutable void const* product_;
92  };
93 
94  typedef std::vector<OutputItem> OutputItemList;
95 
96  typedef std::array<OutputItemList, NumBranchTypes> OutputItemListArray;
97 
99 
100  protected:
102  virtual bool shouldWeCloseFile() const;
103  virtual void write(EventPrincipal const& e);
104  private:
105  virtual void openFile(FileBlock const& fb);
106  virtual void respondToOpenInputFile(FileBlock const& fb);
107  virtual void respondToCloseInputFile(FileBlock const& fb);
108  virtual void writeLuminosityBlock(LuminosityBlockPrincipal const& lb);
109  virtual void writeRun(RunPrincipal const& r);
110  virtual void postForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
111  virtual bool isFileOpen() const;
112  virtual void doOpenFile();
113  virtual void beginJob();
114 
115  virtual void startEndFile();
116  virtual void writeFileFormatVersion();
117  virtual void writeFileIdentifier();
118  virtual void writeIndexIntoFile();
119  virtual void writeProcessConfigurationRegistry();
120  virtual void writeProcessHistoryRegistry();
121  virtual void writeParameterSetRegistry();
122  virtual void writeProductDescriptionRegistry();
123  virtual void writeParentageRegistry();
124  virtual void writeBranchIDListRegistry();
125  virtual void writeProductDependencies();
126  virtual void finishEndFile();
127 
128  void fillSelectedItemList(BranchType branchtype, TTree* theInputTree);
129  void beginInputFile(FileBlock const& fb);
130 
137  unsigned int const maxFileSize_;
138  int const compressionLevel_;
140  int const basketSize_;
142  int const splitLevel_;
151  unsigned int childIndex_;
154  std::unique_ptr<RootOutputFile> rootOutputFile_;
156  };
157 }
158 
159 #endif
virtual void writeParentageRegistry()
BranchDescription const * branchDescription_
int const & basketSize() const
std::string const compressionAlgorithm_
bool const & overrideInputFileSplitLevels() const
int eventAutoFlushSize() const
std::string const & catalog() const
std::string & branchName() const
std::string const catalog_
PoolOutputModule & operator=(PoolOutputModule const &)=delete
std::string const & moduleLabel() const
DropMetaData const & dropMetaData() const
virtual bool isFileOpen() const
std::vector< OutputItem > OutputItemList
std::string const & fileName() const
int const & compressionLevel() const
OutputItemListArray const & selectedOutputItemList() const
std::string const moduleLabel_
virtual void write(EventPrincipal const &e)
bool int lh
Definition: SIMDVec.h:19
unsigned int const & maxFileSize() const
virtual bool shouldWeCloseFile() const
allow inheriting classes to override but still be able to call this method in the overridden version ...
std::string const & logicalFileName() const
virtual void writeParameterSetRegistry()
BranchType
Definition: BranchType.h:11
void fillSelectedItemList(BranchType branchtype, TTree *theInputTree)
PoolOutputModule(ParameterSet const &ps)
virtual void respondToOpenInputFile(FileBlock const &fb)
virtual void respondToCloseInputFile(FileBlock const &fb)
bool operator()(OutputItem const &lh, OutputItem const &rh) const
std::string const & currentFileName() const
bool operator<(OutputItem const &rh) const
virtual void writeFileFormatVersion()
virtual void writeLuminosityBlock(LuminosityBlockPrincipal const &lb)
std::string const & compressionAlgorithm() const
OutputItemListArray selectedOutputItemList_
std::string const & basketOrder() const
std::string const & branchName() const
virtual void writeProcessConfigurationRegistry()
int const & splitLevel() const
BranchID const & branchID() const
virtual void writeProductDependencies()
std::unique_ptr< RootOutputFile > rootOutputFile_
int const & whyNotFastClonable() const
virtual void writeIndexIntoFile()
unsigned int numberOfDigitsInIndex_
std::array< AuxItem, NumBranchTypes > AuxItemArray
unsigned int const maxFileSize_
virtual void writeBranchIDListRegistry()
virtual void writeProcessHistoryRegistry()
virtual void openFile(FileBlock const &fb)
virtual void postForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
AuxItemArray const & auxItems() const
std::string const fileName_
int const & treeMaxVirtualSize() const
virtual void writeFileIdentifier()
virtual void finishEndFile()
std::array< OutputItemList, NumBranchTypes > OutputItemListArray
std::string const logicalFileName_
void beginInputFile(FileBlock const &fb)
virtual void startEndFile()
virtual void writeProductDescriptionRegistry()
boost::shared_ptr< std::map< std::string, int > > treeMap_
static void fillDescriptions(ConfigurationDescriptions &descriptions)
RootServiceChecker rootServiceChecker_
virtual void writeRun(RunPrincipal const &r)
int const & inputFileCount() const
ParameterSetID selectorConfig() const
Definition: OutputModule.h:92