26 jetEnergyResolutionScaleFactors_(
nullptr),
27 jetEnergyResolutionEtaBinning_(
nullptr),
35 std::vector<TtFullHadKinFitter::Constraint> cConstraints;
36 cConstraints.resize(constraints.size());
37 for (
unsigned int i = 0;
i < constraints.size(); ++
i) {
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),
353 jetCorrectionLevel_(
"L3Absolute"),
362 useOnlyMatch_(
false),
363 match_(
std::vector<
int>(0)),
364 invalidMatch_(
false) {
386 unsigned int jetParam,
429 const unsigned int& bJetCounter,
430 std::vector<int>& combi) {
442 if (bJetCounter == 1 &&
459 if (bJetCounter == 0) {
461 }
else if (bJetCounter == 1 &&
478 throw cms::Exception(
"Configuration") <<
"Wrong number of bTags (" <<
bTags_ <<
" bTags not supported)!\n";
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")
502 ret.
setP4(ret.
p4() * jecFactor);
507 std::list<TtFullHadKinFitter::KinFitResult> fitResults;
517 std::vector<int> invalidCombi;
519 invalidCombi.push_back(-1);
537 fitResults.push_back(result);
546 std::vector<int> jetIndices;
548 for (
unsigned int idx = 0;
idx < jets.size(); ++
idx) {
551 jetIndices.push_back(
idx);
555 std::vector<int> combi;
560 unsigned int bJetCounter = 0;
561 for (std::vector<pat::Jet>::const_iterator
jet = jets.begin();
jet < jets.end(); ++
jet) {
567 for (
int cnt = 0; cnt < TMath::Factorial(combi.size()); ++cnt) {
575 std::vector<pat::Jet> jetCombi;
576 jetCombi.resize(nPartons);
601 fitResults.push_back(result);
609 std::next_permutation(combi.begin(), combi.end());
625 if ((
unsigned)fitResults.size() < 1) {
643 std::vector<int> invalidCombi(nPartons, -1);
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) {
TAbsFitParticle * lightQ_
double maxF_
maximal deviation for contstraints
const std::vector< double > * jetEnergyResolutionEtaBinning_
double maxDeltaS_
maximal chi2 equivalent
TtFullHadKinFitter::Param param(unsigned int configParameter)
pat::Jet getCalHadj() const
void setFitHadj(const pat::Particle &aFitHadj)
CovarianceMatrix * covM_
get object resolutions and put them into a matrix
Param
supported parameterizations
void setupConstraints()
initialize constraints
TtHadEvtSolution addKinFitInfo(TtHadEvtSolution *asol)
add kin fit information to the old event solution (in for legacy reasons)
TAbsFitParticle * lightP_
int maxNComb_
maximal number of combinations to be written to the event
ret
prodAgent to be discontinued
TtFullHadKinFitter::Constraint constraint(unsigned int configParameter)
virtual void setIni4Vec(const TLorentzVector *pini)=0
const pat::Particle fittedLightPBar() const
return fitted light quark candidate
void setFitHadb(const pat::Particle &aFitHadb)
double px() const final
x coordinate of momentum vector
pat::Jet getCalHadq() const
pat::Particle fittedLightPBar_
std::string param(const Param ¶m) const
convert Param to human readable form
pat::Jet getCalHadp() const
void setFitHadp(const pat::Particle &aFitHadp)
pat::Particle fittedB_
output particles
jetEnergyResolutionScaleFactors
TMatrixD setupMatrix(const pat::PATObject< T > &object, const TopKinFitter::Param param, const std::string &resolutionProvider="")
return covariance matrix for a PAT object
int fit(const std::vector< pat::Jet > &jets)
kinematic fit interface
void printSetup() const
print fitter setup
TtFullHadKinFitter * fitter
kinematic fit interface
double mW_
W mass value used for constraints.
std::vector< unsigned > constraints_
numbering of different possible kinematic constraints
math::Error< 5 >::type CovarianceMatrix
pat::Particle fittedLightQBar_
const std::vector< double > * jetEnergyResolutionScaleFactors_
scale factors for the jet energy resolution
std::list< TtFullHadKinFitter::KinFitResult > fit(const std::vector< pat::Jet > &jets)
do the fitting and return fit result
int maxNrIter_
maximal allowed number of iterations to be used for the fit
void setProbChi2(double c)
std::vector< double > jetEnergyResolutionScaleFactors_
scale factors for the jet energy resolution
const pat::Particle fittedBBar() const
return fitted b quark candidate
std::vector< edm::ParameterSet > udscResolutions_
store the resolutions for the jets
double fitProb() const
return fit probability
std::vector< edm::ParameterSet > bResolutions_
std::string jetCorrectionLevel_
correction level for jets
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
bool doBTagging(const std::vector< pat::Jet > &jets, const unsigned int &bJetCounter, std::vector< int > &combi)
pat::Jet corJet(const pat::Jet &jet, const std::string &quarkType)
helper function to construct the proper corrected jet for its corresponding quarkType ...
std::vector< double > jetEnergyResolutionEtaBinning_
unsigned int bTags_
minimal number of b-jets
Constraint
supported constraints
unsigned int maxNrIter_
maximal number of iterations to be performed for the fit
std::vector< int > match_
the combination that should be used
std::vector< TtFullHadKinFitter::Constraint > intToConstraint(const std::vector< unsigned int > &constraints)
used to convert vector of int's to vector of constraints (just used in TtFullHadKinFitter(int, int, double, double, std::vector<unsigned int>))
~TtFullHadKinFitter()
default destructor
double pz() const final
z coordinate of momentum vector
const std::vector< edm::ParameterSet > * bResolutions_
void addConstraint(TAbsFitConstraint *constraint)
TAbsFitParticle * b_
input particles
double energy() const final
energy
jetEnergyResolutionEtaBinning
pat::Jet getCalHadb() const
virtual void setCovMatrix(const TMatrixD *theCovMatrix)
double minBTagValueBJet_
min value of bTag for a b-jet
const LorentzVector & p4() const final
four-momentum Lorentz vector
pat::Jet getCalHadk() const
double mW_
W mass value used for constraints.
void addMeasParticle(TAbsFitParticle *particle)
std::map< Constraint, TFitConstraintM * > massConstr_
supported constraints
std::vector< TtFullHadKinFitter::Constraint > constraints(const std::vector< unsigned int > &configParameters)
pat::Particle fittedLightP_
TAbsFitParticle * lightQBar_
const pat::Particle fittedLightQ() const
return fitted light quark candidate
pat::Particle fittedBBar_
double maxDeltaS_
maximal allowed chi2 (not normalized to degrees of freedom)
double mTop_
top mass value used for constraints
std::vector< Constraint > constraints_
vector of constraints to be used
std::vector< int > JetCombi
Param jetParam_
jet parametrization
pat::Particle fittedLightQ_
void setupFitter()
setup fitter
~KinFit()
default destructor
XYZPointD XYZPoint
point in space with cartesian internal representation
Analysis-level particle class.
std::string bTagAlgo_
input tag for b-tagging algorithm
void setFitHadbbar(const pat::Particle &aFitHadbbar)
double py() const final
y coordinate of momentum vector
const std::vector< edm::ParameterSet > * udscResolutions_
resolutions
Analysis-level calorimeter jet class.
void setFitHadk(const pat::Particle &aFitHadk)
static const unsigned int nPartons
const TLorentzVector * getCurr4Vec()
unsigned int jetParam_
numbering of different possible jet parametrizations
void setFitHadq(const pat::Particle &aFitHadq)
bool useOnlyMatch_
fit or only a certain combination
int maxNJets_
maximal number of jets (-1 possible to indicate 'all')
TtFullHadKinFitter()
default constructor
const pat::Particle fittedLightP() const
return fitted light quark candidate
double fitS() const
return chi2 of fit (not normalized to degrees of freedom)
void setupJets()
initialize jet inputs
TKinFitter * fitter_
kinematic fitter
float jecFactor(const std::string &level, const std::string &flavor="none", const std::string &set="") const
double maxBTagValueNonBJet_
max value of bTag for a non-b-jet
bool invalidMatch_
match is invalid
bool next_combination(BidIt n_begin, BidIt n_end, BidIt r_begin, BidIt r_end)
pat::Jet getCalHadbbar() const
const pat::Particle fittedLightQBar() const
return fitted light quark candidate
double mTop_
top mass value used for constraints
const pat::Particle fittedB() const
return fitted b quark candidate
void setP4(const LorentzVector &p4) final
set 4-momentum
KinFit()
default constructor
TAbsFitParticle * lightPBar_
double maxF_
maximal allowed distance from constraints