Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4Event.cc
이 파일의 문서화 페이지로 가기
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 //
27 // $Id: G4Event.cc 110273 2018-05-17 14:43:43Z gcosmo $
28 //
29 
30 // G4Event
31 
32 #include "G4Event.hh"
33 #include "G4VVisManager.hh"
34 //#include "G4HCofThisEvent.hh"
35 //#include "G4DCofThisEvent.hh"
36 #include "G4VHitsCollection.hh"
37 #include "G4VDigiCollection.hh"
38 #include "G4ios.hh"
39 
41 {
42  G4ThreadLocalStatic G4Allocator<G4Event>* _instance = nullptr;
43  return _instance;
44 }
45 
47 :eventID(0),
48  thePrimaryVertex(nullptr),numberOfPrimaryVertex(0),
49  HC(nullptr),DC(nullptr),trajectoryContainer(nullptr),
50  eventAborted(false),userInfo(nullptr),
51  randomNumberStatus(nullptr),validRandomNumberStatus(false),
52  randomNumberStatusForProcessing(nullptr),validRandomNumberStatusForProcessing(false),
53  keepTheEvent(false),grips(0)
54 {
55 }
56 
58 :eventID(evID),
59  thePrimaryVertex(nullptr),numberOfPrimaryVertex(0),
60  HC(nullptr),DC(nullptr),trajectoryContainer(nullptr),
61  eventAborted(false),userInfo(nullptr),
62  randomNumberStatus(nullptr),validRandomNumberStatus(false),
63  randomNumberStatusForProcessing(nullptr),validRandomNumberStatusForProcessing(false),
64  keepTheEvent(false),grips(0)
65 {
66 }
67 
69 {
70  G4PrimaryVertex* nextVertex = thePrimaryVertex;
71  while(nextVertex)
72  {
73  G4PrimaryVertex* thisVertex = nextVertex;
74  nextVertex = thisVertex->GetNext();
75  thisVertex->ClearNext();
76  delete thisVertex;
77  }
78  thePrimaryVertex = nullptr;
79  delete HC;
80  delete DC;
82  {
84  delete trajectoryContainer;
85  }
86  delete userInfo;
87  delete randomNumberStatus;
89 }
90 
92 {
93  return ( eventID == right.eventID );
94 }
95 
97 {
98  return ( eventID != right.eventID );
99 }
100 
101 void G4Event::Print() const
102 {
103  G4cout << "G4Event " << eventID << G4endl;
104 }
105 
106 void G4Event::Draw() const
107 {
109  if(!pVVisManager) return;
110 
112  {
113  G4int n_traj = trajectoryContainer->entries();
114  for(G4int i=0;i<n_traj;i++)
115  { (*trajectoryContainer)[i]->DrawTrajectory(); }
116  }
117 
118  if(HC)
119  {
120  G4int n_HC = HC->GetCapacity();
121  for(G4int j=0;j<n_HC;j++)
122  {
123  G4VHitsCollection * VHC = HC->GetHC(j);
124  if(VHC) VHC->DrawAllHits();
125  }
126  }
127 
128  if(DC)
129  {
130  G4int n_DC = DC->GetCapacity();
131  for(G4int j=0;j<n_DC;j++)
132  {
133  G4VDigiCollection * VDC = DC->GetDC(j);
134  if(VDC) VDC->DrawAllDigi();
135  }
136  }
137 }
G4TrajectoryContainer * trajectoryContainer
Definition: G4Event.hh:93
G4String * randomNumberStatusForProcessing
Definition: G4Event.hh:107
G4int operator==(const G4Event &right) const
Definition: G4Event.cc:91
~G4Event()
Definition: G4Event.cc:68
virtual void DrawAllDigi()
virtual void DrawAllHits()
#define G4endl
Definition: G4ios.hh:61
G4DCofThisEvent * DC
Definition: G4Event.hh:90
G4String * randomNumberStatus
Definition: G4Event.hh:103
#define G4ThreadLocalStatic
Definition: tls.hh:68
static G4VVisManager * GetConcreteInstance()
G4VUserEventInformation * userInfo
Definition: G4Event.hh:100
void Draw() const
Definition: G4Event.cc:106
void Print() const
Definition: G4Event.cc:101
G4EVENT_DLL G4Allocator< G4Event > *& anEventAllocator()
Definition: G4Event.cc:40
G4Event()
Definition: G4Event.cc:46
G4int operator!=(const G4Event &right) const
Definition: G4Event.cc:96
int G4int
Definition: G4Types.hh:78
G4PrimaryVertex * GetNext() const
G4HCofThisEvent * HC
Definition: G4Event.hh:87
G4GLOB_DLL std::ostream G4cout
G4PrimaryVertex * thePrimaryVertex
Definition: G4Event.hh:83
G4VDigiCollection * GetDC(G4int i) const
G4int eventID
Definition: G4Event.hh:80
G4int GetCapacity() const