40 produces<std::vector<TtDilepEvtSolution> >();
63 int selMuonp = -1, selMuonm = -1;
64 int selElectronp = -1, selElectronm = -1;
65 int selTaup = -1, selTaum = -1;
66 bool leptonFound =
false;
73 bool leptonFoundEE =
false;
74 bool leptonFoundMM =
false;
75 bool leptonFoundTT =
false;
76 bool leptonFoundEpMm =
false;
77 bool leptonFoundEmMp =
false;
78 bool leptonFoundEpTm =
false;
79 bool leptonFoundEmTp =
false;
80 bool leptonFoundMpTm =
false;
81 bool leptonFoundMmTp =
false;
82 bool jetsFound =
false;
83 bool METFound =
false;
84 std::vector<int> JetVetoByTaus;
97 else if (
muons->empty())
100 if (
muons->size() == 1)
109 else if (
muons->size() == 1)
119 leptonFoundEE =
true;
132 leptonFoundEpMm =
true;
136 leptonFoundEmMp =
true;
144 leptonFoundMM =
true;
155 if (
jets->size() >= 2) {
164 if (
muons->size() == 1) {
167 int expectedCharge = -
muons->begin()->charge();
168 int* tauIdx =
nullptr;
169 if (expectedCharge < 0) {
172 leptonFoundMpTm =
true;
176 leptonFoundMmTp =
true;
180 std::vector<std::vector<pat::Tau>::const_iterator> subset1;
181 for (std::vector<pat::Tau>::const_iterator
tau =
taus->begin();
tau <
taus->end(); ++
tau) {
185 subset1.push_back(
tau);
190 for (
std::vector<std::vector<pat::Tau>::const_iterator>::const_iterator
tau = subset1.begin();
193 if ((*tau)->isPFTau() && (*tau)->isolationPFChargedHadrCandsPtSum() < iso) {
194 *tauIdx = *
tau -
taus->begin();
195 iso = (*tau)->isolationPFChargedHadrCandsPtSum();
201 leptonFoundMpTm =
false;
202 leptonFoundMmTp =
false;
206 for (std::vector<pat::Jet>::const_iterator
jet =
jets->begin();
jet <
jets->end(); ++
jet) {
208 JetVetoByTaus.push_back(
jet -
jets->begin());
215 int expectedCharge = -
electrons->begin()->charge();
216 int* tauIdx =
nullptr;
217 if (expectedCharge < 0) {
220 leptonFoundEpTm =
true;
224 leptonFoundEmTp =
true;
228 std::vector<std::vector<pat::Tau>::const_iterator> subset1;
229 for (std::vector<pat::Tau>::const_iterator
tau =
taus->begin();
tau <
taus->end(); ++
tau) {
233 subset1.push_back(
tau);
238 for (
std::vector<std::vector<pat::Tau>::const_iterator>::const_iterator
tau = subset1.begin();
241 if ((*tau)->isPFTau() && (*tau)->isolationPFChargedHadrCandsPtSum() < iso) {
242 *tauIdx = *
tau -
taus->begin();
243 iso = (*tau)->isolationPFChargedHadrCandsPtSum();
249 leptonFoundEpTm =
false;
250 leptonFoundEmTp =
false;
254 for (std::vector<pat::Jet>::const_iterator
jet =
jets->begin();
jet <
jets->end(); ++
jet) {
256 JetVetoByTaus.push_back(
jet -
jets->begin());
262 jetsFound = ((
jets->size() - JetVetoByTaus.size()) >= 2);
263 }
else if (
taus->size() > 1) {
267 leptonFoundTT =
true;
276 for (std::vector<pat::Jet>::const_iterator
jet =
jets->begin();
jet <
jets->end(); ++
jet) {
279 JetVetoByTaus.push_back(
jet -
jets->begin());
283 jetsFound = ((
jets->size() - JetVetoByTaus.size()) >= 2);
287 if (
int(ee) +
int(emu) +
int(mumu) +
int(etau) +
int(mutau) +
int(tautau) > 1)
288 std::cout <<
"[TtDilepEvtSolutionMaker]: "
289 <<
"Lepton selection criteria uncorrectly defined" << std::endl;
291 bool correctLepton = (leptonFoundEE &&
eeChannel_) || ((leptonFoundEmMp || leptonFoundEpMm) &&
emuChannel_) ||
295 std::vector<TtDilepEvtSolution>* evtsols =
new std::vector<TtDilepEvtSolution>();
296 if (correctLepton && METFound && jetsFound) {
299 unsigned int numberOfJets = 0;
301 if (
find(JetVetoByTaus.begin(), JetVetoByTaus.end(),
int(
nrCombJets)) == JetVetoByTaus.end())
307 if (
find(JetVetoByTaus.begin(), JetVetoByTaus.end(),
int(
ib)) != JetVetoByTaus.end())
310 for (
unsigned int ibbar = 0; ibbar <
nrCombJets; ibbar++) {
315 if (
find(JetVetoByTaus.begin(), JetVetoByTaus.end(),
int(ibbar)) != JetVetoByTaus.end())
320 double xconstraint = 0, yconstraint = 0;
322 if (leptonFoundEE || leptonFoundEpMm || leptonFoundEpTm) {
324 xconstraint += (*electrons)[selElectronp].px();
325 yconstraint += (*electrons)[selElectronp].py();
328 if (leptonFoundEE || leptonFoundEmMp || leptonFoundEmTp) {
330 xconstraint += (*electrons)[selElectronm].px();
331 yconstraint += (*electrons)[selElectronm].py();
334 if (leptonFoundMM || leptonFoundEmMp || leptonFoundMpTm) {
336 xconstraint += (*muons)[selMuonp].px();
337 yconstraint += (*muons)[selMuonp].py();
340 if (leptonFoundMM || leptonFoundEpMm || leptonFoundMmTp) {
342 xconstraint += (*muons)[selMuonm].px();
343 yconstraint += (*muons)[selMuonm].py();
346 if (leptonFoundEpTm || leptonFoundMpTm || leptonFoundTT) {
348 xconstraint += (*taus)[selTaum].px();
349 yconstraint += (*taus)[selTaum].py();
352 if (leptonFoundEmTp || leptonFoundMmTp || leptonFoundTT) {
354 xconstraint += (*taus)[selTaup].px();
355 yconstraint += (*taus)[selTaup].py();
361 xconstraint += (*jets)[
ib].px() + (*jets)[ibbar].px() + (*mets)[0].px();
362 yconstraint += (*jets)[
ib].py() + (*jets)[ibbar].py() + (*mets)[0].py();
377 (*myLRSignalSelObservables)(asol,
iEvent);
379 evtsols->push_back(asol);
384 double bestSolDR = 9999.;
387 for (
size_t s = 0;
s < evtsols->size();
s++) {
388 dR = (*evtsols)[
s].getJetResidual();
389 if (
dR < bestSolDR) {
395 (*evtsols)[bestSol].setBestSol(
true);
398 std::unique_ptr<std::vector<TtDilepEvtSolution> >
pOut(evtsols);
403 evtsols->push_back(asol);
404 std::unique_ptr<std::vector<TtDilepEvtSolution> >
pOut(evtsols);