CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
edm::StoredMergeableRunProductMetadata Class Reference

#include <StoredMergeableRunProductMetadata.h>

Classes

class  SingleRunEntry
 
class  SingleRunEntryAndProcess
 

Public Member Functions

bool & allValidAndUseIndexIntoFile ()
 
bool getLumiContent (unsigned long long runEntry, std::string const &process, bool &valid, std::vector< LuminosityBlockNumber_t >::const_iterator &lumisBegin, std::vector< LuminosityBlockNumber_t >::const_iterator &lumisEnd) const
 
std::vector< LuminosityBlockNumber_t > & lumis ()
 
void optimizeBeforeWrite ()
 
std::vector< std::string > const & processesWithMergeableRunProducts () const
 
std::vector< SingleRunEntry > & singleRunEntries ()
 
std::vector< SingleRunEntryAndProcess > & singleRunEntryAndProcesses ()
 
 StoredMergeableRunProductMetadata ()
 
 StoredMergeableRunProductMetadata (std::vector< std::string > const &processesWithMergeableRunProducts)
 

Private Attributes

bool allValidAndUseIndexIntoFile_
 
std::vector< LuminosityBlockNumber_tlumis_
 
std::vector< std::string > processesWithMergeableRunProducts_
 
std::vector< SingleRunEntrysingleRunEntries_
 
std::vector< SingleRunEntryAndProcesssingleRunEntryAndProcesses_
 

Detailed Description

This class holds information used to decide how to merge together run products when multiple run entries with the same run number and ProcessHistoryID are read from input files contiguously. This class is persistent and stores the information that needs to be remembered from one process to the next. Most of the work related to this decision is performed by the class MergeableRunProductMetadata. The main purpose of this class is to hold the information that needs to be persistently stored. PoolSource and PoolOutputModule interface with this class to read and write it.

Note that the information is not stored for each product. The information is stored for each run entry in Run TTree in the input file and also for each process in which at least one mergeable run product was selected to be written to the output file. It is not necessary to save information for each product individually, it will be the same for every product created in the same process and in the same run entry.

The main piece of information stored is the list of luminosity block numbers processed when the product was created. Often, this list can be obtained from the IndexIntoFile and we do not need to duplicate this information here and so as an optimization we don't. There are also cases where we can detect that the merging has created invalid run products where part of the content has probably been double counted. We save a value to record this problem.

To improve performance, the data structure has been flattened into 4 vectors instead of containing a vector containing vectors containing vectors.

When the user of this class fails to find a run entry with a particular process, the assumption should be made that the lumi numbers are in IndexIntoFile and valid.

Another optimization is that if in all cases the lumi numbers can be obtained from IndexIntoFile and are valid, then all the vectors are cleared and a boolean value is set to indicate this.

Author
W. David Dagenhart, created 23 May, 2018

Definition at line 57 of file StoredMergeableRunProductMetadata.h.

Constructor & Destructor Documentation

edm::StoredMergeableRunProductMetadata::StoredMergeableRunProductMetadata ( )
edm::StoredMergeableRunProductMetadata::StoredMergeableRunProductMetadata ( std::vector< std::string > const &  processesWithMergeableRunProducts)

Member Function Documentation

bool& edm::StoredMergeableRunProductMetadata::allValidAndUseIndexIntoFile ( )
inline
bool edm::StoredMergeableRunProductMetadata::getLumiContent ( unsigned long long  runEntry,
std::string const &  process,
bool &  valid,
std::vector< LuminosityBlockNumber_t >::const_iterator &  lumisBegin,
std::vector< LuminosityBlockNumber_t >::const_iterator &  lumisEnd 
) const

Definition at line 51 of file StoredMergeableRunProductMetadata.cc.

References allValidAndUseIndexIntoFile_, edm::StoredMergeableRunProductMetadata::SingleRunEntryAndProcess::beginLumi(), edm::StoredMergeableRunProductMetadata::SingleRunEntry::beginProcess(), edm::StoredMergeableRunProductMetadata::SingleRunEntryAndProcess::endLumi(), edm::StoredMergeableRunProductMetadata::SingleRunEntry::endProcess(), lumis_, edm::StoredMergeableRunProductMetadata::SingleRunEntryAndProcess::process(), processesWithMergeableRunProducts_, singleRunEntries_, singleRunEntryAndProcesses_, edm::StoredMergeableRunProductMetadata::SingleRunEntryAndProcess::useIndexIntoFile(), and edm::StoredMergeableRunProductMetadata::SingleRunEntryAndProcess::valid().

Referenced by allValidAndUseIndexIntoFile(), optimizeBeforeWrite(), and edm::MergeableRunProductMetadata::readRun().

55  {
56 
57  valid = true;
59  return false;
60  }
61 
62  SingleRunEntry const& singleRunEntry = singleRunEntries_.at(runEntry);
63  for (unsigned long long j = singleRunEntry.beginProcess(); j < singleRunEntry.endProcess(); ++j) {
64  SingleRunEntryAndProcess const& singleRunEntryAndProcess = singleRunEntryAndProcesses_.at(j);
65  // This string comparison could be optimized away by storing an index mapping in
66  // MergeableRunProductMetadata that gets recalculated each time a new input
67  // file is opened
68  if (processesWithMergeableRunProducts_.at(singleRunEntryAndProcess.process()) == process) {
69  valid = singleRunEntryAndProcess.valid();
70  if (singleRunEntryAndProcess.useIndexIntoFile()) {
71  return false;
72  } else {
73  lumisBegin = lumis_.begin() + singleRunEntryAndProcess.beginLumi();
74  lumisEnd = lumis_.begin() + singleRunEntryAndProcess.endLumi();
75  return true;
76  }
77  }
78  }
79  return false;
80  }
std::vector< SingleRunEntryAndProcess > singleRunEntryAndProcesses_
std::vector< LuminosityBlockNumber_t > lumis_
std::vector<LuminosityBlockNumber_t>& edm::StoredMergeableRunProductMetadata::lumis ( )
inline

Definition at line 130 of file StoredMergeableRunProductMetadata.h.

References lumis_.

Referenced by edm::MergeableRunProductMetadata::addProcess().

130 { return lumis_; }
std::vector< LuminosityBlockNumber_t > lumis_
void edm::StoredMergeableRunProductMetadata::optimizeBeforeWrite ( )
std::vector<std::string> const& edm::StoredMergeableRunProductMetadata::processesWithMergeableRunProducts ( ) const
inline
std::vector<SingleRunEntry>& edm::StoredMergeableRunProductMetadata::singleRunEntries ( )
inline
std::vector<SingleRunEntryAndProcess>& edm::StoredMergeableRunProductMetadata::singleRunEntryAndProcesses ( )
inline

Member Data Documentation

bool edm::StoredMergeableRunProductMetadata::allValidAndUseIndexIntoFile_
private
std::vector<LuminosityBlockNumber_t> edm::StoredMergeableRunProductMetadata::lumis_
private

Definition at line 148 of file StoredMergeableRunProductMetadata.h.

Referenced by getLumiContent(), lumis(), and optimizeBeforeWrite().

std::vector<std::string> edm::StoredMergeableRunProductMetadata::processesWithMergeableRunProducts_
private
std::vector<SingleRunEntry> edm::StoredMergeableRunProductMetadata::singleRunEntries_
private
std::vector<SingleRunEntryAndProcess> edm::StoredMergeableRunProductMetadata::singleRunEntryAndProcesses_
private