CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/TBDataFormats/EcalTBObjects/interface/EcalTBHodoscopePlaneRawHits.h

Go to the documentation of this file.
00001 #ifndef DIGIECAL_ECALTBHODOSCOPEPLANERAWHITS_H
00002 #define DIGIECAL_ECALTBHODOSCOPEPLANERAWHITS_H 1
00003 
00004 
00005 #include <ostream>
00006 #include <vector>
00007 #include <boost/cstdint.hpp>
00008 
00016 class EcalTBHodoscopePlaneRawHits {
00017  public:
00018   EcalTBHodoscopePlaneRawHits(): rawChannelHits_(0) {};
00019 
00020   EcalTBHodoscopePlaneRawHits(unsigned int channels) 
00021     {
00022       rawChannelHits_.reserve(channels);
00023       for (unsigned int i=0;i<channels;i++)
00024         rawChannelHits_[i]=0;
00025     }
00026   
00028   unsigned int channels() const { return rawChannelHits_.size(); } 
00029   const std::vector<bool>& hits() const { return rawChannelHits_; }
00030 
00031   unsigned int numberOfFiredHits() const 
00032     {
00033       int numberOfHits=0;
00034       for (unsigned int i=0;i<rawChannelHits_.size();i++)
00035         if (rawChannelHits_[i])
00036           numberOfHits++;
00037       return numberOfHits;
00038     }
00039 
00040   bool operator[](unsigned int i) const { return rawChannelHits_[i]; }
00041   bool isChannelFired(unsigned int i) const { return rawChannelHits_[i]; }
00042 
00044   void setChannels(unsigned int size)
00045     {
00046       rawChannelHits_.resize(size);
00047     };
00048   
00049   void addHit(unsigned int i) 
00050     {
00051       if (rawChannelHits_.size() < i+1 )
00052         rawChannelHits_.resize(i+1);
00053       rawChannelHits_[i]=true; 
00054     };
00055 
00056   void setHit(unsigned int i,bool status) 
00057     {
00058       if (rawChannelHits_.size() < i+1 )
00059         rawChannelHits_.resize(i+1);
00060       rawChannelHits_[i]=status; 
00061     };
00062 
00063 
00064  private:
00065   std::vector<bool> rawChannelHits_;
00066   
00067 };
00068 
00069 std::ostream& operator<<(std::ostream&, const EcalTBHodoscopePlaneRawHits&);
00070   
00071 #endif