CMS 3D CMS Logo

MergeableRunProductMetadata.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_MergeableRunProductMetadata_h
2 #define FWCore_Framework_MergeableRunProductMetadata_h
3 
41 
42 #include "tbb/concurrent_vector.h"
43 
44 #include <string>
45 #include <vector>
46 
47 namespace edm {
48 
49  class IndexIntoFileItrHolder;
50  class StoredMergeableRunProductMetadata;
51 
53  public:
55 
57 
59 
60  // Called each time a new input file is opened
61  void preReadFile();
62 
63  // Called each time a run entry is read from an input file. This
64  // should be called before the run products themselves are read
65  // because it sets the decision whether to merge, replace, or ignore
66  // run products as they read.
67  void readRun(long long inputRunEntry,
68  StoredMergeableRunProductMetadata const& inputStoredMergeableRunProductMetadata,
69  IndexIntoFileItrHolder const& inputIndexIntoFileItr);
70 
71  // Called to record which lumis were processed by the current run
73 
74  void preWriteRun();
75  void postWriteRun();
76 
78 
79  MergeDecision getMergeDecision(std::string const& processThatCreatedProduct) const;
80 
81  // If Runs were split on lumi boundaries, but then the files were merged
82  // in a way that made it impossible to properly merge run products, this
83  // function will return true. The Framework usually does not know
84  // enough to detect other cases where there is a merging problem.
85  bool knownImproperlyMerged(std::string const& processThatCreatedProduct) const override;
86 
87  std::string const& getProcessName(unsigned int index) const {
89  }
90 
92  public:
93  MetadataForProcess() = default;
94 
95  std::vector<LuminosityBlockNumber_t>& lumis() { return lumis_; }
96  std::vector<LuminosityBlockNumber_t> const& lumis() const { return lumis_; }
97 
100 
101  bool valid() const { return valid_; }
102  void setValid(bool v) { valid_ = v; }
103 
104  bool useIndexIntoFile() const { return useIndexIntoFile_; }
106 
107  bool allLumisProcessed() const { return allLumisProcessed_; }
109 
110  void reset();
111 
112  private:
113  std::vector<LuminosityBlockNumber_t> lumis_;
115  bool valid_ = true;
116  bool useIndexIntoFile_ = false;
117  bool allLumisProcessed_ = false;
118  };
119 
121 
122  // The next few functions are only intended to be used in tests.
123  std::vector<MetadataForProcess> const& metadataForProcesses() const { return metadataForProcesses_; }
124 
125  std::vector<LuminosityBlockNumber_t> const& lumisFromIndexIntoFile() const { return lumisFromIndexIntoFile_; }
126 
128 
129  tbb::concurrent_vector<LuminosityBlockNumber_t> const& lumisProcessed() const { return lumisProcessed_; }
130 
131  private:
133 
134  bool addProcess(StoredMergeableRunProductMetadata& storedMetadata,
135  MetadataForProcess const& metadataForProcess,
136  unsigned int storedProcessIndex,
137  unsigned long long beginProcess,
138  unsigned long long endProcess) const;
139 
141 
142  // This vector has an entry for each process that has a
143  // mergeable run product in the input. It has an exact one to
144  // correspondence with mergeableRunProductProcesses_ and
145  // is in the same order.
146  std::vector<MetadataForProcess> metadataForProcesses_;
147 
148  std::vector<LuminosityBlockNumber_t> lumisFromIndexIntoFile_;
150 
151  tbb::concurrent_vector<LuminosityBlockNumber_t> lumisProcessed_;
152  };
153 } // namespace edm
154 #endif
edm::MergeableRunProductMetadata::MetadataForProcess::setValid
void setValid(bool v)
Definition: MergeableRunProductMetadata.h:102
edm::MergeableRunProductMetadata::addEntryToStoredMetadata
void addEntryToStoredMetadata(StoredMergeableRunProductMetadata &) const
Definition: MergeableRunProductMetadata.cc:162
edm::MergeableRunProductMetadata::lumisProcessed_
tbb::concurrent_vector< LuminosityBlockNumber_t > lumisProcessed_
Definition: MergeableRunProductMetadata.h:151
edm::MergeableRunProductMetadata::MetadataForProcess::lumis
std::vector< LuminosityBlockNumber_t > const & lumis() const
Definition: MergeableRunProductMetadata.h:96
edm::MergeableRunProductMetadata::postWriteRun
void postWriteRun()
Definition: MergeableRunProductMetadata.cc:155
edm::MergeableRunProductMetadata::gotLumisFromIndexIntoFile_
bool gotLumisFromIndexIntoFile_
Definition: MergeableRunProductMetadata.h:149
MergeableRunProductMetadataBase.h
edm::MergeableRunProductMetadataBase
Definition: MergeableRunProductMetadataBase.h:7
edm::MergeableRunProductMetadata::MERGE
Definition: MergeableRunProductMetadata.h:54
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::MergeableRunProductMetadata::mergeLumisFromIndexIntoFile
void mergeLumisFromIndexIntoFile()
Definition: MergeableRunProductMetadata.cc:302
RunLumiEventNumber.h
edm::MergeableRunProductMetadata::lumisProcessed
tbb::concurrent_vector< LuminosityBlockNumber_t > const & lumisProcessed() const
Definition: MergeableRunProductMetadata.h:129
findQualityFiles.v
v
Definition: findQualityFiles.py:179
edm::MergeableRunProductMetadata::MetadataForProcess::lumis_
std::vector< LuminosityBlockNumber_t > lumis_
Definition: MergeableRunProductMetadata.h:113
edm::LuminosityBlockNumber_t
unsigned int LuminosityBlockNumber_t
Definition: RunLumiEventNumber.h:13
edm::MergeableRunProductMetadata::MetadataForProcess::lumis
std::vector< LuminosityBlockNumber_t > & lumis()
Definition: MergeableRunProductMetadata.h:95
edm::IndexIntoFileItrHolder
Definition: IndexIntoFile.h:1109
edm::MergeableRunProductProcesses::getProcessName
std::string const & getProcessName(unsigned int index) const
Definition: MergeableRunProductProcesses.h:19
edm::MergeableRunProductMetadata::MetadataForProcess::reset
void reset()
Definition: MergeableRunProductMetadata.cc:280
edm::MergeableRunProductMetadata::lumisFromIndexIntoFile
std::vector< LuminosityBlockNumber_t > const & lumisFromIndexIntoFile() const
Definition: MergeableRunProductMetadata.h:125
edm::MergeableRunProductMetadata::MetadataForProcess::MetadataForProcess
MetadataForProcess()=default
edm::MergeableRunProductMetadata::MetadataForProcess::useIndexIntoFile
bool useIndexIntoFile() const
Definition: MergeableRunProductMetadata.h:104
edm::MergeableRunProductMetadata::MetadataForProcess::allLumisProcessed
bool allLumisProcessed() const
Definition: MergeableRunProductMetadata.h:107
edm::StoredMergeableRunProductMetadata
Definition: StoredMergeableRunProductMetadata.h:57
edm::MergeableRunProductMetadata::getMergeDecision
MergeDecision getMergeDecision(std::string const &processThatCreatedProduct) const
Definition: MergeableRunProductMetadata.cc:260
edm::MergeableRunProductMetadata
Definition: MergeableRunProductMetadata.h:52
edm::MergeableRunProductMetadata::gotLumisFromIndexIntoFile
bool gotLumisFromIndexIntoFile() const
Definition: MergeableRunProductMetadata.h:127
edm::MergeableRunProductMetadata::MetadataForProcess::valid
bool valid() const
Definition: MergeableRunProductMetadata.h:101
edm::MergeableRunProductMetadata::metadataForProcesses_
std::vector< MetadataForProcess > metadataForProcesses_
Definition: MergeableRunProductMetadata.h:146
edm::MergeableRunProductMetadata::knownImproperlyMerged
bool knownImproperlyMerged(std::string const &processThatCreatedProduct) const override
Definition: MergeableRunProductMetadata.cc:272
edm::MergeableRunProductMetadata::mergeableRunProductProcesses_
MergeableRunProductProcesses const * mergeableRunProductProcesses_
Definition: MergeableRunProductMetadata.h:140
edm::MergeableRunProductMetadata::MetadataForProcess::setUseIndexIntoFile
void setUseIndexIntoFile(bool v)
Definition: MergeableRunProductMetadata.h:105
edm::MergeableRunProductMetadata::MetadataForProcess::setMergeDecision
void setMergeDecision(MergeDecision v)
Definition: MergeableRunProductMetadata.h:99
edm::MergeableRunProductMetadata::MergeDecision
MergeDecision
Definition: MergeableRunProductMetadata.h:54
edm::MergeableRunProductMetadata::MergeableRunProductMetadata
MergeableRunProductMetadata(MergeableRunProductProcesses const &)
Definition: MergeableRunProductMetadata.cc:14
edm::MergeableRunProductMetadata::IGNORE
Definition: MergeableRunProductMetadata.h:54
edm::MergeableRunProductMetadata::MetadataForProcess::valid_
bool valid_
Definition: MergeableRunProductMetadata.h:115
edm::MergeableRunProductMetadata::metadataForProcesses
std::vector< MetadataForProcess > const & metadataForProcesses() const
Definition: MergeableRunProductMetadata.h:123
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
edm::MergeableRunProductMetadata::getProcessName
std::string const & getProcessName(unsigned int index) const
Definition: MergeableRunProductMetadata.h:87
edm::MergeableRunProductMetadata::lumisFromIndexIntoFile_
std::vector< LuminosityBlockNumber_t > lumisFromIndexIntoFile_
Definition: MergeableRunProductMetadata.h:148
edm::MergeableRunProductMetadata::MetadataForProcess::mergeDecision
MergeDecision mergeDecision() const
Definition: MergeableRunProductMetadata.h:98
edm::MergeableRunProductMetadata::REPLACE
Definition: MergeableRunProductMetadata.h:54
edm::MergeableRunProductMetadata::preWriteRun
void preWriteRun()
Definition: MergeableRunProductMetadata.cc:125
MergeableRunProductProcesses.h
edm::MergeableRunProductMetadata::MetadataForProcess::setAllLumisProcessed
void setAllLumisProcessed(bool v)
Definition: MergeableRunProductMetadata.h:108
edm::MergeableRunProductMetadata::metadataForOneProcess
MetadataForProcess const * metadataForOneProcess(std::string const &processName) const
Definition: MergeableRunProductMetadata.cc:288
edm::MergeableRunProductMetadata::MetadataForProcess::useIndexIntoFile_
bool useIndexIntoFile_
Definition: MergeableRunProductMetadata.h:116
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::MergeableRunProductMetadata::addProcess
bool addProcess(StoredMergeableRunProductMetadata &storedMetadata, MetadataForProcess const &metadataForProcess, unsigned int storedProcessIndex, unsigned long long beginProcess, unsigned long long endProcess) const
Definition: MergeableRunProductMetadata.cc:207
edm::MergeableRunProductMetadata::MetadataForProcess::mergeDecision_
MergeDecision mergeDecision_
Definition: MergeableRunProductMetadata.h:114
edm::MergeableRunProductMetadata::MetadataForProcess
Definition: MergeableRunProductMetadata.h:91
lumi
Definition: LumiSectionData.h:20
edm::MergeableRunProductMetadata::readRun
void readRun(long long inputRunEntry, StoredMergeableRunProductMetadata const &inputStoredMergeableRunProductMetadata, IndexIntoFileItrHolder const &inputIndexIntoFileItr)
Definition: MergeableRunProductMetadata.cc:23
edm::MergeableRunProductMetadata::preReadFile
void preReadFile()
Definition: MergeableRunProductMetadata.cc:21
edm::MergeableRunProductMetadata::~MergeableRunProductMetadata
~MergeableRunProductMetadata() override
Definition: MergeableRunProductMetadata.cc:19
edm::MergeableRunProductMetadata::MetadataForProcess::allLumisProcessed_
bool allLumisProcessed_
Definition: MergeableRunProductMetadata.h:117
edm::MergeableRunProductMetadata::writeLumi
void writeLumi(LuminosityBlockNumber_t lumi)
Definition: MergeableRunProductMetadata.cc:118
edm::MergeableRunProductProcesses
Definition: MergeableRunProductProcesses.h:11