LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
larg4::VisualizationAction Class Reference

#include "VisualizationAction.h"

Inheritance diagram for larg4::VisualizationAction:
g4b::UserAction

Public Member Functions

 VisualizationAction ()
 
virtual ~VisualizationAction ()
 
virtual void BeginOfRunAction (const G4Run *)
 G4UserRunAction interfaces. More...
 
virtual void EndOfRunAction (const G4Run *)
 
virtual void BeginOfEventAction (const G4Event *)
 G4UserEventAction interfaces. More...
 
virtual void EndOfEventAction (const G4Event *)
 
G4double GetTrackEnergyCutoff () const
 Acessors, if we need them: More...
 
void SetTrackEnergyCutoff (const G4double e)
 
virtual void Config (fhicl::ParameterSet const &)
 Override Config() to extract any necessary parameters. More...
 
virtual void PrintConfig (std::string const &)
 Override PrintConfig() to print out current configuration. More...
 
virtual void PreTrackingAction (const G4Track *)
 G4UserTrackingAction interfaces. More...
 
virtual void PostTrackingAction (const G4Track *)
 
virtual void SteppingAction (const G4Step *)
 G4UserSteppingAction interface. More...
 
virtual bool ProvidesStacking ()
 
virtual G4ClassificationOfNewTrack StackClassifyNewTrack (const G4Track *)
 G4UserStackingAction interfaces. More...
 
virtual void StackNewStage ()
 
virtual void StackPrepareNewEvent ()
 
std::string const & GetName () const
 
void SetName (std::string const &name)
 

Private Attributes

G4double m_energyCutoff
 Don't draw particles with energies less than this cut. More...
 
G4bool m_drawNeutrals
 Whether or not to draw neutral tracks (default is no). More...
 

Detailed Description

Definition at line 37 of file VisualizationAction.h.

Constructor & Destructor Documentation

larg4::VisualizationAction::VisualizationAction ( )

Definition at line 33 of file VisualizationAction.cxx.

References sim::LArG4Parameters::DrawNeutrals(), m_drawNeutrals, m_energyCutoff, and sim::LArG4Parameters::VisualizationEnergyCut().

34  {
36  m_energyCutoff = lgp->VisualizationEnergyCut()*CLHEP::GeV;
38 
39  }
double VisualizationEnergyCut() const
G4bool m_drawNeutrals
Whether or not to draw neutral tracks (default is no).
G4double m_energyCutoff
Don't draw particles with energies less than this cut.
bool DrawNeutrals() const
larg4::VisualizationAction::~VisualizationAction ( )
virtual

Definition at line 41 of file VisualizationAction.cxx.

42  {
43  }

Member Function Documentation

void larg4::VisualizationAction::BeginOfEventAction ( const G4Event *  )
virtual

G4UserEventAction interfaces.

Reimplemented from g4b::UserAction.

Definition at line 63 of file VisualizationAction.cxx.

64  {}
void larg4::VisualizationAction::BeginOfRunAction ( const G4Run *  )
virtual

G4UserRunAction interfaces.

The following a list of methods that correspond to the available user action classes in Geant 4.0.1 and higher.

Reimplemented from g4b::UserAction.

Definition at line 45 of file VisualizationAction.cxx.

46  {
47  // If graphics is ON
48  if(G4VVisManager::GetConcreteInstance()){
49  G4cout << "Geant4 visualisation is ON" << G4endl;
50  G4UImanager* UI = G4UImanager::GetUIpointer();
51  UI->ApplyCommand("/tracking/storeTrajectory 1");
52  UI->ApplyCommand("/vis/scene/notifyhandlers");
53  }
54  }
virtual void g4b::UserAction::Config ( fhicl::ParameterSet const &  )
inlinevirtualinherited

Override Config() to extract any necessary parameters.

Reimplemented in altns::ExampleAction.

Definition at line 65 of file UserAction.h.

Referenced by g4b::UserAction::UserAction().

65 {};
void larg4::VisualizationAction::EndOfEventAction ( const G4Event *  a_event)
virtual

Reimplemented from g4b::UserAction.

Definition at line 66 of file VisualizationAction.cxx.

References m_drawNeutrals, and m_energyCutoff.

67  {
68  G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
69 
70  if (pVVisManager)
71  {
72  G4TrajectoryContainer* trajectoryContainer = a_event->GetTrajectoryContainer();
73  G4int n_trajectories = 0;
74  if (trajectoryContainer)
75  n_trajectories = trajectoryContainer->entries();
76 
77  for (G4int i=0; i < n_trajectories; i++)
78  {
79  G4VTrajectory* trajectory = (*trajectoryContainer)[i];
80 
81  // Only draw "interesting" trajectories, according to cuts
82  // and limits set by the user.
83 
84  G4bool drawThisTrack = false;
85  if ( trajectory->GetInitialMomentum().mag() > m_energyCutoff )
86  drawThisTrack = true;
87 
88  if ( ! m_drawNeutrals )
89  {
90  G4double charge = trajectory->GetCharge();
91  // electron-, muon-, and tau-neutrino codes:
92  if ( charge == 0 )
93  drawThisTrack = false;
94  }
95 
96  if ( drawThisTrack )
97  trajectory->DrawTrajectory();
98  //trajectory->DrawTrajectory(50);
99  }
100  }
101  }
G4bool m_drawNeutrals
Whether or not to draw neutral tracks (default is no).
G4double m_energyCutoff
Don&#39;t draw particles with energies less than this cut.
void larg4::VisualizationAction::EndOfRunAction ( const G4Run *  )
virtual

