CbmRoot
CbmUnigenGenerator Class Reference

Generates input to transport simulation from files in Unigen format. More...

#include <CbmUnigenGenerator.h>

Inheritance diagram for CbmUnigenGenerator:
[legend]
Collaboration diagram for CbmUnigenGenerator:
[legend]

Public Types

enum  EMode { kStandard, kNoRotation, kRotateFixed, kReuseEvents }
 Mode enumerator. More...
 

Public Member Functions

 CbmUnigenGenerator (const char *fileName="", EMode mode=kStandard)
 Default constructor. More...
 
 CbmUnigenGenerator (const char *fileName, EMode mode, Double_t phi)
 Constructor with fixed rotation angle. More...
 
virtual ~CbmUnigenGenerator ()
 Destructor. More...
 
virtual Bool_t ReadEvent (FairPrimaryGenerator *primGen)
 Read one event from the input file. More...
 

Private Member Functions

void AddPrimary (FairPrimaryGenerator *primGen, Int_t pdgCode, const TVector3 &momentum)
 Add a primary particle to the event generator. More...
 
void CloseInput ()
 Close the input file. More...
 
Int_t GetIonCharge (Int_t pdgCode) const
 Charge number of an ion. More...
 
Int_t GetIonLambdas (Int_t pdgCode) const
 Number of Lambdas in an ion. More...
 
Int_t GetIonMass (Int_t pdgCode) const
 Mass number of an ion. More...
 
Bool_t GetNextEntry ()
 Get next entry from input tree. More...
 
Bool_t Init ()
 Initialisation. More...
 
void ProcessIon (FairPrimaryGenerator *primGen, Int_t pdgCode, const TVector3 &momentum)
 Treat a composite particle (ion) More...
 
Int_t RegisterIons ()
 Register ions to the simulation. More...
 
 CbmUnigenGenerator (const CbmUnigenGenerator &)=delete
 Copy constructor forbidden. More...
 
CbmUnigenGeneratoroperator= (const CbmUnigenGenerator &)=delete
 Assignment operator forbidden. More...
 
 ClassDef (CbmUnigenGenerator, 4)
 

Private Attributes

TString fFileName
 Input file name. More...
 
EMode fMode
 Rotation mode. More...
 
Double_t fPhi
 Event plane rotation angle. More...
 
Bool_t fIsInit
 Flag whether generator is initialised. More...
 
TFile * fFile
 Input ROOT file. More...
 
TTree * fTree
 Input ROOT tree. More...
 
Int_t fCurrentEntry
 Current entry number. More...
 
UEventfEvent
 Current input event. More...
 
Int_t fNofPrimaries
 Number of primaries registered in current event. More...
 
Int_t fNofEvents
 Number of processed events. More...
 
Double_t fBetaCM
 CM velocity in the lab frame. More...
 
Double_t fGammaCM
 Gamma factor of CM in lab frame. More...
 
std::map< TString, FairIon * > fIonMap
 Map from ion name to FairIon. More...
 

Static Private Attributes

static const Int_t kPdgLambda = 10000000
 Decomposition of ion PDG code. More...
 
static const Int_t kPdgCharge = 10000
 Decomposition of ion PDG code. More...
 
static const Int_t kPdgMass = 10
 Decomposition of ion PDG code. More...
 

Detailed Description

Generates input to transport simulation from files in Unigen format.

Author
D. Kresan d.kre.nosp@m.san@.nosp@m.gsi.d.nosp@m.e
Since
4 July 2006
Date
4 September 2019 (revision by V. Friese v.fri.nosp@m.ese@.nosp@m.gsi.d.nosp@m.e)

This class reads ROOT files containing Unigen data (UEvent, UParticle) and inputs them to the transport simulation.

A Lorentz transformation to the lab (target) system is applied. Depending on the chosen mode, the event plane angle is rotated by a fixed value (kRotateFixed) or by a random value (kReuseEvents). In the mode kRotateToZero, the event plane will be rotated by the negative angle found in UEvent, such that the resulting event plane angle is zero (impact parameter in x direction).

