Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-05-12 09:05:03

0001 // -*- C++ -*-
0002 #ifndef RIVET_LeptonFinder_HH
0003 #define RIVET_LeptonFinder_HH
0004 
0005 #include "Rivet/DressedLepton.hh"
0006 #include "Rivet/Projections/FinalState.hh"
0007 #include "Rivet/Projections/PromptFinalState.hh"
0008 #include "Rivet/Projections/IdentifiedFinalState.hh"
0009 #include "Rivet/Config/RivetCommon.hh"
0010 
0011 namespace Rivet {
0012   
0013 
0014   /// @brief Reconstruct leptons, generally including "dressing" with clustered photons
0015   ///
0016   /// The clustering is done by a delta(R) cone around each bare lepton or by
0017   /// jet clustering. In both modes, double counting is avoided: for the dR
0018   /// clustering, a photon is only added to the _closest_ bare lepton if it
0019   /// happens to be within the capture radius of more than one; for the jet
0020   /// clustering, only the bare lepton with the highest pT is retained if more
0021   /// than one is clustered into a jet.
0022   ///
0023   /// @note The particles() and dressedLeptons() methods both return the
0024   /// composite clustered-lepton objects, just with a few extra helper methods
0025   /// on the special DressedLepton type returned by the latter. The constituent
0026   /// bare leptons and photons are returned by rawParticles() (inherited from
0027   /// ParticleFinder)
0028   ///
0029   class LeptonFinder : public FinalState {
0030   public:
0031 
0032     /// @brief Constructor with a single input FinalState (used for both photons and bare leptons)
0033     ///
0034     /// Provide a single final state projection used to select the photons and
0035     /// bare leptons, a photon-clustering delta(R) cone size around each bare
0036     /// lepton, and an optional cut on the _dressed_ leptons (i.e. the momenta
0037     /// and PID after clustering).  The final arguments control whether
0038     /// non-prompt photons are to be included, and whether the matching of
0039     /// photons to leptons is to be done via dR matching to the bare lepton or
0040     /// by a jet clustering algorithm.  Set the clustering radius to 0 or
0041     /// negative to disable clustering.
0042     LeptonFinder(const FinalState& allfs,
0043                  double dRdress,
0044                  const Cut& cut=Cuts::OPEN,
0045          DressingType dressing=DressingType::CONE)
0046       : LeptonFinder(allfs, allfs, dRdress, cut, dressing)
0047     {     }
0048 
0049 
0050     /// @brief Constructor with a single input FinalState and default dR
0051     ///
0052     /// Provide a single final state projection used to select the
0053     /// photons and bare leptons, an optional photon-clustering
0054     /// delta(R) cone size around each bare lepton, and an optional
0055     /// cut on the _dressed_ leptons (i.e. the momenta and PID after
0056     /// clustering).  The final arguments control whether non-prompt
0057     /// photons are to be included, and whether the matching of
0058     /// photons to leptons is to be done via dR matching to the bare
0059     /// lepton or by a jet clustering algorithm.  Set the clustering
0060     /// radius to 0 or negative to disable clustering.
0061     LeptonFinder(const FinalState& allfs,
0062          const Cut& cut,
0063                  double dRdress,
0064          DressingType dressing=DressingType::CONE)
0065       : LeptonFinder(allfs, dRdress, cut, dressing)
0066     {   }
0067 
0068 
0069     /// @brief Constructor with default input FinalState and deltaR
0070     ///
0071     /// Dressed lepton construction from a default FinalState and optional deltaR cone.
0072     /// Provide a photon-clustering delta(R) cone size around each bare lepton,
0073     /// and an optional cut on the _dressed_ leptons (i.e. the momenta and PID
0074     /// after clustering).  The final arguments control whether non-prompt
0075     /// photons are to be included, and whether the matching of photons to
0076     /// leptons is to be done via dR matching to the bare lepton or by a jet
0077     /// clustering algorithm.  Set the clustering radius to 0 or negative to
0078     /// disable clustering.
0079     LeptonFinder(const Cut& cut,
0080          double dRdress,
0081          LeptonOrigin whichleptons=LeptonOrigin::NODECAY,
0082          PhotonOrigin whichphotons=PhotonOrigin::NODECAY,
0083                  TauDecaysAs tauDecays=TauDecaysAs::PROMPT,
0084                  MuDecaysAs muDecays=MuDecaysAs::PROMPT,
0085          DressingType dressing=DressingType::CONE)
0086       : LeptonFinder(dRdress, cut, whichleptons, whichphotons, tauDecays, muDecays, dressing)
0087     {   }
0088 
0089 
0090     /// @brief Constructor with default input FinalState and deltaR
0091     ///
0092     /// Dressed lepton construction from a default FinalState and optional deltaR cone.
0093     /// Provide a photon-clustering delta(R) cone size around each bare lepton,
0094     /// and an optional cut on the _dressed_ leptons (i.e. the momenta and PID
0095     /// after clustering).  The final arguments control whether non-prompt
0096     /// photons are to be included, and whether the matching of photons to
0097     /// leptons is to be done via dR matching to the bare lepton or by a jet
0098     /// clustering algorithm.  Set the clustering radius to 0 or negative to
0099     /// disable clustering.
0100     LeptonFinder(const Cut& cut,
0101          double dRdress,
0102          DressingType dressing,
0103          LeptonOrigin whichleptons=LeptonOrigin::NODECAY,
0104          PhotonOrigin whichphotons=PhotonOrigin::NODECAY,
0105                  TauDecaysAs tauDecays=TauDecaysAs::PROMPT,
0106                  MuDecaysAs muDecays=MuDecaysAs::PROMPT)
0107       : LeptonFinder(dRdress, cut, whichleptons, whichphotons, tauDecays, muDecays, dressing)
0108     {   }
0109 
0110 
0111     /// @brief Constructor with default input FinalState
0112     ///
0113     /// DressedLepton construction from a default-constructed FinalState.
0114     /// Provide a photon-clustering delta(R) cone size around each bare lepton,
0115     /// and an optional cut on the _dressed_ leptons (i.e. the momenta and PID
0116     /// after clustering).  The final arguments control whether non-prompt
0117     /// photons are to be included, and whether the matching of photons to
0118     /// leptons is to be done via dR matching to the bare lepton or by a jet
0119     /// clustering algorithm.  Set the clustering radius to 0 or negative to
0120     /// disable clustering.
0121     LeptonFinder(double dRdress, const Cut& cut=Cuts::OPEN,
0122          LeptonOrigin whichleptons=LeptonOrigin::NODECAY,
0123          PhotonOrigin whichphotons=PhotonOrigin::NODECAY,
0124                  TauDecaysAs tauDecays=TauDecaysAs::PROMPT,
0125                  MuDecaysAs muDecays=MuDecaysAs::PROMPT,
0126          DressingType dressing=DressingType::CONE);
0127 
0128 
0129     /// @brief Constructor with default input FinalState
0130     ///
0131     /// DressedLepton construction from a default-constructed FinalState.
0132     /// Provide a photon-clustering delta(R) cone size around each bare lepton,
0133     /// and an optional cut on the _dressed_ leptons (i.e. the momenta and PID
0134     /// after clustering).  The final arguments control whether non-prompt
0135     /// photons are to be included, and whether the matching of photons to
0136     /// leptons is to be done via dR matching to the bare lepton or by a jet
0137     /// clustering algorithm.  Set the clustering radius to 0 or negative to
0138     /// disable clustering.
0139     LeptonFinder(double dRdress, const Cut& cut,
0140          DressingType dressing,
0141          LeptonOrigin whichleptons=LeptonOrigin::NODECAY,
0142          PhotonOrigin whichphotons=PhotonOrigin::NODECAY,
0143                  TauDecaysAs tauDecays=TauDecaysAs::PROMPT,
0144                  MuDecaysAs muDecays=MuDecaysAs::PROMPT)
0145       : LeptonFinder(dRdress, cut, whichleptons, whichphotons, tauDecays, muDecays, dressing)
0146     {   }
0147 
0148 
0149     /// @brief Constructor with distinct photon and lepton finders
0150     ///
0151     /// Provide final state projections used to select the photons and bare
0152     /// leptons, a clustering delta(R) cone size around each bare lepton, and an
0153     /// optional cut on the _dressed_ leptons (i.e. the momenta and PID after
0154     /// clustering.)  The final arguments control whether non-prompt photons are
0155     /// to be included, and whether the matching of photons to leptons is to be
0156     /// done via dR matching to the bare lepton or by a jet clustering
0157     /// algorithm.  Set the clustering radius to 0 or negative to disable
0158     /// clustering.
0159     ///
0160     /// @note The first two args were swapped in version 3.2.0!
0161     ///
0162     /// @todo Convert the "bare" arg to a general ParticleFinder rather than an FS, to
0163     /// allow clustering of unstables, e.g. taus via TauFinder when that becomes a PF.
0164     /// Complicated by the clustering version relying on MergedFinalState and FastJets'
0165     /// current restriction to FinalState inputs. Requires widespread redesign.
0166     LeptonFinder(const FinalState& leptonfs, const FinalState& photonfs,
0167          double dRdress, const Cut& cut=Cuts::OPEN,
0168          DressingType dressing=DressingType::CONE);
0169 
0170 
0171     /// @brief Constructor with distinct photon and lepton finders
0172     ///
0173     /// Provide final state projections used to select the photons and bare
0174     /// leptons, an optional clustering delta(R) cone size around each bare lepton, and an
0175     /// optional cut on the _dressed_ leptons (i.e. the momenta and PID after
0176     /// clustering.)  The final arguments control whether non-prompt photons are
0177     /// to be included, and whether the matching of photons to leptons is to be
0178     /// done via dR matching to the bare lepton or by a jet clustering
0179     /// algorithm.  Set the clustering radius to 0 or negative to disable
0180     /// clustering.
0181     ///
0182     /// @note The first two args were swapped in version 3.2.0!
0183     ///
0184     /// @todo Convert the "bare" arg to a general ParticleFinder rather than an FS, to
0185     /// allow clustering of unstables, e.g. taus via TauFinder when that becomes a PF.
0186     /// Complicated by the clustering version relying on MergedFinalState and FastJets'
0187     /// current restriction to FinalState inputs. Requires widespread redesign.
0188     LeptonFinder(const FinalState& leptonfs, const FinalState& photonfs,
0189          const Cut& cut, double dRdress, DressingType dressing=DressingType::CONE)
0190       : LeptonFinder(leptonfs, photonfs, dRdress, cut, dressing)
0191     {   }
0192 
0193 
0194     /// Clone this projection
0195     RIVET_DEFAULT_PROJ_CLONE(LeptonFinder);
0196 
0197     /// Import to avoid warnings about overload-hiding
0198     using Projection::operator =;
0199 
0200 
0201     /// @brief Retrieve the dressed leptons
0202     ///
0203     /// @note Like particles() but with helper functions and sorted by pT
0204     DressedLeptons dressedLeptons() const {
0205       DressedLeptons rtn;
0206       for (const Particle& p : particles(cmpMomByPt))
0207         rtn += DressedLepton(p);  //static_cast<const DressedLepton>(p);
0208       return rtn;
0209     }
0210 
0211     /// @brief Retrieve the dressed leptons ordered by supplied sorting functor
0212     ///
0213     /// @note Like particles() but with helper functions
0214     DressedLeptons dressedLeptons(const ParticleSorter& sorter) const {
0215       DressedLeptons rtn;
0216       for (const Particle& p : particles(sorter))
0217         rtn += DressedLepton(p);  //static_cast<const DressedLepton>(p);
0218       return rtn;
0219     }
0220 
0221 
0222   protected:
0223 
0224     /// Apply the projection on the supplied event.
0225     void project(const Event& e);
0226 
0227     /// Compare projections.
0228     CmpState compare(const Projection& p) const;
0229 
0230 
0231   protected:
0232 
0233     /// Maximum cone radius to find photons in
0234     double _dRdress;
0235 
0236     /// Whether to use a cone, a clustering algorithm or other
0237     DressingType _dressMode;
0238 
0239   };
0240 
0241 
0242 }
0243 
0244 #endif