Pluto v6.3.0
Loading...
Searching...
No Matches
PFairGenerator.cc
Go to the documentation of this file.
1
2// Pluto interface to FairRoots primary generator
3//
4//
5// Author: Ingo Froehlich
6// Written: 13/10/2009
7//
9
10#include "PFairGenerator.h"
11#include "PDynamicData.h"
12#include "PChannel.h"
14
15#include "TDatabasePDG.h"
16
18 fPriority = 99999; //a really high number!
19}
20
21bool PFairGenerator::Modify(PParticle **stack, int *decay_done, int *num, int) {
22
23 fNumberParticles = 0;
24
25 //cout << "PFairGenerator::Modify" << endl;
26
27 for (int i=0; i<*num; i++) {
28
29 //Loop over stack particles
30 if (stack[i]->IsActive()) {
31 //count only active particles
32 //because the fireball macros have a multiplicity sampling
33 if (!decay_done[i]) {
34 //count only undecayed particles
35
36 if (fNumberParticles == FAIRGENERATOR_STACKSIZE) {
37 Error("Modify", "FAIRGENERATOR_STACKSIZE reached");
38 return kFALSE;
39 }
40 fLocalStack[fNumberParticles] = stack[i];
41 fNumberParticles++;
42 }
43 }
44 }
45
46 return kTRUE;
47}
48
49Bool_t PFairGenerator::GetNextParticle(Int_t *pdgType, Double_t *px, Double_t *py,
50 Double_t *pz, Double_t *vx, Double_t *vy, Double_t *vz) {
51 //iterator for reading the particles
52
53 if (!fNumberParticles) return kFALSE;
54
55 TDatabasePDG *dataBase = TDatabasePDG::Instance();
56
57 fNumberParticles--;
58 PParticle *part = fLocalStack[fNumberParticles];
59
60 TLorentzVector mom = part->Vect4();
61 *px = mom.Px();
62 *py = mom.Py();
63 *pz = mom.Pz();
64
65 TVector3 vertex = part->getVertex();
66 *vx = vertex.x();
67 *vy = vertex.y();
68 *vz = vertex.z();
69
70 *pdgType = dataBase->ConvertGeant3ToPdg(part->ID());
71
72 return kTRUE;
73
74}
75
76
ClassImp(PBeamLineSimulation) PBeamLineSimulation
#define FAIRGENERATOR_STACKSIZE
double pz
double px
double py
Bool_t GetNextParticle(Int_t *pdgType, Double_t *px, Double_t *py, Double_t *pz, Double_t *vx, Double_t *vy, Double_t *vz)
bool Modify(PParticle **stack, int *decay_done, int *num, int maxnum)
Int_t ID() const
Definition PParticle.h:80
TVector3 & getVertex()
Definition PParticle.h:276
TLorentzVector Vect4() const
Definition PParticle.h:117