CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PrunedRecombiner.cc
Go to the documentation of this file.
1 //
3 // Implements the PrunedRecombiner class. See PrunedRecombiner.hh
4 //
6 
7 #include "RecoJets/JetAlgorithms/interface/PrunedRecombiner.hh"
8 
9 #include <sstream>
10 
11 using namespace fastjet;
12 
14 {
15  std::ostringstream s;
16  s << "Pruned " << _recombiner->description()
17  << ", with zcut = " << _zcut << " and Rcut = " << _Rcut;
18  return s.str();
19 }
20 
21 // Recombine pa and pb and put result into pab.
22 // If pruning test is true (the recombination is vetoed) the harder
23 // parent is merged with a 0 PseudoJet. (Check that this is an identity in
24 // all recombination schemes!)
25 // When a branch is pruned, its cluster_hist_index is stored in
26 // _pruned_pseudojets for later use.
27 void PrunedRecombiner::recombine(const PseudoJet & pa, const PseudoJet & pb,
28  PseudoJet & pab) const
29 {
30  PseudoJet p0(0.0, 0.0, 0.0, 0.0);
31  // test if recombination should be pruned
32  switch ( _pruning_test(pa, pb) ) {
33  case 1:
34  _pruned_pseudojets.push_back(pb.cluster_hist_index());
35  _recombiner->recombine(pa, p0, pab);
36  break;
37  case 2:
38  _pruned_pseudojets.push_back(pa.cluster_hist_index());
39  _recombiner->recombine(pb, p0, pab);
40  break;
41  default:
42  // if no pruning, do regular combination
43  _recombiner->recombine(pa, pb, pab);
44  }
45 }
46 
47 
48 // Function to test if two pseudojets should be merged -- ie, to selectively
49 // veto mergings. Should provide possibility to provide this function...
50 // Return codes:
51 //
52 // 0: Merge. (Currently, anything other than 1 or 2 will do.)
53 // 1: Don't merge; keep pa
54 // 2: Don't merge; keep pb
55 //
56 int PrunedRecombiner::_pruning_test(const PseudoJet & pa, const PseudoJet & pb) const
57 {
58  // create the new jet by recombining the first two, using the normal
59  // recombination scheme
60  PseudoJet newjet;
61  _recombiner->recombine(pa, pb, newjet);
62 
63  double minpT = pa.perp();
64  int hard = 2; // harder pj is pj2
65  double tmp = pb.perp();
66  if (tmp < minpT) {
67  minpT = tmp;
68  hard = 1; // harder pj is pj1
69  }
70 
71  if ( pa.squared_distance(pb) < _Rcut*_Rcut
72  || minpT > _zcut * newjet.perp() )
73  return 0;
74  else
75  return hard;
76 }
77 
78 
79 void PrunedRecombiner::reset(const double & zcut, const double & Rcut)
80 {
81  _pruned_pseudojets.clear();
82  _zcut = zcut;
83  _Rcut = Rcut;
84 }
susybsm::HSCParticle pa
Definition: classes.h:8
tuple description
Definition: idDealer.py:66
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void reset(double vett[256])
Definition: TPedValues.cc:11