Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
exGPSEventAction Class Reference

#include <exGPSEventAction.hh>

Inheritance diagram for exGPSEventAction:
G4UserEventAction

Public Member Functions

 exGPSEventAction (exGPSHistoManager *histoManager)
 
virtual ~exGPSEventAction ()
 
virtual void BeginOfEventAction (const G4Event *)
 
virtual void EndOfEventAction (const G4Event *)
 
void SetDrawFlag (G4String val)
 
void SetPrintModulo (G4int val)
 
- Public Member Functions inherited from G4UserEventAction
 G4UserEventAction ()
 
virtual ~G4UserEventAction ()
 
void SetEventManager (G4EventManager *value)
 

Additional Inherited Members

- Protected Attributes inherited from G4UserEventAction
G4EventManagerfpEventManager
 

Detailed Description

Definition at line 43 of file exGPSEventAction.hh.

Constructor & Destructor Documentation

exGPSEventAction::exGPSEventAction ( exGPSHistoManager histoManager)

Definition at line 46 of file exGPSEventAction.cc.

48  fDrawFlag("all"), fPrintModulo(1000), fEventMessenger(NULL),
49  fexGPSHistoManager(histoManager)
50 {
51  fEventMessenger = new exGPSEventActionMessenger(this);
52 }
exGPSEventAction::~exGPSEventAction ( )
virtual

Definition at line 56 of file exGPSEventAction.cc.

57 {
58  delete fEventMessenger;
59 }

Member Function Documentation

void exGPSEventAction::BeginOfEventAction ( const G4Event evt)
virtual

Reimplemented from G4UserEventAction.

Definition at line 63 of file exGPSEventAction.cc.

References G4cout, G4endl, and G4Event::GetEventID().

64 {
65 
66  G4int evtNb = evt->GetEventID();
67  if (evtNb%fPrintModulo == 0)
68  {
69  G4cout << "\n---> Begin of event: " << evtNb << G4endl;
70  // HepRandom::showEngineStatus();
71  }
72 
73 }
int G4int
Definition: G4Types.hh:78
G4int GetEventID() const
Definition: G4Event.hh:140
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void exGPSEventAction::EndOfEventAction ( const G4Event evt)
virtual

Reimplemented from G4UserEventAction.

Definition at line 77 of file exGPSEventAction.cc.

References exGPSHistoManager::Fill(), G4PrimaryParticle::GetG4code(), G4PrimaryParticle::GetMass(), G4PrimaryParticle::GetMomentum(), G4PrimaryVertex::GetNumberOfParticle(), G4Event::GetNumberOfPrimaryVertex(), G4PrimaryParticle::GetPDGcode(), G4ParticleDefinition::GetPDGMass(), G4PrimaryVertex::GetPosition(), G4PrimaryVertex::GetPrimary(), G4Event::GetPrimaryVertex(), G4PrimaryParticle::GetWeight(), CLHEP::Hep3Vector::mag(), python.hepunit::twopi, test::x, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), z, and CLHEP::Hep3Vector::z().

78 {
79  // G4int evtNb = evt->GetEventID();
80 
81  G4int nVertex = evt->GetNumberOfPrimaryVertex();
82  for ( G4int j = 0; j < nVertex; j++) {
83  G4int nPart = evt->GetPrimaryVertex(j)->GetNumberOfParticle();
84  for ( G4int i = 0; i < nPart; i++) {
86  G4ThreeVector direction=evt->GetPrimaryVertex(j)->GetPrimary(i)
87  ->GetMomentum();
88  G4double P=direction.mag();
91  ->GetPDGMass();
92  E=std::sqrt(P*P+E0*E0);
93  E -= E0;
94  G4int pid = evt->GetPrimaryVertex(j)->GetPrimary(i)
95  ->GetPDGcode();
96  //
97  direction=direction*(1./direction.mag());
98  direction = -direction; // reverse the direction
99  G4double x,y,z,w;
100  G4double Phi=direction.phi();
101  if (Phi <0) Phi=Phi+twopi;
102  G4double Theta=direction.theta();
103  x=position.x();
104  y=position.y();
105  z=position.z();
106  w = evt->GetPrimaryVertex(j)->GetPrimary(i)->GetWeight();
107  fexGPSHistoManager->Fill(pid,E,x,y,z,Theta,Phi,w);
108  }
109  }
110 }
G4int GetNumberOfParticle() const
G4ThreeVector GetMomentum() const
G4ThreeVector GetPosition() const
double x() const
G4int GetNumberOfPrimaryVertex() const
Definition: G4Event.hh:153
G4double z
Definition: TRTMaterials.hh:39
int G4int
Definition: G4Types.hh:78
G4ParticleDefinition * GetG4code() const
double z() const
G4PrimaryParticle * GetPrimary(G4int i=0) const
void Fill(G4int PDGid, G4double e, G4double x, G4double y, G4double z, G4double t, G4double p, G4double w)
G4double GetMass() const
G4PrimaryVertex * GetPrimaryVertex(G4int i=0) const
Definition: G4Event.hh:156
G4int GetPDGcode() const
G4double GetWeight() const
G4double GetPDGMass() const
double y() const
double G4double
Definition: G4Types.hh:76
double mag() const
void exGPSEventAction::SetDrawFlag ( G4String  val)
inline

Definition at line 52 of file exGPSEventAction.hh.

Referenced by exGPSEventActionMessenger::SetNewValue().

52 {fDrawFlag = val;};
void exGPSEventAction::SetPrintModulo ( G4int  val)
inline

Definition at line 53 of file exGPSEventAction.hh.

Referenced by exGPSEventActionMessenger::SetNewValue().

53 {fPrintModulo = val;};

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