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 
39 
40 class TTree;
41 class TFile;
42 class TClass;
43 
44 namespace edm {
45  class OccurrenceForOutput;
46  class PoolOutputModule;
47 
49  public:
52  explicit RootOutputFile(PoolOutputModule* om,
53  std::string const& fileName,
54  std::string const& logicalFileName,
55  std::vector<std::string> const& processesWithSelectedMergeableRunProducts);
57  void writeOne(EventForOutput const& e);
58  //void endFile();
60  void writeRun(RunForOutput const& r);
63  void writeFileIdentifier();
64  void writeIndexIntoFile();
73  void writeEventAuxiliary();
75 
76  void finishEndFile();
77  void beginInputFile(FileBlock const& fb, int remainingEvents);
78  void respondToCloseInputFile(FileBlock const& fb);
79  bool shouldWeCloseFile() const;
80 
81  std::string const& fileName() const { return file_; }
82 
83  private:
84  void setBranchAliases(TTree* tree, SelectedProducts const& branches, std::string const& processName) const;
85 
86  void fillBranches(BranchType const& branchType,
87  OccurrenceForOutput const& occurrence,
88  unsigned int ttreeIndex,
89  StoredProductProvenanceVector* productProvenanceVecPtr = nullptr,
90  ProductProvenanceRetriever const* provRetriever = nullptr);
91 
92  void insertAncestors(ProductProvenance const& iGetParents,
93  ProductProvenanceRetriever const* iMapper,
94  bool produced,
95  std::set<BranchID> const& producedBranches,
96  std::set<StoredProductProvenance>& oToFill);
97 
98  bool insertProductProvenance(const ProductProvenance&, std::set<StoredProductProvenance>& oToInsert);
99 
100  std::shared_ptr<TFile const> filePtr() const { return get_underlying_safe(filePtr_); }
101  std::shared_ptr<TFile>& filePtr() { return get_underlying_safe(filePtr_); }
104  }
106 
107  //-------------------------------
108  // Member data
109 
123  unsigned long nEventsInLumi_;
140  std::vector<edm::propagate_const<std::unique_ptr<RootOutputTree>>> processBlockTrees_;
141  std::vector<edm::propagate_const<RootOutputTree*>> treePointers_;
144  std::map<ParentageID, unsigned int> parentageIDs_;
145  std::set<BranchID> branchesWithStoredHistory_;
148  };
149 
150 } // namespace edm
151 
152 #endif
edm::RootOutputFile::writeProcessBlockHelper
void writeProcessBlockHelper()
Definition: RootOutputFile.cc:712
edm::RootOutputFile::dataTypeReported_
bool dataTypeReported_
Definition: RootOutputFile.h:142
edm::RootOutputFile::treePointers_
std::vector< edm::propagate_const< RootOutputTree * > > treePointers_
Definition: RootOutputFile.h:141
edm::RootOutputFile::shouldWeCloseFile
bool shouldWeCloseFile() const
Definition: RootOutputFile.cc:429
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::EventToProcessBlockIndexes
Definition: EventToProcessBlockIndexes.h:12
edm::RootOutputFile::indexIntoFile_
IndexIntoFile indexIntoFile_
Definition: RootOutputFile.h:121
edm::RootOutputFile::pRunAux_
RunAuxiliary const * pRunAux_
Definition: RootOutputFile.h:131
edm::RootOutputFile::runEntryNumber_
IndexIntoFile::EntryNumber_t runEntryNumber_
Definition: RootOutputFile.h:120
edm::RootOutputFile::filePtr
std::shared_ptr< TFile const > filePtr() const
Definition: RootOutputFile.h:100
edm::PoolOutputModule::OutputItem
Definition: PoolOutputModule.h:82
BranchType.h
edm::RootOutputFile::parentageIDs_
std::map< ParentageID, unsigned int > parentageIDs_
Definition: RootOutputFile.h:144
edm::RootOutputFile::pEventToProcessBlockIndexes_
EventToProcessBlockIndexes const * pEventToProcessBlockIndexes_
Definition: RootOutputFile.h:135
propagate_const.h
CompactEventAuxiliaryVector.h
edm::RootOutputFile::writeProductDescriptionRegistry
void writeProductDescriptionRegistry()
Definition: RootOutputFile.cc:635
edm
HLT enums.
Definition: AlignableModifier.h:19
tree
Definition: tree.py:1
edm::JobReport::Token
std::size_t Token
Definition: JobReport.h:106
edm::RootOutputFile::beginInputFile
void beginInputFile(FileBlock const &fb, int remainingEvents)
Definition: RootOutputFile.cc:328
StoredMergeableRunProductMetadata.h
edm::BranchListIndexes
std::vector< BranchListIndex > BranchListIndexes
Definition: BranchListIndex.h:18
edm::RootOutputFile::whyNotFastClonable_
int whyNotFastClonable_
Definition: RootOutputFile.h:114
edm::IndexIntoFile
Definition: IndexIntoFile.h:225
edm::RootOutputFile::fid_
FileID fid_
Definition: RootOutputFile.h:117
edm::RootOutputFile::filePtr
std::shared_ptr< TFile > & filePtr()
Definition: RootOutputFile.h:101
IndexIntoFile.h
edm::RootOutputFile::lumiEntryNumber_
IndexIntoFile::EntryNumber_t lumiEntryNumber_
Definition: RootOutputFile.h:119
edm::RootOutputFile::lumiTree_
RootOutputTree lumiTree_
Definition: RootOutputFile.h:138
ProcessHistoryRegistry.h
edm::RootOutputFile
Definition: RootOutputFile.h:48
edm::RootOutputFile::fillBranches
void fillBranches(BranchType const &branchType, OccurrenceForOutput const &occurrence, unsigned int ttreeIndex, StoredProductProvenanceVector *productProvenanceVecPtr=nullptr, ProductProvenanceRetriever const *provRetriever=nullptr)
Definition: RootOutputFile.cc:810
edm::get_underlying_safe
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
Definition: get_underlying_safe.h:41
edm::PoolOutputModule
Definition: PoolOutputModule.h:41
edm::RootOutputFile::writeThinnedAssociationsHelper
void writeThinnedAssociationsHelper()
Definition: RootOutputFile.cc:623
edm::FileID
Definition: FileID.h:14
edm::RootOutputFile::file_
std::string file_
Definition: RootOutputFile.h:110
edm::RootOutputFile::writeBranchIDListRegistry
void writeBranchIDListRegistry()
Definition: RootOutputFile.cc:616
ParentageID.h
edm::BranchType
BranchType
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::CompactEventAuxiliaryVector
Definition: CompactEventAuxiliaryVector.h:11
edm::FileBlock
Definition: FileBlock.h:22
edm::LuminosityBlockAuxiliary
Definition: LuminosityBlockAuxiliary.h:15
edm::RootOutputFile::fileName
std::string const & fileName() const
Definition: RootOutputFile.h:81
edm::RunForOutput
Definition: RunForOutput.h:40
edm::RootOutputFile::pLumiAux_
LuminosityBlockAuxiliary const * pLumiAux_
Definition: RootOutputFile.h:130
edm::propagate_const
Definition: propagate_const.h:32
edm::RootOutputFile::metaDataTree_
edm::propagate_const< TTree * > metaDataTree_
Definition: RootOutputFile.h:124
edm::RootOutputFile::nEventsInLumi_
unsigned long nEventsInLumi_
Definition: RootOutputFile.h:123
edm::RootOutputFile::pEventEntryInfoVector_
edm::propagate_const< StoredProductProvenanceVector * > pEventEntryInfoVector_
Definition: RootOutputFile.h:133
edm::RootOutputFile::processHistoryRegistry_
ProcessHistoryRegistry processHistoryRegistry_
Definition: RootOutputFile.h:143
edm::RootOutputFile::filePtr_
edm::propagate_const< std::shared_ptr< TFile > > filePtr_
Definition: RootOutputFile.h:116
edm::ProductProvenance
Definition: ProductProvenance.h:24
edm::RootOutputFile::~RootOutputFile
~RootOutputFile()
Definition: RootOutputFile.h:56
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:887
edm::RootOutputFile::writeParameterSetRegistry
void writeParameterSetRegistry()
Definition: RootOutputFile.cc:631
edm::RootOutputFile::branchesWithStoredHistory_
std::set< BranchID > branchesWithStoredHistory_
Definition: RootOutputFile.h:145
edm::RootOutputFile::compactEventAuxiliary_
CompactEventAuxiliaryVector compactEventAuxiliary_
Definition: RootOutputFile.h:147
edm::RootOutputFile::wrapperBaseTClass_
edm::propagate_const< TClass * > wrapperBaseTClass_
Definition: RootOutputFile.h:146
edm::RootOutputFile::canFastCloneAux_
bool canFastCloneAux_
Definition: RootOutputFile.h:115
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:785
edm::EventAuxiliary
Definition: EventAuxiliary.h:14
edm::RootOutputFile::eventTree_
RootOutputTree eventTree_
Definition: RootOutputFile.h:137
LuminosityBlockAuxiliary.h
edm::RootOutputFile::writeStoredMergeableRunProductMetadata
void writeStoredMergeableRunProductMetadata()
Definition: RootOutputFile.cc:603
edm::RootOutputFile::writeEventAuxiliary
void writeEventAuxiliary()
Definition: RootOutputFile.cc:682
edm::RootOutputFile::pBranchListIndexes_
BranchListIndexes const * pBranchListIndexes_
Definition: RootOutputFile.h:134
edm::RootOutputFile::runTree_
RootOutputTree runTree_
Definition: RootOutputFile.h:139
edm::RootOutputTree
Definition: RootOutputTree.h:24
edm::RootOutputFile::pEventEntryInfoVector
StoredProductProvenanceVector *& pEventEntryInfoVector()
Definition: RootOutputFile.h:105
edm::RootOutputFile::writeLuminosityBlock
void writeLuminosityBlock(LuminosityBlockForOutput const &lb)
Definition: RootOutputFile.cc:490
edm::RootOutputFile::eventEntryInfoVector_
StoredProductProvenanceVector eventEntryInfoVector_
Definition: RootOutputFile.h:132
edm::RootOutputFile::writeRun
void writeRun(RunForOutput const &r)
Definition: RootOutputFile.cc:512
edm::RootOutputFile::parentageTree_
edm::propagate_const< TTree * > parentageTree_
Definition: RootOutputFile.h:126
edm::RootOutputFile::writeOne
void writeOne(EventForOutput const &e)
Definition: RootOutputFile.cc:435
edm::RootOutputFile::logicalFile_
std::string logicalFile_
Definition: RootOutputFile.h:111
edm::RootOutputFile::reportToken_
JobReport::Token reportToken_
Definition: RootOutputFile.h:112
RootOutputTree.h
FileID.h
edm::RootOutputFile::runAux_
RunAuxiliary runAux_
Definition: RootOutputFile.h:128
edm::RootOutputFile::finishEndFile
void finishEndFile()
Definition: RootOutputFile.cc:726
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
alignCSCRings.r
r
Definition: alignCSCRings.py:93
edm::ProcessBlockForOutput
Definition: ProcessBlockForOutput.h:27
edm::EventForOutput
Definition: EventForOutput.h:50
edm::ProductProvenanceRetriever
Definition: ProductProvenanceRetriever.h:37
edm::RootOutputFile::om_
edm::propagate_const< PoolOutputModule * > om_
Definition: RootOutputFile.h:113
edm::RootOutputFile::writeFileFormatVersion
void writeFileFormatVersion()
Definition: RootOutputFile.cc:570
edm::RootOutputFile::eventEntryNumber_
IndexIntoFile::EntryNumber_t eventEntryNumber_
Definition: RootOutputFile.h:118
edm::RootOutputFile::writeFileIdentifier
void writeFileIdentifier()
Definition: RootOutputFile.cc:579
Frameworkfwd.h
edm::RootOutputFile::processBlockTrees_
std::vector< edm::propagate_const< std::unique_ptr< RootOutputTree > > > processBlockTrees_
Definition: RootOutputFile.h:140
RunAuxiliary.h
edm::RootOutputFile::setBranchAliases
void setBranchAliases(TTree *tree, SelectedProducts const &branches, std::string const &processName) const
Definition: RootOutputFile.cc:763
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:420
JobReport.h
edm::RootOutputFile::OutputItemList
PoolOutputModule::OutputItemList OutputItemList
Definition: RootOutputFile.h:51
edm::RootOutputFile::writeProductDependencies
void writeProductDependencies()
Definition: RootOutputFile.cc:666
edm::RootOutputFile::pEventAux_
EventAuxiliary const * pEventAux_
Definition: RootOutputFile.h:129
edm::RootOutputFile::pEventEntryInfoVector
StoredProductProvenanceVector const * pEventEntryInfoVector() const
Definition: RootOutputFile.h:102
edm::EventSelectionIDVector
std::vector< EventSelectionID > EventSelectionIDVector
Definition: EventSelectionID.h:16
get_underlying_safe.h
edm::RootOutputFile::lumiAux_
LuminosityBlockAuxiliary lumiAux_
Definition: RootOutputFile.h:127
edm::PoolOutputModule::OutputItemList
std::vector< OutputItem > OutputItemList
Definition: PoolOutputModule.h:115
edm::RootOutputFile::writeParentageRegistry
void writeParentageRegistry()
Definition: RootOutputFile.cc:548
edm::RootOutputFile::pEventSelectionIDs_
EventSelectionIDVector const * pEventSelectionIDs_
Definition: RootOutputFile.h:136
edm::RootOutputFile::parameterSetsTree_
edm::propagate_const< TTree * > parameterSetsTree_
Definition: RootOutputFile.h:125
edm::RootOutputFile::storedMergeableRunProductMetadata_
StoredMergeableRunProductMetadata storedMergeableRunProductMetadata_
Definition: RootOutputFile.h:122
edm::RootOutputFile::writeIndexIntoFile
void writeIndexIntoFile()
Definition: RootOutputFile.cc:586
edm::StoredProductProvenanceVector
std::vector< StoredProductProvenance > StoredProductProvenanceVector
Definition: StoredProductProvenance.h:34
edm::RootOutputFile::writeProcessBlock
void writeProcessBlock(ProcessBlockForOutput const &)
Definition: RootOutputFile.cc:534
EventSelectionID.h
SelectedProducts.h
edm::RootOutputFile::writeProcessHistoryRegistry
void writeProcessHistoryRegistry()
Definition: RootOutputFile.cc:612
edm::RunAuxiliary
Definition: RunAuxiliary.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37