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 92 of file DaqProvenanceHelper.cc.

93  : 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 41 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.

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

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

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

156  {
157  std::replace(branchID.begin(), branchID.end(), oldBranchID_, newBranchID_);
158  }
def replace(string, replacements)

◆ fixMetaData() [3/4]

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

Definition at line 160 of file DaqProvenanceHelper.cc.

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

160  {
163  // The const_cast is ugly, but it beats the alternatives.
164  BranchIDLists& lists = const_cast<BranchIDLists&>(branchIDLists);
165  for (auto& list : lists) {
166  std::replace(list.begin(), list.end(), oldID, newID);
167  }
168  }
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 170 of file DaqProvenanceHelper.cc.

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

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

◆ mapBranchID()

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

◆ mapParentageID()

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

Definition at line 199 of file DaqProvenanceHelper.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and parentageIDMap_.

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

199  {
200  ParentageIDMap::const_iterator it = parentageIDMap_.find(parentageID);
201  if (it == parentageIDMap_.end()) {
202  return parentageID;
203  }
204  return it->second;
205  }

◆ mapProcessHistoryID()

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

Definition at line 191 of file DaqProvenanceHelper.cc.

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

191  {
192  ProcessHistoryIDMap::const_iterator it = phidMap_.find(phid);
193  assert(it != phidMap_.end());
194  oldProcessHistoryID_ = &it->first;
195  return it->second;
196  }
assert(be >=bs)
ProcessHistoryIDMap phidMap_
ProcessHistoryID const * oldProcessHistoryID_

◆ matchProcesses()

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

Definition at line 110 of file DaqProvenanceHelper.cc.

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

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

◆ 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 212 of file DaqProvenanceHelper.cc.

References parentageIDMap_.

212  {
213  parentageIDMap_.insert(std::make_pair(iOld, iNew));
214  }

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().