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 
35 
36 class TTree;
37 class TFile;
38 class TClass;
39 
40 namespace edm {
41  class OccurrenceForOutput;
42  class PoolOutputModule;
43 
45  public:
48  typedef std::array<edm::propagate_const<RootOutputTree*>, NumBranchTypes> RootOutputTreePtrArray;
50  std::string const& logicalFileName);
52  void writeOne(EventForOutput const& e);
53  //void endFile();
55  void writeRun(RunForOutput const& r);
57  void writeFileIdentifier();
58  void writeIndexIntoFile();
66 
67  void finishEndFile();
68  void beginInputFile(FileBlock const& fb, int remainingEvents);
69  void respondToCloseInputFile(FileBlock const& fb);
70  bool shouldWeCloseFile() const;
71 
72  std::string const& fileName() const {return file_;}
73 
74  private:
75 
76  //-------------------------------
77  // Local types
78  //
79 
80  //-------------------------------
81  // Private functions
82 
83  void setBranchAliases(TTree* tree, SelectedProducts const& branches) const;
84 
86  OccurrenceForOutput const& occurrence,
87  StoredProductProvenanceVector* productProvenanceVecPtr = nullptr,
88  ProductProvenanceRetriever const* provRetriever = nullptr);
89 
90  void insertAncestors(ProductProvenance const& iGetParents,
91  ProductProvenanceRetriever const* iMapper,
92  bool produced,
93  std::set<BranchID> const& producedBranches,
94  std::set<StoredProductProvenance>& oToFill);
95 
97  std::set<StoredProductProvenance>& oToInsert);
98 
99  std::shared_ptr<TFile const> filePtr() const {return get_underlying_safe(filePtr_);}
100  std::shared_ptr<TFile>& filePtr() {return get_underlying_safe(filePtr_);}
103 
104  //-------------------------------
105  // Member data
106 
119  unsigned long nEventsInLumi_;
135  RootOutputTreePtrArray treePointers_;
138  std::map<ParentageID,unsigned int> parentageIDs_;
139  std::set<BranchID> branchesWithStoredHistory_;
141  };
142 
143 }
144 
145 #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
long long EntryNumber_t
BranchType
Definition: BranchType.h:11
std::set< BranchID > branchesWithStoredHistory_
std::vector< EventSelectionID > EventSelectionIDVector
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
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_
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
RootOutputFile(PoolOutputModule *om, std::string const &fileName, std::string const &logicalFileName)
RootOutputTreePtrArray treePointers_
Definition: tree.py:1
BranchListIndexes const * pBranchListIndexes_
const eventsetup::produce::Produce produced
Definition: ESProducts.cc:20
IndexIntoFile::EntryNumber_t lumiEntryNumber_
RootOutputTree lumiTree_
void writeRun(RunForOutput const &r)
RunAuxiliary const * pRunAux_
def branchType(schema, name)
Definition: revisionDML.py:112
JobReport::Token reportToken_
void fillBranches(BranchType const &branchType, OccurrenceForOutput const &occurrence, StoredProductProvenanceVector *productProvenanceVecPtr=0, ProductProvenanceRetriever const *provRetriever=0)