diff --git a/sim/transport/gconfig/g4Config.C b/sim/transport/gconfig/g4Config.C index 96692f783d27ed89859a7dda9a27afc305b19ede..aad1a727f00ff0b26656f26e871b321174ff88f5 100644 --- a/sim/transport/gconfig/g4Config.C +++ b/sim/transport/gconfig/g4Config.C @@ -61,11 +61,17 @@ void Config() if (cut == 0) gInterpreter->ProcessLine("SetCuts()"); - //set geant4 specific stuff + // --- Random seed and maximum number of steps + size_t buf_size = 100; + Text_t buffer[buf_size]; // 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->TRandom::GetSeed(), gRandom->TRandom::GetSeed()); + // Since ROOT 6.24 the derrived classes return a differnt value. + Int_t randomSeed = gRandom->TRandom::GetSeed(); + LOG(info) << "Set Geant4 random seed to " << randomSeed; + int result_length = snprintf(buffer, buf_size - 1, "/random/setSeeds %i %i ", randomSeed, randomSeed); + if (!(result_length > 0 && result_length < static_cast<int>(buf_size))) { + LOG(fatal) << "Buffer overrun. Random seed for Geant4 would be improper."; + } geant4->ProcessGeantCommand(buffer); geant4->SetMaxNStep(10000); // default is 30000 diff --git a/sim/transport/gconfig/g4config.in b/sim/transport/gconfig/g4config.in index 30cefff1d39567d63ece2868364b6cd6d7b4dc23..088b462e6510dd268ee5ed697fddff94babbf3ac 100644 --- a/sim/transport/gconfig/g4config.in +++ b/sim/transport/gconfig/g4config.in @@ -40,8 +40,9 @@ # (Needed as Cerenkov process does not limit step itself) # /process/optical/verbose 0 -/process/optical/defaults/cerenkov/setMaxPhotons 20 -/process/optical/defaults/cerenkov/setMaxBetaChange 0.1 -/process/optical/setTrackSecondariesFirst Cerenkov false - - +/process/optical/cerenkov/setMaxPhotons 20 +/process/optical/cerenkov/setMaxBetaChange 0.1 +/process/optical/cerenkov/setTrackSecondariesFirst true +/process/optical/processActivation Cerenkov true +/process/optical/processActivation OpAbsorption true +/process/optical/processActivation OpBoundary true