CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloSamples.h
Go to the documentation of this file.
1 #ifndef CALOSAMPLES_H
2 #define CALOSAMPLES_H 1
3 
4 #include <ostream>
5 #include <vector>
7 
16 class CaloSamples {
17 public:
18  CaloSamples();
19  explicit CaloSamples(const DetId& id, int size);
20  explicit CaloSamples(const DetId& id, int size, int preciseSize);
21 
23  DetId id() const { return id_; }
24 
26  int size() const { return size_; }
28  double& operator[](int i) { return data_[i]; }
30  double operator[](int i) const { return data_[i]; }
31 
33  float& preciseAtMod(int i) { return preciseData_[i]; }
35  float preciseAt(int i) const { return preciseData_[i]; }
36 
38  int presamples() const { return presamples_; }
40  void setPresamples(int pre);
41 
43  CaloSamples& scale(double value);
45  CaloSamples& operator*=(double value) { return scale(value); }
46 
48  CaloSamples& operator+=(double value);
49  CaloSamples& operator+=(const CaloSamples & other);
50 
52  // between values
53  CaloSamples& offsetTime(double offset);
54 
55  void setDetId( DetId detId ) { id_ = detId ; }
56 
57  void setSize( unsigned int size ) { size_ = size ; }
58 
59  bool isBlank() const ; // are the samples blank (zero?)
60 
61  void setBlank() ; // keep id, presamples, size but zero out data
62 
64  int preciseSize() const { if ( preciseData_.size() ==0 ) return 0; return preciseSize_; }
65  int precisePresamples() const { return precisePresamples_; }
66  float preciseDeltaT() const { return deltaTprecise_; }
67 
68  void setPrecise( int precisePresamples, float deltaT ) {
70  deltaTprecise_=deltaT;
71  }
72 
73  void resetPrecise();
74 
75  static const int MAXSAMPLES=10;
76 private:
78  double data_[MAXSAMPLES]; //
81  std::vector<float> preciseData_;
83 };
84 
85 std::ostream& operator<<(std::ostream& s, const CaloSamples& samps);
86 
87 #endif
int i
Definition: DBlmapReader.cc:9
CaloSamples & scale(double value)
multiply each item by this value
Definition: CaloSamples.cc:33
static const int MAXSAMPLES
Definition: CaloSamples.h:75
int precisePresamples_
Definition: CaloSamples.h:82
void setSize(unsigned int size)
Definition: CaloSamples.h:57
double & operator[](int i)
mutable operator to access samples
Definition: CaloSamples.h:28
int precisePresamples() const
Definition: CaloSamples.h:65
int presamples() const
access presample information
Definition: CaloSamples.h:38
void resetPrecise()
Definition: CaloSamples.cc:25
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
int preciseSize() const
get the size
Definition: CaloSamples.h:64
std::vector< float > preciseData_
Definition: CaloSamples.h:81
float preciseAt(int i) const
const function to access precise samples
Definition: CaloSamples.h:35
bool isBlank() const
Definition: CaloSamples.cc:88
void setDetId(DetId detId)
Definition: CaloSamples.h:55
void setBlank()
Definition: CaloSamples.cc:98
float preciseDeltaT() const
Definition: CaloSamples.h:66
void setPresamples(int pre)
set presample information
Definition: CaloSamples.cc:29
unsigned int offset(bool)
double operator[](int i) const
const operator to access samples
Definition: CaloSamples.h:30
Definition: DetId.h:20
int size() const
get the size
Definition: CaloSamples.h:26
CaloSamples & offsetTime(double offset)
shift all the samples by a time, in ns, interpolating
Definition: CaloSamples.cc:67
float deltaTprecise_
Definition: CaloSamples.h:80
int presamples_
Definition: CaloSamples.h:79
float & preciseAtMod(int i)
mutable function to access precise samples
Definition: CaloSamples.h:33
void setPrecise(int precisePresamples, float deltaT)
Definition: CaloSamples.h:68
CaloSamples & operator+=(double value)
add a value to all samples
Definition: CaloSamples.cc:40
DetId id() const
get the (generic) id
Definition: CaloSamples.h:23
double data_[MAXSAMPLES]
Definition: CaloSamples.h:78
CaloSamples & operator*=(double value)
scale all samples
Definition: CaloSamples.h:45
int preciseSize_
Definition: CaloSamples.h:82