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;
51  std::string const& logicalFileName,
52  std::vector<std::string> const& processesWithSelectedMergeableRunProducts);
54  void writeOne(EventForOutput const& e);
55  //void endFile();
57  void writeRun(RunForOutput const& r);
59  void writeFileIdentifier();
60  void writeIndexIntoFile();
69 
70  void finishEndFile();
71  void beginInputFile(FileBlock const& fb, int remainingEvents);
72  void respondToCloseInputFile(FileBlock const& fb);
73  bool shouldWeCloseFile() const;
74 
75  std::string const& fileName() const {return file_;}
76 
77  private:
78 
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 
100  std::set<StoredProductProvenance>& oToInsert);
101 
102  std::shared_ptr<TFile const> filePtr() const {return get_underlying_safe(filePtr_);}
103  std::shared_ptr<TFile>& filePtr() {return get_underlying_safe(filePtr_);}
106 
107  //-------------------------------
108  // Member data
109 
123  unsigned long nEventsInLumi_;
139  RootOutputTreePtrArray treePointers_;
142  std::map<ParentageID,unsigned int> parentageIDs_;
143  std::set<BranchID> branchesWithStoredHistory_;
145  };
146 
147 }
148 
149 #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
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::map< ParentageID, unsigned int > parentageIDs_
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:107
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:113
JobReport::Token reportToken_
void fillBranches(BranchType const &branchType, OccurrenceForOutput const &occurrence, StoredProductProvenanceVector *productProvenanceVecPtr=0, ProductProvenanceRetriever const *provRetriever=0)