CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/RecoJets/JetAlgorithms/src/PrunedRecombiner.cc

Go to the documentation of this file.
00001 
00002 //
00003 // PrunedRecombiner.cc
00004 // Last update: 5/28/09 CKV
00005 // PrunedRecomb version: 0.2.0
00006 // Author: Christopher Vermilion <verm@u.washington.edu>
00007 //
00008 // Implements the PrunedRecombiner class.  See PrunedRecombiner.hh
00009 //
00011 
00012 #include "PrunedRecombPlugin.h"
00013 
00014 #include <string>
00015 #include <sstream>
00016 #include <iostream>
00017 
00018 FASTJET_BEGIN_NAMESPACE
00019 
00020 std::string PrunedRecombiner::description() const
00021 {
00022         std::ostringstream s;
00023         s << "Pruned " << JetDefinition::DefaultRecombiner::description()
00024           << ", with zcut = " << _zcut << " and Rcut = " << _Rcut;
00025         return s.str();
00026 }       
00027         
00032 void PrunedRecombiner::recombine(const PseudoJet & pa, const PseudoJet & pb, 
00033                            PseudoJet & pab) const
00034 {
00035         //std::cout << "In PR::recombine()\n";
00036         PseudoJet p0(0.0, 0.0, 0.0, 0.0);
00037         // test if recombination should be pruned
00038         switch ( _pruning_test(pa, pb) ) {
00039                 case 1:
00040                         // MAKE RECORD OF PB BEING PRUNED
00041                         JetDefinition::DefaultRecombiner::recombine(pa, p0, pab);
00042                         break;
00043                 case 2:
00044                         // MAKE RECORD OF PA BEING PRUNED
00045                         JetDefinition::DefaultRecombiner::recombine(pb, p0, pab);
00046                         break;
00047                 default: 
00048                         // if no pruning, do regular combination
00049                         JetDefinition::DefaultRecombiner::recombine(pa, pb, pab);
00050         }
00051 }
00052 
00053                 
00054 // Function to test if two pseudojets should be merged -- ie, to selectively
00055 //   veto mergings.  Should provide possibility to provide this function...
00056 //   Return codes:
00057 //
00058 //   0: Merge.  (Currently, anything other than 1 or 2 will do.)
00059 //   1: Don't merge; keep pa
00060 //   2: Don't merge; keep pb 
00061 //
00062 int PrunedRecombiner::_pruning_test(const PseudoJet & pa, const PseudoJet & pb) const
00063 {
00064         // create the new jet by recombining the first two, using the normal
00065         //   recombination scheme
00066         PseudoJet newjet;       
00067         JetDefinition::DefaultRecombiner::recombine(pa, pb, newjet);
00068 
00069         double minpT = pa.perp();
00070         int hard = 2;  // harder pj is pj2
00071         double tmp = pb.perp();
00072         if (tmp < minpT) {
00073                 minpT = tmp;
00074                 hard = 1;  // harder pj is pj1
00075         }
00076         
00077         if ( pa.squared_distance(pb) < _Rcut*_Rcut 
00078               || minpT > _zcut * newjet.perp() )
00079                 return 0;
00080         else
00081                 return hard;
00082 }
00083 
00084 
00085 FASTJET_END_NAMESPACE
00086