Commit 3dd8d23f authored by Chad Lantz's avatar Chad Lantz
Browse files

Set the OPTICAL flag in stepping action in a better way

parent 983430f0
......@@ -61,6 +61,7 @@ class AnalysisManager
void MakeRPDOpticalTree( G4int nTupleNo, G4int rpdNo );
inline G4bool GetClusterFlag(){ return CLUSTER; }
inline G4bool GetOpticalFlag(){ return OPTICAL; }
inline std::vector< std::vector< std::vector<double> > >* GetRPDdoubleVectors( ){return m_RPDdblVec;}
inline std::vector< std::vector< std::vector< int > > >* GetRPDintVectors ( ){return m_RPDintVec;}
......@@ -71,7 +72,7 @@ class AnalysisManager
AnalysisManager();
static AnalysisManager* analysisManager;
G4bool m_FactoryOn;
G4bool CLUSTER;
G4bool CLUSTER, OPTICAL;
G4AnalysisManager* m_analysisManager;
DetectorConstruction* m_detectorConstruction;
std::vector< std::vector< std::vector<double> > > *m_ZDCdblVec, *m_RPDdblVec;
......
......@@ -43,6 +43,8 @@ class SteppingAction : public G4UserSteppingAction
SteppingAction();
virtual ~SteppingAction();
inline void SetOpticalFlag( G4bool arg ){ OPTICAL = arg; }
// method from the base class
virtual void UserSteppingAction(const G4Step*);
......
......@@ -29,6 +29,7 @@
/// \brief Implementation of the RunAction class
#include "RunAction.hh"
#include "SteppingAction.hh"
#include "G4RunManager.hh"
#include "G4Run.hh"
......@@ -59,6 +60,11 @@ void RunAction::BeginOfRunAction(__attribute__((unused)) const G4Run* run)
// Book the output file
m_analysisManager->Book();
// Hand the OPTICAL flag from analysis manager to Stepping action
SteppingAction* steppingAction
= (SteppingAction*)G4RunManager::GetRunManager()->GetUserSteppingAction();
steppingAction->SetOpticalFlag( m_analysisManager->GetOpticalFlag() );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
......
......@@ -43,15 +43,8 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::SteppingAction( )
: G4UserSteppingAction(){
// Get number of OPTICAL flag from DetectorConstruction
const DetectorConstruction* constDetectorConstruction
= static_cast<const DetectorConstruction*>(G4RunManager::GetRunManager()->GetUserDetectorConstruction());
DetectorConstruction* detectorConstruction
= const_cast<DetectorConstruction*>(constDetectorConstruction);
OPTICAL = detectorConstruction->GetOpticalFlag();
}
: G4UserSteppingAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
......@@ -73,8 +66,10 @@ void SteppingAction::UserSteppingAction(__attribute__((unused)) const G4Step* th
}
}
// If we are tracking a photon
if(theTrack->GetDefinition() == G4OpticalPhoton::OpticalPhotonDefinition() ){
// Get the SD for the volume we're in. Returns 0 if we aren't in an SD volume
FiberSD* sd = (FiberSD*)theTrack->GetVolume()->GetLogicalVolume()->GetSensitiveDetector();
// If World OPTICAL is on
if(OPTICAL){
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment