Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-03-05 03:16:36

0001 #ifndef L1Trigger_L1TGEM_ME0StubPrimitive_H
0002 #define L1Trigger_L1TGEM_ME0StubPrimitive_H
0003 
0004 #include <vector>
0005 #include <cstdint>
0006 #include <string>
0007 #include <iostream>
0008 
0009 #include "DataFormats/MuonDetId/interface/GEMDetId.h"
0010 
0011 class ME0StubPrimitive final {
0012 public:
0013   // Constructors
0014   ME0StubPrimitive();
0015   ME0StubPrimitive(int layerCount, int hitCount, int patternId, int strip, int etaPartition);
0016   ME0StubPrimitive(int layerCount, int hitCount, int patternId, int strip, int etaPartition, double bx);
0017   ME0StubPrimitive(int layerCount,
0018                    int hitCount,
0019                    int patternId,
0020                    int strip,
0021                    int etaPartition,
0022                    double bx,
0023                    std::vector<double>& centroids);
0024 
0025   // clone
0026   ME0StubPrimitive* clone() const { return new ME0StubPrimitive(*this); }
0027 
0028   // Get private variable
0029   int layerCount() const { return layerCount_; }
0030   int hitCount() const { return hitCount_; }
0031   int patternId() const { return patternId_; }
0032   int strip() const { return strip_; }
0033   int etaPartition() const { return etaPartition_; }
0034   int bx() const { return bx_; }
0035   double subStrip() const { return subStrip_; }
0036   double bendingAngle() const { return bendingAngle_; }
0037   double mse() const { return mse_; }
0038   std::vector<double> centroids() const { return centroids_; }
0039   int quality() const { return quality_; }
0040   int maxClusterSize() const { return maxClusterSize_; }
0041   int maxNoise() const { return maxNoise_; }
0042 
0043   // Set private variable
0044   void setLayerCount(int layerCount) { layerCount_ = layerCount; }
0045   void setHitCount(int hitCount) { hitCount_ = hitCount; }
0046   void setPatternId(int patternId) { patternId_ = patternId; }
0047   void setStrip(int strip) { strip_ = strip; }
0048   void setEtaPartition(int etaPartition) { etaPartition_ = etaPartition; }
0049   void setBx(double bx) { bx_ = bx; }
0050   void setCentroids(std::vector<double> centroids) { centroids_ = centroids; }
0051   void setMaxClusterSize(int maxClusterSize) { maxClusterSize_ = maxClusterSize; }
0052   void setMaxNoise(int maxNoise) { maxNoise_ = maxNoise; }
0053 
0054   void reset();
0055   void updateQuality();
0056   void fit(int maxSpan = 37);
0057 
0058   // operators
0059   bool operator==(const ME0StubPrimitive& other) {
0060     if (layerCount_ == 0 && other.layerCount_ == 0) {
0061       return true;
0062     }
0063     return (quality_ == other.quality_);
0064   }
0065   bool operator>(const ME0StubPrimitive& other) { return (quality_ > other.quality_); }
0066   bool operator<(const ME0StubPrimitive& other) { return (quality_ < other.quality_); }
0067   bool operator>=(const ME0StubPrimitive& other) { return (quality_ >= other.quality_); }
0068   bool operator<=(const ME0StubPrimitive& other) { return (quality_ <= other.quality_); }
0069   // ostream
0070   friend std::ostream& operator<<(std::ostream& os, const ME0StubPrimitive& stub) {
0071     os << "id=" << stub.patternId() << ", lc=" << stub.layerCount() << ", strip=" << stub.strip()
0072        << ", prt=" << stub.etaPartition() << ", quality=" << stub.quality();
0073     return os;
0074   }
0075 
0076 private:
0077   int layerCount_, hitCount_, patternId_, strip_, etaPartition_;
0078   double bx_ = -9999;
0079   std::vector<double> centroids_;
0080   double subStrip_ = 0.0;
0081   double bendingAngle_ = 0.0;
0082   double mse_ = 9999;
0083   int quality_ = 0;
0084   int maxClusterSize_ = 0;
0085   int maxNoise_ = 0;
0086   bool ignoreBend_ = false;
0087   std::vector<double> llseFit(const std::vector<double>& x, const std::vector<double>& y);
0088 };
0089 
0090 #endif