SND@LHC Software
Loading...
Searching...
No Matches
tPythia6Generator.cxx
Go to the documentation of this file.
1#include <math.h>
2#include "TROOT.h"
3#include "TPythia6.h"
4#include "FairPrimaryGenerator.h"
5#include "tPythia6Generator.h"
6#include "TRandom1.h"
7using std::cout;
8using std::endl;
9// ----- Default constructor -------------------------------------------
11{
12 fMom = 400; // muon
13 fDeepCopy = kFALSE; // copy complete pythia event
14 fPythia = TPythia6::Instance();
15 fPionKaonDecay = kFALSE;
16 fType = "gamma/mu-"; // muon proton scattering
17 fTarget = "p+";
18}
19// -------------------------------------------------------------------------
20
21// ----- Default constructor -------------------------------------------
23{
24
25 fPythia->SetMRPY(1,gRandom->GetSeed());
26
27 cout<<"Muon Momentum "<<fMom<<endl;
28
29 if (fPionKaonDecay) {
30// let also pion and kaon decay
31 fPythia->SetMDCY(fPythia->Pycomp(211),1,100);
32 fPythia->SetMDCY(fPythia->Pycomp(321),1,100);
33 }
34 fPythia->SetMSEL(1); // msel 2 includes diffractive parts
35// fPythia->SetMSUB(91,0); // elastic scattering
36 fPythia->SetPARP(2,2); // To get below 10 GeV, you have to change PARP(2)
37
38/* compass settings
39# CKIN(10) = 100
40# MSEL = 2 # include elastic and diffractive to mbias
41# MSTJ = 1 default, string fragmentation
42*/
43
44 fPythia->Initialize("FIXT",fType,fTarget,fMom);
45
46 return kTRUE;
47}
48// -------------------------------------------------------------------------
49
50
51// ----- Destructor ----------------------------------------------------
55// -------------------------------------------------------------------------
56
57// ----- Passing the event ---------------------------------------------
58Bool_t tPythia6Generator::ReadEvent(FairPrimaryGenerator* cpg)
59{
60 Int_t npart = 0;
61 while(npart == 0)
62 {
63 fPythia->GenerateEvent();
64// remove all unnecessary stuff
65 fPythia->Pyedit(2);
66 npart = fPythia->GetN();
67 };
68
69 for(Int_t ii=1; ii<fPythia->GetN()+1; ii++){
70 Bool_t wanttracking=false;
71 if(fPythia->GetK(ii,1) == 1){ wanttracking=true;}
72 Int_t id = fPythia->GetK(ii,2);
73 Double_t z = fPythia->GetV(ii,3)/10.;
74 Double_t x = fPythia->GetV(ii,1)/10.;
75 Double_t y = fPythia->GetV(ii,2)/10.;
76 Double_t pz = fPythia->GetP(ii,3);
77 Double_t px = fPythia->GetP(ii,1);
78 Double_t py = fPythia->GetP(ii,2);
79 Double_t t = fPythia->GetP(ii,2); // time of production, in mm/c (¼ 3.33 × 10−12 s).
80 Int_t im = fPythia->GetV(ii,4);
81 // cout << "debug p6 "<<id<<" "<< pz << endl;
82// copy blind complete pythia event
83 if (fDeepCopy || wanttracking){ cpg->AddTrack(id,px,py,pz,x,y,z,im,wanttracking); }
84 }
85 return kTRUE;
86}
87
Bool_t ReadEvent(FairPrimaryGenerator *)
virtual Bool_t Init()
ClassImp(ecalContFact) ecalContFact