CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
TtSemiLepKinFitter Class Reference

#include <TtSemiLepKinFitter.h>

Inheritance diagram for TtSemiLepKinFitter:
TopKinFitter

Public Types

enum  Constraint {
  kWHadMass = 1, kWLepMass, kTopHadMass, kTopLepMass,
  kNeutrinoMass, kEqualTopMasses, kSumPt
}
 supported constraints More...
 
- Public Types inherited from TopKinFitter
enum  Param { kEMom, kEtEtaPhi, kEtThetaPhi }
 supported parameterizations More...
 

Public Member Functions

TtSemiEvtSolution addKinFitInfo (TtSemiEvtSolution *asol)
 add kin fit information to the old event solution (in for legacy reasons) More...
 
template<class LeptonType >
int fit (const std::vector< pat::Jet > &jets, const pat::Lepton< LeptonType > &leps, const pat::MET &met)
 kinematic fit interface for PAT objects More...
 
int fit (const TLorentzVector &p4HadP, const TLorentzVector &p4HadQ, const TLorentzVector &p4HadB, const TLorentzVector &p4LepB, const TLorentzVector &p4Lepton, const TLorentzVector &p4Neutrino, const int leptonCharge, const CovarianceMatrix::ObjectType leptonType)
 kinematic fit interface for plain 4-vecs More...
 
int fit (const TLorentzVector &p4HadP, const TLorentzVector &p4HadQ, const TLorentzVector &p4HadB, const TLorentzVector &p4LepB, const TLorentzVector &p4Lepton, const TLorentzVector &p4Neutrino, const TMatrixD &covHadP, const TMatrixD &covHadQ, const TMatrixD &covHadB, const TMatrixD &covLepB, const TMatrixD &covLepton, const TMatrixD &covNeutrino, const int leptonCharge)
 common core of the fit interface More...
 
const pat::Particle fittedHadB () const
 return hadronic b quark candidate More...
 
const pat::Particle fittedHadP () const
 return hadronic light quark candidate More...
 
const pat::Particle fittedHadQ () const
 return hadronic light quark candidate More...
 
const pat::Particle fittedLepB () const
 return leptonic b quark candidate More...
 
const pat::Particle fittedLepton () const
 return lepton candidate More...
 
const pat::Particle fittedNeutrino () const
 return neutrino candidate More...
 
 TtSemiLepKinFitter ()
 default constructor More...
 
 TtSemiLepKinFitter (Param jetParam, Param lepParam, Param metParam, int maxNrIter, double maxDeltaS, double maxF, const std::vector< Constraint > &constraints, double mW=80.4, double mTop=173., const std::vector< edm::ParameterSet > *udscResolutions=nullptr, const std::vector< edm::ParameterSet > *bResolutions=nullptr, const std::vector< edm::ParameterSet > *lepResolutions=nullptr, const std::vector< edm::ParameterSet > *metResolutions=nullptr, const std::vector< double > *jetEnergyResolutionScaleFactors=nullptr, const std::vector< double > *jetEnergyResolutionEtaBinning=nullptr)
 constructor initialized with built-in types and class enum's custom parameters More...
 
 ~TtSemiLepKinFitter ()
 default destructor More...
 
- Public Member Functions inherited from TopKinFitter
int fitNrIter () const
 return number of used iterations More...
 
double fitProb () const
 return fit probability More...
 
double fitS () const
 return chi2 of fit (not normalized to degrees of freedom) More...
 
void setVerbosity (const int verbosityLevel)
 allows to change the verbosity of the TKinFitter More...
 
 TopKinFitter (const int maxNrIter=200, const double maxDeltaS=5e-5, const double maxF=1e-4, const double mW=80.4, const double mTop=173.)
 default constructor More...
 
 ~TopKinFitter ()
 default destructor More...
 

Private Member Functions

void printSetup () const
 print fitter setup More...
 
void setupConstraints ()
 initialize constraints More...
 
void setupFitter ()
 setup fitter More...
 
void setupJets ()
 initialize jet inputs More...
 
void setupLeptons ()
 initialize lepton inputs More...
 

Private Attributes

const std::vector< edm::ParameterSet > * bResolutions_ = nullptr
 
bool constrainSumPt_
 internally use simple boolean for this constraint to reduce the per-event computing time More...
 
std::vector< ConstraintconstrList_
 vector of constraints to be used More...
 
std::unique_ptr< CovarianceMatrixcovM_
 object used to construct the covariance matrices for the individual particles More...
 
pat::Particle fittedHadB_
 output particles More...
 
pat::Particle fittedHadP_
 
pat::Particle fittedHadQ_
 
pat::Particle fittedLepB_
 
pat::Particle fittedLepton_
 
pat::Particle fittedNeutrino_
 
std::unique_ptr< TAbsFitParticlehadB_
 input particles More...
 
std::unique_ptr< TAbsFitParticlehadP_
 
std::unique_ptr< TAbsFitParticlehadQ_
 
const std::vector< double > * jetEnergyResolutionEtaBinning_ = nullptr
 
const std::vector< double > * jetEnergyResolutionScaleFactors_ = nullptr
 scale factors for the jet energy resolution More...
 
Param jetParam_
 jet parametrization More...
 
std::unique_ptr< TAbsFitParticlelepB_
 
Param lepParam_
 lepton parametrization More...
 
const std::vector< edm::ParameterSet > * lepResolutions_ = nullptr
 
std::unique_ptr< TAbsFitParticlelepton_
 
std::map< Constraint, std::unique_ptr< TFitConstraintM > > massConstr_
 supported constraints More...
 
Param metParam_
 met parametrization More...
 
const std::vector< edm::ParameterSet > * metResolutions_ = nullptr
 
std::unique_ptr< TAbsFitParticleneutrino_
 
std::unique_ptr< TFitConstraintEpsumPxConstr_
 
std::unique_ptr< TFitConstraintEpsumPyConstr_
 
const std::vector< edm::ParameterSet > * udscResolutions_ = nullptr
 resolutions More...
 

Additional Inherited Members

- Protected Member Functions inherited from TopKinFitter
std::string param (const Param &param) const
 convert Param to human readable form More...
 
- Protected Attributes inherited from TopKinFitter
std::unique_ptr< TKinFitterfitter_
 kinematic fitter More...
 
