G4Event.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 
00030 // G4Event
00031 
00032 #include "G4Event.hh"
00033 #include "G4VVisManager.hh"
00034 //#include "G4HCofThisEvent.hh"
00035 //#include "G4DCofThisEvent.hh"
00036 #include "G4VHitsCollection.hh"
00037 #include "G4VDigiCollection.hh"
00038 #include "G4ios.hh"
00039 
00040 G4Allocator<G4Event> anEventAllocator;
00041 
00042 G4Event::G4Event()
00043 :eventID(0),
00044  thePrimaryVertex(0),numberOfPrimaryVertex(0),
00045  HC(0),DC(0),trajectoryContainer(0),eventAborted(false),userInfo(0),
00046  randomNumberStatus(0),validRandomNumberStatus(false),
00047  randomNumberStatusForProcessing(0),validRandomNumberStatusForProcessing(false),
00048  keepTheEvent(false)
00049 {;}
00050 
00051 G4Event::G4Event(G4int evID)
00052 :eventID(evID),
00053  thePrimaryVertex(0),numberOfPrimaryVertex(0),
00054  HC(0),DC(0),trajectoryContainer(0),eventAborted(false),userInfo(0),
00055  randomNumberStatus(0),validRandomNumberStatus(false),
00056  randomNumberStatusForProcessing(0),validRandomNumberStatusForProcessing(false),
00057  keepTheEvent(false)
00058 {;}
00059 
00060 G4Event::~G4Event()
00061 { 
00062   if(thePrimaryVertex) delete thePrimaryVertex;
00063   if(HC) delete HC;
00064   if(DC) delete DC;
00065   if(trajectoryContainer)
00066   {
00067     trajectoryContainer->clearAndDestroy();
00068     delete trajectoryContainer;
00069   }
00070   if(userInfo) delete userInfo;
00071   if(validRandomNumberStatus) delete randomNumberStatus;
00072   if(validRandomNumberStatusForProcessing) delete randomNumberStatusForProcessing;
00073 }
00074 
00075 G4int G4Event::operator==(const G4Event &right) const
00076 {
00077   return ( eventID == right.eventID );
00078 }
00079 
00080 G4int G4Event::operator!=(const G4Event &right) const
00081 {
00082   return ( eventID != right.eventID );
00083 }
00084 
00085 void G4Event::Print() const
00086 {
00087   G4cout << "G4Event " << eventID << G4endl;
00088 }
00089 
00090 void G4Event::Draw() const
00091 {
00092   G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
00093   if(!pVVisManager) return;
00094 
00095   if(trajectoryContainer)
00096   {
00097     G4int n_traj = trajectoryContainer->entries();
00098     for(G4int i=0;i<n_traj;i++)
00099     { (*trajectoryContainer)[i]->DrawTrajectory(); }
00100   }
00101 
00102   if(HC)
00103   {
00104     G4int n_HC = HC->GetCapacity();
00105     for(G4int j=0;j<n_HC;j++)
00106     {
00107       G4VHitsCollection * VHC = HC->GetHC(j);
00108       if(VHC) VHC->DrawAllHits();
00109     }
00110   }
00111 
00112   if(DC)
00113   {
00114     G4int n_DC = DC->GetCapacity();
00115     for(G4int j=0;j<n_DC;j++)
00116     {
00117       G4VDigiCollection * VDC = DC->GetDC(j);
00118       if(VDC) VDC->DrawAllDigi();
00119     }
00120   }
00121 }
00122 

Generated on Mon May 27 17:48:13 2013 for Geant4 by  doxygen 1.4.7