CMS 3D CMS Logo

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);
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_.empty() ) 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  //preserved for use in other packages - no longer used in this class
74  static const int MAXSAMPLES=10;
75 private:
78  std::vector<double> data_; //
80  std::vector<float> preciseData_;
82 };
83 
84 std::ostream& operator<<(std::ostream& s, const CaloSamples& samps);
85 
86 typedef std::vector<CaloSamples> CaloSamplesCollection;
87 
88 #endif
std::vector< CaloSamples > CaloSamplesCollection
Definition: CaloSamples.h:86
CaloSamples & scale(double value)
multiply each item by this value
Definition: CaloSamples.cc:35
static const int MAXSAMPLES
Definition: CaloSamples.h:74
int precisePresamples_
Definition: CaloSamples.h:81
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
int preciseSize() const
get the size
Definition: CaloSamples.h:62
std::vector< float > preciseData_
Definition: CaloSamples.h:80
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
Definition: value.py:1
float preciseDeltaT() const
Definition: CaloSamples.h:64
void setPresamples(int pre)
set presample information
Definition: CaloSamples.cc:31
std::vector< double > data_
Definition: CaloSamples.h:78
double operator[](int i) const
const operator to access samples
Definition: CaloSamples.h:28
Definition: DetId.h:18
std::ostream & operator<<(std::ostream &s, const CaloSamples &samps)
Definition: CaloSamples.cc:106
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:79
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
CaloSamples & operator*=(double value)
scale all samples
Definition: CaloSamples.h:43
int preciseSize_
Definition: CaloSamples.h:81