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)
 
 DaqProvenanceHelper (TypeID const &rawDataType, std::string const &collectionName, std::string const &friendlyName, std::string const &sourceLabel)
 
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() [1/2]

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

Definition at line 91 of file DaqProvenanceHelper.cc.

92  : DaqProvenanceHelper(rawDataType, "FEDRawDataCollection", "FEDRawDataCollection", "FedRawDataInputSource") {}
DaqProvenanceHelper(TypeID const &rawDataType)

◆ DaqProvenanceHelper() [2/2]

edm::DaqProvenanceHelper::DaqProvenanceHelper ( TypeID const &  rawDataType,
std::string const &  collectionName,
std::string const &  friendlyName,
std::string const &  sourceLabel 
)
explicit

Definition at line 40 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.

45  makeDescriptionForDaqProvHelper(rawDataType, collectionName, friendlyName, sourceLabel)),
49  oldBranchID_(),
50  newBranchID_(),
51  oldProcessHistoryID_(nullptr),
52  phidMap_() {
53  // Now we create a process parameter set for the "LHC" process.
54  // We don't currently use the untracked parameters, However, we make them available, just in case.
58  typedef std::vector<std::string> vstring;
59  vstring empty;
60 
61  vstring modlbl;
62  modlbl.reserve(1);
63  modlbl.push_back(moduleLabel);
64  processParameterSet_.addParameter("@all_sources", modlbl);
65 
67  triggerPaths.addParameter<vstring>("@trigger_paths", empty);
69 
70  ParameterSet pseudoInput;
71  pseudoInput.addParameter<std::string>("@module_edm_type", "Source");
72  pseudoInput.addParameter<std::string>("@module_label", moduleLabel);
73  pseudoInput.addParameter<std::string>("@module_type", moduleName);
75 
76  processParameterSet_.addParameter<vstring>("@all_esmodules", empty);
77  processParameterSet_.addParameter<vstring>("@all_esprefers", empty);
78  processParameterSet_.addParameter<vstring>("@all_essources", empty);
84  // Now we register the process parameter set.
86 
87  //std::cerr << processParameterSet_.dump() << std::endl;
88  }
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()
std::string friendlyName(std::string const &iFullName)
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 50 of file DaqProvenanceHelper.h.

References constBranchDescription_.

Referenced by FedRawDataInputSource::read().

50 { return constBranchDescription_; }
BranchDescription const constBranchDescription_

◆ daqInit()

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

Definition at line 94 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().

95  {
96  // Now we need to set all the metadata
97  // Add the product to the product registry
98  productRegistry.copyProduct(constBranchDescription_);
99 
100  // Insert an entry for this process in the process history registry
103  processHistoryRegistry.registerProcessHistory(ph);
104 
105  // Save the process history ID for use every event.
106  return ph.setProcessHistoryID();
107  }
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 52 of file DaqProvenanceHelper.h.

References dummyProvenance_.

Referenced by FedRawDataInputSource::read().

