PixelClusterCountsInEvent

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
#ifndef DataFormats_Luminosity_PixelClusterCountsInEvent_h
#define DataFormats_Luminosity_PixelClusterCountsInEvent_h
/** \class reco::PixelClusterCountsInEvent
 *  
 * Reconstructed PixelClusterCountsInEvent object that will contain the moduleID, bxID, and counts per event.
 *
 * \authors: Sam Higginbotham (shigginb@cern.ch), Chris Palmer (capalmer@cern.ch), Attila Radl (attila.radl@cern.ch) 
 * 
 *
 */
#include <algorithm>
#include <vector>

namespace reco {
  class PixelClusterCountsInEvent {
  public:
    PixelClusterCountsInEvent() : m_bxID() {}

    void increment(int mD, int count) {
      size_t modIndex = std::distance(m_ModID.begin(), std::find(m_ModID.begin(), m_ModID.end(), mD));
      if (modIndex == m_ModID.size()) {
        m_ModID.push_back(mD);
        m_counts.push_back(0);
      }
      m_counts[modIndex] += count;
    }

    void incrementRoc(int rD, int count) {
      size_t rocIndex = std::distance(m_RocID.begin(), std::find(m_RocID.begin(), m_RocID.end(), rD));
      if (rocIndex == m_RocID.size()) {
        m_RocID.push_back(rD);
        m_countsRoc.push_back(0);
      }
      m_countsRoc[rocIndex] += count;
    }

    void setbxID(unsigned int inputbxID) { m_bxID = inputbxID; }

    std::vector<int> const& counts() const { return (m_counts); }

    std::vector<int> const& countsRoc() const { return (m_countsRoc); }

    std::vector<int> const& modID() const { return (m_ModID); }

    std::vector<int> const& rocID() const { return (m_RocID); }

    unsigned int const& bxID() const { return m_bxID; }

  private:
    std::vector<int> m_counts;
    std::vector<int> m_countsRoc;
    std::vector<int> m_ModID;
    std::vector<int> m_RocID;
    unsigned int m_bxID;
  };

}  // namespace reco
#endif