StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
starsim.hijing.C
1 // macro to instantiate the Geant3 from within
2 // STAR C++ framework and get the starsim prompt
3 // To use it do
4 // root4star starsim.C
5 
6 class St_geant_Maker;
7 St_geant_Maker *geant_maker = 0;
8 
9 class StarGenEvent;
10 StarGenEvent *event = 0;
11 
12 class StarPrimaryMaker;
13 StarPrimaryMaker *_primary = 0;
14 
15 class StarHijing;
16 StarHijing *hijing = 0;
17 // ----------------------------------------------------------------------------
18 void geometry( TString tag, bool agml=true )
19 {
20  TString cmd = "DETP GEOM "; cmd += tag;
21  if ( !geant_maker ) geant_maker = (St_geant_Maker *)chain->GetMaker("geant");
22  geant_maker -> LoadGeometry(cmd);
23 
24  // if ( agml ) command("gexec $STAR_LIB/libxgeometry.so");
25 }
26 // ----------------------------------------------------------------------------
27 void command( TString cmd )
28 {
29  if ( !geant_maker ) geant_maker = (St_geant_Maker *)chain->GetMaker("geant");
30  geant_maker -> Do( cmd );
31 }
32 // ----------------------------------------------------------------------------
33 void trig( int n=0 )
34 {
35  for ( int i=0; i<n+1; i++ ) {
36  chain->Clear();
37  chain->Make();
38  _primary -> event() -> Print();
39  }
40 }
41 // ----------------------------------------------------------------------------
42 void Hijing()
43 {
44  hijing = new StarHijing();
45  hijing->SetTitle("Hijing 1.383");
46 
47  // Setup collision frame, energy and beam species
48  hijing->SetFrame("CMS",200.0);
49  hijing->SetBlue("Au");
50  hijing->SetYell("Au");
51  hijing->SetImpact(0.0, 30.0); // Impact parameter min/max (fm) 0. 30.
52 
53 
54 
55  _primary -> AddGenerator(hijing);
56  _primary -> SetCuts( 1.0E-6 , -1., -2.5, +2.5 );
57 
58 }
59 // ----------------------------------------------------------------------------
60 // ----------------------------------------------------------------------------
61 // ----------------------------------------------------------------------------
62 void starsim( int nevents=10,int rngSeed=1234, const char* tag="y2018" )
63 {
64 
65  gROOT->ProcessLine(".L bfc.C");
66  {
67  TString simple = Form("%s geant gstar usexgeom agml ",tag);
68  bfc(0, simple );
69  }
70 
71  gSystem->Load( "libVMC.so");
72 
73  gSystem->Load( "StarGeneratorUtil.so" );
74  gSystem->Load( "StarGeneratorEvent.so" );
75  gSystem->Load( "StarGeneratorBase.so" );
76  gSystem->Load( "libMathMore.so" );
77  gSystem->Load( "libHijing1_383.so");
78  gSystem->Load( "xgeometry.so" );
79 
80  // Setup RNG seed and map all ROOT TRandom here
81  StarRandom::seed( rngSeed );
83 
84  //
85  // Create the primary event generator and insert it
86  // before the geant maker
87  //
88  _primary = new StarPrimaryMaker();
89  {
90  _primary -> SetFileName( "hijing.starsim.root");
91  chain -> AddBefore( "geant", _primary );
92  }
93 
94 
95  //
96  // Setup an event generator
97  //
98  Hijing();
99 
100  //
101  // Initialize primary event generator and all sub makers
102  //
103  _primary -> Init();
104 
105  // Configure HIJING simulation
106  HiParnt_t &hiparnt = hijing->hiparnt();
107  {
108  hiparnt.ihpr2(4) = 0; // Jet quenching (1=yes/0=no) 0
109  hiparnt.ihpr2(3) = 0; // Hard scattering (1=yes/0=no)
110  //hiparnt.hipr1(10) = -2.5; // pT jet (negative indicates lower limit)
111  hiparnt.ihpr2(8) = 10; // Max number of jets / nucleon
112  hiparnt.ihpr2(11) = 1; // Set baryon production
113  hiparnt.ihpr2(12) = 1; // Turn on/off decay of particles [1=recommended]
114  hiparnt.ihpr2(18) = 0; // 1=B quark production. 0=C quark production.
115  hiparnt.hipr1(7) = 5.35; // Set B production ???? Not really used... Really ????
116 
117  // For more configuration options, see the HIJING manual
118  // http://ntc0.lbl.gov/~xnwang/hijing/doc.html
119  }
120  //
121  // Setup geometry and set starsim to use agusread for input
122  //
123  //geometry("y2012");
124  command("gkine -4 0");
125  command("gfile o hijing.starsim.fzd");
126 
127  //
128  // Trigger on nevents
129  //
130  trig( nevents );
131  command("gprint kine");
132 
133  if ( gROOT->IsBatch() ) {
134  command("call agexit"); // Make sure that STARSIM exits properly
135  }
136  else {
137  std::cout << "Interactive mode. Please call AgExit() before .q" << std::endl;
138  }
139 
140 }
141 // ----------------------------------------------------------------------------
142 void AgExit() { command("call agexit"); }
HIJING /HIPARNT/ common block/.
Definition: Hijing.h:79
void SetFrame(const Char_t *frame, const Double_t val)
void SetImpact(Double_t bmin, Double_t bmax)
Set the minimum and maximum impact parameters for the collision (HI generators)
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
void SetBlue(const Char_t *b)
Sets the particle species for the blue beam.
int & ihpr2(int i)
Definition: Hijing.h:94
HiParnt_t & hiparnt()
Returns a reference to the hijing parameters.
Definition: StarHijing.h:58
float & hipr1(int i)
Definition: Hijing.h:90
Interface to the HIJING event generator.
Definition: StarHijing.h:48
virtual Int_t Make()
Definition: StChain.cxx:110
static void seed(UInt_t s)
Definition: StarRandom.cxx:119
Base class for event records.
Definition: StarGenEvent.h:81
Main steering class for event generation.
void SetYell(const Char_t *y)
Sets the particle species for the yellow beam.
static void capture()
Capture gRandom random number generator.
Definition: StarRandom.cxx:57
Int_t Init()
Definition: StarHijing.cxx:98