StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
StarPrimaryMaker Class Reference

Main steering class for event generation. More...

#include <StarPrimaryMaker.h>

Inheritance diagram for StarPrimaryMaker:
StMaker TDataSet StarEmbedMaker

Public Member Functions

 StarPrimaryMaker ()
Int_t InitRun (Int_t runnumber)
Int_t Init ()
Int_t Make ()
void Clear (const Option_t *opts="")
Int_t Finish ()
void SetFileName (const Char_t *name)
 Set the filename of the output TTree.
void AddGenerator (StarGenerator *gener)
void AddFilter (StarFilterMaker *filt)
void SetVertex (Double_t x, Double_t y, Double_t z)
 Set the x, y and z vertex position.
void SetSigma (Double_t sx, Double_t sy, Double_t sz, Double_t rho=0)
void SetSlope (Double_t dxdz, Double_t dydz)
void SetBeamline (Int_t beamline=1)
void SetCuts (Double_t ptmin, Double_t ptmax=-1, Double_t ymin=0, Double_t ymax=-1, Double_t phimin=0, Double_t phimax=-1, Double_t zmin=-999, Double_t zmax=+999)
 Set particle cuts.
void SetPtRange (Double_t ptmin, Double_t ptmax=-1)
 Set PT range. Particles falling outside this range will be dropped from simulation.
void SetEtaRange (Double_t etamin, Double_t etamax)
 Set rapidity range. Particles falling outside this range will be dropped from simulation.
void SetPhiRange (Double_t phimin, Double_t phimax)
 Set phi range. Particles falling outside this range will be dropped from simulation.
void SetZvertexRange (Double_t zmin, Double_t zmax)
 Set z-vertex range. Primary vertices outside these bounds will be rejected.
StarGenEventevent ()
 Return a pointer to the event.
virtual const char * GetCVS () const
- Public Member Functions inherited from StMaker
 StMaker (const char *name="", const char *dummy=0)
 Constructor & Destructor.
virtual Int_t IsChain () const
virtual void Clear (Option_t *option="")
 User defined functions.
virtual void StartMaker ()
virtual Int_t IMake (Int_t number)
virtual void EndMaker (Int_t ierr)
virtual Int_t FinishRun (Int_t oldrunumber)
virtual void FatalErr (Int_t Ierr, const char *Com)
virtual void PrintInfo ()
virtual void NotifyMe (const char *, const void *)
virtual void AddMaker (StMaker *mk)
virtual void MakeDoc (const TString &, const TString &, Bool_t)
virtual void AddData (TDataSet *data, const char *dir=".data")
 User methods.
virtual TDataSetAddObj (TObject *obj, const char *dir, int owner=1)
virtual TDataSetToWhiteBoard (const char *name, void *dat)
virtual TDataSetToWhiteBoard (const char *name, void *dat, void *del)
virtual TDataSetToWhiteBoard (const char *name, TObject *dat, Int_t owner)
virtual TDataSetToWhiteConst (const char *name, TObject *dat)
virtual TDataSetToWhiteConst (const char *name, void *dat)
virtual TDataSetWhiteBoard (const char *name, void *v=0) const
virtual Int_t Skip (Int_t nskip)
virtual void AddConst (TDataSet *data=0)
virtual void AddHist (TH1 *h, const char *dir=0)
virtual void AddGarb (TDataSet *data=0)
virtual void AddRunco (TDataSet *data=0)
virtual void AddRunco (Double_t par, const char *name, const char *comment)
void AddRunCont (TDataSet *data=0)
virtual TList * GetHistList () const
virtual TH1 * GetHist (const char *histName) const
virtual StMakercd ()
virtual StMakerCd ()
virtual Int_t GetNumber () const
 STAR methods.
virtual void SetNumber (Int_t number)
virtual StMakerGetParentChain () const
virtual Int_t GetIventNumber () const
 Returns the current event number.
virtual void SetIventNumber (Int_t iv)
virtual Int_t GetEventNumber () const
virtual Int_t GetRunNumber () const
 Returns the current RunNumber.
