Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:25

0001 ///////////////////////////////////////////////////////////////////////////////
0002 //
0003 // Implements the PrunedRecombiner class.  See PrunedRecombiner.hh
0004 //
0005 ///////////////////////////////////////////////////////////////////////////////
0006 
0007 #include "RecoJets/JetAlgorithms/interface/PrunedRecombiner.hh"
0008 
0009 #include <sstream>
0010 
0011 using namespace fastjet;
0012 
0013 std::string PrunedRecombiner::description() const {
0014   std::ostringstream s;
0015   s << "Pruned " << _recombiner->description() << ", with zcut = " << _zcut << " and Rcut = " << _Rcut;
0016   return s.str();
0017 }
0018 
0019 // Recombine pa and pb and put result into pab.
0020 // If pruning test is true (the recombination is vetoed) the harder
0021 //   parent is merged with a 0 PseudoJet. (Check that this is an identity in
0022 //   all recombination schemes!)
0023 // When a branch is pruned, its cluster_hist_index is stored in
0024 //   _pruned_pseudojets for later use.
0025 void PrunedRecombiner::recombine(const PseudoJet& pa, const PseudoJet& pb, PseudoJet& pab) const {
0026   PseudoJet p0(0.0, 0.0, 0.0, 0.0);
0027   // test if recombination should be pruned
0028   switch (_pruning_test(pa, pb)) {
0029     case 1:
0030       _pruned_pseudojets.push_back(pb.cluster_hist_index());
0031       _recombiner->recombine(pa, p0, pab);
0032       break;
0033     case 2:
0034       _pruned_pseudojets.push_back(pa.cluster_hist_index());
0035       _recombiner->recombine(pb, p0, pab);
0036       break;
0037     default:
0038       // if no pruning, do regular combination
0039       _recombiner->recombine(pa, pb, pab);
0040   }
0041 }
0042 
0043 // Function to test if two pseudojets should be merged -- ie, to selectively
0044 //   veto mergings.  Should provide possibility to provide this function...
0045 //   Return codes:
0046 //
0047 //   0: Merge.  (Currently, anything other than 1 or 2 will do.)
0048 //   1: Don't merge; keep pa
0049 //   2: Don't merge; keep pb
0050 //
0051 int PrunedRecombiner::_pruning_test(const PseudoJet& pa, const PseudoJet& pb) const {
0052   // create the new jet by recombining the first two, using the normal
0053   //   recombination scheme
0054   PseudoJet newjet;
0055   _recombiner->recombine(pa, pb, newjet);
0056 
0057   double minpT = pa.perp();
0058   int hard = 2;  // harder pj is pj2
0059   double tmp = pb.perp();
0060   if (tmp < minpT) {
0061     minpT = tmp;
0062     hard = 1;  // harder pj is pj1
0063   }
0064 
0065   if (pa.squared_distance(pb) < _Rcut * _Rcut || minpT > _zcut * newjet.perp())
0066     return 0;
0067   else
0068     return hard;
0069 }
0070 
0071 void PrunedRecombiner::reset(const double& zcut, const double& Rcut) {
0072   _pruned_pseudojets.clear();
0073   _zcut = zcut;
0074   _Rcut = Rcut;
0075 }