FWCore
Common
src
ProcessBlockHelperBase.cc
Go to the documentation of this file.
1
#include "
FWCore/Common/interface/ProcessBlockHelperBase.h
"
2
3
#include "
DataFormats/Provenance/interface/BranchDescription.h
"
4
#include "
DataFormats/Provenance/interface/ProductRegistry.h
"
5
#include "
FWCore/Utilities/interface/BranchType.h
"
6
#include "
FWCore/Utilities/interface/ProductLabels.h
"
7
#include "
FWCore/Utilities/interface/TypeID.h
"
8
9
#include <algorithm>
10
#include <iterator>
11
12
namespace
edm
{
13
14
ProcessBlockHelperBase::~ProcessBlockHelperBase
() =
default
;
15
16
void
ProcessBlockHelperBase::updateForNewProcess
(
ProductRegistry
const
& productRegistry,
17
std::string
const
&
processName
) {
18
// Add the current process at the end if there are any
19
// process blocks produced in the current process.
20
for
(
auto
const
& product : productRegistry.
productList
()) {
21
auto
const
&
desc
= product.second;
22
if
(
desc
.branchType() ==
InProcess
&&
desc
.produced() && !
desc
.transient()) {
23
processesWithProcessBlockProducts_
.emplace_back(
processName
);
24
addedProcesses_
.emplace_back(
processName
);
25
return
;
26
}
27
}
28
}
29
30
std::string
ProcessBlockHelperBase::selectProcess
(
ProductRegistry
const
& productRegistry,
31
ProductLabels
const
&
productLabels
,
32
TypeID
const
& typeID)
const
{
33
std::string
processName
(
productLabels
.process);
34
std::string
selectedProcess;
35
36
unsigned
int
bestPosition = 0;
37
for
(
auto
const
&
prod
: productRegistry.
productList
()) {
38
BranchDescription
const
&
desc
=
prod
.second;
39
if
(
desc
.branchType() ==
InProcess
&& !
desc
.produced() &&
desc
.present() &&
40
desc
.moduleLabel() ==
productLabels
.module &&
desc
.productInstanceName() ==
productLabels
.productInstance &&
41
desc
.unwrappedTypeID() == typeID && (
processName
.empty() ||
processName
==
desc
.processName())) {
42
// This code is to select the latest matching process
43
auto
found
=
44
std::find_if(
processesWithProcessBlockProducts_
.begin(),
45
processesWithProcessBlockProducts_
.end(),
46
[&
desc
](
auto
const
& processFromHelper) {
return
processFromHelper ==
desc
.processName(); });
47
if
(
found
!=
processesWithProcessBlockProducts_
.end()) {
48
const
unsigned
int
position
=
std::distance
(
processesWithProcessBlockProducts_
.begin(),
found
);
49
if
(
position
>= bestPosition) {
50
bestPosition =
position
;
51
selectedProcess =
desc
.processName();
52
}
53
}
54
}
55
}
56
return
selectedProcess;
57
}
58
59
}
// namespace edm
BranchType.h
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::ProcessBlockHelperBase::addedProcesses_
std::vector< std::string > addedProcesses_
Definition:
ProcessBlockHelperBase.h:70
TypeID.h
ProductRegistry.h
newFWLiteAna.found
found
Definition:
newFWLiteAna.py:118
edm::ProductRegistry
Definition:
ProductRegistry.h:37
edm::ProcessBlockHelperBase::~ProcessBlockHelperBase
virtual ~ProcessBlockHelperBase()
edm::InProcess
Definition:
BranchType.h:11
HLT_FULL_cff.productLabels
productLabels
Definition:
HLT_FULL_cff.py:14609
dumpMFGeometry_cfg.prod
prod
Definition:
dumpMFGeometry_cfg.py:24
edm::ProcessBlockHelperBase::updateForNewProcess
void updateForNewProcess(ProductRegistry const &, std::string const &processName)
Definition:
ProcessBlockHelperBase.cc:16
BranchDescription.h
position
static int position[264][3]
Definition:
ReadPGInfo.cc:289
edm::ProcessBlockHelperBase::selectProcess
std::string selectProcess(ProductRegistry const &, ProductLabels const &, TypeID const &) const
Definition:
ProcessBlockHelperBase.cc:30
edm::ProcessBlockHelperBase::processesWithProcessBlockProducts_
std::vector< std::string > processesWithProcessBlockProducts_
Definition:
ProcessBlockHelperBase.h:64
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition:
SimL1EmulatorRepack_CalouGT_cff.py:17
submitPVResolutionJobs.desc
string desc
Definition:
submitPVResolutionJobs.py:251
edm::TypeID
Definition:
TypeID.h:22
edm::ProductRegistry::productList
ProductList const & productList() const
Definition:
ProductRegistry.h:76
edm::BranchDescription
Definition:
BranchDescription.h:32
HLT_FULL_cff.distance
distance
Definition:
HLT_FULL_cff.py:7746
ProcessBlockHelperBase.h
ProductLabels.h
edm::ProductLabels
Definition:
ProductLabels.h:4
Generated for CMSSW Reference Manual by
1.8.16