1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
//
//
#include "DataFormats/Math/interface/deltaR.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "AnalysisDataFormats/TopObjects/interface/TtDilepEvtSolution.h"
TtDilepEvtSolution::TtDilepEvtSolution() {
jetCorrScheme_ = 0;
wpDecay_ = "NotDefined";
wmDecay_ = "NotDefined";
bestSol_ = false;
topmass_ = 0.;
weightmax_ = 0.;
}
TtDilepEvtSolution::~TtDilepEvtSolution() {}
//-------------------------------------------
// get calibrated base objects
//-------------------------------------------
pat::Jet TtDilepEvtSolution::getJetB() const {
// WARNING this is obsolete and only
// kept for backwards compatibility
if (jetCorrScheme_ == 1) {
//jet calibrated according to MC truth
return jetB_->correctedJet("HAD", "B");
} else if (jetCorrScheme_ == 2) {
return jetB_->correctedJet("HAD", "B");
} else {
return *jetB_;
}
}
pat::Jet TtDilepEvtSolution::getJetBbar() const {
// WARNING this is obsolete and only
// kept for backwards compatibility
if (jetCorrScheme_ == 1) {
//jet calibrated according to MC truth
return jetBbar_->correctedJet("HAD", "B");
} else if (jetCorrScheme_ == 2) {
return jetBbar_->correctedJet("HAD", "B");
} else {
return *jetBbar_;
}
}
//-------------------------------------------
// returns the 4-vector of the positive
// lepton, with the charge and the pdgId
//-------------------------------------------
reco::Particle TtDilepEvtSolution::getLeptPos() const {
reco::Particle p;
if (wpDecay_ == "muon") {
p = reco::Particle(+1, getMuonp().p4());
p.setPdgId(-11);
}
if (wpDecay_ == "electron") {
p = reco::Particle(+1, getElectronp().p4());
p.setPdgId(-13);
}
if (wmDecay_ == "tau") {
p = reco::Particle(+1, getTaup().p4());
p.setPdgId(-15);
}
return p;
}
//-------------------------------------------
// miscellaneous
//-------------------------------------------
double TtDilepEvtSolution::getJetResidual() const {
double distance = 0.;
if (!getGenB() || !getGenBbar())
return distance;
distance += reco::deltaR(getCalJetB(), *getGenB());
distance += reco::deltaR(getCalJetBbar(), *getGenBbar());
return distance;
}
double TtDilepEvtSolution::getLeptonResidual() const {
double distance = 0.;
if (!getGenLepp() || !getGenLepm())
return distance;
if (getWpDecay() == "electron")
distance += reco::deltaR(getElectronp(), *getGenLepp());
else if (getWpDecay() == "muon")
distance += reco::deltaR(getMuonp(), *getGenLepp());
else if (getWpDecay() == "tau")
distance += reco::deltaR(getTaup(), *getGenLepp());
if (getWmDecay() == "electron")
distance += reco::deltaR(getElectronm(), *getGenLepm());
else if (getWmDecay() == "muon")
distance += reco::deltaR(getMuonm(), *getGenLepm());
else if (getWmDecay() == "tau")
distance += reco::deltaR(getTaum(), *getGenLepm());
return distance;
}
//-------------------------------------------
// returns the 4-vector of the negative
// lepton, with the charge and the pdgId
//-------------------------------------------
reco::Particle TtDilepEvtSolution::getLeptNeg() const {
reco::Particle p;
if (wmDecay_ == "electron") {
p = reco::Particle(-1, getElectronm().p4());
p.setPdgId(11);
}
if (wmDecay_ == "muon") {
p = reco::Particle(-1, getMuonm().p4());
p.setPdgId(13);
}
if (wmDecay_ == "tau") {
p = reco::Particle(-1, getTaum().p4());
p.setPdgId(15);
}
return p;
}
//-------------------------------------------
// get info on the outcome of the signal
//selection LR
//-------------------------------------------
double TtDilepEvtSolution::getLRSignalEvtObsVal(unsigned int selObs) const {
double val = -999.;
for (size_t i = 0; i < lrSignalEvtVarVal_.size(); i++) {
if (lrSignalEvtVarVal_[i].first == selObs)
val = lrSignalEvtVarVal_[i].second;
}
return val;
}
//-------------------------------------------
// set the generated event
//-------------------------------------------
void TtDilepEvtSolution::setGenEvt(const edm::Handle<TtGenEvent>& aGenEvt) {
if (!aGenEvt->isFullLeptonic()) {
edm::LogInfo("TtGenEventNotFilled") << "genEvt is not di-leptonic; TtGenEvent is not filled";
return;
}
theGenEvt_ = edm::RefProd<TtGenEvent>(aGenEvt);
}
//-------------------------------------------
// set the outcome of the signal selection LR
//-------------------------------------------
void TtDilepEvtSolution::setLRSignalEvtObservables(const std::vector<std::pair<unsigned int, double> >& varval) {
lrSignalEvtVarVal_.clear();
for (size_t ise = 0; ise < varval.size(); ise++)
lrSignalEvtVarVal_.push_back(varval[ise]);
}
|