CbmRoot
CbmTransport Class Reference

User interface class for transport simulation. More...

#include <CbmTransport.h>

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

Public Member Functions

 CbmTransport ()
 Constructor. More...
 
virtual ~CbmTransport ()
 Destructor
More...
 
void AddInput (const char *fileName, ECbmGenerator generator=kUnigen)
 Add an input by file name and generator type. More...
 
void AddInput (FairGenerator *generator)
 Add an input by generator instance. More...
 
void ConfigureVMC ()
 Set the parameters for the TVirtualMC. More...
 
void ForceVertexAtZ (Double_t zVertex)
 Force the event vertex to be at a given z position. More...
 
void ForceVertexInTarget (Bool_t choice=kTRUE)
 Enable or disable forcing the vertex to be in the target. More...
 
void GenerateRunInfo (Bool_t choice=kTRUE)
 Trigger generation of a run info file. More...
 
CbmSetupGetSetup () const
 Detector setup interface. More...
 
std::unique_ptr< CbmStackFilter > & GetStackFilter ()
 Access to stack filter object. More...
 
void SetSetupSource (ECbmSetupSource setupSource)
 Set the source the setup will be loaded from. More...
 
void LoadSetup (const char *setupName)
 Use a standard setup. More...
 
void RegisterRadLength (Bool_t choice=kTRUE)
 Enable registration of radiation length. More...
 
void Run (Int_t nEvents)
 Execute transport run. More...
 
void SetBeamAngle (Double_t x0, Double_t y0, Double_t sigmaX=-1., Double_t sigmaY=-1.)
 Set the beam angle (emittency at the beam position) More...
 
void SetBeamPosition (Double_t x0, Double_t y0, Double_t sigmaX=-1., Double_t sigmaY=-1., Double_t zF=0.)
 Set the beam position. More...
 
void SetDecayMode (Int_t pdg, UInt_t nDaughters, Int_t *daughterPdg)
 Set a decay mode for a particle. More...
 
void SetEngine (ECbmEngine engine)
 Set transport engine. More...
 
void SetEventFilter (std::unique_ptr< CbmMCEventFilter > &filter)
 Set a user-defined event filter class. More...
 
void SetEventFilterMinNofData (ECbmDataType type, Int_t value)
 
void SetField (FairField *field)
 Set magnetic field. More...
 
void SetGeoFileName (TString name)
 Define geometry file name (output) More...
 
void SetMediaFileName (TString fileName)
 Set the media file name. More...
 
void SetParFileName (TString name)
 Define parameter file name. More...
 
void SetStackFilter (std::unique_ptr< CbmStackFilter > &filter)
 Set a user-defined stack filter class. More...
 
void SetTarget (const char *medium, Double_t thickness, Double_t diameter, Double_t x=0., Double_t y=0., Double_t z=0., Double_t rot=0.)
 Define the target. More...
 
void SetOutFileName (TString name)
 Define output file name. More...
 
void SetRandomEventPlane (Double_t phiMin=0., Double_t phiMax=2. *TMath::Pi())
 Activate random event plane. More...
 
void SetVertexSmearXY (Bool_t choice=kTRUE)
 Enable smearing of event vertex in x and y. More...
 
void SetVertexSmearZ (Bool_t choice=kTRUE)
 Enable smearing of event vertex in z. More...
 
void StoreTrajectories (Bool_t choice=kTRUE)
 Enable storing of trajectories. More...
 
void SetGeant3Settings (CbmGeant3Settings *val)
 Set user defined transport settings for Geant3. More...
 
void SetGeant4Settings (CbmGeant4Settings *val)
 Set user defined transport settings for Geant4. More...
 

Private Member Functions

void InitEventGenerator ()
 Event generator initialisation. More...
 
void ForceUserDecays ()
 Force user-defined single-mode decays. More...
 
void PiAndEtaDecay (TVirtualMC *vmc)
 Correct decay modes for pi0 and eta. More...
 
