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 
37 
38 class TTree;
39 class TFile;
40 class TClass;
41 
42 namespace edm {
43  class OccurrenceForOutput;
44  class PoolOutputModule;
45 
47  public:
50  typedef std::array<edm::propagate_const<RootOutputTree*>, NumBranchTypes> RootOutputTreePtrArray;
51  explicit RootOutputFile(PoolOutputModule* om,
52  std::string const& fileName,
53  std::string const& logicalFileName,
54  std::vector<std::string> const& processesWithSelectedMergeableRunProducts);
56  void writeOne(EventForOutput const& e);
57  //void endFile();
59  void writeRun(RunForOutput const& r);
61  void writeFileIdentifier();
62  void writeIndexIntoFile();
71  void writeEventAuxiliary();
72 
73  void finishEndFile();
74  void beginInputFile(FileBlock const& fb, int remainingEvents);
76  bool shouldWeCloseFile() const;
77 
78  std::string const& fileName() const { return file_; }
79 
80  private:
81  //-------------------------------
82  // Local types
83  //
84 
85  //-------------------------------
86  // Private functions
87 
88  void setBranchAliases(TTree* tree, SelectedProducts const& branches) const;
89 
90  void fillBranches(BranchType const& branchType,
91  OccurrenceForOutput const& occurrence,
92  StoredProductProvenanceVector* productProvenanceVecPtr = nullptr,
93  ProductProvenanceRetriever const* provRetriever = nullptr);
94 
95  void insertAncestors(ProductProvenance const& iGetParents,
96  ProductProvenanceRetriever const* iMapper,
97  bool produced,
98  std::set<BranchID> const& producedBranches,
99  std::set<StoredProductProvenance>& oToFill);
100 
101  bool insertProductProvenance(const ProductProvenance&, std::set<StoredProductProvenance>& oToInsert);
102 
103  std::shared_ptr<TFile const> filePtr() const { return get_underlying_safe(filePtr_); }
104  std::shared_ptr<TFile>& filePtr() { return get_underlying_safe(filePtr_); }
107  }
109 
110  //-------------------------------
111  // Member data
112 
126  unsigned long nEventsInLumi_;
145  std::map<ParentageID, unsigned int> parentageIDs_;
146  std::set<BranchID> branchesWithStoredHistory_;
149  };
150 
151 } // namespace edm
152 
153 #endif
edm::RootOutputFile::dataTypeReported_
bool dataTypeReported_
Definition: RootOutputFile.h:143
edm::RootOutputFile::shouldWeCloseFile
bool shouldWeCloseFile() const
Definition: RootOutputFile.cc:418
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:722
edm::RootOutputFile::indexIntoFile_
IndexIntoFile indexIntoFile_
Definition: RootOutputFile.h:124
edm::RootOutputFile::pRunAux_
RunAuxiliary const * pRunAux_
Definition: RootOutputFile.h:134
edm::RootOutputFile::runEntryNumber_
IndexIntoFile::EntryNumber_t runEntryNumber_
Definition: RootOutputFile.h:123
edm::RootOutputFile::filePtr
std::shared_ptr< TFile const > filePtr() const
Definition: RootOutputFile.h:103
edm::PoolOutputModule::OutputItem
Definition: PoolOutputModule.h:80
edm::RootOutputFile::parentageIDs_
std::map< ParentageID, unsigned int > parentageIDs_
Definition: RootOutputFile.h:145
CompactEventAuxiliaryVector.h
edm::RootOutputFile::writeProductDescriptionRegistry
void writeProductDescriptionRegistry()
Definition: RootOutputFile.cc:606
edm
HLT enums.
Definition: AlignableModifier.h:19
tree
Definition: tree.py:1
edm::PoolOutputModule::OutputItemList
std::vector< OutputItem > OutputItemList
Definition: PoolOutputModule.h:117
edm::JobReport::Token
std::size_t Token
Definition: JobReport.h:106
edm::RootOutputFile::beginInputFile
void beginInputFile(FileBlock const &fb, int remainingEvents)
Definition: RootOutputFile.cc:317
StoredMergeableRunProductMetadata.h
edm::BranchListIndexes
std::vector< BranchListIndex > BranchListIndexes
Definition: BranchListIndex.h:18
edm::RootOutputFile::whyNotFastClonable_
int whyNotFastClonable_
Definition: RootOutputFile.h:117
edm::RootOutputFile::treePointers_
RootOutputTreePtrArray treePointers_
Definition: RootOutputFile.h:142
edm::IndexIntoFile
Definition: IndexIntoFile.h:225
edm::RootOutputFile::fid_
FileID fid_
Definition: RootOutputFile.h:120
edm::RootOutputFile::filePtr
std::shared_ptr< TFile > & filePtr()
Definition: RootOutputFile.h:104
IndexIntoFile.h
edm::RootOutputFile::lumiEntryNumber_
IndexIntoFile::EntryNumber_t lumiEntryNumber_
Definition: RootOutputFile.h:122
edm::RootOutputFile::lumiTree_
RootOutputTree lumiTree_
Definition: RootOutputFile.h:140
ProcessHistoryRegistry.h
edm::RootOutputFile
Definition: RootOutputFile.h:46
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:39
edm::RootOutputFile::writeThinnedAssociationsHelper
void writeThinnedAssociationsHelper()
Definition: RootOutputFile.cc:594
edm::FileID
Definition: FileID.h:14
edm::RootOutputFile::file_
std::string file_
Definition: RootOutputFile.h:113
edm::RootOutputFile::writeBranchIDListRegistry
void writeBranchIDListRegistry()
Definition: RootOutputFile.cc:587
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:764
edm::CompactEventAuxiliaryVector
Definition: CompactEventAuxiliaryVector.h:11
edm::FileBlock
Definition: FileBlock.h:20
edm::LuminosityBlockAuxiliary
Definition: LuminosityBlockAuxiliary.h:15
edm::RootOutputFile::fileName
std::string const & fileName() const
Definition: RootOutputFile.h:78
edm::RunForOutput
Definition: RunForOutput.h:39
edm::RootOutputFile::pLumiAux_
LuminosityBlockAuxiliary const * pLumiAux_
Definition: RootOutputFile.h:133
edm::propagate_const
Definition: propagate_const.h:32
edm::RootOutputFile::metaDataTree_
edm::propagate_const< TTree * > metaDataTree_
Definition: RootOutputFile.h:127
OccurrenceForOutput
edm::RootOutputFile::nEventsInLumi_
unsigned long nEventsInLumi_
Definition: RootOutputFile.h:126
edm::RootOutputFile::pEventEntryInfoVector_
edm::propagate_const< StoredProductProvenanceVector * > pEventEntryInfoVector_
Definition: RootOutputFile.h:136
edm::RootOutputFile::processHistoryRegistry_
ProcessHistoryRegistry processHistoryRegistry_
Definition: RootOutputFile.h:144
edm::RootOutputFile::filePtr_
edm::propagate_const< std::shared_ptr< TFile > > filePtr_
Definition: RootOutputFile.h:119
edm::ProductProvenance
Definition: ProductProvenance.h:24
edm::RootOutputFile::RootOutputTreePtrArray
std::array< edm::propagate_const< RootOutputTree * >, NumBranchTypes > RootOutputTreePtrArray
Definition: RootOutputFile.h:50
edm::RootOutputFile::~RootOutputFile
~RootOutputFile()
Definition: RootOutputFile.h:55
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:840
edm::RootOutputFile::writeParameterSetRegistry
void writeParameterSetRegistry()
Definition: RootOutputFile.cc:602
edm::RootOutputFile::branchesWithStoredHistory_
std::set< BranchID > branchesWithStoredHistory_
Definition: RootOutputFile.h:146
edm::RootOutputFile::OutputItemList
PoolOutputModule::OutputItemList OutputItemList
Definition: RootOutputFile.h:49
edm::RootOutputFile::compactEventAuxiliary_
CompactEventAuxiliaryVector compactEventAuxiliary_
Definition: RootOutputFile.h:148
edm::RootOutputFile::wrapperBaseTClass_
edm::propagate_const< TClass * > wrapperBaseTClass_
Definition: RootOutputFile.h:147
edm::RootOutputFile::canFastCloneAux_
bool canFastCloneAux_
Definition: RootOutputFile.h:118
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:739
edm::EventAuxiliary
Definition: EventAuxiliary.h:14
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::RootOutputFile::eventTree_
RootOutputTree eventTree_
Definition: RootOutputFile.h:139
LuminosityBlockAuxiliary.h
edm::RootOutputFile::writeStoredMergeableRunProductMetadata
void writeStoredMergeableRunProductMetadata()
Definition: RootOutputFile.cc:574
edm::RootOutputFile::writeEventAuxiliary
void writeEventAuxiliary()
Definition: RootOutputFile.cc:653
edm::RootOutputFile::pBranchListIndexes_
BranchListIndexes const * pBranchListIndexes_
Definition: RootOutputFile.h:137
edm::RootOutputFile::runTree_
RootOutputTree runTree_
Definition: RootOutputFile.h:141
edm::RootOutputTree
Definition: RootOutputTree.h:24
edm::RootOutputFile::pEventEntryInfoVector
StoredProductProvenanceVector *& pEventEntryInfoVector()
Definition: RootOutputFile.h:108
edm::RootOutputFile::writeLuminosityBlock
void writeLuminosityBlock(LuminosityBlockForOutput const &lb)
Definition: RootOutputFile.cc:477
edm::RootOutputFile::eventEntryInfoVector_
StoredProductProvenanceVector eventEntryInfoVector_
Definition: RootOutputFile.h:135
edm::RootOutputFile::writeRun
void writeRun(RunForOutput const &r)
Definition: RootOutputFile.cc:498
edm::RootOutputFile::parentageTree_
edm::propagate_const< TTree * > parentageTree_
Definition: RootOutputFile.h:129
edm::RootOutputFile::writeOne
void writeOne(EventForOutput const &e)
Definition: RootOutputFile.cc:424
edm::RootOutputFile::logicalFile_
std::string logicalFile_
Definition: RootOutputFile.h:114
edm::RootOutputFile::reportToken_
JobReport::Token reportToken_
Definition: RootOutputFile.h:115
RootOutputTree.h
FileID.h
edm::RootOutputFile::runAux_
RunAuxiliary runAux_
Definition: RootOutputFile.h:131
edm::RootOutputFile::finishEndFile
void finishEndFile()
Definition: RootOutputFile.cc:683
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:116
edm::RootOutputFile::writeFileFormatVersion
void writeFileFormatVersion()
Definition: RootOutputFile.cc:541
edm::RootOutputFile::eventEntryNumber_
IndexIntoFile::EntryNumber_t eventEntryNumber_
Definition: RootOutputFile.h:121
edm::RootOutputFile::writeFileIdentifier
void writeFileIdentifier()
Definition: RootOutputFile.cc:550
Frameworkfwd.h
edm::RootOutputFile::OutputItem
PoolOutputModule::OutputItem OutputItem
Definition: RootOutputFile.h:48
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:409
JobReport.h
edm::RootOutputFile::writeProductDependencies
void writeProductDependencies()
Definition: RootOutputFile.cc:637
edm::RootOutputFile::pEventAux_
EventAuxiliary const * pEventAux_
Definition: RootOutputFile.h:132
edm::RootOutputFile::pEventEntryInfoVector
StoredProductProvenanceVector const * pEventEntryInfoVector() const
Definition: RootOutputFile.h:105
edm::EventSelectionIDVector
std::vector< EventSelectionID > EventSelectionIDVector
Definition: EventSelectionID.h:16
get_underlying_safe.h
edm::RootOutputFile::lumiAux_
LuminosityBlockAuxiliary lumiAux_
Definition: RootOutputFile.h:130
edm::RootOutputFile::writeParentageRegistry
void writeParentageRegistry()
Definition: RootOutputFile.cc:519
edm::RootOutputFile::pEventSelectionIDs_
EventSelectionIDVector const * pEventSelectionIDs_
Definition: RootOutputFile.h:138
edm::RootOutputFile::parameterSetsTree_
edm::propagate_const< TTree * > parameterSetsTree_
Definition: RootOutputFile.h:128
edm::RootOutputFile::storedMergeableRunProductMetadata_
StoredMergeableRunProductMetadata storedMergeableRunProductMetadata_
Definition: RootOutputFile.h:125
edm::RootOutputFile::writeIndexIntoFile
void writeIndexIntoFile()
Definition: RootOutputFile.cc:557
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:583
edm::RunAuxiliary
Definition: RunAuxiliary.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37