Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:00

0001 #ifndef DataFormats_Luminosity_PixelClusterCountsInEvent_h
0002 #define DataFormats_Luminosity_PixelClusterCountsInEvent_h
0003 /** \class reco::PixelClusterCountsInEvent
0004  *  
0005  * Reconstructed PixelClusterCountsInEvent object that will contain the moduleID, bxID, and counts per event.
0006  *
0007  * \authors: Sam Higginbotham (shigginb@cern.ch), Chris Palmer (capalmer@cern.ch), Attila Radl (attila.radl@cern.ch) 
0008  * 
0009  *
0010  */
0011 #include <algorithm>
0012 #include <vector>
0013 
0014 namespace reco {
0015   class PixelClusterCountsInEvent {
0016   public:
0017     PixelClusterCountsInEvent() : m_bxID() {}
0018 
0019     void increment(int mD, int count) {
0020       size_t modIndex = std::distance(m_ModID.begin(), std::find(m_ModID.begin(), m_ModID.end(), mD));
0021       if (modIndex == m_ModID.size()) {
0022         m_ModID.push_back(mD);
0023         m_counts.push_back(0);
0024       }
0025       m_counts[modIndex] += count;
0026     }
0027 
0028     void setbxID(unsigned int inputbxID) { m_bxID = inputbxID; }
0029 
0030     std::vector<int> const& counts() const { return (m_counts); }
0031 
0032     std::vector<int> const& modID() const { return (m_ModID); }
0033 
0034     unsigned int const& bxID() const { return m_bxID; }
0035 
0036   private:
0037     std::vector<int> m_counts;
0038     std::vector<int> m_ModID;
0039     unsigned int m_bxID;
0040   };
0041 
0042 }  // namespace reco
0043 #endif