Project
Loading...
Searching...
No Matches
o2::eventgen::PrimaryGenerator Class Reference

#include <PrimaryGenerator.h>

Inherits FairPrimaryGenerator.

Public Member Functions

 PrimaryGenerator ()=default
 
 ~PrimaryGenerator () override
 
Bool_t GenerateEvent (FairGenericStack *pStack) override
 
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 mother1=-1, Int_t mother2=-1, Int_t daughter1=-1, Int_t daughter2=-1, Bool_t wanttracking=true, Double_t e=-9e9, Double_t tof=0., Double_t weight=0., TMCProcess proc=kPPrimary, Int_t generatorStatus=0)
 
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) override
 
Bool_t Init () override
 
Bool_t embedInto (TString fname)
 
void setEmbedIndex (int idx)
 sets the embedding index
 
void setExternalVertexForNextEvent (double x, double y, double z)
 
void setVertexMode (o2::conf::VertexMode const &mode, o2::dataformats::MeanVertexObject const *obj=nullptr)
 
void setApplyVertex (bool onoff)
 
void setGeneratorId (int id)
 
void setGeneratorDescription (std::string const &desc)
 
- Public Member Functions inherited from FairPrimaryGenerator
 FairPrimaryGenerator ()
 
 FairPrimaryGenerator (const char *name, const char *title="FAIR Generator")
 
virtual ~FairPrimaryGenerator ()
 
void AddGenerator (FairGenerator *generator)
 
void SetEventNr (Int_t evtNr)
 
virtual FairPrimaryGenerator * ClonePrimaryGenerator () 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)
 
FairMCEventHeader * GetEvent ()
 
void DoTracking (Bool_t doTracking=kTRUE)
 
Int_t GetTotPrimary ()
 

Protected Member Functions

void setInteractionDiamond (const Double_t *xyz, const Double_t *sigmaxyz)
 
void setInteractionVertex (const o2::dataformats::MCEventHeader *event)
 
void fixInteractionVertex ()
 
- Protected Member Functions inherited from FairPrimaryGenerator
 FairPrimaryGenerator (const FairPrimaryGenerator &)
 
FairPrimaryGenerator & operator= (const FairPrimaryGenerator &)
 
virtual void MakeVertex ()
 
virtual void MakeBeamAngle ()
 
void MakeEventPlane ()
 
 ClassDef (FairPrimaryGenerator, 5)
 

Protected Attributes

float mExternalVertexX = 0
 
float mExternalVertexY = 0
 
float mExternalVertexZ = 0
 
bool mHaveExternalVertex = false
 
TFile * mEmbedFile = nullptr
 
TTree * mEmbedTree = nullptr
 
Int_t mEmbedEntries = 0
 
Int_t mEmbedIndex = 0
 
o2::dataformats::MCEventHeader * mEmbedEvent = nullptr
 
bool mApplyVertex = true
 
o2::conf::VertexMode mVertexMode = o2::conf::VertexMode::kDiamondParam
 
std::unique_ptr< o2::dataformats::MeanVertexObject > mMeanVertex
 
- Protected Attributes inherited from FairPrimaryGenerator
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
 
FairGenericStack * fStack
 
TObjArray * fGenList
 
TIterator * fListIter
 
FairMCEventHeader * fEvent
 
Bool_t fdoTracking
 
Int_t fMCIndexOffset
 
Int_t fEventNr
 

Additional Inherited Members

- Static Protected Attributes inherited from FairPrimaryGenerator
static Int_t fTotPrim = 0
 

Detailed Description

custom primary generator in order to be able to deal with specific O2 matters, like initialisation, generation, ...

Definition at line 43 of file PrimaryGenerator.h.

Constructor & Destructor Documentation

◆ PrimaryGenerator()

o2::eventgen::PrimaryGenerator::PrimaryGenerator ( )
default

default constructor

◆ ~PrimaryGenerator()

o2::eventgen::PrimaryGenerator::~PrimaryGenerator ( )
override

destructor

destructor

Definition at line 40 of file PrimaryGenerator.cxx.

Member Function Documentation

◆ AddTrack() [1/2]

void o2::eventgen::PrimaryGenerator::AddTrack ( Int_t  pdgid,
Double_t  px,
Double_t  py,
Double_t  pz,
Double_t  vx,
Double_t  vy,
Double_t  vz,
Int_t  mother1 = -1,
Int_t  mother2 = -1,
Int_t  daughter1 = -1,
Int_t  daughter2 = -1,
Bool_t  wanttracking = true,
Double_t  e = -9e9,
Double_t  tof = 0.,
Double_t  weight = 0.,
TMCProcess  proc = kPPrimary,
Int_t  generatorStatus = 0 
)

ALICE-o2 AddTrack with mother/daughter indices

add track

add event vertex to track vertex

check if particle to be tracked exists in PDG database

set all other parameters required by PushTrack

if it is a K0/antiK0 to be tracked, convert it into K0s/K0L.

NOTE: we could think of pushing the K0/antiK0 without tracking first and then push she K0s/K0L for tracking. In this way we would properly keep track of this conversion, but there is the risk of messing up with the indices, so this is not done for the time being.

compute particle energy if negative

add track to stack

Definition at line 132 of file PrimaryGenerator.cxx.

◆ AddTrack() [2/2]

void o2::eventgen::PrimaryGenerator::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 
)
overridevirtual

override, to set encoded status code correctly

