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();
118 std::vector<pat::Electron>::const_iterator
electron = 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) {
126 electron = electronIt;
130 double caloIso = electronIt->caloIso();
132 nIsolatedElectrons++;
133 isolatedElectron = electronIt;
143 if (isolatedMuon != muonEnd) {
146 }
else if (isolatedElectron != electronEnd) {
147 electron = isolatedElectron;
151 if (muon != muonEnd && electron == electronEnd)
153 else if (muon == muonEnd && electron != electronEnd)
155 else if (muon != muonEnd && electron != electronEnd) {
156 isMuon = muon->pt() > electron->pt();
163 int nIsolatedLeptons = nIsolatedMuons + nIsolatedElectrons;
164 if (nIsolatedLeptons > 1) {
165 preselection =
false;
171 if (muon == muonEnd && electron == electronEnd) {
172 preselection =
false;
178 if (jets.size() < 2 || mets.empty()) {
179 preselection =
false;
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);
279 zcalculator.
SetMuon(*electron);
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;
373 double psi = (p1.P() + p2.P()) *
TMath::Abs(TMath::Sin(th1th2)) / (2. * mass);
375 psi = (p1.P() + p2.P()) * (1. +
TMath::Abs(TMath::Cos(th1th2))) / (2. * mass);
Analysis-level MET class.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool isMuon(const Candidate &part)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< std::vector< pat::Electron > > eleToken_
edm::EDGetTokenT< std::vector< pat::Muon > > muoToken_
double px() const final
x coordinate of momentum vector
edm::EDGetTokenT< TtSemiLeptonicEvent > solToken_
void produce(edm::Event &, const edm::EventSetup &) override
Class derived from the TtEvent for the semileptonic decay channel.
std::map< std::string, int, std::less< std::string > > psi
edm::EDGetTokenT< std::vector< pat::Jet > > jetToken_
void SetMET(const pat::MET &MET)
Set MET.
edm::EDGetTokenT< std::vector< pat::MET > > metToken_
#define DEFINE_FWK_MODULE(type)
double pz() const final
z coordinate of momentum vector
void SetMuon(const pat::Particle &lepton)
Set Muon.
double energy() const final
energy
BoostedTopProducer(const edm::ParameterSet &)
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
const reco::CompositeCandidate & eventHypo(const HypoClassKey &key, const unsigned &cmb=0) const
double Calculate(int type=0)
member functions
double py() const final
y coordinate of momentum vector
double Psi(const TLorentzVector &p1, const TLorentzVector &p2, double mass)
~BoostedTopProducer() override
void set(reco::Candidate &c) const
set up a candidate
size_type numberOfDaughters() const override
number of daughters
preselection
PRESELECTION
void setPz(double pz) final