Go to the documentation of this file.00001 #ifndef CondEx_Efficiency_H
00002 #define CondEx_Efficiency_H
00003
00004
00005
00006
00007
00008
00009 #include<cmath>
00010
00011 namespace condex {
00012
00013
00014
00015
00016 class Efficiency {
00017 public:
00018 Efficiency(){}
00019 virtual ~Efficiency(){}
00020 float operator()(float pt, float eta) const {
00021 return value(pt,eta);
00022 }
00023
00024 virtual float value(float pt, float eta) const=0;
00025
00026 };
00027
00028
00029 class ParametricEfficiencyInPt : public Efficiency {
00030 public:
00031 ParametricEfficiencyInPt() : cutLow(0), cutHigh(0), low(0), high(0){}
00032 ParametricEfficiencyInPt(float cm, float ch,
00033 float el, float eh) :
00034 cutLow(cm), cutHigh(ch),
00035 low(el), high(eh){}
00036 private:
00037 virtual float value(float pt, float) const {
00038 if ( pt<low) return cutLow;
00039 if ( pt>high) return cutHigh;
00040 return cutLow + (pt-low)/(high-low)*(cutHigh-cutLow);
00041 }
00042 float cutLow, cutHigh;
00043 float low, high;
00044
00045 };
00046
00047 class ParametricEfficiencyInEta : public Efficiency {
00048 public:
00049 ParametricEfficiencyInEta() : cutLow(0), cutHigh(0), low(0), high(0) {}
00050 ParametricEfficiencyInEta(float cmin, float cmax,
00051 float el, float eh) :
00052 cutLow(cmin), cutHigh(cmax),
00053 low(el), high(eh){}
00054 private:
00055 virtual float value(float, float eta) const {
00056 eta = std::abs(eta);
00057 if ( eta<low) return cutLow;
00058 if ( eta>high) return cutHigh;
00059 return cutLow + (eta-low)/(high-low)*(cutHigh-cutLow);
00060 }
00061 float cutLow, cutHigh;
00062 float low, high;
00063
00064 };
00065
00066 }
00067
00068
00069
00070
00071 #endif