W pliku
MyRun.cc (zmiany kolorem czerwonym)
#include "MyAnalysis.hh"
............................................................................................
void
MyRun::RecordEvent(const G4Event* evt)
{
...............................................................................................
frunHitsMap += *hitsMap;
G4THitsCollection<MyPhotonHit>* photonCollection =
dynamic_cast<G4THitsCollection<MyPhotonHit>*>
(hce->GetHC(fCollectionId));
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
for( G4int i = 0; i< photonCollection->entries();
i++) {
float e =
(*photonCollection)[i]->GetEnergy()/MeV;
float x =
(*photonCollection)[i]->GetPosition().x()/cm;
float y =
(*photonCollection)[i]->GetPosition().y()/cm;
float z =
(*photonCollection)[i]->GetPosition().z()/cm;
analysisManager->FillNtupleDColumn(0,e);
analysisManager->FillNtupleDColumn(1,x);
analysisManager->FillNtupleDColumn(2,y);
analysisManager->FillNtupleDColumn(3,z);
analysisManager->AddNtupleRow();
}
/**
for( G4int i = 0; i<
photonCollection->entries(); i++)
G4cout << "MyLog:
energy and position of photon: "
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
W pliku
MyRunAction.cc (zmiany kolorem czerwonym)
void MyRunAction::BeginOfRunAction(const G4Run* aRun)
{
...............................................................................................
//analysisManager->SetFirstHistoId(1);
analysisManager->SetFirstNtupleId(1);
analysisManager->OpenFile("tree.root");
//G4int idPhotonFlux = analysisManager->CreateH1("PhotonFlux","photon flow",15,0.,90.);
analysisManager->CreateNtuple("PhotonCollection","Kolekcja fotonow");
analysisManager->CreateNtupleDColumn("E");
analysisManager->CreateNtupleDColumn("X");
analysisManager->CreateNtupleDColumn("Y");
analysisManager->CreateNtupleDColumn("Z");
analysisManager->FinishNtuple();
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
void MyRunAction::EndOfRunAction(const G4Run* aRun)
{
...............................................................................................
/*
G4int idPhotonFlux = analysisManager->GetH1Id("PhotonFlux");
MyRun* theRun = (MyRun*) aRun;
G4cout << "MyLog: number of map entries in run: " << theRun->frunHitsMap.entries() << G4endl;
std::map::iterator iter;
iter = theRun->frunHitsMap.GetMap()->begin();
while( iter != theRun->frunHitsMap.GetMap()->end() ) {
// Fill histagrams as weighted events
analysisManager->FillH1(idPhotonFlux, (iter->first+0.5)*90./15. , *iter->second);
G4cout<< "MyLog: value of HitsMap for run: "<< *iter->second << " index of value: "<< iter->first << G4endl;
iter++;
}
*/