#include <DaqProvenanceHelper.h>
Definition at line 18 of file DaqProvenanceHelper.h.
typedef std::map<ParentageID, ParentageID> edm::DaqProvenanceHelper::ParentageIDMap |
Definition at line 20 of file DaqProvenanceHelper.h.
typedef std::map<ProcessHistoryID, ProcessHistoryID> edm::DaqProvenanceHelper::ProcessHistoryIDMap |
Definition at line 19 of file DaqProvenanceHelper.h.
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.
: constBranchDescription_(BranchDescription(InEvent , "rawDataCollector" //, "source" , "LHC" // , "HLT" , "FEDRawDataCollection" , "FEDRawDataCollection" , "" , "DaqSource" , ParameterSetID() , TypeWithDict(rawDataType.typeInfo()) , false)) , dummyProvenance_(constBranchDescription_.branchID()) , processParameterSet_() , oldProcessName_() , oldBranchID_() , newBranchID_() , oldProcessHistoryID_(nullptr) , phidMap_() { // Now we create a process parameter set for the "LHC" process. // We don't currently use the untracked parameters, However, we make them available, just in case. std::string const& moduleLabel = constBranchDescription_.moduleLabel(); std::string const& processName = constBranchDescription_.processName(); std::string const& moduleName = constBranchDescription_.moduleName(); typedef std::vector<std::string> vstring; vstring empty; vstring modlbl; modlbl.reserve(1); modlbl.push_back(moduleLabel); processParameterSet_.addParameter("@all_sources", modlbl); ParameterSet triggerPaths; triggerPaths.addParameter<vstring>("@trigger_paths", empty); processParameterSet_.addParameter<ParameterSet>("@trigger_paths", triggerPaths); ParameterSet pseudoInput; pseudoInput.addParameter<std::string>("@module_edm_type", "Source"); pseudoInput.addParameter<std::string>("@module_label", moduleLabel); pseudoInput.addParameter<std::string>("@module_type", moduleName); processParameterSet_.addParameter<ParameterSet>(moduleLabel, pseudoInput); processParameterSet_.addParameter<vstring>("@all_esmodules", empty); processParameterSet_.addParameter<vstring>("@all_esprefers", empty); processParameterSet_.addParameter<vstring>("@all_essources", empty); processParameterSet_.addParameter<vstring>("@all_loopers", empty); processParameterSet_.addParameter<vstring>("@all_modules", empty); processParameterSet_.addParameter<vstring>("@end_paths", empty); processParameterSet_.addParameter<vstring>("@paths", empty); processParameterSet_.addParameter<std::string>("@process_name", processName); // Now we register the process parameter set. processParameterSet_.registerIt(); //std::cerr << processParameterSet_.dump() << std::endl; }
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::ProcessHistory::id(), edm::ParameterSet::id(), instance, edm::ConstBranchDescription::me(), edm::ConstBranchDescription::processName(), and processParameterSet_.
Referenced by edm::DaqSource::DaqSource().
{ // Now we need to set all the metadata // Add the product to the product registry productRegistry.copyProduct(constBranchDescription_.me()); // Insert an entry for this process in the process history registry ProcessHistory ph; ph.emplace_back(constBranchDescription_.processName(), processParameterSet_.id(), getReleaseVersion(), getPassID()); ProcessConfiguration const& pc = ph.data().back(); ProcessHistoryRegistry::instance()->insertMapped(ph); // Insert an entry for this process in the process configuration registry ProcessConfigurationRegistry::instance()->insertMapped(pc); // Save the process history ID for use every event. return ph.id(); }
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_.
{ std::vector<ProcessConfiguration> newPCs; for(auto const& pc : pcv) { if(pc.processName() == oldProcessName_) { newPCs.emplace_back(constBranchDescription_.processName(), processParameterSet_.id(), pc.releaseVersion(), pc.passID()); } } assert(!newPCs.empty()); pcv.reserve(pcv.size() + newPCs.size()); pcv.insert(pcv.end(), newPCs.begin(), newPCs.end()); // update existing process histories for(auto& ph : phv) { for(auto const& newPC : newPCs) { if(matchProcesses(newPC, ph)) { ProcessHistoryID oldPHID = ph.id(); ph.push_front(newPC); ProcessHistoryID newPHID = ph.id(); phidMap_.insert(std::make_pair(oldPHID, newPHID)); break; } } } // For new process histories, containing only the new process configurations phv.reserve(phv.size() + newPCs.size()); for(auto const& newPC : newPCs) { phv.emplace_back(); phv.back().push_front(newPC); } }
void edm::DaqProvenanceHelper::fixMetaData | ( | std::vector< BranchID > & | branchIDs | ) | const |
Definition at line 139 of file DaqProvenanceHelper.cc.
References newBranchID_, oldBranchID_, and linker::replace().
{ std::replace(branchID.begin(), branchID.end(), oldBranchID_, newBranchID_); }
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().
{ BranchID::value_type oldID = oldBranchID_.id(); BranchID::value_type newID = newBranchID_.id(); // The const_cast is ugly, but it beats the alternatives. BranchIDLists& lists = const_cast<BranchIDLists&>(branchIDLists); for(auto& list : lists) { std::replace(list.begin(), list.end(), oldID, newID); } }
void edm::DaqProvenanceHelper::fixMetaData | ( | BranchChildren & | branchChildren | ) | const |
Definition at line 155 of file DaqProvenanceHelper.cc.
References edm::BranchChildren::childLookup(), i, newBranchID_, and oldBranchID_.
{ typedef std::map<BranchID, std::set<BranchID> > BCMap; // The const_cast is ugly, but it beats the alternatives. BCMap& childLookup = const_cast<BCMap&>(branchChildren.childLookup()); // First fix any old branchID's in the key. { BCMap::iterator i = childLookup.find(oldBranchID_); if(i != childLookup.end()) { childLookup.insert(std::make_pair(newBranchID_, i->second)); childLookup.erase(i); } } // Now fix any old branchID's in the sets; for(auto& child : childLookup) { if(child.second.erase(oldBranchID_) != 0) { child.second.insert(newBranchID_); } } }
Definition at line 196 of file DaqProvenanceHelper.cc.
References newBranchID_, and oldBranchID_.
Referenced by edm::FullProvenanceReader::readProvenance().
{ return(branchID == oldBranchID_ ? newBranchID_ : branchID); }
ParentageID const & edm::DaqProvenanceHelper::mapParentageID | ( | ParentageID const & | phid | ) | const |
Definition at line 186 of file DaqProvenanceHelper.cc.
References parentageIDMap_.
Referenced by edm::FullProvenanceReader::readProvenance().
{ ParentageIDMap::const_iterator it = parentageIDMap_.find(parentageID); if(it == parentageIDMap_.end()) { return parentageID; } return it->second; }
ProcessHistoryID const & edm::DaqProvenanceHelper::mapProcessHistoryID | ( | ProcessHistoryID const & | phid | ) |
Definition at line 177 of file DaqProvenanceHelper.cc.
References oldProcessHistoryID_, and phidMap_.
{ ProcessHistoryIDMap::const_iterator it = phidMap_.find(phid); assert(it != phidMap_.end()); oldProcessHistoryID_ = &it->first; return it->second; }
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().
{ for(auto const& pc : ph) { if(pc.processName() == oldProcessName_) { return(pc.releaseVersion() == newPC.releaseVersion() && pc.passID() == newPC.passID()); } } return false; }
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().
{ oldProcessName_ = oldBD.processName(); oldBranchID_ = oldBD.branchID(); newBranchID_ = newBD.branchID(); }
Definition at line 37 of file DaqProvenanceHelper.h.
Referenced by daqInit(), DaqProvenanceHelper(), and fixMetaData().
Definition at line 38 of file DaqProvenanceHelper.h.
Definition at line 43 of file DaqProvenanceHelper.h.
Referenced by fixMetaData(), mapBranchID(), and saveInfo().
Definition at line 42 of file DaqProvenanceHelper.h.
Referenced by fixMetaData(), mapBranchID(), and saveInfo().
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().
Definition at line 46 of file DaqProvenanceHelper.h.
Referenced by mapParentageID().
Definition at line 45 of file DaqProvenanceHelper.h.
Referenced by fixMetaData(), and mapProcessHistoryID().
Definition at line 39 of file DaqProvenanceHelper.h.
Referenced by daqInit(), DaqProvenanceHelper(), and fixMetaData().