CbmRoot
Loading...
Searching...
No Matches
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.
 
virtual ~CbmTransport ()
 Destructor

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

Private Member Functions

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

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}
 
ULong_t fRandomSeed {0}
 

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 55 of file CbmTransport.h.

Constructor & Destructor Documentation

◆ CbmTransport()

CbmTransport::CbmTransport ( )

Constructor.

Definition at line 62 of file CbmTransport.cxx.

References fEventGen, and fRun.

◆ ~CbmTransport()

CbmTransport::~CbmTransport ( )
virtual

Destructor

Definition at line 108 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 113 of file CbmTransport.cxx.

References fEventGen, Cbm::File::IsRootFile(), kPluto, kUnigen, and kUrqmd.

Referenced by CbmTransportConfig::SetIO().

◆ AddInput() [2/2]

void CbmTransport::AddInput ( FairGenerator * generator)

Add an input by generator instance.

Parameters
generatorPointer to generator instance

Definition at line 144 of file CbmTransport.cxx.

References fEventGen.

◆ ClassDef()

CbmTransport::ClassDef ( CbmTransport ,
4  )
private

◆ ConfigureVMC()

void CbmTransport::ConfigureVMC ( )

Set the parameters for the TVirtualMC.

Definition at line 153 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 214 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 196 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 205 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 104 of file CbmTransport.h.

References fGenerateRunInfo.

◆ GetSetup()

CbmSetup * CbmTransport::GetSetup ( ) const
inline

Detector setup interface.

Returns
Pointer to CbmSetup class

Definition at line 110 of file CbmTransport.h.

References fSetup.

Referenced by CbmTransportConfig::SetGeometry().

◆ GetStackFilter()

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

Access to stack filter object.

Returns
Pointer to stack filter object

Definition at line 116 of file CbmTransport.h.

References fStackFilter.

Referenced by CbmTransportConfig::SetStackFilter().

◆ InitEventGenerator()

void CbmTransport::InitEventGenerator ( )
private

◆ LoadSetup()

void CbmTransport::LoadSetup ( const char * setupName)

Use a standard setup.

Parameters
setupNameName of standard setup

Definition at line 313 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 393 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 318 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 378 of file CbmTransport.cxx.

References fRun.

◆ RegisterSetup()

void CbmTransport::RegisterSetup ( )
private

Create and register the setup modules.

Definition at line 388 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 669 of file CbmTransport.cxx.

References fEventGen, and CbmEventGenerator::SetBeamAngle().

Referenced by CbmTransportConfig::SetBeamProfile().

◆ 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 678 of file CbmTransport.cxx.

References fEventGen, and CbmEventGenerator::SetBeamPosition().

Referenced by CbmTransportConfig::SetBeamProfile().

◆ 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 687 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 199 of file CbmTransport.h.

References fEngine.

Referenced by CbmTransportConfig::SetTransportParameters().

◆ 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 209 of file CbmTransport.h.

References fEventFilter.

◆ SetEventFilterMinNofData()

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

Definition at line 216 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 226 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 361 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 370 of file CbmTransport.h.

References fGeant4Settings.

Referenced by CbmTransportConfig::SetTransportParameters().

◆ 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 703 of file CbmTransport.cxx.

References fGeoFileName.

Referenced by CbmTransportConfig::SetIO().

◆ 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 247 of file CbmTransport.h.

References fSetup, and CbmSetup::SetMediaFilePath().

◆ SetOutFileName()

void CbmTransport::SetOutFileName ( TString name,
Bool_t overwrite = kFALSE )

Set the output file name.

Parameters
pathName of output file
overwriteOverwrite output file if already existing

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

Definition at line 751 of file CbmTransport.cxx.

References fOutFileName.

Referenced by CbmTransportConfig::SetIO().

◆ 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 724 of file CbmTransport.cxx.

References fParFileName.

Referenced by CbmTransportConfig::SetIO().

◆ 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 746 of file CbmTransport.cxx.

References fEventGen.

Referenced by CbmTransportConfig::SetTransportParameters().

