ME0Stub

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 66 67 68 69 70 71 72 73 74 75
#ifndef DataFormats_GEMDigi_ME0Stub_H
#define DataFormats_GEMDigi_ME0Stub_H

#include <vector>
#include <cstdint>
#include <string>
#include <iostream>
#include <iomanip>

#include "DataFormats/MuonDetId/interface/GEMDetId.h"

class ME0Stub final {
public:
  ME0Stub()
      : detId_(), etaPartition_(0), padStrip_(0), bendingAngle_(0), layerCount_(0), quality_(0), patternId_(0), bx_(0) {}
  ME0Stub(const GEMDetId& id,
          int etaPartition,
          double padStrip,
          double bendingAngle,
          int layerCount,
          int quality,
          int patternId,
          double bx)
      : detId_(id),
        etaPartition_(etaPartition),
        padStrip_(padStrip),
        bendingAngle_(bendingAngle),
        layerCount_(layerCount),
        quality_(quality),
        patternId_(patternId),
        bx_(bx) {}

  // clone
  ME0Stub* clone() const { return new ME0Stub(*this); }

  // Get private variable
  GEMDetId detId() const { return detId_; }
  int etaPartition() const { return etaPartition_; }
  double strip() const { return padStrip_; }
  double bendingAngle() const { return bendingAngle_; }
  int layerCount() const { return layerCount_; }
  int quality() const { return quality_; }
  int patternId() const { return patternId_; }
  double bx() const { return bx_; }

  // operators
  bool operator==(const ME0Stub& other) {
    if (layerCount_ == 0 && other.layerCount_ == 0) {
      return true;
    }
    return (quality_ == other.quality_);
  }
  bool operator>(const ME0Stub& other) { return (quality_ > other.quality_); }
  bool operator<(const ME0Stub& other) { return (quality_ < other.quality_); }
  bool operator>=(const ME0Stub& other) { return (quality_ >= other.quality_); }
  bool operator<=(const ME0Stub& other) { return (quality_ <= other.quality_); }
  // ostream
  friend std::ostream& operator<<(std::ostream& os, const ME0Stub& stub) {
    os << "id=" << stub.patternId() << ", lc=" << stub.layerCount() << ", strip=" << std::fixed << std::setprecision(3)
       << stub.strip() << ", prt=" << stub.etaPartition() << ", quality=" << stub.quality();
    return os;
  }

private:
  GEMDetId detId_;
  int etaPartition_;
  double padStrip_;
  double bendingAngle_;
  int layerCount_;
  int quality_;
  int patternId_;
  double bx_;
};

#endif