Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef RecoJets_JetProducers_plugins_FastjetJetProducer_h
0002 #define RecoJets_JetProducers_plugins_FastjetJetProducer_h
0003 
0004 #include "RecoJets/JetProducers/interface/JetSpecific.h"
0005 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0006 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0007 
0008 #include "DataFormats/VertexReco/interface/Vertex.h"
0009 #include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h"
0010 
0011 #include "RecoJets/JetProducers/plugins/VirtualJetProducer.h"
0012 
0013 #include <fastjet/tools/Transformer.hh>
0014 
0015 // a function returning
0016 //   min(Rmax, deltaR_factor * deltaR(j1,j2))
0017 // where j1 and j2 are the 2 subjets of j
0018 // if the jet does not have exactly 2 pieces, Rmax is used.
0019 class DynamicRfilt : public fastjet::FunctionOfPseudoJet<double> {
0020 public:
0021   // default ctor
0022   DynamicRfilt(double Rmax, double deltaR_factor) : _Rmax(Rmax), _deltaR_factor(deltaR_factor) {}
0023 
0024   // action of the function
0025   double result(const fastjet::PseudoJet& j) const override {
0026     if (!j.has_pieces())
0027       return _Rmax;
0028 
0029     std::vector<fastjet::PseudoJet> pieces = j.pieces();
0030     if (pieces.size() != 2)
0031       return _Rmax;
0032 
0033     double deltaR = pieces[0].delta_R(pieces[1]);
0034     return std::min(_Rmax, _deltaR_factor * deltaR);
0035   }
0036 
0037 private:
0038   double _Rmax, _deltaR_factor;
0039 };
0040 
0041 class FastjetJetProducer : public VirtualJetProducer {
0042 public:
0043   // typedefs
0044   typedef fastjet::Transformer transformer;
0045   typedef std::unique_ptr<transformer> transformer_ptr;
0046   typedef std::vector<transformer_ptr> transformer_coll;
0047   //
0048   // construction/destruction
0049   //
0050   explicit FastjetJetProducer(const edm::ParameterSet& iConfig);
0051   ~FastjetJetProducer() override;
0052   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0053   static void fillDescriptionsFromFastJetProducer(edm::ParameterSetDescription& desc);
0054 
0055   void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
0056 
0057   // typedefs
0058   typedef std::shared_ptr<DynamicRfilt> DynamicRfiltPtr;
0059 
0060 protected:
0061   //
0062   // member functions
0063   //
0064 
0065   virtual void produceTrackJets(edm::Event& iEvent, const edm::EventSetup& iSetup);
0066   void runAlgorithm(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
0067 
0068 private:
0069   // trackjet clustering parameters
0070   bool useOnlyVertexTracks_;
0071   bool useOnlyOnePV_;
0072   float dzTrVtxMax_;
0073   float dxyTrVtxMax_;
0074   int minVtxNdof_;
0075   float maxVtxZ_;
0076 
0077   // jet trimming parameters
0078   bool useMassDropTagger_;                 /// Mass-drop tagging for boosted Higgs
0079   bool useFiltering_;                      /// Jet filtering technique
0080   bool useDynamicFiltering_;               /// Use dynamic filtering radius (as in arXiv:0802.2470)
0081   bool useTrimming_;                       /// Jet trimming technique
0082   bool usePruning_;                        /// Jet pruning technique
0083   bool useCMSBoostedTauSeedingAlgorithm_;  /// algorithm for seeding reconstruction of boosted Taus (similar to mass-drop tagging)
0084   bool useKtPruning_;                      /// Use Kt clustering algorithm for pruning (default is Cambridge/Aachen)
0085   bool useConstituentSubtraction_;  /// constituent subtraction technique
0086   bool useSoftDrop_;                /// Soft drop
0087   bool correctShape_;               /// Correct the shape of the jets
0088   double muCut_;                    /// for mass-drop tagging, m0/mjet (m0 = mass of highest mass subjet)
0089   double yCut_;                     /// for mass-drop tagging, symmetry cut: min(pt1^2,pt2^2) * dR(1,2) / mjet > ycut
0090   double rFilt_;                    /// for filtering, trimming: dR scale of sub-clustering
0091   DynamicRfiltPtr rFiltDynamic_;    /// for dynamic filtering radius (as in arXiv:0802.2470)
0092   double rFiltFactor_;              /// for dynamic filtering radius (as in arXiv:0802.2470)
0093   int nFilt_;                       /// for filtering, pruning: number of subjets expected
0094   double trimPtFracMin_;            /// for trimming: constituent minimum pt fraction of full jet
0095   double zCut_;                     /// for pruning OR soft drop: constituent minimum pt fraction of parent cluster
0096   double RcutFactor_;               /// for pruning: constituent dR * pt/2m < rcut_factor
0097   double csRho_EtaMax_;             /// for constituent subtraction : maximum rapidity for ghosts
0098   double csRParam_;  /// for constituent subtraction : R parameter for KT alg in jet median background estimator
0099   double beta_;      /// for soft drop : beta (angular exponent)
0100   double R0_;        /// for soft drop : R0 (angular distance normalization - should be set to jet radius in most cases)
0101   double gridMaxRapidity_;  /// for shape subtraction, get the fixed-grid rho
0102   double gridSpacing_;      /// for shape subtraction, get the grid spacing
0103 
0104   double subjetPtMin_;  /// for CMSBoostedTauSeedingAlgorithm : subjet pt min
0105   double muMin_;        /// for CMSBoostedTauSeedingAlgorithm : min mass-drop
0106   double muMax_;        /// for CMSBoostedTauSeedingAlgorithm : max mass-drop
0107   double yMin_;         /// for CMSBoostedTauSeedingAlgorithm : min asymmetry
0108   double yMax_;         /// for CMSBoostedTauSeedingAlgorithm : max asymmetry
0109   double dRMin_;        /// for CMSBoostedTauSeedingAlgorithm : min dR
0110   double dRMax_;        /// for CMSBoostedTauSeedingAlgorithm : max dR
0111   int maxDepth_;        /// for CMSBoostedTauSeedingAlgorithm : max depth for descending into clustering sequence
0112 
0113   // tokens for the data access
0114   edm::EDGetTokenT<edm::View<reco::RecoChargedRefCandidate> > input_chrefcand_token_;
0115 };
0116 
0117 #endif