LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
MCTruthEventAction_service.h
Go to the documentation of this file.
1 // MCTruthEventAction is the service that injects particles into
2 // the simulation.
3 // To use this action, all you need to do is put it in the services section
4 // of the configuration file, like this:
5 //
6 // services: {
7 // ...
8 // MCTruthEventAction: {}
9 // ...
10 // }
11 // Expected parameters:
12 // - name (string): A name describing the action service.
13 // Default is 'exampleParticleGun'
14 
15 // Include guard
16 #ifndef MCTRUTHEVENTACTION_SERVICE_HH
17 #define MCTRUTHEVENTACTION_SERVICE_HH
18 
20 
22 
25 
26 namespace fhicl {
27  class ParameterSet;
28 }
29 
30 #include "Geant4/G4Types.hh"
31 
32 class G4Event;
33 class G4ParticleTable;
34 
35 #include <map>
36 #include <vector>
37 
38 namespace larg4 {
39 
41  public:
44 
45  void setInputCollections(std::vector<art::Handle<std::vector<simb::MCTruth>>> const& mclists)
46  {
47  fMCLists = &mclists;
48  }
49 
50  private:
51  // To generate primaries, we need to overload the GeneratePrimaries
52  // method.
53 
54  void generatePrimaries(G4Event* anEvent) override;
55 
56  static G4ParticleTable* fParticleTable;
57  std::vector<art::Handle<std::vector<simb::MCTruth>>> const*
59  std::map<G4int, G4int> fUnknownPDG;
60  std::map<G4int, G4int> fNon1StatusPDG;
61  std::map<G4int, G4int> fProcessedPDG;
62  };
63 } //namespace larg4
64 
66 
67 #endif // MCTRUTHEVENTACTION_SERVICE_HH
static G4ParticleTable * fParticleTable
Geant4&#39;s table of particle definitions.
Geant4 interface.
std::vector< art::Handle< std::vector< simb::MCTruth > > > const * fMCLists
MCTruthCollection input lists.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:289
void setInputCollections(std::vector< art::Handle< std::vector< simb::MCTruth >>> const &mclists)
#define DECLARE_ART_SERVICE(svc, scope)
parameter set interface
std::map< G4int, G4int > fProcessedPDG
PDG codes processed.
std::map< G4int, G4int > fNon1StatusPDG
PDG codes skipped because not status 1.
std::map< G4int, G4int > fUnknownPDG
map of unknown PDG codes to instances