18 b_(0), bBar_(0), lightQ_(0), lightQBar_(0), lightP_(0), lightPBar_(0),
26 std::vector<TtFullHadKinFitter::Constraint>
29 std::vector<TtFullHadKinFitter::Constraint> cConstraints;
30 cConstraints.resize(constraints.size());
31 for(
unsigned int i=0;
i<constraints.size();++
i)
40 std::vector<unsigned int>
constraints,
double mW,
double mTop):
42 b_(0), bBar_(0), lightQ_(0), lightQBar_(0), lightP_(0), lightPBar_(0),
43 jetParam_((
Param)jetParam), constraints_(intToConstraint(constraints))
51 std::vector<Constraint>
constraints,
double mW,
double mTop):
53 b_(0), bBar_(0), lightQ_(0), lightQBar_(0), lightP_(0), lightPBar_(0),
54 jetParam_(jetParam), constraints_(constraints)
70 for(std::map<Constraint, TFitConstraintM*>::iterator it =
massConstr_.begin(); it !=
massConstr_.end(); ++it)
78 std::stringstream constr;
81 case kWPlusMass : constr <<
" * W+-mass (" <<
mW_ <<
" GeV) \n";
break;
82 case kWMinusMass : constr <<
" * W--mass (" << mW_ <<
" GeV) \n";
break;
83 case kTopMass : constr <<
" * t-mass (" <<
mTop_ <<
" GeV) \n";
break;
84 case kTopBarMass : constr <<
" * tBar-mass (" << mTop_ <<
" GeV) \n";
break;
90 <<
"+++++++++++ TtFullHadKinFitter Setup ++++++++++++ \n"
91 <<
" Parametrization: \n"
95 <<
" Max(No iterations): " <<
maxNrIter_ <<
"\n"
97 <<
" Max(F) : " <<
maxF_ <<
"\n"
98 <<
"+++++++++++++++++++++++++++++++++++++++++++++++++ \n";
105 TMatrixD empty3x3(3,3);
106 TMatrixD empty4x4(4,4);
178 TtFullHadKinFitter::fit(
const std::vector<pat::Jet>&
jets,
const std::vector<edm::ParameterSet> udscResolutions,
const std::vector<edm::ParameterSet> bResolutions,
const double resolutionSmearFactor = 1.)
193 TLorentzVector p4B( b.
px(), b.
py(), b.
pz(), b.
energy() );
194 TLorentzVector p4BBar( bBar.
px(), bBar.
py(), bBar.
pz(), bBar.
energy() );
195 TLorentzVector p4LightQ( lightQ.
px(), lightQ.
py(), lightQ.
pz(), lightQ.
energy() );
196 TLorentzVector p4LightQBar( lightQBar.
px(), lightQBar.
py(), lightQBar.
pz(), lightQBar.
energy() );
197 TLorentzVector p4LightP( lightP.
px(), lightP.
py(), lightP.
pz(), lightP.
energy() );
198 TLorentzVector p4LightPBar( lightPBar.
px(), lightPBar.
py(), lightPBar.
pz(), lightPBar.
energy() );
247 const std::vector<edm::ParameterSet> emptyResolutionVector;
248 return fit(jets, emptyResolutionVector, emptyResolutionVector);
257 std::vector<pat::Jet>
jets;
289 bTagAlgo_(
"trackCountingHighPurBJetTags"),
290 minBTagValueBJet_(3.41),
291 maxBTagValueNonBJet_(3.41),
294 resolutionSmearFactor_(1.),
295 jetCorrectionLevel_(
"L3Absolute"),
304 useOnlyMatch_(
false),
305 match_(std::vector<int>(0)),
315 std::vector<edm::ParameterSet> udscResolutions, std::vector<edm::ParameterSet> bResolutions,
double resolutionSmearFactor,
316 std::string jetCorrectionLevel,
int maxNJets,
int maxNComb,
317 unsigned int maxNrIter,
double maxDeltaS,
double maxF,
unsigned int jetParam, std::vector<unsigned>
constraints,
double mW,
double mTop) :
318 useBTagging_(useBTagging),
321 minBTagValueBJet_(minBTagValueBJet),
322 maxBTagValueNonBJet_(maxBTagValueNonBJet),
323 udscResolutions_(udscResolutions),
324 bResolutions_(bResolutions),
325 resolutionSmearFactor_(resolutionSmearFactor),
326 jetCorrectionLevel_(jetCorrectionLevel),
336 useOnlyMatch_(
false),
352 if( !useBTagging_ ) {
364 else if( bTags_ == 1 ){
365 if( bJetCounter == 1 &&
374 else if( bJetCounter > 1 &&
384 else if( bTags_ == 0 ){
385 if( bJetCounter == 0){
388 else if( bJetCounter == 1 &&
397 else if( bJetCounter > 1 &&
407 else if( bTags_ > 2 ){
409 <<
"Wrong number of bTags (" << bTags_ <<
" bTags not supported)!\n";
420 if(jetCorrectionLevel_.empty())
422 <<
"Unconfigured jetCorrectionLevel. Please use an appropriate, non-empty string.\n";
425 if( !(quarkType==
"wMix" ||
427 quarkType==
"charm" ||
428 quarkType==
"bottom") )
430 << quarkType <<
" is unknown as a quarkType for the jetCorrectionLevel.\n";
432 float jecFactor = 1.;
433 if(quarkType==
"wMix") jecFactor = 0.75 * jet.
jecFactor(jetCorrectionLevel_,
"uds") + 0.25 * jet.
jecFactor(jetCorrectionLevel_,
"charm");
434 else jecFactor = jet.
jecFactor(jetCorrectionLevel_, quarkType);
441 std::list<TtFullHadKinFitter::KinFitResult>
444 std::list<TtFullHadKinFitter::KinFitResult> fitResults;
452 if( jets.size()<
nPartons || invalidMatch_ ) {
454 std::vector<int> invalidCombi;
455 for(
unsigned int i = 0;
i <
nPartons; ++
i) invalidCombi.push_back( -1 );
465 result.
B = fitter->fittedB();
466 result.
BBar = fitter->fittedBBar();
467 result.
LightQ = fitter->fittedLightQ();
468 result.
LightQBar= fitter->fittedLightQBar();
469 result.
LightP = fitter->fittedLightP();
470 result.
LightPBar= fitter->fittedLightPBar();
473 fitResults.push_back( result );
482 std::vector<int> jetIndices;
484 for(
unsigned int idx=0; idx<jets.size(); ++idx){
485 if(maxNJets_>=(
int)
nPartons && maxNJets_==(int)idx)
break;
486 jetIndices.push_back(idx);
490 std::vector<int> combi;
491 for(
unsigned int idx=0; idx<
nPartons; ++idx) {
492 useOnlyMatch_?combi.push_back(match_[idx]):combi.push_back(idx);
496 unsigned int bJetCounter = 0;
497 for(std::vector<pat::Jet>::const_iterator
jet = jets.begin();
jet < jets.end(); ++
jet){
498 if(
jet->bDiscriminator(bTagAlgo_) >= minBTagValueBJet_) ++bJetCounter;
502 for(
int cnt=0; cnt<TMath::Factorial(combi.size()); ++cnt){
508 useOnlyMatch_) && doBTagging(jets, bJetCounter, combi) ) {
510 std::vector<pat::Jet> jetCombi;
511 jetCombi.resize(nPartons);
520 int status = fitter->fit(jetCombi, udscResolutions_, bResolutions_, resolutionSmearFactor_);
526 result.
Chi2 = fitter->fitS();
527 result.
Prob = fitter->fitProb();
528 result.
B = fitter->fittedB();
529 result.
BBar = fitter->fittedBBar();
530 result.
LightQ = fitter->fittedLightQ();
531 result.
LightQBar= fitter->fittedLightQBar();
532 result.
LightP = fitter->fittedLightP();
533 result.
LightPBar= fitter->fittedLightPBar();
536 fitResults.push_back( result );
544 std::next_permutation( combi.begin(), combi.end() );
562 if( fitResults.size() < 1 ) {
573 result.
B = fitter->fittedB();
574 result.
BBar = fitter->fittedBBar();
575 result.
LightQ = fitter->fittedLightQ();
576 result.
LightQBar= fitter->fittedLightQBar();
577 result.
LightP = fitter->fittedLightP();
578 result.
LightPBar= fitter->fittedLightPBar();
580 std::vector<int> invalidCombi(nPartons, -1);
583 fitResults.push_back( result );
592 switch(configParameter){
598 <<
"Chosen jet parametrization is not supported: " << configParameter <<
"\n";
608 switch(configParameter){
616 <<
"Chosen fit constraint is not supported: " << configParameter <<
"\n";
622 std::vector<TtFullHadKinFitter::Constraint>
625 std::vector<TtFullHadKinFitter::Constraint>
result;
626 for(
unsigned i=0;
i<configParameters.size(); ++
i){
627 result.push_back(constraint(configParameters[
i]));
TAbsFitParticle * lightQ_
double maxF_
maximal deviation for contstraints
float jecFactor(const std::string &level, const std::string &flavor="none", const std::string &set="") const
double maxDeltaS_
maximal chi2 equivalent
TtFullHadKinFitter::Param param(unsigned int configParameter)
pat::Jet getCalHadj() const
void setFitHadj(const pat::Particle &aFitHadj)
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_
TtFullHadKinFitter::Constraint constraint(unsigned int configParameter)
virtual void setIni4Vec(const TLorentzVector *pini)=0
void setFitHadb(const pat::Particle &aFitHadb)
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)
virtual void setP4(const LorentzVector &p4)
set 4-momentum
TMatrixD setupMatrix(const pat::PATObject< ObjectType > &object, TopKinFitter::Param param, std::string resolutionProvider)
pat::Particle fittedB_
output particles
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
CovarianceMatrix * covM
get object resolutions and put them into a matrix
pat::Particle fittedLightQBar_
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)
double fitProb() const
return fit probability
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 ...
virtual double energy() const
energy
Constraint
supported constraints
unsigned int maxNrIter_
maximal number of iterations to be performed for the fit
~TtFullHadKinFitter()
default destructor
std::vector< TtFullHadKinFitter::Constraint > intToConstraint(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>))
void addConstraint(TAbsFitConstraint *constraint)
TAbsFitParticle * b_
input particles
pat::Jet getCalHadb() const
virtual void setCovMatrix(const TMatrixD *theCovMatrix)
pat::Jet getCalHadk() const
double mW_
W mass value used for constraints.
void addMeasParticle(TAbsFitParticle *particle)
std::map< Constraint, TFitConstraintM * > massConstr_
supported constraints
pat::Particle fittedLightP_
TAbsFitParticle * lightQBar_
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
virtual double px() const
x coordinate of momentum vector
~KinFit()
default destructor
XYZPointD XYZPoint
point in space with cartesian internal representation
Analysis-level particle class.
void setFitHadbbar(const pat::Particle &aFitHadbbar)
Analysis-level calorimeter jet class.
void setFitHadk(const pat::Particle &aFitHadk)
static const unsigned int nPartons
virtual double pz() const
z coordinate of momentum vector
const TLorentzVector * getCurr4Vec()
unsigned int jetParam_
numbering of different possible jet parametrizations
void setFitHadq(const pat::Particle &aFitHadq)
TtFullHadKinFitter()
default constructor
void setupJets()
initialize jet inputs
std::vector< TtFullHadKinFitter::Constraint > constraints(std::vector< unsigned int > &configParameters)
bool next_combination(BidIt n_begin, BidIt n_end, BidIt r_begin, BidIt r_end)
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
pat::Jet getCalHadbbar() const
double mTop_
top mass value used for constraints
KinFit()
default constructor
virtual double py() const
y coordinate of momentum vector
TAbsFitParticle * lightPBar_
double maxF_
maximal allowed distance from constraints