CbmRoot
Loading...
Searching...
No Matches
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.
 
 CbmUnigenGenerator (const char *fileName, EMode mode, Double_t phi)
 Constructor with fixed rotation angle.
 
virtual ~CbmUnigenGenerator ()
 Destructor.
 
virtual Bool_t ReadEvent (FairPrimaryGenerator *primGen)
 Read one event from the input file.
 
Int_t GetNumAvailableEvents ()
 Get the maximum number of events available in the input file.
 

Private Member Functions

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

Private Attributes

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

Static Private Attributes

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

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 51 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 55 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 34 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 50 of file CbmUnigenGenerator.cxx.

References Init().

◆ ~CbmUnigenGenerator()

CbmUnigenGenerator::~CbmUnigenGenerator ( )
virtual

Destructor.

Definition at line 64 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 74 of file CbmUnigenGenerator.cxx.

References fNofPrimaries.

Referenced by ProcessIon(), and ReadEvent().

◆ ClassDef()

CbmUnigenGenerator::ClassDef ( CbmUnigenGenerator ,
5  )
private

◆ CloseInput()

void CbmUnigenGenerator::CloseInput ( )
private

Close the input file.

Definition at line 83 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 145 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 154 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 163 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 94 of file CbmUnigenGenerator.cxx.

References fCurrentEntry, fMode, fTree, and kReuseEvents.

Referenced by ReadEvent().

◆ GetNumAvailableEvents()

Int_t CbmUnigenGenerator::GetNumAvailableEvents ( )
inline

Get the maximum number of events available in the input file.

Returns
number of available ebvents

Definition at line 100 of file CbmUnigenGenerator.h.

References fAvailableEvents.

Referenced by CbmTransport::Run().

◆ 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.

Save old global file and folder pointer to avoid messing with FairRoot

Restore old global file and folder pointer to avoid messing with FairRoot

Definition at line 121 of file CbmUnigenGenerator.cxx.

References fAvailableEvents, 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(), and 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 203 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 233 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, 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 303 of file CbmUnigenGenerator.cxx.

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

Referenced by Init().

Member Data Documentation

◆ fAvailableEvents

Int_t CbmUnigenGenerator::fAvailableEvents = 0
private

Maximum number of events in the input file.

Definition at line 115 of file CbmUnigenGenerator.h.

Referenced by GetNumAvailableEvents(), and Init().

◆ fBetaCM

Double_t CbmUnigenGenerator::fBetaCM = 0
private

CM velocity in the lab frame.

Definition at line 113 of file CbmUnigenGenerator.h.

Referenced by Init(), and ReadEvent().

◆ fCurrentEntry

Int_t CbmUnigenGenerator::fCurrentEntry = -1
private

Current entry number.

Definition at line 109 of file CbmUnigenGenerator.h.

Referenced by GetNextEntry().

◆ fEvent

UEvent* CbmUnigenGenerator::fEvent = new UEvent()
private

Current input event.

Definition at line 110 of file CbmUnigenGenerator.h.

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

◆ fFile

TFile* CbmUnigenGenerator::fFile = nullptr
private

Input ROOT file.

Definition at line 107 of file CbmUnigenGenerator.h.

Referenced by CloseInput(), and Init().

◆ fFileName

TString CbmUnigenGenerator::fFileName = ""
private

Input file name.

Definition at line 103 of file CbmUnigenGenerator.h.

Referenced by CloseInput(), and Init().

◆ fGammaCM

Double_t CbmUnigenGenerator::fGammaCM = 0
private

Gamma factor of CM in lab frame.

Definition at line 114 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 116 of file CbmUnigenGenerator.h.

Referenced by RegisterIons().

◆ fIsInit

Bool_t CbmUnigenGenerator::fIsInit = kFALSE
private

Flag whether generator is initialised.

Definition at line 106 of file CbmUnigenGenerator.h.

Referenced by Init(), and ReadEvent().

◆ fMode

EMode CbmUnigenGenerator::fMode = kStandard
private

Rotation mode.

Definition at line 104 of file CbmUnigenGenerator.h.

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

◆ fNofEvents

Int_t CbmUnigenGenerator::fNofEvents = 0
private

Number of processed events.

Definition at line 112 of file CbmUnigenGenerator.h.

Referenced by ReadEvent().

◆ fNofPrimaries

Int_t CbmUnigenGenerator::fNofPrimaries = 0
private

Number of primaries registered in current event.

Definition at line 111 of file CbmUnigenGenerator.h.

Referenced by AddPrimary(), and ReadEvent().

◆ fPhi

Double_t CbmUnigenGenerator::fPhi = 0.
private

Event plane rotation angle.

Definition at line 105 of file CbmUnigenGenerator.h.

Referenced by Init(), and ReadEvent().

◆ fTree

TTree* CbmUnigenGenerator::fTree = nullptr
private

Input ROOT tree.

Definition at line 108 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 123 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 122 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 124 of file CbmUnigenGenerator.h.

Referenced by GetIonMass().


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