FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairPrimaryGenerator Class Reference

#include <FairPrimaryGenerator.h>

Inheritance diagram for FairPrimaryGenerator:

Public Member Functions

 FairPrimaryGenerator ()
 
 FairPrimaryGenerator (const char *name, const char *title="FAIR Generator")
 
virtual ~FairPrimaryGenerator ()
 
virtual Bool_t Init ()
 
void AddGenerator (FairGenerator *generator)
 
void SetEventNr (Int_t evtNr)
 
virtual Bool_t GenerateEvent (FairGenericStack *pStack)
 
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 FairPrimaryGeneratorClonePrimaryGenerator () const
 
void SetBeam (Double_t beamX0, Double_t beamY0, Double_t beamSigmaX, Double_t beamSigmaY)
 
void SetBeamAngle (Double_t beamAngleX0, Double_t beamAngleY0, Double_t beamAngleSigmaX, Double_t beamAngleSigmaY)
 
void SetEventPlane (Double_t phiMin, Double_t phiMax)
 
void SetTarget (Double_t targetZ, Double_t targetDz)
 
void SetMultTarget (Int_t nroftargets, Double_t *targetZ, Double_t targetDz)
 
void SmearVertexZ (Bool_t flag)
 
void SmearGausVertexZ (Bool_t flag)
 
void SmearVertexXY (Bool_t flag)
 
void SmearGausVertexXY (Bool_t flag)
 
TObjArray * GetListOfGenerators ()
 
void SetEvent (FairMCEventHeader *event)
 
FairMCEventHeaderGetEvent ()
 
void DoTracking (Bool_t doTracking=kTRUE)
 
Int_t GetTotPrimary ()
 

Protected Member Functions

 FairPrimaryGenerator (const FairPrimaryGenerator &)
 
FairPrimaryGeneratoroperator= (const FairPrimaryGenerator &)
 
virtual void MakeVertex ()
 
virtual void MakeBeamAngle ()
 
void MakeEventPlane ()
 
 ClassDef (FairPrimaryGenerator, 5)
 

Protected Attributes

Double_t fBeamX0
 
Double_t fBeamY0
 
Double_t fBeamSigmaX
 
Double_t fBeamSigmaY
 
Double_t fBeamAngleX0
 
Double_t fBeamAngleY0
 
Double_t fBeamAngleX
 
Double_t fBeamAngleY
 
Double_t fBeamAngleSigmaX
 
Double_t fBeamAngleSigmaY
 
TVector3 fBeamDirection
 
Double_t fPhiMin
 
Double_t fPhiMax
 
Double_t fPhi
 
Double_t * fTargetZ
 
Int_t fNrTargets
 
Double_t fTargetDz
 
TVector3 fVertex
 
Int_t fNTracks
 
Bool_t fSmearVertexZ
 
Bool_t fSmearGausVertexZ
 
Bool_t fSmearVertexXY
 
Bool_t fSmearGausVertexXY
 
Bool_t fBeamAngle
 
Bool_t fEventPlane
 
FairGenericStackfStack
 
TObjArray * fGenList
 
TIterator * fListIter
 
FairMCEventHeaderfEvent
 
Bool_t fdoTracking
 
Int_t fMCIndexOffset
 
Int_t fEventNr
 

Static Protected Attributes

static Int_t fTotPrim = 0
 

Detailed Description

Definition at line 39 of file FairPrimaryGenerator.h.

Constructor & Destructor Documentation

FairPrimaryGenerator::FairPrimaryGenerator ( )

Default constructor.

Definition at line 30 of file FairPrimaryGenerator.cxx.

FairPrimaryGenerator::FairPrimaryGenerator ( const char *  name,
const char *  title = "FAIR Generator" 
)

Constructor with name and title

Definition at line 68 of file FairPrimaryGenerator.cxx.

FairPrimaryGenerator::~FairPrimaryGenerator ( )
virtual

Destructor.

Definition at line 156 of file FairPrimaryGenerator.cxx.

FairPrimaryGenerator::FairPrimaryGenerator ( const FairPrimaryGenerator rhs)
protected

Copy constructor

Definition at line 106 of file FairPrimaryGenerator.cxx.

