CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TtFullHadKinFitter.h
Go to the documentation of this file.
1 #ifndef TtFullHadKinFitter_h
2 #define TtFullHadKinFitter_h
3 
4 #include <vector>
5 
6 #include "TLorentzVector.h"
7 
9 
12 
14 
16 
17 class TAbsFitParticle;
18 class TFitConstraintM;
19 
20 /*
21  \class TtFullHadKinFitter TtFullHadKinFitter.h "TopQuarkAnalysis/TopKinFitter/interface/TtFullHadKinFitter.h"
22 
23  \brief one line description to be added here...
24 
25  text to be added here...
26 
27 **/
28 
30 
31  public:
34 
35  public:
39  std::vector<TtFullHadKinFitter::Constraint> intToConstraint(std::vector<unsigned int> constraints);
41  TtFullHadKinFitter(int jetParam, int maxNrIter, double maxDeltaS, double maxF, std::vector<unsigned int> constraints,
42  double mW=80.4, double mTop=173.);
44  TtFullHadKinFitter(Param jetParam, int maxNrIter, double maxDeltaS, double maxF, std::vector<Constraint> constraints,
45  double mW=80.4, double mTop=173.);
48 
50  int fit(const std::vector<pat::Jet>& jets);
51  int fit(const std::vector<pat::Jet>& jets, const std::vector<edm::ParameterSet> udscResolutions, const std::vector<edm::ParameterSet> bResolutions, const double resolutionSmearFactor);
53  const pat::Particle fittedB() const { return (fitter_->getStatus()==0 ? fittedB_ : pat::Particle()); };
55  const pat::Particle fittedBBar() const { return (fitter_->getStatus()==0 ? fittedBBar_ : pat::Particle()); };
57  const pat::Particle fittedLightQ() const { return (fitter_->getStatus()==0 ? fittedLightQ_ : pat::Particle()); };
61  const pat::Particle fittedLightP() const { return (fitter_->getStatus()==0 ? fittedLightP_ : pat::Particle()); };
66 
67  private:
69  void printSetup() const;
71  void setupFitter();
73  void setupJets();
75  void setupConstraints();
76 
77  private:
86  std::map<Constraint, TFitConstraintM*> massConstr_;
97  std::vector<Constraint> constraints_;
98 
101 
102  public:
103 
105  struct KinFitResult {
106  int Status;
107  double Chi2;
108  double Prob;
115  std::vector<int> JetCombi;
116  bool operator< (const KinFitResult& rhs) { return Chi2 < rhs.Chi2; };
117  };
118 
120  class KinFit {
121 
122  public:
123 
125  KinFit();
127  KinFit(bool useBTagging, unsigned int bTags, std::string bTagAlgo, double minBTagValueBJet, double maxBTagValueNonBJet,
128  std::vector<edm::ParameterSet> udscResolutions, std::vector<edm::ParameterSet> bResolutions, double resolutionSmearFactor,
129  std::string jetCorrectionLevel, int maxNJets, int maxNComb,
130  unsigned int maxNrIter, double maxDeltaS, double maxF, unsigned int jetParam, std::vector<unsigned> constraints, double mW, double mTop);
132  ~KinFit();
133 
135  void setBTagging(bool useBTagging, unsigned int bTags, std::string bTagAlgo, double minBTagValueBJet, double maxBTagValueNonBJet){
136  useBTagging_ = useBTagging;
137  bTags_ = bTags;
138  bTagAlgo_ = bTagAlgo;
139  minBTagValueBJet_ = minBTagValueBJet;
140  maxBTagValueNonBJet_ = maxBTagValueNonBJet;
141  }
143  void setResolutions(std::vector<edm::ParameterSet> udscResolutions, std::vector<edm::ParameterSet> bResolutions, double resolutionSmearFactor = 1.){
144  udscResolutions_ = udscResolutions;
145  bResolutions_ = bResolutions;
146  resolutionSmearFactor_ = resolutionSmearFactor;
147  }
149  void setFitter(int maxNJets, unsigned int maxNrIter, double maxDeltaS, double maxF,
150  unsigned int jetParam, std::vector<unsigned> constraints, double mW, double mTop){
151  maxNJets_ = maxNJets;
152  maxNrIter_ = maxNrIter;
153  maxDeltaS_ = maxDeltaS;
154  maxF_ = maxF;
155  jetParam_ = jetParam;
157  mW_ = mW;
158  mTop_ = mTop;
159  }
161  void setJEC(std::string jetCorrectionLevel){
162  jetCorrectionLevel_ = jetCorrectionLevel;
163  }
165  void setUseOnlyMatch(bool useOnlyMatch){
166  useOnlyMatch_ = useOnlyMatch;
167  }
169  void setMatch(std::vector<int> match){
170  match_ = match;
171  }
173  void setMatchInvalidity(bool invalidMatch){
174  invalidMatch_ = invalidMatch;
175  }
177  void setOutput(int maxNComb){
178  maxNComb_ = maxNComb;
179  }
180 
182  std::list<TtFullHadKinFitter::KinFitResult> fit(const std::vector<pat::Jet>& jets);
183 
184  private:
185 
186  // helper function for b-tagging
187  bool doBTagging(const std::vector<pat::Jet>& jets, const unsigned int& bJetCounter, std::vector<int>& combi);
189  pat::Jet corJet(const pat::Jet& jet, const std::string& quarkType);
190 
191  // convert unsigned to Param
192  TtFullHadKinFitter::Param param(unsigned int configParameter);
193  // convert unsigned int to Constraint
194  TtFullHadKinFitter::Constraint constraint(unsigned int configParameter);
195  // convert vector of unsigned int's to vector of Contraint's
196  std::vector<TtFullHadKinFitter::Constraint> constraints(std::vector<unsigned int>& configParameters);
197 
203  unsigned int bTags_;
205  std::string bTagAlgo_;
211  std::vector<edm::ParameterSet> udscResolutions_, bResolutions_;
215  std::string jetCorrectionLevel_;
221  unsigned int maxNrIter_;
223  double maxDeltaS_;
225  double maxF_;
227  unsigned int jetParam_;
229  std::vector<unsigned> constraints_;
231  double mW_;
233  double mTop_;
237  std::vector<int> match_;
240 
243 
244  };
245 };
246 
247 #endif
TAbsFitParticle * lightQ_
double resolutionSmearFactor_
smearing factor for jet energy resolutions
double maxF_
maximal deviation for contstraints
double maxDeltaS_
maximal chi2 equivalent
TtFullHadKinFitter::Param param(unsigned int configParameter)
Param
supported parameterizations
Definition: TopKinFitter.h:22
void setupConstraints()
initialize constraints
TtHadEvtSolution addKinFitInfo(TtHadEvtSolution *asol)
add kin fit information to the old event solution (in for legacy reasons)
TAbsFitParticle * lightP_
void setBTagging(bool useBTagging, unsigned int bTags, std::string bTagAlgo, double minBTagValueBJet, double maxBTagValueNonBJet)
set all parameters for b-tagging
void setFitter(int maxNJets, unsigned int maxNrIter, double maxDeltaS, double maxF, unsigned int jetParam, std::vector< unsigned > constraints, double mW, double mTop)
set parameters for fitter
int maxNComb_
maximal number of combinations to be written to the event
TtFullHadKinFitter::Constraint constraint(unsigned int configParameter)
const pat::Particle fittedLightPBar() const
return fitted light quark candidate
pat::Particle fittedLightPBar_
void setUseOnlyMatch(bool useOnlyMatch)
set useOnlyMatch
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
const pat::Particle fittedBBar() const
return fitted b quark candidate
std::vector< edm::ParameterSet > udscResolutions_
store the resolutions for the jets
class that does the fitting
std::vector< edm::ParameterSet > bResolutions_
std::string jetCorrectionLevel_
correction level for jets
void setJEC(std::string jetCorrectionLevel)
set jec level
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 ...
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
~TtFullHadKinFitter()
default destructor
std::vector< TtFullHadKinFitter::Constraint > intToConstraint(std::vector< unsigned int > constraints)
used to convert vector of int&#39;s to vector of constraints (just used in TtFullHadKinFitter(int, int, double, double, std::vector&lt;unsigned int&gt;))
TAbsFitParticle * b_
input particles
Int_t getStatus()
Definition: TKinFitter.h:40
double minBTagValueBJet_
min value of bTag for a b-jet
std::map< Constraint, TFitConstraintM * > massConstr_
supported constraints
pat::Particle fittedLightP_
TAbsFitParticle * lightQBar_
const pat::Particle fittedLightQ() const
return fitted light quark candidate
pat::Particle fittedBBar_
double mTop_
top mass value used for constraints
std::vector< Constraint > constraints_
vector of constraints to be used
Param jetParam_
jet parametrization
pat::Particle fittedLightQ_
void setupFitter()
setup fitter
TAbsFitParticle * bBar_
~KinFit()
default destructor
Analysis-level particle class.
Definition: Particle.h:34
std::string bTagAlgo_
input tag for b-tagging algorithm
Analysis-level calorimeter jet class.
Definition: Jet.h:71
void setResolutions(std::vector< edm::ParameterSet > udscResolutions, std::vector< edm::ParameterSet > bResolutions, double resolutionSmearFactor=1.)
set resolutions
void setOutput(int maxNComb)
set number of combinations of output
unsigned int jetParam_
numbering of different possible jet parametrizations
bool useOnlyMatch_
fit or only a certain combination
int maxNJets_
maximal number of jets (-1 possible to indicate &#39;all&#39;)
TtFullHadKinFitter()
default constructor
const pat::Particle fittedLightP() const
return fitted light quark candidate
void setupJets()
initialize jet inputs
TKinFitter * fitter_
Definition: TopKinFitter.h:44
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
std::vector< TtFullHadKinFitter::Constraint > constraints(std::vector< unsigned int > &configParameters)
bool operator<(const KinFitResult &rhs)
double maxBTagValueNonBJet_
max value of bTag for a non-b-jet
Definition: Chi2.h:17
bool invalidMatch_
match is invalid
const pat::Particle fittedLightQBar() const
return fitted light quark candidate
const pat::Particle fittedB() const
return fitted b quark candidate
KinFit()
default constructor
void setMatch(std::vector< int > match)
set match to be used
TAbsFitParticle * lightPBar_
void setMatchInvalidity(bool invalidMatch)
set the validity of a match