CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
16 {
17  public:
18 
26  CSCStripData( float phmax, int tmax, const std::vector<int>& phRaw, const std::vector<float>& ph ) :
27  phmax_(phmax), tmax_(tmax), phRaw_(phRaw), ph_(ph) {}
28 
29  CSCStripData( float phmax, int tmax, std::vector<int> && phRaw, std::vector<float> && ph ) :
30  phmax_(phmax), tmax_(tmax), phRaw_(std::move(phRaw)), ph_(std::move(ph)) {}
31 
32  void reset() { phmax_=0.f;tmax_= -1;}
33  bool valid() const { return tmax_>=0;}
34 
36  float phmax() const {return phmax_;}
38  int tmax() const {return tmax_;}
39 
43  const std::vector<float>& ph() const {return ph_;}
44 
48  const std::vector<int>& phRaw() const {return phRaw_;}
49 
53  void operator*=( float factor) {
54  // scale all elements of ph by 'factor'. Leaves phRaw_ unchanged.
55  std::transform( ph_.begin(), ph_.end(), ph_.begin(),
56  std::bind2nd( std::multiplies<float>(), 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 
75 #endif
76 
int tmax() const
the time bin in which the maximum pulseheight occurs (counts from 0)
Definition: CSCStripData.h:38
std::vector< float > ph_
Definition: CSCStripData.h:71
const std::vector< int > & phRaw() const
Definition: CSCStripData.h:48
std::vector< int > phRaw_
Definition: CSCStripData.h:70
bool valid() const
Definition: CSCStripData.h:33
#define constexpr
CSCStripData(float phmax, int tmax, const std::vector< int > &phRaw, const std::vector< float > &ph)
Definition: CSCStripData.h:26
void reset()
Definition: CSCStripData.h:32
CSCStripData(float phmax, int tmax, std::vector< int > &&phRaw, std::vector< float > &&ph)
Definition: CSCStripData.h:29
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
float phmax() const
maximum pulseheight in one SCA time bin
Definition: CSCStripData.h:36
void operator*=(float factor)
Definition: CSCStripData.h:53
bool operator<(const CSCStripData &data) const
Definition: CSCStripData.h:60
const std::vector< float > & ph() const
Definition: CSCStripData.h:43