Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:16:38

0001 
0002 #ifndef HijCrdn_h
0003 #define HijCrdn_h
0004 
0005 extern "C" { void* hijcrdn_address_(void); }
0006 /**
0007 @brief Class definition for HijCrdn, which is used
0008       to modify the Hijing HIJCRDN common.
0009 
0010 */
0011 class HijCrdn {
0012 public:
0013     HijCrdn();
0014     ~HijCrdn();
0015     
0016     float&      yp  (int i, int j);
0017     float&      yt  (int i, int j);
0018     
0019     void    init    (void);
0020 
0021     // return common array lengths
0022     inline int  lenI() const {return _lenI;}
0023     inline int  lenJ() const {return _lenJ;}
0024 
0025 private: 
0026 
0027     // Lengths of array in HiMain2 common
0028     static const int _lenI  = 3;
0029     static const int _lenJ  = 300;
0030 
0031     struct HIJCRDN;
0032     friend struct HIJCRDN;
0033 
0034     struct HIJCRDN
0035     {
0036     float   yp  [_lenJ][_lenI];
0037     float   yt  [_lenJ][_lenI];
0038     };
0039 
0040 //    int  _dummy;
0041     float  _realdummy;
0042 
0043     static HIJCRDN* _hijcrdn;
0044 };
0045 
0046 // set pointer to zero at start
0047 HijCrdn::HIJCRDN* HijCrdn::_hijcrdn =0;
0048 
0049 inline void
0050 HijCrdn::init(void)
0051 { if (!_hijcrdn) _hijcrdn = static_cast<HIJCRDN*>(hijcrdn_address_()); }
0052 
0053 // Constructor
0054 inline
0055 HijCrdn::HijCrdn()
0056     :// _dummy      (-999),
0057       _realdummy    (-999.)
0058 {}
0059 
0060 // Destructor
0061 inline
0062 HijCrdn::~HijCrdn()
0063 {}
0064 
0065 inline float&
0066 HijCrdn::yp (int i, int j)
0067 {
0068     init(); // check COMMON is initialized
0069     if( i < 1 || i > lenI() ||
0070     j < 1 || j > lenJ() ) return _realdummy;
0071 
0072     return _hijcrdn->yp[j-1][i-1];
0073 }
0074 
0075 inline float&
0076 HijCrdn::yt (int i, int j)
0077 {
0078     init(); // check COMMON is initialized
0079     if( i < 1 || i > lenI() ||
0080     j < 1 || j > lenJ() ) return _realdummy;
0081 
0082     return _hijcrdn->yt[j-1][i-1];
0083 }
0084 
0085 #endif