Reimplemented from FairPrimaryGenerator.

Definition at line 219 of file PrimaryGenerator.cxx.

◆ embedInto()

Bool_t o2::eventgen::PrimaryGenerator::embedInto ( TString  fname)

Public embedding methods

embed into

check if a file is already open

open file

get tree

get entries

connect MC event header

success

Definition at line 335 of file PrimaryGenerator.cxx.

◆ fixInteractionVertex()

void o2::eventgen::PrimaryGenerator::fixInteractionVertex ( )
protected

generate and fix interaction vertex

Definition at line 285 of file PrimaryGenerator.cxx.

◆ GenerateEvent()

Bool_t o2::eventgen::PrimaryGenerator::GenerateEvent ( FairGenericStack *  pStack)
overridevirtual

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

generate event

normal generation if no embedding

this is for embedding

setup interaction vertex

notify event generators

generate event

add embedding info to event header

increment embedding counter

success

Reimplemented from FairPrimaryGenerator.

Definition at line 79 of file PrimaryGenerator.cxx.

◆ Init()

Bool_t o2::eventgen::PrimaryGenerator::Init ( )
overridevirtual

initialize the generator

init

embedding

base class init

Reimplemented from FairPrimaryGenerator.

Definition at line 55 of file PrimaryGenerator.cxx.

◆ setApplyVertex()

void o2::eventgen::PrimaryGenerator::setApplyVertex ( bool  onoff)
inline

Definition at line 91 of file PrimaryGenerator.h.

◆ setEmbedIndex()

void o2::eventgen::PrimaryGenerator::setEmbedIndex ( int  idx)
inline

sets the embedding index

Definition at line 84 of file PrimaryGenerator.h.

◆ setExternalVertexForNextEvent()

void o2::eventgen::PrimaryGenerator::setExternalVertexForNextEvent ( double  x,
double  y,
double  z 
)

Definition at line 250 of file PrimaryGenerator.cxx.

◆ setGeneratorDescription()

void o2::eventgen::PrimaryGenerator::setGeneratorDescription ( std::string const &  desc)
inline

Definition at line 95 of file PrimaryGenerator.h.

◆ setGeneratorId()

void o2::eventgen::PrimaryGenerator::setGeneratorId ( int  id)
inline

Definition at line 94 of file PrimaryGenerator.h.

◆ setInteractionDiamond()

void o2::eventgen::PrimaryGenerator::setInteractionDiamond ( const Double_t *  xyz,
const Double_t *  sigmaxyz 
)
protected

copy constructor operator= set interaction diamond position

◆ setInteractionVertex()

void o2::eventgen::PrimaryGenerator::setInteractionVertex ( const o2::dataformats::MCEventHeader *  event)
protected

set interaction vertex position

set interaction vertex

Definition at line 233 of file PrimaryGenerator.cxx.

◆ setVertexMode()

void o2::eventgen::PrimaryGenerator::setVertexMode ( o2::conf::VertexMode const &  mode,
o2::dataformats::MeanVertexObject const *  obj = nullptr 
)

Definition at line 263 of file PrimaryGenerator.cxx.

Member Data Documentation

◆ mApplyVertex

bool o2::eventgen::PrimaryGenerator::mApplyVertex = true
protected

Definition at line 122 of file PrimaryGenerator.h.

◆ mEmbedEntries

Int_t o2::eventgen::PrimaryGenerator::mEmbedEntries = 0
protected

Definition at line 118 of file PrimaryGenerator.h.

◆ mEmbedEvent

o2::dataformats::MCEventHeader* o2::eventgen::PrimaryGenerator::mEmbedEvent = nullptr
protected

Definition at line 120 of file PrimaryGenerator.h.

◆ mEmbedFile

TFile* o2::eventgen::PrimaryGenerator::mEmbedFile = nullptr
protected

embedding members

Definition at line 116 of file PrimaryGenerator.h.

◆ mEmbedIndex

Int_t o2::eventgen::PrimaryGenerator::mEmbedIndex = 0
protected

Definition at line 119 of file PrimaryGenerator.h.

◆ mEmbedTree

TTree* o2::eventgen::PrimaryGenerator::mEmbedTree = nullptr
protected

Definition at line 117 of file PrimaryGenerator.h.

◆ mExternalVertexX

float o2::eventgen::PrimaryGenerator::mExternalVertexX = 0
protected

Definition at line 112 of file PrimaryGenerator.h.

◆ mExternalVertexY

float o2::eventgen::PrimaryGenerator::mExternalVertexY = 0
protected

Definition at line 112 of file PrimaryGenerator.h.

◆ mExternalVertexZ

float o2::eventgen::PrimaryGenerator::mExternalVertexZ = 0
protected

Definition at line 112 of file PrimaryGenerator.h.

◆ mHaveExternalVertex

bool o2::eventgen::PrimaryGenerator::mHaveExternalVertex = false
protected

Definition at line 113 of file PrimaryGenerator.h.

◆ mMeanVertex

std::unique_ptr<o2::dataformats::MeanVertexObject> o2::eventgen::PrimaryGenerator::mMeanVertex
protected

Definition at line 124 of file PrimaryGenerator.h.

◆ mVertexMode

o2::conf::VertexMode o2::eventgen::PrimaryGenerator::mVertexMode = o2::conf::VertexMode::kDiamondParam
protected

Definition at line 123 of file PrimaryGenerator.h.


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