Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:37:32

0001 #ifndef RecoJets_JetAlgorithms_CMSInsideOutAlgorithm_h
0002 #define RecoJets_JetAlgorithms_CMSInsideOutAlgorithm_h
0003 
0004 /** \class Inside-Out Algorithm
0005  *
0006  * description
0007  *
0008  * \author Evan K. Friis, UC Davis (friis@physics.ucdavis.edu)
0009  * \some code adapted from RecoJets/JetAlgorithms/CMSIterativeConeAlgorithm
0010  ************************************************************/
0011 
0012 #include <list>
0013 #include <algorithm>
0014 
0015 #include "DataFormats/Candidate/interface/Candidate.h"
0016 #include "DataFormats/Math/interface/deltaR.h"
0017 #include <limits>
0018 #include <vector>
0019 #include <list>
0020 
0021 #include "fastjet/PseudoJet.hh"
0022 
0023 class CMSInsideOutAlgorithm {
0024 public:
0025   typedef reco::Particle::LorentzVector LorentzVector;
0026   typedef std::list<fastjet::PseudoJet>::iterator inputListIter;
0027   // binary predicate to sort a std::list of std::list<InputItem> iterators by increasing deltaR
0028   // from a eta-phi point specified in the ctor
0029   class ListIteratorLesserByDeltaR {
0030   public:
0031     ListIteratorLesserByDeltaR(const double& eta, const double& phi) : seedEta_(eta), seedPhi_(phi) {}
0032     bool operator()(const inputListIter& A, const inputListIter& B) const {
0033       double deltaR2A = reco::deltaR2((*A).eta(), seedEta_, (*A).phi(), seedPhi_);
0034       double deltaR2B = reco::deltaR2((*B).eta(), seedEta_, (*B).phi(), seedPhi_);
0035       return fabs(deltaR2A - deltaR2B) > std::numeric_limits<double>::epsilon()
0036                  ? deltaR2A < deltaR2B
0037                  : reco::deltaPhi((*A).phi(), seedPhi_) < reco::deltaPhi((*B).phi(), seedPhi_);
0038     };
0039 
0040   private:
0041     double seedEta_, seedPhi_;
0042   };
0043 
0044   /** Constructor
0045         \param seed defines the minimum ET in GeV of an object that can seed the jet
0046         \param growthparameter sets the growth parameter X, i.e. [dR < X/Et_jet]
0047         \param min/max size define the min/max size of jet in deltaR.  Min is included for resolution effects
0048         \param seedCharge can be the following values; -1 [don't care], 0 neutral only, 1 [tracks only]
0049         */
0050   CMSInsideOutAlgorithm(double seedObjectPt, double growthParameter, double maxSize, double minSize)
0051       : seedThresholdPt_(seedObjectPt),
0052         growthParameterSquared_(growthParameter * growthParameter),
0053         maxSizeSquared_(maxSize * maxSize),
0054         minSizeSquared_(minSize * minSize) {}
0055 
0056   /// Build from input candidate collection
0057   void run(const std::vector<fastjet::PseudoJet>& fInput, std::vector<fastjet::PseudoJet>& fOutput);
0058 
0059 private:
0060   double seedThresholdPt_;
0061   double growthParameterSquared_;
0062   double maxSizeSquared_;
0063   double minSizeSquared_;
0064 };
0065 
0066 #endif