CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Public Attributes
edm::DaqProvenanceHelper Struct Reference

#include <DaqProvenanceHelper.h>

Public Types

typedef std::map< ParentageID,
ParentageID
ParentageIDMap
 
typedef std::map
< ProcessHistoryID,
ProcessHistoryID
ProcessHistoryIDMap
 

Public Member Functions

ProcessHistoryID daqInit (ProductRegistry &productRegistry) const
 
 DaqProvenanceHelper (TypeID const &rawDataType)
 
void fixMetaData (std::vector< ProcessConfiguration > &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
 
void saveInfo (BranchDescription const &oldBD, BranchDescription const &newBD)
 

Public Attributes

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

Detailed Description

Definition at line 18 of file DaqProvenanceHelper.h.

Member Typedef Documentation

Definition at line 20 of file DaqProvenanceHelper.h.

Definition at line 19 of file DaqProvenanceHelper.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file DaqProvenanceHelper.cc.

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

19  : constBranchDescription_(BranchDescription(InEvent
20  , "rawDataCollector"
21  //, "source"
22  , "LHC"
23  // , "HLT"
24  , "FEDRawDataCollection"
25  , "FEDRawDataCollection"
26  , ""
27  , "DaqSource"
28  , ParameterSetID()
29  , TypeWithDict(rawDataType.typeInfo())
30  , false))
33  , oldProcessName_()
34  , oldBranchID_()
35  , newBranchID_()
36  , oldProcessHistoryID_(nullptr)
37  , phidMap_() {
38 
39  // Now we create a process parameter set for the "LHC" process.
40  // We don't currently use the untracked parameters, However, we make them available, just in case.
41  std::string const& moduleLabel = constBranchDescription_.moduleLabel();
42  std::string const& processName = constBranchDescription_.processName();
43  std::string const& moduleName = constBranchDescription_.moduleName();
44  typedef std::vector<std::string> vstring;
45  vstring empty;
46 
47  vstring modlbl;
48  modlbl.reserve(1);
49  modlbl.push_back(moduleLabel);
50  processParameterSet_.addParameter("@all_sources", modlbl);
51 
52  ParameterSet triggerPaths;
53  triggerPaths.addParameter<vstring>("@trigger_paths", empty);
54  processParameterSet_.addParameter<ParameterSet>("@trigger_paths", triggerPaths);
55 
56  ParameterSet pseudoInput;
57  pseudoInput.addParameter<std::string>("@module_edm_type", "Source");
58  pseudoInput.addParameter<std::string>("@module_label", moduleLabel);
59  pseudoInput.addParameter<std::string>("@module_type", moduleName);
60  processParameterSet_.addParameter<ParameterSet>(moduleLabel, pseudoInput);
61 
62  processParameterSet_.addParameter<vstring>("@all_esmodules", empty);
63  processParameterSet_.addParameter<vstring>("@all_esprefers", empty);
64  processParameterSet_.addParameter<vstring>("@all_essources", empty);
65  processParameterSet_.addParameter<vstring>("@all_loopers", empty);
66  processParameterSet_.addParameter<vstring>("@all_modules", empty);
67  processParameterSet_.addParameter<vstring>("@end_paths", empty);
68  processParameterSet_.addParameter<vstring>("@paths", empty);
69  processParameterSet_.addParameter<std::string>("@process_name", processName);
70  // Now we register the process parameter set.
72 
73  //std::cerr << processParameterSet_.dump() << std::endl;
74  }
std::string const & processName() const
ProductProvenance dummyProvenance_
std::vector< std::string > vstring
Definition: Schedule.cc:277
std::string const & moduleName() const
ConstBranchDescription constBranchDescription_
ProcessHistoryIDMap phidMap_
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:145
BranchID const & branchID() const
Hash< ParameterSetType > ParameterSetID
ParameterSet const & registerIt()
std::string const & moduleLabel() const
ProcessHistoryID const * oldProcessHistoryID_

Member Function Documentation

ProcessHistoryID edm::DaqProvenanceHelper::daqInit ( ProductRegistry productRegistry) const

Definition at line 77 of file DaqProvenanceHelper.cc.

References constBranchDescription_, edm::ProductRegistry::copyProduct(), edm::ProcessHistory::data(), edm::ProcessHistory::emplace_back(), edm::getPassID(), edm::getReleaseVersion(), edm::ParameterSet::id(), edm::ProcessHistory::id(), edm::detail::ThreadSafeRegistry< KEY, T, E >::insertMapped(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), edm::ConstBranchDescription::me(), edm::ConstBranchDescription::processName(), and processParameterSet_.

Referenced by edm::DaqSource::DaqSource().

77  {
78  // Now we need to set all the metadata
79  // Add the product to the product registry
80  productRegistry.copyProduct(constBranchDescription_.me());
81 
82  // Insert an entry for this process in the process history registry
83  ProcessHistory ph;
85  ProcessConfiguration const& pc = ph.data().back();
87 
88  // Insert an entry for this process in the process configuration registry
90 
91  // Save the process history ID for use every event.
92  return ph.id();
93  }
std::string const & processName() const
std::string getPassID()
Definition: GetPassID.h:8
BranchDescription const & me() const
ParameterSetID id() const
static ThreadSafeRegistry * instance()
bool insertMapped(value_type const &v)
ConstBranchDescription constBranchDescription_
std::string getReleaseVersion()
void edm::DaqProvenanceHelper::fixMetaData ( std::vector< ProcessConfiguration > &  pcv,
std::vector< ProcessHistory > &  phv 
)

Definition at line 106 of file DaqProvenanceHelper.cc.

References constBranchDescription_, edm::ParameterSet::id(), matchProcesses(), oldProcessName_, phidMap_, edm::ConstBranchDescription::processName(), and processParameterSet_.

106  {
107  std::vector<ProcessConfiguration> newPCs;
108  for(auto const& pc : pcv) {
109  if(pc.processName() == oldProcessName_) {
110  newPCs.emplace_back(constBranchDescription_.processName(),
112  pc.releaseVersion(), pc.passID());
113  }
114  }
115  assert(!newPCs.empty());
116  pcv.reserve(pcv.size() + newPCs.size());
117  pcv.insert(pcv.end(), newPCs.begin(), newPCs.end());
118  // update existing process histories
119  for(auto& ph : phv) {
120  for(auto const& newPC : newPCs) {
121  if(matchProcesses(newPC, ph)) {
122  ProcessHistoryID oldPHID = ph.id();
123  ph.push_front(newPC);
124  ProcessHistoryID newPHID = ph.id();
125  phidMap_.insert(std::make_pair(oldPHID, newPHID));
126  break;
127  }
128  }
129  }
130  // For new process histories, containing only the new process configurations
131  phv.reserve(phv.size() + newPCs.size());
132  for(auto const& newPC : newPCs) {
133  phv.emplace_back();
134  phv.back().push_front(newPC);
135  }
136  }
std::string const & processName() const
ParameterSetID id() const
ConstBranchDescription constBranchDescription_
ProcessHistoryIDMap phidMap_
Hash< ProcessHistoryType > ProcessHistoryID
bool matchProcesses(ProcessConfiguration const &pc, ProcessHistory const &ph) const
void edm::DaqProvenanceHelper::fixMetaData ( std::vector< BranchID > &  branchIDs) const

Definition at line 139 of file DaqProvenanceHelper.cc.

References newBranchID_, oldBranchID_, and linker::replace().

139  {
140  std::replace(branchID.begin(), branchID.end(), oldBranchID_, newBranchID_);
141  }
def replace
Definition: linker.py:10
void edm::DaqProvenanceHelper::fixMetaData ( BranchIDLists const &  branchIDLists) const

Definition at line 144 of file DaqProvenanceHelper.cc.

References edm::BranchID::id(), list(), newBranchID_, oldBranchID_, and linker::replace().

144  {
147  // The const_cast is ugly, but it beats the alternatives.
148  BranchIDLists& lists = const_cast<BranchIDLists&>(branchIDLists);
149  for(auto& list : lists) {
150  std::replace(list.begin(), list.end(), oldID, newID);
151  }
152  }
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
def replace
Definition: linker.py:10
unsigned int id() const
Definition: BranchID.h:23
unsigned int value_type
Definition: BranchID.h:16
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
void edm::DaqProvenanceHelper::fixMetaData ( BranchChildren branchChildren) const

Definition at line 155 of file DaqProvenanceHelper.cc.

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

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

Definition at line 186 of file DaqProvenanceHelper.cc.

References parentageIDMap_.

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

186  {
187  ParentageIDMap::const_iterator it = parentageIDMap_.find(parentageID);
188  if(it == parentageIDMap_.end()) {
189  return parentageID;
190  }
191  return it->second;
192  }
ProcessHistoryID const & edm::DaqProvenanceHelper::mapProcessHistoryID ( ProcessHistoryID const &  phid)

Definition at line 177 of file DaqProvenanceHelper.cc.

References oldProcessHistoryID_, and phidMap_.

177  {
178  ProcessHistoryIDMap::const_iterator it = phidMap_.find(phid);
179  assert(it != phidMap_.end());
180  oldProcessHistoryID_ = &it->first;
181  return it->second;
182  }
ProcessHistoryIDMap phidMap_
ProcessHistoryID const * oldProcessHistoryID_
bool edm::DaqProvenanceHelper::matchProcesses ( ProcessConfiguration const &  pc,
ProcessHistory const &  ph 
) const

Definition at line 96 of file DaqProvenanceHelper.cc.

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

Referenced by fixMetaData().

96  {
97  for(auto const& pc : ph) {
98  if(pc.processName() == oldProcessName_) {
99  return(pc.releaseVersion() == newPC.releaseVersion() && pc.passID() == newPC.passID());
100  }
101  }
102  return false;
103  }
void edm::DaqProvenanceHelper::saveInfo ( BranchDescription const &  oldBD,
BranchDescription const &  newBD 
)
inline

Definition at line 23 of file DaqProvenanceHelper.h.

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

23  {
24  oldProcessName_ = oldBD.processName();
25  oldBranchID_ = oldBD.branchID();
26  newBranchID_ = newBD.branchID();
27  }

Member Data Documentation

ConstBranchDescription edm::DaqProvenanceHelper::constBranchDescription_
ProductProvenance edm::DaqProvenanceHelper::dummyProvenance_

Definition at line 38 of file DaqProvenanceHelper.h.

Referenced by edm::DaqSource::readEvent_().

BranchID edm::DaqProvenanceHelper::newBranchID_

Definition at line 43 of file DaqProvenanceHelper.h.

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

BranchID edm::DaqProvenanceHelper::oldBranchID_

Definition at line 42 of file DaqProvenanceHelper.h.

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

ProcessHistoryID const* edm::DaqProvenanceHelper::oldProcessHistoryID_

Definition at line 44 of file DaqProvenanceHelper.h.

Referenced by mapProcessHistoryID().

std::string edm::DaqProvenanceHelper::oldProcessName_

Definition at line 41 of file DaqProvenanceHelper.h.

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

ParentageIDMap edm::DaqProvenanceHelper::parentageIDMap_

Definition at line 46 of file DaqProvenanceHelper.h.

Referenced by mapParentageID().

ProcessHistoryIDMap edm::DaqProvenanceHelper::phidMap_

Definition at line 45 of file DaqProvenanceHelper.h.

Referenced by fixMetaData(), and mapProcessHistoryID().

ParameterSet edm::DaqProvenanceHelper::processParameterSet_

Definition at line 39 of file DaqProvenanceHelper.h.

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