33 #include <TCollection.h>
34 #include <TGeoManager.h>
36 #include <TObjString.h>
59 , fIons(new TObjArray())
60 , fParticles(new TObjArray())
61 , ListOfModules(new TObjArray())
64 , fLoaderName(new TString(
"TGeo"))
65 , fPythiaDecayer(kFALSE)
66 , fPythiaDecayerConfig(
"")
68 , fUserDecayConfig(
"")
72 , fMeshList(new TObjArray())
74 , fUserCuts(
"SetCuts.C")
76 , fImportTGeoToVMC(kTRUE)
77 , fSimulationConfig(nullptr)
81 Fatal(
"FairRun",
"Singleton instance already exists.");
91 LOG(debug) <<
"Enter Destructor of FairRunSim ";
99 LOG(debug) <<
"Start deleting all registered modules";
102 LOG(debug) <<
"Finish deleting all registered modules";
151 LOG(info) <<
"============== FairRunSim: Initialising simulation run ==============";
156 GeoInterFace->setMediaFile(
MatFname.Data());
157 GeoInterFace->readMedia();
205 LOG(info) <<
"Create visualisation manager ";
225 TIter next(containerList);
227 TObjArray* ContList =
new TObjArray();
228 while ((cont = dynamic_cast<FairParSet*>(next()))) {
229 ContList->Add(
new TObjString(cont->
GetName()));
254 void FairRunSim::CheckFlukaExec()
257 TString work = getenv(
"VMCWORKDIR");
258 TString work_config = work +
"/gconfig/";
259 work_config.ReplaceAll(
"//",
"/");
261 TString config_dir = getenv(
"CONFIG_DIR");
262 config_dir.ReplaceAll(
"//",
"/");
263 if (!config_dir.EndsWith(
"/")) {
268 if (strcmp(GetName(),
"TFluka") == 0) {
269 TString flexec =
"run_fluka.sh";
270 if (TString(gSystem->FindFile(config_dir.Data(), flexec)) != TString(
"")) {
271 LOG(info) <<
"---User path for Configuration is used: " << config_dir.Data();
273 flexec = work_config +
"run_fluka.sh";
275 gSystem->Exec(flexec.Data());
278 TString macrodir = getenv(
"PWD");
280 flout = macrodir +
"/fluka_out";
281 flout.ReplaceAll(
"//",
"/");
282 gSystem->cd(flout.Data());
286 void FairRunSim::SetMCConfig()
315 TString work = getenv(
"GEOMPATH");
316 work.ReplaceAll(
"//",
"/");
318 work = getenv(
"VMCWORKDIR");
319 Mat = work +
"/geometry/";
320 Mat.ReplaceAll(
"//",
"/");
323 if (!Mat.EndsWith(
"/")) {
328 LOG(info) <<
"Media file used: " <<
MatFname.Data();
333 if (strncmp(fName,
"TGeant3", 7) == 0) {
336 LOG(info) <<
"FairRun::SetGeoModel(): G3 native geometry model used ";
338 LOG(info) <<
"FairRun::SetGeoModel(): Geant3 MC engine only !";
339 LOG(info) <<
"FairRun::SetGeoModel(): Method skipped ... ";
void SetPythiaDecayerConfig(const TString decayerConf)
void AddMesh(FairMesh *Mesh)
Bool_t fPythiaDecayer
/** Geometry Model (TGeo or G3)*/
FairRunSim(Bool_t isMaster=kTRUE)
virtual const char * GetName() const
std::function< void()> fSimSetupPostInit
void SetBeamMom(Double_t BMom)
void SetPythiaDecayer(Bool_t decayer)
static TMCThreadLocal FairRunSim * fginstance
/** MC Event Header */
virtual void Setup(const char *mcEngine)
void SetField(FairField *field)
unsigned int generateId(void)
Bool_t fRadMap
/** flag for registring radiation length*/
FairMCEventHeader * GetMCEventHeader()
FairGeoInterface * getGeoInterface()
friend class FairMCApplication
FairRootManager * fRootManager
FairMCEventHeader * fMCEvHead
/** Primary Event Generator */
TString MatFname
/** Array of used modules */
void setChanged(Bool_t flag=kTRUE)
void WriteFileHeader(FairFileHeader *f)
virtual void FillParContainer()
void SetRadiationMapReg(Bool_t RadMap)
static FairRunSim * Instance()
void SetGenerator(FairPrimaryGenerator *Gen)
ClassImp(FairEventBuilder)
virtual void SetupPostInit(const char *mcEngine)
FairMCApplication * fApp
/** Internal counter*/
void SetNoOfSets(Int_t n)
Bool_t fRadLength
/** Macro for decay configuration*/
void SetContListStr(TObjArray *list)
TList * getListOfContainers()
FairParSet * getContainer(const Text_t *)
void SetRadiationLengthReg(Bool_t RadLen)
TObjArray * ListOfModules
/** Array of user defined particles*/
void AddMeshList(TObjArray *meshList)
FairPrimaryGenerator * GetPrimaryGenerator()
void SetRndSeed(UInt_t RndSeed)
void SetDetList(TObjArray *array)
TString fPythiaDecayerConfig
/** flag for using Pythia decayer*/
TObjArray * fParticles
/** Array of user defined ions */
FairPrimaryGenerator * fGen
/** flag for use Beam Energy */
TObjArray * GetUserDefIons()
void SetField(FairField *field)
Bool_t fUserDecay
/** Macro for Pythia decay configuration*/
void SetUserDecayConfig(const TString decayerConf)
void SetPythiaDecayer(Bool_t decayer)
FairGenericVMCConfig * fSimulationConfig
FairMQExParamsParOne * par
FairFileHeader * fFileHeader
TObjArray * GetListOfModules()
Bool_t fStoreTraj
/** Material file name */
void SetGeoModel(char *name)
void setInputVersion(Int_t v=-1, Int_t i=0)
void SetMaterials(const char *MatFileName)
TString * fLoaderName
/** Trajectory store flags */
Bool_t fRadGrid
/** flag for RadiationMapManager
FairRtdbRun * addRun(Int_t runId, Int_t refId=-1)
std::function< void()> fSimSetup
/** Allow importing TGeometry to VMC */
void SetUserDecay(const TString &Config)
void SetGen(FairPrimaryGenerator *gen)
virtual void Run(Int_t NEvents=0, Int_t NotUsed=0)
void AddModule(FairModule *Mod)
void AddTask(TTask *fTask)
TObjArray * fIons
/** Input file name map*/
FairField * fField
/** Singleton Instance */
void InitMC(const char *setup, const char *cuts)
void SetGenerator(FairPrimaryGenerator *fxGenerator)
void SetGeometry(TGeoManager *Geom)
Double_t fBeamMom
/** Main VMC application */
void RunMC(Int_t nofEvents)
void Config()
Configuration macro for Geant3 VirtualMC.
TObjArray * GetUserDefParticles()
void SetUserDecay(Bool_t decay)
*bool fUseSimSetupFunction