//
// ********************************************************************
// * DISCLAIMER                                                       *
// *                                                                  *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in:                      *
// *   http://cern.ch/geant4/license                                  *
// *                                                                  *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work  make  any representation or  warranty, express or implied, *
// * regarding  this  software system or assume any liability for its *
// * use.                                                             *
// *                                                                  *
// * 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: SteppingAction.cc,v 1.1 2003/06/23 16:16:34 maire Exp $
// GEANT4 tag $Name: geant4-08-00-patch-01 $
//
// 

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

#include "SteppingAction.hh"
#include "EventAction.hh"
#include "G4SteppingManager.hh"
//#include "iostream.h"

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

SteppingAction::SteppingAction(EventAction* EvAct)
:eventAction(EvAct),myVerbose(NULL)
{ }

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

SteppingAction::~SteppingAction()
{ }

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void SteppingAction::UserSteppingAction(const G4Step* aStep)
{
  if( aStep->GetTrack()->GetNextVolume() != 0 ) {
    G4String PosVol = aStep->GetTrack()->GetNextVolume()->GetName();
    G4String PreVol = aStep->GetTrack()->GetVolume()->GetName();
    G4String pName = aStep->GetTrack()->GetDefinition()->GetParticleName();
    G4ThreeVector x = aStep->GetPostStepPoint()->GetPosition();
    G4double e = aStep->GetTrack()->GetTotalEnergy();
    G4ThreeVector p = aStep->GetTrack()->GetMomentum();
    G4double angle = p.x() / e;

    if( PreVol == "BeampipePhysical" && PosVol == "WorldPhysical" && pName == "e-" && ( angle < -0.001 || angle > 0.001 ) && e > 10.0 ) {
      G4cout << " " << p.x()/e << " " << p.y()/e << " " << p.z()/e << " " << e << " " << G4endl;
      } 
  }
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......