Reimplemented from g4b::UserAction.

Definition at line 56 of file VisualizationAction.cxx.

57  {
58  // If graphics is ON
59  if (G4VVisManager::GetConcreteInstance())
60  G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
61  }
std::string const& g4b::UserAction::GetName ( ) const
inlineinherited

Definition at line 98 of file UserAction.h.

References g4b::UserAction::myName.

Referenced by g4b::UserActionManager::PrintActionList().

98 { return myName; }
std::string myName
self-knowledge
Definition: UserAction.h:101
G4double larg4::VisualizationAction::GetTrackEnergyCutoff ( ) const
inline

Acessors, if we need them:

Definition at line 49 of file VisualizationAction.h.

References m_energyCutoff.

49 {return m_energyCutoff;}
G4double m_energyCutoff
Don&#39;t draw particles with energies less than this cut.
virtual void g4b::UserAction::PostTrackingAction ( const G4Track *  )
inlinevirtualinherited

Reimplemented in larg4::ParticleListAction, and altns::ExampleAction.

Definition at line 83 of file UserAction.h.

83 {};
virtual void g4b::UserAction::PreTrackingAction ( const G4Track *  )
inlinevirtualinherited

G4UserTrackingAction interfaces.

Reimplemented in larg4::ParticleListAction, and altns::ExampleAction.

Definition at line 82 of file UserAction.h.

82 {};
virtual void g4b::UserAction::PrintConfig ( std::string const &  )
inlinevirtualinherited

Override PrintConfig() to print out current configuration.

Reimplemented in altns::ExampleAction.

Definition at line 68 of file UserAction.h.

Referenced by g4b::UserActionManager::PrintActionList().

68 {};
virtual bool g4b::UserAction::ProvidesStacking ( )
inlinevirtualinherited

Does this UserAction do stacking? Override to return "true" if the following interfaces are implemented

Reimplemented in altns::ExampleAction.

Definition at line 90 of file UserAction.h.

Referenced by g4b::UserActionManager::PrintActionList().

90 { return false; }
void g4b::UserAction::SetName ( std::string const &  name)
inlineinherited

Definition at line 99 of file UserAction.h.

References g4b::UserAction::myName.

Referenced by g4b::UserActionFactory::GetUserAction().

99 { myName = name; }
std::string myName
self-knowledge
Definition: UserAction.h:101
void larg4::VisualizationAction::SetTrackEnergyCutoff ( const G4double  e)
inline

Definition at line 50 of file VisualizationAction.h.

References e, and m_energyCutoff.

50 {m_energyCutoff = e;}
Float_t e
Definition: plot.C:34
G4double m_energyCutoff
Don&#39;t draw particles with energies less than this cut.
virtual G4ClassificationOfNewTrack g4b::UserAction::StackClassifyNewTrack ( const G4Track *  )
inlinevirtualinherited

G4UserStackingAction interfaces.

Reimplemented in altns::ExampleAction.

Definition at line 93 of file UserAction.h.

93 { return fUrgent; }
virtual void g4b::UserAction::StackNewStage ( )
inlinevirtualinherited

Reimplemented in altns::ExampleAction.

Definition at line 94 of file UserAction.h.

94 {};
virtual void g4b::UserAction::StackPrepareNewEvent ( )
inlinevirtualinherited

Reimplemented in altns::ExampleAction.

Definition at line 95 of file UserAction.h.

95 {};
virtual void g4b::UserAction::SteppingAction ( const G4Step *  )
inlinevirtualinherited

G4UserSteppingAction interface.

Reimplemented in larg4::ParticleListAction, larg4::G4BadIdeaAction, altns::ExampleAction, and larg4::IonizationAndScintillationAction.

Definition at line 86 of file UserAction.h.

86 {};

Member Data Documentation

G4bool larg4::VisualizationAction::m_drawNeutrals
private

Whether or not to draw neutral tracks (default is no).

Definition at line 57 of file VisualizationAction.h.

Referenced by EndOfEventAction(), and VisualizationAction().

G4double larg4::VisualizationAction::m_energyCutoff
private

Don't draw particles with energies less than this cut.

Definition at line 54 of file VisualizationAction.h.

Referenced by EndOfEventAction(), GetTrackEnergyCutoff(), SetTrackEnergyCutoff(), and VisualizationAction().


The documentation for this class was generated from the following files: