// 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: ExN02EventAction.cc,v 1.4 2000/01/24 14:45:51 stesting Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//////////////////////////////////////////////////////////////////////
//
//  Modified: 31-01-2006  J.L. Tain --> testEventAction.cc
//
//  Collects the energy deposited in the sensitive volumes
// 
/////////////////////////////////////////////////////////////////////

#include "testEventAction.hh"

#include "testRunAction.hh"

#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4UnitsTable.hh"

#include "globals.hh"
#include "G4ios.hh"


testEventAction::testEventAction(testRunAction* RunAct)
:runAction(RunAct)
{}

testEventAction::~testEventAction()
{}

void testEventAction::BeginOfEventAction(const G4Event*)
{

  TotalEnergyDeposit = 0.; 

}

void testEventAction::EndOfEventAction(const G4Event* evt)
{

  if(TotalEnergyDeposit > 0.){

    // fill histograms
    runAction-> fillHistogram(TotalEnergyDeposit);

  }

}

void testEventAction::addEdep(G4double Edep)
{

  TotalEnergyDeposit += Edep;

}
