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