FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairParticleGenerator.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 // -------------------------------------------------------------------------
9 // ----- FairParticleGenerator source file -----
10 // ----- Created 09/07/04 by V. Friese / D.Bertini -----
11 // -------------------------------------------------------------------------
12 #include "FairParticleGenerator.h"
13 
14 #include "FairLogger.h"
15 #include "FairPrimaryGenerator.h" // for FairPrimaryGenerator
16 
19  , fPx(0)
20  , fPy(0)
21  , fPz(0)
22 {
23  SetPDGType(-1);
24 }
25 
27  Int_t mult,
28  Double32_t px,
29  Double32_t py,
30  Double32_t pz,
31  Double32_t vx,
32  Double32_t vy,
33  Double32_t vz)
35  , fPx(px)
36  , fPy(py)
37  , fPz(pz)
38 {
39  SetPDGType(pdgid);
40  SetMultiplicity(mult);
41  SetVertex(vx, vy, vz);
42 }
43 
44 void FairParticleGenerator::SetMomentum(Double32_t px, Double32_t py, Double32_t pz)
45 {
46  fPx = px;
47  fPy = py;
48  fPz = pz;
49 }
50 
52 {
53  // Check for particle type
55  if (GetPDGType() == -1) {
56  LOG(fatal) << "FairParticleGenerator PDG code not defined";
57  }
58 
59  // Generate particles
60  for (Int_t k = 0; k < GetMultiplicity(); k++) {
61  LOG(debug) << "FairParticleGenerator: "
62  << Form("PDG %i p=(%.2f, %.2f, %.2f) GeV,", GetPDGType(), fPx, fPy, fPz);
63  primGen->AddTrack(GetPDGType(), fPx, fPy, fPz, fX, fY, fZ);
64  }
65 
66  return kTRUE;
67 }
68 
void SetMultiplicity(Int_t mult)
virtual Bool_t ReadEvent(FairPrimaryGenerator *primGen)
ClassImp(FairEventBuilder)
Int_t GetPDGType() const
void SetPDGType(Int_t pdg)
virtual void AddTrack(Int_t pdgid, Double_t px, Double_t py, Double_t pz, Double_t vx, Double_t vy, Double_t vz, Int_t parent=-1, Bool_t wanttracking=true, Double_t e=-9e9, Double_t tof=0., Double_t weight=0., TMCProcess proc=kPPrimary)
virtual void GenerateEventParameters()
void SetVertex(Double_t vx, Double_t vy, Double_t vz, Double_t evx=0, Double_t evy=0, Double_t evz=0, eVertexSmear sm=kBox)
Int_t GetMultiplicity() const
void SetMomentum(Double32_t px, Double32_t py, Double32_t pz)