//
// ********************************************************************
// * 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)
{
 G4double EdepStep = aStep->GetTotalEnergyDeposit();
 if (EdepStep > 0.) eventAction->addEdep(EdepStep);

 /* G4double am = aStep->GetTrack()->GetDefinition()->GetPDGMass();
 if(am > 0.6) {
   if(aStep->GetTrack()->GetNextVolume()) {
     G4String PreVol = aStep->GetTrack()->GetVolume()->GetName();
     G4String PosVol = aStep->GetTrack()->GetNextVolume()->GetName();
     if( PreVol == "BeampipePhysical" && PosVol == "WorldPhysical") {
       G4String pName = aStep->GetTrack()->GetDefinition()->GetParticleName();
       G4double energy = aStep->GetTrack()->GetKineticEnergy();
       cout << eventAction->evtNb << "  " <<  am << "  " << energy << " " << endl;
     }
   }
   } */

     G4String PreVol = aStep->GetTrack()->GetVolume()->GetName();
     G4String PosVol = aStep->GetTrack()->GetNextVolume()->GetName();
     /*     if( PreVol == "BeampipePhysical" && PosVol == "WorldPhysical") {
       G4String pName = aStep->GetTrack()->GetDefinition()->GetParticleName();
       G4double e = aStep->GetTrack()->GetTotalEnergy();
       G4ThreeVector p = aStep->GetTrack()->GetMomentum();
       G4double angle = p.x() / e;
       // if( angle > 0.005)
	 cout << pName << " " << p << " " << e << " " << endl; 
       
	 // if( angle < 0.005)
	 // cout << pName << " " << p << " " << e << " " << endl; 
      
	 } */
}

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


