CMS 3D CMS Logo

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 public:
36 
37 public:
39  explicit TtSemiLepKinFitter();
41  explicit TtSemiLepKinFitter(Param jetParam,
42  Param lepParam,
43  Param metParam,
44  int maxNrIter,
45  double maxDeltaS,
46  double maxF,
47  const std::vector<Constraint>& constraints,
48  double mW = 80.4,
49  double mTop = 173.,
50  const std::vector<edm::ParameterSet>* udscResolutions = nullptr,
51  const std::vector<edm::ParameterSet>* bResolutions = nullptr,
52  const std::vector<edm::ParameterSet>* lepResolutions = nullptr,
53  const std::vector<edm::ParameterSet>* metResolutions = nullptr,
54  const std::vector<double>* jetEnergyResolutionScaleFactors = nullptr,
55  const std::vector<double>* jetEnergyResolutionEtaBinning = nullptr);
58 
60  template <class LeptonType>
61  int fit(const std::vector<pat::Jet>& jets, const pat::Lepton<LeptonType>& leps, const pat::MET& met);
63  int fit(const TLorentzVector& p4HadP,
64  const TLorentzVector& p4HadQ,
65  const TLorentzVector& p4HadB,
66  const TLorentzVector& p4LepB,
67  const TLorentzVector& p4Lepton,
68  const TLorentzVector& p4Neutrino,
69  const int leptonCharge,
72  int fit(const TLorentzVector& p4HadP,
73  const TLorentzVector& p4HadQ,
74  const TLorentzVector& p4HadB,
75  const TLorentzVector& p4LepB,
76  const TLorentzVector& p4Lepton,
77  const TLorentzVector& p4Neutrino,
78  const TMatrixD& covHadP,
79  const TMatrixD& covHadQ,
80  const TMatrixD& covHadB,
81  const TMatrixD& covLepB,
82  const TMatrixD& covLepton,
83  const TMatrixD& covNeutrino,
84  const int leptonCharge);
86  const pat::Particle fittedHadB() const { return (fitter_->getStatus() == 0 ? fittedHadB_ : pat::Particle()); };
88  const pat::Particle fittedHadP() const { return (fitter_->getStatus() == 0 ? fittedHadP_ : pat::Particle()); };
90  const pat::Particle fittedHadQ() const { return (fitter_->getStatus() == 0 ? fittedHadQ_ : pat::Particle()); };
92  const pat::Particle fittedLepB() const { return (fitter_->getStatus() == 0 ? fittedLepB_ : pat::Particle()); };
94  const pat::Particle fittedLepton() const { return (fitter_->getStatus() == 0 ? fittedLepton_ : pat::Particle()); };
96  const pat::Particle fittedNeutrino() const {
97  return (fitter_->getStatus() == 0 ? fittedNeutrino_ : pat::Particle());
98  };
101 
102 private:
104  void printSetup() const;
106  void setupFitter();
108  void setupJets();
110  void setupLeptons();
112  void setupConstraints();
113 
114 private:
123  const std::vector<edm::ParameterSet>* udscResolutions_;
124  const std::vector<edm::ParameterSet>* bResolutions_;
125  const std::vector<edm::ParameterSet>* lepResolutions_;
126  const std::vector<edm::ParameterSet>* metResolutions_;
128  const std::vector<double>* jetEnergyResolutionScaleFactors_;
129  const std::vector<double>* jetEnergyResolutionEtaBinning_;
133  std::map<Constraint, TFitConstraintM*> massConstr_;
150  std::vector<Constraint> constrList_;
153 };
154 
155 template <class LeptonType>
156 int TtSemiLepKinFitter::fit(const std::vector<pat::Jet>& jets,
157  const pat::Lepton<LeptonType>& lepton,
158  const pat::MET& neutrino) {
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 }
199 
200 #endif
TtSemiLepKinFitter::constrainSumPt_
bool constrainSumPt_
internally use simple boolean for this constraint to reduce the per-event computing time
Definition: TtSemiLepKinFitter.h:152
TtSemiLepEvtPartons::LightQBar
Definition: TtSemiLepEvtPartons.h:25
TopKinFitter::fitter_
TKinFitter * fitter_
kinematic fitter
Definition: TopKinFitter.h:47
TtSemiLepKinFitter::fittedNeutrino
const pat::Particle fittedNeutrino() const
return neutrino candidate
Definition: TtSemiLepKinFitter.h:96
TtSemiLepKinFitter::kSumPt
Definition: TtSemiLepKinFitter.h:35
TtSemiLepKinFitter::fittedHadP_
pat::Particle fittedHadP_
Definition: TtSemiLepKinFitter.h:138
TtFullHadKinFitProducer_cfi.udscResolutions
udscResolutions
Definition: TtFullHadKinFitProducer_cfi.py:83
TtSemiLepKinFitter::jetParam_
Param jetParam_
jet parametrization
Definition: TtSemiLepKinFitter.h:144
StEvtSolProducer_cfi.maxNrIter
maxNrIter
Definition: StEvtSolProducer_cfi.py:24
TtSemiLepEvtPartons::LepB
Definition: TtSemiLepEvtPartons.h:25
TtSemiLepKinFitter::fittedHadB
const pat::Particle fittedHadB() const
return hadronic b quark candidate
Definition: TtSemiLepKinFitter.h:86
TFitConstraintM
Definition: TFitConstraintM.h:11
TtSemiLepKinFitter::bResolutions_
const std::vector< edm::ParameterSet > * bResolutions_
Definition: TtSemiLepKinFitter.h:124
TtSemiLepKinFitter::metParam_
Param metParam_
met parametrization
Definition: TtSemiLepKinFitter.h:148
pat::Lepton
Analysis-level lepton class.
Definition: Lepton.h:29
TtSemiLepKinFitter::metResolutions_
const std::vector< edm::ParameterSet > * metResolutions_
Definition: TtSemiLepKinFitter.h:126
TtSemiLepKinFitter::fit
int fit(const std::vector< pat::Jet > &jets, const pat::Lepton< LeptonType > &leps, const pat::MET &met)
kinematic fit interface for PAT objects
Definition: TtSemiLepKinFitter.h:156
TtSemiLepKinFitter::addKinFitInfo
TtSemiEvtSolution addKinFitInfo(TtSemiEvtSolution *asol)
add kin fit information to the old event solution (in for legacy reasons)
Definition: TtSemiLepKinFitter.cc:351
TtSemiLepKinFitter::lepResolutions_
const std::vector< edm::ParameterSet > * lepResolutions_
Definition: TtSemiLepKinFitter.h:125
TtSemiLepKinFitter::constrList_
std::vector< Constraint > constrList_
vector of constraints to be used
Definition: TtSemiLepKinFitter.h:150
CovarianceMatrix
Definition: CovarianceMatrix.h:27
TtSemiLepKinFitter::fittedHadQ_
pat::Particle fittedHadQ_
Definition: TtSemiLepKinFitter.h:139
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
TtSemiLepKinFitter::setupFitter
void setupFitter()
setup fitter
Definition: TtSemiLepKinFitter.cc:200
TtSemiLepEvtPartons.h
Lepton.h
TtSemiLepKinFitter::~TtSemiLepKinFitter
~TtSemiLepKinFitter()
default destructor
Definition: TtSemiLepKinFitter.cc:70
TtSemiLepKinFitter::setupConstraints
void setupConstraints()
initialize constraints
Definition: TtSemiLepKinFitter.cc:175
TtSemiLepKinFitter::fittedNeutrino_
pat::Particle fittedNeutrino_
Definition: TtSemiLepKinFitter.h:142
TtSemiLepKinFitter::jetEnergyResolutionEtaBinning_
const std::vector< double > * jetEnergyResolutionEtaBinning_
Definition: TtSemiLepKinFitter.h:129
TopKinFitter.h
CovarianceMatrix.h
BTaggingMonitor_cfi.met
met
Definition: BTaggingMonitor_cfi.py:84
edm::Exception
Definition: EDMException.h:77
TtSemiLepHitFitProducer_Electrons_cfi.leps
leps
Definition: TtSemiLepHitFitProducer_Electrons_cfi.py:5
TtSemiLepKinFitter::hadQ_
TAbsFitParticle * hadQ_
Definition: TtSemiLepKinFitter.h:118
TtSemiLepKinFitter::kEqualTopMasses
Definition: TtSemiLepKinFitter.h:35
TtSemiLepKinFitter::TtSemiLepKinFitter
TtSemiLepKinFitter()
default constructor
Definition: TtSemiLepKinFitter.cc:15
TtSemiLepKinFitter::fittedLepton
const pat::Particle fittedLepton() const
return lepton candidate
Definition: TtSemiLepKinFitter.h:94
pat::Jet
Analysis-level calorimeter jet class.
Definition: Jet.h:77
TtSemiLepKinFitter
Definition: TtSemiLepKinFitter.h:32
TtSemiLepKinFitter::printSetup
void printSetup() const
print fitter setup
Definition: TtSemiLepKinFitter.cc:84
TtSemiLepKinFitter::fittedHadQ
const pat::Particle fittedHadQ() const
return hadronic light quark candidate
Definition: TtSemiLepKinFitter.h:90
reco::LeafCandidate::py
double py() const final
y coordinate of momentum vector
Definition: LeafCandidate.h:142
TtSemiLepHitFitProducer_Electrons_cfi.mTop
mTop
Definition: TtSemiLepHitFitProducer_Electrons_cfi.py:36
TtSemiLepKinFitter::covM_
CovarianceMatrix * covM_
object used to construct the covariance matrices for the individual particles
Definition: TtSemiLepKinFitter.h:131
TtSemiLepKinFitter::udscResolutions_
const std::vector< edm::ParameterSet > * udscResolutions_
resolutions
Definition: TtSemiLepKinFitter.h:123
TtSemiLepKinFitter::sumPxConstr_
TFitConstraintEp * sumPxConstr_
Definition: TtSemiLepKinFitter.h:134
TtSemiLepKinFitter::kTopHadMass
Definition: TtSemiLepKinFitter.h:35
TtSemiLepKinFitter::neutrino_
TAbsFitParticle * neutrino_
Definition: TtSemiLepKinFitter.h:121
TAbsFitParticle
Definition: TAbsFitParticle.h:9
TtSemiLepKinFitter::kNeutrinoMass
Definition: TtSemiLepKinFitter.h:35
TtSemiLepKinFitter::fittedHadP
const pat::Particle fittedHadP() const
return hadronic light quark candidate
Definition: TtSemiLepKinFitter.h:88
TtSemiLepHitFitProducer_Electrons_cfi.mW
mW
Definition: TtSemiLepHitFitProducer_Electrons_cfi.py:35
TKinFitter::getStatus
Int_t getStatus()
Definition: TKinFitter.h:51
TtSemiLepEvtPartons::HadB
Definition: TtSemiLepEvtPartons.h:25
TtSemiLepKinFitter::Constraint
Constraint
supported constraints
Definition: TtSemiLepKinFitter.h:35
TtSemiLepKinFitter::lepton_
TAbsFitParticle * lepton_
Definition: TtSemiLepKinFitter.h:120
TopKinFitter
Definition: TopKinFitter.h:17
TtSemiLepEvtPartons::LightQ
Definition: TtSemiLepEvtPartons.h:25
TtSemiEvtSolution.h
TtSemiLepKinFitter::setupJets
void setupJets()
initialize jet inputs
Definition: TtSemiLepKinFitter.cc:124
TtSemiLepKinFitter::fittedLepB
const pat::Particle fittedLepB() const
return leptonic b quark candidate
Definition: TtSemiLepKinFitter.h:92
pat::MET
Analysis-level MET class.
Definition: MET.h:40
TtSemiLepKinFitter::kWLepMass
Definition: TtSemiLepKinFitter.h:35
TFitConstraintEp
Definition: TFitConstraintEp.h:9
TtFullHadKinFitProducer_cfi.jetEnergyResolutionEtaBinning
jetEnergyResolutionEtaBinning
Definition: TtFullHadKinFitProducer_cfi.py:95
TtFullHadKinFitProducer_cfi.jetEnergyResolutionScaleFactors
jetEnergyResolutionScaleFactors
Definition: TtFullHadKinFitProducer_cfi.py:94
createBeamHaloJobs.constraints
string constraints
Definition: createBeamHaloJobs.py:229
TtSemiLepKinFitter::fittedLepton_
pat::Particle fittedLepton_
Definition: TtSemiLepKinFitter.h:141
StEvtSolProducer_cfi.maxDeltaS
maxDeltaS
Definition: StEvtSolProducer_cfi.py:25
TtSemiEvtSolution
Definition: TtSemiEvtSolution.h:31
reco::LeafCandidate::et
double et() const final
transverse energy
Definition: LeafCandidate.h:127
TtSemiLepKinFitter::lepParam_
Param lepParam_
lepton parametrization
Definition: TtSemiLepKinFitter.h:146
TtSemiLepKinFitter::lepB_
TAbsFitParticle * lepB_
Definition: TtSemiLepKinFitter.h:119
TtFullHadKinFitProducer_cfi.bResolutions
bResolutions
Definition: TtFullHadKinFitProducer_cfi.py:84
TtSemiLepKinFitter::kTopLepMass
Definition: TtSemiLepKinFitter.h:35
TtSemiLepKinFitter::hadB_
TAbsFitParticle * hadB_
input particles
Definition: TtSemiLepKinFitter.h:116
TtSemiLepKinFitter::hadP_
TAbsFitParticle * hadP_
Definition: TtSemiLepKinFitter.h:117
TtSemiLepKinFitter::kWHadMass
Definition: TtSemiLepKinFitter.h:35
reco::LeafCandidate::energy
double energy() const final
energy
Definition: LeafCandidate.h:125
TtSemiLepKinFitter::jetEnergyResolutionScaleFactors_
const std::vector< double > * jetEnergyResolutionScaleFactors_
scale factors for the jet energy resolution
Definition: TtSemiLepKinFitter.h:128
CovarianceMatrix::setupMatrix
TMatrixD setupMatrix(const pat::PATObject< T > &object, const TopKinFitter::Param param, const std::string &resolutionProvider="")
return covariance matrix for a PAT object
Definition: CovarianceMatrix.h:87
CovarianceMatrix::ObjectType
ObjectType
Definition: CovarianceMatrix.h:29
TtSemiLepKinFitter::sumPyConstr_
TFitConstraintEp * sumPyConstr_
Definition: TtSemiLepKinFitter.h:135
ParameterSet.h
TtSemiLepKinFitter::setupLeptons
void setupLeptons()
initialize lepton inputs
Definition: TtSemiLepKinFitter.cc:149
TopKinFitter::Param
Param
supported parameterizations
Definition: TopKinFitter.h:20
objects.autophobj.leptonType
leptonType
BASIC VERSION WITH ONLY MAIN LEPTON ID CRITERIA.
Definition: autophobj.py:48
TtSemiLepKinFitter::fittedLepB_
pat::Particle fittedLepB_
Definition: TtSemiLepKinFitter.h:140
StEvtSolProducer_cfi.maxF
maxF
Definition: StEvtSolProducer_cfi.py:26
reco::LeafCandidate::px
double px() const final
x coordinate of momentum vector
Definition: LeafCandidate.h:140
reco::LeafCandidate::pz
double pz() const final
z coordinate of momentum vector
Definition: LeafCandidate.h:144
edm::errors::Configuration
Definition: EDMException.h:36
pat::Particle
Analysis-level particle class.
Definition: Particle.h:30
TtSemiLepKinFitter::massConstr_
std::map< Constraint, TFitConstraintM * > massConstr_
supported constraints
Definition: TtSemiLepKinFitter.h:133
TtSemiLepKinFitter::fittedHadB_
pat::Particle fittedHadB_
output particles
Definition: TtSemiLepKinFitter.h:137