//Handles events in reactor #include "ReactorEventAction.hh" #include "ReactorEventActionMessenger.hh" #ifdef G4ANALYSIS_USE #include "ReactorAnalysisManager.hh" #endif // G4ANALYSIS_USE #include "G4Event.hh" #include "G4EventManager.hh" #include "G4HCofThisEvent.hh" #include "G4VHitsCollection.hh" #include "G4TrajectoryContainer.hh" #include "G4Trajectory.hh" #include "G4VVisManager.hh" #include "G4SDManager.hh" #include "G4UImanager.hh" #include "G4ios.hh" #include "ReactorDetectorHit.hh" //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ReactorEventAction::ReactorEventAction() { G4cout << "ReactorEventActionCreated"; G4String colName; G4SDManager* SDman = G4SDManager::GetSDMpointer(); RDCID = SDman->GetCollectionID(colName="reactorDetector/detectorColl"); //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ verboseLevel = 1; messenger = new ReactorEventActionMessenger(this); #ifdef G4ANALYSIS_USE plotter = 0; rdHits = 0; rdXY = evstof = 0; // Do some analysis ReactorAnalysisManager* analysisManager = ReactorAnalysisManager::getInstance(); IHistogramFactory* hFactory = analysisManager->getHistogramFactory(); if (hFactory) { // Create some histograms rdHits = hFactory->createHistogram1D("Reactor Detector # Hits",10,0,10); // Create some clouds (Scatter Plots) rdXY = hFactory->createCloud2D("Reactor Detector X vs Y"); evstof = hFactory->createCloud2D("EDep vs Time-of-flight"); plotter = analysisManager->getPlotter(); if (plotter) { plotter->createRegions(3,2); plotter->region(0)->plot(*rdHits); plotter->region(1)->plot(*rdXY); plotter->region(3)->plot(*evstof); plotter->show(); } } #endif // G4ANALYSIS_USE } ReactorEventAction::~ReactorEventAction() { #ifdef G4ANALYSIS_USE ReactorAnalysisManager::dispose(); #endif // G4ANALYSIS_USE delete messenger; } void ReactorEventAction::BeginOfEventAction(const G4Event*) { } void ReactorEventAction::EndOfEventAction(const G4Event* evt) { G4HCofThisEvent* HCE = evt->GetHCofThisEvent(); ReactorDetectorHitsCollection* RDC = 0; if(HCE) { RDC= (ReactorDetectorHitsCollection*)(HCE->GetHC(RDCID)); } #ifdef G4ANALYSIS_USE // Fill some histograms if (RDC && rdHits) { int n_hit = RDC->entries(); rdHits->fill(n_hit); for(int i1=0;i1GetLocalPos(); if (rdXY) rdXY->fill(localPos.x(), localPos.y()); if (evstof) evstof->fill(aHit->GetTime(),aHit->GetEdep()); } } if (plotter) plotter->refresh(); #endif // G4ANALYSIS_USE if(RDC) { int n_hit = RDC->entries(); // G4cout << "The Reactor Detector has " << n_hit << " hits." << G4endl; for(int i1=0;i1Print(); } } }