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

#include <GeneratorTParticle.h>

Inherits o2::eventgen::Generator, and o2::eventgen::GeneratorFileOrCmd.

Public Member Functions

 GeneratorTParticle ()
 
 GeneratorTParticle (const std::string &name)
 
virtual ~GeneratorTParticle ()
 
Bool_t Init () override
 
void setup (const GeneratorFileOrCmdParam &param0, const GeneratorTParticleParam &param, const conf::SimConfig &config)
 
Bool_t generateEvent () override
 
Bool_t importParticles () override
 
void setTreeName (const std::string &val)
 
void setBranchName (const std::string &val)
 
- Public Member Functions inherited from o2::eventgen::Generator
 Generator ()
 
 Generator (const Char_t *name, const Char_t *title="ALICEo2 Generator")
 
 ~Generator () override=default
 
Bool_t Init () override
 
Bool_t ReadEvent (FairPrimaryGenerator *primGen) final
 
virtual void updateHeader (o2::dataformats::MCEventHeader *eventHeader)
 
Bool_t triggerEvent ()
 
void setMomentumUnit (double val)
 
void setEnergyUnit (double val)
 
void setPositionUnit (double val)
 
void setTimeUnit (double val)
 
void setBoost (Double_t val)
 
void setTriggerMode (ETriggerMode_t val)
 
void addTrigger (Trigger trigger)
 
void addDeepTrigger (DeepTrigger trigger)
 
const std::vector< TParticle > & getParticles () const
 
void clearParticles ()
 
virtual void notifyEmbedding (const o2::dataformats::MCEventHeader *eventHeader)
 
void setTriggerOkHook (std::function< void(std::vector< TParticle > const &p, int eventCount)> f)
 
void setTriggerFalseHook (std::function< void(std::vector< TParticle > const &p, int eventCount)> f)
 
- Public Member Functions inherited from o2::eventgen::GeneratorFileOrCmd
void setup (const GeneratorFileOrCmdParam &param, const conf::SimConfig &config)
 
void setup (const FileOrCmdGenConfig &param, const conf::SimConfig &config)
 
void setCmd (const std::string &cmd)
 
void setCmdPid (const pid_t cmdPid)
 
void setNEvents (unsigned int nev)
 
void setSeed (unsigned long seed)
 
void setBmax (float bmax)
 
void setFileNames (const std::string &filenames)
 
void setOutputSwitch (const std::string &opt)
 
void setSeedSwitch (const std::string &opt)
 
void setNEventsSwitch (const std::string &opt)
 
void setBmaxSwitch (const std::string &opt)
 
void setBackgroundSwitch (const std::string &opt)
 
void setWait (int miliseconds=500)
 

Protected Member Functions

 ClassDefOverride (GeneratorTParticle, 1)
 
- Protected Member Functions inherited from o2::eventgen::Generator
 Generator (const Generator &)
 
Generatoroperator= (const Generator &)
 
Bool_t addTracks (FairPrimaryGenerator *primGen)
 
Bool_t boostEvent ()
 
void addSubGenerator (int subGeneratorId, std::string const &subGeneratorDescription)
 
void notifySubGenerator (int subGeneratorId)
 
- Protected Member Functions inherited from o2::eventgen::GeneratorFileOrCmd
virtual std::string makeCmdLine () const
 
virtual bool executeCmdLine (const std::string &cmd)
 
virtual bool terminateCmd ()
 
virtual bool makeTemp (const bool &)
 
virtual bool removeTemp () const
 
virtual bool makeFifo () const
 
virtual bool ensureFiles ()
 
virtual void waitForData (const std::string &filename) const
 

Protected Attributes

std::string mTreeName = "T"
 
std::string mBranchName = "Particles"
 
unsigned int mEntry = 0
 
TChain * mChain = 0
 
TClonesArray * mTParticles
 
- Protected Attributes inherited from o2::eventgen::Generator
voidmInterface = nullptr
 
std::string mInterfaceName
 
ETriggerMode_t mTriggerMode = kTriggerOFF
 
std::vector< TriggermTriggers
 
std::vector< DeepTriggermDeepTriggers
 
std::function< void(std::vector< TParticle > const &p, int eventCount)> mTriggerOkHook = [](std::vector<TParticle> const& p, int eventCount) {}
 
std::function< void(std::vector< TParticle > const &p, int eventCount)> mTriggerFalseHook = [](std::vector<TParticle> const& p, int eventCount) {}
 
int mReadEventCounter = 0
 
double mMomentumUnit = 1.
 
double mEnergyUnit = 1.
 
double mPositionUnit = 0.1
 
double mTimeUnit = 3.3356410e-12
 
std::vector< TParticle > mParticles
 
Double_t mBoost
 
int mThisInstanceID = 0
 
- Protected Attributes inherited from o2::eventgen::GeneratorFileOrCmd
std::string mCmd = ""
 
std::list< std::string > mFileNames
 
std::string mTemporary
 
unsigned int mNEvents = 0
 
