diff --git a/include/OpNoviceEventAction.hh b/include/OpNoviceEventAction.hh new file mode 100644 index 0000000000000000000000000000000000000000..d86905d144908214a659f40b9153e11428d40b2e --- /dev/null +++ b/include/OpNoviceEventAction.hh @@ -0,0 +1,50 @@ +// +// ******************************************************************** +// * License and Disclaimer * +// * * +// * The Geant4 software is copyright of the Copyright Holders of * +// * the Geant4 Collaboration. It is provided under the terms and * +// * conditions of the Geant4 Software License, included in the file * +// * LICENSE and available at http://cern.ch/geant4/license . These * +// * include a list of copyright holders. * +// * * +// * Neither the authors of this software system, nor their employing * +// * institutes,nor the agencies providing financial support for this * +// * work make any representation or warranty, express or implied, * +// * regarding this software system or assume any liability for its * +// * use. Please see the license in the file LICENSE and URL above * +// * for the full disclaimer and the limitation of liability. * +// * * +// * This code implementation is the result of the scientific and * +// * technical work of the GEANT4 collaboration. * +// * By using, copying, modifying or distributing the software (or * +// * any work based on the software) you agree to acknowledge its * +// * use in resulting scientific publications, and indicate your * +// * acceptance of all terms of the Geant4 Software license. * +// ******************************************************************** +// @Author Chad Lantz +#ifndef OpNoviceEventAction_H +#define OpNoviceEventAction_H 1 + +#include "globals.hh" +#include "G4UserEventAction.hh" + + +class OpNoviceEventAction : public G4UserEventAction{ + public: + OpNoviceEventAction(); + virtual ~OpNoviceEventAction(); + + virtual void BeginOfEventAction( const G4Event* event ); + virtual void EndOfEventAction( const G4Event* event ); + + private: + + G4THitsMap<G4double>* GetHitsCollection ( G4int hcID, const G4Event* event ) const; + G4double GetSum ( G4THitsMap<G4double>* hitsMap ) const; + void PrintEventStatistics( G4double absoEdep, G4double absoTrackLength, G4double gapEdep, G4double gapTrackLength ) const; + + G4int hitsCollID; +}; + +#endif diff --git a/src/OpNoviceEventAction.cc b/src/OpNoviceEventAction.cc new file mode 100644 index 0000000000000000000000000000000000000000..17a204836cee4b2471374a9ffa4af224ae22ec3d --- /dev/null +++ b/src/OpNoviceEventAction.cc @@ -0,0 +1,64 @@ +// ******************************************************************** +// * License and Disclaimer * +// * * +// * The Geant4 software is copyright of the Copyright Holders of * +// * the Geant4 Collaboration. It is provided under the terms and * +// * conditions of the Geant4 Software License, included in the file * +// * LICENSE and available at http://cern.ch/geant4/license . These * +// * include a list of copyright holders. * +// * * +// * Neither the authors of this software system, nor their employing * +// * institutes,nor the agencies providing financial support for this * +// * work make any representation or warranty, express or implied, * +// * regarding this software system or assume any liability for its * +// * use. Please see the license in the file LICENSE and URL above * +// * for the full disclaimer and the limitation of liability. * +// * * +// * This code implementation is the result of the scientific and * +// * technical work of the GEANT4 collaboration. * +// * By using, copying, modifying or distributing the software (or * +// * any work based on the software) you agree to acknowledge its * +// * use in resulting scientific publications, and indicate your * +// * acceptance of all terms of the Geant4 Software license. * +// ******************************************************************** +// +// @Author Chad Lantz +#include "OpNoviceEventAction.hh" + +#include "G4VProcess.hh" + +#include "G4ParticleDefinition.hh" +#include "G4ParticleTypes.hh" +#include "G4Track.hh" +#include "G4ios.hh" + + +OpNoviceEventgAction::OpNoviceStackingAction() + : G4UserEventAction(), + hitsCollID(0){ + +} + + +OpNoviceEventAction::~OpNoviceStackingAction(){ + +} + + +void OpNoviceEventAction::BeginOfEventAction(const G4Event* event){ + fEventNo = evt->GetEventID(); + // G4SDManager * SDman = G4SDManager::GetSDMpointer(); + hitsCollID = 0; +} + + +void OpNoviceEventAction::EndOfEventAction(const G4Event* event){ + + G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); + // fill ntuple // + analysisManager->FillNtupleDColumn(0, absoEdep); + analysisManager->FillNtupleDColumn(1, gapEdep); + analysisManager->FillNtupleDColumn(2, absoTrackLength); + analysisManager->FillNtupleDColumn(3, gapTrackLength); + analysisManager->AddNtupleRow(); +}