52 { 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 150 of file DaqProvenanceHelper.cc.

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

150  {
151  std::replace(branchID.begin(), branchID.end(), oldBranchID_, newBranchID_);
152  }
def replace(string, replacements)

◆ fixMetaData() [3/4]

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

Definition at line 154 of file DaqProvenanceHelper.cc.

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

154  {
157  // The const_cast is ugly, but it beats the alternatives.
158  BranchIDLists& lists = const_cast<BranchIDLists&>(branchIDLists);
159  for (auto& list : lists) {
160  std::replace(list.begin(), list.end(), oldID, newID);
161  }
162  }
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 164 of file DaqProvenanceHelper.cc.

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

164  {
165  typedef std::map<BranchID, std::set<BranchID> > BCMap;
166  // The const_cast is ugly, but it beats the alternatives.
167  BCMap& childLookup = const_cast<BCMap&>(branchChildren.childLookup());
168  // First fix any old branchID's in the key.
169  {
170  BCMap::iterator i = childLookup.find(oldBranchID_);
171  if (i != childLookup.end()) {
172  childLookup.insert(std::make_pair(newBranchID_, i->second));
173  childLookup.erase(i);
174  }
175  }
176  // Now fix any old branchID's in the sets;
177  for (auto& child : childLookup) {
178  if (child.second.erase(oldBranchID_) != 0) {
179  child.second.insert(newBranchID_);
180  }
181  }
182  }

◆ mapBranchID()

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

◆ mapParentageID()

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

Definition at line 193 of file DaqProvenanceHelper.cc.

References parentageIDMap_.

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

193  {
194  ParentageIDMap::const_iterator it = parentageIDMap_.find(parentageID);
195  if (it == parentageIDMap_.end()) {
196  return parentageID;
197  }
198  return it->second;
199  }

◆ mapProcessHistoryID()

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

Definition at line 185 of file DaqProvenanceHelper.cc.

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

185  {
186  ProcessHistoryIDMap::const_iterator it = phidMap_.find(phid);
187  assert(it != phidMap_.end());
188  oldProcessHistoryID_ = &it->first;
189  return it->second;
190  }
assert(be >=bs)
ProcessHistoryIDMap phidMap_
ProcessHistoryID const * oldProcessHistoryID_

◆ matchProcesses()

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

Definition at line 109 of file DaqProvenanceHelper.cc.

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

109  {
110  for (auto const& pc : ph) {
111  if (pc.processName() == oldProcessName_) {
112  return (pc.releaseVersion() == newPC.releaseVersion() && pc.passID() == newPC.passID());
113  }
114  }
115  return false;
116  }

◆ oldProcessHistoryID()

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

Definition at line 51 of file DaqProvenanceHelper.h.

References oldProcessHistoryID_.

51 { return oldProcessHistoryID_; }
ProcessHistoryID const * oldProcessHistoryID_

◆ saveInfo()

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

Definition at line 36 of file DaqProvenanceHelper.h.

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

36  {
37  oldProcessName_ = oldBD.processName();
38  oldBranchID_ = oldBD.branchID();
39  newBranchID_ = newBD.branchID();
40  }

◆ setOldParentageIDToNew()

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

Definition at line 206 of file DaqProvenanceHelper.cc.

References parentageIDMap_.

206  {
207  parentageIDMap_.insert(std::make_pair(iOld, iNew));
208  }

Member Data Documentation

◆ constBranchDescription_

BranchDescription const edm::DaqProvenanceHelper::constBranchDescription_
private

Definition at line 57 of file DaqProvenanceHelper.h.

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

◆ dummyProvenance_

ProductProvenance edm::DaqProvenanceHelper::dummyProvenance_
private

Definition at line 58 of file DaqProvenanceHelper.h.

Referenced by dummyProvenance().

◆ newBranchID_

BranchID edm::DaqProvenanceHelper::newBranchID_
private

Definition at line 63 of file DaqProvenanceHelper.h.

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

◆ oldBranchID_

BranchID edm::DaqProvenanceHelper::oldBranchID_
private

Definition at line 62 of file DaqProvenanceHelper.h.

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

◆ oldProcessHistoryID_

ProcessHistoryID const* edm::DaqProvenanceHelper::oldProcessHistoryID_
private

Definition at line 64 of file DaqProvenanceHelper.h.

Referenced by mapProcessHistoryID(), and oldProcessHistoryID().

◆ oldProcessName_

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

Definition at line 61 of file DaqProvenanceHelper.h.

Referenced by matchProcesses(), and saveInfo().

◆ parentageIDMap_

ParentageIDMap edm::DaqProvenanceHelper::parentageIDMap_
private

Definition at line 66 of file DaqProvenanceHelper.h.

Referenced by mapParentageID(), and setOldParentageIDToNew().

◆ phidMap_

ProcessHistoryIDMap edm::DaqProvenanceHelper::phidMap_
private

Definition at line 65 of file DaqProvenanceHelper.h.

Referenced by mapProcessHistoryID().

◆ processParameterSet_

ParameterSet edm::DaqProvenanceHelper::processParameterSet_
private

Definition at line 59 of file DaqProvenanceHelper.h.

Referenced by daqInit(), and DaqProvenanceHelper().