CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
CMSTopTagger Class Reference

#include <CMSTopTagger.h>

Inheritance diagram for CMSTopTagger:

Public Types

typedef CMSTopTaggerStructure StructureType
 

Public Member Functions

 CMSTopTagger (double delta_p=0.05, double delta_r=0.4, double A=0.0004)
 
std::string description () const override
 returns a textual description of the tagger More...
 
PseudoJet result (const PseudoJet &jet) const override
 

Protected Member Functions

void _find_min_mass (const std::vector< PseudoJet > &subjets, int &i, int &j) const
 
std::vector< PseudoJet > _split_once (const PseudoJet &jet_to_split, const PseudoJet &reference_jet) const
 runs the Johns Hopkins decomposition procedure More...
 

Protected Attributes

double _A
 
double _delta_p
 
double _delta_r
 
LimitedWarning _warnings_nonca
 

Detailed Description

Definition at line 54 of file CMSTopTagger.h.

Member Typedef Documentation

Definition at line 78 of file CMSTopTagger.h.

Constructor & Destructor Documentation

CMSTopTagger::CMSTopTagger ( double  delta_p = 0.05,
double  delta_r = 0.4,
double  A = 0.0004 
)
inline

The parameters are the following:

Parameters
delta_pfractional pt cut imposed on the subjets (computed as a fraction of the original jet)
delta_rminimum distance between 2 subjets (computed as sqrt((y1-y2)^2+(phi1-phi2)^2))
Athe actual DeltaR cut is (delta_r - A * pT_child)

The default values of these parameters are taken from CMS-PAS-JME-10-013. For the older tagger described in CMS-PAS-JME-09-001, use delta_p=0.05, delta_r=0.0, A=0.0

Definition at line 109 of file CMSTopTagger.h.

110  : _delta_p(delta_p), _delta_r(delta_r), _A(A) {}
double _delta_p
Definition: CMSTopTagger.h:89
double delta_r(const Fourvec &a, const Fourvec &b)
Find the distance between two four-vectors in the two-dimensional space .
Definition: fourvec.cc:249
double _delta_r
Definition: CMSTopTagger.h:89

Member Function Documentation

void CMSTopTagger::_find_min_mass ( const std::vector< PseudoJet > &  subjets,
int &  i,
int &  j 
) const
inlineprotected

find the indices corresponding to the minimum mass pairing in subjets only considers the hardest 3

Definition at line 227 of file CMSTopTagger.h.

References cuy::ii, findQualityFiles::jj, funct::m, SiStripPI::max, cosmictrackSelector_cfi::min_pt, and perp().

Referenced by result().

227  {
228  assert(subjets.size() > 1 && subjets.size() < 5);
229 
230  // if four subjets found, only consider three hardest
231  unsigned softest = 5; // invalid value
232  if (subjets.size() == 4) {
234  for (unsigned ii = 0; ii < subjets.size(); ++ii) {
235  if (subjets[ii].perp() < min_pt) {
236  min_pt = subjets[ii].perp();
237  softest = ii;
238  }
239  }
240  }
241 
242  double min_mass = std::numeric_limits<double>::max();
243  for (unsigned ii = 0; ii+1 < subjets.size(); ++ii) { // don't do size()-1: (unsigned(0)-1 != -1) !!
244  if (ii == softest) continue;
245  for (unsigned jj = ii + 1; jj < subjets.size(); ++jj) {
246  if (jj == softest) continue;
247  if ((subjets[ii]+subjets[jj]).m() < min_mass) {
248  min_mass = (subjets[ii]+subjets[jj]).m();
249  i = ii;
250  j = jj;
251  }
252  }
253  }
254 }
ii
Definition: cuy.py:590
T perp() const
Magnitude of transverse component.
std::vector< PseudoJet > CMSTopTagger::_split_once ( const PseudoJet &  jet_to_split,
const PseudoJet &  reference_jet 
) const
inlineprotected

runs the Johns Hopkins decomposition procedure

Definition at line 203 of file CMSTopTagger.h.

References _A, _delta_p, _delta_r, p1, p2, result(), and std::swap().

Referenced by result().

204  {
205  PseudoJet this_jet = jet_to_split;
206  PseudoJet p1, p2;
207  std::vector<PseudoJet> result;
208  while (this_jet.has_parents(p1, p2)) {
209  if (p2.perp2() > p1.perp2()) std::swap(p1,p2); // order with hardness
210  if (p1.perp() < _delta_p * reference_jet.perp()) break; // harder is too soft wrt original jet
211  double DR = p1.delta_R(p2);
212  if (DR < _delta_r - _A * this_jet.perp()) break; // distance is too small
213  if (p2.perp() < _delta_p * reference_jet.perp()) {
214  this_jet = p1; // softer is too soft wrt original, so ignore it
215  continue;
216  }
217  //result.push_back(this_jet);
218  result.push_back(p1);
219  result.push_back(p2);
220  break;
221  }
222  return result;
223 }
double _delta_p
Definition: CMSTopTagger.h:89
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
double p2[4]
Definition: TauolaWrapper.h:90
PseudoJet result(const PseudoJet &jet) const override
Definition: CMSTopTagger.h:126
double p1[4]
Definition: TauolaWrapper.h:89
double _delta_r
Definition: CMSTopTagger.h:89
std::string CMSTopTagger::description ( ) const
inlineoverride

returns a textual description of the tagger

Definition at line 114 of file CMSTopTagger.h.

References _A, _delta_p, and _delta_r.