void RegisterIons ()
 Register ions. More...
 
void RegisterSetup ()
 Create and register the setup modules. More...
 
 ClassDef (CbmTransport, 3)
 

Private Attributes

CbmSetupfSetup
 
FairField * fField
 
std::shared_ptr< CbmTargetfTarget
 
CbmEventGeneratorfEventGen
 
std::unique_ptr< CbmMCEventFilterfEventFilter
 
FairRunSim * fRun
 
TString fOutFileName
 
TString fParFileName
 
TString fGeoFileName
 
std::vector< FairGenerator * > fGenerators
 
Double_t fRealTimeInit
 
Double_t fRealTimeRun
 
Double_t fCpuTime
 
ECbmEngine fEngine
 
std::unique_ptr< CbmStackFilterfStackFilter
 
Bool_t fGenerateRunInfo
 
Bool_t fStoreTrajectories
 
std::function< void()> fSimSetup
 
std::map< Int_t, std::vector< Int_t > > fDecayModes
 
CbmGeant3SettingsfGeant3Settings {nullptr}
 
CbmGeant4SettingsfGeant4Settings {nullptr}
 

Detailed Description

User interface class for transport simulation.

Author
Volker Friese v.fri.nosp@m.ese@.nosp@m.gsi.d.nosp@m.e
Since
31 January 2019

Definition at line 40 of file CbmTransport.h.

Constructor & Destructor Documentation

◆ CbmTransport()

CbmTransport::CbmTransport ( )

Constructor.

Definition at line 53 of file CbmTransport.cxx.

References fEventGen, and fRun.

◆ ~CbmTransport()

CbmTransport::~CbmTransport ( )
virtual

Destructor

Definition at line 98 of file CbmTransport.cxx.

Member Function Documentation

◆ AddInput() [1/2]

void CbmTransport::AddInput ( const char *  fileName,
ECbmGenerator  generator = kUnigen 
)

Add an input by file name and generator type.

Parameters
fileNameName of input file
generatorType of generator input

Definition at line 103 of file CbmTransport.cxx.

References fEventGen, kPluto, kUnigen, and kUrqmd.

◆ AddInput() [2/2]

void CbmTransport::AddInput ( FairGenerator *  generator)

Add an input by generator instance.

Parameters
generatorPointer to generator instance

Definition at line 125 of file CbmTransport.cxx.

References fEventGen.

◆ ClassDef()

CbmTransport::ClassDef ( CbmTransport  ,
 
)
private

◆ ConfigureVMC()

void CbmTransport::ConfigureVMC ( )

Set the parameters for the TVirtualMC.

Definition at line 133 of file CbmTransport.cxx.

References fEngine, fGeant3Settings, fGeant4Settings, fRun, fStackFilter, CbmGeant4Settings::GetG4RunConfig(), CbmGeant3Settings::Init(), CbmGeant4Settings::Init(), kGeant3, and kGeant4.

Referenced by Run().

◆ ForceUserDecays()

void CbmTransport::ForceUserDecays ( )
private

Force user-defined single-mode decays.

Definition at line 192 of file CbmTransport.cxx.

References fDecayModes, fEngine, kGeant4, and log().

Referenced by Run().

◆ ForceVertexAtZ()

void CbmTransport::ForceVertexAtZ ( Double_t  zVertex)

Force the event vertex to be at a given z position.

Parameters
zVertexz position of event vertex

The event vertex will be determined by the beam intersection with the specified z plane. The beam properties (position in focal plane and direction) are sampled from the specified beam profile.

Definition at line 176 of file CbmTransport.cxx.

References fEventGen, and CbmEventGenerator::ForceVertexAtZ().

◆ ForceVertexInTarget()

void CbmTransport::ForceVertexInTarget ( Bool_t  choice = kTRUE)

Enable or disable forcing the vertex to be in the target.

Parameters
choiceIf true, the vertex will be generated in the target

