Skip to content
Snippets Groups Projects
Commit 835a0d5d authored by Shaojun Lu's avatar Shaojun Lu
Browse files

Overload function 'Geant4HitData::extractContribution' with 'bool...

  Overload function 'Geant4HitData::extractContribution' with 'bool ApplyBirksLaw' for extracting the MC contribution for a given hit from the step information with BirksLaw effect option. 
parent 76972696
No related branches found
No related tags found
No related merge requests found
...@@ -179,6 +179,8 @@ namespace DD4hep { ...@@ -179,6 +179,8 @@ namespace DD4hep {
virtual ~Geant4HitData(); virtual ~Geant4HitData();
/// Extract the MC contribution for a given hit from the step information /// Extract the MC contribution for a given hit from the step information
static Contribution extractContribution(const G4Step* step); static Contribution extractContribution(const G4Step* step);
/// Extract the MC contribution for a given hit from the step information with BirksLaw option
static Contribution extractContribution(const G4Step* step, bool ApplyBirksLaw);
}; };
/// Helper class to define structures used by the generic DDG4 tracker sensitive detector /// Helper class to define structures used by the generic DDG4 tracker sensitive detector
......
...@@ -70,6 +70,18 @@ Geant4HitData::Contribution Geant4HitData::extractContribution(const G4Step* ste ...@@ -70,6 +70,18 @@ Geant4HitData::Contribution Geant4HitData::extractContribution(const G4Step* ste
Contribution contrib(h.trkID(),h.trkPdgID(),deposit,h.trkTime(),pos); Contribution contrib(h.trkID(),h.trkPdgID(),deposit,h.trkTime(),pos);
return contrib; return contrib;
} }
/// Extract the MC contribution for a given hit from the step information with BirksLaw effect option
Geant4HitData::Contribution Geant4HitData::extractContribution(const G4Step* step, bool ApplyBirksLaw) {
Geant4StepHandler h(step);
if ( ApplyBirksLaw == true ) h.doApplyBirksLaw();
double deposit =
(h.trackDef() == G4OpticalPhoton::OpticalPhotonDefinition()) ? h.trkEnergy() : h.totalEnergy();
const G4ThreeVector& pre = h.prePosG4();
const G4ThreeVector& post = h.postPosG4();
float pos[] = {float((pre.x()+post.x())/2.0),float((pre.y()+post.y())/2.0),float((pre.z()+post.z())/2.0) };
Contribution contrib(h.trkID(),h.trkPdgID(),deposit,h.trkTime(),pos);
return contrib;
}
/// Default constructor /// Default constructor
Geant4Tracker::Hit::Hit() Geant4Tracker::Hit::Hit()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment