StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Hijing.cxx
1 #include "Hijing.h"
2 
3 #define hijing F77_NAME(hijing, HIJING)
4 #define hijset F77_NAME(hijset, HIJSET)
5 #define ulmass F77_NAME(ulmass, ULMASS)
6 #define lucomp F77_NAME(lucomp, LUCOMP)
7 
8 #include <StMessMgr.h>
9 
10 extern "C" {
11  void hijing( const char *frame, float &bmin, float &bmax, int sframe );
12  void hijset( float &root_s, // energy
13  const char *frame, // frame
14  const char *blue, // projectile (blue beam)
15  const char *yell, // target (yellow beam)
16  int &Ablue, // A of blue beam
17  int &Zblue, // Z of blue beam
18  int &Ayell, // A of yellow beam
19  int &Zyell, // Z of yellow beam
20  int sframe, // number of characters in "frame"
21  int sblue, // number of characters in "blue"
22  int syell ); // number of characters in "yell"
23 
24  float ulmass( int &code );
25  int lucomp( int &code );
26 
27 };
28 
29 
30 void Hijset() {
31  Hijset(0,"init","the","generator",0,0,0,0);
32 };
33 
34 void Hijset( float E, string frame, string blue, string yell, int Ablue, int Zblue, int Ayell, int Zyell )
35 {
36 
37  // Lazy initialization of hijing
38  static int called = 0;
39  static float _E;
40  static string _frame;
41  static string _blue;
42  static string _yell;
43  static int _ablue;
44  static int _zblue;
45  static int _ayell;
46  static int _zyell;
47 
48  if ( 0 == called ) { // capture the arguement list on the first call
49  _E = E;
50  _frame = frame;
51  _blue = blue;
52  _yell = yell;
53  _ablue = Ablue;
54  _zblue = Zblue;
55  _ayell = Ayell;
56  _zyell = Zyell;
57  LOG_INFO << "Hijset captured " << _frame << " E=" << _E << " GeV "
58  << _blue << " (" << _ablue << "," << _zblue << ") "
59  << _yell << " (" << _ayell << "," << _zyell << ") "
60  << endm;
61  ++called;
62  }
63  else if ( 1 == called ) { // perform actual initialization on subsequent call
64  int sframe = _frame.size();
65  int syell = _yell.size();
66  int sblue = _blue.size();
67  LOG_INFO << "Hijset configure E=" << _E << " " << _frame << " " << _blue << " " << _yell << endm;
68  hijset( _E, _frame.c_str(), _blue.c_str(), _yell.c_str(), _ablue, _zblue, _ayell, _zyell, sframe, sblue, syell );
69  ++called;
70  }
71  else { // log additional calls, but don't change the generator state
72 
73  LOG_INFO << "Additional call to Hijset is ignored" << endm;
74 
75  }
76 
77 }
78 
79 void Hijing( string frame, float bmin, float bmax )
80 {
81  int sframe = frame.size();
82  hijing( frame.c_str(), bmin, bmax, sframe );
83 }
84 
85 float Ulmass( int code )
86 {
87  return ulmass(code);
88 }
89 
90 int Lucomp( int code )
91 {
92  return lucomp(code);
93 };