double maxDeltaS_
 maximal allowed chi2 (not normalized to degrees of freedom) More...
 
double maxF_
 maximal allowed distance from constraints More...
 
int maxNrIter_
 maximal allowed number of iterations to be used for the fit More...
 
double mTop_
 top mass value used for constraints More...
 
double mW_
 W mass value used for constraints. More...
 

Detailed Description

Definition at line 32 of file TtSemiLepKinFitter.h.

Member Enumeration Documentation

◆ Constraint

Constructor & Destructor Documentation

◆ TtSemiLepKinFitter() [1/2]

TtSemiLepKinFitter::TtSemiLepKinFitter ( )
explicit

default constructor

default configuration is: Parametrization kEMom, Max iterations = 200, deltaS<= 5e-5, maxF<= 1e-4, no constraints

Definition at line 15 of file TtSemiLepKinFitter.cc.

References setupFitter().

16  setupFitter();
17 }
TopKinFitter(const int maxNrIter=200, const double maxDeltaS=5e-5, const double maxF=1e-4, const double mW=80.4, const double mTop=173.)
default constructor
Definition: TopKinFitter.cc:4
Param lepParam_
lepton parametrization
Param jetParam_
jet parametrization
Param metParam_
met parametrization
void setupFitter()
setup fitter

◆ TtSemiLepKinFitter() [2/2]

TtSemiLepKinFitter::TtSemiLepKinFitter ( Param  jetParam,
Param  lepParam,
Param  metParam,
int  maxNrIter,
double  maxDeltaS,
double  maxF,
const std::vector< Constraint > &  constraints,
double  mW = 80.4,
double  mTop = 173.,
const std::vector< edm::ParameterSet > *  udscResolutions = nullptr,
const std::vector< edm::ParameterSet > *  bResolutions = nullptr,
const std::vector< edm::ParameterSet > *  lepResolutions = nullptr,
const std::vector< edm::ParameterSet > *  metResolutions = nullptr,
const std::vector< double > *  jetEnergyResolutionScaleFactors = nullptr,
const std::vector< double > *  jetEnergyResolutionEtaBinning = nullptr 
)
explicit

constructor initialized with built-in types and class enum's custom parameters

Definition at line 19 of file TtSemiLepKinFitter.cc.

References setupFitter().

37  lepResolutions_(lepResolutions),
38  metResolutions_(metResolutions),
41  jetParam_(jetParam),
42  lepParam_(lepParam),
43  metParam_(metParam),
45  setupFitter();
46 }
const std::vector< edm::ParameterSet > * udscResolutions_
resolutions
TopKinFitter(const int maxNrIter=200, const double maxDeltaS=5e-5, const double maxF=1e-4, const double mW=80.4, const double mTop=173.)
default constructor
Definition: TopKinFitter.cc:4
Param lepParam_
lepton parametrization
const std::vector< edm::ParameterSet > * bResolutions_
const std::vector< edm::ParameterSet > * lepResolutions_
const std::vector< double > * jetEnergyResolutionScaleFactors_
scale factors for the jet energy resolution
Param jetParam_
jet parametrization
Param metParam_
met parametrization
std::vector< Constraint > constrList_
vector of constraints to be used
void setupFitter()
setup fitter
const std::vector< double > * jetEnergyResolutionEtaBinning_
const std::vector< edm::ParameterSet > * metResolutions_

◆ ~TtSemiLepKinFitter()

TtSemiLepKinFitter::~TtSemiLepKinFitter ( )
default

default destructor

Member Function Documentation

◆ addKinFitInfo()

TtSemiEvtSolution TtSemiLepKinFitter::addKinFitInfo ( TtSemiEvtSolution asol)

add kin fit information to the old event solution (in for legacy reasons)

Definition at line 318 of file TtSemiLepKinFitter.cc.

References fit(), TopKinFitter::fitProb(), fittedHadB(), fittedHadP(), fittedHadQ(), fittedLepB(), fittedLepton(), fittedNeutrino(), TopKinFitter::fitter_, TtSemiEvtSolution::getCalHadb(), TtSemiEvtSolution::getCalHadp(), TtSemiEvtSolution::getCalHadq(), TtSemiEvtSolution::getCalLepb(), TtSemiEvtSolution::getCalLepe(), TtSemiEvtSolution::getCalLepm(), TtSemiEvtSolution::getCalLepn(), TtSemiEvtSolution::getDecay(), TtSemiLepEvtPartons::HadB, PDWG_EXODelayedJetMET_cff::jets, TtSemiLepEvtPartons::LepB, TtSemiLepEvtPartons::LightQ, TtSemiLepEvtPartons::LightQBar, TtSemiEvtSolution::setFitHadb(), TtSemiEvtSolution::setFitHadp(), TtSemiEvtSolution::setFitHadq(), TtSemiEvtSolution::setFitLepb(), TtSemiEvtSolution::setFitLepl(), TtSemiEvtSolution::setFitLepn(), and TtSemiEvtSolution::setProbChi2().

Referenced by TtSemiEvtSolutionMaker::produce().

318  {
319  TtSemiEvtSolution fitsol(*asol);
320 
321  std::vector<pat::Jet> jets;
322  jets.resize(4);
323  jets[TtSemiLepEvtPartons::LightQ] = fitsol.getCalHadp();
324  jets[TtSemiLepEvtPartons::LightQBar] = fitsol.getCalHadq();
325  jets[TtSemiLepEvtPartons::HadB] = fitsol.getCalHadb();
326  jets[TtSemiLepEvtPartons::LepB] = fitsol.getCalLepb();
327 
328  // perform the fit, either using the electron or the muon
329  if (fitsol.getDecay() == "electron")
330  fit(jets, fitsol.getCalLepe(), fitsol.getCalLepn());
331  if (fitsol.getDecay() == "muon")
332  fit(jets, fitsol.getCalLepm(), fitsol.getCalLepn());
333 
334  // add fitted information to the solution
335  if (fitter_->getStatus() == 0) {
336  // fill the fitted particles
337  fitsol.setFitHadb(fittedHadB());
338  fitsol.setFitHadp(fittedHadP());
339  fitsol.setFitHadq(fittedHadQ());
340  fitsol.setFitLepb(fittedLepB());
341  fitsol.setFitLepl(fittedLepton());
342  fitsol.setFitLepn(fittedNeutrino());
343  // store the fit's chi2 probability
344  fitsol.setProbChi2(fitProb());
345  }
346  return fitsol;
347 }
std::unique_ptr< TKinFitter > fitter_
kinematic fitter
Definition: TopKinFitter.h:49
const pat::Particle fittedHadQ() const
return hadronic light quark candidate
const pat::Particle fittedNeutrino() const
return neutrino candidate
int fit(const std::vector< pat::Jet > &jets, const pat::Lepton< LeptonType > &leps, const pat::MET &met)
kinematic fit interface for PAT objects
const pat::Particle fittedLepB() const
return leptonic b quark candidate
double fitProb() const
return fit probability
Definition: TopKinFitter.h:39
const pat::Particle fittedHadP() const
return hadronic light quark candidate
const pat::Particle fittedHadB() const
return hadronic b quark candidate
const pat::Particle fittedLepton() const
return lepton candidate