Definition at line 184 of file CbmTransport.cxx.

References fEventGen, and CbmEventGenerator::ForceVertexInTarget().

◆ GenerateRunInfo()

void CbmTransport::GenerateRunInfo ( Bool_t  choice = kTRUE)
inline

Trigger generation of a run info file.

Parameters
choiceIf kTRUE, run info file will be generated.

The run info file contains information on resource usage.

Definition at line 89 of file CbmTransport.h.

References fGenerateRunInfo.

◆ GetSetup()

CbmSetup* CbmTransport::GetSetup ( ) const
inline

Detector setup interface.

Returns
Pointer to CbmSetup class

Definition at line 95 of file CbmTransport.h.

References fSetup.

◆ GetStackFilter()

std::unique_ptr<CbmStackFilter>& CbmTransport::GetStackFilter ( )
inline

Access to stack filter object.

Returns
Pointer to stack filter object

Definition at line 101 of file CbmTransport.h.

References fStackFilter.

◆ InitEventGenerator()

void CbmTransport::InitEventGenerator ( )
private

◆ LoadSetup()

void CbmTransport::LoadSetup ( const char *  setupName)

Use a standard setup.

Parameters
setupNameName of standard setup

Definition at line 300 of file CbmTransport.cxx.

References fSetup, and CbmSetup::LoadSetup().

◆ PiAndEtaDecay()

void CbmTransport::PiAndEtaDecay ( TVirtualMC *  vmc)
private

Correct decay modes for pi0 and eta.

Definition at line 380 of file CbmTransport.cxx.

References fEngine, and kGeant4.

Referenced by Run().

◆ RegisterIons()

void CbmTransport::RegisterIons ( )
private

Register ions.

Since the TDatabasePDG does not contain ions we use in the transport, they are added manually by this method.

Definition at line 307 of file CbmTransport.cxx.

Referenced by Run().

◆ RegisterRadLength()

void CbmTransport::RegisterRadLength ( Bool_t  choice = kTRUE)

Enable registration of radiation length.

Parameters
choiceIf kTRUE, registration is enabled.

If this method is used, an array of FairRadLenPoint will be created in the output tree. This is needed to analyse the material budget of the setup. It should not be used for standard transport, since it creates a lot of additional output.

Definition at line 366 of file CbmTransport.cxx.

References fRun.

◆ RegisterSetup()

void CbmTransport::RegisterSetup ( )
private

Create and register the setup modules.

Definition at line 375 of file CbmTransport.cxx.

References fSetup, and CbmSetup::RegisterSetup().

Referenced by Run().

◆ Run()

◆ SetBeamAngle()

void CbmTransport::SetBeamAngle ( Double_t  x0,
Double_t  y0,
Double_t  sigmaX = -1.,
Double_t  sigmaY = -1. 
)

Set the beam angle (emittency at the beam position)

Parameters
x0Beam mean angle in the x-z plane [rad]
y0Beam mean angle in the y-z plane [rad]
sigmaXBeam angle width in x-z [rad]
sigmaYBeam angle width in y-z [rad]

For each event, beam angles in x and y will be generated from Gaussian distributions with the specified parameters. The event will be rotated accordingly from the beam C.S. into the global C.S.

Without using this method, the default beam is always in z direction.

Definition at line 620 of file CbmTransport.cxx.

References fEventGen, and CbmEventGenerator::SetBeamAngle().

◆ SetBeamPosition()

void CbmTransport::SetBeamPosition ( Double_t  x0,
Double_t  y0,
Double_t  sigmaX = -1.,
Double_t  sigmaY = -1.,
Double_t  zF = 0. 
)

Set the beam position.

