LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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 29 of file VisualizationAction.cxx.

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

30  {
32  m_energyCutoff = lgp->VisualizationEnergyCut() * CLHEP::GeV;
34  }
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 36 of file VisualizationAction.cxx.

36 {}

Member Function Documentation

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

G4UserEventAction interfaces.

Reimplemented from g4b::UserAction.

Definition at line 56 of file VisualizationAction.cxx.

56 {}
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 38 of file VisualizationAction.cxx.

39  {
40  // If graphics is ON
41  if (G4VVisManager::GetConcreteInstance()) {
42  G4cout << "Geant4 visualisation is ON" << G4endl;
43  G4UImanager* UI = G4UImanager::GetUIpointer();
44  UI->ApplyCommand("/tracking/storeTrajectory 1");
45  UI->ApplyCommand("/vis/scene/notifyhandlers");
46  }
47  }
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 58 of file VisualizationAction.cxx.

References m_drawNeutrals, and m_energyCutoff.

59  {
60  G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
61 
62  if (pVVisManager) {
63  G4TrajectoryContainer* trajectoryContainer = a_event->GetTrajectoryContainer();
64  G4int n_trajectories = 0;
65  if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
66 
67  for (G4int i = 0; i < n_trajectories; i++) {
68  G4VTrajectory* trajectory = (*trajectoryContainer)[i];
69 
70  // Only draw "interesting" trajectories, according to cuts
71  // and limits set by the user.
72 
73  G4bool drawThisTrack = false;
74  if (trajectory->GetInitialMomentum().mag() > m_energyCutoff) drawThisTrack = true;
75 
76  if (!m_drawNeutrals) {
77  G4double charge = trajectory->GetCharge();
78  // electron-, muon-, and tau-neutrino codes:
79  if (charge == 0) drawThisTrack = false;
80  }
81 
82  if (drawThisTrack) trajectory->DrawTrajectory();
83  //trajectory->DrawTrajectory(50);
84  }
85  }
86  }
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 49 of file VisualizationAction.cxx.

50  {
51  // If graphics is ON
52  if (G4VVisManager::GetConcreteInstance())
53  G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
54  }
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 48 of file VisualizationAction.h.

References m_energyCutoff.

48 { 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 49 of file VisualizationAction.h.

References e, and m_energyCutoff.

49 { m_energyCutoff = e; }
Float_t e
Definition: plot.C:35
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, altns::ExampleAction, larg4::G4BadIdeaAction, 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 56 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 53 of file VisualizationAction.h.

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


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