29 caloIsoCut_(iConfig.getParameter<double>(
"caloIsoCut")),
30 mTop_(iConfig.getParameter<double>(
"mTop")) {
32 produces<std::vector<reco::CompositeCandidate> >();
52 std::vector<pat::Muon>
const&
muons = *muonHandle;
56 std::vector<pat::Jet>
const&
jets = *jetHandle;
60 std::vector<pat::Electron>
const&
electrons = *electronHandle;
64 std::vector<pat::MET>
const&
mets = *metHandle;
88 double maxWLeptonPt = -1;
94 std::vector<pat::Muon>::const_iterator isolatedMuon =
muons.end();
95 std::vector<pat::Muon>::const_iterator
muon =
muons.end();
96 unsigned int nIsolatedMuons = 0;
97 std::vector<pat::Muon>::const_iterator muonIt =
muons.begin(), muonEnd =
muons.end();
98 for (; muonIt != muonEnd; ++muonIt) {
100 double pt = muonIt->pt();
101 if (
pt > maxWLeptonPt) {
107 double caloIso = muonIt->caloIso();
110 isolatedMuon = muonIt;
117 std::vector<pat::Electron>::const_iterator isolatedElectron =
electrons.end();
119 unsigned int nIsolatedElectrons = 0;
120 std::vector<pat::Electron>::const_iterator electronIt =
electrons.begin(), electronEnd =
electrons.end();
121 for (; electronIt != electronEnd; ++electronIt) {
123 double pt = electronIt->pt();
124 if (
pt > maxWLeptonPt) {
130 double caloIso = electronIt->caloIso();
132 nIsolatedElectrons++;
133 isolatedElectron = electronIt;
143 if (isolatedMuon != muonEnd) {
146 }
else if (isolatedElectron != electronEnd) {
163 int nIsolatedLeptons = nIsolatedMuons + nIsolatedElectrons;
164 if (nIsolatedLeptons > 1) {
178 if (
jets.size() < 2 ||
mets.empty()) {
216 cout <<
"Preselection is satisfied" << endl;
219 cout <<
"Jets.size() = " <<
jets.size() << endl;
227 if (
jets.size() >= 4) {
229 cout <<
"Getting ttbar semileptonic solution" << endl;
238 cout <<
"Got a nonzero size solution vector" << endl;
246 edm::LogWarning(
"DataNotFound") <<
"BoostedTopProducer: Cannot find TtSemiEvtSolution\n";
252 else if (
jets.size() == 2 ||
jets.size() == 3) {
260 cout <<
"Adding muon as daughter" << endl;
264 cout <<
"Adding electron as daughter" << endl;
268 cout <<
"Adding neutrino as daughter" << endl;
270 addFourMomenta.
set(lepW);
275 zcalculator.
SetMET(neutrino);
280 double neutrinoPz = zcalculator.
Calculate(1);
283 neutrino.
setPz(neutrinoPz);
286 cout <<
"Set neutrino pz to " << neutrinoPz << endl;
295 cout <<
"Adding lepW as daughter" << endl;
302 TLorentzVector p4_W(lepW.
px(), lepW.
py(), lepW.
pz(), lepW.
energy());
305 std::vector<pat::Jet>::const_iterator jetit =
jets.begin(), jetend =
jets.end();
306 unsigned long ii = 1;
307 for (; jetit != jetend; ++jetit, ++
ii) {
309 TLorentzVector p4_jet(jetit->px(), jetit->py(), jetit->pz(), jetit->energy());
320 cout <<
"Adding daughter " <<
s.str() << endl;
332 cout <<
"Adding daughter " <<
s.str() << endl;
337 addFourMomenta.
set(lept);
338 addFourMomenta.
set(hadt);
342 if (lepWHasJet && hadWHasJet) {
344 cout <<
"Adding daughters lept and hadt" << endl;
347 addFourMomenta.
set(ttbar);
356 std::vector<reco::CompositeCandidate> ttbarList;
359 cout <<
"Writing out" << endl;
360 ttbarList.push_back(ttbar);
362 std::unique_ptr<std::vector<reco::CompositeCandidate> > pTtbar(
new std::vector<reco::CompositeCandidate>(ttbarList));
367 TLorentzVector ptot =
p1 +
p2;
368 Double_t theta1 = TMath::ACos((
p1.Vect().Dot(ptot.Vect())) / (
p1.P() * ptot.P()));
369 Double_t theta2 = TMath::ACos((
p2.Vect().Dot(ptot.Vect())) / (
p2.P() * ptot.P()));
372 double th1th2 = theta1 + theta2;