Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:20:37

0001 #ifndef MuonIsolation_IsolatorByDeposit_H
0002 #define MuonIsolation_IsolatorByDeposit_H
0003 
0004 /** \class IsolatorByDeposit
0005  *  Define the isolation variable simply as the deposit within the cone.
0006  *  This is the simplest definition possible, for isolation algorithms
0007  *  where the cut is directly on, e.g., the deposited energy.
0008  *
0009  *  \author M. Konecki, N. Amapane
0010  */
0011 
0012 #include "RecoMuon/MuonIsolation/interface/MuIsoBaseIsolator.h"
0013 #include <vector>
0014 
0015 namespace muonisolation {
0016   class IsolatorByDeposit : public MuIsoBaseIsolator {
0017   public:
0018     typedef MuIsoBaseIsolator::DepositContainer DepositContainer;
0019 
0020     struct ConeSizeFunction {
0021       virtual ~ConeSizeFunction() = default;
0022       virtual float coneSize(float eta, float pt) const = 0;
0023     };
0024 
0025     //! construct with no addtnl thresholds on deposits
0026     IsolatorByDeposit(float conesize, const std::vector<double>& weights);
0027     IsolatorByDeposit(const ConeSizeFunction* conesize, const std::vector<double>& weights);
0028 
0029     //! construct with non-default thresholds per deposit
0030     IsolatorByDeposit(float conesize, const std::vector<double>& weights, const std::vector<double>& thresh);
0031     IsolatorByDeposit(const ConeSizeFunction* conesize,
0032                       const std::vector<double>& weights,
0033                       const std::vector<double>& thresh);
0034 
0035     ~IsolatorByDeposit() override {}
0036 
0037     //! Set the weights for summing deposits of different types
0038     virtual void setWeights(const std::vector<double>& weights) { theWeights = weights; }
0039 
0040     //! Compute the deposit within the cone and return the isolation result
0041     Result result(const DepositContainer& deposits, const edm::Event* = nullptr) const override;
0042 
0043     //! Compute the count of deposit within the cone and return the isolation result
0044     /*   virtual int resultInt(DepositContainer deposits) const; */
0045 
0046     void setConeSize(float conesize) {
0047       theConeSize = conesize;
0048       theConeSizeFunction = nullptr;
0049     }
0050 
0051     void setConeSize(ConeSizeFunction* conesize) { theConeSizeFunction = conesize; }
0052 
0053     //! Get the cone size
0054     virtual float coneSize(float eta, float pT) const {
0055       return theConeSizeFunction ? theConeSizeFunction->coneSize(eta, pT) : theConeSize;
0056     }
0057 
0058     ResultType resultType() const override { return ISOL_FLOAT_TYPE; }
0059 
0060   private:
0061     // Compute the weighted sum of deposits of different type within dRcone
0062     double weightedSum(const DepositContainer& deposits, float dRcone) const;
0063 
0064   private:
0065     const ConeSizeFunction* theConeSizeFunction;
0066     float theConeSize;
0067     std::vector<double> theWeights;
0068     std::vector<double> theDepThresholds;
0069   };
0070 }  // namespace muonisolation
0071 
0072 #endif