◆ fit() [1/3]

template<class LeptonType >
int TtSemiLepKinFitter::fit ( const std::vector< pat::Jet > &  jets,
const pat::Lepton< LeptonType > &  leps,
const pat::MET met 
)

kinematic fit interface for PAT objects

Definition at line 156 of file TtSemiLepKinFitter.h.

References edm::errors::Configuration, covM_, reco::LeafCandidate::energy(), reco::LeafCandidate::et(), TtSemiLepEvtPartons::HadB, jetParam_, PDWG_EXODelayedJetMET_cff::jets, TtSemiLepEvtPartons::LepB, lepParam_, TtSemiLepEvtPartons::LightQ, TtSemiLepEvtPartons::LightQBar, metParam_, reco::LeafCandidate::px(), reco::LeafCandidate::py(), and reco::LeafCandidate::pz().

Referenced by addKinFitInfo(), fit(), and trackingPlots.Iteration::modules().

158  {
159  if (jets.size() < 4)
160  throw edm::Exception(edm::errors::Configuration, "Cannot run the TtSemiLepKinFitter with less than 4 jets");
161 
162  // get jets in right order
167 
168  // initialize particles
169  const TLorentzVector p4HadP(hadP.px(), hadP.py(), hadP.pz(), hadP.energy());
170  const TLorentzVector p4HadQ(hadQ.px(), hadQ.py(), hadQ.pz(), hadQ.energy());
171  const TLorentzVector p4HadB(hadB.px(), hadB.py(), hadB.pz(), hadB.energy());
172  const TLorentzVector p4LepB(lepB.px(), lepB.py(), lepB.pz(), lepB.energy());
173  const TLorentzVector p4Lepton(lepton.px(), lepton.py(), lepton.pz(), lepton.energy());
174  const TLorentzVector p4Neutrino(neutrino.px(), neutrino.py(), 0, neutrino.et());
175 
176  // initialize covariance matrices
177  TMatrixD covHadP = covM_->setupMatrix(hadP, jetParam_);
178  TMatrixD covHadQ = covM_->setupMatrix(hadQ, jetParam_);
179  TMatrixD covHadB = covM_->setupMatrix(hadB, jetParam_, "bjets");
180  TMatrixD covLepB = covM_->setupMatrix(lepB, jetParam_, "bjets");
181  TMatrixD covLepton = covM_->setupMatrix(lepton, lepParam_);
182  TMatrixD covNeutrino = covM_->setupMatrix(neutrino, metParam_);
183 
184  // now do the part that is fully independent of PAT features
185  return fit(p4HadP,
186  p4HadQ,
187  p4HadB,
188  p4LepB,
189  p4Lepton,
190  p4Neutrino,
191  covHadP,
192  covHadQ,
193  covHadB,
194  covLepB,
195  covLepton,
196  covNeutrino,
197  lepton.charge());
198 }
double pz() const final
z coordinate of momentum vector
Param lepParam_
lepton parametrization
double px() const final
x coordinate of momentum vector
int fit(const std::vector< pat::Jet > &jets, const pat::Lepton< LeptonType > &leps, const pat::MET &met)
kinematic fit interface for PAT objects
Param jetParam_
jet parametrization
double py() const final
y coordinate of momentum vector
Param metParam_
met parametrization
Analysis-level calorimeter jet class.
Definition: Jet.h:77
std::unique_ptr< CovarianceMatrix > covM_
object used to construct the covariance matrices for the individual particles
double energy() const final
energy

◆ fit() [2/3]

int TtSemiLepKinFitter::fit ( const TLorentzVector &  p4HadP,
const TLorentzVector &  p4HadQ,
const TLorentzVector &  p4HadB,
const TLorentzVector &  p4LepB,
const TLorentzVector &  p4Lepton,
const TLorentzVector &  p4Neutrino,
const int  leptonCharge,
const CovarianceMatrix::ObjectType  leptonType 
)

kinematic fit interface for plain 4-vecs

Definition at line 204 of file TtSemiLepKinFitter.cc.

References covM_, fit(), jetParam_, CovarianceMatrix::kBJet, CovarianceMatrix::kMet, CovarianceMatrix::kUdscJet, lepParam_, objects.autophobj::leptonType, and metParam_.

Referenced by trackingPlots.Iteration::modules().

211  {
212  // initialize covariance matrices
213  TMatrixD covHadP = covM_->setupMatrix(p4HadP, CovarianceMatrix::kUdscJet, jetParam_);
214  TMatrixD covHadQ = covM_->setupMatrix(p4HadQ, CovarianceMatrix::kUdscJet, jetParam_);
215  TMatrixD covHadB = covM_->setupMatrix(p4HadB, CovarianceMatrix::kBJet, jetParam_);
216  TMatrixD covLepB = covM_->setupMatrix(p4LepB, CovarianceMatrix::kBJet, jetParam_);
217  TMatrixD covLepton = covM_->setupMatrix(p4Lepton, leptonType, lepParam_);
218  TMatrixD covNeutrino = covM_->setupMatrix(p4Neutrino, CovarianceMatrix::kMet, metParam_);
219 
220  // now do the part that is fully independent of PAT features
221  return fit(p4HadP,
222  p4HadQ,
223  p4HadB,
224  p4LepB,
225  p4Lepton,
226  p4Neutrino,
227  covHadP,
228  covHadQ,
229  covHadB,
230  covLepB,
231  covLepton,
232  covNeutrino,
233  leptonCharge);
234 }
Param lepParam_
lepton parametrization
leptonType
LEPTON
Definition: autophobj.py:48
int fit(const std::vector< pat::Jet > &jets, const pat::Lepton< LeptonType > &leps, const pat::MET &met)
kinematic fit interface for PAT objects
Param jetParam_
jet parametrization
Param metParam_
met parametrization
std::unique_ptr< CovarianceMatrix > covM_
object used to construct the covariance matrices for the individual particles

