CMS 3D CMS Logo

RootOutputFile.h
Go to the documentation of this file.
1 #ifndef IOPool_Output_RootOutputFile_h
2 #define IOPool_Output_RootOutputFile_h
3 
5 //
6 // Class RootOutputFile
7 //
8 // Current Author: Bill Tanenbaum
9 //
11 
12 #include <array>
13 #include <map>
14 #include <string>
15 #include <vector>
16 
17 #include <memory>
18 
36 
37 class TTree;
38 class TFile;
39 class TClass;
40 
41 namespace edm {
42  class OccurrenceForOutput;
43  class PoolOutputModule;
44 
46  public:
49  typedef std::array<edm::propagate_const<RootOutputTree*>, NumBranchTypes> RootOutputTreePtrArray;
50  explicit RootOutputFile(PoolOutputModule* om,
51  std::string const& fileName,
52  std::string const& logicalFileName,
53  std::vector<std::string> const& processesWithSelectedMergeableRunProducts);
55  void writeOne(EventForOutput const& e);
56  //void endFile();
58  void writeRun(RunForOutput const& r);
60  void writeFileIdentifier();
61  void writeIndexIntoFile();
70 
71  void finishEndFile();
72  void beginInputFile(FileBlock const& fb, int remainingEvents);
73  void respondToCloseInputFile(FileBlock const& fb);
74  bool shouldWeCloseFile() const;
75 
76  std::string const& fileName() const { return file_; }
77 
78  private:
79  //-------------------------------
80  // Local types
81  //
82 
83  //-------------------------------
84  // Private functions
85 
86  void setBranchAliases(TTree* tree, SelectedProducts const& branches) const;
87 
89  OccurrenceForOutput const& occurrence,
90  StoredProductProvenanceVector* productProvenanceVecPtr = nullptr,
91  ProductProvenanceRetriever const* provRetriever = nullptr);
92 
93  void insertAncestors(ProductProvenance const& iGetParents,
94  ProductProvenanceRetriever const* iMapper,
95  bool produced,
96  std::set<BranchID> const& producedBranches,
97  std::set<StoredProductProvenance>& oToFill);
98 
99  bool insertProductProvenance(const ProductProvenance&, std::set<StoredProductProvenance>& oToInsert);
100 
101  std::shared_ptr<TFile const> filePtr() const { return get_underlying_safe(filePtr_); }
102  std::shared_ptr<TFile>& filePtr() { return get_underlying_safe(filePtr_); }
105  }
107 
108  //-------------------------------
109  // Member data
110 
124  unsigned long nEventsInLumi_;
140  RootOutputTreePtrArray treePointers_;
143  std::map<ParentageID, unsigned int> parentageIDs_;
144  std::set<BranchID> branchesWithStoredHistory_;
146  };
147 
148 } // namespace edm
149 
150 #endif
void beginInputFile(FileBlock const &fb, int remainingEvents)
LuminosityBlockAuxiliary lumiAux_
std::shared_ptr< TFile > & filePtr()
void writeProcessHistoryRegistry()
void insertAncestors(ProductProvenance const &iGetParents, ProductProvenanceRetriever const *iMapper, bool produced, std::set< BranchID > const &producedBranches, std::set< StoredProductProvenance > &oToFill)
std::vector< OutputItem > OutputItemList
std::map< ParentageID, unsigned int > parentageIDs_
edm::propagate_const< TTree * > metaDataTree_
unsigned long nEventsInLumi_
ProcessHistoryRegistry processHistoryRegistry_
StoredProductProvenanceVector *& pEventEntryInfoVector()
void writeLuminosityBlock(LuminosityBlockForOutput const &lb)
bool shouldWeCloseFile() const
BranchType
Definition: BranchType.h:11
std::set< BranchID > branchesWithStoredHistory_
std::vector< EventSelectionID > EventSelectionIDVector
RootOutputFile(PoolOutputModule *om, std::string const &fileName, std::string const &logicalFileName, std::vector< std::string > const &processesWithSelectedMergeableRunProducts)
std::vector< std::pair< BranchDescription const *, EDGetToken > > SelectedProducts
std::string const & fileName() const
void writeThinnedAssociationsHelper()
std::shared_ptr< TFile const > filePtr() const
long long EntryNumber_t
RootOutputTree eventTree_
std::vector< BranchListIndex > BranchListIndexes
edm::propagate_const< PoolOutputModule * > om_
IndexIntoFile::EntryNumber_t eventEntryNumber_
LuminosityBlockAuxiliary const * pLumiAux_
PoolOutputModule::OutputItem OutputItem
edm::propagate_const< std::shared_ptr< TFile > > filePtr_
std::array< edm::propagate_const< RootOutputTree * >, NumBranchTypes > RootOutputTreePtrArray
void writeOne(EventForOutput const &e)
std::string logicalFile_
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
PoolOutputModule::OutputItemList OutputItemList
edm::propagate_const< TClass * > wrapperBaseTClass_
std::size_t Token
Definition: JobReport.h:106
EventSelectionIDVector const * pEventSelectionIDs_
edm::propagate_const< TTree * > parameterSetsTree_
StoredMergeableRunProductMetadata storedMergeableRunProductMetadata_
void writeStoredMergeableRunProductMetadata()
edm::propagate_const< StoredProductProvenanceVector * > pEventEntryInfoVector_
void setBranchAliases(TTree *tree, SelectedProducts const &branches) const
RootOutputTree runTree_
StoredProductProvenanceVector eventEntryInfoVector_
edm::propagate_const< TTree * > parentageTree_
bool insertProductProvenance(const ProductProvenance &, std::set< StoredProductProvenance > &oToInsert)
std::vector< StoredProductProvenance > StoredProductProvenanceVector
void respondToCloseInputFile(FileBlock const &fb)
IndexIntoFile indexIntoFile_
IndexIntoFile::EntryNumber_t runEntryNumber_
EventAuxiliary const * pEventAux_
HLT enums.
RunAuxiliary runAux_
void writeProductDescriptionRegistry()
StoredProductProvenanceVector const * pEventEntryInfoVector() const
RootOutputTreePtrArray treePointers_
Definition: tree.py:1
BranchListIndexes const * pBranchListIndexes_
IndexIntoFile::EntryNumber_t lumiEntryNumber_
RootOutputTree lumiTree_
void writeRun(RunForOutput const &r)
RunAuxiliary const * pRunAux_
def branchType(schema, name)
Definition: revisionDML.py:114
JobReport::Token reportToken_
void fillBranches(BranchType const &branchType, OccurrenceForOutput const &occurrence, StoredProductProvenanceVector *productProvenanceVecPtr=0, ProductProvenanceRetriever const *provRetriever=0)