50 return (l1->
pt() > l2->
pt());
84 produces<std::vector<TtDilepEvtSolution> >();
105 int selMuonp = -1, selMuonm = -1;
106 int selElectronp = -1, selElectronm = -1;
107 int selTaup = -1, selTaum = -1;
108 bool leptonFound =
false;
115 bool leptonFoundEE =
false;
116 bool leptonFoundMM =
false;
117 bool leptonFoundTT =
false;
118 bool leptonFoundEpMm =
false;
119 bool leptonFoundEmMp =
false;
120 bool leptonFoundEpTm =
false;
121 bool leptonFoundEmTp =
false;
122 bool leptonFoundMpTm =
false;
123 bool leptonFoundMmTp =
false;
124 bool jetsFound =
false;
125 bool METFound =
false;
126 std::vector<int> JetVetoByTaus;
129 if (!
mets->empty()) {
139 else if (
muons->empty())
142 if (
muons->size() == 1)
151 else if (
muons->size() == 1)
160 leptonFoundEE =
true;
172 leptonFoundEpMm =
true;
176 leptonFoundEmMp =
true;
183 leptonFoundMM =
true;
194 if (
jets->size() >= 2) {
203 if (
muons->size() == 1) {
206 int expectedCharge = -
muons->begin()->charge();
208 if (expectedCharge < 0) {
211 leptonFoundMpTm =
true;
215 leptonFoundMmTp =
true;
219 std::vector<std::vector<pat::Tau>::const_iterator> subset1;
220 for (std::vector<pat::Tau>::const_iterator
tau =
taus->begin();
tau <
taus->end(); ++
tau) {
224 subset1.push_back(
tau);
229 for (
std::vector<std::vector<pat::Tau>::const_iterator>::const_iterator
tau = subset1.begin();
232 if ((*tau)->isPFTau() && (*tau)->isolationPFChargedHadrCandsPtSum() <
iso) {
234 iso = (*tau)->isolationPFChargedHadrCandsPtSum();
240 leptonFoundMpTm =
false;
241 leptonFoundMmTp =
false;
245 for (std::vector<pat::Jet>::const_iterator
jet =
jets->begin();
jet <
jets->end(); ++
jet) {
247 JetVetoByTaus.push_back(
jet -
jets->begin());
254 int expectedCharge = -
electrons->begin()->charge();
256 if (expectedCharge < 0) {
259 leptonFoundEpTm =
true;
263 leptonFoundEmTp =
true;
267 std::vector<std::vector<pat::Tau>::const_iterator> subset1;
268 for (std::vector<pat::Tau>::const_iterator
tau =
taus->begin();
tau <
taus->end(); ++
tau) {
272 subset1.push_back(
tau);
277 for (
std::vector<std::vector<pat::Tau>::const_iterator>::const_iterator
tau = subset1.begin();
280 if ((*tau)->isPFTau() && (*tau)->isolationPFChargedHadrCandsPtSum() <
iso) {
282 iso = (*tau)->isolationPFChargedHadrCandsPtSum();
288 leptonFoundEpTm =
false;
289 leptonFoundEmTp =
false;
293 for (std::vector<pat::Jet>::const_iterator
jet =
jets->begin();
jet <
jets->end(); ++
jet) {
295 JetVetoByTaus.push_back(
jet -
jets->begin());
301 jetsFound = ((
jets->size() - JetVetoByTaus.size()) >= 2);
302 }
else if (
taus->size() > 1) {
305 leptonFoundTT =
true;
314 for (std::vector<pat::Jet>::const_iterator
jet =
jets->begin();
jet <
jets->end(); ++
jet) {
317 JetVetoByTaus.push_back(
jet -
jets->begin());
321 jetsFound = ((
jets->size() - JetVetoByTaus.size()) >= 2);
325 if (
int(ee) +
int(emu) +
int(mumu) +
int(etau) +
int(mutau) +
int(tautau) > 1)
326 std::cout <<
"[TtDilepEvtSolutionMaker]: " 327 <<
"Lepton selection criteria uncorrectly defined" << std::endl;
329 bool correctLepton = (leptonFoundEE &&
eeChannel_) || ((leptonFoundEmMp || leptonFoundEpMm) &&
emuChannel_) ||
333 std::vector<TtDilepEvtSolution>* evtsols =
new std::vector<TtDilepEvtSolution>();
334 if (correctLepton && METFound && jetsFound) {
337 unsigned int numberOfJets = 0;
339 if (
find(JetVetoByTaus.begin(), JetVetoByTaus.end(),
int(
nrCombJets)) == JetVetoByTaus.end())
345 if (
find(JetVetoByTaus.begin(), JetVetoByTaus.end(),
int(
ib)) != JetVetoByTaus.end())
348 for (
unsigned int ibbar = 0; ibbar <
nrCombJets; ibbar++) {
353 if (
find(JetVetoByTaus.begin(), JetVetoByTaus.end(),
int(ibbar)) != JetVetoByTaus.end())
358 double xconstraint = 0, yconstraint = 0;
360 if (leptonFoundEE || leptonFoundEpMm || leptonFoundEpTm) {
362 xconstraint += (*electrons)[selElectronp].px();
363 yconstraint += (*electrons)[selElectronp].py();
366 if (leptonFoundEE || leptonFoundEmMp || leptonFoundEmTp) {
368 xconstraint += (*electrons)[selElectronm].px();
369 yconstraint += (*electrons)[selElectronm].py();
372 if (leptonFoundMM || leptonFoundEmMp || leptonFoundMpTm) {
374 xconstraint += (*muons)[selMuonp].px();
375 yconstraint += (*muons)[selMuonp].py();
378 if (leptonFoundMM || leptonFoundEpMm || leptonFoundMmTp) {
380 xconstraint += (*muons)[selMuonm].px();
381 yconstraint += (*muons)[selMuonm].py();
384 if (leptonFoundEpTm || leptonFoundMpTm || leptonFoundTT) {
386 xconstraint += (*taus)[selTaum].px();
387 yconstraint += (*taus)[selTaum].py();
390 if (leptonFoundEmTp || leptonFoundMmTp || leptonFoundTT) {
392 xconstraint += (*taus)[selTaup].px();
393 yconstraint += (*taus)[selTaup].py();
399 xconstraint += (*jets)[
ib].px() + (*jets)[ibbar].px() + (*mets)[0].px();
400 yconstraint += (*jets)[
ib].py() + (*jets)[ibbar].py() + (*mets)[0].py();
415 (*myLRSignalSelObservables)(asol,
iEvent);
417 evtsols->push_back(asol);
422 double bestSolDR = 9999.;
425 for (
size_t s = 0;
s < evtsols->size();
s++) {
426 dR = (*evtsols)[
s].getJetResidual();
427 if (
dR < bestSolDR) {
433 (*evtsols)[bestSol].setBestSol(
true);
436 std::unique_ptr<std::vector<TtDilepEvtSolution> > pOut(evtsols);
441 evtsols->push_back(asol);
442 std::unique_ptr<std::vector<TtDilepEvtSolution> > pOut(evtsols);
edm::EDGetTokenT< std::vector< pat::Jet > > jetSourceToken_
T getParameter(std::string const &) const
bool HasPositiveCharge(const reco::Candidate *) const
void setElectronm(const edm::Handle< std::vector< pat::Electron > > &elec, int i)
void setElectronp(const edm::Handle< std::vector< pat::Electron > > &elec, int i)
virtual double pt() const =0
transverse momentum
void setB(const edm::Handle< std::vector< pat::Jet > > &jet, int i)
edm::EDGetTokenT< std::vector< pat::Muon > > muonSourceToken_
void SetConstraints(const double xx=0, const double yy=0)
bool LepDiffCharge(const reco::Candidate *, const reco::Candidate *) const
TtDilepEvtSolutionMaker(const edm::ParameterSet &iConfig)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
edm::EDGetTokenT< std::vector< pat::Tau > > tauSourceToken_
edm::EDGetTokenT< std::vector< pat::MET > > metSourceToken_
void setMuonm(const edm::Handle< std::vector< pat::Muon > > &muon, int i)
edm::EDGetTokenT< std::vector< pat::Electron > > electronSourceToken_
TtDilepEvtSolution addKinSolInfo(TtDilepEvtSolution *asol)
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
TtFullLepKinSolver * solver
void setMET(const edm::Handle< std::vector< pat::MET > > &met, int i)
#define DEFINE_FWK_MODULE(type)
virtual int charge() const =0
electric charge
void useWeightFromMC(bool useMC)
void setTaup(const edm::Handle< std::vector< pat::Tau > > &tau, int i)
void setJetCorrectionScheme(int jetCorrScheme)
edm::EDGetTokenT< TtGenEvent > evtSourceToken_
void setGenEvt(const edm::Handle< TtGenEvent > &)
void setMuonp(const edm::Handle< std::vector< pat::Muon > > &muon, int i)
std::vector< double > nupars_
bool PTComp(const reco::Candidate *, const reco::Candidate *) const
~TtDilepEvtSolutionMaker() override
void setTaum(const edm::Handle< std::vector< pat::Tau > > &tau, int i)
TtDilepLRSignalSelObservables * myLRSignalSelObservables
void setBbar(const edm::Handle< std::vector< pat::Jet > > &jet, int i)