◆ fit() [3/3]

int TtSemiLepKinFitter::fit ( const TLorentzVector &  p4HadP,
const TLorentzVector &  p4HadQ,
const TLorentzVector &  p4HadB,
const TLorentzVector &  p4LepB,
const TLorentzVector &  p4Lepton,
const TLorentzVector &  p4Neutrino,
const TMatrixD &  covHadP,
const TMatrixD &  covHadQ,
const TMatrixD &  covHadB,
const TMatrixD &  covLepB,
const TMatrixD &  covLepton,
const TMatrixD &  covNeutrino,
const int  leptonCharge 
)

common core of the fit interface

Definition at line 236 of file TtSemiLepKinFitter.cc.

References constrainSumPt_, fittedHadB_, fittedHadP_, fittedHadQ_, fittedLepB_, fittedLepton_, fittedNeutrino_, TopKinFitter::fitter_, hadB_, hadP_, hadQ_, lepB_, lepton_, neutrino_, sumPxConstr_, and sumPyConstr_.

Referenced by trackingPlots.Iteration::modules().

248  {
249  // set the kinematics of the objects to be fitted
250  hadP_->setIni4Vec(&p4HadP);
251  hadQ_->setIni4Vec(&p4HadQ);
252  hadB_->setIni4Vec(&p4HadB);
253  lepB_->setIni4Vec(&p4LepB);
254  lepton_->setIni4Vec(&p4Lepton);
255  neutrino_->setIni4Vec(&p4Neutrino);
256 
257  hadP_->setCovMatrix(&covHadP);
258  hadQ_->setCovMatrix(&covHadQ);
259  hadB_->setCovMatrix(&covHadB);
260  lepB_->setCovMatrix(&covLepB);
261  lepton_->setCovMatrix(&covLepton);
262  neutrino_->setCovMatrix(&covNeutrino);
263 
264  if (constrainSumPt_) {
265  // setup Px and Py constraint for curent event configuration so that sum Pt will be conserved
266  sumPxConstr_->setConstraint(p4HadP.Px() + p4HadQ.Px() + p4HadB.Px() + p4LepB.Px() + p4Lepton.Px() +
267  p4Neutrino.Px());
268  sumPyConstr_->setConstraint(p4HadP.Py() + p4HadQ.Py() + p4HadB.Py() + p4LepB.Py() + p4Lepton.Py() +
269  p4Neutrino.Py());
270  }
271 
272  // now do the fit
273  fitter_->fit();
274 
275  // read back the resulting particles if the fit converged
276  if (fitter_->getStatus() == 0) {
277  // read back jet kinematics
279  0,
281  hadP_->getCurr4Vec()->X(), hadP_->getCurr4Vec()->Y(), hadP_->getCurr4Vec()->Z(), hadP_->getCurr4Vec()->E()),
282  math::XYZPoint()));
284  0,
286  hadQ_->getCurr4Vec()->X(), hadQ_->getCurr4Vec()->Y(), hadQ_->getCurr4Vec()->Z(), hadQ_->getCurr4Vec()->E()),
287  math::XYZPoint()));
289  0,
291  hadB_->getCurr4Vec()->X(), hadB_->getCurr4Vec()->Y(), hadB_->getCurr4Vec()->Z(), hadB_->getCurr4Vec()->E()),
292  math::XYZPoint()));
294  0,
296  lepB_->getCurr4Vec()->X(), lepB_->getCurr4Vec()->Y(), lepB_->getCurr4Vec()->Z(), lepB_->getCurr4Vec()->E()),
297  math::XYZPoint()));
298 
299  // read back lepton kinematics
301  math::XYZTLorentzVector(lepton_->getCurr4Vec()->X(),
302  lepton_->getCurr4Vec()->Y(),
303  lepton_->getCurr4Vec()->Z(),
304  lepton_->getCurr4Vec()->E()),
305  math::XYZPoint()));
306 
307  // read back the MET kinematics
309  math::XYZTLorentzVector(neutrino_->getCurr4Vec()->X(),
310  neutrino_->getCurr4Vec()->Y(),
311  neutrino_->getCurr4Vec()->Z(),
312  neutrino_->getCurr4Vec()->E()),
313  math::XYZPoint()));
314  }
315  return fitter_->getStatus();
316 }
std::unique_ptr< TAbsFitParticle > hadQ_
std::unique_ptr< TKinFitter > fitter_
kinematic fitter
Definition: TopKinFitter.h:49
std::unique_ptr< TAbsFitParticle > neutrino_
bool constrainSumPt_
internally use simple boolean for this constraint to reduce the per-event computing time ...
std::unique_ptr< TAbsFitParticle > lepton_
pat::Particle fittedHadP_
pat::Particle fittedLepB_
pat::Particle fittedHadB_
output particles
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
pat::Particle fittedLepton_
std::unique_ptr< TFitConstraintEp > sumPyConstr_
pat::Particle fittedHadQ_
std::unique_ptr< TAbsFitParticle > lepB_
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
Analysis-level particle class.
Definition: Particle.h:30
std::unique_ptr< TFitConstraintEp > sumPxConstr_
std::unique_ptr< TAbsFitParticle > hadB_
input particles
pat::Particle fittedNeutrino_
std::unique_ptr< TAbsFitParticle > hadP_

◆ fittedHadB()

const pat::Particle TtSemiLepKinFitter::fittedHadB ( ) const
inline

return hadronic b quark candidate

Definition at line 86 of file TtSemiLepKinFitter.h.

References fittedHadB_, and TopKinFitter::fitter_.

Referenced by addKinFitInfo().

86 { return (fitter_->getStatus() == 0 ? fittedHadB_ : pat::Particle()); };
std::unique_ptr< TKinFitter > fitter_
kinematic fitter
Definition: TopKinFitter.h:49
pat::Particle fittedHadB_
output particles
Analysis-level particle class.
Definition: Particle.h:30

