MyTrackerHit.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
15 #include "MyTrackerHit.h"
16 #include "G4Track.hh"
17 
18 using namespace SomeExperiment;
19 
22  if ( &c != this ) {
23  position = c.position;
24  momentum = c.momentum;
25  length = c.length;
26  truth = c.truth;
27  }
28  return *this;
29 }
30 
33  position.SetXYZ(0, 0, 0);
34  momentum.SetXYZ(0, 0, 0);
35  length = 0.0;
36  truth.clear();
37  return *this;
38 }
39 
41 MyTrackerHit& MyTrackerHit::storePoint(const G4Step* step, const G4StepPoint* pnt) {
42  G4Track* trk = step->GetTrack();
43  G4ThreeVector pos = pnt->GetPosition();
44  G4ThreeVector mom = pnt->GetMomentum();
45 
46  truth.trackID = trk->GetTrackID();
47  truth.pdgID = trk->GetDefinition()->GetPDGEncoding();
48  truth.deposit = step->GetTotalEnergyDeposit();
49  truth.time = trk->GetGlobalTime();
50  position.SetXYZ(pos.x(), pos.y(), pos.z());
51  momentum.SetXYZ(mom.x(), mom.y(), mom.z());
52  length = 0;
53  return *this;
54 }
MyTrackerHit & storePoint(const G4Step *step, const G4StepPoint *pnt)
Store Geant4 point and step information into tracker hit structure.
This is the hit definition.
Definition: MyTrackerHit.h:39
double length
Length of the track segment contributing to this hit.
Definition: MyTrackerHit.h:55
dd4hep::Direction momentum
Hit direction.
Definition: MyTrackerHit.h:53
Framework include files.
Definition: MyTrackerHit.h:19
MyTrackerHit & clear()
Clear hit content.
dd4hep::sim::Geant4HitData::MonteCarloContrib truth
Monte Carlo / Geant4 information.
Definition: MyTrackerHit.h:57
MyTrackerHit & operator=(const MyTrackerHit &c)
Assignment operator.
dd4hep::Position position
Hit position.
Definition: MyTrackerHit.h:51