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 
14 class CaloSamples {
15 public:
16  CaloSamples();
17  explicit CaloSamples(const DetId& id, int size);
18  explicit CaloSamples(const DetId& id, int size, int preciseSize);
19 
21  DetId id() const { return id_; }
22 
24  int size() const { return size_; }
26  double& operator[](int i) { return data_[i]; }
28  double operator[](int i) const { return data_[i]; }
29 
31  float& preciseAtMod(int i) { return preciseData_[i]; }
33  float preciseAt(int i) const { return preciseData_[i]; }
34 
36  int presamples() const { return presamples_; }
38  void setPresamples(int pre);
39 
41  CaloSamples& scale(double value);
43  CaloSamples& operator*=(double value) { return scale(value); }
44 
46  CaloSamples& operator+=(double value);
47  CaloSamples& operator+=(const CaloSamples & other);
48 
50  // between values
51  CaloSamples& offsetTime(double offset);
52 
53  void setDetId( DetId detId ) { id_ = detId ; }
54 
55  void setSize( unsigned int size ) { size_ = size ; }
56 
57  bool isBlank() const ; // are the samples blank (zero?)
58 
59  void setBlank() ; // keep id, presamples, size but zero out data
60 
62  int preciseSize() const { if ( preciseData_.size() ==0 ) return 0; return preciseSize_; }
63  int precisePresamples() const { return precisePresamples_; }
64  float preciseDeltaT() const { return deltaTprecise_; }
65 
66  void setPrecise( int precisePresamples, float deltaT ) {
68  deltaTprecise_=deltaT;
69  }
70 
71  void resetPrecise();
72 
73  static const int MAXSAMPLES=10;
74 private:
76  double data_[MAXSAMPLES]; //
79  std::vector<float> preciseData_;
81 };
82 
83 std::ostream& operator<<(std::ostream& s, const CaloSamples& samps);
84 
85 #endif
int i
Definition: DBlmapReader.cc:9
CaloSamples & scale(double value)
multiply each item by this value
Definition: CaloSamples.cc:35
static const int MAXSAMPLES
Definition: CaloSamples.h:73
int precisePresamples_
Definition: CaloSamples.h:80
void setSize(unsigned int size)
Definition: CaloSamples.h:55
double & operator[](int i)
mutable operator to access samples
Definition: CaloSamples.h:26
int precisePresamples() const
Definition: CaloSamples.h:63
int presamples() const
access presample information
Definition: CaloSamples.h:36
void resetPrecise()
Definition: CaloSamples.cc:27
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
int preciseSize() const
get the size
Definition: CaloSamples.h:62
std::vector< float > preciseData_
Definition: CaloSamples.h:79
float preciseAt(int i) const
const function to access precise samples
Definition: CaloSamples.h:33
bool isBlank() const
Definition: CaloSamples.cc:90
void setDetId(DetId detId)
Definition: CaloSamples.h:53
void setBlank()
Definition: CaloSamples.cc:100
float preciseDeltaT() const
Definition: CaloSamples.h:64
void setPresamples(int pre)
set presample information
Definition: CaloSamples.cc:31
double operator[](int i) const
const operator to access samples
Definition: CaloSamples.h:28
Definition: DetId.h:18
int size() const
get the size
Definition: CaloSamples.h:24
CaloSamples & offsetTime(double offset)
shift all the samples by a time, in ns, interpolating
Definition: CaloSamples.cc:69
float deltaTprecise_
Definition: CaloSamples.h:78
int presamples_
Definition: CaloSamples.h:77
float & preciseAtMod(int i)
mutable function to access precise samples
Definition: CaloSamples.h:31
void setPrecise(int precisePresamples, float deltaT)
Definition: CaloSamples.h:66
CaloSamples & operator+=(double value)
add a value to all samples
Definition: CaloSamples.cc:42
DetId id() const
get the (generic) id
Definition: CaloSamples.h:21
double data_[MAXSAMPLES]
Definition: CaloSamples.h:76
CaloSamples & operator*=(double value)
scale all samples
Definition: CaloSamples.h:43
int preciseSize_
Definition: CaloSamples.h:80