Geant4.10
 All Data Structures 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 69010 2013-04-15 09:34:16Z 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(0),numberOfPrimaryVertex(0),
45  HC(0),DC(0),trajectoryContainer(0),eventAborted(false),userInfo(0),
46  randomNumberStatus(0),validRandomNumberStatus(false),
47  randomNumberStatusForProcessing(0),validRandomNumberStatusForProcessing(false),
48  keepTheEvent(false)
49 {
50 }
51 
53 :eventID(evID),
54  thePrimaryVertex(0),numberOfPrimaryVertex(0),
55  HC(0),DC(0),trajectoryContainer(0),eventAborted(false),userInfo(0),
56  randomNumberStatus(0),validRandomNumberStatus(false),
57  randomNumberStatusForProcessing(0),validRandomNumberStatusForProcessing(false),
58  keepTheEvent(false)
59 {
60 }
61 
63 {
64  if(thePrimaryVertex) delete thePrimaryVertex;
65  if(HC) delete HC;
66  if(DC) delete DC;
67  if(trajectoryContainer)
68  {
69  trajectoryContainer->clearAndDestroy();
70  delete trajectoryContainer;
71  }
72  if(userInfo) delete userInfo;
73  if(validRandomNumberStatus) delete randomNumberStatus;
74  if(validRandomNumberStatusForProcessing) delete randomNumberStatusForProcessing;
75 }
76 
78 {
79  return ( eventID == right.eventID );
80 }
81 
83 {
84  return ( eventID != right.eventID );
85 }
86 
87 void G4Event::Print() const
88 {
89  G4cout << "G4Event " << eventID << G4endl;
90 }
91 
92 void G4Event::Draw() const
93 {
95  if(!pVVisManager) return;
96 
97  if(trajectoryContainer)
98  {
99  G4int n_traj = trajectoryContainer->entries();
100  for(G4int i=0;i<n_traj;i++)
101  { (*trajectoryContainer)[i]->DrawTrajectory(); }
102  }
103 
104  if(HC)
105  {
106  G4int n_HC = HC->GetCapacity();
107  for(G4int j=0;j<n_HC;j++)
108  {
109  G4VHitsCollection * VHC = HC->GetHC(j);
110  if(VHC) VHC->DrawAllHits();
111  }
112  }
113 
114  if(DC)
115  {
116  G4int n_DC = DC->GetCapacity();
117  for(G4int j=0;j<n_DC;j++)
118  {
119  G4VDigiCollection * VDC = DC->GetDC(j);
120  if(VDC) VDC->DrawAllDigi();
121  }
122  }
123 }
static G4VVisManager * GetConcreteInstance()
G4int operator==(const G4Event &right) const
Definition: G4Event.cc:77
void Print() const
Definition: G4Event.cc:87
G4VDigiCollection * GetDC(G4int i) const
~G4Event()
Definition: G4Event.cc:62
#define G4ThreadLocal
Definition: tls.hh:52
virtual void DrawAllHits()
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
G4ThreadLocal G4Allocator< G4Event > * anEventAllocator
Definition: G4Event.cc:40
G4Event()
Definition: G4Event.cc:42
void Draw() const
Definition: G4Event.cc:92
#define G4endl
Definition: G4ios.hh:61
G4int GetCapacity() const
virtual void DrawAllDigi()
G4int operator!=(const G4Event &right) const
Definition: G4Event.cc:82