Main Page
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
o
p
q
r
s
t
u
v
w
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
_
a
d
e
f
l
m
o
p
s
t
u
v
Related Functions
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Package Documentation
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
TauAnalysis
MCEmbeddingTools
plugins
MuMuForEmbeddingSelector.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: TauAnalysis/EmbeddingProducer
4
// Class: MuMuForEmbeddingSelector
5
//
13
//
14
// Original Author: Artur Akhmetshin
15
// Created: Mon, 13 Jun 2016 11:05:32 GMT
16
//
17
//
18
19
// system include files
20
#include <memory>
21
22
// user include files
23
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
24
#include "
FWCore/Framework/interface/stream/EDProducer.h
"
25
26
#include "
FWCore/Framework/interface/Event.h
"
27
#include "
FWCore/Framework/interface/MakerMacros.h
"
28
29
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
30
#include "
FWCore/Utilities/interface/StreamID.h
"
31
32
#include "
DataFormats/Candidate/interface/CompositeCandidate.h
"
33
#include "
DataFormats/PatCandidates/interface/Muon.h
"
34
35
//
36
// class declaration
37
//
38
39
class
MuMuForEmbeddingSelector
:
public
edm::stream::EDProducer
<> {
40
public
:
41
explicit
MuMuForEmbeddingSelector
(
const
edm::ParameterSet
&);
42
~MuMuForEmbeddingSelector
()
override
;
43
44
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions);
45
46
private
:
47
void
beginStream
(
edm::StreamID
)
override
;
48
void
produce
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
49
void
endStream
()
override
;
50
51
//virtual void beginRun(edm::Run const&, edm::EventSetup const&) override;
52
//virtual void endRun(edm::Run const&, edm::EventSetup const&) override;
53
//virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
54
//virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
55
56
// ----------member data ---------------------------
57
edm::EDGetTokenT<edm::View<reco::CompositeCandidate>
>
ZmumuCandidates_
;
58
double
ZMass
= 91.0;
59
};
60
61
//
62
// constants, enums and typedefs
63
//
64
65
//
66
// static data member definitions
67
//
68
69
//
70
// constructors and destructor
71
//
72
MuMuForEmbeddingSelector::MuMuForEmbeddingSelector
(
const
edm::ParameterSet
& iConfig)
73
: ZmumuCandidates_(consumes<
edm
::
View
<
reco
::CompositeCandidate>>(
74
iConfig.getParameter<
edm
::
InputTag
>(
"ZmumuCandidatesCollection"
))) {
75
//register your products
76
/* Examples
77
produces<ExampleData2>();
78
79
//if do put with a label
80
produces<ExampleData2>("label");
81
82
//if you want to put into the Run
83
produces<ExampleData2,InRun>();
84
*/
85
produces<edm::RefVector<pat::MuonCollection>>();
86
87
//now do what ever other initialization is needed
88
}
89
90
MuMuForEmbeddingSelector::~MuMuForEmbeddingSelector
() {
91
// do anything here that needs to be done at destruction time
92
// (e.g. close files, deallocate resources etc.)
93
}
94
95
//
96
// member functions
97
//
98
99
// ------------ method called to produce the data ------------
100
void
MuMuForEmbeddingSelector::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
101
using namespace
edm
;
102
edm::Handle<edm::View<reco::CompositeCandidate>
> ZmumuCandidatesHandle;
103
iEvent
.getByToken(
ZmumuCandidates_
, ZmumuCandidatesHandle);
104
edm::View<reco::CompositeCandidate>
ZmumuCandidates
= *ZmumuCandidatesHandle;
105
106
const
reco::CompositeCandidate
* chosenZCand =
nullptr
;
107
double
massDifference = -1.0;
108
for
(
edm::View<reco::CompositeCandidate>::const_iterator
iZCand =
ZmumuCandidates
.begin();
109
iZCand !=
ZmumuCandidates
.end();
110
++iZCand) {
111
if
(
std::abs
(
ZMass
- iZCand->mass()) < massDifference || massDifference < 0) {
112
massDifference =
std::abs
(
ZMass
- iZCand->mass());
113
chosenZCand = &(*iZCand);
114
}
115
}
116
std::unique_ptr<edm::RefVector<pat::MuonCollection>>
prod
(
new
edm::RefVector<pat::MuonCollection>
());
117
prod
->reserve(2);
118
prod
->push_back(chosenZCand->
daughter
(0)->
masterClone
().
castTo
<
pat::MuonRef
>());
119
prod
->push_back(chosenZCand->
daughter
(1)->
masterClone
().
castTo
<
pat::MuonRef
>());
120
iEvent
.put(
std::move
(
prod
));
121
}
122
123
// ------------ method called once each stream before processing any runs, lumis or events ------------
124
void
MuMuForEmbeddingSelector::beginStream
(
edm::StreamID
) {}
125
126
// ------------ method called once each stream after processing all runs, lumis and events ------------
127
void
MuMuForEmbeddingSelector::endStream
() {}
128
129
// ------------ method called when starting to processes a run ------------
130
/*
131
void
132
MuMuForEmbeddingSelector::beginRun(edm::Run const&, edm::EventSetup const&)
133
{
134
}
135
*/
136
137
// ------------ method called when ending the processing of a run ------------
138
/*
139
void
140
MuMuForEmbeddingSelector::endRun(edm::Run const&, edm::EventSetup const&)
141
{
142
}
143
*/
144
145
// ------------ method called when starting to processes a luminosity block ------------
146
/*
147
void
148
MuMuForEmbeddingSelector::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&)
149
{
150
}
151
*/
152
153
// ------------ method called when ending the processing of a luminosity block ------------
154
/*
155
void
156
MuMuForEmbeddingSelector::endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&)
157
{
158
}
159
*/
160
161
// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
162
void
MuMuForEmbeddingSelector::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
163
//The following says we do not know what parameters are allowed so do no validation
164
// Please change this to state exactly what you do use, even if it is no parameters
165
edm::ParameterSetDescription
desc
;
166
desc
.setUnknown();
167
descriptions.
addDefault
(
desc
);
168
}
169
170
//define this as a plug-in
171
DEFINE_FWK_MODULE
(
MuMuForEmbeddingSelector
);
edm::StreamID
Definition:
StreamID.h:30
SelectingProcedure_cff.ZmumuCandidates
ZmumuCandidates
Definition:
SelectingProcedure_cff.py:57
CompositeCandidate.h
sistrip::View
View
Definition:
ConstantsForView.h:26
edm::EDGetTokenT
Definition:
EDGetToken.h:33
edm
HLT enums.
Definition:
AlignableModifier.h:19
Muon.h
HLT_FULL_cff.InputTag
InputTag
Definition:
HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
EDProducer.h
edm::RefVector
Definition:
EDProductfwd.h:27
MuMuForEmbeddingSelector::beginStream
void beginStream(edm::StreamID) override
Definition:
MuMuForEmbeddingSelector.cc:124
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:46
edm::Handle
Definition:
AssociativeIterator.h:50
MuMuForEmbeddingSelector::ZmumuCandidates_
edm::EDGetTokenT< edm::View< reco::CompositeCandidate > > ZmumuCandidates_
Definition:
MuMuForEmbeddingSelector.cc:57
edm::Ref< MuonCollection >
MuMuForEmbeddingSelector::ZMass
double ZMass
Definition:
MuMuForEmbeddingSelector.cc:58
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
MuMuForEmbeddingSelector::MuMuForEmbeddingSelector
MuMuForEmbeddingSelector(const edm::ParameterSet &)
Definition:
MuMuForEmbeddingSelector.cc:72
MuMuForEmbeddingSelector::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
MuMuForEmbeddingSelector.cc:162
dumpMFGeometry_cfg.prod
prod
Definition:
dumpMFGeometry_cfg.py:24
MuMuForEmbeddingSelector::~MuMuForEmbeddingSelector
~MuMuForEmbeddingSelector() override
Definition:
MuMuForEmbeddingSelector.cc:90
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
edm::View
Definition:
CaloClusterFwd.h:14
MuMuForEmbeddingSelector
Definition:
MuMuForEmbeddingSelector.cc:39
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::stream::EDProducer
Definition:
EDProducer.h:36
edm::EventSetup
Definition:
EventSetup.h:58
edm::RefToBase::castTo
REF castTo() const
Definition:
RefToBase.h:257
submitPVResolutionJobs.desc
string desc
Definition:
submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition:
eostools.py:511
Frameworkfwd.h
MuMuForEmbeddingSelector::endStream
void endStream() override
Definition:
MuMuForEmbeddingSelector.cc:127
reco::Candidate::masterClone
virtual const CandidateBaseRef & masterClone() const =0
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition:
View.h:86
MuMuForEmbeddingSelector::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
MuMuForEmbeddingSelector.cc:100
funct::abs
Abs< T >::type abs(const T &t)
Definition:
Abs.h:22
ParameterSet.h
edm::Event
Definition:
Event.h:73
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:99
reco::CompositeCandidate::daughter
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode)
Definition:
CompositeCandidate.cc:30
StreamID.h
reco::CompositeCandidate
Definition:
CompositeCandidate.h:21
Generated for CMSSW Reference Manual by
1.8.16