CMS 3D CMS Logo

CSCStripData.h
Go to the documentation of this file.
1 #ifndef CSCRecHitD_CSCStripData_h
2 #define CSCRecHitD_CSCStripData_h
3 
10 #include <algorithm>
11 #include <functional>
12 #include <vector>
13 #include <iosfwd>
14 
15 class CSCStripData {
16 public:
24  CSCStripData(float phmax, int tmax, const std::vector<int>& phRaw, const std::vector<float>& ph)
25  : phmax_(phmax), tmax_(tmax), phRaw_(phRaw), ph_(ph) {}
26 
27  CSCStripData(float phmax, int tmax, std::vector<int>&& phRaw, std::vector<float>&& ph)
29 
30  void reset() {
31  phmax_ = 0.f;
32  tmax_ = -1;
33  }
34  bool valid() const { return tmax_ >= 0; }
35 
37  float phmax() const { return phmax_; }
39  int tmax() const { return tmax_; }
40 
44  const std::vector<float>& ph() const { return ph_; }
45 
49  const std::vector<int>& phRaw() const { return phRaw_; }
50 
54  void operator*=(float factor) {
55  // scale all elements of ph by 'factor'. Leaves phRaw_ unchanged.
56  std::transform(ph_.begin(), ph_.end(), ph_.begin(), [&factor](auto c) { return c * factor; });
57  phmax_ *= factor;
58  }
59 
60  bool operator<(const CSCStripData& data) const { return phmax_ < data.phmax_; }
61 
63  friend std::ostream& operator<<(std::ostream&, const CSCStripData&);
64 
65  // private:
66 
67  static constexpr int ntbins_ = 8; //@@ Number of time bins & hence length of ph vectors
68  float phmax_;
69  int tmax_;
70  std::vector<int> phRaw_;
71  std::vector<float> ph_;
72 };
73 
74 #endif
std::vector< float > ph_
Definition: CSCStripData.h:71
int tmax() const
the time bin in which the maximum pulseheight occurs (counts from 0)
Definition: CSCStripData.h:39
std::vector< int > phRaw_
Definition: CSCStripData.h:70
float phmax() const
maximum pulseheight in one SCA time bin
Definition: CSCStripData.h:37
bool operator<(const CSCStripData &data) const
Definition: CSCStripData.h:60
const std::vector< int > & phRaw() const
Definition: CSCStripData.h:49
const std::vector< float > & ph() const
Definition: CSCStripData.h:44
CSCStripData(float phmax, int tmax, const std::vector< int > &phRaw, const std::vector< float > &ph)
Definition: CSCStripData.h:24
void reset()
Definition: CSCStripData.h:30
CSCStripData(float phmax, int tmax, std::vector< int > &&phRaw, std::vector< float > &&ph)
Definition: CSCStripData.h:27
double f[11][100]
friend std::ostream & operator<<(std::ostream &, const CSCStripData &)
for debugging purposes
Definition: CSCStripData.cc:9
static constexpr int ntbins_
Definition: CSCStripData.h:67
bool valid() const
Definition: CSCStripData.h:34
void operator*=(float factor)
Definition: CSCStripData.h:54
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
def move(src, dest)
Definition: eostools.py:511
unsigned transform(const HcalDetId &id, unsigned transformCode)