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 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 (BranchChildren &branchChildren) const
 
void fixMetaData (BranchIDLists const &) const
 
void fixMetaData (ProcessConfigurationVector &pcv, std::vector< ProcessHistory > &phv)
 
void fixMetaData (std::vector< BranchID > &branchIDs) 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

const BranchDescription 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

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.

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  }

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.

Member Function Documentation

◆ branchDescription()

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

Definition at line 46 of file DaqProvenanceHelper.h.

46 { return constBranchDescription_; }

References constBranchDescription_.

Referenced by FedRawDataInputSource::read().

◆ daqInit()

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

Definition at line 83 of file DaqProvenanceHelper.cc.

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
90  ProcessHistory ph;
92  processHistoryRegistry.registerProcessHistory(ph);
93 
94  // Save the process history ID for use every event.
95  return ph.setProcessHistoryID();
96  }

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

Referenced by FedRawDataInputSource::FedRawDataInputSource().

◆ dummyProvenance()

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

Definition at line 48 of file DaqProvenanceHelper.h.

48 { return dummyProvenance_; }

References dummyProvenance_.

Referenced by FedRawDataInputSource::read().

◆ fixMetaData() [1/4]

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

Definition at line 153 of file DaqProvenanceHelper.cc.

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  }

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

◆ fixMetaData() [2/4]

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

Definition at line 143 of file DaqProvenanceHelper.cc.

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  }

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

◆ fixMetaData() [3/4]

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

◆ fixMetaData() [4/4]

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

Definition at line 139 of file DaqProvenanceHelper.cc.

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

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

◆ 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.

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

References parentageIDMap_.

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

◆ mapProcessHistoryID()

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

Definition at line 174 of file DaqProvenanceHelper.cc.

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

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

◆ matchProcesses()

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

Definition at line 98 of file DaqProvenanceHelper.cc.

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  }

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

◆ oldProcessHistoryID()

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

Definition at line 47 of file DaqProvenanceHelper.h.

47 { return oldProcessHistoryID_; }

References oldProcessHistoryID_.

◆ saveInfo()

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

Definition at line 32 of file DaqProvenanceHelper.h.

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

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

◆ setOldParentageIDToNew()

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

Definition at line 195 of file DaqProvenanceHelper.cc.

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

References parentageIDMap_.

Member Data Documentation

◆ constBranchDescription_

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

edm::ParameterSet::registerIt
ParameterSet const & registerIt()
Definition: ParameterSet.cc:113
edm::DaqProvenanceHelper::oldBranchID_
BranchID oldBranchID_
Definition: DaqProvenanceHelper.h:58
edm::DaqProvenanceHelper::oldProcessName_
std::string oldProcessName_
Definition: DaqProvenanceHelper.h:57
mps_fire.i
i
Definition: mps_fire.py:428
edm::DaqProvenanceHelper::processParameterSet_
ParameterSet processParameterSet_
Definition: DaqProvenanceHelper.h:55
ProducerES_cfi.ProcessHistory
ProcessHistory
Definition: ProducerES_cfi.py:14
edm::DaqProvenanceHelper::oldProcessHistoryID_
ProcessHistoryID const * oldProcessHistoryID_
Definition: DaqProvenanceHelper.h:60
edm::moduleName
std::string moduleName(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:27
cms::cuda::assert
assert(be >=bs)
edm::DaqProvenanceHelper::newBranchID_
BranchID newBranchID_
Definition: DaqProvenanceHelper.h:59
edm::ParameterSet::id
ParameterSetID id() const
Definition: ParameterSet.cc:189
edm::getPassID
std::string getPassID()
Definition: GetPassID.h:7
edm::BranchID::id
unsigned int id() const
Definition: BranchID.h:21
edm::DaqProvenanceHelper::dummyProvenance_
ProductProvenance dummyProvenance_
Definition: DaqProvenanceHelper.h:54
edm::vstring
std::vector< std::string > vstring
Definition: Schedule.cc:653
edm::BranchDescription::processName
std::string const & processName() const
Definition: BranchDescription.h:73
edm::BranchIDLists
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
edm::BranchID::value_type
unsigned int value_type
Definition: BranchID.h:16
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ParameterSet
Definition: Functions.h:16
edm::ParameterSet::addParameter
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:135
triggerPaths
static const std::string triggerPaths
Definition: EdmProvDump.cc:46
edm::DaqProvenanceHelper::parentageIDMap_
ParentageIDMap parentageIDMap_
Definition: DaqProvenanceHelper.h:62
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
edm::BranchDescription::moduleName
std::string const & moduleName() const
Definition: BranchDescription.h:116
edm::BranchDescription::moduleLabel
std::string const & moduleLabel() const
Definition: BranchDescription.h:72
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
edm::DaqProvenanceHelper::phidMap_
ProcessHistoryIDMap phidMap_
Definition: DaqProvenanceHelper.h:61
edm::getReleaseVersion
std::string getReleaseVersion()
Definition: GetReleaseVersion.cc:7
vstring
vector< string > vstring
Definition: ExoticaDQM.cc:8
HerwigMaxPtPartonFilter_cfi.moduleLabel
moduleLabel
Definition: HerwigMaxPtPartonFilter_cfi.py:4
child
Definition: simpleInheritance.h:11
edm::BranchDescription::branchID
BranchID const & branchID() const
Definition: BranchDescription.h:74
edm::DaqProvenanceHelper::constBranchDescription_
const BranchDescription constBranchDescription_
Definition: DaqProvenanceHelper.h:53
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444