virtual const TDatime & GetDateTime () const
virtual const TDatime & GetDBTime () const
virtual void SetDateTime (Int_t idat, Int_t itim)
virtual StEvtHddrGetEvtHddr () const
virtual Int_t GetDate () const
virtual Int_t GetTime () const
virtual const char * GetEventType () const
virtual TDataSetGetData (const char *name, const char *dir=".data") const
virtual TDataSetGetData () const
virtual TDataSetGetConst () const
virtual TDataSetGetDataSet (const char *logInput) const
virtual TDataSetDataSet (const char *logInput) const
virtual TDataSetGetInputDS (const char *logInput) const
virtual TDataSetGetDataBase (const char *logInput, const TDatime *td=0)
virtual TDataSetGetInputDB (const char *logInput)
virtual Int_t GetDebug () const
virtual Int_t Debug () const
virtual Int_t GetMakeReturn () const
virtual TList * Histograms () const
virtual TString GetAlias (const char *log, const char *dir=".aliases") const
virtual TString GetInput (const char *log) const
virtual TString GetOutput (const char *log) const
virtual TList * GetMakeList () const
virtual StMakerGetParentMaker () const
virtual StMakerGetMaker (const char *mkname)
virtual StMakerGetMakerInheritsFrom (const char *mktype) const
virtual Bool_t IsActive ()
virtual StMakerMaker (const char *mkname)
virtual void SetBIT (EMakerStatus k)
 Maker Status Bits.
virtual void ResetBIT (EMakerStatus k)
virtual Bool_t TestBIT (EMakerStatus k)
virtual void SetActive (Bool_t k=kTRUE)
 Setters for flags and switches.
virtual void SetDebug (Int_t l=1)
virtual void SetDEBUG (Int_t l=1)
virtual void SetFlavor (const char *flav, const char *tabname)
virtual void SetMakeReturn (Int_t ret)
virtual void SetAlias (const char *log, const char *act, const char *dir=".aliases")
virtual void AddAlias (const char *log, const char *act, const char *dir=".aliases")
virtual void SetInput (const char *log, const char *act)
virtual void SetOutput (const char *log, const char *act)
virtual void SetOutput (const char *log, TDataSet *ds)
virtual void SetOutput (TDataSet *ds)
virtual void SetOutputAll (TDataSet *ds, Int_t level=1)
virtual void SetMode (Int_t mode=0)
virtual void SetNotify (const char *about, StMaker *mk)
virtual Int_t GetMode ()
virtual Int_t GetDebug ()
virtual const StChainOptGetChainOpt () const
virtual TFile * GetTFile () const
virtual void NotifyEm (const char *about, const void *ptr)
virtual Double_t RealTime ()
virtual Double_t CpuTime ()
virtual void StartTimer (Bool_t reset=kFALSE)
virtual void StopTimer ()
virtual void PrintTimer (Option_t *option="")
virtual void PrintTotalTime ()
virtual const char * GetName () const
 special overload
TObject * GetDirObj (const char *dir) const
void SetDirObj (TObject *obj, const char *dir)
Int_t SetAttr (const char *key, const char *val, const char *to=".")
Int_t SetAttr (const char *key, Int_t val, const char *to=".")
Int_t SetAttr (const char *key, UInt_t val, const char *to=".")
Int_t SetAttr (const char *key, Double_t val, const char *to=".")
Int_t SetAttr (const StMaker *mk)
Int_t RemAttr (const char *key, const char *to=".")
const TAttrGetAttr () const
Int_t IAttr (const char *key) const
UInt_t UAttr (const char *key) const
Double_t DAttr (const char *key) const
const char * SAttr (const char *key) const
void PrintAttr () const
- Public Member Functions inherited from TDataSet
 TDataSet (const char *name="", TDataSet *parent=0, Bool_t arrayFlag=kFALSE)
 TDataSet (const TDataSet &src, EDataSetPass iopt=kAll)
 TDataSet (TNode &src)
 This copy ctor has been depricated (left for thwe sake of the backweard compatibility)
