24 udscResolutions_(nullptr),
25 bResolutions_(nullptr),
26 jetEnergyResolutionScaleFactors_(nullptr),
27 jetEnergyResolutionEtaBinning_(nullptr),
35 std::vector<TtFullHadKinFitter::Constraint> cConstraints;
66 jetParam_((
Param)jetParam),
108 for (std::map<Constraint, TFitConstraintM*>::iterator it =
massConstr_.begin(); it !=
massConstr_.end(); ++it)
114 std::stringstream constr;
118 constr <<
" * W+-mass (" <<
mW_ <<
" GeV) \n";
121 constr <<
" * W--mass (" <<
mW_ <<
" GeV) \n";
124 constr <<
" * t-mass (" <<
mTop_ <<
" GeV) \n";
127 constr <<
" * tBar-mass (" <<
mTop_ <<
" GeV) \n";
130 constr <<
" * equal t-masses \n";
135 <<
"+++++++++++ TtFullHadKinFitter Setup ++++++++++++ \n"
136 <<
" Parametrization: \n"
138 <<
" Constraints: \n"
139 << constr.str() <<
" Max(No iterations): " <<
maxNrIter_ <<
"\n"
141 <<
" Max(F) : " <<
maxF_ <<
"\n"
142 <<
"+++++++++++++++++++++++++++++++++++++++++++++++++ \n";
147 TMatrixD empty3x3(3, 3);
148 TMatrixD empty4x4(4, 4);
222 if (
jets.size() < 6) {
235 const TLorentzVector p4B(
b.px(),
b.py(),
b.pz(),
b.energy());
236 const TLorentzVector p4BBar(bBar.
px(), bBar.
py(), bBar.
pz(), bBar.
energy());
237 const TLorentzVector p4LightQ(lightQ.
px(), lightQ.
py(), lightQ.
pz(), lightQ.
energy());
238 const TLorentzVector p4LightQBar(lightQBar.
px(), lightQBar.
py(), lightQBar.
pz(), lightQBar.
energy());
239 const TLorentzVector p4LightP(lightP.
px(), lightP.
py(), lightP.
pz(), lightP.
energy());
240 const TLorentzVector p4LightPBar(lightPBar.
px(), lightPBar.
py(), lightPBar.
pz(), lightPBar.
energy());
315 std::vector<pat::Jet>
jets;
344 : useBTagging_(
true),
346 bTagAlgo_(
"trackCountingHighPurBJetTags"),
347 minBTagValueBJet_(3.41),
348 maxBTagValueNonBJet_(3.41),
351 jetEnergyResolutionScaleFactors_(0),
352 jetEnergyResolutionEtaBinning_(0),
353 jetCorrectionLevel_(
"L3Absolute"),
362 useOnlyMatch_(
false),
363 match_(
std::vector<
int>(0)),
364 invalidMatch_(
false) {
386 unsigned int jetParam,
409 useOnlyMatch_(
false),
410 invalidMatch_(
false) {
429 const unsigned int& bJetCounter,
430 std::vector<int>& combi) {
441 }
else if (bTags_ == 1) {
442 if (bJetCounter == 1 &&
458 }
else if (bTags_ == 0) {
459 if (bJetCounter == 0) {
461 }
else if (bJetCounter == 1 &&
477 }
else if (bTags_ > 2) {
478 throw cms::Exception(
"Configuration") <<
"Wrong number of bTags (" << bTags_ <<
" bTags not supported)!\n";
487 if (jetCorrectionLevel_.empty())
489 <<
"Unconfigured jetCorrectionLevel. Please use an appropriate, non-empty string.\n";
492 if (!(quarkType ==
"wMix" || quarkType ==
"uds" || quarkType ==
"charm" || quarkType ==
"bottom"))
493 throw cms::Exception(
"Configuration") << quarkType <<
" is unknown as a quarkType for the jetCorrectionLevel.\n";
495 float jecFactor = 1.;
496 if (quarkType ==
"wMix")
497 jecFactor = 0.75 *
jet.jecFactor(jetCorrectionLevel_,
"uds") + 0.25 *
jet.jecFactor(jetCorrectionLevel_,
"charm");
499 jecFactor =
jet.jecFactor(jetCorrectionLevel_, quarkType);
502 ret.setP4(
ret.p4() * jecFactor);
507 std::list<TtFullHadKinFitter::KinFitResult> fitResults;
517 std::vector<int> invalidCombi;
519 invalidCombi.push_back(-1);
529 result.B = fitter->fittedB();
530 result.BBar = fitter->fittedBBar();
531 result.LightQ = fitter->fittedLightQ();
532 result.LightQBar = fitter->fittedLightQBar();
533 result.LightP = fitter->fittedLightP();
534 result.LightPBar = fitter->fittedLightPBar();
535 result.JetCombi = invalidCombi;
537 fitResults.push_back(
result);
546 std::vector<int> jetIndices;
547 if (!useOnlyMatch_) {
551 jetIndices.push_back(
idx);
555 std::vector<int> combi;
557 useOnlyMatch_ ? combi.push_back(match_[
idx]) : combi.push_back(
idx);
560 unsigned int bJetCounter = 0;
561 for (std::vector<pat::Jet>::const_iterator
jet =
jets.begin();
jet <
jets.end(); ++
jet) {
562 if (
jet->bDiscriminator(bTagAlgo_) >= minBTagValueBJet_)
567 for (
int cnt = 0; cnt < TMath::Factorial(combi.size()); ++cnt) {
574 doBTagging(
jets, bJetCounter, combi)) {
575 std::vector<pat::Jet> jetCombi;
585 int status = fitter->fit(jetCombi);
591 result.Chi2 = fitter->fitS();
592 result.Prob = fitter->fitProb();
593 result.B = fitter->fittedB();
594 result.BBar = fitter->fittedBBar();
595 result.LightQ = fitter->fittedLightQ();
596 result.LightQBar = fitter->fittedLightQBar();
597 result.LightP = fitter->fittedLightP();
598 result.LightPBar = fitter->fittedLightPBar();
601 fitResults.push_back(
result);
609 std::next_permutation(combi.begin(), combi.end());
625 if ((
unsigned)fitResults.size() < 1) {
636 result.B = fitter->fittedB();
637 result.BBar = fitter->fittedBBar();
638 result.LightQ = fitter->fittedLightQ();
639 result.LightQBar = fitter->fittedLightQBar();
640 result.LightP = fitter->fittedLightP();
641 result.LightPBar = fitter->fittedLightPBar();
643 std::vector<int> invalidCombi(
nPartons, -1);
644 result.JetCombi = invalidCombi;
646 fitResults.push_back(
result);
653 switch (configParameter) {
665 <<
"Chosen jet parametrization is not supported: " << configParameter <<
"\n";
673 switch (configParameter) {
690 throw cms::Exception(
"Configuration") <<
"Chosen fit constraint is not supported: " << configParameter <<
"\n";
697 const std::vector<unsigned>& configParameters) {
698 std::vector<TtFullHadKinFitter::Constraint>
result;
699 for (
unsigned i = 0;
i < configParameters.size(); ++
i) {