In the mode kReuseEvents, the input events are be used multiple times if more events are requested than present in the input tree. This implies random event plane rotation.

Definition at line 44 of file CbmUnigenGenerator.h.

Member Enumeration Documentation

◆ EMode

Mode enumerator.

Enumerator
kStandard 

Rotate events to zero event plane (default)

kNoRotation 

No event rotation.

kRotateFixed 

Rotate events around z by a fixed angle.

kReuseEvents 

Reuse events if more are requested than present.

Definition at line 48 of file CbmUnigenGenerator.h.

Constructor & Destructor Documentation

◆ CbmUnigenGenerator() [1/3]

CbmUnigenGenerator::CbmUnigenGenerator ( const char *  fileName = "",
EMode  mode = kStandard 
)

Default constructor.

Parameters
fileNameName of input file in UniGen format
modeExecution mode (see EMode)

This constructor cannot be used for mode kRotateFixed.

Definition at line 27 of file CbmUnigenGenerator.cxx.

References Init(), and kRotateFixed.

◆ CbmUnigenGenerator() [2/3]

CbmUnigenGenerator::CbmUnigenGenerator ( const char *  fileName,
EMode  mode,
Double_t  phi 
)

Constructor with fixed rotation angle.

Parameters
fileNameName of input file in UniGen format
modeExecution mode (see EMode)
phiEvent plane rotation angle (only for mode fRotateFixed)

Definition at line 54 of file CbmUnigenGenerator.cxx.

References Init().

◆ ~CbmUnigenGenerator()

CbmUnigenGenerator::~CbmUnigenGenerator ( )
virtual

Destructor.

Definition at line 80 of file CbmUnigenGenerator.cxx.

References CloseInput(), and fEvent.

◆ CbmUnigenGenerator() [3/3]

CbmUnigenGenerator::CbmUnigenGenerator ( const CbmUnigenGenerator )
privatedelete

Copy constructor forbidden.

Member Function Documentation

◆ AddPrimary()

void CbmUnigenGenerator::AddPrimary ( FairPrimaryGenerator *  primGen,
Int_t  pdgCode,
const TVector3 &  momentum 
)
private

Add a primary particle to the event generator.

Parameters
primGenFairPrimaryGenerator instance
pdgCodeParticle ID (PDG code)
momentumMomentum vector [GeV]

Definition at line 89 of file CbmUnigenGenerator.cxx.

References fNofPrimaries.

Referenced by ProcessIon(), and ReadEvent().

◆ ClassDef()

CbmUnigenGenerator::ClassDef ( CbmUnigenGenerator  ,
 
)
private

◆ CloseInput()

void CbmUnigenGenerator::CloseInput ( )
private

Close the input file.

Definition at line 100 of file CbmUnigenGenerator.cxx.

References fFile, and fFileName.

Referenced by ~CbmUnigenGenerator().

◆ GetIonCharge()

Int_t CbmUnigenGenerator::GetIonCharge ( Int_t  pdgCode) const
inlineprivate

Charge number of an ion.

Parameters
pdgCodeParticle ID (PDG code)
Returns
Charge number (numbers of protons)

For ions the PDG code is +-10LZZZAAAI, with ZZZ the number of protons

Definition at line 134 of file CbmUnigenGenerator.h.

References kPdgCharge, and kPdgLambda.

Referenced by ProcessIon(), and RegisterIons().

◆ GetIonLambdas()

Int_t CbmUnigenGenerator::GetIonLambdas ( Int_t  pdgCode) const
inlineprivate

Number of Lambdas in an ion.

Parameters
pdgCodeParticle ID (PDG code)
Returns
Number of Lambdas

For ions the PDG code is +-10LZZZAAAI, with L the number of Lambdas

Definition at line 145 of file CbmUnigenGenerator.h.

References kPdgLambda.

Referenced by ProcessIon(), and RegisterIons().

◆ GetIonMass()