unsigned long mSeed = 0
 
float mBmax = -1.f
 
std::string mOutputSwitch = ">"
 
std::string mSeedSwitch = "-s"
 
std::string mNEventsSwitch = "-n"
 
std::string mBmaxSwitch = "-b"
 
std::string mBackgroundSwitch = "&"
 
int mWait = 500
 
int mCmdPid = -1
 

Additional Inherited Members

- Public Types inherited from o2::eventgen::Generator
enum  ETriggerMode_t { kTriggerOFF , kTriggerOR , kTriggerAND }
 
- Static Public Member Functions inherited from o2::eventgen::Generator
static void setTotalNEvents (unsigned int &n)
 
static unsigned int getTotalNEvents ()
 
- Static Protected Attributes inherited from o2::eventgen::Generator
static std::atomic< intInstanceCounter {0}
 

Detailed Description

A class that reads in particles of class TParticle from a branch in a TChain.

Optionally, a program that generates such a TTree can be spawn, and the TParticles written to a file from which this object reads them in. This is done with

–configKeyValues "TParticle.progCmd=<eg program and options>"

which will execute the specified EG program with the given options. The EG program must support the command line options

-n NUMBER Number of events to generate -o FILENAME Name of file to write to

The tree name and particle branch names can be configured.

–configKeyValues "TParticle.treeName=T,TParticle.branchName=P"

File(s) to read are also configurable

–configKeyValues "TParticle.fileNames=foo.root,bar.root"

Definition at line 56 of file GeneratorTParticle.h.

Constructor & Destructor Documentation

◆ GeneratorTParticle() [1/2]

o2::eventgen::GeneratorTParticle::GeneratorTParticle ( )

CTOR

Definition at line 28 of file GeneratorTParticle.cxx.

◆ GeneratorTParticle() [2/2]

o2::eventgen::GeneratorTParticle::GeneratorTParticle ( const std::string &  name)
inline

CTOR

Definition at line 62 of file GeneratorTParticle.h.

◆ ~GeneratorTParticle()

o2::eventgen::GeneratorTParticle::~GeneratorTParticle ( )
virtual

DTOR

Definition at line 34 of file GeneratorTParticle.cxx.

Member Function Documentation

◆ ClassDefOverride()

o2::eventgen::GeneratorTParticle::ClassDefOverride ( GeneratorTParticle  ,
 
)
protected

◆ generateEvent()

Bool_t o2::eventgen::GeneratorTParticle::generateEvent ( )
overridevirtual

Read in the next entry from the chain. Returns false in case of errors or no more entries to read.

Implements o2::eventgen::Generator.

Definition at line 100 of file GeneratorTParticle.cxx.

◆ importParticles()

Bool_t o2::eventgen::GeneratorTParticle::importParticles ( )
overridevirtual

Import the read-in particles into the steer particle stack

Implements o2::eventgen::Generator.

Definition at line 125 of file GeneratorTParticle.cxx.

◆ Init()

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

Initialize this generator. This will set up the chain. Optionally, if a command line was specified by TParticle.progCmd then that command line is executed in the background and events are read from the output file of that program

Definition at line 50 of file GeneratorTParticle.cxx.

◆ setBranchName()

void o2::eventgen::GeneratorTParticle::setBranchName ( const std::string &  val)
inline

Set the branch name of the branch that holds a TClonesArray of TParticle objects

Definition at line 95 of file GeneratorTParticle.h.

◆ setTreeName()

void o2::eventgen::GeneratorTParticle::setTreeName ( const std::string &  val)
inline

Set the name of the tree in the files. The tree must reside in the top-level directory of the files.

Definition at line 92 of file GeneratorTParticle.h.

◆ setup()

void o2::eventgen::GeneratorTParticle::setup ( const GeneratorFileOrCmdParam param0,
const GeneratorTParticleParam param,
const conf::SimConfig config 
)

Configure the generator from parameters and the general simulation configuration. This is implemented as a member function so as to better facilitate changes.

Definition at line 90 of file GeneratorTParticle.cxx.

Member Data Documentation

◆ mBranchName

std::string o2::eventgen::GeneratorTParticle::mBranchName = "Particles"
protected

Name of branch containing a TClonesArray of TParticle

Definition at line 101 of file GeneratorTParticle.h.

◆ mChain

TChain* o2::eventgen::GeneratorTParticle::mChain = 0
protected

Chain of files

Definition at line 105 of file GeneratorTParticle.h.

◆ mEntry

unsigned int o2::eventgen::GeneratorTParticle::mEntry = 0
protected

Current entry

Definition at line 103 of file GeneratorTParticle.h.

◆ mTParticles

TClonesArray* o2::eventgen::GeneratorTParticle::mTParticles
protected

Array to read particles into

Definition at line 107 of file GeneratorTParticle.h.

◆ mTreeName

std::string o2::eventgen::GeneratorTParticle::mTreeName = "T"
protected

Name of the tree to read

Definition at line 99 of file GeneratorTParticle.h.


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