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 
25  class ModuleCallingContext;
26  class ParameterSet;
27  class RootOutputFile;
29 
30  class PoolOutputModule : public one::OutputModule<WatchInputFiles> {
31  public:
33  explicit PoolOutputModule(ParameterSet const& ps);
34  virtual ~PoolOutputModule();
35  PoolOutputModule(PoolOutputModule const&) = delete; // Disallow copying and moving
36  PoolOutputModule& operator=(PoolOutputModule const&) = delete; // Disallow copying and moving
37  std::string const& fileName() const {return fileName_;}
38  std::string const& logicalFileName() const {return logicalFileName_;}
39  int const& compressionLevel() const {return compressionLevel_;}
41  int const& basketSize() const {return basketSize_;}
43  int const& splitLevel() const {return splitLevel_;}
44  std::string const& basketOrder() const {return basketOrder_;}
45  int const& treeMaxVirtualSize() const {return treeMaxVirtualSize_;}
47  DropMetaData const& dropMetaData() const {return dropMetaData_;}
48  std::string const& catalog() const {return catalog_;}
49  std::string const& moduleLabel() const {return moduleLabel_;}
50  unsigned int const& maxFileSize() const {return maxFileSize_;}
51  int const& inputFileCount() const {return inputFileCount_;}
52  int const& whyNotFastClonable() const {return whyNotFastClonable_;}
53 
54  std::string const& currentFileName() const;
55 
56  static void fillDescriptions(ConfigurationDescriptions& descriptions);
57 
59 
60  struct AuxItem {
61  AuxItem();
62  ~AuxItem() {}
64  };
65  typedef std::array<AuxItem, NumBranchTypes> AuxItemArray;
66  AuxItemArray const& auxItems() const {return auxItems_;}
67 
68  struct OutputItem {
69  class Sorter {
70  public:
71  explicit Sorter(TTree* tree);
72  bool operator() (OutputItem const& lh, OutputItem const& rh) const;
73  private:
74  boost::shared_ptr<std::map<std::string, int> > treeMap_;
75  };
76 
77  OutputItem();
78 
79  explicit OutputItem(BranchDescription const* bd, int splitLevel, int basketSize);
80 
82 
84  std::string const& branchName() const { return branchDescription_->branchName(); }
85 
86  bool operator <(OutputItem const& rh) const {
88  }
89 
91  mutable void const* product_;
94  };
95 
96  typedef std::vector<OutputItem> OutputItemList;
97 
98  typedef std::array<OutputItemList, NumBranchTypes> OutputItemListArray;
99 
101 
102  protected:
104  virtual bool shouldWeCloseFile() const override;
105  virtual void write(EventPrincipal const& e, ModuleCallingContext const*) override;
106  private:
107  virtual void openFile(FileBlock const& fb) override;
108  virtual void respondToOpenInputFile(FileBlock const& fb) override;
109  virtual void respondToCloseInputFile(FileBlock const& fb) override;
110  virtual void writeLuminosityBlock(LuminosityBlockPrincipal const& lb, ModuleCallingContext const*) override;
111  virtual void writeRun(RunPrincipal const& r, ModuleCallingContext const*) override;
112  virtual void postForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren) override;
113  virtual bool isFileOpen() const override;
114  virtual void reallyOpenFile() override;
115  virtual void reallyCloseFile() override;
116  virtual void beginJob() override;
117 
118  void startEndFile();
119  void writeFileFormatVersion();
120  void writeFileIdentifier();
121  void writeIndexIntoFile();
125  void writeParentageRegistry();
128  void finishEndFile();
129 
130  void fillSelectedItemList(BranchType branchtype, TTree* theInputTree);
131  void beginInputFile(FileBlock const& fb);
132 
139  unsigned int const maxFileSize_;
140  int const compressionLevel_;
142  int const basketSize_;
144  int const splitLevel_;
153  unsigned int childIndex_;
156  std::unique_ptr<RootOutputFile> rootOutputFile_;
158  };
159 }
160 
161 #endif
virtual void openFile(FileBlock const &fb) override
std::string const & branchName() const
virtual void writeRun(RunPrincipal const &r, ModuleCallingContext const *) override
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 const catalog_
PoolOutputModule & operator=(PoolOutputModule const &)=delete
std::string const & moduleLabel() const
DropMetaData const & dropMetaData() const
std::vector< OutputItem > OutputItemList
std::string const & fileName() const
int const & compressionLevel() const
OutputItemListArray const & selectedOutputItemList() const
std::string const moduleLabel_
bool int lh
Definition: SIMDVec.h:19
unsigned int const & maxFileSize() const
std::string const & logicalFileName() const
BranchType
Definition: BranchType.h:11
void fillSelectedItemList(BranchType branchtype, TTree *theInputTree)
PoolOutputModule(ParameterSet const &ps)
bool operator()(OutputItem const &lh, OutputItem const &rh) const
std::string const & currentFileName() const
bool operator<(OutputItem const &rh) const
std::string const & compressionAlgorithm() const
OutputItemListArray selectedOutputItemList_
std::string const & basketOrder() const
std::string const & branchName() const
int const & splitLevel() const
BranchID const & branchID() const
virtual void reallyOpenFile() override
std::unique_ptr< RootOutputFile > rootOutputFile_
int const & whyNotFastClonable() const
unsigned int numberOfDigitsInIndex_
std::array< AuxItem, NumBranchTypes > AuxItemArray
unsigned int const maxFileSize_
virtual bool shouldWeCloseFile() const override
allow inheriting classes to override but still be able to call this method in the overridden version ...
virtual void respondToCloseInputFile(FileBlock const &fb) override
virtual bool isFileOpen() const override
virtual void write(EventPrincipal const &e, ModuleCallingContext const *) override
virtual void beginJob() override
virtual void reallyCloseFile() override
AuxItemArray const & auxItems() const
std::string const fileName_
virtual void writeLuminosityBlock(LuminosityBlockPrincipal const &lb, ModuleCallingContext const *) override
int const & treeMaxVirtualSize() const
std::array< OutputItemList, NumBranchTypes > OutputItemListArray
virtual void postForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren) override
std::string const logicalFileName_
void beginInputFile(FileBlock const &fb)
boost::shared_ptr< std::map< std::string, int > > treeMap_
virtual void respondToOpenInputFile(FileBlock const &fb) override
static void fillDescriptions(ConfigurationDescriptions &descriptions)
RootServiceChecker rootServiceChecker_
int const & inputFileCount() const
ParameterSetID selectorConfig() const
Definition: OutputModule.h:98