| [816] | 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,v 1.14 2007/03/07 02:44:16 asaim Exp $
|
|---|
| [1228] | 28 | // GEANT4 tag $Name: geant4-09-03 $
|
|---|
| [816] | 29 | //
|
|---|
| 30 |
|
|---|
| 31 | // G4Event
|
|---|
| 32 |
|
|---|
| 33 | #include "G4Event.hh"
|
|---|
| 34 | #include "G4VVisManager.hh"
|
|---|
| 35 | //#include "G4HCofThisEvent.hh"
|
|---|
| 36 | //#include "G4DCofThisEvent.hh"
|
|---|
| 37 | #include "G4VHitsCollection.hh"
|
|---|
| 38 | #include "G4VDigiCollection.hh"
|
|---|
| 39 | #include "G4ios.hh"
|
|---|
| 40 |
|
|---|
| 41 | G4Allocator<G4Event> anEventAllocator;
|
|---|
| 42 |
|
|---|
| 43 | G4Event::G4Event()
|
|---|
| 44 | :eventID(0),
|
|---|
| 45 | thePrimaryVertex(0),numberOfPrimaryVertex(0),
|
|---|
| 46 | HC(0),DC(0),trajectoryContainer(0),eventAborted(false),userInfo(0),
|
|---|
| 47 | randomNumberStatus(0),validRandomNumberStatus(false),
|
|---|
| 48 | randomNumberStatusForProcessing(0),validRandomNumberStatusForProcessing(false),
|
|---|
| 49 | keepTheEvent(false)
|
|---|
| 50 | {;}
|
|---|
| 51 |
|
|---|
| 52 | G4Event::G4Event(G4int evID)
|
|---|
| 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 | G4Event::~G4Event()
|
|---|
| 62 | {
|
|---|
| 63 | if(thePrimaryVertex) delete thePrimaryVertex;
|
|---|
| 64 | if(HC) delete HC;
|
|---|
| 65 | if(DC) delete DC;
|
|---|
| 66 | if(trajectoryContainer)
|
|---|
| 67 | {
|
|---|
| 68 | trajectoryContainer->clearAndDestroy();
|
|---|
| 69 | delete trajectoryContainer;
|
|---|
| 70 | }
|
|---|
| 71 | if(userInfo) delete userInfo;
|
|---|
| 72 | if(validRandomNumberStatus) delete randomNumberStatus;
|
|---|
| 73 | if(validRandomNumberStatusForProcessing) delete randomNumberStatusForProcessing;
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|
| 76 | G4int G4Event::operator==(const G4Event &right) const
|
|---|
| 77 | {
|
|---|
| 78 | return ( eventID == right.eventID );
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | G4int G4Event::operator!=(const G4Event &right) const
|
|---|
| 82 | {
|
|---|
| 83 | return ( eventID != right.eventID );
|
|---|
| 84 | }
|
|---|
| 85 |
|
|---|
| 86 | void G4Event::Print() const
|
|---|
| 87 | {
|
|---|
| 88 | G4cout << "G4Event " << eventID << G4endl;
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 | void G4Event::Draw() const
|
|---|
| 92 | {
|
|---|
| 93 | G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
|---|
| 94 | if(!pVVisManager) return;
|
|---|
| 95 |
|
|---|
| 96 | if(trajectoryContainer)
|
|---|
| 97 | {
|
|---|
| 98 | G4int n_traj = trajectoryContainer->entries();
|
|---|
| 99 | for(G4int i=0;i<n_traj;i++)
|
|---|
| 100 | { (*trajectoryContainer)[i]->DrawTrajectory(); }
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|
| 103 | if(HC)
|
|---|
| 104 | {
|
|---|
| 105 | G4int n_HC = HC->GetCapacity();
|
|---|
| 106 | for(G4int j=0;j<n_HC;j++)
|
|---|
| 107 | {
|
|---|
| 108 | G4VHitsCollection * VHC = HC->GetHC(j);
|
|---|
| 109 | if(VHC) VHC->DrawAllHits();
|
|---|
| 110 | }
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|
| 113 | if(DC)
|
|---|
| 114 | {
|
|---|
| 115 | G4int n_DC = DC->GetCapacity();
|
|---|
| 116 | for(G4int j=0;j<n_DC;j++)
|
|---|
| 117 | {
|
|---|
| 118 | G4VDigiCollection * VDC = DC->GetDC(j);
|
|---|
| 119 | if(VDC) VDC->DrawAllDigi();
|
|---|
| 120 | }
|
|---|
| 121 | }
|
|---|
| 122 | }
|
|---|
| 123 |
|
|---|