virtual ~TDataSet ()
 std::cout << "Default destructor for " << GetName() << " - " << GetTitle() << std::endl;
virtual void Add (TDataSet *dataset)
virtual void AddAt (TDataSet *dataset, Int_t idx=0)
virtual void AddAtAndExpand (TDataSet *dataset, Int_t idx=0)
virtual void AddFirst (TDataSet *dataset)
 Add TDataSet object at the beginning of the dataset list of this dataset.
virtual void AddLast (TDataSet *dataset)
 Add TDataSet object at the end of the dataset list of this dataset.
TDataSetAt (Int_t idx) const
virtual void Browse (TBrowser *b)
 Browse this dataset (called by TBrowser).
virtual TObject * Clone (const char *newname="") const
 the custom implementation fo the TObject::Clone
virtual void Delete (Option_t *opt="")
virtual TDataSetFind (const char *path) const
virtual TDataSetFindByName (const char *name, const char *path="", Option_t *opt="") const
virtual TDataSetFindByPath (const char *path) const
 Aliase for TDataSet::Find(const Char_t *path) method.
virtual TDataSetFindByTitle (const char *title, const char *path="", Option_t *opt="") const
TObject * FindObject (const char *name) const
TObject * FindObject (const TObject *o) const
virtual TDataSetFirst () const
 Return the first object in the list. Returns 0 when list is empty.
TObjArray * GetObjArray () const
virtual TSeqCollection * GetCollection () const
TList * GetList () const
virtual Int_t GetListSize () const
TObject * GetMother () const
virtual TObject * GetObject () const
 The depricated method (left here for the sake of the backward compatibility)
virtual TDataSetGetParent () const
virtual Long_t HasData () const
virtual TDataSetInstance () const
virtual TString Path () const
 return the full path of this data set
virtual EDataSetPass Pass (EDataSetPass(*callback)(TDataSet *), Int_t depth=0)
virtual EDataSetPass Pass (EDataSetPass(*callback)(TDataSet *, void *), void *user, Int_t depth=0)
virtual void PrintContents (Option_t *opt="") const
virtual Int_t Purge (Option_t *opt="")
virtual void Remove (TDataSet *set)
 Remiove the "set" from this TDataSet.
virtual TDataSetRemoveAt (Int_t idx)
virtual void SetMother (TDataSet *parent=0)
virtual void SetObject (TObject *obj)
 The depricated method (left here for the sake of the backward compatibility)
virtual void SetParent (TDataSet *parent=0)
virtual void SetWrite ()
virtual void Shunt (TDataSet *newParent=0)
virtual void Sort ()
 Sort recursively all members of the TDataSet with TList::Sort method.
virtual Bool_t IsEmpty () const
 return kTRUE if the "internal" collection has no member
virtual Bool_t IsFolder () const
virtual Bool_t IsMarked () const
virtual Bool_t IsThisDir (const char *dirname, int len=-1, int ignorecase=0) const
virtual TDataSetLast () const
 Return the last object in the list. Returns 0 when list is empty.
virtual void ls (Option_t *option="") const
virtual void ls (Int_t depth) const
void Mark ()
void UnMark ()
void MarkAll ()
 Mark all members of this dataset.
void UnMarkAll ()
 UnMark all members of this dataset.
void InvertAllMarks ()
 Invert mark bit for all members of this dataset.
void Mark (UInt_t flag, EBitOpt reset=kSet)
virtual TDataSetNext () const
virtual TDataSetPrev () const
virtual void Update ()
virtual void Update (TDataSet *set, UInt_t opt=0)
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0)
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const

Static Public Member Functions

static TParticlePDG * pdg (Int_t pdgid)
- Static Public Member Functions inherited from StMaker
static StMakerNew (const char *classname, const char *name="", void *title=0)
static StMakerGetTopChain ()
static StMakerGetChain ()
static StMakerGetFailedMaker ()
static StMakerGetMaker (const TDataSet *ds)
 Static functions.
