File indexing completed on 2024-04-06 11:58:11
0001 #ifndef CALOSAMPLES_H
0002 #define CALOSAMPLES_H 1
0003
0004 #include "DataFormats/DetId/interface/DetId.h"
0005 #include <ostream>
0006 #include <vector>
0007
0008
0009
0010
0011
0012
0013
0014 class CaloSamples {
0015 public:
0016 CaloSamples();
0017 explicit CaloSamples(const DetId &id, int size);
0018 explicit CaloSamples(const DetId &id, int size, int preciseSize);
0019
0020
0021 DetId id() const { return id_; }
0022
0023
0024 int size() const { return size_; }
0025
0026 double &operator[](int i) { return data_[i]; }
0027
0028 double operator[](int i) const { return data_[i]; }
0029
0030
0031 float &preciseAtMod(int i) { return preciseData_[i]; }
0032
0033 float preciseAt(int i) const { return preciseData_[i]; }
0034
0035
0036 int presamples() const { return presamples_; }
0037
0038 void setPresamples(int pre);
0039
0040
0041 CaloSamples &scale(double value);
0042
0043 CaloSamples &operator*=(double value) { return scale(value); }
0044
0045
0046 CaloSamples &operator+=(double value);
0047 CaloSamples &operator+=(const CaloSamples &other);
0048
0049
0050
0051 CaloSamples &offsetTime(double offset);
0052
0053 void setDetId(DetId detId) { id_ = detId; }
0054
0055 void setSize(unsigned int size) {
0056 size_ = size;
0057 data_.resize(size, 0.);
0058 }
0059
0060 void setPreciseSize(unsigned int size) {
0061 preciseSize_ = size;
0062 preciseData_.resize(preciseSize_, 0.);
0063 }
0064
0065 bool isBlank() const;
0066
0067 void setBlank();
0068
0069
0070 int preciseSize() const {
0071 if (preciseData_.empty())
0072 return 0;
0073 return preciseSize_;
0074 }
0075 int precisePresamples() const { return precisePresamples_; }
0076 float preciseDeltaT() const { return deltaTprecise_; }
0077
0078 void setPrecise(int precisePresamples, float deltaT) {
0079 precisePresamples_ = precisePresamples;
0080 deltaTprecise_ = deltaT;
0081 }
0082
0083 void resetPrecise();
0084
0085
0086 static const int MAXSAMPLES = 10;
0087
0088 private:
0089 DetId id_;
0090 int size_, presamples_;
0091 std::vector<double> data_;
0092 float deltaTprecise_;
0093 std::vector<float> preciseData_;
0094 int preciseSize_, precisePresamples_;
0095 };
0096
0097 std::ostream &operator<<(std::ostream &s, const CaloSamples &samps);
0098
0099 typedef std::vector<CaloSamples> CaloSamplesCollection;
0100
0101 #endif