W
pliku MyRun.hh (zmiany kolorem czerwonym)
............................................................
#include "G4Run.hh"
#include "G4THitsMap.hh"
....................................................................
//Data
G4int fMapId;
G4THitsMap<G4double> frunHitsMap;
};
oooooooooooooooooooooooooooooooooooooooooooooooooooooooo
W pliku
MyRun.cc (zmiany kolorem czerwonym)
............................................................
void MyRun::RecordEvent(const
G4Event* evt)
{
numberOfEvent++;
G4HCofThisEvent* hce = evt->GetHCofThisEvent();
G4THitsMap<G4double>* hitsMap =
(G4THitsMap<G4double>*) (hce->GetHC(fMapId));
frunHitsMap +=
*hitsMap;
/**
G4cout << "MyLog: number of entries " <<
hitsMap->entries() << G4endl;
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
W pliku MyRunAction.cc
(zmiany kolorem czerwonym)
............................................................
void MyRunAction::EndOfRunAction(const G4Run* aRun)
{
MyRun* theRun = (MyRun*) aRun;
G4cout
<< "MyLog: number of map entries in run: " <<
theRun->frunHitsMap.entries() << G4endl;
std::map<int,double*>::iterator iter;
iter =
theRun->frunHitsMap.GetMap()->begin();
while(
iter != theRun->frunHitsMap.GetMap()->end() ) {
G4cout<< "MyLog: value of
HitsMap for run: "<< *iter->second << " index of
value: "<< iter->first << G4endl;
iter++;
}
G4cout <<"MyLog: Number of processed
events:" << aRun->GetNumberOfEvent()
.............................................................................................................