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);
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 
88  void fillBranches(BranchType const& branchType,
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_;
143  std::map<ParentageID, unsigned int> parentageIDs_;
144  std::set<BranchID> branchesWithStoredHistory_;
146  };
147 
148 } // namespace edm
149 
150 #endif
edm::RootOutputFile::dataTypeReported_
bool dataTypeReported_
Definition: RootOutputFile.h:141
edm::RootOutputFile::shouldWeCloseFile
bool shouldWeCloseFile() const
Definition: RootOutputFile.cc:390
edm::RootOutputFile::RootOutputFile
RootOutputFile(PoolOutputModule *om, std::string const &fileName, std::string const &logicalFileName, std::vector< std::string > const &processesWithSelectedMergeableRunProducts)
Definition: RootOutputFile.cc:81
PoolOutputModule.h
edm::RootOutputFile::setBranchAliases
void setBranchAliases(TTree *tree, SelectedProducts const &branches) const
Definition: RootOutputFile.cc:645
edm::RootOutputFile::indexIntoFile_
IndexIntoFile indexIntoFile_
Definition: RootOutputFile.h:122
edm::RootOutputFile::pRunAux_
RunAuxiliary const * pRunAux_
Definition: RootOutputFile.h:132
edm::RootOutputFile::runEntryNumber_
IndexIntoFile::EntryNumber_t runEntryNumber_
Definition: RootOutputFile.h:121
edm::RootOutputFile::filePtr
std::shared_ptr< TFile const > filePtr() const
Definition: RootOutputFile.h:101
edm::PoolOutputModule::OutputItem
Definition: PoolOutputModule.h:78
edm::RootOutputFile::parentageIDs_
std::map< ParentageID, unsigned int > parentageIDs_
Definition: RootOutputFile.h:143
edm::RootOutputFile::writeProductDescriptionRegistry
void writeProductDescriptionRegistry()
Definition: RootOutputFile.cc:574
edm
HLT enums.
Definition: AlignableModifier.h:19
tree
Definition: tree.py:1
edm::PoolOutputModule::OutputItemList
std::vector< OutputItem > OutputItemList
Definition: PoolOutputModule.h:115
edm::JobReport::Token
std::size_t Token
Definition: JobReport.h:106
edm::RootOutputFile::beginInputFile
void beginInputFile(FileBlock const &fb, int remainingEvents)
Definition: RootOutputFile.cc:304
StoredMergeableRunProductMetadata.h
edm::BranchListIndexes
std::vector< BranchListIndex > BranchListIndexes
Definition: BranchListIndex.h:18
edm::RootOutputFile::whyNotFastClonable_
int whyNotFastClonable_
Definition: RootOutputFile.h:115
edm::RootOutputFile::treePointers_
RootOutputTreePtrArray treePointers_
Definition: RootOutputFile.h:140
edm::IndexIntoFile
Definition: IndexIntoFile.h:225
edm::RootOutputFile::fid_
FileID fid_
Definition: RootOutputFile.h:118
edm::RootOutputFile::filePtr
std::shared_ptr< TFile > & filePtr()
Definition: RootOutputFile.h:102
IndexIntoFile.h
edm::RootOutputFile::lumiEntryNumber_
IndexIntoFile::EntryNumber_t lumiEntryNumber_
Definition: RootOutputFile.h:120
edm::RootOutputFile::lumiTree_
RootOutputTree lumiTree_
Definition: RootOutputFile.h:138
ProcessHistoryRegistry.h
edm::RootOutputFile
Definition: RootOutputFile.h:45
edm::PoolOutputModule
Definition: PoolOutputModule.h:39
edm::RootOutputFile::writeThinnedAssociationsHelper
void writeThinnedAssociationsHelper()
Definition: RootOutputFile.cc:562
edm::FileID
Definition: FileID.h:14
edm::RootOutputFile::file_
std::string file_
Definition: RootOutputFile.h:111
edm::RootOutputFile::writeBranchIDListRegistry
void writeBranchIDListRegistry()
Definition: RootOutputFile.cc:555
ParentageID.h
edm::BranchType
BranchType
Definition: BranchType.h:11
edm::NumBranchTypes
Definition: BranchType.h:11
edm::OccurrenceForOutput
Definition: OccurrenceForOutput.h:45
edm::SelectedProducts
std::vector< std::pair< BranchDescription const *, EDGetToken > > SelectedProducts
Definition: SelectedProducts.h:11
edm::LuminosityBlockForOutput
Definition: LuminosityBlockForOutput.h:40
edm::RootOutputFile::fillBranches
void fillBranches(BranchType const &branchType, OccurrenceForOutput const &occurrence, StoredProductProvenanceVector *productProvenanceVecPtr=nullptr, ProductProvenanceRetriever const *provRetriever=nullptr)
Definition: RootOutputFile.cc:687
edm::FileBlock
Definition: FileBlock.h:20
edm::LuminosityBlockAuxiliary
Definition: LuminosityBlockAuxiliary.h:15
edm::RootOutputFile::fileName
std::string const & fileName() const
Definition: RootOutputFile.h:76
edm::RunForOutput
Definition: RunForOutput.h:39
edm::RootOutputFile::pLumiAux_
LuminosityBlockAuxiliary const * pLumiAux_
Definition: RootOutputFile.h:131
edm::propagate_const
Definition: propagate_const.h:32
edm::RootOutputFile::metaDataTree_
edm::propagate_const< TTree * > metaDataTree_
Definition: RootOutputFile.h:125
OccurrenceForOutput
edm::RootOutputFile::nEventsInLumi_
unsigned long nEventsInLumi_
Definition: RootOutputFile.h:124
edm::RootOutputFile::pEventEntryInfoVector_
edm::propagate_const< StoredProductProvenanceVector * > pEventEntryInfoVector_
Definition: RootOutputFile.h:134
edm::RootOutputFile::processHistoryRegistry_
ProcessHistoryRegistry processHistoryRegistry_
Definition: RootOutputFile.h:142
edm::RootOutputFile::filePtr_
edm::propagate_const< std::shared_ptr< TFile > > filePtr_
Definition: RootOutputFile.h:117
edm::ProductProvenance
Definition: ProductProvenance.h:24
edm::RootOutputFile::RootOutputTreePtrArray
std::array< edm::propagate_const< RootOutputTree * >, NumBranchTypes > RootOutputTreePtrArray
Definition: RootOutputFile.h:49
edm::RootOutputFile::~RootOutputFile
~RootOutputFile()
Definition: RootOutputFile.h:54
ProductProvenance.h
BranchListIndex.h
edm::StoredMergeableRunProductMetadata
Definition: StoredMergeableRunProductMetadata.h:57
StoredProductProvenance.h
edm::RootOutputFile::insertProductProvenance
bool insertProductProvenance(const ProductProvenance &, std::set< StoredProductProvenance > &oToInsert)
Definition: RootOutputFile.cc:763
edm::RootOutputFile::writeParameterSetRegistry
void writeParameterSetRegistry()
Definition: RootOutputFile.cc:570
edm::RootOutputFile::branchesWithStoredHistory_
std::set< BranchID > branchesWithStoredHistory_
Definition: RootOutputFile.h:144
edm::RootOutputFile::OutputItemList
PoolOutputModule::OutputItemList OutputItemList
Definition: RootOutputFile.h:48
edm::RootOutputFile::wrapperBaseTClass_
edm::propagate_const< TClass * > wrapperBaseTClass_
Definition: RootOutputFile.h:145
edm::RootOutputFile::canFastCloneAux_
bool canFastCloneAux_
Definition: RootOutputFile.h:116
edm::RootOutputFile::insertAncestors
void insertAncestors(ProductProvenance const &iGetParents, ProductProvenanceRetriever const *iMapper, bool produced, std::set< BranchID > const &producedBranches, std::set< StoredProductProvenance > &oToFill)
Definition: RootOutputFile.cc:662
edm::EventAuxiliary
Definition: EventAuxiliary.h:14
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::get_underlying_safe
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
Definition: get_underlying_safe.h:40
edm::RootOutputFile::eventTree_
RootOutputTree eventTree_
Definition: RootOutputFile.h:137
LuminosityBlockAuxiliary.h
edm::RootOutputFile::writeStoredMergeableRunProductMetadata
void writeStoredMergeableRunProductMetadata()
Definition: RootOutputFile.cc:542
edm::RootOutputFile::pBranchListIndexes_
BranchListIndexes const * pBranchListIndexes_
Definition: RootOutputFile.h:135
edm::RootOutputFile::runTree_
RootOutputTree runTree_
Definition: RootOutputFile.h:139
edm::RootOutputTree
Definition: RootOutputTree.h:24
edm::RootOutputFile::pEventEntryInfoVector
StoredProductProvenanceVector *& pEventEntryInfoVector()
Definition: RootOutputFile.h:106
edm::RootOutputFile::writeLuminosityBlock
void writeLuminosityBlock(LuminosityBlockForOutput const &lb)
Definition: RootOutputFile.cc:445
edm::RootOutputFile::eventEntryInfoVector_
StoredProductProvenanceVector eventEntryInfoVector_
Definition: RootOutputFile.h:133
edm::RootOutputFile::writeRun
void writeRun(RunForOutput const &r)
Definition: RootOutputFile.cc:466
edm::RootOutputFile::parentageTree_
edm::propagate_const< TTree * > parentageTree_
Definition: RootOutputFile.h:127
edm::RootOutputFile::writeOne
void writeOne(EventForOutput const &e)
Definition: RootOutputFile.cc:396
edm::RootOutputFile::logicalFile_
std::string logicalFile_
Definition: RootOutputFile.h:112
edm::RootOutputFile::reportToken_
JobReport::Token reportToken_
Definition: RootOutputFile.h:113
RootOutputTree.h
FileID.h
edm::RootOutputFile::runAux_
RunAuxiliary runAux_
Definition: RootOutputFile.h:129
edm::RootOutputFile::finishEndFile
void finishEndFile()
Definition: RootOutputFile.cc:614
alignCSCRings.r
r
Definition: alignCSCRings.py:93
edm::EventForOutput
Definition: EventForOutput.h:50
edm::ProductProvenanceRetriever
Definition: ProductProvenanceRetriever.h:56
edm::RootOutputFile::om_
edm::propagate_const< PoolOutputModule * > om_
Definition: RootOutputFile.h:114
edm::RootOutputFile::writeFileFormatVersion
void writeFileFormatVersion()
Definition: RootOutputFile.cc:509
edm::RootOutputFile::eventEntryNumber_
IndexIntoFile::EntryNumber_t eventEntryNumber_
Definition: RootOutputFile.h:119
edm::RootOutputFile::writeFileIdentifier
void writeFileIdentifier()
Definition: RootOutputFile.cc:518
Frameworkfwd.h
edm::RootOutputFile::OutputItem
PoolOutputModule::OutputItem OutputItem
Definition: RootOutputFile.h:47
RunAuxiliary.h
edm::IndexIntoFile::EntryNumber_t
long long EntryNumber_t
Definition: IndexIntoFile.h:231
edm::ProcessHistoryRegistry
Definition: ProcessHistoryRegistry.h:18
edm::RootOutputFile::respondToCloseInputFile
void respondToCloseInputFile(FileBlock const &fb)
Definition: RootOutputFile.cc:384
JobReport.h
edm::RootOutputFile::writeProductDependencies
void writeProductDependencies()
Definition: RootOutputFile.cc:605
edm::RootOutputFile::pEventAux_
EventAuxiliary const * pEventAux_
Definition: RootOutputFile.h:130
edm::RootOutputFile::pEventEntryInfoVector
StoredProductProvenanceVector const * pEventEntryInfoVector() const
Definition: RootOutputFile.h:103
edm::EventSelectionIDVector
std::vector< EventSelectionID > EventSelectionIDVector
Definition: EventSelectionID.h:16
get_underlying_safe.h
edm::RootOutputFile::lumiAux_
LuminosityBlockAuxiliary lumiAux_
Definition: RootOutputFile.h:128
edm::RootOutputFile::writeParentageRegistry
void writeParentageRegistry()
Definition: RootOutputFile.cc:487
edm::RootOutputFile::pEventSelectionIDs_
EventSelectionIDVector const * pEventSelectionIDs_
Definition: RootOutputFile.h:136
edm::RootOutputFile::parameterSetsTree_
edm::propagate_const< TTree * > parameterSetsTree_
Definition: RootOutputFile.h:126
edm::RootOutputFile::storedMergeableRunProductMetadata_
StoredMergeableRunProductMetadata storedMergeableRunProductMetadata_
Definition: RootOutputFile.h:123
edm::RootOutputFile::writeIndexIntoFile
void writeIndexIntoFile()
Definition: RootOutputFile.cc:525
benchmark_cfg.fb
fb
Definition: benchmark_cfg.py:14
edm::StoredProductProvenanceVector
std::vector< StoredProductProvenance > StoredProductProvenanceVector
Definition: StoredProductProvenance.h:34
EventSelectionID.h
SelectedProducts.h
edm::RootOutputFile::writeProcessHistoryRegistry
void writeProcessHistoryRegistry()
Definition: RootOutputFile.cc:551
edm::RunAuxiliary
Definition: RunAuxiliary.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37