CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/CalibFormats/CaloObjects/interface/CaloSamples.h

Go to the documentation of this file.
00001 #ifndef CALOSAMPLES_H
00002 #define CALOSAMPLES_H 1
00003 
00004 #include <ostream>
00005 #include <vector>
00006 #include "DataFormats/DetId/interface/DetId.h"
00007 
00016 class CaloSamples {
00017 public:
00018   CaloSamples();
00019   explicit CaloSamples(const DetId& id, int size);
00020   explicit CaloSamples(const DetId& id, int size, int preciseSize);
00021  
00023   DetId id() const { return id_; }
00024 
00026   int size() const { return size_; }
00028   double& operator[](int i) { return data_[i]; }
00030   double operator[](int i) const { return data_[i]; }
00031 
00033   float& preciseAtMod(int i) { return preciseData_[i]; }
00035   float preciseAt(int i) const { return preciseData_[i]; }
00036 
00038   int presamples() const { return presamples_; }
00040   void setPresamples(int pre);
00041 
00043   CaloSamples& scale(double value);
00045   CaloSamples& operator*=(double value) { return scale(value); }
00046 
00048   CaloSamples& operator+=(double value);
00049   CaloSamples& operator+=(const CaloSamples & other);
00050 
00052   // between values
00053   CaloSamples& offsetTime(double offset);
00054 
00055   void setDetId( DetId detId ) { id_ = detId ; }
00056 
00057   void setSize( unsigned int size ) { size_ = size ; }
00058 
00059   bool isBlank() const ; // are the samples blank (zero?)
00060 
00061   void setBlank() ; // keep id, presamples, size but zero out data
00062 
00064   int preciseSize() const { if ( preciseData_.size() ==0 ) return 0; return preciseSize_; }
00065   int precisePresamples() const { return precisePresamples_; }
00066   float preciseDeltaT() const { return deltaTprecise_; }
00067 
00068   void setPrecise( int precisePresamples, float deltaT ) {
00069     precisePresamples_=precisePresamples;
00070     deltaTprecise_=deltaT;
00071   }
00072 
00073   void resetPrecise();
00074 
00075   static const int MAXSAMPLES=10;
00076 private:
00077   DetId id_;
00078   double data_[MAXSAMPLES]; // 
00079   int size_, presamples_;
00080   float deltaTprecise_;
00081   std::vector<float> preciseData_;
00082   int preciseSize_,precisePresamples_;
00083 };
00084 
00085 std::ostream& operator<<(std::ostream& s, const CaloSamples& samps);
00086 
00087 #endif