StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
starsim.pythia6standalone.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  _primary -> event() -> Print();
28  }
29 }
30 // ----------------------------------------------------------------------------
31 // ----------------------------------------------------------------------------
32 // ----------------------------------------------------------------------------
33 void Pythia6( TString mode="pp:W", Int_t tune=320 )
34 {
35 
36  // gSystem->Load( "libStarGeneratorPoolPythia6_4_23.so" );
37  gSystem->Load( "libPythia6_4_28.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  int& msel = pysubs.msel;
50  msel = 12;
51 
52  // Setup other common block variables / array elements
53  float& ckin3 = pysubs.ckin(3);
54  ckin3 = 4.0;
55 
56  //
57  // Set particles to be stable so that the decay manager
58  // can handle them in the starsim phase
59  //
60  pythia6 -> SetDecayFlag( +24, 0 ); // W+
61  pythia6 -> SetDecayFlag( -24, 0 ); // W-
62  pythia6 -> SetDecayFlag( +23, 0 ); // Z0
63  pythia6 -> SetDecayFlag( -23, 0 ); // Z0
64  pythia6 -> SetDecayFlag( +15, 0 ); // tau+
65  pythia6 -> SetDecayFlag( -15, 0 ); // tau-
66 
67 
68  }
69  if ( mode == "pp:minbias" )
70  {
71  pythia6->SetFrame("CMS", 510.0 );
72  pythia6->SetBlue("proton");
73  pythia6->SetYell("proton");
74  if ( tune ) pythia6->PyTune( tune );
75  }
76  if ( mode == "ep" )
77  {
78  Double_t pblue[]={0.,0.,30.0};
79  Double_t pyell[]={0.,0.,-320.0};
80  pythia6->SetFrame("3MOM", pblue, pyell );
81  pythia6->SetBlue("e-");
82  pythia6->SetYell("proton");
83  if ( tune ) pythia6->PyTune( tune );
84  }
85 
86  _primary->AddGenerator(pythia6);
87 }
88 // ----------------------------------------------------------------------------
89 // ----------------------------------------------------------------------------
90 // ----------------------------------------------------------------------------
91 void starsim( Int_t nevents=1000, UInt_t rngSeed = 12345 )
92 {
93 
94  gROOT->ProcessLine(".L bfc.C");
95  {
96  TString simple = "tables nodefault";
97  bfc(0, simple );
98  }
99 
100  gSystem->Load( "libVMC.so");
101  gSystem->Load( "St_g2t.so" );
102  gSystem->Load( "St_geant_Maker.so" );
103 
104  gSystem->Load( "StarGeneratorUtil.so" );
105  gSystem->Load( "StarGeneratorEvent.so" );
106  gSystem->Load( "StarGeneratorBase.so" );
107 
108  gSystem->Load( "libMathMore.so" );
109 
110  //
111  // Create the primary event generator and insert it
112  // before the geant maker
113  //
114  // StarPrimaryMaker *
115  _primary = new StarPrimaryMaker();
116  {
117  _primary -> SetFileName( "pythia6.starsim.root");
118  // chain -> AddBefore( "geant", primary );
119  }
120 
121  //
122  // Setup an event generator
123  //
124  Pythia6( "pp:W" );
125 
126  //
127  // Initialize random number generator
128  //
129  StarRandom &random = StarRandom::Instance();
130  random.capture(); // maps all ROOT TRandoms to StarRandom
131  random.seed( rngSeed );
132 
133 
134  //
135  // Setup cuts on which particles get passed to geant for
136  // simulation. (To run generator in standalone mode,
137  // set ptmin=1.0E9.)
138  // ptmin ptmax
139  _primary->SetPtRange (1.0E9, -1.0); // GeV
140  // etamin etamax
141  _primary->SetEtaRange ( -5.0, +5.0 );
142  // phimin phimax
143  _primary->SetPhiRange ( 0., TMath::TwoPi() );
144 
145 
146  //
147  // Fixed x, y, z vertex
148  //
149  _primary->SetVertex( 0., 0., 0. );
150  _primary->SetSigma( 0., 0., 0. );
151 
152  //
153  // Initialize primary event generator and all sub makers
154  //
155  _primary -> Init();
156 
157  //
158  // Trigger on nevents
159  //
160  trig( nevents );
161 
162 }
163 // ----------------------------------------------------------------------------
164 
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
StarGenEvent * event()
Return a pointer to the event.
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.