CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TtSemiLepKinFitter.h
Go to the documentation of this file.
1 #ifndef TtSemiLepKinFitter_h
2 #define TtSemiLepKinFitter_h
3 
4 #include <vector>
5 
6 #include "TLorentzVector.h"
7 
9 
11 
13 
16 
18 
19 class TAbsFitParticle;
20 class TFitConstraintM;
21 class TFitConstraintEp;
22 
23 /*
24  \class TtSemiLepKinFitter TtSemiLepKinFitter.h "TopQuarkAnalysis/TopKinFitter/interface/TtSemiLepKinFitter.h"
25 
26  \brief one line description to be added here...
27 
28  text to be added here...
29 
30 **/
31 
33 
34  public:
35 
38 
39  public:
41  explicit TtSemiLepKinFitter();
43  explicit TtSemiLepKinFitter(Param jetParam, Param lepParam, Param metParam, int maxNrIter, double maxDeltaS, double maxF,
44  const std::vector<Constraint>& constraints, double mW=80.4, double mTop=173.,
45  const std::vector<edm::ParameterSet>* udscResolutions=0,
46  const std::vector<edm::ParameterSet>* bResolutions =0,
47  const std::vector<edm::ParameterSet>* lepResolutions =0,
48  const std::vector<edm::ParameterSet>* metResolutions =0,
49  const std::vector<double>* jetEnergyResolutionScaleFactors=0,
50  const std::vector<double>* jetEnergyResolutionEtaBinning =0);
53 
55  template <class LeptonType> int fit(const std::vector<pat::Jet>& jets, const pat::Lepton<LeptonType>& leps, const pat::MET& met);
57  int fit(const TLorentzVector& p4HadP, const TLorentzVector& p4HadQ, const TLorentzVector& p4HadB, const TLorentzVector& p4LepB,
58  const TLorentzVector& p4Lepton, const TLorentzVector& p4Neutrino, const int leptonCharge, const CovarianceMatrix::ObjectType leptonType);
60  int fit(const TLorentzVector& p4HadP, const TLorentzVector& p4HadQ, const TLorentzVector& p4HadB, const TLorentzVector& p4LepB,
61  const TLorentzVector& p4Lepton, const TLorentzVector& p4Neutrino,
62  const TMatrixD& covHadP, const TMatrixD& covHadQ, const TMatrixD& covHadB, const TMatrixD& covLepB,
63  const TMatrixD& covLepton, const TMatrixD& covNeutrino,
64  const int leptonCharge);
66  const pat::Particle fittedHadB() const { return (fitter_->getStatus()==0 ? fittedHadB_ : pat::Particle()); };
68  const pat::Particle fittedHadP() const { return (fitter_->getStatus()==0 ? fittedHadP_ : pat::Particle()); };
70  const pat::Particle fittedHadQ() const { return (fitter_->getStatus()==0 ? fittedHadQ_ : pat::Particle()); };
72  const pat::Particle fittedLepB() const { return (fitter_->getStatus()==0 ? fittedLepB_ : pat::Particle()); };
74  const pat::Particle fittedLepton() const { return (fitter_->getStatus()==0 ? fittedLepton_ : pat::Particle()); };
79 
80  private:
82  void printSetup() const;
84  void setupFitter();
86  void setupJets();
88  void setupLeptons();
90  void setupConstraints();
91 
92  private:
101  const std::vector<edm::ParameterSet>* udscResolutions_;
102  const std::vector<edm::ParameterSet>* bResolutions_;
103  const std::vector<edm::ParameterSet>* lepResolutions_;
104  const std::vector<edm::ParameterSet>* metResolutions_;
106  const std::vector<double>* jetEnergyResolutionScaleFactors_;
107  const std::vector<double>* jetEnergyResolutionEtaBinning_;
111  std::map<Constraint, TFitConstraintM*> massConstr_;
128  std::vector<Constraint> constrList_;
131 };
132 
133 template <class LeptonType>
134 int TtSemiLepKinFitter::fit(const std::vector<pat::Jet>& jets, const pat::Lepton<LeptonType>& lepton, const pat::MET& neutrino)
135 {
136  if( jets.size()<4 )
137  throw edm::Exception( edm::errors::Configuration, "Cannot run the TtSemiLepKinFitter with less than 4 jets" );
138 
139  // get jets in right order
140  const pat::Jet hadP = jets[TtSemiLepEvtPartons::LightQ ];
141  const pat::Jet hadQ = jets[TtSemiLepEvtPartons::LightQBar];
142  const pat::Jet hadB = jets[TtSemiLepEvtPartons::HadB ];
143  const pat::Jet lepB = jets[TtSemiLepEvtPartons::LepB ];
144 
145  // initialize particles
146  const TLorentzVector p4HadP( hadP.px(), hadP.py(), hadP.pz(), hadP.energy() );
147  const TLorentzVector p4HadQ( hadQ.px(), hadQ.py(), hadQ.pz(), hadQ.energy() );
148  const TLorentzVector p4HadB( hadB.px(), hadB.py(), hadB.pz(), hadB.energy() );
149  const TLorentzVector p4LepB( lepB.px(), lepB.py(), lepB.pz(), lepB.energy() );
150  const TLorentzVector p4Lepton ( lepton.px(), lepton.py(), lepton.pz(), lepton.energy() );
151  const TLorentzVector p4Neutrino( neutrino.px(), neutrino.py(), 0, neutrino.et() );
152 
153  // initialize covariance matrices
154  TMatrixD covHadP = covM_->setupMatrix(hadP, jetParam_);
155  TMatrixD covHadQ = covM_->setupMatrix(hadQ, jetParam_);
156  TMatrixD covHadB = covM_->setupMatrix(hadB, jetParam_, "bjets");
157  TMatrixD covLepB = covM_->setupMatrix(lepB, jetParam_, "bjets");
158  TMatrixD covLepton = covM_->setupMatrix(lepton , lepParam_);
159  TMatrixD covNeutrino = covM_->setupMatrix(neutrino, metParam_);
160 
161  // now do the part that is fully independent of PAT features
162  return fit(p4HadP, p4HadQ, p4HadB, p4LepB, p4Lepton, p4Neutrino,
163  covHadP, covHadQ, covHadB, covLepB, covLepton, covNeutrino,
164  lepton.charge());
165 }
166 
167 
168 #endif
Analysis-level MET class.
Definition: MET.h:42
virtual double energy() const GCC11_FINAL
energy
const pat::Particle fittedHadP() const
return hadronic light quark candidate
virtual double et() const GCC11_FINAL
transverse energy
TAbsFitParticle * hadB_
input particles
tuple met
____________________________________________________________________________||
Definition: CaloMET_cfi.py:4
const std::vector< edm::ParameterSet > * udscResolutions_
resolutions
TAbsFitParticle * neutrino_
const pat::Particle fittedNeutrino() const
return neutrino candidate
const pat::Particle fittedLepB() const
return leptonic b quark candidate
TAbsFitParticle * hadQ_
bool constrainSumPt_
internally use simple boolean for this constraint to reduce the per-event computing time ...
TMatrixD setupMatrix(const pat::PATObject< T > &object, const TopKinFitter::Param param, const std::string &resolutionProvider="")
return covariance matrix for a PAT object
TFitConstraintEp * sumPyConstr_
virtual double pz() const GCC11_FINAL
z coordinate of momentum vector
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
pat::Particle fittedHadP_
pat::Particle fittedLepB_
Param lepParam_
lepton parametrization
pat::Particle fittedHadB_
output particles
const std::vector< edm::ParameterSet > * bResolutions_
TAbsFitParticle * lepton_
int fit(const std::vector< pat::Jet > &jets, const pat::Lepton< LeptonType > &leps, const pat::MET &met)
kinematic fit interface for PAT objects
void setupJets()
initialize jet inputs
const std::vector< edm::ParameterSet > * lepResolutions_
void printSetup() const
print fitter setup
pat::Particle fittedLepton_
TAbsFitParticle * hadP_
vector< PseudoJet > jets
Analysis-level lepton class.
Definition: Lepton.h:30
const std::vector< double > * jetEnergyResolutionScaleFactors_
scale factors for the jet energy resolution
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
Int_t getStatus()
Definition: TKinFitter.h:41
Param jetParam_
jet parametrization
const pat::Particle fittedHadB() const
return hadronic b quark candidate
TtSemiLepKinFitter()
default constructor
std::map< Constraint, TFitConstraintM * > massConstr_
supported constraints
Param metParam_
met parametrization
CovarianceMatrix * covM_
object used to construct the covariance matrices for the individual particles
pat::Particle fittedHadQ_
TtSemiEvtSolution addKinFitInfo(TtSemiEvtSolution *asol)
add kin fit information to the old event solution (in for legacy reasons)
~TtSemiLepKinFitter()
default destructor
void setupConstraints()
initialize constraints
std::vector< Constraint > constrList_
vector of constraints to be used
void setupLeptons()
initialize lepton inputs
TFitConstraintEp * sumPxConstr_
Analysis-level particle class.
Definition: Particle.h:32
Analysis-level calorimeter jet class.
Definition: Jet.h:73
const pat::Particle fittedHadQ() const
return hadronic light quark candidate
const pat::Particle fittedLepton() const
return lepton candidate
void setupFitter()
setup fitter
pat::Particle fittedNeutrino_
const std::vector< double > * jetEnergyResolutionEtaBinning_
TKinFitter * fitter_
kinematic fitter
Definition: TopKinFitter.h:46
TAbsFitParticle * lepB_
Constraint
supported constraints
const std::vector< edm::ParameterSet > * metResolutions_