From eb3ed03c304849c80a8eea053b9ca64f1dd8547f Mon Sep 17 00:00:00 2001 From: Kamil Sedlak Date: Thu, 27 Jan 2011 14:37:33 +0000 Subject: [PATCH] 27.1.2011 Kamil Sedlak A new class "musrStackingAction" added (was forgotten during the last commit) --- include/musrStackingAction.hh | 45 ++++++++++++++++++++++ src/musrStackingAction.cc | 70 +++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 include/musrStackingAction.hh create mode 100644 src/musrStackingAction.cc diff --git a/include/musrStackingAction.hh b/include/musrStackingAction.hh new file mode 100644 index 0000000..25cc3f5 --- /dev/null +++ b/include/musrStackingAction.hh @@ -0,0 +1,45 @@ +/*************************************************************************** + * musrSim - the program for the simulation of (mainly) muSR instruments. * + * More info on http://lmu.web.psi.ch/simulation/index.html . * + * musrSim is based od Geant4 (http://geant4.web.cern.ch/geant4/) * + * * + * Copyright (C) 2009 by Paul Scherrer Institut, 5232 Villigen PSI, * + * Switzerland * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * + ***************************************************************************/ +#ifndef musrStackingAction_h +#define musrStackingAction_h 1 + +#include "globals.hh" +#include "G4UserStackingAction.hh" + + +class musrStackingAction : public G4UserStackingAction +{ + public: + musrStackingAction(); + ~musrStackingAction(); + G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack); + void NewStage(); + void PrepareNewEvent(); + + private: + G4int opticalPhotonCounter; +}; + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +#endif diff --git a/src/musrStackingAction.cc b/src/musrStackingAction.cc new file mode 100644 index 0000000..359e46e --- /dev/null +++ b/src/musrStackingAction.cc @@ -0,0 +1,70 @@ +/*************************************************************************** + * musrSim - the program for the simulation of (mainly) muSR instruments. * + * More info on http://lmu.web.psi.ch/simulation/index.html . * + * musrSim is based od Geant4 (http://geant4.web.cern.ch/geant4/) * + * * + * Copyright (C) 2009 by Paul Scherrer Institut, 5232 Villigen PSI, * + * Switzerland * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * + ***************************************************************************/ + +#include "G4ParticleDefinition.hh" +#include "G4ParticleTypes.hh" +#include "G4Track.hh" +#include "G4ios.hh" +#include "musrStackingAction.hh" +#include "musrParameters.hh" +#include "musrErrorMessage.hh" +#include "musrRootOutput.hh" + + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +musrStackingAction::musrStackingAction() +: opticalPhotonCounter(0) +{ + //std::cout<<" DEBUG KAMIL: StackingAction() called"<GetDefinition() == G4OpticalPhoton::OpticalPhotonDefinition()) { + opticalPhotonCounter++; + } + return fUrgent; +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +void musrStackingAction::NewStage() { + // G4cout << "Number of optical photons produces in this event : " + // << opticalPhotonCounter << G4endl; + musrRootOutput::GetRootInstance()->SetNOptPhot(opticalPhotonCounter); +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +void musrStackingAction::PrepareNewEvent() +{ + opticalPhotonCounter = 0; +}