CMS 3D CMS Logo

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  std::ostringstream s;
15  s << "Pruned " << _recombiner->description() << ", with zcut = " << _zcut << " and Rcut = " << _Rcut;
16  return s.str();
17 }
18 
19 // Recombine pa and pb and put result into pab.
20 // If pruning test is true (the recombination is vetoed) the harder
21 // parent is merged with a 0 PseudoJet. (Check that this is an identity in
22 // all recombination schemes!)
23 // When a branch is pruned, its cluster_hist_index is stored in
24 // _pruned_pseudojets for later use.
25 void PrunedRecombiner::recombine(const PseudoJet& pa, const PseudoJet& pb, PseudoJet& pab) const {
26  PseudoJet p0(0.0, 0.0, 0.0, 0.0);
27  // test if recombination should be pruned
28  switch (_pruning_test(pa, pb)) {
29  case 1:
30  _pruned_pseudojets.push_back(pb.cluster_hist_index());
31  _recombiner->recombine(pa, p0, pab);
32  break;
33  case 2:
34  _pruned_pseudojets.push_back(pa.cluster_hist_index());
35  _recombiner->recombine(pb, p0, pab);
36  break;
37  default:
38  // if no pruning, do regular combination
39  _recombiner->recombine(pa, pb, pab);
40  }
41 }
42 
43 // Function to test if two pseudojets should be merged -- ie, to selectively
44 // veto mergings. Should provide possibility to provide this function...
45 // Return codes:
46 //
47 // 0: Merge. (Currently, anything other than 1 or 2 will do.)
48 // 1: Don't merge; keep pa
49 // 2: Don't merge; keep pb
50 //
51 int PrunedRecombiner::_pruning_test(const PseudoJet& pa, const PseudoJet& pb) const {
52  // create the new jet by recombining the first two, using the normal
53  // recombination scheme
54  PseudoJet newjet;
55  _recombiner->recombine(pa, pb, newjet);
56 
57  double minpT = pa.perp();
58  int hard = 2; // harder pj is pj2
59  double tmp = pb.perp();
60  if (tmp < minpT) {
61  minpT = tmp;
62  hard = 1; // harder pj is pj1
63  }
64 
65  if (pa.squared_distance(pb) < _Rcut * _Rcut || minpT > _zcut * newjet.perp())
66  return 0;
67  else
68  return hard;
69 }
70 
71 void PrunedRecombiner::reset(const double& zcut, const double& Rcut) {
72  _pruned_pseudojets.clear();
73  _zcut = zcut;
74  _Rcut = Rcut;
75 }
fastjet
Definition: BackgroundEstimator.h:8
edmLumisInFiles.description
description
Definition: edmLumisInFiles.py:11
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
TrackValidationHeavyIons_cff.minpT
minpT
Definition: TrackValidationHeavyIons_cff.py:33
alignCSCRings.s
s
Definition: alignCSCRings.py:92
HLT_FULL_cff.zcut
zcut
Definition: HLT_FULL_cff.py:8647
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
reset
void reset(double vett[256])
Definition: TPedValues.cc:11