LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
HepevtInputAction.cc
Go to the documentation of this file.
1 //
2 // __ __ __ __ __
3 // ____ ______/ /_____ _/ // / / /_/ /__
4 // / __ `/ ___/ __/ __ `/ // /_/ __/ //_/
5 // / /_/ / / / /_/ /_/ /__ __/ /_/ ,<
6 // \__,_/_/ \__/\__, / /_/ \__/_/|_|
7 // /____/
8 //
9 // artg4tk: art based Geant 4 Toolkit
10 //
11 //=============================================================================
12 // This file provides the implementation for an action object that produces
13 // the primary particles using a pythia generated Hepevt event as input
14 // ParticleGunActionService.hh: art wrapper for G4ParticleGun
15 // To use this, all you need to do is put it in the services section
16 // of the configuration file, like this:
17 //
18 // services: {
19 // ...
20 // user: {
21 // HepevtInputAction: {
22 // name: "HepevtInput"
23 // FileName: "pythia_event.data"
24 // }
25 // . ..
26 // }
27 // }
28 // Authors: Tasha Arvanitis, Adam Lyon
29 // Date: August 2012
30 //=============================================================================
31 
32 // Framework includes
33 #include "fhiclcpp/ParameterSet.h"
35 
36 // artg4tk includes
38 
39 // Geant4 includes
40 #include "Geant4/G4HEPEvtInterface.hh"
41 
43  : PrimaryGeneratorActionBase(p.get<std::string>("name", "HepevtInput"))
44  , fileName_(p.get<std::string>("FileName"))
45 {}
46 
47 void
49 {
50  mf::LogInfo("HepevtInputAction") << "Initializing Hepevt Input";
51  HEPEvt_ = std::make_unique<G4HEPEvtInterface>(fileName_.c_str());
52 }
53 
54 // Create a primary particle for an event!
55 // (Standard Art G4 simulation)
56 
57 void
59 {
60  HEPEvt_->GeneratePrimaryVertex(anEvent);
61 }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
STL namespace.
void generatePrimaries(G4Event *anEvent) override
std::unique_ptr< G4VPrimaryGenerator > HEPEvt_
HepevtInputActionService(fhicl::ParameterSet const &)
decltype(auto) get(T &&obj)
ADL-aware version of std::to_string.
Definition: StdUtils.h:120