CbmRoot
|
User interface class for transport simulation. More...
#include <CbmTransport.h>
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... | |
CbmSetup * | GetSetup () 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 | |
CbmSetup * | fSetup |
FairField * | fField |
std::shared_ptr< CbmTarget > | fTarget |
CbmEventGenerator * | fEventGen |
std::unique_ptr< CbmMCEventFilter > | fEventFilter |
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< CbmStackFilter > | fStackFilter |
Bool_t | fGenerateRunInfo |
Bool_t | fStoreTrajectories |
std::function< void()> | fSimSetup |
std::map< Int_t, std::vector< Int_t > > | fDecayModes |
CbmGeant3Settings * | fGeant3Settings {nullptr} |
CbmGeant4Settings * | fGeant4Settings {nullptr} |
User interface class for transport simulation.
Definition at line 40 of file CbmTransport.h.
CbmTransport::CbmTransport | ( | ) |
|
virtual |
Destructor
Definition at line 98 of file CbmTransport.cxx.
void CbmTransport::AddInput | ( | const char * | fileName, |
ECbmGenerator | generator = kUnigen |
||
) |
void CbmTransport::AddInput | ( | FairGenerator * | generator | ) |
Add an input by generator instance.
generator | Pointer to generator instance |
Definition at line 125 of file CbmTransport.cxx.
References fEventGen.
|
private |
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().
|
private |
Force user-defined single-mode decays.
Definition at line 192 of file CbmTransport.cxx.
References fDecayModes, fEngine, kGeant4, and log().
Referenced by Run().
void CbmTransport::ForceVertexAtZ | ( | Double_t | zVertex | ) |
Force the event vertex to be at a given z position.
zVertex | z 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().
void CbmTransport::ForceVertexInTarget | ( | Bool_t | choice = kTRUE | ) |
Enable or disable forcing the vertex to be in the target.
choice | If true, the vertex will be generated in the target |
Definition at line 184 of file CbmTransport.cxx.
References fEventGen, and CbmEventGenerator::ForceVertexInTarget().
|
inline |
Trigger generation of a run info file.
choice | If 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.
|
inline |
Detector setup interface.
Definition at line 95 of file CbmTransport.h.
References fSetup.
|
inline |
Access to stack filter object.
Definition at line 101 of file CbmTransport.h.
References fStackFilter.
|
private |
Event generator initialisation.
Definition at line 268 of file CbmTransport.cxx.
References CbmBeamProfile::CheckWithTarget(), fEventGen, fTarget, CbmEventGenerator::GetBeamProfile(), CbmEventGenerator::Print(), and CbmEventGenerator::SetTarget().
Referenced by Run().
void CbmTransport::LoadSetup | ( | const char * | setupName | ) |
Use a standard setup.
setupName | Name of standard setup |
Definition at line 300 of file CbmTransport.cxx.
References fSetup, and CbmSetup::LoadSetup().
|
private |
Correct decay modes for pi0 and eta.
Definition at line 380 of file CbmTransport.cxx.
References fEngine, and kGeant4.
Referenced by Run().
|
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().
void CbmTransport::RegisterRadLength | ( | Bool_t | choice = kTRUE | ) |
Enable registration of radiation length.
choice | If 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.
|
private |
Create and register the setup modules.
Definition at line 375 of file CbmTransport.cxx.
References fSetup, and CbmSetup::RegisterSetup().
Referenced by Run().
void CbmTransport::Run | ( | Int_t | nEvents | ) |
Execute transport run.
nEvents | Number of events to process |
Definition at line 457 of file CbmTransport.cxx.
References ConfigureVMC(), CbmSetup::CreateFieldMap(), f, fCpuTime, fEngine, fEventFilter, fField, fGeant3Settings, fGeant4Settings, fGenerateRunInfo, fGeoFileName, ForceUserDecays(), fOutFileName, fParFileName, fRealTimeInit, fRealTimeRun, fRun, fSetup, fStoreTrajectories, fTarget, InitEventGenerator(), kGeant3, kGeant4, PiAndEtaDecay(), RegisterIons(), RegisterSetup(), and CbmFieldPar::SetParameters().
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)
x0 | Beam mean angle in the x-z plane [rad] |
y0 | Beam mean angle in the y-z plane [rad] |
sigmaX | Beam angle width in x-z [rad] |
sigmaY | Beam 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().
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.
x0 | Beam centre position in x [cm] |
y0 | Beam centre position in y [cm] |
sigmaX | Beam width in x [cm]. Default is 0.1. |
sigmaY | Beam width in y [cm]. Default is 0.1. |
zF | z 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().
void CbmTransport::SetDecayMode | ( | Int_t | pdg, |
UInt_t | nDaughters, | ||
Int_t * | daughterPdg | ||
) |
Set a decay mode for a particle.
pdg | PDG code of particle to decay |
nDaughters | Number of daughters |
daughterPdg | Array 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.
|
inline |
Set transport engine.
engine | kGeant3 or kGeant4 |
By default, GEANT3 is used.
Definition at line 191 of file CbmTransport.h.
References fEngine.
|
inline |
Set a user-defined event filter class.
filter | Pointer 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.
|
inline |
Definition at line 207 of file CbmTransport.h.
References fEventFilter.
|
inline |
Set magnetic field.
field | Pointer 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.
|
inline |
Set user defined transport settings for Geant3.
val | Pointer 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.
|
inline |
Set user defined transport settings for Geant4.
val | Pointer 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.
void CbmTransport::SetGeoFileName | ( | TString | name | ) |
Define geometry file name (output)
name | Name 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.
|
inline |
Set the media file name.
fileName | Path 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().
void CbmTransport::SetOutFileName | ( | TString | name | ) |
Define output file name.
name | Name for output file |
Definition at line 710 of file CbmTransport.cxx.
References fOutFileName.
void CbmTransport::SetParFileName | ( | TString | name | ) |
Define parameter file name.
name | Name for parameter file |
If the parameter file does not exist, it will be created.
Definition at line 681 of file CbmTransport.cxx.
References fParFileName.
void CbmTransport::SetRandomEventPlane | ( | Double_t | phiMin = 0. , |
Double_t | phiMax = 2. * TMath::Pi() |
||
) |
Activate random event plane.
phiMin | Minimum event plane angle [rad] |
phiMax | Maximum 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.
void CbmTransport::SetSetupSource | ( | ECbmSetupSource | setupSource | ) |
Set the source the setup will be loaded from.
setupSource | enum value ECbmSetupSource |
Definition at line 293 of file CbmTransport.cxx.
References fSetup, and CbmSetup::SetSetupSource().
|
inline |
Set a user-defined stack filter class.
filter | Pointer 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.
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.
medium | Name of target medium |
thickness | Thickness of target (in z) [cm] |
diameter | Target diameter [cm] |
x | x position of target centre in global c.s. [cm] |
y | y position of target centre in global c.s. [cm] |
z | z position of target centre in global c.s. [cm] |
rot | Rotation 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.
void CbmTransport::SetVertexSmearXY | ( | Bool_t | choice = kTRUE | ) |
Enable smearing of event vertex in x and y.
choice | If 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.
void CbmTransport::SetVertexSmearZ | ( | Bool_t | choice = kTRUE | ) |
Enable smearing of event vertex in z.
choice | If 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.
|
inline |
Enable storing of trajectories.
choice | If 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.
|
private |
Definition at line 373 of file CbmTransport.h.
Referenced by Run().
|
private |
Definition at line 379 of file CbmTransport.h.
Referenced by ForceUserDecays(), and SetDecayMode().
|
private |
Definition at line 374 of file CbmTransport.h.
Referenced by ConfigureVMC(), ForceUserDecays(), PiAndEtaDecay(), Run(), and SetEngine().
|
private |
Definition at line 365 of file CbmTransport.h.
Referenced by Run(), SetEventFilter(), and SetEventFilterMinNofData().
|
private |
Definition at line 364 of file CbmTransport.h.
Referenced by AddInput(), CbmTransport(), ForceVertexAtZ(), ForceVertexInTarget(), InitEventGenerator(), SetBeamAngle(), SetBeamPosition(), SetRandomEventPlane(), SetVertexSmearXY(), and SetVertexSmearZ().
|
private |
Definition at line 362 of file CbmTransport.h.
Referenced by Run(), and SetField().
|
private |
Definition at line 381 of file CbmTransport.h.
Referenced by ConfigureVMC(), Run(), and SetGeant3Settings().
|
private |
Definition at line 382 of file CbmTransport.h.
Referenced by ConfigureVMC(), Run(), and SetGeant4Settings().
|
private |
Definition at line 376 of file CbmTransport.h.
Referenced by GenerateRunInfo(), and Run().
|
private |
Definition at line 370 of file CbmTransport.h.
|
private |
Definition at line 369 of file CbmTransport.h.
Referenced by Run(), and SetGeoFileName().
|
private |
Definition at line 367 of file CbmTransport.h.
Referenced by Run(), and SetOutFileName().
|
private |
Definition at line 368 of file CbmTransport.h.
Referenced by Run(), and SetParFileName().
|
private |
Definition at line 371 of file CbmTransport.h.
Referenced by Run().
|
private |
Definition at line 372 of file CbmTransport.h.
Referenced by Run().
|
private |
Definition at line 366 of file CbmTransport.h.
Referenced by CbmTransport(), ConfigureVMC(), RegisterRadLength(), and Run().
|
private |
Definition at line 361 of file CbmTransport.h.
Referenced by GetSetup(), LoadSetup(), RegisterSetup(), Run(), SetMediaFileName(), and SetSetupSource().
|
private |
Definition at line 378 of file CbmTransport.h.
|
private |
Definition at line 375 of file CbmTransport.h.
Referenced by ConfigureVMC(), GetStackFilter(), and SetStackFilter().
|
private |
Definition at line 377 of file CbmTransport.h.
Referenced by Run(), and StoreTrajectories().
|
private |
Definition at line 363 of file CbmTransport.h.
Referenced by InitEventGenerator(), Run(), and SetTarget().