Geant4  10.02.p02
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 97477 2016-06-03 10:13:42Z 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  delete thePrimaryVertex;
67  delete HC;
68  delete DC;
70  {
72  delete trajectoryContainer;
73  }
74  delete userInfo;
75  delete randomNumberStatus;
77 }
78 
80 {
81  return ( eventID == right.eventID );
82 }
83 
85 {
86  return ( eventID != right.eventID );
87 }
88 
89 void G4Event::Print() const
90 {
91  G4cout << "G4Event " << eventID << G4endl;
92 }
93 
94 void G4Event::Draw() const
95 {
97  if(!pVVisManager) return;
98 
100  {
101  G4int n_traj = trajectoryContainer->entries();
102  for(G4int i=0;i<n_traj;i++)
103  { (*trajectoryContainer)[i]->DrawTrajectory(); }
104  }
105 
106  if(HC)
107  {
108  G4int n_HC = HC->GetCapacity();
109  for(G4int j=0;j<n_HC;j++)
110  {
111  G4VHitsCollection * VHC = HC->GetHC(j);
112  if(VHC) VHC->DrawAllHits();
113  }
114  }
115 
116  if(DC)
117  {
118  G4int n_DC = DC->GetCapacity();
119  for(G4int j=0;j<n_DC;j++)
120  {
121  G4VDigiCollection * VDC = DC->GetDC(j);
122  if(VDC) VDC->DrawAllDigi();
123  }
124  }
125 }
G4VHitsCollection * GetHC(G4int i)
static G4VVisManager * GetConcreteInstance()
G4int operator==(const G4Event &right) const
Definition: G4Event.cc:79
void Print() const
Definition: G4Event.cc:89
G4VDigiCollection * GetDC(G4int i) const
~G4Event()
Definition: G4Event.cc:64
#define G4ThreadLocal
Definition: tls.hh:89
virtual void DrawAllHits()
int G4int
Definition: G4Types.hh:78
G4String * randomNumberStatus
Definition: G4Event.hh:103
G4GLOB_DLL std::ostream G4cout
G4ThreadLocal G4Allocator< G4Event > * anEventAllocator
Definition: G4Event.cc:40
G4Event()
Definition: G4Event.cc:42
G4VUserEventInformation * userInfo
Definition: G4Event.hh:100
G4PrimaryVertex * thePrimaryVertex
Definition: G4Event.hh:83
G4DCofThisEvent * DC
Definition: G4Event.hh:90
G4String * randomNumberStatusForProcessing
Definition: G4Event.hh:107
void Draw() const
Definition: G4Event.cc:94
G4int eventID
Definition: G4Event.hh:80
#define G4endl
Definition: G4ios.hh:61
G4int GetCapacity() const
virtual void DrawAllDigi()
G4HCofThisEvent * HC
Definition: G4Event.hh:87
G4int operator!=(const G4Event &right) const
Definition: G4Event.cc:84
G4TrajectoryContainer * trajectoryContainer
Definition: G4Event.hh:93