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:
54 
56 
58 
60 
61  // Called each time a new input file is opened
62  void preReadFile();
63 
64  // Called each time a run entry is read from an input file. This
65  // should be called before the run products themselves are read
66  // because it sets the decision whether to merge, replace, or ignore
67  // run products as they read.
68  void readRun(
69  long long inputRunEntry,
70  StoredMergeableRunProductMetadata const& inputStoredMergeableRunProductMetadata,
71  IndexIntoFileItrHolder const& inputIndexIntoFileItr);
72 
73  // Called to record which lumis were processed by the current run
75 
76  void preWriteRun();
77  void postWriteRun();
78 
80 
81  MergeDecision getMergeDecision(std::string const& processThatCreatedProduct) const;
82 
83  // If Runs were split on lumi boundaries, but then the files were merged
84  // in a way that made it impossible to properly merge run products, this
85  // function will return true. The Framework usually does not know
86  // enough to detect other cases where there is a merging problem.
87  bool knownImproperlyMerged(std::string const& processThatCreatedProduct) const override;
88 
89  std::string const& getProcessName(unsigned int index) const {
91  }
92 
94  public:
95 
96  MetadataForProcess() = default;
97 
98  std::vector<LuminosityBlockNumber_t>& lumis() { return lumis_; }
99  std::vector<LuminosityBlockNumber_t> const& lumis() const { return lumis_; }
100 
103 
104  bool valid() const { return valid_; }
105  void setValid(bool v) { valid_ = v; }
106 
107  bool useIndexIntoFile() const { return useIndexIntoFile_; }
109 
110  bool allLumisProcessed() const { return allLumisProcessed_; }
112 
113  void reset();
114 
115  private:
116 
117  std::vector<LuminosityBlockNumber_t> lumis_;
119  bool valid_ = true;
120  bool useIndexIntoFile_ = false;
121  bool allLumisProcessed_ = false;
122  };
123 
125 
126  // The next few functions are only intended to be used in tests.
127  std::vector<MetadataForProcess> const&
129 
130  std::vector<LuminosityBlockNumber_t> const &
132 
134 
135  tbb::concurrent_vector<LuminosityBlockNumber_t> const&
136  lumisProcessed() const { return lumisProcessed_; }
137 
138  private:
139 
141 
142  bool addProcess(StoredMergeableRunProductMetadata& storedMetadata,
143  MetadataForProcess const& metadataForProcess,
144  unsigned int storedProcessIndex,
145  unsigned long long beginProcess,
146  unsigned long long endProcess) const;
147 
149 
150  // This vector has an entry for each process that has a
151  // mergeable run product in the input. It has an exact one to
152  // correspondence with mergeableRunProductProcesses_ and
153  // is in the same order.
154  std::vector<MetadataForProcess> metadataForProcesses_;
155 
156  std::vector<LuminosityBlockNumber_t> lumisFromIndexIntoFile_;
158 
159  tbb::concurrent_vector<LuminosityBlockNumber_t> lumisProcessed_;
160  };
161 }
162 #endif
bool knownImproperlyMerged(std::string const &processThatCreatedProduct) const override
void addEntryToStoredMetadata(StoredMergeableRunProductMetadata &) const
std::vector< LuminosityBlockNumber_t > const & lumisFromIndexIntoFile() const
bool addProcess(StoredMergeableRunProductMetadata &storedMetadata, MetadataForProcess const &metadataForProcess, unsigned int storedProcessIndex, unsigned long long beginProcess, unsigned long long endProcess) const
unsigned int LuminosityBlockNumber_t
std::string const & getProcessName(unsigned int index) const
MergeableRunProductProcesses const * mergeableRunProductProcesses_
tbb::concurrent_vector< LuminosityBlockNumber_t > const & lumisProcessed() const
std::vector< MetadataForProcess > metadataForProcesses_
MergeableRunProductMetadata(MergeableRunProductProcesses const &)
MergeDecision getMergeDecision(std::string const &processThatCreatedProduct) const
std::vector< LuminosityBlockNumber_t > const & lumis() const
void writeLumi(LuminosityBlockNumber_t lumi)
std::vector< LuminosityBlockNumber_t > lumisFromIndexIntoFile_
std::string const & getProcessName(unsigned int index) const
tbb::concurrent_vector< LuminosityBlockNumber_t > lumisProcessed_
MetadataForProcess const * metadataForOneProcess(std::string const &processName) const
HLT enums.
std::vector< MetadataForProcess > const & metadataForProcesses() const
void readRun(long long inputRunEntry, StoredMergeableRunProductMetadata const &inputStoredMergeableRunProductMetadata, IndexIntoFileItrHolder const &inputIndexIntoFileItr)