Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-10 01:53:51

0001 #ifndef L1Trigger_Phase2L1ParticleFlow_PFAlgo3_h
0002 #define L1Trigger_Phase2L1ParticleFlow_PFAlgo3_h
0003 
0004 #include "L1Trigger/Phase2L1ParticleFlow/interface/PFAlgoBase.h"
0005 
0006 namespace l1tpf_impl {
0007   class PFAlgo3 : public PFAlgoBase {
0008   public:
0009     PFAlgo3(const edm::ParameterSet &);
0010     void runPF(Region &r) const override;
0011 
0012   protected:
0013     float drMatchMu_;
0014     enum class MuMatchMode { BoxBestByPtRatio, DrBestByPtRatio, DrBestByPtDiff } muMatchMode_;
0015     float drMatch_, ptMatchLow_, ptMatchHigh_, maxInvisiblePt_;
0016     bool useTrackCaloSigma_, rescaleUnmatchedTrack_, caloTrkWeightedAverage_;
0017     enum class TkCaloLinkMetric { BestByDR = 0, BestByDRPt = 1, BestByDR2Pt2 = 2 };
0018     float drMatchEm_, ptMinFracMatchEm_, drMatchEmHad_;
0019     float emHadSubtractionPtSlope_;
0020     TkCaloLinkMetric tkCaloLinkMetric_;
0021     bool caloReLinkStep_;
0022     float caloReLinkDr_, caloReLinkThreshold_;
0023     bool rescaleTracks_, sumTkCaloErr2_, ecalPriority_, trackEmUseAlsoTrackSigma_, trackEmMayUseCaloMomenta_,
0024         emCaloUseAlsoCaloSigma_;
0025     float tightTrackMaxInvisiblePt_;
0026     enum GoodTrackStatus { GoodTK_Calo_TkPt = 0, GoodTK_Calo_TkCaloPt = 1, GoodTk_Calo_CaloPt = 2, GoodTK_NoCalo = 3 };
0027     enum BadTrackStatus { BadTK_NoCalo = 1 };
0028     bool sortInputs_;
0029 
0030     /// do muon track linking (also sets track.muonLink)
0031     void link_tk2mu(Region &r, std::vector<int> &tk2mu, std::vector<int> &mu2tk) const;
0032 
0033     /// match all tracks to the closest EM cluster
0034     //  tk2em[itrack] = iem, or -1 if unmatched
0035     void link_tk2em(Region &r, std::vector<int> &tk2em) const;
0036 
0037     /// match all em to the closest had (can happen in parallel to the above)
0038     //  em2calo[iem] = icalo or -1
0039     void link_em2calo(Region &r, std::vector<int> &em2calo) const;
0040 
0041     /// for each EM cluster, count and add up the pt of all the corresponding tracks (skipping muons)
0042     void sum_tk2em(Region &r,
0043                    const std::vector<int> &tk2em,
0044                    std::vector<int> &em2ntk,
0045                    std::vector<float> &em2sumtkpt,
0046                    std::vector<float> &em2sumtkpterr) const;
0047 
0048     /// process ecal clusters after linking
0049     void emcalo_algo(Region &r,
0050                      const std::vector<int> &em2ntk,
0051                      const std::vector<float> &em2sumtkpt,
0052                      const std::vector<float> &em2sumtkpterr) const;
0053 
0054     /// promote all flagged tracks to electrons
0055     void emtk_algo(Region &r,
0056                    const std::vector<int> &tk2em,
0057                    const std::vector<int> &em2ntk,
0058                    const std::vector<float> &em2sumtkpterr) const;
0059 
0060     /// subtract EM component from Calo clusters for all photons and electrons (within tracker coverage)
0061     void sub_em2calo(Region &r, const std::vector<int> &em2calo) const;
0062 
0063     /// track to calo matching
0064     //  tk2calo[itk] = icalo or -1
0065     void link_tk2calo(Region &r, std::vector<int> &tk2calo) const;
0066 
0067     /// for each calo, compute the sum of the track pt
0068     void sum_tk2calo(Region &r,
0069                      const std::vector<int> &tk2calo,
0070                      std::vector<int> &calo2ntk,
0071                      std::vector<float> &calo2sumtkpt,
0072                      std::vector<float> &calo2sumtkpterr) const;
0073 
0074     /// promote unlinked low pt tracks to hadrons
0075     void unlinkedtk_algo(Region &r, const std::vector<int> &tk2calo) const;
0076 
0077     /// try to recover split hadron showers (v1.0):
0078     //  take hadrons that are not track matched, close by a hadron which has an excess of track pt vs calo pt
0079     //  add this pt to the calo pt of the other cluster
0080     //  off by default, as it seems to not do much in jets even if it helps remove tails in single-pion events
0081     void calo_relink(Region &r,
0082                      const std::vector<int> &calo2ntk,
0083                      const std::vector<float> &calo2sumtkpt,
0084                      const std::vector<float> &calo2sumtkpterr) const;
0085 
0086     /// process matched calo clusters, compare energy to sum track pt, compute track rescaling factor if needed
0087     //  alpha[icalo] = x < 1 if all tracks linked to icalo must have their pt rescaled by x
0088     void linkedcalo_algo(Region &r,
0089                          const std::vector<int> &calo2ntk,
0090                          const std::vector<float> &calo2sumtkpt,
0091                          const std::vector<float> &calo2sumtkpterr,
0092                          std::vector<float> &calo2alpha) const;
0093 
0094     /// process matched tracks, if necessary rescale or average
0095     void linkedtk_algo(Region &r,
0096                        const std::vector<int> &tk2calo,
0097                        const std::vector<int> &calo2ntk,
0098                        const std::vector<float> &calo2alpha) const;
0099 
0100     /// process unmatched calo clusters
0101     void unlinkedcalo_algo(Region &r) const;
0102 
0103     /// save muons in output list
0104     void save_muons(Region &r, const std::vector<int> &tk2mu) const;
0105   };
0106 
0107 }  // namespace l1tpf_impl
0108 
0109 #endif