File indexing completed on 2024-04-06 12:25:59
0001 #ifndef CSCRecHitD_CSCStripData_h
0002 #define CSCRecHitD_CSCStripData_h
0003
0004
0005
0006
0007
0008
0009
0010 #include <algorithm>
0011 #include <functional>
0012 #include <vector>
0013 #include <iosfwd>
0014
0015 class CSCStripData {
0016 public:
0017
0018
0019
0020
0021
0022
0023 CSCStripData() : phmax_(0.f), tmax_(-1), phRaw_(ntbins_), ph_(ntbins_) {}
0024 CSCStripData(float phmax, int tmax, const std::vector<int>& phRaw, const std::vector<float>& ph)
0025 : phmax_(phmax), tmax_(tmax), phRaw_(phRaw), ph_(ph) {}
0026
0027 CSCStripData(float phmax, int tmax, std::vector<int>&& phRaw, std::vector<float>&& ph)
0028 : phmax_(phmax), tmax_(tmax), phRaw_(std::move(phRaw)), ph_(std::move(ph)) {}
0029
0030 void reset() {
0031 phmax_ = 0.f;
0032 tmax_ = -1;
0033 }
0034 bool valid() const { return tmax_ >= 0; }
0035
0036
0037 float phmax() const { return phmax_; }
0038
0039 int tmax() const { return tmax_; }
0040
0041
0042
0043
0044 const std::vector<float>& ph() const { return ph_; }
0045
0046
0047
0048
0049 const std::vector<int>& phRaw() const { return phRaw_; }
0050
0051
0052
0053
0054 void operator*=(float factor) {
0055
0056 std::transform(ph_.begin(), ph_.end(), ph_.begin(), [&factor](auto c) { return c * factor; });
0057 phmax_ *= factor;
0058 }
0059
0060 bool operator<(const CSCStripData& data) const { return phmax_ < data.phmax_; }
0061
0062
0063 friend std::ostream& operator<<(std::ostream&, const CSCStripData&);
0064
0065
0066
0067 static constexpr int ntbins_ = 8;
0068 float phmax_;
0069 int tmax_;
0070 std::vector<int> phRaw_;
0071 std::vector<float> ph_;
0072 };
0073
0074 #endif