17 #include "artg4tk/geantInit/ArtG4DetectorConstruction.hh" 18 #include "artg4tk/geantInit/ArtG4RunManager.hh" 21 #include "artg4tk/geantInit/ArtG4EventAction.hh" 22 #include "artg4tk/geantInit/ArtG4PrimaryGeneratorAction.hh" 23 #include "artg4tk/geantInit/ArtG4StackingAction.hh" 24 #include "artg4tk/geantInit/ArtG4SteppingAction.hh" 25 #include "artg4tk/geantInit/ArtG4TrackingAction.hh" 32 #include "artg4tk/services/ActionHolder_service.hh" 33 #include "artg4tk/services/DetectorHolder_service.hh" 34 #include "artg4tk/services/PhysicsListHolder_service.hh" 39 #include "nug4/ParticleNavigation/ParticleList.h" 40 #include "nurandom/RandomUtils/NuRandomService.h" 42 #include "Geant4/G4UImanager.hh" 43 #include "Geant4/G4UIterminal.hh" 70 G4UImanager*
UI_{
nullptr};
126 ,
seed_(
p.get<
long>(
"seed", -1))
135 produces<std::vector<simb::MCParticle>>();
136 produces<art::Assns<simb::MCTruth, simb::MCParticle, sim::GeneratedParticleInfo>>();
144 detectorHolder->initialize();
146 detectorHolder->constructAllLVs();
155 if (
seed_ > 900000000) {
157 <<
"The provided largeant seed value: " <<
seed_ <<
" is invalid! Maximum seed value is 9E8.";
196 runManager_->SetUserInitialization(physicsListHolder->makePhysicsList());
202 new artg4tk::ArtG4DetectorConstruction{detectorHolder->worldPhysicalVolume()});
206 actionHolder->initialize();
209 actionHolder->setCurrArtRun(r);
212 runManager_->SetUserAction(
new artg4tk::ArtG4PrimaryGeneratorAction{actionHolder});
219 runManager_->SetUserAction(
new artg4tk::ArtG4SteppingAction{actionHolder});
220 runManager_->SetUserAction(
new artg4tk::ArtG4StackingAction{actionHolder});
221 runManager_->SetUserAction(
new artg4tk::ArtG4EventAction{actionHolder, detectorHolder});
222 runManager_->SetUserAction(
new artg4tk::ArtG4TrackingAction{actionHolder});
225 physicsListHolder->initializePhysicsList();
228 UI_ = G4UImanager::GetUIpointer();
234 << (macroWasFound ?
"successful " :
"unsuccessful ") <<
"and path is: \n" 241 std::string commandToExecute =
"/control/execute ";
242 commandToExecute.append(macroLocation);
243 UI_->ApplyCommand(commandToExecute);
294 std::vector<art::Handle<MCTruthCollection>>
298 return e.
getMany<std::vector<simb::MCTruth>>();
301 std::vector<art::Handle<MCTruthCollection>>
result;
static bool initializeDetectors_
static std::atomic< int > processingRun_
void endRun(art::Run &) override
ProductID getProductID(std::string const &instance_name="") const
Handle< PROD > getHandle(SelectorBase const &) const
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
static std::unique_ptr< artg4tk::ArtG4RunManager > runManager_
void produce(art::Event &e) override
std::vector< art::Handle< MCTruthCollection > > inputCollections(art::Event const &e) const
EDProducer(fhicl::ParameterSet const &pset)
cet::search_path pathFinder_
std::unique_ptr< std::vector< simb::MCParticle > > ParticleCollection()
Utility functions to print MC truth information.
std::unique_ptr< art::Assns< simb::MCTruth, simb::MCParticle, sim::GeneratedParticleInfo > > AssnsMCTruthToMCParticle()
#define DEFINE_ART_MODULE(klass)
void setInputCollections(std::vector< art::Handle< std::vector< simb::MCTruth >>> const &mclists)
std::vector< Handle< PROD > > getMany(SelectorBase const &selector=MatchAllSelector{}) const
Use Geant4's user "hooks" to maintain a list of particles generated by Geant4.
EDProductGetter const * productGetter(ProductID const pid) const
std::vector< simb::MCTruth > MCTruthCollection
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
std::vector< art::InputTag > inputCollectionTags_
ProducesCollector & producesCollector() noexcept
Contains data associated to particles from detector simulation.
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
std::string find_file(std::string const &filename) const
EventNumber_t event() const
void beginRun(art::Run &r) override
larg4Main(fhicl::ParameterSet const &p)
void setPtrInfo(art::ProductID pid, art::EDProductGetter const *productGetter)
cet::coded_exception< error, detail::translate > exception
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.