CMS 3D CMS Logo

Public Types | Public Member Functions | Public Attributes

edm::DaqProvenanceHelper Struct Reference

#include <DaqProvenanceHelper.h>

List of all members.

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 (BranchChildren &branchChildren) const
void fixMetaData (std::vector< ProcessHistory > &phv)
void fixMetaData (BranchIDLists const &) const
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)
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 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_(0)
        , processConfiguration_()
        , 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;
  }

Member Function Documentation

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

Definition at line 78 of file DaqProvenanceHelper.cc.

References constBranchDescription_, edm::ProductRegistry::copyProduct(), edm::getPassID(), edm::getReleaseVersion(), edm::ProcessHistory::id(), edm::ParameterSet::id(), instance, edm::ConstBranchDescription::me(), edm::ConstBranchDescription::processName(), processParameterSet_, and edm::ProcessHistory::push_back().

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 configuration registry
    ProcessConfiguration pc(constBranchDescription_.processName(), processParameterSet_.id(), getReleaseVersion(), getPassID());
    ProcessConfigurationRegistry::instance()->insertMapped(pc);

    // Insert an entry for this process in the process history registry
    ProcessHistory ph;
    ph.push_back(pc);
    ProcessHistoryRegistry::instance()->insertMapped(ph);

    // Save the process history ID for use every event.
    return ph.id();
  }
void edm::DaqProvenanceHelper::fixMetaData ( std::vector< ProcessHistory > &  phv)

Definition at line 113 of file DaqProvenanceHelper.cc.

References phidMap_, and processConfiguration_.

                                                                 {
    phv.reserve(phv.size() + 1);
    phv.push_back(ProcessHistory()); // For new processHistory, containing only processConfiguration_.
    for(std::vector<ProcessHistory>::iterator it = phv.begin(), itEnd = phv.end(); it != itEnd; ++it) {
      ProcessHistoryID oldPHID = it->id();
      it->push_front(processConfiguration_);
      ProcessHistoryID newPHID = it->id();
      phidMap_.insert(std::make_pair(oldPHID, newPHID));
    }
  }
void edm::DaqProvenanceHelper::fixMetaData ( std::vector< BranchID > &  branchIDs) const

Definition at line 125 of file DaqProvenanceHelper.cc.

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

                                                                      {
    std::replace(branchID.begin(), branchID.end(), oldBranchID_, newBranchID_);
  }
void edm::DaqProvenanceHelper::fixMetaData ( std::vector< ProcessConfiguration > &  pcv)

Definition at line 97 of file DaqProvenanceHelper.cc.

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

                                                                       {
    bool found = false;
    for(std::vector<ProcessConfiguration>::const_iterator it = pcv.begin(), itEnd = pcv.end(); it != itEnd; ++it) {
       if(it->processName() == oldProcessName_) {
         processConfiguration_ = ProcessConfiguration(constBranchDescription_.processName(),
                                                      processParameterSet_.id(),
                                                      it->releaseVersion(), it->passID());
         pcv.push_back(processConfiguration_);
         found = true;
         break;
       }
    }
    assert(found);
  }
void edm::DaqProvenanceHelper::fixMetaData ( BranchChildren branchChildren) const

Definition at line 141 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(BCMap::iterator it = childLookup.begin(), itEnd = childLookup.end(); it != itEnd; ++it) {
      if(it->second.erase(oldBranchID_) != 0) {
        it->second.insert(newBranchID_);
      }
    }
  }
void edm::DaqProvenanceHelper::fixMetaData ( BranchIDLists const &  branchIDLists) const

Definition at line 130 of file DaqProvenanceHelper.cc.

References edm::BranchID::id(), 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(BranchIDLists::iterator it = lists.begin(), itEnd = lists.end(); it != itEnd; ++it) {
      std::replace(it->begin(), it->end(), oldID, newID);
    }
  }
BranchID const & edm::DaqProvenanceHelper::mapBranchID ( BranchID const &  branchID) const

Definition at line 182 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 172 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 163 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;
  }
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();
    }

Member Data Documentation

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

Definition at line 41 of file DaqProvenanceHelper.h.

Referenced by fixMetaData(), and saveInfo().

Definition at line 47 of file DaqProvenanceHelper.h.

Referenced by mapParentageID().

Definition at line 46 of file DaqProvenanceHelper.h.

Referenced by fixMetaData(), and mapProcessHistoryID().

Definition at line 45 of file DaqProvenanceHelper.h.

Referenced by fixMetaData().

Definition at line 39 of file DaqProvenanceHelper.h.

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