static EDataSetPass ClearDS (TDataSet *ds, void *user)
static const char * RetCodeAsString (Int_t kode)
static Int_t AliasDate (const char *alias)
static Int_t AliasTime (const char *alias)
static const char * AliasGeometry (const char *alias)
static const DbAlias_tGetDbAliases ()
static void SetTestMaker (StTestMaker *mk)
static Int_t Cleanup (TDataSet *&ds)
static void lsMakers (const StMaker *top)
- Static Public Member Functions inherited from TDataSet
static TDataSetGetMainSet ()
 return pointer to the main dataset
static TDataSetinstance ()

Protected Member Functions

Int_t PreGenerate ()
Int_t Generate ()
Int_t PostGenerate ()
Int_t Finalize ()
void BuildTables ()
void RotateBeamline (Double_t &px, Double_t &py, Double_t &pz, Double_t &E, Double_t &M, Double_t &vx, Double_t &vy, Double_t &vz, Double_t &vt)
Bool_t Simulate (StarGenParticle *p)
 Tests to see whether the particle passes all appropriate cuts to be passed to the simulator.
std::function< TLorentzVector() > GetVertexFunction (const char *name)
TLorentzVector vertexGaussXYZ ()
TLorentzVector vertexFlatZ ()
TLorentzVector vertexFlatXYZ ()
TLorentzVector vertexFlatRZ ()
TLorentzVector vertexFlatABZ ()
 ClassDef (StarPrimaryMaker, 1)
- Protected Member Functions inherited from StMaker
StMessMgrGetLogger () const
virtual TDataSetFindDataSet (const char *logInput, const StMaker *uppMk=0, const StMaker *dowMk=0) const
- Protected Member Functions inherited from TDataSet
virtual void SetMother (TObject *mother)
 TDataSet (const char *name, const char *title)
void AddMain (TDataSet *set)
 add data set to main data set
TDataSetGetRealParent ()
 return real parent
void MakeCollection ()
 Create the internal container at once if any.

Protected Attributes

Int_t mNumParticles
 Total number of particles.
TTree * mTree
 The output tree.
TFile * mFile
TString mTreeName
TString mFileName
Double_t mVx
Double_t mVy
Double_t mVz
Double_t mSx
Double_t mSy
Double_t mSz
Double_t mRho
Double_t mVdxdz
Double_t mVdydz
Bool_t mDoBeamline
Double_t mPtMin
Double_t mPtMax
Double_t mRapidityMin
Double_t mRapidityMax
Double_t mPhiMin
Double_t mPhiMax
Double_t mZMin
Double_t mZMax
Int_t mRunNumber
TLorentzVector mPrimaryVertex
TEventList * mAccepted
std::function< TLorentzVector() > mVertexFunction
std::map< std::string,
std::function< TLorentzVector() > > 
- Protected Attributes inherited from StMaker
 list of logInput:ActualInput
 list of logOuput:ActualOuput
TList * m_Histograms
 Run Control parameters.
Int_t fTallyMaker [kStFatal+1]
Int_t m_Mode
Int_t m_Number
 Integer mode of maker.
Int_t m_LastRun
 Serial event number.
Int_t m_DebugLevel
 Last Run number.
Int_t m_MakeReturn
 Debug level.
TStopwatch m_Timer
 Make() return flag.
 Timer object.
 StMemStat for Make.
Int_t fStatus
 StMemStat for Clear.
 Maker status.
- Protected Attributes inherited from TDataSet
TSeqCollection * fList

Additional Inherited Members

