LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
G4Interaction.hh
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 // G4Interaction.hh: holds outcome of an interaction + checks if 1st interaction or not
13 // Author: Julia Yarba (Fermilab)
14 //=============================================================================
15 #ifndef artg4tk_DataProducts_G4DetectorHits_G4Interaction_hh
16 #define artg4tk_DataProducts_G4DetectorHits_G4Interaction_hh
17 
18 #include "Geant4/G4VParticleChange.hh"
19 
20 class G4Interaction : public G4VParticleChange {
21 
22 public:
24  G4Interaction(bool isFirst) : fIsFirstInter(isFirst), fIncomingTrack(0) {}
25  virtual ~G4Interaction()
26  {
27  if (fIncomingTrack)
28  delete fIncomingTrack;
29  fIncomingTrack = 0;
30  }
31 
32  void
34  {
35  if (fIncomingTrack)
36  delete fIncomingTrack;
37  fIncomingTrack = new G4Track(*trk);
38  fIncomingTrack->SetTouchableHandle(trk->GetTouchableHandle());
39  fIncomingTrack->SetStep(new G4Step(*(trk->GetStep())));
40  return;
41  }
42  bool
44  {
45  return fIsFirstInter;
46  }
47  const G4Track*
49  {
50  return fIncomingTrack;
51  }
52 
53 private:
55  G4Track* fIncomingTrack;
56 };
57 
58 #endif /* artg4tk_DataProducts_G4DetectorHits_G4Interaction_hh */
const G4Track * GetIncomingTrack() const
virtual ~G4Interaction()
G4Track * fIncomingTrack
G4Interaction(bool isFirst)
void SetIncomingTrack(G4Track *trk)
bool IsFirstInteraction() const