Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:05

0001 #ifndef MuonIsolation_NominalEfficiencyThresholds_H
0002 #define MuonIsolation_NominalEfficiencyThresholds_H
0003 
0004 #include <map>
0005 #include <string>
0006 #include <utility>
0007 #include <vector>
0008 
0009 namespace muonisolation {
0010   class NominalEfficiencyThresholds {
0011   public:
0012     NominalEfficiencyThresholds() {}
0013     NominalEfficiencyThresholds(const std::string& infile);
0014     ~NominalEfficiencyThresholds() {}
0015 
0016     /// threshold location
0017     struct ThresholdLocation {
0018       float eta;
0019       int cone;
0020     };
0021 
0022     float thresholdValueForEfficiency(ThresholdLocation location, float eff_thr) const;
0023 
0024     std::vector<double> bins() const;
0025     void dump();
0026 
0027   private:
0028     /// compare to efficiencies
0029     struct EfficiencyBin {
0030       float eff;
0031       float eff_previous;
0032       bool operator()(const EfficiencyBin& e1, const EfficiencyBin& e2) const;
0033     };
0034 
0035     class EtaBounds {
0036     public:
0037       enum { NumberOfTowers = 32 };
0038       EtaBounds();
0039       int towerFromEta(double eta) const;
0040       float operator()(unsigned int i) const { return theBounds[i]; }
0041 
0042     private:
0043       float theBounds[NumberOfTowers + 1];  //max eta of towers 1-32 (indx 1-32) and 0. for indx 0
0044     };
0045 
0046     /// compare two locations
0047     struct locless {
0048       bool operator()(const ThresholdLocation& l1, const ThresholdLocation& l2) const;
0049       EtaBounds etabounds;
0050     };
0051 
0052     typedef std::pair<EfficiencyBin, float> ThresholdConstituent;
0053     typedef std::map<EfficiencyBin, float, EfficiencyBin> ThresholdConstituents;
0054     typedef std::map<ThresholdLocation, ThresholdConstituents, locless> MapType;
0055 
0056     void add(ThresholdLocation location, ThresholdConstituent threshold);
0057     MapType thresholds;
0058 
0059     EtaBounds etabounds;
0060   };
0061 }  // namespace muonisolation
0062 #endif