Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:20:22

0001 #ifndef MICROMEGAS_MICROMEGASHOTCHANNELMAPDATA_H
0002 #define MICROMEGAS_MICROMEGASHOTCHANNELMAPDATA_H
0003 
0004 /*!
0005  * \file MicromegasHotChannelMapData.h
0006  * \author Hugo Pereira Da Costa <hugo.pereira-da-costa@cea.fr>
0007  */
0008 
0009 #include <trackbase/TrkrDefs.h>
0010 
0011 #include <array>
0012 #include <map>
0013 #include <set>
0014 #include <string>
0015 
0016 /// micromegas calibration data
0017 class MicromegasHotChannelMapData
0018 {
0019   public:
0020 
0021   /// constructor
0022   MicromegasHotChannelMapData() = default;
0023 
0024   ///@name modifiers
0025   //@{
0026 
0027   /// read calibration from file
0028   void read( const std::string& /*filename*/ );
0029 
0030   /// clear hot channels
0031   void clear()
0032   { m_hot_channel_map.clear(); }
0033 
0034   /// add hot channel
0035   void add_hot_channel( int /*layer*/, int /*tile*/, int /*strip*/ );
0036 
0037   //@}
0038 
0039   //!@name accessors
0040   //@{
0041 
0042   /// write calibration to file
0043   void write( const std::string& /*filename*/ ) const;
0044 
0045   /// returns true if channel is hot
0046   bool is_hot_channel( int /*layer*/, int /*tile*/, int /*strip*/ ) const;
0047 
0048   //@}
0049 
0050   private:
0051 
0052   /// channel id
0053   class channel_id_t
0054   {
0055     public:
0056 
0057     /// constructor
0058     channel_id_t( int layer, int tile, int strip ):
0059       m_layer(layer),
0060       m_tile(tile),
0061       m_strip(strip)
0062     {}
0063 
0064     int m_layer = 0;
0065     int m_tile = 0;
0066     int m_strip = 0;
0067 
0068     /// less than operator
0069     bool operator < (const channel_id_t& other ) const
0070     {
0071       if( m_layer != other.m_layer ) return m_layer < other.m_layer;
0072       else if( m_tile != other.m_tile ) return m_tile < other.m_tile;
0073       else return m_strip < other.m_strip;
0074     }
0075 
0076     /// streamer
0077     friend std::ostream& operator << ( std::ostream& out, const channel_id_t& channel_id )
0078     {
0079       out << "{ " << channel_id.m_layer << ", " << channel_id.m_tile << ", " << channel_id.m_strip << " }";
0080       return out;
0081     }
0082 
0083   };
0084 
0085   using channel_id_set_t = std::set<channel_id_t>;
0086   channel_id_set_t m_hot_channel_map;
0087 
0088   friend std::ostream& operator << (std::ostream&, const MicromegasHotChannelMapData& );
0089 
0090 };
0091 
0092 #endif