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 
23 
24 class TTree;
25 namespace edm {
26 
27  class ModuleCallingContext;
28  class ParameterSet;
29  class RootOutputFile;
31 
32  class PoolOutputModule : public one::OutputModule<WatchInputFiles> {
33  public:
35  explicit PoolOutputModule(ParameterSet const& ps);
36  virtual ~PoolOutputModule();
37  PoolOutputModule(PoolOutputModule const&) = delete; // Disallow copying and moving
38  PoolOutputModule& operator=(PoolOutputModule const&) = delete; // Disallow copying and moving
39  std::string const& fileName() const {return fileName_;}
40  std::string const& logicalFileName() const {return logicalFileName_;}
41  int const& compressionLevel() const {return compressionLevel_;}
43  int const& basketSize() const {return basketSize_;}
45  int const& splitLevel() const {return splitLevel_;}
46  std::string const& basketOrder() const {return basketOrder_;}
47  int const& treeMaxVirtualSize() const {return treeMaxVirtualSize_;}
49  DropMetaData const& dropMetaData() const {return dropMetaData_;}
50  std::string const& catalog() const {return catalog_;}
51  std::string const& moduleLabel() const {return moduleLabel_;}
52  unsigned int const& maxFileSize() const {return maxFileSize_;}
53  int const& inputFileCount() const {return inputFileCount_;}
54  int const& whyNotFastClonable() const {return whyNotFastClonable_;}
55 
56  std::string const& currentFileName() const;
57 
58  static void fillDescription(ParameterSetDescription& desc);
59  static void fillDescriptions(ConfigurationDescriptions& descriptions);
60 
62 
63  struct AuxItem {
64  AuxItem();
65  ~AuxItem() {}
67  };
68  typedef std::array<AuxItem, NumBranchTypes> AuxItemArray;
69  AuxItemArray const& auxItems() const {return auxItems_;}
70 
71  struct OutputItem {
72  class Sorter {
73  public:
74  explicit Sorter(TTree* tree);
75  bool operator() (OutputItem const& lh, OutputItem const& rh) const;
76  private:
77  std::shared_ptr<std::map<std::string, int> > treeMap_;
78  };
79 
80  OutputItem();
81 
82  explicit OutputItem(BranchDescription const* bd, int splitLevel, int basketSize);
83 
85 
87  std::string const& branchName() const { return branchDescription_->branchName(); }
88 
89  bool operator <(OutputItem const& rh) const {
91  }
92 
94  mutable void const* product_;
97  };
98 
99  typedef std::vector<OutputItem> OutputItemList;
100 
101  typedef std::array<OutputItemList, NumBranchTypes> OutputItemListArray;
102 
104 
106 
107  protected:
109  virtual bool shouldWeCloseFile() const override;
110  virtual void write(EventPrincipal const& e, ModuleCallingContext const*) override;
111 
112  virtual std::pair<std::string, std::string> physicalAndLogicalNameForNewFile();
113  virtual void doExtrasAfterCloseFile();
114  private:
115  virtual void openFile(FileBlock const& fb) override;
116  virtual void respondToOpenInputFile(FileBlock const& fb) override;
117  virtual void respondToCloseInputFile(FileBlock const& fb) override;
118  virtual void writeLuminosityBlock(LuminosityBlockPrincipal const& lb, ModuleCallingContext const*) override;
119  virtual void writeRun(RunPrincipal const& r, ModuleCallingContext const*) override;
120  virtual void postForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren) override;
121  virtual bool isFileOpen() const override;
122  virtual void reallyOpenFile() override;
123  virtual void reallyCloseFile() override;
124  virtual void beginJob() override;
125 
126  typedef std::map<BranchID, std::set<ParentageID> > BranchParents;
127  void updateBranchParents(EventPrincipal const& ep);
128  void fillDependencyGraph();
129 
130  void startEndFile();
131  void writeFileFormatVersion();
132  void writeFileIdentifier();
133  void writeIndexIntoFile();
137  void writeParentageRegistry();
141  void finishEndFile();
142 
143  void fillSelectedItemList(BranchType branchtype, TTree* theInputTree);
144  void beginInputFile(FileBlock const& fb);
145 
152  unsigned int const maxFileSize_;
153  int const compressionLevel_;
155  int const basketSize_;
157  int const splitLevel_;
166  unsigned int childIndex_;
173  };
174 }
175 
176 #endif
177 
virtual void openFile(FileBlock const &fb) override
virtual std::pair< std::string, std::string > physicalAndLogicalNameForNewFile()
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
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
std::string const catalog_
PoolOutputModule & operator=(PoolOutputModule const &)=delete
std::string const & moduleLabel() const
DropMetaData const & dropMetaData() const
BranchChildren branchChildren_
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:21
unsigned int const & maxFileSize() const
virtual void doExtrasAfterCloseFile()
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
void updateBranchParents(EventPrincipal const &ep)
int const & splitLevel() const
BranchID const & branchID() const
virtual void reallyOpenFile() override
BranchParents branchParents_
int const & whyNotFastClonable() const
unsigned int numberOfDigitsInIndex_
std::array< AuxItem, NumBranchTypes > AuxItemArray
unsigned int const maxFileSize_
BranchChildren const & branchChildren() const
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::shared_ptr< std::map< std::string, int > > treeMap_
std::string const logicalFileName_
void beginInputFile(FileBlock const &fb)
virtual void respondToOpenInputFile(FileBlock const &fb) override
static void fillDescriptions(ConfigurationDescriptions &descriptions)
static void fillDescription(ParameterSetDescription &desc)
std::map< BranchID, std::set< ParentageID > > BranchParents
RootServiceChecker rootServiceChecker_
int const & inputFileCount() const
ParameterSetID selectorConfig() const
Definition: OutputModule.h:102