LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
KillerAction.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 // KillerActionService.cc: example artg4tk stacking action that allows to
13 // liik certain particles of interest ((p0, eta, gamma from nCapture)
14 // To use this, all you need to do is put it in the services section
15 // of the configuration file, like this:
16 //
17 // services: {
18 // ...
19 // user: {
20 // KillerAction : {name: "KillerAction"
21 // killPi0: true
22 // killeta: false
23 // killGammafromnCapture: false
24 // }
25 // . ..
26 // }
27 // }
28 // Author: Hans Wenzel (Fermilab)
29 //=============================================================================
30 
32 
33 // G4 includes
34 #include "Geant4/G4Track.hh"
35 #include "Geant4/G4VProcess.hh"
36 
37 using std::string;
38 
40  : StackingActionBase(p.get<string>("name", "myKillerAction"))
41  , killPi0(p.get<bool>("killPi0"))
42  , killeta(p.get<bool>("killeta"))
43  , killGammafromnCapture(p.get<bool>("killGammafromnCapture"))
44  , logInfo_("KillerAction")
45 {
46  // Register ourselves with the ActionHolder
47  // art::ServiceHandle<ActionHolderService> actionHolder;
48 }
49 
50 bool
52 {
53  if (aTrack->GetParentID() == 0)
54  return false;
55  if (aTrack->GetDefinition()->GetParticleName() == "pi0") {
56  if (killPi0) {
57  return true;
58  }
59  }
60  if (aTrack->GetDefinition()->GetParticleName() == "eta") {
61  if (killeta) {
62  return true;
63  }
64  }
65  if (aTrack->GetDefinition()->GetParticleName() == "gamma") {
66  if (aTrack->GetCreatorProcess()->GetProcessName() == "nCapture") {
68  return true;
69  }
70  }
71  }
72  return false;
73 }
74 // Destructor
75 
KillerActionService(fhicl::ParameterSet const &)
Definition: KillerAction.cc:39
bool killNewTrack(const G4Track *aTrack) override
Definition: KillerAction.cc:51
decltype(auto) get(T &&obj)
ADL-aware version of std::to_string.
Definition: StdUtils.h:120