Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 
0002 #ifndef HiParnt_h
0003 #define HiParnt_h
0004 
0005 extern "C" { void* hiparnt_address_(void); }
0006 
0007 /**
0008 @class HiParnt
0009 @brief      Class definition for HiParnt, which is used
0010       to modify the Hijing HIPARNT common.
0011 */
0012 class HiParnt {
0013 public:
0014     HiParnt();
0015     ~HiParnt();
0016     
0017     float&  hipr1   (int n);
0018     int&    ihpr2   (int n);
0019     float&  hint1   (int n);
0020     int&    ihnt2   (int n);
0021     
0022     void    init    (void);
0023 
0024     // return common array lengths
0025     inline int lenHipr1() const {return _lenHipr1;}
0026     inline int lenIhpr2() const {return _lenIhpr2;}
0027     inline int lenHint1() const {return _lenHint1;}
0028     inline int lenIhnt2() const {return _lenIhnt2;}
0029 
0030 private: 
0031 
0032     // Lengths of the COMMONS
0033     static const int _lenHipr1 = 100;
0034     static const int _lenIhpr2 = 50;
0035     static const int _lenHint1 = 100;
0036     static const int _lenIhnt2 = 50;
0037 
0038     struct HIPARNT;
0039     friend struct HIPARNT;
0040 
0041     struct HIPARNT
0042     {
0043     float   hipr1[_lenHipr1];
0044     int ihpr2[_lenIhpr2];
0045     float   hint1[_lenHint1];
0046     int ihnt2[_lenIhnt2];
0047     };
0048 
0049     int _dummy;
0050     float _realdummy;
0051     static HIPARNT* _hiparnt;
0052 };
0053 
0054 // set pointer to zero at start
0055 HiParnt::HIPARNT* HiParnt::_hiparnt =0;
0056 
0057 inline void
0058 HiParnt::init(void)
0059 { if (!_hiparnt) _hiparnt = static_cast<HIPARNT*>(hiparnt_address_()); }
0060 
0061 inline 
0062 HiParnt::HiParnt() 
0063     : _dummy        (-999),
0064       _realdummy    (-999.)
0065 {}
0066 
0067 inline 
0068 HiParnt::~HiParnt() 
0069 {}
0070 
0071 inline float&
0072 HiParnt::hipr1  (int n)
0073 {
0074     init(); // check COMMON is initialized
0075     if(n < 1 || n > lenHipr1()) return _realdummy;
0076     return _hiparnt->hipr1[n-1];
0077 }
0078 
0079 inline int&
0080 HiParnt::ihpr2  (int n)
0081 {
0082     init(); // check COMMON is initialized
0083     if(n < 1 || n > lenIhpr2()) return _dummy;
0084     return _hiparnt->ihpr2[n-1];
0085 }
0086 
0087 inline float&
0088 HiParnt::hint1  (int n)
0089 {
0090     init(); // check COMMON is initialized
0091     if(n < 1 || n > lenHint1()) return _realdummy;
0092     return _hiparnt->hint1[n-1];
0093 }
0094 
0095 // access ihnt2 in common
0096 inline int&
0097 HiParnt::ihnt2  (int n)
0098 {
0099     init(); // check COMMON is initialized
0100     if(n < 1 || n > lenIhnt2()) return _dummy;
0101     return _hiparnt->ihnt2[n-1];
0102 }
0103 
0104 #endif