#include "RunAction.hh"
#include "G4Run.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"

RunAction::RunAction()
{
  runIDcounter = 0;
 
}

RunAction::~RunAction()
{
}

void RunAction::BeginOfRunAction(const G4Run* aRun)
{
  N=0;
  
  ((G4Run *)(aRun))->SetRunID(runIDcounter++);
  
  G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;

  //   G4UImanager* UI = G4UImanager::GetUIpointer();
  //     G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();

  //  if(pVVisManager)  UI->ApplyCommand("/vis/scene/notifyHandlers");
   

}


void RunAction::EndOfRunAction(const G4Run* aRun)
{
  
  //    if (G4VVisManager::GetConcreteInstance()) 
  //       G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");    
   
  G4cout << "number of event=" << aRun->GetNumberOfEvent() << G4endl;
  N=0;
}

// 2005 by G.I.Vasilyev
