RecoLuminosity
LumiProducer
plugins
BunchSpacingProducer.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/stream/EDProducer.h
"
2
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
3
#include "
FWCore/Framework/interface/Event.h
"
4
#include "
FWCore/Framework/interface/LuminosityBlock.h
"
5
#include "
FWCore/Framework/interface/Run.h
"
6
#include "
FWCore/Framework/interface/EventSetup.h
"
7
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
8
#include "
FWCore/ParameterSet/interface/ParameterSetDescription.h
"
9
#include <iostream>
10
11
namespace
edm
{
12
class
EventSetup
;
13
}
14
15
//
16
// class declaration
17
//
18
class
BunchSpacingProducer
:
public
edm::stream::EDProducer
<> {
19
public
:
20
explicit
BunchSpacingProducer
(
const
edm::ParameterSet
&);
21
22
~BunchSpacingProducer
()
override
;
23
24
void
produce
(
edm::Event
&,
const
edm::EventSetup
&)
final
;
25
26
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
&);
27
28
private
:
29
edm::EDGetTokenT<int>
bunchSpacing_
;
30
unsigned
int
bunchSpacingOverride_
;
31
bool
overRide_
;
32
};
33
34
//
35
// constructors and destructor
36
//
37
38
BunchSpacingProducer::BunchSpacingProducer::BunchSpacingProducer(
const
edm::ParameterSet
& iConfig) {
39
// register your products
40
produces<unsigned int>();
41
bunchSpacing_ = consumes<int>(
edm::InputTag
(
"addPileupInfo"
,
"bunchSpacing"
));
42
overRide_ =
false
;
43
if
(iConfig.
exists
(
"overrideBunchSpacing"
)) {
44
overRide_ = iConfig.
getParameter
<
bool
>(
"overrideBunchSpacing"
);
45
if
(overRide_) {
46
bunchSpacingOverride_ = iConfig.
getParameter
<
unsigned
int
>(
"bunchSpacingOverride"
);
47
}
48
}
49
}
50
51
BunchSpacingProducer::~BunchSpacingProducer
() {}
52
53
//
54
// member functions
55
//
56
void
BunchSpacingProducer::produce
(
edm::Event
&
e
,
const
edm::EventSetup
& iSetup) {
57
if
(
overRide_
) {
58
e
.put(std::make_unique<unsigned int>(
bunchSpacingOverride_
));
59
return
;
60
}
61
62
unsigned
int
bunchSpacing
= 50;
63
unsigned
int
run
=
e
.run();
64
65
if
(
e
.isRealData()) {
66
if
((
run
> 252126 &&
run
!= 254833) ||
run
== 178003 ||
run
== 178004 ||
run
== 209089 ||
run
== 209106 ||
67
run
== 209109 ||
run
== 209146 ||
run
== 209148 ||
run
== 209151) {
68
bunchSpacing
= 25;
69
}
70
}
else
{
71
edm::Handle<int>
bunchSpacingH;
72
e
.getByToken(
bunchSpacing_
, bunchSpacingH);
73
bunchSpacing
= *bunchSpacingH;
74
}
75
76
e
.put(std::make_unique<unsigned int>(
bunchSpacing
));
77
return
;
78
}
79
80
void
BunchSpacingProducer::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
81
edm::ParameterSetDescription
desc
;
82
desc
.add<
bool
>(
"overrideBunchSpacing"
,
false
);
// true for prompt reco
83
desc
.add<
unsigned
int
>(
"bunchSpacingOverride"
, 25);
// override value
84
85
descriptions.
add
(
"bunchSpacingProducer"
,
desc
);
86
}
87
88
#include "
FWCore/Framework/interface/MakerMacros.h
"
89
DEFINE_FWK_MODULE
(
BunchSpacingProducer
);
ConfigurationDescriptions.h
edm::EDGetTokenT< int >
LuminosityBlock.h
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
EDProducer.h
BunchSpacingProducer::~BunchSpacingProducer
~BunchSpacingProducer() override
Definition:
BunchSpacingProducer.cc:51
edm::Handle< int >
BunchSpacingProducer::bunchSpacing_
edm::EDGetTokenT< int > bunchSpacing_
Definition:
BunchSpacingProducer.cc:29
BunchSpacingProducer::overRide_
bool overRide_
Definition:
BunchSpacingProducer.cc:31
BunchSpacingProducer
Definition:
BunchSpacingProducer.cc:18
BunchSpacingProducer::BunchSpacingProducer
BunchSpacingProducer(const edm::ParameterSet &)
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:57
HLTEgPhaseIITestSequence_cff.bunchSpacing
bunchSpacing
Definition:
HLTEgPhaseIITestSequence_cff.py:1574
Run.h
ParameterSetDescription.h
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
edm::ParameterSet::exists
bool exists(std::string const ¶meterName) const
checks if a parameter exists
Definition:
ParameterSet.cc:681
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
BunchSpacingProducer::produce
void produce(edm::Event &, const edm::EventSetup &) final
Definition:
BunchSpacingProducer.cc:56
edm::stream::EDProducer
Definition:
EDProducer.h:36
edm::EventSetup
Definition:
EventSetup.h:58
submitPVResolutionJobs.desc
string desc
Definition:
submitPVResolutionJobs.py:251
writedatasetfile.run
run
Definition:
writedatasetfile.py:27
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
BunchSpacingProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition:
BunchSpacingProducer.cc:80
EventSetup
ParameterSet.h
edm::Event
Definition:
Event.h:73
BunchSpacingProducer::bunchSpacingOverride_
unsigned int bunchSpacingOverride_
Definition:
BunchSpacingProducer.cc:30
edm::InputTag
Definition:
InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
Generated for CMSSW Reference Manual by
1.8.16