Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:21:08

0001 #include "MicromegasGeometry.h"
0002 
0003 //__________________________________________________
0004 MicromegasGeometry::MicromegasGeometry():
0005   m_detnames_sphenix( { "SCO", "SCI", "NCI", "NCO", "SEI", "NEI", "SWI", "NWI" } )
0006 {
0007   /*
0008    * to convert sphenix coordinates into a x,y 2D histogram, 
0009    * we transform z(3D) = x(2D)
0010    * and x (3D) = y (2D)
0011    */
0012   {
0013     const double tile_x = 0;
0014     for( const double& tile_z:{ -84.6, -28.2, 28.2, 84.6 } )
0015     { m_tile_centers.push_back( {tile_z, tile_x} ); }
0016   }
0017     
0018   {
0019     // neighbor sectors have two modules, separated by 10cm
0020     for( const double& tile_x: { -m_tile_width - 2, m_tile_width+2 } )
0021       for( const double& tile_z:{ -37.1, 37.1 } )
0022     { m_tile_centers.push_back( {tile_z, tile_x} ); }
0023   }  
0024 }
0025 
0026 //__________________________________________________
0027 MicromegasGeometry::point_list_t MicromegasGeometry::get_tile_boundaries( size_t index ) const
0028 {
0029   const auto center = get_tile_center( index );
0030   return 
0031   {    
0032     { center.first-m_tile_length/2,center.second-m_tile_width/2 },
0033     { center.first-m_tile_length/2,center.second+m_tile_width/2 },     
0034     { center.first+m_tile_length/2,center.second+m_tile_width/2 },     
0035     { center.first+m_tile_length/2,center.second-m_tile_width/2 }     
0036   };                                                                                       
0037 }
0038 
0039 //__________________________________________________
0040 MicromegasGeometry::point_list_t MicromegasGeometry::get_resist_boundaries( size_t tile_index, size_t resist_index, MicromegasDefs::SegmentationType segmentation ) const
0041 {
0042   const auto tile_center = get_tile_center( tile_index );
0043   switch( segmentation )
0044   {
0045     case MicromegasDefs::SegmentationType::SEGMENTATION_Z:
0046     {
0047       const double& resist_width = m_tile_width;
0048       const double resist_length = m_tile_length/m_nresist;
0049       const point_t resist_center({ tile_center.first - (m_tile_length - (2*resist_index+1)*resist_length)/2, tile_center.second });
0050       return 
0051       {    
0052         { resist_center.first-resist_length/2,resist_center.second-resist_width/2 },
0053         { resist_center.first-resist_length/2,resist_center.second+resist_width/2 },     
0054         { resist_center.first+resist_length/2,resist_center.second+resist_width/2 },     
0055         { resist_center.first+resist_length/2,resist_center.second-resist_width/2 }     
0056       };                                                                                       
0057     }
0058     case MicromegasDefs::SegmentationType::SEGMENTATION_PHI:
0059     {
0060       const double resist_width = m_tile_width/m_nresist;
0061       const double& resist_length = m_tile_length;
0062       const point_t resist_center({tile_center.first, tile_center.second - (m_tile_width - (2*resist_index+1)*resist_width)/2 });
0063       return 
0064       {    
0065         { resist_center.first-resist_length/2,resist_center.second-resist_width/2 },
0066         { resist_center.first-resist_length/2,resist_center.second+resist_width/2 },     
0067         { resist_center.first+resist_length/2,resist_center.second+resist_width/2 },     
0068         { resist_center.first+resist_length/2,resist_center.second-resist_width/2 }     
0069       };                                                                                       
0070     }
0071   }
0072 
0073   // unreached
0074   return point_list_t();
0075 }