Int_t CbmUnigenGenerator::GetIonMass ( Int_t  pdgCode) const
inlineprivate

Mass number of an ion.

Parameters
pdgCodeParticle ID (PDG code)
Returns
Mass number (sum of numbers of protons, neutrons and Lambdas)

For ions the PDG code is +-10LZZZAAAI, with AAA the mass number

Definition at line 156 of file CbmUnigenGenerator.h.

References kPdgCharge, and kPdgMass.

Referenced by ProcessIon(), and RegisterIons().

◆ GetNextEntry()

Bool_t CbmUnigenGenerator::GetNextEntry ( )
private

Get next entry from input tree.

Returns
true if valid entry is available; else false

Definition at line 110 of file CbmUnigenGenerator.cxx.

References fCurrentEntry, fMode, fTree, and kReuseEvents.

Referenced by ReadEvent().

◆ Init()

Bool_t CbmUnigenGenerator::Init ( )
private

Initialisation.

Returns
kTRUE is initialised successfully

The input file is opened, run information is retrieved, and the input branch is connected.

Definition at line 138 of file CbmUnigenGenerator.cxx.

References fBetaCM, fEvent, fFile, fFileName, fGammaCM, fIsInit, fMode, fPhi, fTree, URun::GetNNSqrtS(), URun::GetPProj(), URun::GetPTarg(), kNoRotation, kReuseEvents, kRotateFixed, kStandard, URun::Print(), and RegisterIons().

Referenced by CbmUnigenGenerator().

◆ operator=()

CbmUnigenGenerator& CbmUnigenGenerator::operator= ( const CbmUnigenGenerator )
privatedelete

Assignment operator forbidden.

◆ ProcessIon()

void CbmUnigenGenerator::ProcessIon ( FairPrimaryGenerator *  primGen,
Int_t  pdgCode,
const TVector3 &  momentum 
)
private

Treat a composite particle (ion)

Parameters
primGenFairPrimaryGenerator instance
pdgCodeParticle ID (PDG code)
momentumMomentum vector [GeV]

Composite particle need special treatment because hyper-nuclei ** are not supported by FairRoot, and neutral ions are not supported by GEANT4. Hyper-nuclei are thus replaced by their non-strange analogue, and neutral ions are decomposed into neutrons.

Definition at line 216 of file CbmUnigenGenerator.cxx.

References AddPrimary(), GetIonCharge(), GetIonLambdas(), GetIonMass(), and kPdgLambda.

Referenced by ReadEvent().

◆ ReadEvent()

Bool_t CbmUnigenGenerator::ReadEvent ( FairPrimaryGenerator *  primGen)
virtual

Read one event from the input file.

Parameters
primGenPointer to FairPrimaryGenerator instance
Returns
kTRUE if successful; else kFALSE

Framework interface to define one input event for the transport simulation. Is called from the FairPrimaryGenerator instance. It adds all particles in the input event to the stack using FairPrimaryGenerator::AddTrack after having applied the Lorentz transformation and (if required) event plane rotation.

Definition at line 249 of file CbmUnigenGenerator.cxx.

References AddPrimary(), UParticle::E(), fBetaCM, fEvent, fGammaCM, fIsInit, fMode, fNofEvents, fNofPrimaries, fPhi, UEvent::GetB(), UEvent::GetEventNr(), GetNextEntry(), UEvent::GetNpa(), UEvent::GetParticle(), UParticle::GetPdg(), UEvent::GetPhi(), kNoRotation, kReuseEvents, kRotateFixed, kStandard, xMath::Pi(), ProcessIon(), UParticle::Px(), UParticle::Py(), and UParticle::Pz().

◆ RegisterIons()

Int_t CbmUnigenGenerator::RegisterIons ( )
private

Register ions to the simulation.

Returns
Number of registered ions

The input may contain ions, which are not known to the simulation engine. They are added using the method FairRunSim::AddIon. This has to be done at initialisation. The method scans the entire input for ions and registers them before the start of the transport run.

Definition at line 319 of file CbmUnigenGenerator.cxx.

