Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:12

0001 #ifndef DIGIECAL_ECALTBHODOSCOPEPLANERAWHITS_H
0002 #define DIGIECAL_ECALTBHODOSCOPEPLANERAWHITS_H 1
0003 
0004 #include <ostream>
0005 #include <vector>
0006 
0007 /** \class EcalTBHodoscopePlaneRawHits
0008  *  Simple container for rawHits 
0009  *
0010  *
0011  */
0012 
0013 class EcalTBHodoscopePlaneRawHits {
0014 public:
0015   EcalTBHodoscopePlaneRawHits() : rawChannelHits_(0){};
0016 
0017   EcalTBHodoscopePlaneRawHits(unsigned int channels) {
0018     rawChannelHits_.reserve(channels);
0019     for (unsigned int i = 0; i < channels; i++)
0020       rawChannelHits_[i] = false;
0021   }
0022 
0023   /// Get Methods
0024   unsigned int channels() const { return rawChannelHits_.size(); }
0025   const std::vector<bool>& hits() const { return rawChannelHits_; }
0026 
0027   unsigned int numberOfFiredHits() const {
0028     int numberOfHits = 0;
0029     for (unsigned int i = 0; i < rawChannelHits_.size(); i++)
0030       if (rawChannelHits_[i])
0031         numberOfHits++;
0032     return numberOfHits;
0033   }
0034 
0035   bool operator[](unsigned int i) const { return rawChannelHits_[i]; }
0036   bool isChannelFired(unsigned int i) const { return rawChannelHits_[i]; }
0037 
0038   /// Set methods
0039   void setChannels(unsigned int size) { rawChannelHits_.resize(size); };
0040 
0041   void addHit(unsigned int i) {
0042     if (rawChannelHits_.size() < i + 1)
0043       rawChannelHits_.resize(i + 1);
0044     rawChannelHits_[i] = true;
0045   };
0046 
0047   void setHit(unsigned int i, bool status) {
0048     if (rawChannelHits_.size() < i + 1)
0049       rawChannelHits_.resize(i + 1);
0050     rawChannelHits_[i] = status;
0051   };
0052 
0053 private:
0054   std::vector<bool> rawChannelHits_;
0055 };
0056 
0057 std::ostream& operator<<(std::ostream&, const EcalTBHodoscopePlaneRawHits&);
0058 
0059 #endif