114  {
115  std::ostringstream oss;
116  oss << "CMSTopTagger with delta_p=" << _delta_p << ", delta_r=" << _delta_r
117  << ", and A=" << _A;
118  oss << description_of_selectors();
119  return oss.str();
120 }
double _delta_p
Definition: CMSTopTagger.h:89
double _delta_r
Definition: CMSTopTagger.h:89
PseudoJet CMSTopTagger::result ( const PseudoJet &  jet) const
inlineoverride

runs the tagger on the given jet and returns the tagged PseudoJet if successful, or a PseudoJet==0 otherwise (standard access is through operator()).

Parameters
jetthe PseudoJet to tag

Definition at line 126 of file CMSTopTagger.h.

References _find_min_mass(), _split_once(), _warnings_nonca, mps_fire::i, cuy::ii, findQualityFiles::jj, join(), perp2(), alignCSCRings::s, and std::swap().

Referenced by _split_once().

126  {
127  // make sure that there is a "regular" cluster sequence associated
128  // with the jet. Note that we also check it is valid (to avoid a
129  // more criptic error later on)
130  if (!jet.has_valid_cluster_sequence()){
131  throw Error("CMSTopTagger can only be applied on jets having an associated (and valid) ClusterSequence");
132  }
133 
134  // warn if the jet has not been clustered with a Cambridge/Aachen
135  // algorithm
136  if (jet.validated_cs()->jet_def().jet_algorithm() != cambridge_algorithm)
137  _warnings_nonca.warn("CMSTopTagger should only be applied on jets from a Cambridge/Aachen clustering; use it with other algorithms at your own risk.");
138 
139 
140  // do the first splitting
141  std::vector<PseudoJet> split0 = _split_once(jet, jet);
142  if (split0.empty()) return PseudoJet();
143 
144  // now try a second splitting on each of the resulting objects
145  std::vector<PseudoJet> subjets;
146  for (unsigned i = 0; i < 2; i++) {
147  std::vector<PseudoJet> split1 = _split_once(split0[i], jet);
148  if (!split1.empty()) {
149  subjets.push_back(split1[0]);
150  subjets.push_back(split1[1]);
151  } else {
152  subjets.push_back(split0[i]);
153  }
154  }
155 
156  // make sure things make sense
157  if (subjets.size() < 3) return PseudoJet();
158 
159  // now find the pair of subjets with minimum mass (only taking hardest three)
160  int ii=-1, jj=-1;
161  _find_min_mass(subjets, ii, jj);
162 
163  // order the subjets in the following order:
164  // - hardest of the W subjets
165  // - softest of the W subjets
166  // - hardest of the remaining subjets
167  // - softest of the remaining subjets (if any)
168  if (ii>0) std::swap(subjets[ii], subjets[0]);
169  if (jj>1) std::swap(subjets[jj], subjets[1]);
170  if (subjets[0].perp2() < subjets[1].perp2()) std::swap(subjets[0], subjets[1]);
171  if ((subjets.size()>3) && (subjets[2].perp2() < subjets[3].perp2()))
172  std::swap(subjets[2], subjets[3]);
173 
174  // create the result and its structure
175  const JetDefinition::Recombiner *rec
176  = jet.associated_cluster_sequence()->jet_def().recombiner();
177 
178  PseudoJet W = join(subjets[0], subjets[1], *rec);
179  PseudoJet non_W;
180  if (subjets.size()>3) {
181  non_W = join(subjets[2], subjets[3], *rec);
182  } else {
183  non_W = join(subjets[2], *rec);
184  }
185  PseudoJet result = join<CMSTopTaggerStructure>(W, non_W, *rec);
186  CMSTopTaggerStructure *s = (CMSTopTaggerStructure*) result.structure_non_const_ptr();
187  s->_cos_theta_w = _cos_theta_W(result);
188 
189  // Note that we could perhaps ensure this cut before constructing
190  // the result structure but this has the advantage that the top
191  // 4-vector is already available and does not have to de re-computed
192  if (!_top_selector.pass(result) || ! _W_selector.pass(W)) {
193  result *= 0.0;
194  }
195 
196  result = join(subjets); //Added by J. Pilot to combine the (up to 4) subjets identified in the decomposition instead of just the W and non_W components
197 
198  return result;
199 }
edm::ErrorSummaryEntry Error
LimitedWarning _warnings_nonca
Definition: CMSTopTagger.h:90
void _find_min_mass(const std::vector< PseudoJet > &subjets, int &i, int &j) const
Definition: CMSTopTagger.h:227
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
ii
Definition: cuy.py:590
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
T perp2() const
Squared magnitude of transverse component.
PseudoJet result(const PseudoJet &jet) const override
Definition: CMSTopTagger.h:126
std::vector< PseudoJet > _split_once(const PseudoJet &jet_to_split, const PseudoJet &reference_jet) const
runs the Johns Hopkins decomposition procedure
Definition: CMSTopTagger.h:203

Member Data Documentation

double CMSTopTagger::_A
protected

Definition at line 89 of file CMSTopTagger.h.

Referenced by _split_once(), and description().

double CMSTopTagger::_delta_p
protected

Definition at line 89 of file CMSTopTagger.h.

Referenced by _split_once(), and description().

double CMSTopTagger::_delta_r
protected

Definition at line 89 of file CMSTopTagger.h.

Referenced by _split_once(), and description().

LimitedWarning CMSTopTagger::_warnings_nonca
mutableprotected

Definition at line 90 of file CMSTopTagger.h.

Referenced by result().