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 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)
 

Protected Member Functions

void setInteractionDiamond (const Double_t *xyz, const Double_t *sigmaxyz)
 
void setInteractionVertex (const o2::dataformats::MCEventHeader *event)
 
void fixInteractionVertex ()
 

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::MCEventHeadermEmbedEvent = nullptr
 
bool mApplyVertex = true
 
o2::conf::VertexMode mVertexMode = o2::conf::VertexMode::kDiamondParam
 
std::unique_ptr< o2::dataformats::MeanVertexObjectmMeanVertex
 

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 131 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 
)
override

override, to set encoded status code correctly

Definition at line 218 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 334 of file PrimaryGenerator.cxx.

◆ fixInteractionVertex()

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

generate and fix interaction vertex

Definition at line 284 of file PrimaryGenerator.cxx.

◆ GenerateEvent()

Bool_t o2::eventgen::PrimaryGenerator::GenerateEvent ( FairGenericStack pStack)
override

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

Definition at line 79 of file PrimaryGenerator.cxx.

◆ Init()

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

initialize the generator

init

embedding

base class init

Definition at line 55 of file PrimaryGenerator.cxx.

◆ setApplyVertex()

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

Definition at line 88 of file PrimaryGenerator.h.

◆ setExternalVertexForNextEvent()

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

Definition at line 249 of file PrimaryGenerator.cxx.

◆ setGeneratorDescription()

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

Definition at line 92 of file PrimaryGenerator.h.

◆ setGeneratorId()

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

Definition at line 91 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 232 of file PrimaryGenerator.cxx.

◆ setVertexMode()

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

Definition at line 262 of file PrimaryGenerator.cxx.

Member Data Documentation

◆ mApplyVertex

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

Definition at line 119 of file PrimaryGenerator.h.

◆ mEmbedEntries

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

Definition at line 115 of file PrimaryGenerator.h.

◆ mEmbedEvent

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

Definition at line 117 of file PrimaryGenerator.h.

◆ mEmbedFile

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

embedding members

Definition at line 113 of file PrimaryGenerator.h.

◆ mEmbedIndex

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

Definition at line 116 of file PrimaryGenerator.h.

◆ mEmbedTree

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

Definition at line 114 of file PrimaryGenerator.h.

◆ mExternalVertexX

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

Definition at line 109 of file PrimaryGenerator.h.

◆ mExternalVertexY

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

Definition at line 109 of file PrimaryGenerator.h.

◆ mExternalVertexZ

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

Definition at line 109 of file PrimaryGenerator.h.

◆ mHaveExternalVertex

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

Definition at line 110 of file PrimaryGenerator.h.

◆ mMeanVertex

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

Definition at line 121 of file PrimaryGenerator.h.

◆ mVertexMode

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

Definition at line 120 of file PrimaryGenerator.h.


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