Member Function Documentation

void FairPrimaryGenerator::AddGenerator ( FairGenerator generator)
inline

Register a generator derived from FairGenerator.

Definition at line 56 of file FairPrimaryGenerator.h.

void FairPrimaryGenerator::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

Public method AddTrack Adding a track to the MC stack. To be called within the ReadEvent methods of the registered generators.

Parameters
pdgidParticle ID (PDG code)
px,py,pzMomentum coordinates [GeV]
vx,vy,vzTrack origin relative to event vertex

Definition at line 279 of file FairPrimaryGenerator.cxx.

FairPrimaryGenerator::ClassDef ( FairPrimaryGenerator  ,
 
)
protected
FairPrimaryGenerator * FairPrimaryGenerator::ClonePrimaryGenerator ( ) const
virtual

Clone this object (used in MT mode only)

Clone generators in the list

Definition at line 396 of file FairPrimaryGenerator.cxx.

void FairPrimaryGenerator::DoTracking ( Bool_t  doTracking = kTRUE)
inline

Swich on/off the tracking of a particle

Definition at line 154 of file FairPrimaryGenerator.h.

Bool_t FairPrimaryGenerator::GenerateEvent ( FairGenericStack pStack)
virtual

Public method GenerateEvent To be called at the beginning of each event from FairMCApplication. Generates an event vertex and calls the ReadEvent methods from the registered generators.

Parameters
pStackThe particle stack
Returns
kTRUE if successful, kFALSE if not

Definition at line 212 of file FairPrimaryGenerator.cxx.

FairMCEventHeader* FairPrimaryGenerator::GetEvent ( )
inline

Accessor to the MCEvent

Definition at line 150 of file FairPrimaryGenerator.h.

TObjArray* FairPrimaryGenerator::GetListOfGenerators ( )
inline

Definition at line 144 of file FairPrimaryGenerator.h.

Int_t FairPrimaryGenerator::GetTotPrimary ( )
inline

Definition at line 156 of file FairPrimaryGenerator.h.

Bool_t FairPrimaryGenerator::Init ( )
virtual

Initialize the generater (if needed!)

Initialize list of generators

Definition at line 144 of file FairPrimaryGenerator.cxx.

void FairPrimaryGenerator::MakeBeamAngle ( )
protectedvirtual
  Private method MakeBeamAngle. If beam angle smearing in xy

is switched on, all tracks in an event are rotated by a Gaussianlike angle distribution around the x and y axis according to the mean beam angle and angle widths set by the SetBeamAngle method. To be called at the beginning of the event from the GenerateEvent method.

Definition at line 499 of file FairPrimaryGenerator.cxx.

void FairPrimaryGenerator::MakeEventPlane ( )
protected

Private method MakeEventPlane. If the rotation of the event around the z-axis by a random angle is switched on, the complete event is rotated by the chosen angle. This function is called at the beginning of the event from the GenerateEvent method. The function pick a random rotation angle between fPhiMin and fPhiMax which are set using the function SetEventPlane.

Definition at line 508 of file FairPrimaryGenerator.cxx.

void FairPrimaryGenerator::MakeVertex ( )
protectedvirtual

Private method MakeVertex. If vertex smearing in xy is switched on, the event vertex is smeared Gaussianlike in x and y direction according to the mean beam positions and widths set by the SetBeam method. If vertex smearing in z is switched on, the z coordinate of the event vertex is flatly distributed over the extension of the target. To be called at the beginning of the event from the GenerateEvent method.

Definition at line 459 of file FairPrimaryGenerator.cxx.

FairPrimaryGenerator & FairPrimaryGenerator::operator= ( const FairPrimaryGenerator rhs)
protected

Assignment operator

Definition at line 165 of file FairPrimaryGenerator.cxx.

void FairPrimaryGenerator::SetBeam ( Double_t  beamX0,
Double_t  beamY0,
Double_t  beamSigmaX,
Double_t  beamSigmaY 
)

Set beam position and widths.

Parameters
beamX0mean x position of beam at target
beamY0mean y position of beam at target
beamSigmaXGaussian beam width in x
beamSigmaYGaussian beam width in y

