StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
starsim.herwig6.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 Herwig6.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 StarHerwig6;
16 //StarHerwig6 *gHerwig = 0;
17 
18 // ----------------------------------------------------------------------------
19 void geometry( TString tag, Bool_t agml=true )
20 {
21  TString cmd = "DETP GEOM "; cmd += tag;
22  if ( !geant_maker ) geant_maker = (St_geant_Maker *)chain->GetMaker("geant");
23  geant_maker -> LoadGeometry(cmd);
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_t n=1 )
34 {
35  for ( Int_t i=0; i<n; i++ ) {
36  chain->Clear();
37  chain->Make();
38  _primary->event()->Print(); // Print the primary event
39  }
40 }
41 // ----------------------------------------------------------------------------
42 // ----------------------------------------------------------------------------
43 // ----------------------------------------------------------------------------
44 void Herwig6( TString mode="pp" )
45 {
46 
47  gSystem->Load( "libHerwig6_5_20.so");
48 
49  //StarHerwig6 *herwig6 = new StarHerwig6("herwig6");
50  herwig6 = new StarHerwig6("herwig6");
51  if ( mode == "pp" )
52  {
53  Double_t pblue[]={0.,0.,320.0};
54  Double_t pyell[]={0.,0.,-320.0};
55  herwig6->SetFrame("3MOM", pblue, pyell );
56  herwig6->SetBlue("proton");
57  herwig6->SetYell("proton");
58  herwig6->SetProcess(1000);
59  }
60 
61  _primary->AddGenerator(herwig6);
62 }
63 // ----------------------------------------------------------------------------
64 // ----------------------------------------------------------------------------
65 // ----------------------------------------------------------------------------
66 void starsim( Int_t nevents=1, Int_t rngSeed=1234 )
67 {
68 
69  gROOT->ProcessLine(".L bfc.C");
70  {
71  TString simple = "y2012 geant gstar usexgeom agml ";
72  bfc(0, simple );
73  }
74 
75  gSystem->Load( "libVMC.so");
76 
77  gSystem->Load( "StarGeneratorUtil.so" );
78  gSystem->Load( "StarGeneratorEvent.so" );
79  gSystem->Load( "StarGeneratorBase.so" );
80 
81  gSystem->Load( "libMathMore.so" );
82  gSystem->Load( "xgeometry.so" );
83 
84  // Setup RNG seed and captuire ROOT TRandom
85  StarRandom::seed(rngSeed);
87 
88  //
89  // Create the primary event generator and insert it
90  // before the geant maker
91  //
92  // StarPrimaryMaker *
93  _primary = new StarPrimaryMaker();
94  {
95  _primary -> SetFileName( "Herwig6.starsim.root");
96  chain -> AddBefore( "geant", _primary );
97  }
98 
99  //
100  // Setup an event generator
101  //
102  Herwig6( "pp" );
103 
104  //
105  // Initialize primary event generator and all sub makers
106  //
107  _primary -> Init();
108 
109  //
110  // Setup geometry and set starsim to use agusread for input
111  //
112  geometry("y2012");
113  command("gkine -4 0");
114  command("gfile o herwig6.starsim.fzd");
115 
116 
117  //
118  // Trigger on nevents
119  //
120  trig( nevents );
121 
122  command("call agexit"); // Make sure that STARSIM exits properly
123 
124 }
125 // ----------------------------------------------------------------------------
void SetFileName(const Char_t *name)
Set the filename of the output TTree.
void Print(const Option_t *opts="head") const
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
void AddGenerator(StarGenerator *gener)
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
StarGenEvent * event()
Return a pointer to the event.
Main steering class for event generation.
static void capture()
Capture gRandom random number generator.
Definition: StarRandom.cxx:57