Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-23 03:13:03

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 incrementRoc(int rD, int count) {
0029       size_t rocIndex = std::distance(m_RocID.begin(), std::find(m_RocID.begin(), m_RocID.end(), rD));
0030       if (rocIndex == m_RocID.size()) {
0031         m_RocID.push_back(rD);
0032         m_countsRoc.push_back(0);
0033       }
0034       m_countsRoc[rocIndex] += count;
0035     }
0036 
0037     void setbxID(unsigned int inputbxID) { m_bxID = inputbxID; }
0038 
0039     std::vector<int> const& counts() const { return (m_counts); }
0040 
0041     std::vector<int> const& countsRoc() const { return (m_countsRoc); }
0042 
0043     std::vector<int> const& modID() const { return (m_ModID); }
0044 
0045     std::vector<int> const& rocID() const { return (m_RocID); }
0046 
0047     unsigned int const& bxID() const { return m_bxID; }
0048 
0049   private:
0050     std::vector<int> m_counts;
0051     std::vector<int> m_countsRoc;
0052     std::vector<int> m_ModID;
0053     std::vector<int> m_RocID;
0054     unsigned int m_bxID;
0055   };
0056 
0057 }  // namespace reco
0058 #endif