Definition at line 411 of file FairPrimaryGenerator.cxx.

void FairPrimaryGenerator::SetBeamAngle ( Double_t  beamAngleX0,
Double_t  beamAngleY0,
Double_t  beamAngleSigmaX,
Double_t  beamAngleSigmaY 
)

Set nominal beam angle and angle widths.

Parameters
beamAngleX0mean x angle of beam at target
beamAngleY0mean y angle of beam at target
beamAngleSigmaXGaussian beam angle width in x
beamAngleSigmaYGaussian beam angle width in y

Definition at line 419 of file FairPrimaryGenerator.cxx.

void FairPrimaryGenerator::SetEvent ( FairMCEventHeader event)
inline

Set the pointer to the MCEvent

Definition at line 147 of file FairPrimaryGenerator.h.

void FairPrimaryGenerator::SetEventNr ( Int_t  evtNr)
inline

Definition at line 65 of file FairPrimaryGenerator.h.

void FairPrimaryGenerator::SetEventPlane ( Double_t  phiMin,
Double_t  phiMax 
)

Public method SetEventPlane

Parameters
phiMinLower limit for event plane angle [rad]
phiMaxUpper limit for event plane angle [rad] If set, an event plane angle will be generated with flat distrtibution between phiMin and phiMax.

Definition at line 431 of file FairPrimaryGenerator.cxx.

void FairPrimaryGenerator::SetMultTarget ( Int_t  nroftargets,
Double_t *  targetZ,
Double_t  targetDz 
)

Set target position for multiple tagets. The thickness is the same for all targets.

Parameters
nroftargetsnumber of targets
*targetZz positions of target center
targetDzfull target thickness

Definition at line 445 of file FairPrimaryGenerator.cxx.

void FairPrimaryGenerator::SetTarget ( Double_t  targetZ,
Double_t  targetDz 
)

Set target position and thickness.

Parameters
targetZz position of target center
targetDzfull target thickness

Definition at line 438 of file FairPrimaryGenerator.cxx.

void FairPrimaryGenerator::SmearGausVertexXY ( Bool_t  flag)

Definition at line 536 of file FairPrimaryGenerator.cxx.

void FairPrimaryGenerator::SmearGausVertexZ ( Bool_t  flag)

Definition at line 522 of file FairPrimaryGenerator.cxx.

void FairPrimaryGenerator::SmearVertexXY ( Bool_t  flag)

Definition at line 529 of file FairPrimaryGenerator.cxx.

void FairPrimaryGenerator::SmearVertexZ ( Bool_t  flag)

Enable vertex smearing in z and/or xy direction

Definition at line 514 of file FairPrimaryGenerator.cxx.

Member Data Documentation

Bool_t FairPrimaryGenerator::fBeamAngle
protected

Flag for beam gradient calculation

Definition at line 217 of file FairPrimaryGenerator.h.

Double_t FairPrimaryGenerator::fBeamAngleSigmaX
protected

Beam angle width (Gaussian) in x [rad]

Definition at line 182 of file FairPrimaryGenerator.h.

Double_t FairPrimaryGenerator::fBeamAngleSigmaY
protected

Beam angle width (Gaussian) in y [rad]

Definition at line 184 of file FairPrimaryGenerator.h.

Double_t FairPrimaryGenerator::fBeamAngleX
protected

Actual beam angle at target in x [rad]

Definition at line 178 of file FairPrimaryGenerator.h.

Double_t FairPrimaryGenerator::fBeamAngleX0
protected

Nominal beam angle at target in x [rad]

Definition at line 174 of file FairPrimaryGenerator.h.

Double_t FairPrimaryGenerator::fBeamAngleY
protected

Actual beam angle at target in y [rad]

Definition at line 180 of file FairPrimaryGenerator.h.

Double_t FairPrimaryGenerator::fBeamAngleY0
protected

Nominal beam angle at target in y [rad]

Definition at line 176 of file FairPrimaryGenerator.h.

TVector3 FairPrimaryGenerator::fBeamDirection
protected

Actual beam direction at the vertex

Definition at line 186 of file FairPrimaryGenerator.h.

Double_t FairPrimaryGenerator::fBeamSigmaX
protected

