W pliku GNUmakefile  (zmiany kolorem czerwonym)


name := My
G4TARGET := $(name)
G4EXLIB := true
G4WORKDIR :=.


.PHONY: all
all:  lib bin

CPPFLAGS += -I$(ROOTSYS)/include
EXTRALIBS = $(shell root-config --glibs)

include $(G4INSTALL)/config/binmake.gmk

ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

W pliku MyRunAction  (zmiany kolorem czerwonym)


....................................................................................................................................
#include "MyRun.hh"
#include "globals.hh"
#include "TH1.h"
#include "TFile.h"

.....................................................................................................................................

void MyRunAction::EndOfRunAction(const G4Run* aRun)
{
 
//..Output file for histograms
  TFile   *HistFile = new TFile("hist.root","RECREATE");

//..histograms definitions
  TH1D  *PhotonFlux = new TH1D("PhotonFlux","photon flow versus theta ",15,0.,90.);
 
  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() ) {

//..set histogram content
  PhotonFlux->SetBinContent(iter->first+1,*iter->second);
 
  G4cout<< "MyLog:      value of HitsMap for run: "<< *iter->second << " index of value: "<< iter->first << G4endl;
  iter++;
  }
 
//.. write histograms and close the file
   HistFile->Write();
   HistFile->Close();

....................................................................................................................