References fEvent, fIonMap, fTree, GetIonCharge(), GetIonLambdas(), GetIonMass(), UEvent::GetNpa(), UEvent::GetParticle(), and UParticle::GetPdg().

Referenced by Init().

Member Data Documentation

◆ fBetaCM

Double_t CbmUnigenGenerator::fBetaCM
private

CM velocity in the lab frame.

Definition at line 101 of file CbmUnigenGenerator.h.

Referenced by Init(), and ReadEvent().

◆ fCurrentEntry

Int_t CbmUnigenGenerator::fCurrentEntry
private

Current entry number.

Definition at line 97 of file CbmUnigenGenerator.h.

Referenced by GetNextEntry().

◆ fEvent

UEvent* CbmUnigenGenerator::fEvent
private

Current input event.

Definition at line 98 of file CbmUnigenGenerator.h.

Referenced by Init(), ReadEvent(), RegisterIons(), and ~CbmUnigenGenerator().

◆ fFile

TFile* CbmUnigenGenerator::fFile
private

Input ROOT file.

Definition at line 95 of file CbmUnigenGenerator.h.

Referenced by CloseInput(), and Init().

◆ fFileName

TString CbmUnigenGenerator::fFileName
private

Input file name.

Definition at line 91 of file CbmUnigenGenerator.h.

Referenced by CloseInput(), and Init().

◆ fGammaCM

Double_t CbmUnigenGenerator::fGammaCM
private

Gamma factor of CM in lab frame.

Definition at line 102 of file CbmUnigenGenerator.h.

Referenced by Init(), and ReadEvent().

◆ fIonMap

std::map<TString, FairIon*> CbmUnigenGenerator::fIonMap
private

Map from ion name to FairIon.

Definition at line 103 of file CbmUnigenGenerator.h.

Referenced by RegisterIons().

◆ fIsInit

Bool_t CbmUnigenGenerator::fIsInit
private

Flag whether generator is initialised.

Definition at line 94 of file CbmUnigenGenerator.h.

Referenced by Init(), and ReadEvent().

◆ fMode

EMode CbmUnigenGenerator::fMode
private

Rotation mode.

Definition at line 92 of file CbmUnigenGenerator.h.

Referenced by GetNextEntry(), Init(), and ReadEvent().

◆ fNofEvents

Int_t CbmUnigenGenerator::fNofEvents
private

Number of processed events.

Definition at line 100 of file CbmUnigenGenerator.h.

Referenced by ReadEvent().

◆ fNofPrimaries

Int_t CbmUnigenGenerator::fNofPrimaries
private

Number of primaries registered in current event.

Definition at line 99 of file CbmUnigenGenerator.h.

Referenced by AddPrimary(), and ReadEvent().

◆ fPhi

Double_t CbmUnigenGenerator::fPhi
private

Event plane rotation angle.

Definition at line 93 of file CbmUnigenGenerator.h.

Referenced by Init(), and ReadEvent().

◆ fTree

TTree* CbmUnigenGenerator::fTree
private

Input ROOT tree.

Definition at line 96 of file CbmUnigenGenerator.h.

Referenced by GetNextEntry(), Init(), and RegisterIons().

◆ kPdgCharge

const Int_t CbmUnigenGenerator::kPdgCharge = 10000
staticprivate

Decomposition of ion PDG code.

Definition at line 110 of file CbmUnigenGenerator.h.

Referenced by GetIonCharge(), and GetIonMass().

◆ kPdgLambda

const Int_t CbmUnigenGenerator::kPdgLambda = 10000000
staticprivate

Decomposition of ion PDG code.

Definition at line 109 of file CbmUnigenGenerator.h.

Referenced by GetIonCharge(), GetIonLambdas(), and ProcessIon().

◆ kPdgMass

const Int_t CbmUnigenGenerator::kPdgMass = 10
staticprivate

Decomposition of ion PDG code.

Definition at line 111 of file CbmUnigenGenerator.h.

Referenced by GetIonMass().


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