Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-19 01:43:47

0001 #include "FWCore/Framework/src/insertSelectedProcesses.h"
0002 
0003 #include "DataFormats/Common/interface/WrapperBase.h"
0004 #include "DataFormats/Provenance/interface/BranchDescription.h"
0005 #include "FWCore/Utilities/interface/BranchType.h"
0006 #include "FWCore/Utilities/interface/getAnyPtr.h"
0007 #include "FWCore/Reflection/interface/TypeWithDict.h"
0008 
0009 #include "TClass.h"
0010 
0011 #include <memory>
0012 
0013 namespace edm {
0014 
0015   void insertSelectedProcesses(BranchDescription const& desc,
0016                                std::set<std::string>& processes,
0017                                std::set<std::string>& processesWithKeptProcessBlockProducts) {
0018     // Select input processes in which mergeable run products were produced
0019     if (desc.branchType() == InRun && !desc.produced()) {
0020       // Determine if the product is "mergeable"
0021       TClass* tClass = desc.wrappedType().getClass();
0022       void* p = tClass->New();
0023       TClass* wrapperBaseTClass = TypeWithDict::byName("edm::WrapperBase").getClass();
0024       int offset = tClass->GetBaseClassOffset(wrapperBaseTClass);
0025       std::unique_ptr<WrapperBase> edp = getAnyPtr<WrapperBase>(p, offset);
0026       if (edp->isMergeable()) {
0027         // record the process names in a set (which is ordered and unique)
0028         processes.insert(desc.processName());
0029       }
0030     }
0031     if (desc.branchType() == InProcess) {
0032       processesWithKeptProcessBlockProducts.insert(desc.processName());
0033     }
0034   }
0035 }  // namespace edm