◆ SetRandomSeed()

void CbmTransport::SetRandomSeed ( const ULong_t seedValue)
inline

Set global random seed value.

Parameters
seedValue

This function allows to set the global seed value used by ROOTs random number generator TRandom

Definition at line 317 of file CbmTransport.h.

References fRandomSeed.

◆ SetSetupSource()

void CbmTransport::SetSetupSource ( ECbmSetupSource setupSource)

Set the source the setup will be loaded from.

Parameters
setupSourceenum value ECbmSetupSource

Definition at line 308 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 265 of file CbmTransport.h.

References fStackFilter.

◆ SetTarget()

void CbmTransport::SetTarget ( const char * medium = "Gold",
Double_t thickness = 0.025,
Double_t diameter = 2.5,
Double_t x = 0.,
Double_t y = 0.,
Double_t z = -44.0,
Double_t rot = 0.,
Double_t density = -1 )

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]
densitytarget material density [g/cm^3], -1 to attempt using a default

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 776 of file CbmTransport.cxx.

References fTarget, x, and y.

Referenced by CbmTransportConfig::SetTarget().

◆ 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 792 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 801 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 352 of file CbmTransport.h.

References fStoreTrajectories.

Member Data Documentation

◆ fCpuTime

Double_t CbmTransport::fCpuTime
private

Definition at line 385 of file CbmTransport.h.

Referenced by Run().

◆ fDecayModes

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

Definition at line 391 of file CbmTransport.h.

Referenced by ForceUserDecays(), and SetDecayMode().

◆ fEngine

ECbmEngine CbmTransport::fEngine
private

Definition at line 386 of file CbmTransport.h.

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

◆ fEventFilter

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

Definition at line 377 of file CbmTransport.h.

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

◆ fEventGen

◆ fField

FairField* CbmTransport::fField
private

Definition at line 374 of file CbmTransport.h.

Referenced by Run(), and SetField().

◆ fGeant3Settings

CbmGeant3Settings* CbmTransport::fGeant3Settings {nullptr}
private

Definition at line 393 of file CbmTransport.h.

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

◆ fGeant4Settings

CbmGeant4Settings* CbmTransport::fGeant4Settings {nullptr}
private

Definition at line 394 of file CbmTransport.h.

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

◆ fGenerateRunInfo

Bool_t CbmTransport::fGenerateRunInfo
private

Definition at line 388 of file CbmTransport.h.

Referenced by GenerateRunInfo(), and Run().

◆ fGenerators

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

Definition at line 382 of file CbmTransport.h.

◆ fGeoFileName

TString CbmTransport::fGeoFileName
private

Definition at line 381 of file CbmTransport.h.

Referenced by Run(), and SetGeoFileName().

◆ fOutFileName

TString CbmTransport::fOutFileName
private

Definition at line 379 of file CbmTransport.h.

Referenced by Run(), and SetOutFileName().

◆ fParFileName

TString CbmTransport::fParFileName
private

Definition at line 380 of file CbmTransport.h.

Referenced by Run(), and SetParFileName().

◆ fRandomSeed

ULong_t CbmTransport::fRandomSeed {0}
private

Definition at line 396 of file CbmTransport.h.

Referenced by Run(), and SetRandomSeed().

◆ fRealTimeInit

Double_t CbmTransport::fRealTimeInit
private

Definition at line 383 of file CbmTransport.h.

Referenced by Run().

◆ fRealTimeRun

Double_t CbmTransport::fRealTimeRun
private

Definition at line 384 of file CbmTransport.h.

Referenced by Run().

◆ fRun

FairRunSim* CbmTransport::fRun
private

Definition at line 378 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 390 of file CbmTransport.h.

◆ fStackFilter

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

Definition at line 387 of file CbmTransport.h.

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

◆ fStoreTrajectories

Bool_t CbmTransport::fStoreTrajectories
private

Definition at line 389 of file CbmTransport.h.

Referenced by Run(), and StoreTrajectories().

◆ fTarget

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

Definition at line 375 of file CbmTransport.h.

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


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