1 |
|
#include "VHbbAnalysis/HbbAnalyzer/interface/HbbCandidateFinder.h" |
2 |
|
|
3 |
< |
struct CompareJetPt { |
4 |
< |
bool operator()( const VHbbEvent::SimpleJet& j1, const VHbbEvent::SimpleJet& j2 ) const { |
5 |
< |
return j1.fourMomentum.Pt() > j2.fourMomentum.Pt(); |
6 |
< |
} |
7 |
< |
}; |
8 |
< |
|
9 |
< |
struct CompareBTag { |
10 |
< |
bool operator()(const VHbbEvent::SimpleJet& j1, const VHbbEvent::SimpleJet& j2 ) const { |
11 |
< |
return j1.csv > j2.csv; |
12 |
< |
} |
13 |
< |
}; |
14 |
< |
|
15 |
< |
HbbCandidateFinder::HbbCandidateFinder(const edm::ParameterSet& iConfig): vhbbevent_(iConfig.getParameter<edm::InputTag>("VHbbEventLabel")), verbose_ (iConfig.getParameter<bool>("verbose")), jetPtThreshold(iConfig.getParameter<double>("jetPtThreshold")){ |
3 |
> |
HbbCandidateFinder::HbbCandidateFinder(const edm::ParameterSet& iConfig): verbose_(iConfig.getParameter<bool>("verbose") ) { |
4 |
> |
algo_ = new HbbCandidateFinderAlgo(iConfig.getParameter<bool>("verbose"), iConfig.getParameter<double>("jetPtThreshold"), |
5 |
> |
iConfig.getParameter<bool>("useHighestPtHiggs") ); |
6 |
|
produces<std::vector<VHbbCandidate > >(); |
7 |
|
} |
8 |
|
|
9 |
< |
HbbCandidateFinder::~HbbCandidateFinder(){} |
9 |
> |
HbbCandidateFinder::~HbbCandidateFinder(){delete algo_;} |
10 |
|
|
11 |
|
void HbbCandidateFinder::beginJob(){} |
12 |
|
void HbbCandidateFinder::endJob(){} |
13 |
|
|
24 |
– |
|
25 |
– |
float HbbCandidateFinder::getDeltaTheta( VHbbEvent::SimpleJet * j1, VHbbEvent::SimpleJet * j2 ){return -1.;} |
26 |
– |
|
27 |
– |
|
28 |
– |
|
14 |
|
void HbbCandidateFinder::produce( edm::Event& iEvent, const edm::EventSetup& iEventSetup){ |
15 |
|
|
16 |
|
std::auto_ptr<std::vector<VHbbCandidate> > vHbbCandidates( new std::vector<VHbbCandidate> ); |
27 |
|
// hbbCandidateFinderAlgo(vHbbCandidates, vHbbEvent-> result()); |
28 |
|
// do nothing for a test |
29 |
|
|
30 |
< |
run(vHbbEvent.product(),vHbbCandidates); |
31 |
< |
|
32 |
< |
|
30 |
> |
algo_->run(vHbbEvent.product(),(*vHbbCandidates)); |
31 |
> |
|
32 |
> |
|
33 |
|
if (verbose_) |
34 |
|
std::cout <<" Pushing VHbb candidates: "<<vHbbCandidates->size()<<std::endl; |
50 |
– |
|
51 |
– |
iEvent.put(vHbbCandidates); |
52 |
– |
|
53 |
– |
} |
54 |
– |
|
55 |
– |
void HbbCandidateFinder::run (const VHbbEvent* event, std::auto_ptr<std::vector<VHbbCandidate> > & candidates){ |
56 |
– |
// |
57 |
– |
// first find the jets |
58 |
– |
// |
59 |
– |
|
60 |
– |
VHbbEvent::SimpleJet j1,j2; |
61 |
– |
std::vector<VHbbEvent::SimpleJet> addJets; |
62 |
– |
bool foundJets = findDiJets(event->simpleJets2,j1,j2,addJets) ; |
63 |
– |
|
64 |
– |
if (verbose_){ |
65 |
– |
std::cout <<" Found Dijets: "<<foundJets<< " Additional: "<<addJets.size()<< std::endl; |
66 |
– |
} |
35 |
|
|
36 |
< |
if (foundJets == false) return; |
69 |
< |
// |
70 |
< |
// search for a dilepton - just |
71 |
< |
// |
72 |
< |
std::vector<VHbbEvent::MuonInfo> mu; |
73 |
< |
findMuons(event->muInfo,mu); |
74 |
< |
std::vector<VHbbEvent::ElectronInfo> ele; |
75 |
< |
findElectrons(event->eleInfo,ele); |
76 |
< |
|
77 |
< |
if (verbose_){ |
78 |
< |
std::cout <<" Electrons: "<< ele.size()<<std::endl; |
79 |
< |
std::cout <<" Muons : "<< mu.size()<<std::endl; |
80 |
< |
} |
81 |
< |
if (ele.size()<1 && mu.size() < 1 ) return; |
82 |
< |
|
83 |
< |
// |
84 |
< |
// fill! |
85 |
< |
// |
86 |
< |
VHbbCandidate tempMu; |
87 |
< |
VHbbCandidate tempE; |
88 |
< |
tempMu.H.jets.push_back(j1); |
89 |
< |
tempMu.H.jets.push_back(j2); |
90 |
< |
tempMu.H.fourMomentum = (j1).fourMomentum+(j2).fourMomentum; |
91 |
< |
tempMu.additionalJets = addJets; |
92 |
< |
tempE = tempMu; |
93 |
< |
TLorentzVector pMu,pE; |
94 |
< |
|
95 |
< |
if (mu.size()){ |
96 |
< |
for (std::vector<VHbbEvent::MuonInfo>::iterator it = mu.begin(); it !=mu.end(); ++it){ |
97 |
< |
tempMu.V.muons.push_back(*it); |
98 |
< |
} |
99 |
< |
} |
100 |
< |
if (ele.size()){ |
101 |
< |
for (std::vector<VHbbEvent::ElectronInfo>::iterator it = ele.begin(); it !=ele.end(); ++it){ |
102 |
< |
tempE.V.electrons.push_back(*it); |
103 |
< |
} |
104 |
< |
} |
105 |
< |
|
106 |
< |
if (tempMu.V.muons.size()){ |
107 |
< |
candidates->push_back(tempMu); |
108 |
< |
} |
109 |
< |
if (tempE.V.electrons.size()){ |
110 |
< |
candidates->push_back(tempE); |
111 |
< |
} |
112 |
< |
} |
113 |
< |
|
114 |
< |
bool HbbCandidateFinder::findDiJets (const std::vector<VHbbEvent::SimpleJet>& jets, VHbbEvent::SimpleJet& j1, VHbbEvent::SimpleJet& j2,std::vector<VHbbEvent::SimpleJet>& addJets){ |
36 |
> |
iEvent.put(vHbbCandidates); |
37 |
|
|
116 |
– |
std::vector<VHbbEvent::SimpleJet> tempJets; |
117 |
– |
|
118 |
– |
for (unsigned int i=0 ; i< jets.size(); ++i){ |
119 |
– |
if (jets[i].fourMomentum.Pt()> jetPtThreshold) |
120 |
– |
tempJets.push_back(jets[i]); |
121 |
– |
} |
122 |
– |
|
123 |
– |
CompareBTag bTagComparator; |
124 |
– |
|
125 |
– |
if (tempJets.size()<2) return false; |
126 |
– |
|
127 |
– |
std::sort(tempJets.begin(), tempJets.end(), bTagComparator); |
128 |
– |
|
129 |
– |
j1 = tempJets[0]; |
130 |
– |
j2 = tempJets[1]; |
131 |
– |
// |
132 |
– |
// additional jets |
133 |
– |
// |
134 |
– |
if (tempJets.size()>2){ |
135 |
– |
for (unsigned int i=2 ; i< tempJets.size(); ++i){ |
136 |
– |
addJets.push_back(tempJets[i]); |
137 |
– |
} |
138 |
– |
} |
139 |
– |
CompareJetPt ptComparator; |
140 |
– |
|
141 |
– |
std::sort(addJets.begin(), addJets.end(), ptComparator); |
142 |
– |
return true; |
143 |
– |
} |
144 |
– |
|
145 |
– |
void HbbCandidateFinder::findMuons(const std::vector<VHbbEvent::MuonInfo>& muons, std::vector<VHbbEvent::MuonInfo>& out){ |
146 |
– |
/* Use: |
147 |
– |
For both W -> mu nu and Z -> mu mu, we adopt the standard VBTF muon selection described in VbtfWmunuBaselineSelection. The explicit cuts are reproduced here: |
148 |
– |
|
149 |
– |
We use RECO Muons that are both Global and Tracker |
150 |
– |
chi2/ndof < 10 for the global muon fit |
151 |
– |
The track associated to the muon must have |
152 |
– |
>= 1 pixel hits |
153 |
– |
>= 10 pixel + strip hits |
154 |
– |
>= 1 valid hit in the muon chambers |
155 |
– |
>= 2 muon stations |
156 |
– |
|dxy| < 0.2 |
157 |
– |
|eta| < 2.4 |
158 |
– |
Relative combined isolation (R) is required to be < 0.15 |
159 |
– |
R = [Sum pT(trks) + Et(ECAL) + Et(HCAL)] / pT(mu) computed in a cone of radius 0.3 in eta-phi |
160 |
– |
pT(mu) > 20 GeV |
161 |
– |
*/ |
162 |
– |
for (std::vector<VHbbEvent::MuonInfo>::const_iterator it = muons.begin(); it!= muons.end(); ++it){ |
163 |
– |
if ( |
164 |
– |
(*it).nPixelHits>= 1 && |
165 |
– |
(*it).nHits +(*it).nPixelHits >= 10 && |
166 |
– |
// |
167 |
– |
// sta muon not saved???? |
168 |
– |
(*it).ipDb<.2 && |
169 |
– |
((*it).hIso+(*it).eIso+(*it).tIso)/(*it).fourMomentum.Pt()<.15 && |
170 |
– |
(*it).fourMomentum.Eta()<2.4 && |
171 |
– |
(*it).fourMomentum.Pt()>20) { |
172 |
– |
out.push_back(*it); |
173 |
– |
} |
174 |
– |
} |
175 |
– |
} |
176 |
– |
|
177 |
– |
|
178 |
– |
void HbbCandidateFinder::findElectrons(const std::vector<VHbbEvent::ElectronInfo>& electrons, std::vector<VHbbEvent::ElectronInfo>& out){ |
179 |
– |
/* |
180 |
– |
We adopt the standard cut-based selection from VBTF described in detail here. |
181 |
– |
|
182 |
– |
Z -> ee |
183 |
– |
gsf electrons |
184 |
– |
VBTF WP95 |
185 |
– |
|eta|<2.5, excluding the gap 1.44 < |eta| < 1.57 |
186 |
– |
pT(e) > 20 |
187 |
– |
|
188 |
– |
W -> e nu |
189 |
– |
gsf electrons |
190 |
– |
VBTF WP80 |
191 |
– |
|eta|<2.5, excluding the gap 1.44 < |eta| < 1.57 |
192 |
– |
pT(e) > 30 |
193 |
– |
*/ |
194 |
– |
|
195 |
– |
for (std::vector<VHbbEvent::ElectronInfo>::const_iterator it = electrons.begin(); it!= electrons.end(); ++it){ |
196 |
– |
if ( |
197 |
– |
// fake |
198 |
– |
// (*it).id95> && |
199 |
– |
std::abs((*it).fourMomentum.Eta()) < 2.5 && |
200 |
– |
!( std::abs((*it).fourMomentum.Eta()) < 1.57 && std::abs((*it).fourMomentum.Eta()) > 1.44) && |
201 |
– |
(*it).fourMomentum.Pt()>30 |
202 |
– |
){ |
203 |
– |
out.push_back(*it); |
204 |
– |
} |
205 |
– |
} |
38 |
|
} |
39 |
|
|
40 |
|
|