- Public Types inherited from StMaker
enum  EDebugLevel { kNormal, kDebug }
enum  EMakerStatus {
  kInitBeg = 1, kInitEnd = 2, kMakeBeg = 3, kCleaBeg = 4,
  kFiniBeg = 5, kFiniEnd = 6, kActive = 7
- Public Types inherited from TDataSet
enum  EDataSetPass {
  kContinue, kPrune, kStop, kUp,
  kStruct, kAll, kRefs, kMarked
enum  ESetBits { kMark = BIT(22), kArray = BIT(20) }
enum  EBitOpt { kSet = kTRUE, kReset = kFALSE }
- Public Attributes inherited from StMaker
enum StMaker:: { ... }  EModule_return_Status
- Static Protected Member Functions inherited from TDataSet
static EDataSetPass SortIt (TDataSet *ds)
static EDataSetPass SortIt (TDataSet *ds, void *user)
- Static Protected Attributes inherited from StMaker
static StMakerfgTopChain = 0
 list of Histograms
static StMakerfgStChain = 0
 pointer to top StChain
static StMakerfgFailedMaker = 0
 current pointer to StChain
static StTestMakerfgTestMaker = 0
 current pointer to failed maker
static Int_t fgTallyMaker [kStFatal+1] = {0,0,0,0,0}
- Static Protected Attributes inherited from TDataSet
static TDataSetfgMainSet = &mainSet

Detailed Description

Main steering class for event generation.

Jason C. Webb StarPrimaryMaker is the main steering maker for event generators in the (new) STAR event generator framework. Users add one or more event generators (derived from StarGenerator) to the maker. The primary maker is responsible for calling the event generators in a well-defined calling sequence:

1) PreGenerate Phase

During the PreGenerate phase, the PreGenerate() method will be called on all generators in the order in which they were added to the primary maker. This (optional) method on event generators is provided for the developer to perform any event-by-event configuration which may be required by the event generator.

2) Generate Phase

During the Generate phase, the event generation machinery of the concrete event generator is called. Generate will be called on all event generators, in the order in which they were added to the primary maker. Generate will be called on all generatos before the PostGenerate phase is entered. At the end of Generate, it is expected that event generators have filled their event records.

3) PostGenerate Phase

After Generate has been called on all generators, PostGenerate will be called on each generator in the order in which they were added to the primary maker. Developers may at this point access the results from event generators which were found earlier in the chain. This is the last point at which a developer may interact with the event record.

After PostGenerate, the event is finalized. The primary maker will loop over all event generators in its list, set the vertex, and accumulate the particles from each generator at an appropriate vertex. Two modes are available on generators: standard and pileup mode. Standard mode (which is the default) places all events at the same vertex. Pileup mode places pileup events, with some probability, at an independent vertex.

Event Record

The event record, which records the particle-wise and event-wise inforamtion from each event generator, is saved in a TTree format. The results from each generator are saved in a separate branch, whose name corresponds to the assigned name of the generator.

Particle-wise information is stored as an array of StarGenParticle s. The main event record lists all particles which were generated, with inices refering to their position in their parent event generator, their position in the event record of the main event generator, and their position on the GEANT stack (aka ID truth).

Event Vertex

The event-vertex is generated by StarPrimaryMaker. It is sampled from a gaussian distributions in x, y and z. The possibility exists to correlate the x and y distributions. See SetSigma() for details.

Beamline Constraint

The beamline as measured at STAR may be simulated. For the case where an SDT timestamp is specified, the user may set the attribute "beamline" to true

primary->SetAttr("beamline", 1)

This will instruct the StarPrimaryMaker to lookup the beamline constraint as recorded in the online database for the requested SDT timestamp. Otherwise, the beamline may be specified by hand by calling

primary->SetSlope( dxdz, dydz );

When setting the beamline by hand, you should not use SetAttr("beamline",1). That will cause the maker to attempt to load slopes from the database, resulting in no slope.

Definition at line 103 of file StarPrimaryMaker.h.

Constructor & Destructor Documentation

StarPrimaryMaker::StarPrimaryMaker ( )

name = "gaussXYZ" is the default. name = "flatZ" throws points uniform on a line from Vz - Sz to Vz + Sz name = "flatXYZ" thows within a rectangular box Vx+/-Sx, Vy+/-Sy, Vz+/-Sz name = "flatRZ" throws within a cylinder of radius Sx centered on Vx,Vy, from z=Vz-Sz to Vz+Sz name = "flatABZ" throws within an eliptical cyilnder of major axis A minor axis B, rotated by Rho

Definition at line 41 of file StarPrimaryMaker.cxx.

References StMaker::AddData(), and StarParticleData::instance().

