Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 //
27 // $Id: G4Event.cc 99158 2016-09-07 08:10:46Z 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 
43 :eventID(0),
44  thePrimaryVertex(nullptr),numberOfPrimaryVertex(0),
45  HC(nullptr),DC(nullptr),trajectoryContainer(nullptr),
46  eventAborted(false),userInfo(nullptr),
47  randomNumberStatus(nullptr),validRandomNumberStatus(false),
48  randomNumberStatusForProcessing(nullptr),validRandomNumberStatusForProcessing(false),
49  keepTheEvent(false),grips(0)
50 {
51 }
52 
54 :eventID(evID),
55  thePrimaryVertex(nullptr),numberOfPrimaryVertex(0),
56  HC(nullptr),DC(nullptr),trajectoryContainer(nullptr),
57  eventAborted(false),userInfo(nullptr),
58  randomNumberStatus(nullptr),validRandomNumberStatus(false),
59  randomNumberStatusForProcessing(nullptr),validRandomNumberStatusForProcessing(false),
60  keepTheEvent(false),grips(0)
61 {
62 }
63 
65 {
66  G4PrimaryVertex* nextVertex = thePrimaryVertex;
67  while(nextVertex)
68  {
69  G4PrimaryVertex* thisVertex = nextVertex;
70  nextVertex = thisVertex->GetNext();
71  thisVertex->ClearNext();
72  delete thisVertex;
73  }
74  thePrimaryVertex = nullptr;
75  delete HC;
76  delete DC;
77  if(trajectoryContainer)
78  {
79  trajectoryContainer->clearAndDestroy();
80  delete trajectoryContainer;
81  }
82  delete userInfo;
83  delete randomNumberStatus;
84  delete randomNumberStatusForProcessing;
85 }
86 
88 {
89  return ( eventID == right.eventID );
90 }
91 
93 {
94  return ( eventID != right.eventID );
95 }
96 
97 void G4Event::Print() const
98 {
99  G4cout << "G4Event " << eventID << G4endl;
100 }
101 
102 void G4Event::Draw() const
103 {
105  if(!pVVisManager) return;
106 
107  if(trajectoryContainer)
108  {
109  G4int n_traj = trajectoryContainer->entries();
110  for(G4int i=0;i<n_traj;i++)
111  { (*trajectoryContainer)[i]->DrawTrajectory(); }
112  }
113 
114  if(HC)
115  {
116  G4int n_HC = HC->GetCapacity();
117  for(G4int j=0;j<n_HC;j++)
118  {
119  G4VHitsCollection * VHC = HC->GetHC(j);
120  if(VHC) VHC->DrawAllHits();
121  }
122  }
123 
124  if(DC)
125  {
126  G4int n_DC = DC->GetCapacity();
127  for(G4int j=0;j<n_DC;j++)
128  {
129  G4VDigiCollection * VDC = DC->GetDC(j);
130  if(VDC) VDC->DrawAllDigi();
131  }
132  }
133 }
G4VHitsCollection * GetHC(G4int i)
static G4VVisManager * GetConcreteInstance()
G4int operator==(const G4Event &right) const
Definition: G4Event.cc:87
void Print() const
Definition: G4Event.cc:97
G4VDigiCollection * GetDC(G4int i) const
G4EVENT_DLL G4ThreadLocal G4Allocator< G4Event > * anEventAllocator
Definition: G4Event.cc:40
~G4Event()
Definition: G4Event.cc:64
#define G4ThreadLocal
Definition: tls.hh:89
virtual void DrawAllHits()
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
G4Event()
Definition: G4Event.cc:42
G4PrimaryVertex * GetNext() const
void Draw() const
Definition: G4Event.cc:102
#define G4endl
Definition: G4ios.hh:61
G4int GetCapacity() const
virtual void DrawAllDigi()
G4int operator!=(const G4Event &right) const
Definition: G4Event.cc:92