CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
edm::DaqProvenanceHelper Struct Reference

#include <DaqProvenanceHelper.h>

Public Types

typedef oneapi::tbb::concurrent_unordered_map< ParentageID, ParentageID, dqh::parentage_hashParentageIDMap
 
typedef std::map< ProcessHistoryID, ProcessHistoryIDProcessHistoryIDMap
 

Public Member Functions

BranchDescription const & branchDescription () const
 
ProcessHistoryID daqInit (ProductRegistry &productRegistry, ProcessHistoryRegistry &processHistoryRegistry) const
 
 DaqProvenanceHelper (TypeID const &rawDataType)
 
ProductProvenance const & dummyProvenance () const
 
void fixMetaData (ProcessConfigurationVector &pcv, std::vector< ProcessHistory > &phv)
 
void fixMetaData (std::vector< BranchID > &branchIDs) const
 
void fixMetaData (BranchIDLists const &) const
 
void fixMetaData (BranchChildren &branchChildren) const
 
BranchID const & mapBranchID (BranchID const &branchID) const
 
ParentageID const & mapParentageID (ParentageID const &phid) const
 
ProcessHistoryID const & mapProcessHistoryID (ProcessHistoryID const &phid)
 
bool matchProcesses (ProcessConfiguration const &pc, ProcessHistory const &ph) const
 
ProcessHistoryID const * oldProcessHistoryID () const
 
void saveInfo (BranchDescription const &oldBD, BranchDescription const &newBD)
 
void setOldParentageIDToNew (ParentageID const &iOld, ParentageID const &iNew)
 

Private Attributes

BranchDescription const constBranchDescription_
 
ProductProvenance dummyProvenance_
 
BranchID newBranchID_
 
BranchID oldBranchID_
 
ProcessHistoryID const * oldProcessHistoryID_
 
std::string oldProcessName_
 
ParentageIDMap parentageIDMap_
 
ProcessHistoryIDMap phidMap_
 
ParameterSet processParameterSet_
 

Detailed Description

Definition at line 27 of file DaqProvenanceHelper.h.

Member Typedef Documentation

◆ ParentageIDMap

typedef oneapi::tbb::concurrent_unordered_map<ParentageID, ParentageID, dqh::parentage_hash> edm::DaqProvenanceHelper::ParentageIDMap

Definition at line 29 of file DaqProvenanceHelper.h.

◆ ProcessHistoryIDMap

Definition at line 28 of file DaqProvenanceHelper.h.

Constructor & Destructor Documentation

◆ DaqProvenanceHelper()

edm::DaqProvenanceHelper::DaqProvenanceHelper ( TypeID const &  rawDataType)
explicit

Definition at line 37 of file DaqProvenanceHelper.cc.

References edm::ParameterSet::addParameter(), constBranchDescription_, relativeConstraints::empty, HerwigMaxPtPartonFilter_cfi::moduleLabel, edm::BranchDescription::moduleLabel(), edm::moduleName(), edm::BranchDescription::moduleName(), SimL1EmulatorRepack_CalouGT_cff::processName, edm::BranchDescription::processName(), processParameterSet_, edm::ParameterSet::registerIt(), AlCaHLTBitMon_QueryRunRegistry::string, and triggerPaths.

