// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: ExN02SteppingAction.cc,v 1.3 1999/12/15 14:49:22 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
/////////////////////////////////////////////////////////////////////
//
//  Modified: 31-01-2006  J.L. Tain  --> testSteppingAction.cc
//
//  Collect the energy deposited in the sensitive test volume
//

#include "testSteppingAction.hh"
#include "testEventAction.hh"
#include "G4SteppingManager.hh"

testSteppingAction::testSteppingAction(testEventAction* EvAct) 
:eventAction(EvAct)
{ }

testSteppingAction::~testSteppingAction()
{ }

void testSteppingAction::UserSteppingAction(const G4Step* aStep)
{
  // collect the energy deposited in the sensitive volume
  
  const G4String currentPhysicalName 
    = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName();


  if (currentPhysicalName == "Detector"){
    G4double EdepStep = aStep->GetTotalEnergyDeposit();
    if (EdepStep > 0.) eventAction->addEdep(EdepStep);
   } 

}


