StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
standalone.pythia6.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 // ----------------------------------------------------------------------------
22 void trig( Int_t n=1 )
23 {
24  for ( Int_t i=0; i<n; i++ ) {
25  chain->Clear();
26  chain->Make();
27  }
28 }
29 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
31 // ----------------------------------------------------------------------------
32 void Pythia6( TString mode="pp:W", Int_t tune=320 )
33 {
34 
35  // gSystem->Load( "libStarGeneratorPoolPythia6_4_23.so" );
36  gSystem->Load( "libPythia6_4_23.so");
37  gSystem->Load( "StarPythia6.so" );
38 
39  StarPythia6 *pythia6 = new StarPythia6("pythia6");
40  if ( mode=="pp:W" )
41  {
42  pythia6->SetFrame("CMS", 510.0 );
43  pythia6->SetBlue("proton");
44  pythia6->SetYell("proton");
45  if ( tune ) pythia6->PyTune( tune );
46 
47  // Setup pythia process
48  PySubs_t &pysubs = pythia6->pysubs();
49  pysubs.msel = 12;
50  pysubs.ckin(3)=4.0;
51 
52  }
53  if ( mode == "pp:minbias" )
54  {
55  pythia6->SetFrame("CMS", 510.0 );
56  pythia6->SetBlue("proton");
57  pythia6->SetYell("proton");
58  if ( tune ) pythia6->PyTune( tune );
59  }
60  if ( mode == "ep" )
61  {
62  Double_t pblue[]={0.,0.,30.0};
63  Double_t pyell[]={0.,0.,-320.0};
64  pythia6->SetFrame("3MOM", pblue, pyell );
65  pythia6->SetBlue("e-");
66  pythia6->SetYell("proton");
67  if ( tune ) pythia6->PyTune( tune );
68  }
69 
70  _primary->AddGenerator(pythia6);
71 }
72 // ----------------------------------------------------------------------------
73 // ----------------------------------------------------------------------------
74 // ----------------------------------------------------------------------------
75 void standalone( Int_t nevents=100, UInt_t rngSeed = 12345 )
76 {
77 
78  gROOT->ProcessLine(".L bfc.C");
79  {
80  TString simple = "tables nodefault";
81  bfc(0, simple );
82  }
83 
84  gSystem->Load( "libVMC.so");
85  gSystem->Load( "St_g2t.so" );
86  gSystem->Load( "St_geant_Maker.so" );
87 
88  gSystem->Load( "StarGeneratorUtil.so" );
89  gSystem->Load( "StarGeneratorEvent.so" );
90  gSystem->Load( "StarGeneratorBase.so" );
91 
92  gSystem->Load( "libMathMore.so" );
93 
94  //
95  // Create the primary event generator and insert it
96  // before the geant maker
97  //
98  // StarPrimaryMaker *
99  _primary = new StarPrimaryMaker();
100  {
101  _primary -> SetFileName( "pythia6.starsim.root");
102  // chain -> AddBefore( "geant", _primary );
103  }
104 
105  //
106  // Setup an event generator
107  //
108  Pythia6( "pp:W" );
109 
110  //
111  // Initialize random number generator
112  //
113  StarRandom &random = StarRandom::Instance();
114  random.capture(); // maps all ROOT TRandoms to StarRandom
115  random.seed( rngSeed );
116 
117 
118  //
119  // Setup cuts on which particles get passed to geant for
120  // simulation. (To run generator in standalone mode,
121  // set ptmin=1.0E9.)
122  // ptmin ptmax
123  _primary->SetPtRange (1.0E9, -1.0); // GeV
124  // etamin etamax
125  _primary->SetEtaRange ( -3.0, +3.0 );
126  // phimin phimax
127  _primary->SetPhiRange ( 0., TMath::TwoPi() );
128 
129 
130  //
131  // Setup a realistic z-vertex distribution:
132  // x = 0 gauss width = 1mm
133  // y = 0 gauss width = 1mm
134  // z = 0 gauss width = 30cm
135  //
136  _primary->SetVertex( 0., 0., 0. );
137  _primary->SetSigma( 0.1, 0.1, 30.0 );
138 
139  //
140  // Initialize primary event generator and all sub makers
141  //
142  _primary -> Init();
143 
144  //
145  // Trigger on nevents
146  //
147  trig( nevents );
148 
149 }
150 // ----------------------------------------------------------------------------
151 
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)
void SetFileName(const Char_t *name)
Set the filename of the output TTree.
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
void AddGenerator(StarGenerator *gener)
void SetBlue(const Char_t *b)
Sets the particle species for the blue beam.
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
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.