StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
starsim.pythia6standalone.Z0.C
1 
12 class St_geant_Maker;
13 St_geant_Maker *geant_maker = 0;
14 
15 class StarGenEvent;
16 StarGenEvent *event = 0;
17 
18 class StarPrimaryMaker;
19 StarPrimaryMaker *_primary = 0;
20 
21 class StarPythia6;
22 StarPythia6 *_pythia6 = 0;
23 
24 // ----------------------------------------------------------------------------
25 void trig( Int_t n=1 )
26 {
27  for ( Int_t i=0; i<n; i++ ) {
28  chain->Clear();
29  chain->Make();
30  // if (0==i) _primary -> event() -> Print();
31  }
32 }
33 // ----------------------------------------------------------------------------
34 // ----------------------------------------------------------------------------
35 // ----------------------------------------------------------------------------
36 void Pythia6( TString mode="pp:W", Int_t tune=320 )
37 {
38 
39  // gSystem->Load( "libStarGeneratorPoolPythia6_4_23.so" );
40  gSystem->Load( "libPythia6_4_28.so");
41 
42  StarPythia6 *pythia6 = _pythia6 = new StarPythia6("pythia6");
43  if ( mode=="pp:W" )
44  {
45  pythia6->SetFrame("CMS", 510.0 );
46  pythia6->SetBlue("proton");
47  pythia6->SetYell("proton");
48  if ( tune ) pythia6->PyTune( tune );
49 
50  // Setup pythia process
51  PySubs_t &pysubs = pythia6->pysubs();
52  int& msel = pysubs.msel;
53  msel = 12;
54 
55  // Setup other common block variables / array elements
56  // float& ckin3 = pysubs.ckin(3);
57  // ckin3 = 4.0;
58 
59  //
60  // Set particles to be stable so that the decay manager
61  // can handle them in the starsim phase
62  //
63  pythia6 -> SetDecayFlag( +24, 0 ); // W+
64  pythia6 -> SetDecayFlag( -24, 0 ); // W-
65  pythia6 -> SetDecayFlag( +23, 0 ); // Z0
66  pythia6 -> SetDecayFlag( -23, 0 ); // Z0
67  pythia6 -> SetDecayFlag( +15, 0 ); // tau+
68  pythia6 -> SetDecayFlag( -15, 0 ); // tau-
69 
70  pythia6 -> CloseDecays(24);
71  pythia6 -> OpenDecay( 24, 206, 2 ); // limit decay to electron channel
72 
73  }
74 
75  if ( mode=="pp:Z" )
76  {
77  pythia6->SetFrame("CMS", 510.0 );
78  pythia6->SetBlue("proton");
79  pythia6->SetYell("proton");
80  if ( tune ) pythia6->PyTune( tune );
81 
82  // Setup pythia process
83  PySubs_t& pysubs = pythia6->pysubs();
84  int& msel = pysubs.msel;
85  msel = 11;
86 
87  PyPars_t& pypars = pythia6->pypars();
88  int& mstp43 = pypars.mstp(43);
89  mstp43 = 2;
90 
91  //
92  // Set particles to be stable so that the decay manager
93  // can handle them in the starsim phase
94  //
95  pythia6 -> SetDecayFlag( +24, 0 ); // W+
96  pythia6 -> SetDecayFlag( -24, 0 ); // W-
97  pythia6 -> SetDecayFlag( +23, 0 ); // Z0
98  pythia6 -> SetDecayFlag( -23, 0 ); // Z0
99  pythia6 -> SetDecayFlag( +15, 0 ); // tau+
100  pythia6 -> SetDecayFlag( -15, 0 ); // tau-
101 
102  pythia6 -> CloseDecays(23);
103  pythia6 -> OpenDecay( 23, 186, 2 );
104 
105  }
106 
107 
108 
109  if ( mode == "pp:minbias" )
110  {
111  pythia6->SetFrame("CMS", 510.0 );
112  pythia6->SetBlue("proton");
113  pythia6->SetYell("proton");
114  if ( tune ) pythia6->PyTune( tune );
115  }
116  if ( mode == "ep" )
117  {
118  Double_t pblue[]={0.,0.,30.0};
119  Double_t pyell[]={0.,0.,-320.0};
120  pythia6->SetFrame("3MOM", pblue, pyell );
121  pythia6->SetBlue("e-");
122  pythia6->SetYell("proton");
123  if ( tune ) pythia6->PyTune( tune );
124  }
125 
126  _primary->AddGenerator(pythia6);
127 }
128 // ----------------------------------------------------------------------------
129 // ----------------------------------------------------------------------------
130 // ----------------------------------------------------------------------------
131 void starsim( Int_t nevents=100, UInt_t rngSeed = 12345 )
132 {
133 
134  gROOT->ProcessLine(".L bfc.C");
135  {
136  TString simple = "tables nodefault";
137  bfc(0, simple );
138  }
139 
140  gSystem->Load( "libVMC.so");
141  gSystem->Load( "St_g2t.so" );
142  gSystem->Load( "St_geant_Maker.so" );
143 
144  gSystem->Load( "StarGeneratorUtil.so" );
145  gSystem->Load( "StarGeneratorEvent.so" );
146  gSystem->Load( "StarGeneratorBase.so" );
147 
148  gSystem->Load( "libMathMore.so" );
149 
150  //
151  // Create the primary event generator and insert it
152  // before the geant maker
153  //
154  // StarPrimaryMaker *
155  _primary = new StarPrimaryMaker();
156  {
157  _primary -> SetFileName( "pythia6.standalone.root");
158  // chain -> AddBefore( "geant", primary );
159  }
160 
161  //
162  // Setup an event generator
163  //
164  Pythia6( "pp:Z" );
165 
166  //
167  // Initialize random number generator
168  //
169  StarRandom &random = StarRandom::Instance();
170  random.capture(); // maps all ROOT TRandoms to StarRandom
171  random.seed( rngSeed );
172 
173 
174  //
175  // Setup cuts on which particles get passed to geant for
176  // simulation. (To run generator in standalone mode,
177  // set ptmin=1.0E9.)
178  // ptmin ptmax
179  _primary->SetPtRange (1.0E9, -1.0); // GeV
180  // etamin etamax
181  _primary->SetEtaRange ( -5.0, +5.0 );
182  // phimin phimax
183  _primary->SetPhiRange ( 0., TMath::TwoPi() );
184 
185 
186  //
187  // Fixed x, y, z vertex
188  //
189  _primary->SetVertex( 0., 0., 0. );
190  _primary->SetSigma( 0., 0., 0. );
191 
192  //
193  // Initialize primary event generator and all sub makers
194  //
195  _primary -> Init();
196 
197  //
198  // Trigger on nevents
199  //
200  trig( nevents );
201 
202  //command("call pystat");
203  _pythia6->PyStat(1);
204 
205 
206 }
207 // ----------------------------------------------------------------------------
208 
void PyTune(Int_t tune)
Calls the pytune function.
Definition: StarPythia6.cxx:44
static StarRandom & Instance()
Obtain the single instance of the random number generator.
Definition: StarRandom.cxx:87
void SetSigma(Double_t sx, Double_t sy, Double_t sz, Double_t rho=0)
void SetFrame(const Char_t *frame, const Double_t val)
static void SetDecayFlag(const int kf, const int flag)
void SetPhiRange(Double_t phimin, Double_t phimax)
Set phi range. Particles falling outside this range will be dropped from simulation.
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
Int_t Init()
Definition: StarPythia6.cxx:49
void AddGenerator(StarGenerator *gener)
void SetBlue(const Char_t *b)
Sets the particle species for the blue beam.
void PyStat(Int_t stat)
Calls the pystat function.
Definition: StarPythia6.cxx:45
A class for providing random number generation.
Definition: StarRandom.h:30
PySubs_t & pysubs()
Returns a reference to the /PYSUBS/ common block.
Definition: StarPythia6.h:61
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
Interface to pythia 6.
Definition: StarPythia6.h:48
PyPars_t & pypars()
Returns a reference to the /PYPARS/ common block.
Definition: StarPythia6.h:67
Main steering class for event generation.
void SetYell(const Char_t *y)
Sets the particle species for the yellow beam.
void SetPtRange(Double_t ptmin, Double_t ptmax=-1)
Set PT range. Particles falling outside this range will be dropped from simulation.
static void capture()
Capture gRandom random number generator.
Definition: StarRandom.cxx:57
void SetEtaRange(Double_t etamin, Double_t etamax)
Set rapidity range. Particles falling outside this range will be dropped from simulation.
void SetVertex(Double_t x, Double_t y, Double_t z)
Set the x, y and z vertex position.