CbmRoot
|
User interface class for transport simulation. More...
#include <CbmTransport.h>
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. | |
CbmSetup * | GetSetup () 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 | |
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} |
ULong_t | fRandomSeed {0} |
User interface class for transport simulation.
Definition at line 55 of file CbmTransport.h.
CbmTransport::CbmTransport | ( | ) |
|
virtual |
Destructor
Definition at line 108 of file CbmTransport.cxx.
void CbmTransport::AddInput | ( | const char * | fileName, |
ECbmGenerator | generator = kUnigen ) |
Add an input by file name and generator type.
fileName | Name of input file |
generator | Type of generator input |
Definition at line 113 of file CbmTransport.cxx.
References fEventGen, Cbm::File::IsRootFile(), kPluto, kUnigen, and kUrqmd.
Referenced by CbmTransportConfig::SetIO().
void CbmTransport::AddInput | ( | FairGenerator * | generator | ) |
Add an input by generator instance.
generator | Pointer to generator instance |
Definition at line 144 of file CbmTransport.cxx.
References fEventGen.
|
private |
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().
|
private |
Force user-defined single-mode decays.
Definition at line 214 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 196 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 205 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 104 of file CbmTransport.h.
References fGenerateRunInfo.
|
inline |
Detector setup interface.
Definition at line 110 of file CbmTransport.h.
References fSetup.
Referenced by CbmTransportConfig::SetGeometry().
|
inline |
Access to stack filter object.
Definition at line 116 of file CbmTransport.h.
References fStackFilter.
Referenced by CbmTransportConfig::SetStackFilter().
|
private |
Event generator initialisation.
Definition at line 283 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 313 of file CbmTransport.cxx.
References fSetup, and CbmSetup::LoadSetup().
|
private |
Correct decay modes for pi0 and eta.
Definition at line 393 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 318 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 378 of file CbmTransport.cxx.
References fRun.
|
private |
Create and register the setup modules.
Definition at line 388 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 470 of file CbmTransport.cxx.
References ConfigureVMC(), CbmSetup::CreateFieldMap(), fCpuTime, fEngine, fEventFilter, fEventGen, fField, fGeant3Settings, fGeant4Settings, fGenerateRunInfo, fGeoFileName, ForceUserDecays(), fOutFileName, fParFileName, fRandomSeed, fRealTimeInit, fRealTimeRun, fRun, fSetup, fStoreTrajectories, fTarget, CbmPlutoGenerator::GetNumAvailableEvents(), CbmUnigenGenerator::GetNumAvailableEvents(), 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 669 of file CbmTransport.cxx.
References fEventGen, and CbmEventGenerator::SetBeamAngle().
Referenced by CbmTransportConfig::SetBeamProfile().
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 678 of file CbmTransport.cxx.
References fEventGen, and CbmEventGenerator::SetBeamPosition().
Referenced by CbmTransportConfig::SetBeamProfile().
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 687 of file CbmTransport.cxx.
References fDecayModes.
|
inline |
Set transport engine.
engine | kGeant3 or kGeant4 |
By default, GEANT3 is used.
Definition at line 199 of file CbmTransport.h.
References fEngine.
Referenced by CbmTransportConfig::SetTransportParameters().
|
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 209 of file CbmTransport.h.
References fEventFilter.
|
inline |
Definition at line 216 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 226 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 361 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 370 of file CbmTransport.h.
References fGeant4Settings.
Referenced by CbmTransportConfig::SetTransportParameters().
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 703 of file CbmTransport.cxx.
References fGeoFileName.
Referenced by CbmTransportConfig::SetIO().
|
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 247 of file CbmTransport.h.
References fSetup, and CbmSetup::SetMediaFilePath().
void CbmTransport::SetOutFileName | ( | TString | name, |
Bool_t | overwrite = kFALSE ) |
Set the output file name.
path | Name of output file |
overwrite | Overwrite 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().
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 724 of file CbmTransport.cxx.
References fParFileName.
Referenced by CbmTransportConfig::SetIO().
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 746 of file CbmTransport.cxx.
References fEventGen.
Referenced by CbmTransportConfig::SetTransportParameters().
|
inline |
Set global random seed value.
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.
void CbmTransport::SetSetupSource | ( | ECbmSetupSource | setupSource | ) |
Set the source the setup will be loaded from.
setupSource | enum value ECbmSetupSource |
Definition at line 308 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 265 of file CbmTransport.h.
References fStackFilter.
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.
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] |
density | target 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.
Referenced by CbmTransportConfig::SetTarget().
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 792 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 801 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 352 of file CbmTransport.h.
References fStoreTrajectories.
|
private |
Definition at line 385 of file CbmTransport.h.
Referenced by Run().
|
private |
Definition at line 391 of file CbmTransport.h.
Referenced by ForceUserDecays(), and SetDecayMode().
|
private |
Definition at line 386 of file CbmTransport.h.
Referenced by ConfigureVMC(), ForceUserDecays(), PiAndEtaDecay(), Run(), and SetEngine().
|
private |
Definition at line 377 of file CbmTransport.h.
Referenced by Run(), SetEventFilter(), and SetEventFilterMinNofData().
|
private |
Definition at line 376 of file CbmTransport.h.
Referenced by AddInput(), AddInput(), CbmTransport(), ForceVertexAtZ(), ForceVertexInTarget(), InitEventGenerator(), Run(), SetBeamAngle(), SetBeamPosition(), SetRandomEventPlane(), SetVertexSmearXY(), and SetVertexSmearZ().
|
private |
Definition at line 374 of file CbmTransport.h.
Referenced by Run(), and SetField().
|
private |
Definition at line 393 of file CbmTransport.h.
Referenced by ConfigureVMC(), Run(), and SetGeant3Settings().
|
private |
Definition at line 394 of file CbmTransport.h.
Referenced by ConfigureVMC(), Run(), and SetGeant4Settings().
|
private |
Definition at line 388 of file CbmTransport.h.
Referenced by GenerateRunInfo(), and Run().
|
private |
Definition at line 382 of file CbmTransport.h.
|
private |
Definition at line 381 of file CbmTransport.h.
Referenced by Run(), and SetGeoFileName().
|
private |
Definition at line 379 of file CbmTransport.h.
Referenced by Run(), and SetOutFileName().
|
private |
Definition at line 380 of file CbmTransport.h.
Referenced by Run(), and SetParFileName().
|
private |
Definition at line 396 of file CbmTransport.h.
Referenced by Run(), and SetRandomSeed().
|
private |
Definition at line 383 of file CbmTransport.h.
Referenced by Run().
|
private |
Definition at line 384 of file CbmTransport.h.
Referenced by Run().
|
private |
Definition at line 378 of file CbmTransport.h.
Referenced by CbmTransport(), ConfigureVMC(), RegisterRadLength(), and Run().
|
private |
Definition at line 373 of file CbmTransport.h.
Referenced by GetSetup(), LoadSetup(), RegisterSetup(), Run(), SetMediaFileName(), and SetSetupSource().
|
private |
Definition at line 390 of file CbmTransport.h.
|
private |
Definition at line 387 of file CbmTransport.h.
Referenced by ConfigureVMC(), GetStackFilter(), and SetStackFilter().
|
private |
Definition at line 389 of file CbmTransport.h.
Referenced by Run(), and StoreTrajectories().
|
private |
Definition at line 375 of file CbmTransport.h.
Referenced by InitEventGenerator(), Run(), and SetTarget().