CMS 3D CMS Logo

HEPTopTaggerWrapperV2.h
Go to the documentation of this file.
1 // 2011 Christopher Vermilion
2 //
3 //----------------------------------------------------------------------
4 // This file is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This file is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // The GNU General Public License is available at
15 // http://www.gnu.org/licenses/gpl.html or you can write to the Free Software
16 // Foundation, Inc.:
17 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 //----------------------------------------------------------------------
19 
20 #ifndef __HEPTOPTAGGER_WRAPPERV2_HH__
21 #define __HEPTOPTAGGER_WRAPPERV2_HH__
22 
23 #include <fastjet/tools/TopTaggerBase.hh>
24 #include <fastjet/CompositeJetStructure.hh>
25 #include "CLHEP/Random/RandomEngine.h"
26 #include <sstream>
27 
28 FASTJET_BEGIN_NAMESPACE
29 
43 
44 // Removed legacy comments by CHRISTOPHER SILKWORTH
45 
47 
48 
49 class HEPTopTaggerV2 : public TopTaggerBase {
50 public:
51  HEPTopTaggerV2(bool DoOptimalR,
52  bool DoQjets,
53  double minSubjetPt,
54  double minCandPt,
55  double subjetMass,
56  double muCut,
57  double filtR,
58  int filtN,
59  int mode,
60  double minCandMass,
61  double maxCandMass,
62  double massRatioWidth,
63  double minM23Cut,
64  double minM13Cut,
65  double maxM13Cut,
66  bool optRrejectMin) : DoOptimalR_(DoOptimalR),
67  DoQjets_(DoQjets),
68  minSubjetPt_(minSubjetPt),
69  minCandPt_(minCandPt),
70  subjetMass_(subjetMass),
71  muCut_(muCut),
72  filtR_(filtR),
73  filtN_(filtN),
74  mode_(mode),
75  minCandMass_(minCandMass),
76  maxCandMass_(maxCandMass),
77  massRatioWidth_(massRatioWidth),
78  minM23Cut_(minM23Cut),
79  minM13Cut_(minM13Cut),
80  maxM13Cut_(maxM13Cut),
81  optRrejectMin_(optRrejectMin),
83  {}
84 
86  std::string description() const override;
87 
92  PseudoJet result(const PseudoJet & jet) const override;
93 
94  void set_rng(CLHEP::HepRandomEngine* engine){ engine_ = engine;}
95 
96  // the type of the associated structure
98 
99 private:
100  bool DoOptimalR_; // Use optimalR mode
101  bool DoQjets_; // Use qjet mode
102 
103  double minSubjetPt_; // Minimal pT for subjets [GeV]
104  double minCandPt_; // Minimal pT to return a candidate [GeV]
105 
106  double subjetMass_; // Mass above which subjets are further unclustered
107  double muCut_; // Mass drop threshold
108 
109  double filtR_; // maximal filtering radius
110  int filtN_; // number of filtered subjets to use
111 
112  // HEPTopTagger Mode
113  // 0: do 2d-plane, return candidate with delta m_top minimal
114  // 1: return candidate with delta m_top minimal IF passes 2d plane
115  // 2: do 2d-plane, return candidate with max dj_sum
116  // 3: return candidate with max dj_sum IF passes 2d plane
117  // 4: return candidate built from leading three subjets after unclustering IF passes 2d plane
118  // Note: Original HTT was mode==1
119  int mode_;
120 
121  // Top Quark mass window in GeV
122  double minCandMass_;
123  double maxCandMass_;
124 
125  double massRatioWidth_; // One sided width of the A-shaped window around m_W/m_top in %
126  double minM23Cut_; // minimal value of m23/m123
127  double minM13Cut_; // minimal value of atan(m13/m12)
128  double maxM13Cut_; // maximal value of atan(m13/m12)
129 
130  bool optRrejectMin_; // set Ropt to zero for candidates that never leave the window around the initial mass
131  // otherwise (default) set them to R=0.5
132 
133  // Random engine for Q-jet HTT
134  CLHEP::HepRandomEngine* engine_;
135 };
136 
137 
138 class HEPTopTaggerV2Structure : public CompositeJetStructure, public TopTaggerBaseStructure {
139 
140  public:
142  HEPTopTaggerV2Structure(const std::vector<PseudoJet>& pieces_in,
143  const JetDefinition::Recombiner *recombiner = nullptr) : CompositeJetStructure(pieces_in, recombiner),
144  _fj_mass(0.0),
145  _fj_pt(0.0),
146  _fj_eta(0.0),
147  _fj_phi(0.0),
148  _top_mass(0.0),
149  _unfiltered_mass(0.0),
150  _pruned_mass(0.0),
151  _fRec(-1.),
152  _mass_ratio_passed(-1),
153  _ptForRoptCalc(-1),
154  _tau1Unfiltered(-1.),
155  _tau2Unfiltered(-1.),
156  _tau3Unfiltered(-1.),
157  _tau1Filtered(-1.),
158  _tau2Filtered(-1.),
159  _tau3Filtered(-1.),
160  _qweight(-1.),
161  _qepsilon(-1.),
162  _qsigmaM(-1.),
163  W_rec(recombiner),
164  rW_(){}
165 
166  // Return W subjet
167  inline PseudoJet const & W() const override{
168  rW_ = join(_pieces[0], _pieces[1], *W_rec);
169  return rW_;
170  }
171 
172  // Return leading subjet in W
173  inline PseudoJet W1() const{
174  assert(!W().pieces().empty());
175  return W().pieces()[0];
176  }
177 
179  inline PseudoJet W2() const{
180  assert(W().pieces().size()>1);
181  return W().pieces()[1];
182  }
183 
184 
188  inline const PseudoJet & non_W() const override{
189  return _pieces[2];
190  }
191 
193  inline double fj_mass() const {return _fj_mass;}
194 
196  inline double fj_pt() const {return _fj_pt;}
197 
199  inline double fj_eta() const {return _fj_eta;}
200 
202  inline double fj_phi() const {return _fj_phi;}
203 
205  inline double top_mass() const {return _top_mass;}
206 
208  inline double unfiltered_mass() const {return _unfiltered_mass;}
209 
211  inline double pruned_mass() const {return _pruned_mass;}
212 
214  inline double fRec() const {return _fRec;}
215 
217  inline double mass_ratio_passed() const {return _mass_ratio_passed;}
218 
220  inline double ropt() const {return _ropt;}
221 
223  inline double roptCalc() const {return _roptCalc;}
224 
226  inline double ptForRoptCalc() const {return _ptForRoptCalc;}
227 
228  // Nsubjettiness and Q-jet variables
229  inline double Tau1Unfiltered() const {return _tau1Unfiltered;}
230  inline double Tau2Unfiltered() const {return _tau2Unfiltered;}
231  inline double Tau3Unfiltered() const {return _tau3Unfiltered;}
232  inline double Tau1Filtered() const {return _tau1Filtered;}
233  inline double Tau2Filtered() const {return _tau2Filtered;}
234  inline double Tau3Filtered() const {return _tau3Filtered;}
235 
236  inline double qweight() const {return _qweight;}
237  inline double qepsilon() const {return _qepsilon;}
238  inline double qsigmaM() const {return _qsigmaM;}
239 
240  protected:
241 
242  double _fj_mass;
243  double _fj_pt;
244  double _fj_eta;
245  double _fj_phi;
246 
247  double _top_mass;
249  double _pruned_mass;
250  double _fRec;
253  double _ropt;
254  double _roptCalc;
255 
262  double _qweight;
263  double _qepsilon;
264  double _qsigmaM;
265 
266  const JetDefinition::Recombiner * W_rec;
267 
268  mutable PseudoJet rW_;
269 
270  // allow the tagger to set these
271  friend class HEPTopTaggerV2;
272  };
273 
274 
275 //------------------------------------------------------------------------
276 // description of the tagger
278 
279  std::ostringstream oss;
280  oss << "HEPTopTaggerV2 with: "
281  << "minSubjetPt = " << minSubjetPt_
282  << "minCandPt = " << minCandPt_
283  << "subjetMass = " << subjetMass_
284  << "muCut = " << muCut_
285  << "filtR = " << filtR_
286  << "filtN = " << filtN_
287  << "mode = " << mode_
288  << "minCandMass = " << minCandMass_
289  << "maxCandMass = " << maxCandMass_
290  << "massRatioWidth = " << massRatioWidth_
291  << "minM23Cut = " << minM23Cut_
292  << "minM13Cut = " << minM13Cut_
293  << "maxM13Cut = " << maxM13Cut_ << std::endl;
294  return oss.str();
295 }
296 
297 
298 FASTJET_END_NAMESPACE
299 
300 #endif // __HEPTOPTAGGER_HH__
size
Write out results.
CLHEP::HepRandomEngine * engine_
PseudoJet const & W() const override
const JetDefinition::Recombiner * W_rec
void set_rng(CLHEP::HepRandomEngine *engine)
#define nullptr
double fj_eta() const
return the eta of the initial fatjet
HEPTopTaggerV2Structure(const std::vector< PseudoJet > &pieces_in, const JetDefinition::Recombiner *recombiner=nullptr)
ctor with pieces initialisation
const PseudoJet & non_W() const override
double fRec() const
returns fRec
double roptCalc() const
returns calculated Ropt
double top_mass() const
returns the candidate mass
double unfiltered_mass() const
returns the unfiltered mass
std::string description() const override
returns a textual description of the tagger
double fj_pt() const
return the pt of the initial fatjet
double fj_mass() const
return the mass of the initial fatjet
PseudoJet result(const PseudoJet &jet) const override
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
double fj_phi() const
return the phi of the initial fatjet
HEPTopTaggerV2Structure StructureType
double mass_ratio_passed() const
returns if 2d-mass plane cuts were passed
HEPTopTaggerV2(bool DoOptimalR, bool DoQjets, double minSubjetPt, double minCandPt, double subjetMass, double muCut, double filtR, int filtN, int mode, double minCandMass, double maxCandMass, double massRatioWidth, double minM23Cut, double minM13Cut, double maxM13Cut, bool optRrejectMin)
PseudoJet W2() const
returns the second W subjet
double ropt() const
returns Ropt
double ptForRoptCalc() const
returns the filtered pT for calculating R_opt
double pruned_mass() const
returns the pruned mass