◆ fittedHadP()

const pat::Particle TtSemiLepKinFitter::fittedHadP ( ) const
inline

return hadronic light quark candidate

Definition at line 88 of file TtSemiLepKinFitter.h.

References fittedHadP_, and TopKinFitter::fitter_.

Referenced by addKinFitInfo().

88 { return (fitter_->getStatus() == 0 ? fittedHadP_ : pat::Particle()); };
std::unique_ptr< TKinFitter > fitter_
kinematic fitter
Definition: TopKinFitter.h:49
pat::Particle fittedHadP_
Analysis-level particle class.
Definition: Particle.h:30

◆ fittedHadQ()

const pat::Particle TtSemiLepKinFitter::fittedHadQ ( ) const
inline

return hadronic light quark candidate

Definition at line 90 of file TtSemiLepKinFitter.h.

References fittedHadQ_, and TopKinFitter::fitter_.

Referenced by addKinFitInfo().

90 { return (fitter_->getStatus() == 0 ? fittedHadQ_ : pat::Particle()); };
std::unique_ptr< TKinFitter > fitter_
kinematic fitter
Definition: TopKinFitter.h:49
pat::Particle fittedHadQ_
Analysis-level particle class.
Definition: Particle.h:30

◆ fittedLepB()

const pat::Particle TtSemiLepKinFitter::fittedLepB ( ) const
inline

return leptonic b quark candidate

Definition at line 92 of file TtSemiLepKinFitter.h.

References fittedLepB_, and TopKinFitter::fitter_.

Referenced by addKinFitInfo().

92 { return (fitter_->getStatus() == 0 ? fittedLepB_ : pat::Particle()); };
std::unique_ptr< TKinFitter > fitter_
kinematic fitter
Definition: TopKinFitter.h:49
pat::Particle fittedLepB_
Analysis-level particle class.
Definition: Particle.h:30

◆ fittedLepton()

const pat::Particle TtSemiLepKinFitter::fittedLepton ( ) const
inline

return lepton candidate

Definition at line 94 of file TtSemiLepKinFitter.h.

References fittedLepton_, and TopKinFitter::fitter_.

Referenced by addKinFitInfo().

94 { return (fitter_->getStatus() == 0 ? fittedLepton_ : pat::Particle()); };
std::unique_ptr< TKinFitter > fitter_
kinematic fitter
Definition: TopKinFitter.h:49
pat::Particle fittedLepton_
Analysis-level particle class.
Definition: Particle.h:30

◆ fittedNeutrino()

const pat::Particle TtSemiLepKinFitter::fittedNeutrino ( ) const
inline

return neutrino candidate

Definition at line 96 of file TtSemiLepKinFitter.h.

References fittedNeutrino_, and TopKinFitter::fitter_.

Referenced by addKinFitInfo().

96  {
97  return (fitter_->getStatus() == 0 ? fittedNeutrino_ : pat::Particle());
98  };
std::unique_ptr< TKinFitter > fitter_
kinematic fitter
Definition: TopKinFitter.h:49
Analysis-level particle class.
Definition: Particle.h:30
pat::Particle fittedNeutrino_

◆ printSetup()

void TtSemiLepKinFitter::printSetup ( ) const
private

print fitter setup

Definition at line 50 of file TtSemiLepKinFitter.cc.

References constrList_, mps_fire::i, jetParam_, kEqualTopMasses, kNeutrinoMass, kSumPt, kTopHadMass, kTopLepMass, kWHadMass, kWLepMass, lepParam_, TopKinFitter::maxDeltaS_, TopKinFitter::maxF_, TopKinFitter::maxNrIter_, metParam_, TopKinFitter::mTop_, TopKinFitter::mW_, and TopKinFitter::param().

Referenced by setupFitter().

50  {
51  std::stringstream constr;
52  for (unsigned int i = 0; i < constrList_.size(); ++i) {
53  switch (constrList_[i]) {
54  case kWHadMass:
55  constr << " * hadronic W-mass (" << mW_ << " GeV) \n";
56  break;
57  case kWLepMass:
58  constr << " * leptonic W-mass (" << mW_ << " GeV) \n";
59  break;
60  case kTopHadMass:
61  constr << " * hadronic t-mass (" << mTop_ << " GeV) \n";
62  break;
63  case kTopLepMass:
64  constr << " * leptonic t-mass (" << mTop_ << " GeV) \n";
65  break;
66  case kNeutrinoMass:
67  constr << " * neutrino mass (0 GeV) \n";
68  break;
69  case kEqualTopMasses:
70  constr << " * equal t-masses \n";
71  break;
72  case kSumPt:
73  constr << " * summed transverse momentum \n";
74  break;
75  }
76  }
77  edm::LogVerbatim("TtSemiLepKinFitter") << "\n"
78  << "+++++++++++ TtSemiLepKinFitter Setup ++++++++++++ \n"
79  << " Parametrization: \n"
80  << " * jet : " << param(jetParam_) << "\n"
81  << " * lep : " << param(lepParam_) << "\n"
82  << " * met : " << param(metParam_) << "\n"
83  << " Constraints: \n"
84  << constr.str() << " Max(No iterations): " << maxNrIter_ << "\n"
85  << " Max(deltaS) : " << maxDeltaS_ << "\n"
86  << " Max(F) : " << maxF_ << "\n"
87  << "+++++++++++++++++++++++++++++++++++++++++++++++++ \n";
88 }
std::string param(const Param &param) const
convert Param to human readable form
Definition: TopKinFitter.cc:18
Log< level::Info, true > LogVerbatim
int maxNrIter_
maximal allowed number of iterations to be used for the fit
Definition: TopKinFitter.h:51
Param lepParam_
lepton parametrization
Param jetParam_
jet parametrization
double mW_
W mass value used for constraints.
Definition: TopKinFitter.h:57
Param metParam_
met parametrization
double maxDeltaS_
maximal allowed chi2 (not normalized to degrees of freedom)
Definition: TopKinFitter.h:53
std::vector< Constraint > constrList_
vector of constraints to be used
double mTop_
top mass value used for constraints
Definition: TopKinFitter.h:59
double maxF_
maximal allowed distance from constraints
Definition: TopKinFitter.h:55

◆ setupConstraints()

void TtSemiLepKinFitter::setupConstraints ( )
private