Beam width (Gaussian) in x [cm]

Definition at line 169 of file FairPrimaryGenerator.h.

Double_t FairPrimaryGenerator::fBeamSigmaY
protected

Beam width (Gaussian) in y [cm]

Definition at line 171 of file FairPrimaryGenerator.h.

Double_t FairPrimaryGenerator::fBeamX0
protected

Nominal beam position at target in x [cm]

Definition at line 165 of file FairPrimaryGenerator.h.

Double_t FairPrimaryGenerator::fBeamY0
protected

Nominal beam position at target in y [cm]

Definition at line 167 of file FairPrimaryGenerator.h.

Bool_t FairPrimaryGenerator::fdoTracking
protected

go to tracking

Definition at line 230 of file FairPrimaryGenerator.h.

FairMCEventHeader* FairPrimaryGenerator::fEvent
protected

Pointer to MCEventHeader

Definition at line 228 of file FairPrimaryGenerator.h.

Int_t FairPrimaryGenerator::fEventNr
protected

Event number (Set by the primary generator if not set already by one of the specific generators

Definition at line 239 of file FairPrimaryGenerator.h.

Bool_t FairPrimaryGenerator::fEventPlane
protected

Flag for event plane rotation

Definition at line 219 of file FairPrimaryGenerator.h.

TObjArray* FairPrimaryGenerator::fGenList
protected

List of registered generators

Definition at line 224 of file FairPrimaryGenerator.h.

TIterator* FairPrimaryGenerator::fListIter
protected

Iterator over generator list

Definition at line 226 of file FairPrimaryGenerator.h.

Int_t FairPrimaryGenerator::fMCIndexOffset
protected

Number of MC tracks before a Generator is called, needed for MC index update

Definition at line 233 of file FairPrimaryGenerator.h.

Int_t FairPrimaryGenerator::fNrTargets
protected

Number of targets;

Definition at line 198 of file FairPrimaryGenerator.h.

Int_t FairPrimaryGenerator::fNTracks
protected

Number of primary tracks in current event

Definition at line 206 of file FairPrimaryGenerator.h.

Double_t FairPrimaryGenerator::fPhi
protected

Actual event plane rotation angle [rad]

Definition at line 193 of file FairPrimaryGenerator.h.

Double_t FairPrimaryGenerator::fPhiMax
protected

Upper limit for the event plane rotation angle [rad]

Definition at line 191 of file FairPrimaryGenerator.h.

Double_t FairPrimaryGenerator::fPhiMin
protected

Lower limit for the event plane rotation angle [rad]

Definition at line 189 of file FairPrimaryGenerator.h.

Bool_t FairPrimaryGenerator::fSmearGausVertexXY
protected

Flag for gaus vertex smearing in xy

Definition at line 215 of file FairPrimaryGenerator.h.

Bool_t FairPrimaryGenerator::fSmearGausVertexZ
protected

Flag for gaus vertex smearing in z

Definition at line 211 of file FairPrimaryGenerator.h.

Bool_t FairPrimaryGenerator::fSmearVertexXY
protected

Flag for vertex smearing in xy

Definition at line 213 of file FairPrimaryGenerator.h.

Bool_t FairPrimaryGenerator::fSmearVertexZ
protected

Flag for uniform vertex smearing in z

Definition at line 209 of file FairPrimaryGenerator.h.

FairGenericStack* FairPrimaryGenerator::fStack
protected

Pointer to MC stack

Definition at line 222 of file FairPrimaryGenerator.h.

Double_t FairPrimaryGenerator::fTargetDz
protected

Full target thickness [cm]

Definition at line 200 of file FairPrimaryGenerator.h.

Double_t* FairPrimaryGenerator::fTargetZ
protected

Nominal z position of center of targets [cm]

Definition at line 196 of file FairPrimaryGenerator.h.

Int_t FairPrimaryGenerator::fTotPrim = 0
staticprotected

Number of all primaries of this run

Definition at line 235 of file FairPrimaryGenerator.h.

TVector3 FairPrimaryGenerator::fVertex
protected

Vertex position of current event [cm]

Definition at line 203 of file FairPrimaryGenerator.h.


The documentation for this class was generated from the following files: