diff --git a/sim/transport/gconfig/g4Config.C b/sim/transport/gconfig/g4Config.C index faf21eea5c823bc43d9d0910dd0b526ed81c99da..96692f783d27ed89859a7dda9a27afc305b19ede 100644 --- a/sim/transport/gconfig/g4Config.C +++ b/sim/transport/gconfig/g4Config.C @@ -62,8 +62,10 @@ void Config() //set geant4 specific stuff + // Get the infomation about the seed value defined by SetSeed from the base class. + // Since ROOT 6.24 the derived classes return a differnt value. Text_t buffer[50]; - sprintf(buffer, "/random/setSeeds %i %i ", gRandom->GetSeed(), gRandom->GetSeed()); + sprintf(buffer, "/random/setSeeds %i %i ", gRandom->TRandom::GetSeed(), gRandom->TRandom::GetSeed()); geant4->ProcessGeantCommand(buffer); geant4->SetMaxNStep(10000); // default is 30000 diff --git a/sim/transport/steer/CbmGeant4Settings.cxx b/sim/transport/steer/CbmGeant4Settings.cxx index 09ca02d0d0d6993dec37af46792072cd8bdefb79..76fac50e049edc42d7e7b3167fb8fb2a4efb32d1 100644 --- a/sim/transport/steer/CbmGeant4Settings.cxx +++ b/sim/transport/steer/CbmGeant4Settings.cxx @@ -34,8 +34,11 @@ void CbmGeant4Settings::Init(TVirtualMC* vmc) // --- Random seed and maximum number of steps size_t buf_size = 100; Text_t buffer[buf_size]; - int result_length = - snprintf(buffer, buf_size - 1, "/random/setSeeds %i %i ", gRandom->GetSeed(), gRandom->GetSeed()); + // Get the infomation about the seed value defined by SetSeed from the base class. + // Since ROOT 6.24 the derrived classes return a differnt value. + fRandomSeed = gRandom->TRandom::GetSeed(); + LOG(info) << "Set Geant4 random seed to " << fRandomSeed; + int result_length = snprintf(buffer, buf_size - 1, "/random/setSeeds %i %i ", fRandomSeed, fRandomSeed); if (!(result_length > 0 && result_length < static_cast<int>(buf_size))) { LOG(fatal) << "Buffer overrun. Random seed for Geant4 would be improper."; } diff --git a/sim/transport/steer/CbmGeant4Settings.h b/sim/transport/steer/CbmGeant4Settings.h index df3029345c1bc0691e2a09c1c685da0edef4cbab..2bf0d36176d4f60f24dc2004bc24caca1a7e587d 100644 --- a/sim/transport/steer/CbmGeant4Settings.h +++ b/sim/transport/steer/CbmGeant4Settings.h @@ -55,6 +55,12 @@ public: **/ std::array<std::string, 3> GetG4RunConfig() { return fG4RunConfig; } + /** @brief Get the Geant4 random seed + ** @return Initial seed value + ** + **/ + Int_t GetG4Seed() { return fRandomSeed; } + /** @brief Set a new command which should be passsed to Geant4. The call will ** remove the current list of commands ** @param[in] Geant4 command string @@ -71,12 +77,23 @@ public: **/ void AddG4Command(std::string command) { fG4Commands.push_back(command); } + /** @brief Get the Geant4 commands + ** @return Vector with the commands passed to Geant4 + ** + **/ + std::vector<std::string> GetG4Commands() { return fG4Commands; } + /** @brief Set the maximum number of steps after which the transport is stopped ** list of commands ** @param[in] Number of steps **/ void SetMaximumNumberOfSteps(Int_t numSteps) { fMaxNumSteps = numSteps; } + /** @brief Get the maximum number of steps + ** @return Number of steps after which the transport is stopped + **/ + Int_t GetMaximumNumberOfSteps() { return fMaxNumSteps; } + private: std::array<std::string, 3> fG4RunConfig {{"geomRoot", "QGSP_BERT_EMV+optical", "stepLimiter"}}; @@ -90,7 +107,9 @@ private: Int_t fMaxNumSteps {10000000}; - ClassDef(CbmGeant4Settings, 3); + Int_t fRandomSeed {0}; + + ClassDef(CbmGeant4Settings, 4); }; #endif /* CBMGEANT4SETTINGS_H */