1 |
|
#include "VHbbAnalysis/HbbAnalyzer/interface/HbbCandidateFinder.h" |
2 |
|
|
3 |
< |
|
4 |
< |
|
5 |
< |
|
6 |
< |
HbbCandidateFinder::HbbCandidateFinder(const edm::ParameterSet& iConfig): vhbbevent_(iConfig.getParameter<edm::InputTag>("VHbbEventLabel")) { |
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 |
|
|
15 |
– |
|
16 |
– |
float HbbCandidateFinder::getDeltaTheta( VHbbEvent::SimpleJet * j1, VHbbEvent::SimpleJet * j2 ){return -1.;} |
17 |
– |
|
18 |
– |
|
19 |
– |
|
14 |
|
void HbbCandidateFinder::produce( edm::Event& iEvent, const edm::EventSetup& iEventSetup){ |
15 |
|
|
16 |
|
std::auto_ptr<std::vector<VHbbCandidate> > vHbbCandidates( new std::vector<VHbbCandidate> ); |
17 |
|
|
18 |
|
edm::Handle<VHbbEvent> vHbbEvent; |
19 |
< |
iEvent.getByLabel(vhbbevent_, vHbbEvent); |
19 |
> |
// iEvent.getByLabel(vhbbevent_, vHbbEvent); |
20 |
> |
iEvent.getByType(vHbbEvent); |
21 |
|
|
22 |
|
|
23 |
|
// |
27 |
|
// hbbCandidateFinderAlgo(vHbbCandidates, vHbbEvent-> result()); |
28 |
|
// do nothing for a test |
29 |
|
|
30 |
< |
run(vHbbEvent.product(), vHbbCandidates); |
36 |
< |
|
37 |
< |
|
38 |
< |
iEvent.put(vHbbCandidates); |
39 |
< |
|
40 |
< |
} |
41 |
< |
|
42 |
< |
void HbbCandidateFinder::run (const VHbbEvent* event, std::auto_ptr<std::vector<VHbbCandidate> > & candidates){ |
43 |
< |
// |
44 |
< |
// first find the jets |
45 |
< |
// |
46 |
< |
std::pair<int,int> jets = findDiJets(event->simpleJets2); |
30 |
> |
algo_->run(vHbbEvent.product(),(*vHbbCandidates)); |
31 |
|
|
48 |
– |
if (jets.first<0 || jets.second<0) return ; |
49 |
– |
|
50 |
– |
// |
51 |
– |
// search for a dilepton - just |
52 |
– |
// |
53 |
– |
int ele = findDiElectron(event->diElectronInfo); |
54 |
– |
int mu = findDiMuon(event->diMuonInfo); |
55 |
– |
|
56 |
– |
if (ele<0 && mu < 0 ) return; |
57 |
– |
|
58 |
– |
// |
59 |
– |
// fill! |
60 |
– |
// |
61 |
– |
VHbbCandidate temp; |
62 |
– |
temp.H.jets.push_back(event->simpleJets2[jets.first]); |
63 |
– |
temp.H.jets.push_back(event->simpleJets2[jets.second]); |
64 |
– |
temp.H.fourMomentum = (event->simpleJets2[jets.first]).fourMomentum+(event->simpleJets2[jets.second]).fourMomentum; |
65 |
– |
if (mu>-1){ |
66 |
– |
temp.V.muons.push_back((event->diMuonInfo[mu]).daughter1); |
67 |
– |
temp.V.muons.push_back((event->diMuonInfo[mu]).daughter2); |
68 |
– |
temp.V.fourMomentum = (temp.V.muons[0]).fourMomentum+(temp.V.muons[1]).fourMomentum; |
69 |
– |
}else{ |
70 |
– |
temp.V.electrons.push_back((event->diElectronInfo[ele]).daughter1); |
71 |
– |
temp.V.electrons.push_back((event->diElectronInfo[ele]).daughter2); |
72 |
– |
temp.V.fourMomentum = (temp.V.electrons[0]).fourMomentum+(temp.V.electrons[1]).fourMomentum; |
73 |
– |
} |
74 |
– |
|
75 |
– |
candidates->push_back(temp); |
76 |
– |
|
77 |
– |
} |
78 |
– |
|
79 |
– |
std::pair <int, int> HbbCandidateFinder::findDiJets (const std::vector<VHbbEvent::SimpleJet>& jets){ |
32 |
|
|
33 |
< |
// |
34 |
< |
// select jets |
35 |
< |
// |
36 |
< |
// |
37 |
< |
|
86 |
< |
unsigned int maxJets = jets.size(); |
87 |
< |
int i1(-99),i2(-99); |
88 |
< |
float btag_max(-100); |
89 |
< |
// |
90 |
< |
// do the combinatorics |
91 |
< |
|
92 |
< |
if (maxJets<2) return pair<int,int>(-1,-1); |
93 |
< |
|
94 |
< |
for (unsigned int j1=0; j1<maxJets-1; j1++) { |
95 |
< |
for (unsigned int j2=j1+1; j2<maxJets; j2++) { |
96 |
< |
float j1_btag = (jets)[j1].csv; |
97 |
< |
float j2_btag = (jets)[j2].csv; |
98 |
< |
|
99 |
< |
if (j1_btag<=0.0 || j2_btag<=0.0) continue; |
100 |
< |
|
101 |
< |
if ((jets)[j1].fourMomentum.Pt()< 30. || |
102 |
< |
(jets)[j2].fourMomentum.Pt()< 30.) continue; |
103 |
< |
|
104 |
< |
if (j1_btag+j2_btag>btag_max) { |
105 |
< |
btag_max = j1_btag+j2_btag; |
106 |
< |
i1 = j1; |
107 |
< |
i2 = j2; |
108 |
< |
} |
109 |
< |
} |
110 |
< |
} |
111 |
< |
if (i1>=0 && i2>=0) return pair<int,int>(i1,i2); |
112 |
< |
else return pair<int,int>(-1,-1); |
113 |
< |
} |
114 |
< |
|
115 |
< |
int HbbCandidateFinder::findDiMuon (const std::vector<VHbbEvent::DiMuonInfo>& dimu){ |
116 |
< |
int res = -99; |
117 |
< |
if (dimu.size()>0) res= 1; |
118 |
< |
return res; |
119 |
< |
|
120 |
< |
} |
121 |
< |
int HbbCandidateFinder::findDiElectron (const std::vector<VHbbEvent::DiElectronInfo>& die){ |
122 |
< |
int res = -99; |
123 |
< |
if (die.size()>0) res= 1; |
124 |
< |
return res; |
33 |
> |
if (verbose_) |
34 |
> |
std::cout <<" Pushing VHbb candidates: "<<vHbbCandidates->size()<<std::endl; |
35 |
> |
|
36 |
> |
iEvent.put(vHbbCandidates); |
37 |
> |
|
38 |
|
} |
39 |
|
|
40 |
|
|
128 |
– |
|
41 |
|
//define this as a plug-in |
42 |
|
DEFINE_FWK_MODULE(HbbCandidateFinder); |