Geant4-11
G4Event.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4Event class implementation
27//
28// Author: M.Asai, SLAC
29// --------------------------------------------------------------------
30
31#include "G4Event.hh"
32#include "G4VVisManager.hh"
33#include "G4VHitsCollection.hh"
34#include "G4VDigiCollection.hh"
35#include "G4ios.hh"
36
38{
39 G4ThreadLocalStatic G4Allocator<G4Event>* _instance = nullptr;
40 return _instance;
41}
42
44{
45}
46
48 : eventID(evID)
49{
50}
51
53{
55 while(nextVertex != nullptr)
56 {
57 G4PrimaryVertex* thisVertex = nextVertex;
58 nextVertex = thisVertex->GetNext();
59 thisVertex->ClearNext();
60 delete thisVertex;
61 }
62 thePrimaryVertex = nullptr;
63 delete HC;
64 delete DC;
65 if(trajectoryContainer != nullptr)
66 {
69 }
70 delete userInfo;
71 delete randomNumberStatus;
73}
74
76{
77 return ( eventID == right.eventID );
78}
79
81{
82 return ( eventID != right.eventID );
83}
84
85void G4Event::Print() const
86{
87 G4cout << "G4Event " << eventID << G4endl;
88}
89
90void G4Event::Draw() const
91{
93 if(pVVisManager == nullptr) return;
94
96 {
98 for(G4int i=0; i<n_traj; ++i)
99 { (*trajectoryContainer)[i]->DrawTrajectory(); }
100 }
101
102 if(HC != nullptr)
103 {
104 G4int n_HC = HC->GetCapacity();
105 for(G4int j=0; j<n_HC; ++j)
106 {
107 G4VHitsCollection* VHC = HC->GetHC(j);
108 if(VHC != nullptr) VHC->DrawAllHits();
109 }
110 }
111
112 if(DC != nullptr)
113 {
114 G4int n_DC = DC->GetCapacity();
115 for(G4int j=0; j<n_DC; ++j)
116 {
117 G4VDigiCollection* VDC = DC->GetDC(j);
118 if(VDC) VDC->DrawAllDigi();
119 }
120 }
121}
G4Allocator< G4Event > *& anEventAllocator()
Definition: G4Event.cc:37
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4VDigiCollection * GetDC(G4int i) const
size_t GetCapacity() const
G4VUserEventInformation * userInfo
Definition: G4Event.hh:218
G4HCofThisEvent * HC
Definition: G4Event.hh:205
void Print() const
Definition: G4Event.cc:85
~G4Event()
Definition: G4Event.cc:52
G4bool operator!=(const G4Event &right) const
Definition: G4Event.cc:80
G4TrajectoryContainer * trajectoryContainer
Definition: G4Event.hh:211
G4String * randomNumberStatusForProcessing
Definition: G4Event.hh:225
G4int eventID
Definition: G4Event.hh:198
G4DCofThisEvent * DC
Definition: G4Event.hh:208
G4bool operator==(const G4Event &right) const
Definition: G4Event.cc:75
G4String * randomNumberStatus
Definition: G4Event.hh:221
G4PrimaryVertex * thePrimaryVertex
Definition: G4Event.hh:201
G4Event()
Definition: G4Event.cc:43
void Draw() const
Definition: G4Event.cc:90
G4VHitsCollection * GetHC(G4int i)
G4PrimaryVertex * GetNext() const
std::size_t entries() const
virtual void DrawAllDigi()
virtual void DrawAllHits()
static G4VVisManager * GetConcreteInstance()
#define G4ThreadLocalStatic
Definition: tls.hh:76