FairRoot/PandaRoot
PndPythia8Direct.cxx
Go to the documentation of this file.
1 #include <math.h>
2 #include "TROOT.h"
3 #include "Pythia.h"
4 #include "FairPrimaryGenerator.h"
5 //#include "FairGenerator.h"
6 
7 #include "PndPythia8Direct.h"
8 
9 using namespace Pythia8;
10 
11 // ----- Default constructor -------------------------------------------
13 {
14  fPar_it = 0;
15  fMom = 15.;
16  fUseRandom1 = kFALSE;
17  fUseRandom3 = kTRUE;
18 }
19 // -------------------------------------------------------------------------
20 
21 // ----- Default constructor -------------------------------------------
23 {
24  if (fUseRandom1) fRandomEngine = new PyTr1Rng();
25  if (fUseRandom3) fRandomEngine = new PyTr3Rng();
26 
27  fPythia.setRndmEnginePtr(fRandomEngine);
28 
29  // Set Parameters
30  for(Int_t jj=0; jj<fPar_it; jj++) {
31  fPythia.readString(fParams[jj]);
32  cout<<"fPythia.readString(\""<<fParams[jj]<<"\")"<<endl;
33  }
34  cout<<"Beam Momentum "<<fMom<<endl;
35 
36  // fPythia.init(-2212, 2212, 0., 0., fMom, 0., 0., 0.);
37  // Settings according to the obsolete init function
38  fPythia.settings.mode("Beams:idA", -2212);
39  fPythia.settings.mode("Beams:idB", 2212);
40  fPythia.settings.mode("Beams:frameType", 3);
41  fPythia.settings.parm("Beams:pxA", 0.);
42  fPythia.settings.parm("Beams:pyA", 0.);
43  fPythia.settings.parm("Beams:pzA", fMom);
44  fPythia.settings.parm("Beams:pxB", 0.);
45  fPythia.settings.parm("Beams:pyB", 0.);
46  fPythia.settings.parm("Beams:pzB", 0.);
47  fPythia.init();
48 
49  return kTRUE;
50 }
51 // -------------------------------------------------------------------------
52 
53 
54 // ----- Destructor ----------------------------------------------------
56 {
57 }
58 // -------------------------------------------------------------------------
59 
60 // ----- Passing the event ---------------------------------------------
61 Bool_t PndPythia8Direct::ReadEvent(FairPrimaryGenerator* cpg)
62 {
63  Int_t npart = 0;
64  while(npart == 0)
65  {
66  fPythia.next();
67  for(int i=0; i<fPythia.event.size(); i++)
68  {
69  if(fPythia.event[i].isFinal())
70  {
71  npart++;
72  };
73  };
74  };
75 
76  for(Int_t ii=0; ii<fPythia.event.size(); ii++)
77  if(fPythia.event[ii].isFinal())
78  {
79  cpg->AddTrack((Int_t)fPythia.event[ii].id(),
80  (Double_t)fPythia.event[ii].px(),(Double_t)fPythia.event[ii].py(),(Double_t)fPythia.event[ii].pz(),
81  0.,0.,0.);
82  };
83 
84  return kTRUE;
85 }
86 // -------------------------------------------------------------------------
88 {
89  fParams[fPar_it] = par;
90  fPar_it++;
91 }
92 
93 // -------------------------------------------------------------------------
95  fPythia.settings.listAll();
96 }
97 // -------------------------------------------------------------------------
98 
100 
Int_t i
Definition: run_full.C:25
Double_t par[3]
void SetParameters(char *)
Double_t
Bool_t ReadEvent(FairPrimaryGenerator *)
ClassImp(PndAnaContFact)
virtual ~PndPythia8Direct()
virtual Bool_t Init()