Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-19 09:18:50

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef TPC_TPCMASKEDCHANNELMAP_H
0004 #define TPC_TPCMASKEDCHANNELMAP_H
0005 
0006 #include <tpc/TpcMap.h>
0007 #include <trackbase/TrkrDefs.h>
0008 
0009 #include <fun4all/SubsysReco.h>
0010 
0011 #include <string>
0012 #include <vector>
0013 #include <set>
0014 #include <TH2.h>
0015 
0016 class PHCompositeNode;
0017 class TpcRawHitContainer;
0018 
0019 //! Dump TPC raw data in PRDF format to a TTree for online debugging and seeding formal Fun4All reco/calib modules
0020 class TpcMaskedChannelMap : public SubsysReco
0021 {
0022  public:
0023   explicit TpcMaskedChannelMap(const std::string &fname = "");
0024 
0025   ~TpcMaskedChannelMap() override {}
0026 
0027   /** Called for first event when run number is known.
0028       Typically this is where you may want to fetch data from
0029       database, because you know the run number. A place
0030       to book histograms which have to know the run number.
0031   */
0032   int InitRun(PHCompositeNode *topNode) override;
0033 
0034   /** Called for each event.
0035       This is where you do the real work.
0036   */
0037   int process_event(PHCompositeNode *topNode) override;
0038 
0039   /// Called at the end of all processing.
0040   int End(PHCompositeNode *topNode) override;
0041 
0042   void setHitCuts(float low, float high)
0043   {
0044     m_deadChanHitCut = low;
0045     m_hotChanHitCut = high;
0046   }
0047 
0048  private:
0049   
0050   int FEE_R[26]{2, 2, 1, 1, 1, 3, 3, 3, 3, 3, 3, 2, 2, 1, 2, 2, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3};
0051   int FEE_map[26]{3, 2, 5, 3, 4, 0, 2, 1, 3, 4, 5, 7, 6, 2, 0, 1, 0, 1, 4, 5, 11, 9, 10, 8, 6, 7};
0052   int mc_sectors[12]{5, 4, 3, 2, 1, 0, 11, 10, 9, 8, 7, 6};
0053   float nhit_sectors_fees_channels[24][26][256] = {{{0}}};
0054 
0055   std::string m_run{""};
0056   std::string m_hotFile{""};
0057   std::string m_deadFile{""};
0058 
0059   TpcMap M;
0060 
0061   std::vector<TpcRawHitContainer*> rawhitcont_vec{};
0062 
0063   float m_deadChanHitCut = 0.1;
0064   float m_hotChanHitCut = 10;   
0065  
0066   float n_Events = 0; 
0067 
0068   std::string m_histogramFile{""};
0069 
0070   TH2F *h_hits_side0{nullptr};
0071   TH2F *h_hits_side1{nullptr};
0072   TH2F *h_masked_side0{nullptr};
0073   TH2F *h_masked_side1{nullptr};
0074 
0075   class channel_id_t
0076   {
0077     public:
0078 
0079     /// constructor
0080     channel_id_t( int layer, int sector, int side, int pad, float x, float y ):
0081       m_layer(layer),
0082       m_sector(sector),
0083       m_side(side),
0084       m_pad(pad),
0085       m_x(x),
0086       m_y(y)
0087     {}
0088 
0089     int m_layer = 0;
0090     int m_sector = 0;
0091     int m_side = 0;
0092     int m_pad = 0;
0093     int m_x = 0;
0094     int m_y = 0;
0095 
0096     // less than operator
0097     bool operator < (const channel_id_t& other ) const
0098     {
0099       if( m_layer != other.m_layer ) return m_layer < other.m_layer;
0100       else if( m_sector != other.m_sector ) return m_sector < other.m_sector;
0101       else if( m_side != other.m_side ) return m_side < other.m_side;
0102       else if( m_pad != other.m_pad ) return m_pad < other.m_pad;
0103       else if( m_x != other.m_x ) return m_x < other.m_x;
0104       else return m_y < other.m_y;
0105     }
0106 
0107     /// streamer
0108     friend std::ostream& operator << ( std::ostream& out, const channel_id_t& channel_id )
0109     {
0110       out << "{ " << channel_id.m_layer << ", " << channel_id.m_sector << ", " << channel_id.m_side << ", " << channel_id.m_pad << ", " << channel_id.m_x << ", " << channel_id.m_y << " }";
0111       return out;
0112     }
0113 
0114   };
0115 
0116   using channel_id_set_t = std::set<channel_id_t>;
0117   channel_id_set_t m_deadChannelCDB;
0118   channel_id_set_t m_hotChannelCDB;
0119 };
0120 
0121 
0122 #endif  // TpcMaskedChannelMap_H