32 |
|
// hbbCandidateFinderAlgo(vHbbCandidates, vHbbEvent-> result()); |
33 |
|
// do nothing for a test |
34 |
|
|
35 |
+ |
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); |
47 |
+ |
|
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){ |
80 |
+ |
|
81 |
+ |
// |
82 |
+ |
// select jets |
83 |
+ |
// |
84 |
+ |
// |
85 |
+ |
|
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; |
125 |
+ |
} |
126 |
+ |
|
127 |
+ |
|
128 |
|
|
129 |
|
//define this as a plug-in |
130 |
|
DEFINE_FWK_MODULE(HbbCandidateFinder); |