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)
 
void fixMetaData (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)
 
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_
 
ProcessConfiguration processConfiguration_
 
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 17 of file DaqProvenanceHelper.cc.

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

18  : constBranchDescription_(BranchDescription(InEvent
19  , "rawDataCollector"
20  //, "source"
21  , "LHC"
22  // , "HLT"
23  , "FEDRawDataCollection"
24  , "FEDRawDataCollection"
25  , ""
26  , "DaqSource"
27  , ParameterSetID()
28  , rawDataType
29  , false))
32  , oldProcessName_()
33  , oldBranchID_()
34  , newBranchID_()
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:147
std::string const & moduleName() const
ConstBranchDescription constBranchDescription_
ProcessHistoryIDMap phidMap_
ProcessConfiguration processConfiguration_
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::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(), processParameterSet_, and edm::ProcessHistory::push_back().

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 configuration registry
85 
86  // Insert an entry for this process in the process history registry
87  ProcessHistory ph;
88  ph.push_back(pc);
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()
ConstBranchDescription constBranchDescription_
std::string getReleaseVersion()
bool insertMapped(value_type const &v)
void edm::DaqProvenanceHelper::fixMetaData ( std::vector< ProcessConfiguration > &  pcv)

Definition at line 96 of file DaqProvenanceHelper.cc.

References constBranchDescription_, newFWLiteAna::found, edm::ParameterSet::id(), oldProcessName_, processConfiguration_, edm::ConstBranchDescription::processName(), and processParameterSet_.

96  {
97  bool found = false;
98  for(std::vector<ProcessConfiguration>::const_iterator it = pcv.begin(), itEnd = pcv.end(); it != itEnd; ++it) {
99  if(it->processName() == oldProcessName_) {
102  it->releaseVersion(), it->passID());
103  pcv.push_back(processConfiguration_);
104  found = true;
105  break;
106  }
107  }
108  assert(found);
109  }
std::string const & processName() const
ParameterSetID id() const
ConstBranchDescription constBranchDescription_
ProcessConfiguration processConfiguration_
void edm::DaqProvenanceHelper::fixMetaData ( std::vector< ProcessHistory > &  phv)

Definition at line 112 of file DaqProvenanceHelper.cc.

References phidMap_, and processConfiguration_.

112  {
113  phv.reserve(phv.size() + 1);
114  phv.push_back(ProcessHistory()); // For new processHistory, containing only processConfiguration_.
115  for(std::vector<ProcessHistory>::iterator it = phv.begin(), itEnd = phv.end(); it != itEnd; ++it) {
116  ProcessHistoryID oldPHID = it->id();
117  it->push_front(processConfiguration_);
118  ProcessHistoryID newPHID = it->id();
119  phidMap_.insert(std::make_pair(oldPHID, newPHID));
120  }
121  }
ProcessHistoryIDMap phidMap_
ProcessConfiguration processConfiguration_
Hash< ProcessHistoryType > ProcessHistoryID
void edm::DaqProvenanceHelper::fixMetaData ( std::vector< BranchID > &  branchIDs) const
void edm::DaqProvenanceHelper::fixMetaData ( BranchIDLists const &  branchIDLists) const

Definition at line 129 of file DaqProvenanceHelper.cc.

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

129  {
132  // The const_cast is ugly, but it beats the alternatives.
133  BranchIDLists& lists = const_cast<BranchIDLists&>(branchIDLists);
134  for(BranchIDLists::iterator it = lists.begin(), itEnd = lists.end(); it != itEnd; ++it) {
135  std::replace(it->begin(), it->end(), oldID, newID);
136  }
137  }
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
unsigned int id() const
Definition: BranchID.h:23
unsigned int value_type
Definition: BranchID.h:16
void edm::DaqProvenanceHelper::fixMetaData ( BranchChildren branchChildren) const

Definition at line 140 of file DaqProvenanceHelper.cc.

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

140  {
141  typedef std::map<BranchID, std::set<BranchID> > BCMap;
142  // The const_cast is ugly, but it beats the alternatives.
143  BCMap& childLookup = const_cast<BCMap&>(branchChildren.childLookup());
144  // First fix any old branchID's in the key.
145  {
146  BCMap::iterator i = childLookup.find(oldBranchID_);
147  if(i != childLookup.end()) {
148  childLookup.insert(std::make_pair(newBranchID_, i->second));
149  childLookup.erase(i);
150  }
151  }
152  // Now fix any old branchID's in the sets;
153  for(BCMap::iterator it = childLookup.begin(), itEnd = childLookup.end(); it != itEnd; ++it) {
154  if(it->second.erase(oldBranchID_) != 0) {
155  it->second.insert(newBranchID_);
156  }
157  }
158  }
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 171 of file DaqProvenanceHelper.cc.

References parentageIDMap_.

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

171  {
172  ParentageIDMap::const_iterator it = parentageIDMap_.find(parentageID);
173  if(it == parentageIDMap_.end()) {
174  return parentageID;
175  }
176  return it->second;
177  }
ProcessHistoryID const & edm::DaqProvenanceHelper::mapProcessHistoryID ( ProcessHistoryID const &  phid)

Definition at line 162 of file DaqProvenanceHelper.cc.

References oldProcessHistoryID_, and phidMap_.

162  {
163  ProcessHistoryIDMap::const_iterator it = phidMap_.find(phid);
164  assert(it != phidMap_.end());
165  oldProcessHistoryID_ = &it->first;
166  return it->second;
167  }
ProcessHistoryIDMap phidMap_
ProcessHistoryID const * oldProcessHistoryID_
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::getNextItemType().

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(), and saveInfo().

ParentageIDMap edm::DaqProvenanceHelper::parentageIDMap_

Definition at line 47 of file DaqProvenanceHelper.h.

Referenced by mapParentageID().

ProcessHistoryIDMap edm::DaqProvenanceHelper::phidMap_

Definition at line 46 of file DaqProvenanceHelper.h.

Referenced by fixMetaData(), and mapProcessHistoryID().

ProcessConfiguration edm::DaqProvenanceHelper::processConfiguration_

Definition at line 45 of file DaqProvenanceHelper.h.

Referenced by fixMetaData().

ParameterSet edm::DaqProvenanceHelper::processParameterSet_

Definition at line 39 of file DaqProvenanceHelper.h.

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