initialize constraints

Definition at line 141 of file TtSemiLepKinFitter.cc.

References constrainSumPt_, constrList_, spr::find(), hadB_, hadP_, hadQ_, kEqualTopMasses, kNeutrinoMass, kSumPt, kTopHadMass, kTopLepMass, kWHadMass, kWLepMass, lepB_, lepton_, massConstr_, TopKinFitter::mTop_, TopKinFitter::mW_, neutrino_, TFitConstraintEp::pX, TFitConstraintEp::pY, sumPxConstr_, and sumPyConstr_.

Referenced by setupFitter().

141  {
142  massConstr_[kWHadMass] = std::make_unique<TFitConstraintM>("WMassHad", "WMassHad", nullptr, nullptr, mW_);
143  massConstr_[kWLepMass] = std::make_unique<TFitConstraintM>("WMassLep", "WMassLep", nullptr, nullptr, mW_);
144  massConstr_[kTopHadMass] = std::make_unique<TFitConstraintM>("TopMassHad", "TopMassHad", nullptr, nullptr, mTop_);
145  massConstr_[kTopLepMass] = std::make_unique<TFitConstraintM>("TopMassLep", "TopMassLep", nullptr, nullptr, mTop_);
146  massConstr_[kNeutrinoMass] = std::make_unique<TFitConstraintM>("NeutrinoMass", "NeutrinoMass", nullptr, nullptr, 0.);
148  std::make_unique<TFitConstraintM>("EqualTopMasses", "EqualTopMasses", nullptr, nullptr, 0.);
149  sumPxConstr_ = std::make_unique<TFitConstraintEp>("SumPx", "SumPx", nullptr, TFitConstraintEp::pX, 0.);
150  sumPyConstr_ = std::make_unique<TFitConstraintEp>("SumPy", "SumPy", nullptr, TFitConstraintEp::pY, 0.);
151 
152  massConstr_[kWHadMass]->addParticles1(hadP_.get(), hadQ_.get());
153  massConstr_[kWLepMass]->addParticles1(lepton_.get(), neutrino_.get());
154  massConstr_[kTopHadMass]->addParticles1(hadP_.get(), hadQ_.get(), hadB_.get());
155  massConstr_[kTopLepMass]->addParticles1(lepton_.get(), neutrino_.get(), lepB_.get());
156  massConstr_[kNeutrinoMass]->addParticle1(neutrino_.get());
157  massConstr_[kEqualTopMasses]->addParticles1(hadP_.get(), hadQ_.get(), hadB_.get());
158  massConstr_[kEqualTopMasses]->addParticles2(lepton_.get(), neutrino_.get(), lepB_.get());
159  sumPxConstr_->addParticles(lepton_.get(), neutrino_.get(), hadP_.get(), hadQ_.get(), hadB_.get(), lepB_.get());
160  sumPyConstr_->addParticles(lepton_.get(), neutrino_.get(), hadP_.get(), hadQ_.get(), hadB_.get(), lepB_.get());
161 
162  if (std::find(constrList_.begin(), constrList_.end(), kSumPt) != constrList_.end())
163  constrainSumPt_ = true;
164  constrainSumPt_ = false;
165 }
std::map< Constraint, std::unique_ptr< TFitConstraintM > > massConstr_
supported constraints
std::unique_ptr< TAbsFitParticle > hadQ_
std::unique_ptr< TAbsFitParticle > neutrino_
bool constrainSumPt_
internally use simple boolean for this constraint to reduce the per-event computing time ...
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::unique_ptr< TAbsFitParticle > lepton_
std::unique_ptr< TFitConstraintEp > sumPyConstr_
double mW_
W mass value used for constraints.
Definition: TopKinFitter.h:57
std::vector< Constraint > constrList_
vector of constraints to be used
std::unique_ptr< TAbsFitParticle > lepB_
std::unique_ptr< TFitConstraintEp > sumPxConstr_
std::unique_ptr< TAbsFitParticle > hadB_
input particles
std::unique_ptr< TAbsFitParticle > hadP_
double mTop_
top mass value used for constraints
Definition: TopKinFitter.h:59

◆ setupFitter()

void TtSemiLepKinFitter::setupFitter ( )
private

setup fitter

Definition at line 167 of file TtSemiLepKinFitter.cc.

References bResolutions_, constrainSumPt_, constrList_, covM_, TopKinFitter::fitter_, hadB_, hadP_, hadQ_, mps_fire::i, jetEnergyResolutionEtaBinning_, jetEnergyResolutionScaleFactors_, kSumPt, lepB_, lepResolutions_, lepton_, massConstr_, metResolutions_, neutrino_, printSetup(), setupConstraints(), setupJets(), setupLeptons(), sumPxConstr_, sumPyConstr_, and udscResolutions_.

Referenced by TtSemiLepKinFitter().

