EvtPlane

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65

//
// Levels:
//
//    0   Neither recentering nor flattening is done.  The final weights are applied.
//    1   The sums over the sines and cosines are recentered.
//    2   Final results including both recentering and flattening.  Default if the level is not specified.
//    3   Calculation where all weights are set to unity.
//
//

#ifndef DataFormats_EvtPlane_h
#define DataFormats_EvtPlane_h

#include <vector>
#include <string>
#include <cmath>

namespace reco {
  class EvtPlane {
  public:
    EvtPlane(int epindx = 0,
             int level = 2,
             double planeA = 0,
             double sumSin = 0,
             double sumCos = 0,
             double sumw = 0,
             double sumw2 = 0,
             double pe = 0,
             double pe2 = 0,
             uint mult = 0);
    virtual ~EvtPlane();
    void addLevel(int level, double ang, double sumsin, double sumcos);
    int indx() const { return indx_; }
    float angle(int level = 2) const { return (level >= 0 && level < 4) ? angle_[level] : angle_[2]; }
    float sumSin(int level = 2) const { return (level >= 0 && level < 4) ? sumSin_[level] : sumSin_[2]; }
    float sumCos(int level = 2) const { return (level >= 0 && level < 4) ? sumCos_[level] : sumCos_[2]; }
    float sumw() const { return sumw_; }
    float sumw2() const { return sumw2_; }
    float sumPtOrEt() const { return sumPtOrEt_; }
    float sumPtOrEt2() const { return sumPtOrEt2_; }
    float mult() const { return mult_; }
    float qy(int level = 2) const { return sumSin(level); }
    float qx(int level = 2) const { return sumCos(level); }
    float q(int level = 2) const {
      return ((pow(qx(level), 2) + pow(qy(level), 2)) > 0) ? sqrt(pow(qx(level), 2) + pow(qy(level), 2)) : 0.;
    }
    float vn(int level = 2) const { return (q(level) > 0 && fabs(sumw()) > 0) ? q(level) / fabs(sumw()) : 0.; }

  private:
    int indx_;
    float angle_[4];
    float sumSin_[4];
    float sumCos_[4];
    float sumw_;
    float sumw2_;
    float sumPtOrEt_;
    float sumPtOrEt2_;
    uint mult_;
  };

  typedef std::vector<EvtPlane> EvtPlaneCollection;
}  // namespace reco

#endif