38  : constBranchDescription_(makeDescriptionForDaqProvHelper(rawDataType)),
42  oldBranchID_(),
43  newBranchID_(),
44  oldProcessHistoryID_(nullptr),
45  phidMap_() {
46  // Now we create a process parameter set for the "LHC" process.
47  // We don't currently use the untracked parameters, However, we make them available, just in case.
51  typedef std::vector<std::string> vstring;
52  vstring empty;
53 
54  vstring modlbl;
55  modlbl.reserve(1);
56  modlbl.push_back(moduleLabel);
57  processParameterSet_.addParameter("@all_sources", modlbl);
58 
60  triggerPaths.addParameter<vstring>("@trigger_paths", empty);
62 
63  ParameterSet pseudoInput;
64  pseudoInput.addParameter<std::string>("@module_edm_type", "Source");
65  pseudoInput.addParameter<std::string>("@module_label", moduleLabel);
66  pseudoInput.addParameter<std::string>("@module_type", moduleName);
68 
69  processParameterSet_.addParameter<vstring>("@all_esmodules", empty);
70  processParameterSet_.addParameter<vstring>("@all_esprefers", empty);
71  processParameterSet_.addParameter<vstring>("@all_essources", empty);
77  // Now we register the process parameter set.
79 
80  //std::cerr << processParameterSet_.dump() << std::endl;
81  }
ProductProvenance dummyProvenance_
vector< string > vstring
Definition: ExoticaDQM.cc:7
BranchID const & branchID() const
std::string const & moduleName() const
std::string const & processName() const
ParameterSet const & registerIt()
ProcessHistoryIDMap phidMap_
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:135
std::string moduleName(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:27
BranchDescription const constBranchDescription_
static std::string const triggerPaths
Definition: EdmProvDump.cc:48
std::string const & moduleLabel() const
std::vector< std::string > vstring
Definition: Schedule.cc:482
ProcessHistoryID const * oldProcessHistoryID_

Member Function Documentation

◆ branchDescription()

BranchDescription const& edm::DaqProvenanceHelper::branchDescription ( ) const
inline

Definition at line 46 of file DaqProvenanceHelper.h.

References constBranchDescription_.

Referenced by FedRawDataInputSource::read().

46 { return constBranchDescription_; }
BranchDescription const constBranchDescription_

◆ daqInit()

ProcessHistoryID edm::DaqProvenanceHelper::daqInit ( ProductRegistry productRegistry,
ProcessHistoryRegistry processHistoryRegistry 
) const

Definition at line 83 of file DaqProvenanceHelper.cc.

References constBranchDescription_, edm::ProductRegistry::copyProduct(), edm::getPassID(), edm::getReleaseVersion(), edm::ParameterSet::id(), edm::BranchDescription::processName(), processParameterSet_, and edm::ProcessHistoryRegistry::registerProcessHistory().

Referenced by FedRawDataInputSource::FedRawDataInputSource().

84  {
85  // Now we need to set all the metadata
86  // Add the product to the product registry
87  productRegistry.copyProduct(constBranchDescription_);
88 
89  // Insert an entry for this process in the process history registry
92  processHistoryRegistry.registerProcessHistory(ph);
93 
94  // Save the process history ID for use every event.
95  return ph.setProcessHistoryID();
96  }
std::string getPassID()
Definition: GetPassID.h:7
std::string const & processName() const
ParameterSetID id() const
std::string getReleaseVersion()
BranchDescription const constBranchDescription_

◆ dummyProvenance()

ProductProvenance const& edm::DaqProvenanceHelper::dummyProvenance ( ) const
inline

Definition at line 48 of file DaqProvenanceHelper.h.

References dummyProvenance_.

Referenced by FedRawDataInputSource::read().

48 { return dummyProvenance_; }
ProductProvenance dummyProvenance_

◆ fixMetaData() [1/4]

void edm::DaqProvenanceHelper::fixMetaData ( ProcessConfigurationVector pcv,
std::vector< ProcessHistory > &  phv 
)

◆ fixMetaData() [2/4]

void edm::DaqProvenanceHelper::fixMetaData ( std::vector< BranchID > &  branchIDs) const

Definition at line 139 of file DaqProvenanceHelper.cc.

References newBranchID_, oldBranchID_, and python.rootplot.root2matplotlib::replace().

139  {
140  std::replace(branchID.begin(), branchID.end(), oldBranchID_, newBranchID_);
141  }
def replace(string, replacements)

◆ fixMetaData() [3/4]

void edm::DaqProvenanceHelper::fixMetaData ( BranchIDLists const &  branchIDLists) const

Definition at line 143 of file DaqProvenanceHelper.cc.

References edm::BranchID::id(), newBranchID_, oldBranchID_, and python.rootplot.root2matplotlib::replace().

143  {
146  // The const_cast is ugly, but it beats the alternatives.
147  BranchIDLists& lists = const_cast<BranchIDLists&>(branchIDLists);
148  for (auto& list : lists) {
149  std::replace(list.begin(), list.end(), oldID, newID);
150  }
151  }
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
def replace(string, replacements)
unsigned int value_type
Definition: BranchID.h:16
unsigned int id() const
Definition: BranchID.h:21

◆ fixMetaData() [4/4]

void edm::DaqProvenanceHelper::fixMetaData ( BranchChildren branchChildren) const

Definition at line 153 of file DaqProvenanceHelper.cc.

References edm::BranchChildren::childLookup(), mps_fire::i, newBranchID_, and oldBranchID_.

153  {
154  typedef std::map<BranchID, std::set<BranchID> > BCMap;
155  // The const_cast is ugly, but it beats the alternatives.
156  BCMap& childLookup = const_cast<BCMap&>(branchChildren.childLookup());
157  // First fix any old branchID's in the key.
158  {
159  BCMap::iterator i = childLookup.find(oldBranchID_);
160  if (i != childLookup.end()) {
161  childLookup.insert(std::make_pair(newBranchID_, i->second));
162  childLookup.erase(i);
163  }
164  }
165  // Now fix any old branchID's in the sets;
166  for (auto& child : childLookup) {
167  if (child.second.erase(oldBranchID_) != 0) {
168  child.second.insert(newBranchID_);
169  }
170  }
171  }

◆ mapBranchID()

BranchID const & edm::DaqProvenanceHelper::mapBranchID ( BranchID const &  branchID) const

◆ mapParentageID()

ParentageID const & edm::DaqProvenanceHelper::mapParentageID ( ParentageID const &  phid) const

Definition at line 182 of file DaqProvenanceHelper.cc.

References parentageIDMap_.

Referenced by edm::ReducedProvenanceReader::readProvenance(), edm::FullProvenanceReader::readProvenance(), and edm::OldProvenanceReader::readProvenance().

182  {
183  ParentageIDMap::const_iterator it = parentageIDMap_.find(parentageID);
184  if (it == parentageIDMap_.end()) {
185  return parentageID;
186  }
187  return it->second;
188  }

◆ mapProcessHistoryID()

ProcessHistoryID const & edm::DaqProvenanceHelper::mapProcessHistoryID ( ProcessHistoryID const &  phid)

Definition at line 174 of file DaqProvenanceHelper.cc.

References cms::cuda::assert(), oldProcessHistoryID_, and phidMap_.

174  {
175  ProcessHistoryIDMap::const_iterator it = phidMap_.find(phid);
176  assert(it != phidMap_.end());
177  oldProcessHistoryID_ = &it->first;
178  return it->second;
179  }
assert(be >=bs)
ProcessHistoryIDMap phidMap_
ProcessHistoryID const * oldProcessHistoryID_

◆ matchProcesses()

bool edm::DaqProvenanceHelper::matchProcesses ( ProcessConfiguration const &  pc,
ProcessHistory const &  ph 
) const

Definition at line 98 of file DaqProvenanceHelper.cc.

References oldProcessName_, edm::ProcessConfiguration::passID(), and edm::ProcessConfiguration::releaseVersion().

98  {
99  for (auto const& pc : ph) {
100  if (pc.processName() == oldProcessName_) {
101  return (pc.releaseVersion() == newPC.releaseVersion() && pc.passID() == newPC.passID());
102  }
103  }
104  return false;
105  }

◆ oldProcessHistoryID()

ProcessHistoryID const* edm::DaqProvenanceHelper::oldProcessHistoryID ( ) const
inline

Definition at line 47 of file DaqProvenanceHelper.h.

References oldProcessHistoryID_.

47 { return oldProcessHistoryID_; }
ProcessHistoryID const * oldProcessHistoryID_

◆ saveInfo()

void edm::DaqProvenanceHelper::saveInfo ( BranchDescription const &  oldBD,
BranchDescription const &  newBD 
)
inline

Definition at line 32 of file DaqProvenanceHelper.h.

References edm::BranchDescription::branchID(), newBranchID_, oldBranchID_, oldProcessName_, and edm::BranchDescription::processName().

32  {
33  oldProcessName_ = oldBD.processName();
34  oldBranchID_ = oldBD.branchID();
35  newBranchID_ = newBD.branchID();
36  }

◆ setOldParentageIDToNew()

void edm::DaqProvenanceHelper::setOldParentageIDToNew ( ParentageID const &  iOld,
ParentageID const &  iNew 
)

Definition at line 195 of file DaqProvenanceHelper.cc.

References parentageIDMap_.

195  {
196  parentageIDMap_.insert(std::make_pair(iOld, iNew));
197  }

Member Data Documentation

◆ constBranchDescription_

BranchDescription const edm::DaqProvenanceHelper::constBranchDescription_
private

Definition at line 53 of file DaqProvenanceHelper.h.

Referenced by branchDescription(), daqInit(), and DaqProvenanceHelper().

◆ dummyProvenance_

ProductProvenance edm::DaqProvenanceHelper::dummyProvenance_
private

Definition at line 54 of file DaqProvenanceHelper.h.

Referenced by dummyProvenance().

◆ newBranchID_

BranchID edm::DaqProvenanceHelper::newBranchID_
private

Definition at line 59 of file DaqProvenanceHelper.h.

Referenced by fixMetaData(), mapBranchID(), and saveInfo().

◆ oldBranchID_

BranchID edm::DaqProvenanceHelper::oldBranchID_
private

Definition at line 58 of file DaqProvenanceHelper.h.

Referenced by fixMetaData(), mapBranchID(), and saveInfo().

◆ oldProcessHistoryID_

ProcessHistoryID const* edm::DaqProvenanceHelper::oldProcessHistoryID_
private

Definition at line 60 of file DaqProvenanceHelper.h.

Referenced by mapProcessHistoryID(), and oldProcessHistoryID().

◆ oldProcessName_

std::string edm::DaqProvenanceHelper::oldProcessName_
private

Definition at line 57 of file DaqProvenanceHelper.h.

Referenced by matchProcesses(), and saveInfo().

◆ parentageIDMap_

ParentageIDMap edm::DaqProvenanceHelper::parentageIDMap_
private

Definition at line 62 of file DaqProvenanceHelper.h.

Referenced by mapParentageID(), and setOldParentageIDToNew().

◆ phidMap_

ProcessHistoryIDMap edm::DaqProvenanceHelper::phidMap_
private

Definition at line 61 of file DaqProvenanceHelper.h.

Referenced by mapProcessHistoryID().

◆ processParameterSet_

ParameterSet edm::DaqProvenanceHelper::processParameterSet_
private

Definition at line 55 of file DaqProvenanceHelper.h.

Referenced by daqInit(), and DaqProvenanceHelper().