Parameters
x0Beam centre position in x [cm]
y0Beam centre position in y [cm]
sigmaXBeam width in x [cm]. Default is 0.1.
sigmaYBeam width in y [cm]. Default is 0.1.
zFz coordinate of beam focal plane [cm|. Default is 0.

The beam parameters are used to generate the event vertex. A Gaussian beam profile in x and y is assumed. If sigmaX or sigmaY are null, the event vertex is always at (x0, y0). Smearing of the event vertex in the transverse plane can be deactivated by the method SetBeamSmearXY. Without using this method, the primary vertex is always at x=0 and y=0.

Definition at line 631 of file CbmTransport.cxx.

References fEventGen, and CbmEventGenerator::SetBeamPosition().

◆ SetDecayMode()

void CbmTransport::SetDecayMode ( Int_t  pdg,
UInt_t  nDaughters,
Int_t *  daughterPdg 
)

Set a decay mode for a particle.

Parameters
pdgPDG code of particle to decay
nDaughtersNumber of daughters
daughterPdgArray of daughter PDG codes

This method will force the specified particle to always decay in the specified mode (branching ratio 100%).

Definition at line 643 of file CbmTransport.cxx.

References fDecayModes.

◆ SetEngine()

void CbmTransport::SetEngine ( ECbmEngine  engine)
inline

Set transport engine.

Parameters
enginekGeant3 or kGeant4

By default, GEANT3 is used.

Definition at line 191 of file CbmTransport.h.

References fEngine.

◆ SetEventFilter()

void CbmTransport::SetEventFilter ( std::unique_ptr< CbmMCEventFilter > &  filter)
inline

Set a user-defined event filter class.

Parameters
filterPointer to event filter class

The filter class has to be derived from CbmMCEventFilter. It will be used instead of the default CbmMCEventFilter class for filtering MC events before writing to the output.

Definition at line 201 of file CbmTransport.h.

References fEventFilter.

◆ SetEventFilterMinNofData()

void CbmTransport::SetEventFilterMinNofData ( ECbmDataType  type,
Int_t  value 
)
inline

Definition at line 207 of file CbmTransport.h.

References fEventFilter.

◆ SetField()

void CbmTransport::SetField ( FairField *  field)
inline

Set magnetic field.

Parameters
fieldPointer to FairField instance

By default, a field map corresponding to the magnet geometry will be used. This can be overridden by specifying a field object directly through this method.

Definition at line 219 of file CbmTransport.h.

References fField.

◆ SetGeant3Settings()

void CbmTransport::SetGeant3Settings ( CbmGeant3Settings val)
inline

Set user defined transport settings for Geant3.

Parameters
valPointer to the user object

By default, a CbmGeant3Settings object is created with the default values as defined in the class. This can be overridden by specifying a CbmGeant3Settings object directly through this method.

Definition at line 349 of file CbmTransport.h.

References fGeant3Settings.

◆ SetGeant4Settings()

void CbmTransport::SetGeant4Settings ( CbmGeant4Settings val)
inline

Set user defined transport settings for Geant4.

Parameters
valPointer to the user object

By default, a CbmGeant3Settings object is created with the default values as defined in the class. This can be overridden by specifying a CbmGeant3Settings object directly through this method.

Definition at line 358 of file CbmTransport.h.

References fGeant4Settings.

◆ SetGeoFileName()

void CbmTransport::SetGeoFileName ( TString  name)

Define geometry file name (output)

Parameters
nameName for geometry file

If a file name is specified, a ROOT file containing the used geometry will be created (containing the TGeoManager).

Definition at line 661 of file CbmTransport.cxx.

References fGeoFileName.

◆ SetMediaFileName()

void CbmTransport::SetMediaFileName ( TString  fileName)
inline

Set the media file name.

Parameters
fileNamePath to media file

By default, the media needed for building the geometry are read from media.geo. This method allows to use a different one for experimental purposes. If an absolute path is specified, it will be applied. A relative path will be appended to GEOMPATH if defined, else to VMCWRKDIR/geometry.

Definition at line 240 of file CbmTransport.h.

References fSetup, and CbmSetup::SetMediaFilePath().

◆ SetOutFileName()

void CbmTransport::SetOutFileName ( TString  name)

Define output file name.

Parameters
nameName for output file

Definition at line 710 of file CbmTransport.cxx.

References fOutFileName.

◆ SetParFileName()

void CbmTransport::SetParFileName ( TString  name)

Define parameter file name.

Parameters
nameName for parameter file

If the parameter file does not exist, it will be created.

Definition at line 681 of file CbmTransport.cxx.

References fParFileName.

◆ SetRandomEventPlane()

void CbmTransport::SetRandomEventPlane ( Double_t  phiMin = 0.,
Double_t  phiMax = 2. * TMath::Pi() 
)

Activate random event plane.

Parameters
phiMinMinimum event plane angle [rad]
phiMaxMaximum event plane angle [rad]

If this method is used, the input events will be rotated by a random angle around the z axis, with a flat distribution from phiMin to phiMax. In case several generators are used at the same time, this rotation applies to all inputs.

Definition at line 703 of file CbmTransport.cxx.

References fEventGen.

◆ SetSetupSource()

void CbmTransport::SetSetupSource ( ECbmSetupSource  setupSource)

Set the source the setup will be loaded from.

Parameters
setupSourceenum value ECbmSetupSource

Definition at line 293 of file CbmTransport.cxx.

References fSetup, and CbmSetup::SetSetupSource().

◆ SetStackFilter()

void CbmTransport::SetStackFilter ( std::unique_ptr< CbmStackFilter > &  filter)
inline

Set a user-defined stack filter class.

Parameters
filterPointer to CbmStackFilter class

The filter class has to be derived from CbmStackFilter. It will be used instead of the default CbmStackFilter class for filtering MCTracks before writing to the output.

Definition at line 260 of file CbmTransport.h.

References fStackFilter.

◆ SetTarget()

void CbmTransport::SetTarget ( const char *  medium,
Double_t  thickness,
Double_t  diameter,
Double_t  x = 0.,
Double_t  y = 0.,
Double_t  z = 0.,
Double_t  rot = 0. 
)

Define the target.

Parameters
mediumName of target medium
thicknessThickness of target (in z) [cm]
diameterTarget diameter [cm]
xx position of target centre in global c.s. [cm]
yy position of target centre in global c.s. [cm]
zz position of target centre in global c.s. [cm]
rotRotation angle around y axis in global c.s. [deg]

The target is a disk with the z axis as symmetry axis. By default, it is centred at the origin. It can be rotated around the y axis.

Definition at line 730 of file CbmTransport.cxx.

References fTarget, x, and y.

◆ SetVertexSmearXY()

void CbmTransport::SetVertexSmearXY ( Bool_t  choice = kTRUE)

Enable smearing of event vertex in x and y.

Parameters
choiceIf kTRUE(default), smearing is enabled.

If enabled, the event vertex will be sampled in x and y from a Gaussian distribution with the parameters specified by the method SetBeamPosition.

TODO: It is not guaranteed that the generated event vertex falls into the target volume. In order to ensure that, the method FairPrimaryGenerator::MakeVertex would have to be modified.

Definition at line 746 of file CbmTransport.cxx.

References fEventGen.

◆ SetVertexSmearZ()

void CbmTransport::SetVertexSmearZ ( Bool_t  choice = kTRUE)

Enable smearing of event vertex in z.

Parameters
choiceIf kTRUE(default), smearing is enabled.

If enabled, the event vertex z coordinate will be sampled from a flat distribution inside the target. If no target is defined, the event z vertex will always be zero.

Definition at line 754 of file CbmTransport.cxx.

References fEventGen.

◆ StoreTrajectories()

void CbmTransport::StoreTrajectories ( Bool_t  choice = kTRUE)
inline

Enable storing of trajectories.

Parameters
choiceIf kTRUE, trajectories will be stored.

When enabled, information on the trajectories of the simulated particles in stored in the output file for later visualisation. This is disabled by default because it increases the size of the output file by factors.

Definition at line 340 of file CbmTransport.h.

References fStoreTrajectories.

Member Data Documentation

◆ fCpuTime

Double_t CbmTransport::fCpuTime
private

Definition at line 373 of file CbmTransport.h.

Referenced by Run().

◆ fDecayModes

std::map<Int_t, std::vector<Int_t> > CbmTransport::fDecayModes
private

Definition at line 379 of file CbmTransport.h.

Referenced by ForceUserDecays(), and SetDecayMode().

◆ fEngine

ECbmEngine CbmTransport::fEngine
private

Definition at line 374 of file CbmTransport.h.

Referenced by ConfigureVMC(), ForceUserDecays(), PiAndEtaDecay(), Run(), and SetEngine().

◆ fEventFilter

std::unique_ptr<CbmMCEventFilter> CbmTransport::fEventFilter
private

Definition at line 365 of file CbmTransport.h.

Referenced by Run(), SetEventFilter(), and SetEventFilterMinNofData().

◆ fEventGen

◆ fField

FairField* CbmTransport::fField
private

Definition at line 362 of file CbmTransport.h.

Referenced by Run(), and SetField().

◆ fGeant3Settings

CbmGeant3Settings* CbmTransport::fGeant3Settings {nullptr}
private

Definition at line 381 of file CbmTransport.h.

Referenced by ConfigureVMC(), Run(), and SetGeant3Settings().

◆ fGeant4Settings

CbmGeant4Settings* CbmTransport::fGeant4Settings {nullptr}
private

Definition at line 382 of file CbmTransport.h.

Referenced by ConfigureVMC(), Run(), and SetGeant4Settings().

◆ fGenerateRunInfo

Bool_t CbmTransport::fGenerateRunInfo
private

Definition at line 376 of file CbmTransport.h.

Referenced by GenerateRunInfo(), and Run().

◆ fGenerators

std::vector<FairGenerator*> CbmTransport::fGenerators
private

Definition at line 370 of file CbmTransport.h.

◆ fGeoFileName

TString CbmTransport::fGeoFileName
private

Definition at line 369 of file CbmTransport.h.

Referenced by Run(), and SetGeoFileName().

◆ fOutFileName

TString CbmTransport::fOutFileName
private

Definition at line 367 of file CbmTransport.h.

Referenced by Run(), and SetOutFileName().

◆ fParFileName

TString CbmTransport::fParFileName
private

Definition at line 368 of file CbmTransport.h.

Referenced by Run(), and SetParFileName().

◆ fRealTimeInit

Double_t CbmTransport::fRealTimeInit
private

Definition at line 371 of file CbmTransport.h.

Referenced by Run().

◆ fRealTimeRun

Double_t CbmTransport::fRealTimeRun
private

Definition at line 372 of file CbmTransport.h.

Referenced by Run().

◆ fRun

FairRunSim* CbmTransport::fRun
private

Definition at line 366 of file CbmTransport.h.

Referenced by CbmTransport(), ConfigureVMC(), RegisterRadLength(), and Run().

◆ fSetup

CbmSetup* CbmTransport::fSetup
private

◆ fSimSetup

std::function<void()> CbmTransport::fSimSetup
private

Definition at line 378 of file CbmTransport.h.

◆ fStackFilter

std::unique_ptr<CbmStackFilter> CbmTransport::fStackFilter
private

Definition at line 375 of file CbmTransport.h.

Referenced by ConfigureVMC(), GetStackFilter(), and SetStackFilter().

◆ fStoreTrajectories

Bool_t CbmTransport::fStoreTrajectories
private

Definition at line 377 of file CbmTransport.h.

Referenced by Run(), and StoreTrajectories().

◆ fTarget

std::shared_ptr<CbmTarget> CbmTransport::fTarget
private

Definition at line 363 of file CbmTransport.h.

Referenced by InitEventGenerator(), Run(), and SetTarget().


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