ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4Event.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file 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 //
28 
29 // G4Event
30 
31 #include "G4Event.hh"
32 #include "G4VVisManager.hh"
33 //#include "G4HCofThisEvent.hh"
34 //#include "G4DCofThisEvent.hh"
35 #include "G4VHitsCollection.hh"
36 #include "G4VDigiCollection.hh"
37 #include "G4ios.hh"
38 
40 {
41  G4ThreadLocalStatic G4Allocator<G4Event>* _instance = nullptr;
42  return _instance;
43 }
44 
46 :eventID(0),
47  thePrimaryVertex(nullptr),numberOfPrimaryVertex(0),
48  HC(nullptr),DC(nullptr),trajectoryContainer(nullptr),
49  eventAborted(false),userInfo(nullptr),
50  randomNumberStatus(nullptr),validRandomNumberStatus(false),
51  randomNumberStatusForProcessing(nullptr),validRandomNumberStatusForProcessing(false),
52  keepTheEvent(false),grips(0)
53 {
54 }
55 
57 :eventID(evID),
58  thePrimaryVertex(nullptr),numberOfPrimaryVertex(0),
59  HC(nullptr),DC(nullptr),trajectoryContainer(nullptr),
60  eventAborted(false),userInfo(nullptr),
61  randomNumberStatus(nullptr),validRandomNumberStatus(false),
62  randomNumberStatusForProcessing(nullptr),validRandomNumberStatusForProcessing(false),
63  keepTheEvent(false),grips(0)
64 {
65 }
66 
68 {
69  G4PrimaryVertex* nextVertex = thePrimaryVertex;
70  while(nextVertex)
71  {
72  G4PrimaryVertex* thisVertex = nextVertex;
73  nextVertex = thisVertex->GetNext();
74  thisVertex->ClearNext();
75  delete thisVertex;
76  }
77  thePrimaryVertex = nullptr;
78  delete HC;
79  delete DC;
81  {
83  delete trajectoryContainer;
84  }
85  delete userInfo;
86  delete randomNumberStatus;
88 }
89 
91 {
92  return ( eventID == right.eventID );
93 }
94 
96 {
97  return ( eventID != right.eventID );
98 }
99 
100 void G4Event::Print() const
101 {
102  G4cout << "G4Event " << eventID << G4endl;
103 }
104 
105 void G4Event::Draw() const
106 {
108  if(!pVVisManager) return;
109 
111  {
112  G4int n_traj = trajectoryContainer->entries();
113  for(G4int i=0;i<n_traj;i++)
114  { (*trajectoryContainer)[i]->DrawTrajectory(); }
115  }
116 
117  if(HC)
118  {
119  G4int n_HC = HC->GetCapacity();
120  for(G4int j=0;j<n_HC;j++)
121  {
122  G4VHitsCollection * VHC = HC->GetHC(j);
123  if(VHC) VHC->DrawAllHits();
124  }
125  }
126 
127  if(DC)
128  {
129  G4int n_DC = DC->GetCapacity();
130  for(G4int j=0;j<n_DC;j++)
131  {
132  G4VDigiCollection * VDC = DC->GetDC(j);
133  if(VDC) VDC->DrawAllDigi();
134  }
135  }
136 }