Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:17

0001 /**
0002 
0003    ~/o/sysrap/tests/sgeomtools_test.sh 
0004 
0005 **/
0006 
0007 
0008 #include "sgeomtools.h"
0009 #include "scuda_double.h"
0010 
0011 
0012 struct DiskExtent
0013 {
0014     static constexpr const double rmin = 0.9 ; 
0015     static constexpr const double rmax = 1.0 ; 
0016 
0017     double startPhi ; 
0018     double deltaPhi ; 
0019     double endPhi ; 
0020 
0021     double2 pmin = {} ; 
0022     double2 pmax = {} ; 
0023 
0024     DiskExtent(double _startPhi, double _deltaPhi) ; 
0025 
0026     std::string desc() const ; 
0027 
0028     static int Main(); 
0029     static int test_0(); 
0030     static int test_1(); 
0031     static int test_2(); 
0032     static int test_3(); 
0033     static int test_4(); 
0034 
0035 };
0036     
0037 inline DiskExtent::DiskExtent(double _startPhi, double _deltaPhi) 
0038     :
0039     startPhi(_startPhi),
0040     deltaPhi(_deltaPhi),
0041     endPhi(startPhi+deltaPhi)
0042 {
0043     sgeomtools::DiskExtent(rmin, rmax, startPhi, deltaPhi, pmin, pmax ); 
0044 }
0045 
0046     
0047 inline std::string DiskExtent::desc() const 
0048 {
0049     std::stringstream ss ; 
0050 
0051     ss 
0052          << "DiskExtent::desc"
0053          << "\n"
0054          << " startPhi " << startPhi
0055          << " startPhi/M_PI " << startPhi/M_PI
0056          << "\n"
0057          << " endPhi " << endPhi
0058          << " endPhi/M_PI " << endPhi/M_PI
0059          << "\n"
0060          << " deltaPhi " << deltaPhi
0061          << " deltaPhi/M_PI " << deltaPhi/M_PI
0062          << "\n"
0063          << " pmax " << pmax 
0064          << "\n"
0065          << " pmin " << pmin 
0066          << "\n"
0067          ;
0068 
0069     std::string str = ss.str() ; 
0070     return str ; 
0071 }
0072 
0073 
0074 
0075 /**
0076 DiskExtent::test_0
0077 -------------------
0078                         (10,10)
0079            +-----+-----+
0080            | .       . |
0081            |.         .|
0082      pi -x +-----+-----+x  phi=0
0083       (-10,0)
0084 
0085 **/
0086 
0087 int DiskExtent::test_0()
0088 {
0089     DiskExtent t(0.,M_PI); 
0090     std::cout << "test_0\n" << t.desc() ;     
0091     return 0 ; 
0092 }
0093 
0094 
0095 /**
0096 DiskExtent::test_1
0097 -------------------
0098                pi/2     (10,10)
0099            +-----+-----+
0100            | .   |   . |
0101            |.    |    .|
0102      pi -x +-----+-----+x  phi=0
0103       (-10,0)
0104 
0105 **/
0106 
0107 int DiskExtent::test_1()
0108 {
0109     DiskExtent t(0.,M_PI/2);  
0110     std::cout << "test_1 (1st quad)\n" << t.desc() ;     
0111     return 0 ; 
0112 }
0113 
0114 int DiskExtent::test_2()
0115 {
0116     DiskExtent t(M_PI/2,M_PI/2);  
0117     std::cout << "test_2 (2nd quad)\n" << t.desc() ;     
0118     return 0 ; 
0119 }
0120 
0121 int DiskExtent::test_3()
0122 {
0123     DiskExtent t(M_PI,M_PI/2);  
0124     std::cout << "test_3 (3rd quad)\n" << t.desc() ;     
0125     return 0 ; 
0126 }
0127 
0128 int DiskExtent::test_4()
0129 {
0130     DiskExtent t(1.5*M_PI,M_PI/2);  
0131     std::cout << "test_4 (4th quad)\n" << t.desc() ;     
0132     return 0 ; 
0133 }
0134 
0135 
0136 
0137 int DiskExtent::Main()
0138 {
0139     int rc = 0 ; 
0140     rc += test_0();
0141     rc += test_1();
0142     rc += test_2();
0143     rc += test_3();
0144     rc += test_4();
0145     return rc ; 
0146 }
0147 
0148 int main()
0149 {
0150     return DiskExtent::Main() ; 
0151 }