From 1c87482c723c939d37833ea858714c10d9163e7c Mon Sep 17 00:00:00 2001 From: Shaojun Lu <shaojun.lu@desy.de> Date: Thu, 28 May 2015 15:26:45 +0000 Subject: [PATCH] Added a BirksLaw function from Geant4 G4EmSaturation into DDG4 Geant4StepHandler. It may be called within function 'totalEnery()' for each G4Step. --- DDG4/include/DDG4/Geant4StepHandler.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/DDG4/include/DDG4/Geant4StepHandler.h b/DDG4/include/DDG4/Geant4StepHandler.h index 6d47a0f8b..1eb4cebf1 100644 --- a/DDG4/include/DDG4/Geant4StepHandler.h +++ b/DDG4/include/DDG4/Geant4StepHandler.h @@ -17,6 +17,7 @@ #include "G4StepPoint.hh" #include "G4VTouchable.hh" #include "G4VSensitiveDetector.hh" +#include "G4EmSaturation.hh" /// Namespace for the AIDA detector description toolkit @@ -195,6 +196,24 @@ namespace DD4hep { Position localToGlobal(const G4ThreeVector& local) const; /// Coordinate transformation to global coordinates in MM Position localToGlobal(double x, double y, double z) const; + /// Apply BirksLaw + double BirkAttenuation(const G4Step* aStep) const + { + double energyDeposition = aStep->GetTotalEnergyDeposit(); + double length = aStep->GetStepLength(); + double niel = aStep->GetNonIonizingEnergyDeposit(); + const G4Track* track = aStep->GetTrack(); + const G4ParticleDefinition* particle = track->GetDefinition(); + const G4MaterialCutsCouple* couple = track->GetMaterialCutsCouple(); + G4EmSaturation* emSaturation = new G4EmSaturation(); + double engyVis = emSaturation->VisibleEnergyDeposition(particle, + couple, + length, + energyDeposition, + niel); + delete emSaturation; + return engyVis; + } }; } // End namespace Simulation -- GitLab