FWCore
Framework
interface
WillGetIfMatch.h
Go to the documentation of this file.
1
#ifndef FWCore_Framework_WillGetIfMatch_h
2
#define FWCore_Framework_WillGetIfMatch_h
3
13
#include <functional>
14
#include "
DataFormats/Provenance/interface/BranchDescription.h
"
15
#include "
FWCore/Framework/interface/EDConsumerBase.h
"
16
#include "
FWCore/Utilities/interface/InputTag.h
"
17
#include "
FWCore/Utilities/interface/EDGetToken.h
"
18
19
namespace
edm
{
20
21
template
<
typename
T>
22
class
WillGetIfMatch {
23
public
:
24
template
<
typename
U>
25
WillGetIfMatch
(
U
const
&
match
,
EDConsumerBase
* module) :
match_
(
match
),
module_
(module) {}
26
27
EDGetTokenT<T>
operator()
(
BranchDescription
const
& branchDescription) {
28
if
(
match_
(branchDescription)) {
29
auto
transition = branchDescription.
branchType
();
30
edm::InputTag
tag
{
31
branchDescription.
moduleLabel
(), branchDescription.
productInstanceName
(), branchDescription.
processName
()};
32
if
(transition ==
edm::InEvent
) {
33
return
module_
->template consumes<T>(
tag
);
34
}
else
if
(transition ==
edm::InLumi
) {
35
return
module_
->template consumes<T, edm::InLumi>(
tag
);
36
}
else
if
(transition ==
edm::InRun
) {
37
return
module_
->template consumes<T, edm::InRun>(
tag
);
38
}
else
if
(transition ==
edm::InProcess
) {
39
return
module_
->template consumes<T, edm::InProcess>(
tag
);
40
}
41
}
42
return
EDGetTokenT<T>
{};
43
}
44
45
private
:
46
std::function
<
bool
(
BranchDescription
const
&)>
match_
;
47
EDConsumerBase
*
module_
;
48
};
49
}
// namespace edm
50
#endif
edm::BranchDescription::productInstanceName
std::string const & productInstanceName() const
Definition:
BranchDescription.h:81
electrons_cff.bool
bool
Definition:
electrons_cff.py:366
edm::EDGetTokenT
Definition:
EDGetToken.h:33
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::InRun
Definition:
BranchType.h:11
edm::InProcess
Definition:
BranchType.h:11
edm::EDConsumerBase
Definition:
EDConsumerBase.h:71
edm::BranchDescription::processName
std::string const & processName() const
Definition:
BranchDescription.h:73
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition:
GlobalPosition_Frontier_DevDB_cff.py:11
edm::InEvent
Definition:
BranchType.h:11
edm::WillGetIfMatch::operator()
EDGetTokenT< T > operator()(BranchDescription const &branchDescription)
Definition:
WillGetIfMatch.h:27
EDGetToken.h
mitigatedMETSequence_cff.U
U
Definition:
mitigatedMETSequence_cff.py:36
BranchDescription.h
edm::WillGetIfMatch::WillGetIfMatch
WillGetIfMatch(U const &match, EDConsumerBase *module)
Definition:
WillGetIfMatch.h:25
EDConsumerBase.h
edm::InLumi
Definition:
BranchType.h:11
edm::WillGetIfMatch::match_
std::function< bool(BranchDescription const &)> match_
Definition:
WillGetIfMatch.h:46
edm::BranchDescription::branchType
BranchType const & branchType() const
Definition:
BranchDescription.h:122
InputTag.h
edm::WillGetIfMatch::module_
EDConsumerBase * module_
Definition:
WillGetIfMatch.h:47
edm::match
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName)
Definition:
BranchDescription.cc:351
edm::BranchDescription::moduleLabel
std::string const & moduleLabel() const
Definition:
BranchDescription.h:72
HiBiasedCentrality_cfi.function
function
Definition:
HiBiasedCentrality_cfi.py:4
edm::BranchDescription
Definition:
BranchDescription.h:32
edm::InputTag
Definition:
InputTag.h:15
Generated for CMSSW Reference Manual by
1.8.16