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 
20 
21 class TTree;
22 namespace edm {
23 
24  class ModuleCallingContext;
25  class ParameterSet;
26  class RootOutputFile;
28 
29  class PoolOutputModule : public one::OutputModule<WatchInputFiles> {
30  public:
32  explicit PoolOutputModule(ParameterSet const& ps);
33  virtual ~PoolOutputModule();
34  PoolOutputModule(PoolOutputModule const&) = delete; // Disallow copying and moving
35  PoolOutputModule& operator=(PoolOutputModule const&) = delete; // Disallow copying and moving
36  std::string const& fileName() const {return fileName_;}
37  std::string const& logicalFileName() const {return logicalFileName_;}
38  int const& compressionLevel() const {return compressionLevel_;}
40  int const& basketSize() const {return basketSize_;}
42  int const& splitLevel() const {return splitLevel_;}
43  std::string const& basketOrder() const {return basketOrder_;}
44  int const& treeMaxVirtualSize() const {return treeMaxVirtualSize_;}
46  DropMetaData const& dropMetaData() const {return dropMetaData_;}
47  std::string const& catalog() const {return catalog_;}
48  std::string const& moduleLabel() const {return moduleLabel_;}
49  unsigned int const& maxFileSize() const {return maxFileSize_;}
50  int const& inputFileCount() const {return inputFileCount_;}
51  int const& whyNotFastClonable() const {return whyNotFastClonable_;}
52 
53  std::string const& currentFileName() const;
54 
55  static void fillDescription(ParameterSetDescription& desc);
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  std::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 
107  virtual std::pair<std::string, std::string> physicalAndLogicalNameForNewFile();
108  virtual void doExtrasAfterCloseFile();
109  private:
110  virtual void openFile(FileBlock const& fb) override;
111  virtual void respondToOpenInputFile(FileBlock const& fb) override;
112  virtual void respondToCloseInputFile(FileBlock const& fb) override;
113  virtual void writeLuminosityBlock(LuminosityBlockPrincipal const& lb, ModuleCallingContext const*) override;
114  virtual void writeRun(RunPrincipal const& r, ModuleCallingContext const*) override;
115  virtual void postForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren) override;
116  virtual bool isFileOpen() const override;
117  virtual void reallyOpenFile() override;
118  virtual void reallyCloseFile() override;
119  virtual void beginJob() override;
120 
121  void startEndFile();
122  void writeFileFormatVersion();
123  void writeFileIdentifier();
124  void writeIndexIntoFile();
128  void writeParentageRegistry();
132  void finishEndFile();
133 
134  void fillSelectedItemList(BranchType branchtype, TTree* theInputTree);
135  void beginInputFile(FileBlock const& fb);
136 
143  unsigned int const maxFileSize_;
144  int const compressionLevel_;
146  int const basketSize_;
148  int const splitLevel_;
157  unsigned int childIndex_;
160  std::unique_ptr<RootOutputFile> rootOutputFile_;
162  };
163 }
164 
165 #endif
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
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
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
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::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)
RootServiceChecker rootServiceChecker_
int const & inputFileCount() const
ParameterSetID selectorConfig() const
Definition: OutputModule.h:103