Member Function Documentation

void StarPrimaryMaker::AddFilter ( StarFilterMaker filt)

Attach a filter to the primary generator

filtIs a pointer to the filter maker

Definition at line 370 of file StarPrimaryMaker.cxx.

References StMaker::AddData(), and TDataSet::Shunt().

void StarPrimaryMaker::AddGenerator ( StarGenerator gener)

Add an event generator to the list of event generators.

generIs a pointer to the user's event generator

Definition at line 363 of file StarPrimaryMaker.cxx.

Int_t StarPrimaryMaker::Finish ( )

Terminate a run. Place to make operations on histograms, normalization,etc.

add random number state to user info

Reimplemented from StMaker.

Definition at line 196 of file StarPrimaryMaker.cxx.

References StarFilterMaker::Finish(), StMaker::Finish(), StMaker::GetName(), StarParticleData::GetParticles(), StarParticleData::instance(), kStOK, mTree, TDataSet::Next(), StarGenerator::Stats(), and TDataSet::Write().

Int_t StarPrimaryMaker::Make ( )

The Make() method is the one responsible for calling the maker's InitRun(). Note that that InitRun() is called for real data and if both of the following are true

  • a header exists
  • the run number changes

This is the ONLY place calling the InitRun() routine.

Iterate over all generators and execute PreGenerate()

Iterate over all generators and execute Generate()

Iterate over all generators and execute PostGenerate()

Register g2t tables

Finalize the event

Apply the event filter (if available)

Print the event for debugging purposes

If the filter resulted in an accept decision, fill the tree and return kStOK

If the filter resulted in a reject decision, fill the tree and try try again. Clear the particle information if the KeepAll flag has not been set.

check privilege to skip event

Reimplemented from StMaker.

Reimplemented in StarEmbedMaker.

Definition at line 255 of file StarPrimaryMaker.cxx.

References StarGenEvent::Clear(), event(), kStOK, kStSKIP, StarFilterMaker::Make(), mTree, and StarGenEvent::Print().

Referenced by StarEmbedMaker::Make().

TParticlePDG * StarPrimaryMaker::pdg ( Int_t  pdgid)

Returns a pointer to a particle class containing PDG information about the particle

Definition at line 104 of file StarPrimaryMaker.cxx.

References StarParticleData::GetParticle(), and StarParticleData::instance().

void StarPrimaryMaker::RotateBeamline ( Double_t &  px,
Double_t &  py,
Double_t &  pz,
Double_t &  E,
Double_t &  M,
Double_t &  vx,
Double_t &  vy,
Double_t &  vz,
Double_t &  vt 

Boosts (rotates) particle from the event generator frame onto the beamline. x-component of the momentum y-component of the momentum z-component of the momentum E-component of the momentum Mass [GeV] x-component of the production vertex y-component of the production vertex z-component of the production vertex t-component of the production vertex

Definition at line 697 of file StarPrimaryMaker.cxx.

void StarPrimaryMaker::SetBeamline ( Int_t  beamline = 1)

Use the beamline constraint as recorded in the database for the current timestamp. Values set by the SetVertex and SetSlope will be overwritten by the database. User must still provide a width using SetSigma. This should only be used when a valid SDT timestamp has been set in the BFC options.

beamline>0 to use the beamline constraint. =0 to switch it off.

Definition at line 150 of file StarPrimaryMaker.h.

void StarPrimaryMaker::SetSigma ( Double_t  sx,
Double_t  sy,
Double_t  sz,
Double_t  rho = 0 

Set the smearing in the x, y and z vertex positions.

sxis the smearing in x
syis the smearing in y
szis the smearing in z
rhois the correlation between x and y

Definition at line 138 of file StarPrimaryMaker.h.

Referenced by StarEmbedMaker::Make().

void StarPrimaryMaker::SetSlope ( Double_t  dxdz,
Double_t  dydz 

Set the slope of the vertex

dxdzis the increase in x with increasing z
dydzis the increase in y with increasing z

Definition at line 143 of file StarPrimaryMaker.h.

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