CbmRoot
|
Generates input to transport simulation from files in Unigen format. More...
#include <CbmUnigenGenerator.h>
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. | |
CbmUnigenGenerator & | operator= (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. | |
UEvent * | fEvent = 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. | |
Generates input to transport simulation from files in Unigen format.
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.
Mode enumerator.
Definition at line 55 of file CbmUnigenGenerator.h.
Default constructor.
fileName | Name of input file in UniGen format |
mode | Execution mode (see EMode) |
This constructor cannot be used for mode kRotateFixed.
Definition at line 34 of file CbmUnigenGenerator.cxx.
References Init(), and kRotateFixed.
CbmUnigenGenerator::CbmUnigenGenerator | ( | const char * | fileName, |
EMode | mode, | ||
Double_t | phi ) |
Constructor with fixed rotation angle.
fileName | Name of input file in UniGen format |
mode | Execution mode (see EMode) |
phi | Event plane rotation angle (only for mode fRotateFixed) |
Definition at line 50 of file CbmUnigenGenerator.cxx.
References Init().
|
virtual |
Destructor.
Definition at line 64 of file CbmUnigenGenerator.cxx.
References CloseInput(), and fEvent.
|
privatedelete |
Copy constructor forbidden.
|
private |
Add a primary particle to the event generator.
primGen | FairPrimaryGenerator instance |
pdgCode | Particle ID (PDG code) |
momentum | Momentum vector [GeV] |
Definition at line 74 of file CbmUnigenGenerator.cxx.
References fNofPrimaries.
Referenced by ProcessIon(), and ReadEvent().
|
private |
|
private |
Close the input file.
Definition at line 83 of file CbmUnigenGenerator.cxx.
References fFile, and fFileName.
Referenced by ~CbmUnigenGenerator().
|
inlineprivate |
Charge number of an ion.
pdgCode | Particle ID (PDG code) |
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().
|
inlineprivate |
Number of Lambdas in an ion.
pdgCode | Particle ID (PDG code) |
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().
|
inlineprivate |
Mass number of an ion.
pdgCode | Particle ID (PDG code) |
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().
|
private |
Get next entry from input tree.
Definition at line 94 of file CbmUnigenGenerator.cxx.
References fCurrentEntry, fMode, fTree, and kReuseEvents.
Referenced by ReadEvent().
|
inline |
Get the maximum number of events available in the input file.
Definition at line 100 of file CbmUnigenGenerator.h.
References fAvailableEvents.
Referenced by CbmTransport::Run().
|
private |
Initialisation.
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().
|
privatedelete |
Assignment operator forbidden.
|
private |
Treat a composite particle (ion)
primGen | FairPrimaryGenerator instance |
pdgCode | Particle ID (PDG code) |
momentum | Momentum 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().
|
virtual |
Read one event from the input file.
primGen | Pointer to FairPrimaryGenerator instance |
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().
|
private |
Register ions to the simulation.
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().
|
private |
Maximum number of events in the input file.
Definition at line 115 of file CbmUnigenGenerator.h.
Referenced by GetNumAvailableEvents(), and Init().
|
private |
CM velocity in the lab frame.
Definition at line 113 of file CbmUnigenGenerator.h.
Referenced by Init(), and ReadEvent().
|
private |
Current entry number.
Definition at line 109 of file CbmUnigenGenerator.h.
Referenced by GetNextEntry().
Current input event.
Definition at line 110 of file CbmUnigenGenerator.h.
Referenced by Init(), ReadEvent(), RegisterIons(), and ~CbmUnigenGenerator().
|
private |
Input ROOT file.
Definition at line 107 of file CbmUnigenGenerator.h.
Referenced by CloseInput(), and Init().
|
private |
Input file name.
Definition at line 103 of file CbmUnigenGenerator.h.
Referenced by CloseInput(), and Init().
|
private |
Gamma factor of CM in lab frame.
Definition at line 114 of file CbmUnigenGenerator.h.
Referenced by Init(), and ReadEvent().
|
private |
Map from ion name to FairIon.
Definition at line 116 of file CbmUnigenGenerator.h.
Referenced by RegisterIons().
|
private |
Flag whether generator is initialised.
Definition at line 106 of file CbmUnigenGenerator.h.
Referenced by Init(), and ReadEvent().
Rotation mode.
Definition at line 104 of file CbmUnigenGenerator.h.
Referenced by GetNextEntry(), Init(), and ReadEvent().
|
private |
Number of processed events.
Definition at line 112 of file CbmUnigenGenerator.h.
Referenced by ReadEvent().
|
private |
Number of primaries registered in current event.
Definition at line 111 of file CbmUnigenGenerator.h.
Referenced by AddPrimary(), and ReadEvent().
|
private |
Event plane rotation angle.
Definition at line 105 of file CbmUnigenGenerator.h.
Referenced by Init(), and ReadEvent().
|
private |
Input ROOT tree.
Definition at line 108 of file CbmUnigenGenerator.h.
Referenced by GetNextEntry(), Init(), and RegisterIons().
|
staticprivate |
Decomposition of ion PDG code.
Definition at line 123 of file CbmUnigenGenerator.h.
Referenced by GetIonCharge(), and GetIonMass().
|
staticprivate |
Decomposition of ion PDG code.
Definition at line 122 of file CbmUnigenGenerator.h.
Referenced by GetIonCharge(), GetIonLambdas(), and ProcessIon().
|
staticprivate |
Decomposition of ion PDG code.
Definition at line 124 of file CbmUnigenGenerator.h.
Referenced by GetIonMass().