167  {
168  printSetup();
169 
170  setupJets();
171  setupLeptons();
173 
174  // add measured particles
175  fitter_->addMeasParticle(hadB_.get());
176  fitter_->addMeasParticle(hadP_.get());
177  fitter_->addMeasParticle(hadQ_.get());
178  fitter_->addMeasParticle(lepB_.get());
179  fitter_->addMeasParticle(lepton_.get());
180  fitter_->addMeasParticle(neutrino_.get());
181 
182  // add constraints
183  for (unsigned int i = 0; i < constrList_.size(); i++) {
184  if (constrList_[i] != kSumPt)
185  fitter_->addConstraint(massConstr_[constrList_[i]].get());
186  }
187  if (constrainSumPt_) {
188  fitter_->addConstraint(sumPxConstr_.get());
189  fitter_->addConstraint(sumPyConstr_.get());
190  }
191 
192  // initialize helper class used to bring the resolutions into covariance matrices
193  if (!udscResolutions_->empty() && !bResolutions_->empty() && !lepResolutions_->empty() && !metResolutions_->empty())
194  covM_ = std::make_unique<CovarianceMatrix>(*udscResolutions_,
195  *bResolutions_,
200  else
201  covM_ = std::make_unique<CovarianceMatrix>();
202 }
std::map< Constraint, std::unique_ptr< TFitConstraintM > > massConstr_
supported constraints
std::unique_ptr< TAbsFitParticle > hadQ_
const std::vector< edm::ParameterSet > * udscResolutions_
resolutions
void printSetup() const
print fitter setup
std::unique_ptr< TKinFitter > fitter_
kinematic fitter
Definition: TopKinFitter.h:49
std::unique_ptr< TAbsFitParticle > neutrino_
bool constrainSumPt_
internally use simple boolean for this constraint to reduce the per-event computing time ...
std::unique_ptr< TAbsFitParticle > lepton_
const std::vector< edm::ParameterSet > * bResolutions_
void setupJets()
initialize jet inputs
const std::vector< edm::ParameterSet > * lepResolutions_
const std::vector< double > * jetEnergyResolutionScaleFactors_
scale factors for the jet energy resolution
std::unique_ptr< TFitConstraintEp > sumPyConstr_
void setupConstraints()
initialize constraints
std::vector< Constraint > constrList_
vector of constraints to be used
std::unique_ptr< TAbsFitParticle > lepB_
void setupLeptons()
initialize lepton inputs
std::unique_ptr< TFitConstraintEp > sumPxConstr_
std::unique_ptr< TAbsFitParticle > hadB_
input particles
const std::vector< double > * jetEnergyResolutionEtaBinning_
std::unique_ptr< CovarianceMatrix > covM_
object used to construct the covariance matrices for the individual particles
std::unique_ptr< TAbsFitParticle > hadP_
const std::vector< edm::ParameterSet > * metResolutions_

◆ setupJets()

void TtSemiLepKinFitter::setupJets ( )
private

initialize jet inputs

Definition at line 90 of file TtSemiLepKinFitter.cc.

References hadB_, hadP_, hadQ_, jetParam_, TopKinFitter::kEMom, TopKinFitter::kEtEtaPhi, TopKinFitter::kEtThetaPhi, and lepB_.

Referenced by setupFitter().

90  {
91  TMatrixD empty3x3(3, 3);
92  TMatrixD empty4x4(4, 4);
93  switch (jetParam_) { // setup jets according to parameterization
94  case kEMom:
95  hadB_ = std::make_unique<TFitParticleEMomDev>("Jet1", "Jet1", nullptr, &empty4x4);
96  hadP_ = std::make_unique<TFitParticleEMomDev>("Jet2", "Jet2", nullptr, &empty4x4);
97  hadQ_ = std::make_unique<TFitParticleEMomDev>("Jet3", "Jet3", nullptr, &empty4x4);
98  lepB_ = std::make_unique<TFitParticleEMomDev>("Jet4", "Jet4", nullptr, &empty4x4);
99  break;
100  case kEtEtaPhi:
101  hadB_ = std::make_unique<TFitParticleEtEtaPhi>("Jet1", "Jet1", nullptr, &empty3x3);
102  hadP_ = std::make_unique<TFitParticleEtEtaPhi>("Jet2", "Jet2", nullptr, &empty3x3);
103  hadQ_ = std::make_unique<TFitParticleEtEtaPhi>("Jet3", "Jet3", nullptr, &empty3x3);
104  lepB_ = std::make_unique<TFitParticleEtEtaPhi>("Jet4", "Jet4", nullptr, &empty3x3);
105  break;
106  case kEtThetaPhi:
107  hadB_ = std::make_unique<TFitParticleEtThetaPhi>("Jet1", "Jet1", nullptr, &empty3x3);
108  hadP_ = std::make_unique<TFitParticleEtThetaPhi>("Jet2", "Jet2", nullptr, &empty3x3);
109  hadQ_ = std::make_unique<TFitParticleEtThetaPhi>("Jet3", "Jet3", nullptr, &empty3x3);
110  lepB_ = std::make_unique<TFitParticleEtThetaPhi>("Jet4", "Jet4", nullptr, &empty3x3);
111  break;
112  }
113 }
std::unique_ptr< TAbsFitParticle > hadQ_
Param jetParam_
jet parametrization
std::unique_ptr< TAbsFitParticle > lepB_
std::unique_ptr< TAbsFitParticle > hadB_
input particles
std::unique_ptr< TAbsFitParticle > hadP_

◆ setupLeptons()

void TtSemiLepKinFitter::setupLeptons ( )
private

initialize lepton inputs

Definition at line 115 of file TtSemiLepKinFitter.cc.

References TopKinFitter::kEMom, TopKinFitter::kEtEtaPhi, TopKinFitter::kEtThetaPhi, lepParam_, lepton_, metParam_, and neutrino_.

Referenced by setupFitter().

115  {
116  TMatrixD empty3x3(3, 3);
117  switch (lepParam_) { // setup lepton according to parameterization
118  case kEMom:
119  lepton_ = std::make_unique<TFitParticleEScaledMomDev>("Lepton", "Lepton", nullptr, &empty3x3);
120  break;
121  case kEtEtaPhi:
122  lepton_ = std::make_unique<TFitParticleEtEtaPhi>("Lepton", "Lepton", nullptr, &empty3x3);
123  break;
124  case kEtThetaPhi:
125  lepton_ = std::make_unique<TFitParticleEtThetaPhi>("Lepton", "Lepton", nullptr, &empty3x3);
126  break;
127  }
128  switch (metParam_) { // setup neutrino according to parameterization
129  case kEMom:
130  neutrino_ = std::make_unique<TFitParticleEScaledMomDev>("Neutrino", "Neutrino", nullptr, &empty3x3);
131  break;
132  case kEtEtaPhi:
133  neutrino_ = std::make_unique<TFitParticleEtEtaPhi>("Neutrino", "Neutrino", nullptr, &empty3x3);
134  break;
135  case kEtThetaPhi:
136  neutrino_ = std::make_unique<TFitParticleEtThetaPhi>("Neutrino", "Neutrino", nullptr, &empty3x3);
137  break;
138  }
139 }
std::unique_ptr< TAbsFitParticle > neutrino_
std::unique_ptr< TAbsFitParticle > lepton_
Param lepParam_
lepton parametrization
Param metParam_
met parametrization

Member Data Documentation

◆ bResolutions_

const std::vector<edm::ParameterSet>* TtSemiLepKinFitter::bResolutions_ = nullptr
private

Definition at line 124 of file TtSemiLepKinFitter.h.

Referenced by setupFitter().

◆ constrainSumPt_

bool TtSemiLepKinFitter::constrainSumPt_
private

internally use simple boolean for this constraint to reduce the per-event computing time

Definition at line 152 of file TtSemiLepKinFitter.h.

Referenced by fit(), setupConstraints(), and setupFitter().

◆ constrList_

std::vector<Constraint> TtSemiLepKinFitter::constrList_
private

vector of constraints to be used

Definition at line 150 of file TtSemiLepKinFitter.h.

Referenced by printSetup(), setupConstraints(), and setupFitter().

◆ covM_

std::unique_ptr<CovarianceMatrix> TtSemiLepKinFitter::covM_
private

object used to construct the covariance matrices for the individual particles

Definition at line 131 of file TtSemiLepKinFitter.h.

Referenced by fit(), and setupFitter().

◆ fittedHadB_

pat::Particle TtSemiLepKinFitter::fittedHadB_
private

output particles

Definition at line 137 of file TtSemiLepKinFitter.h.

Referenced by fit(), and fittedHadB().

◆ fittedHadP_

pat::Particle TtSemiLepKinFitter::fittedHadP_
private

Definition at line 138 of file TtSemiLepKinFitter.h.

Referenced by fit(), and fittedHadP().

◆ fittedHadQ_

pat::Particle TtSemiLepKinFitter::fittedHadQ_
private

Definition at line 139 of file TtSemiLepKinFitter.h.

Referenced by fit(), and fittedHadQ().

◆ fittedLepB_

pat::Particle TtSemiLepKinFitter::fittedLepB_
private

Definition at line 140 of file TtSemiLepKinFitter.h.

Referenced by fit(), and fittedLepB().

◆ fittedLepton_

pat::Particle TtSemiLepKinFitter::fittedLepton_
private

Definition at line 141 of file TtSemiLepKinFitter.h.

Referenced by fit(), and fittedLepton().

◆ fittedNeutrino_

pat::Particle TtSemiLepKinFitter::fittedNeutrino_
private

Definition at line 142 of file TtSemiLepKinFitter.h.

Referenced by fit(), and fittedNeutrino().

◆ hadB_

std::unique_ptr<TAbsFitParticle> TtSemiLepKinFitter::hadB_
private

input particles

Definition at line 116 of file TtSemiLepKinFitter.h.

Referenced by fit(), setupConstraints(), setupFitter(), and setupJets().

◆ hadP_

std::unique_ptr<TAbsFitParticle> TtSemiLepKinFitter::hadP_
private

Definition at line 117 of file TtSemiLepKinFitter.h.

Referenced by fit(), setupConstraints(), setupFitter(), and setupJets().

◆ hadQ_

std::unique_ptr<TAbsFitParticle> TtSemiLepKinFitter::hadQ_
private

Definition at line 118 of file TtSemiLepKinFitter.h.

Referenced by fit(), setupConstraints(), setupFitter(), and setupJets().

◆ jetEnergyResolutionEtaBinning_

const std::vector<double>* TtSemiLepKinFitter::jetEnergyResolutionEtaBinning_ = nullptr
private

Definition at line 129 of file TtSemiLepKinFitter.h.

Referenced by setupFitter().

◆ jetEnergyResolutionScaleFactors_

const std::vector<double>* TtSemiLepKinFitter::jetEnergyResolutionScaleFactors_ = nullptr
private

scale factors for the jet energy resolution

Definition at line 128 of file TtSemiLepKinFitter.h.

Referenced by setupFitter().

◆ jetParam_

Param TtSemiLepKinFitter::jetParam_
private

jet parametrization

Definition at line 144 of file TtSemiLepKinFitter.h.

Referenced by fit(), printSetup(), and setupJets().

◆ lepB_

std::unique_ptr<TAbsFitParticle> TtSemiLepKinFitter::lepB_
private

Definition at line 119 of file TtSemiLepKinFitter.h.

Referenced by fit(), setupConstraints(), setupFitter(), and setupJets().

◆ lepParam_

Param TtSemiLepKinFitter::lepParam_
private

lepton parametrization

Definition at line 146 of file TtSemiLepKinFitter.h.

Referenced by fit(), printSetup(), and setupLeptons().

◆ lepResolutions_

const std::vector<edm::ParameterSet>* TtSemiLepKinFitter::lepResolutions_ = nullptr
private

Definition at line 125 of file TtSemiLepKinFitter.h.

Referenced by setupFitter().

◆ lepton_

std::unique_ptr<TAbsFitParticle> TtSemiLepKinFitter::lepton_
private

Definition at line 120 of file TtSemiLepKinFitter.h.

Referenced by fit(), setupConstraints(), setupFitter(), and setupLeptons().

◆ massConstr_

std::map<Constraint, std::unique_ptr<TFitConstraintM> > TtSemiLepKinFitter::massConstr_
private

supported constraints

Definition at line 133 of file TtSemiLepKinFitter.h.

Referenced by setupConstraints(), and setupFitter().

◆ metParam_

Param TtSemiLepKinFitter::metParam_
private

met parametrization

Definition at line 148 of file TtSemiLepKinFitter.h.

Referenced by fit(), printSetup(), and setupLeptons().

◆ metResolutions_

const std::vector<edm::ParameterSet>* TtSemiLepKinFitter::metResolutions_ = nullptr
private

Definition at line 126 of file TtSemiLepKinFitter.h.

Referenced by setupFitter().

◆ neutrino_

std::unique_ptr<TAbsFitParticle> TtSemiLepKinFitter::neutrino_
private

Definition at line 121 of file TtSemiLepKinFitter.h.

Referenced by fit(), setupConstraints(), setupFitter(), and setupLeptons().

◆ sumPxConstr_

std::unique_ptr<TFitConstraintEp> TtSemiLepKinFitter::sumPxConstr_
private

Definition at line 134 of file TtSemiLepKinFitter.h.

Referenced by fit(), setupConstraints(), and setupFitter().

◆ sumPyConstr_

std::unique_ptr<TFitConstraintEp> TtSemiLepKinFitter::sumPyConstr_
private

Definition at line 135 of file TtSemiLepKinFitter.h.

Referenced by fit(), setupConstraints(), and setupFitter().

◆ udscResolutions_

const std::vector<edm::ParameterSet>* TtSemiLepKinFitter::udscResolutions_ = nullptr
private

resolutions

Definition at line 123 of file TtSemiLepKinFitter.h.

Referenced by setupFitter().