ElectroWeakAnalysis
ZMuMu
plugins
ZMuMuOverlapExclusion.cc
Go to the documentation of this file.
1
#include "
CommonTools/UtilAlgos/interface/OverlapExclusionSelector.h
"
2
#include "
CommonTools/UtilAlgos/interface/SingleObjectSelector.h
"
3
#include "
DataFormats/RecoCandidate/interface/RecoCandidate.h
"
4
#include <iostream>
5
6
struct
ZMuMuOverlap
{
7
ZMuMuOverlap
(
const
edm::ParameterSet
&) {}
8
bool
operator()
(
const
reco::Candidate
&
zMuMu
,
const
reco::Candidate
&
z
)
const
{
9
using namespace
std
;
10
using namespace
reco
;
11
// check if a candidate z is different from zMuMu
12
// (for example a Z can be done with two global muons, or with a global muon plus a standalone muon.
13
// if the standalone muon is part of the second global muon in fact this is the same Z)
14
15
unsigned
int
nd1 =
zMuMu
.numberOfDaughters();
16
unsigned
int
nd2 =
z
.numberOfDaughters();
17
18
assert
(nd1 == 2 && nd2 == 2);
19
const
int
maxd = 2;
20
const
Candidate
* daughters1[maxd];
21
const
Candidate
* daughters2[maxd];
22
TrackRef
trackerTrack1[maxd];
23
TrackRef
stAloneTrack1[maxd];
24
TrackRef
globalTrack1[maxd];
25
TrackRef
trackerTrack2[maxd];
26
TrackRef
stAloneTrack2[maxd];
27
TrackRef
globalTrack2[maxd];
28
bool
flag
;
29
unsigned
int
matched
= 0;
30
31
for
(
unsigned
int
i
= 0;
i
< nd1; ++
i
) {
32
daughters1[
i
] =
zMuMu
.daughter(
i
);
33
trackerTrack1[
i
] = daughters1[
i
]->
get
<
TrackRef
>();
34
stAloneTrack1[
i
] = daughters1[
i
]->
get
<
TrackRef
,
reco::StandAloneMuonTag
>();
35
globalTrack1[
i
] = daughters1[
i
]->
get
<
TrackRef
,
reco::CombinedMuonTag
>();
36
37
/*********************************************** just used for debug ********************
38
if (trackerTrack1[i].isNull())
39
cout << "in ZMuMu daughter " << i << " tracker ref non found " << endl;
40
else
41
cout << "in ZMuMu daughter " << i << " tracker ref FOUND"
42
<< " id: " << trackerTrack1[i].id() << ", index: " << trackerTrack1[i].key()
43
<< endl;
44
if (stAloneTrack1[i].isNull())
45
cout << "in ZMuMu daughter " << i << " stalone ref non found " << endl;
46
else
47
cout << "in ZMuMu daughter " << i << " stalone ref FOUND"
48
<< " id: " << stAloneTrack1[i].id() << ", index: " << stAloneTrack1[i].key()
49
<< endl;
50
51
if (globalTrack1[i].isNull())
52
cout << "in ZMuMu daughter " << i << " global ref non found " << endl;
53
else
54
cout << "in ZMuMu daughter " << i << " global ref FOUND"
55
<< " id: " << globalTrack1[i].id() << ", index: " << globalTrack1[i].key()
56
<< endl;
57
*/
58
}
59
for
(
unsigned
int
i
= 0;
i
< nd2; ++
i
) {
60
daughters2[
i
] =
z
.daughter(
i
);
61
trackerTrack2[
i
] = daughters2[
i
]->
get
<
TrackRef
>();
62
stAloneTrack2[
i
] = daughters2[
i
]->
get
<
TrackRef
,
reco::StandAloneMuonTag
>();
63
globalTrack2[
i
] = daughters2[
i
]->
get
<
TrackRef
,
reco::CombinedMuonTag
>();
64
65
/******************************************** just used for debug ************
66
if (trackerTrack2[i].isNull())
67
cout << "in ZMuSta daughter " << i << " tracker ref non found " << endl;
68
else
69
cout << "in ZMuSta daughter " << i << " tracker ref FOUND"
70
<< " id: " << trackerTrack2[i].id() << ", index: " << trackerTrack2[i].key()
71
<< endl;
72
if (stAloneTrack2[i].isNull())
73
cout << "in ZMuSta daughter " << i << " standalone ref non found " << endl;
74
else
75
cout << "in ZMuSta daughter " << i << " standalone ref FOUND"
76
<< " id: " << stAloneTrack2[i].id() << ", index: " << stAloneTrack2[i].key()
77
<< endl;
78
79
if (globalTrack2[i].isNull())
80
cout << "in ZMuSta daughter " << i << " global ref non found " << endl;
81
else
82
cout << "in ZMuSta daughter " << i << " global ref FOUND"
83
<< " id: " << globalTrack2[i].id() << ", index: " << globalTrack2[i].key()
84
<< endl;
85
86
*/
87
}
88
for
(
unsigned
int
i
= 0;
i
< nd1;
i
++) {
89
flag
=
false
;
90
for
(
unsigned
int
j
= 0;
j
< nd2;
91
j
++) {
// if the obj2 is a standalone the trackref is alwais in the trackerTRack position
92
if
(((trackerTrack2[
i
].
id
() == trackerTrack1[
j
].
id
()) && (trackerTrack2[
i
].
key
() == trackerTrack1[
j
].
key
())) ||
93
((trackerTrack2[
i
].
id
() == stAloneTrack1[
j
].
id
()) && (trackerTrack2[
i
].
key
() == stAloneTrack1[
j
].
key
()))) {
94
flag
=
true
;
95
}
96
}
97
if
(
flag
)
98
matched
++;
99
}
100
if
(
matched
== nd1)
// return true if all the childrens of the ZMuMu have a children matched in ZMuXX
101
return
true
;
102
else
103
return
false
;
104
}
105
};
106
107
typedef
SingleObjectSelector<edm::View<reco::Candidate>
,
108
OverlapExclusionSelector<reco::CandidateView, reco::Candidate, ZMuMuOverlap>
>
109
ZMuMuOverlapExclusionSelector
;
110
111
#include "
FWCore/Framework/interface/MakerMacros.h
"
112
113
DEFINE_FWK_MODULE
(
ZMuMuOverlapExclusionSelector
);
muonTagProbeFilters_cff.matched
matched
Definition:
muonTagProbeFilters_cff.py:62
reco::CombinedMuonTag
conbined muon component tag
Definition:
RecoCandidate.h:79
mps_fire.i
i
Definition:
mps_fire.py:355
OverlapExclusionSelector
Definition:
OverlapExclusionSelector.h:14
ZMuMuAnalysisNtupler_cff.zMuMu
zMuMu
zMuMu vector of PSet is common to all categories except zMuTrk category
Definition:
ZMuMuAnalysisNtupler_cff.py:340
SingleObjectSelector.h
cms::cuda::assert
assert(be >=bs)
ZMuMuOverlapExclusionSelector
SingleObjectSelector< edm::View< reco::Candidate >, OverlapExclusionSelector< reco::CandidateView, reco::Candidate, ZMuMuOverlap > > ZMuMuOverlapExclusionSelector
Definition:
ZMuMuOverlapExclusion.cc:109
reco::Candidate::get
T get() const
get a component
Definition:
Candidate.h:221
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:45
RecoCandidate.h
edm::Ref< TrackCollection >
MakerMacros.h
reco::StandAloneMuonTag
stand alone muon component tag
Definition:
RecoCandidate.h:77
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
DDAxes::z
reco::TrackRef
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition:
TrackFwd.h:20
edm::ParameterSet
Definition:
ParameterSet.h:36
ZMuMuOverlap
Definition:
ZMuMuOverlapExclusion.cc:6
ZMuMuOverlap::ZMuMuOverlap
ZMuMuOverlap(const edm::ParameterSet &)
Definition:
ZMuMuOverlapExclusion.cc:7
SingleObjectSelectorBase
Definition:
SingleObjectSelector.h:26
reco::Candidate
Definition:
Candidate.h:27
edm::Ref::id
ProductID id() const
Accessor for product ID.
Definition:
Ref.h:244
std
Definition:
JetResolutionObject.h:76
edm::Ref::key
key_type key() const
Accessor for product key.
Definition:
Ref.h:250
OverlapExclusionSelector.h
dqmiolumiharvest.j
j
Definition:
dqmiolumiharvest.py:66
crabWrapper.key
key
Definition:
crabWrapper.py:19
ZMuMuOverlap::operator()
bool operator()(const reco::Candidate &zMuMu, const reco::Candidate &z) const
Definition:
ZMuMuOverlapExclusion.cc:8
RemoveAddSevLevel.flag
flag
Definition:
RemoveAddSevLevel.py:116
Generated for CMSSW Reference Manual by
1.8.16