FairShip
Loading...
Searching...
No Matches
tPythia6Generator.cxx
Go to the documentation of this file.
1
// SPDX-License-Identifier: LGPL-3.0-or-later
2
// SPDX-FileCopyrightText: Copyright CERN for the benefit of the SHiP
3
// Collaboration
4
5
#include "
tPythia6Generator.h
"
6
7
#include <cmath>
8
9
#include "FairPrimaryGenerator.h"
10
#include "TPythia6.h"
11
#include "TROOT.h"
12
#include "TRandom1.h"
13
using
std::cout;
14
using
std::endl;
15
// ----- Default constructor -------------------------------------------
16
tPythia6Generator::tPythia6Generator
() {
17
fMom
= 400;
// muon
18
fDeepCopy
= kFALSE;
// copy complete pythia event
19
fPythia
= TPythia6::Instance();
20
fPionKaonDecay
= kFALSE;
21
fType
=
"gamma/mu-"
;
// muon proton scattering
22
fTarget
=
"p+"
;
23
}
24
// -------------------------------------------------------------------------
25
26
// ----- Default constructor -------------------------------------------
27
Bool_t
tPythia6Generator::Init
() {
28
fPythia
->SetMRPY(1, gRandom->GetSeed());
29
30
cout <<
"Muon Momentum "
<<
fMom
<< endl;
31
32
if
(
fPionKaonDecay
) {
33
// let also pion and kaon decay
34
fPythia
->SetMDCY(
fPythia
->Pycomp(211), 1, 100);
35
fPythia
->SetMDCY(
fPythia
->Pycomp(321), 1, 100);
36
}
37
fPythia
->SetMSEL(1);
// msel 2 includes diffractive parts
38
// fPythia->SetMSUB(91,0); // elastic scattering
39
fPythia
->SetPARP(2, 2);
// To get below 10 GeV, you have to change PARP(2)
40
41
/* compass settings
42
# CKIN(10) = 100
43
# MSEL = 2 # include elastic and diffractive to mbias
44
# MSTJ = 1 default, string fragmentation
45
*/
46
47
fPythia
->Initialize(
"FIXT"
,
fType
,
fTarget
,
fMom
);
48
49
return
kTRUE;
50
}
51
// -------------------------------------------------------------------------
52
53
// ----- Destructor ----------------------------------------------------
54
tPythia6Generator::~tPythia6Generator
() {}
55
// -------------------------------------------------------------------------
56
57
// ----- Passing the event ---------------------------------------------
58
Bool_t
tPythia6Generator::ReadEvent
(FairPrimaryGenerator* cpg) {
59
Int_t npart = 0;
60
while
(npart == 0) {
61
fPythia
->GenerateEvent();
62
// remove all unnecessary stuff
63
fPythia
->Pyedit(2);
64
npart =
fPythia
->GetN();
65
};
66
67
for
(Int_t ii = 1; ii <
fPythia
->GetN() + 1; ii++) {
68
Bool_t wanttracking =
false
;
69
if
(
fPythia
->GetK(ii, 1) == 1) {
70
wanttracking =
true
;
71
}
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
Int_t im =
fPythia
->GetV(ii, 4);
80
// cout << "debug p6 "<<id<<" "<< pz << endl;
81
// copy blind complete pythia event
82
if
(
fDeepCopy
|| wanttracking) {
83
cpg->AddTrack(
id
, px, py, pz, x, y, z, im, wanttracking);
84
}
85
}
86
return
kTRUE;
87
}
tPythia6Generator::fPionKaonDecay
Bool_t fPionKaonDecay
Definition:
tPythia6Generator.h:50
tPythia6Generator::fTarget
TString fTarget
Definition:
tPythia6Generator.h:52
tPythia6Generator::Init
Bool_t Init() override
Definition:
tPythia6Generator.cxx:27
tPythia6Generator::fType
TString fType
Definition:
tPythia6Generator.h:51
tPythia6Generator::fMom
Double_t fMom
Definition:
tPythia6Generator.h:48
tPythia6Generator::fPythia
TPythia6 * fPythia
Definition:
tPythia6Generator.h:45
tPythia6Generator::ReadEvent
Bool_t ReadEvent(FairPrimaryGenerator *) override
Definition:
tPythia6Generator.cxx:58
tPythia6Generator::fDeepCopy
Bool_t fDeepCopy
Definition:
tPythia6Generator.h:49
tPythia6Generator::tPythia6Generator
tPythia6Generator()
Definition:
tPythia6Generator.cxx:16
tPythia6Generator::~tPythia6Generator
~tPythia6Generator() override
Definition:
tPythia6Generator.cxx:54
tPythia6Generator.h
shipgen
tPythia6Generator.cxx
Generated by
1.9.6