00001 //! \file 00002 //! 00003 //! Source file for Time_of_Flight Hit class. 00004 //! 00005 //! The TF_Hit class defines the quantities recorded for each hit in this 00006 //! detector and defines the member functions for handling the hit information. 00007 //! 00008 //! \author D.K. Hasell 00009 //! \version 1.0 00010 //! \date 2010-10-30 00011 //! 00012 //! \ingroup detector 00013 00014 // *+****1****+****2****+****3****+****4****+****5****+****6****+****7****+**** 00015 00016 // Include the TF header file and the user header files referenced here.. 00017 00018 #include "TF_Hit.h" 00019 00020 // Include the GEANT4 header files used below. 00021 00022 #include "G4Allocator.hh" 00023 00024 #include "G4VVisManager.hh" 00025 #include "G4Circle.hh" 00026 #include "G4VisAttributes.hh" 00027 #include "G4Colour.hh" 00028 00029 // Use the standard namespace. 00030 00031 using namespace std; 00032 00033 // *+****1****+****2****+****3****+****4****+****5****+****6****+****7****+**** 00034 00035 // TF_Hit source code. 00036 00037 // Constructors. 00038 00039 TF_Hit::TF_Hit(){} 00040 00041 // Copy constructor. 00042 00043 TF_Hit::TF_Hit( const TF_Hit & hit ) : G4VHit() { 00044 copyno = hit.copyno; 00045 trackid = hit.trackid; 00046 edep = hit.edep; 00047 ttime = hit.ttime; 00048 time = hit.time; 00049 tworld = hit.tworld; 00050 tlocal = hit.tlocal; 00051 world = hit.world; 00052 local = hit.local; 00053 } 00054 00055 // Assignment constructor. 00056 00057 const TF_Hit & TF_Hit::operator = ( const TF_Hit & hit ) { 00058 copyno = hit.copyno; 00059 trackid = hit.trackid; 00060 edep = hit.edep; 00061 ttime = hit.ttime; 00062 time = hit.time; 00063 tworld = hit.tworld; 00064 tlocal = hit.tlocal; 00065 world = hit.world; 00066 local = hit.local; 00067 return *this; 00068 } 00069 00070 // Destructor. 00071 00072 TF_Hit::~TF_Hit(){} 00073 00074 // Member functions. 00075 00076 // Test equivalence. 00077 00078 G4int TF_Hit::operator == ( const TF_Hit & hit ) const { 00079 return ( this == &hit ) ? 1 : 0; 00080 } 00081 00082 // Create an allocator for GT_Hits. 00083 00084 G4Allocator< TF_Hit > TF_HitAllocator; 00085 00086 // Allocate space for a new hit. 00087 00088 void * TF_Hit::operator new( size_t ) { 00089 return ( void * ) TF_HitAllocator.MallocSingle(); 00090 } 00091 00092 // Free space for this hit. 00093 00094 void TF_Hit::operator delete( void * aHit ) { 00095 TF_HitAllocator.FreeSingle( ( TF_Hit * ) aHit ); 00096 } 00097 00098 // Hit drawing routine. 00099 00100 void TF_Hit::Draw() { 00101 00102 G4VVisManager * pVVisManager = G4VVisManager::GetConcreteInstance(); 00103 if( pVVisManager ) { 00104 00105 G4Circle circle( world ); 00106 circle.SetScreenSize( 5.0 ); 00107 circle.SetFillStyle( G4Circle::filled ); 00108 circle.SetVisAttributes( G4VisAttributes( G4Colour( 0.0,1.0,0.0) ) ); 00109 pVVisManager->Draw( circle ); 00110 } 00111 } 00112 00113 // Hit printing routine. 00114 00115 void TF_Hit::Print() { 00116 G4cout.precision(3); 00117 G4cout << fixed 00118 << "TF Hit Copy # " << copyno 00119 << " Track # = " << trackid << "\n" 00120 << " Edep = " << edep/eV << " [eV] " 00121 << " Time = " << time/ns << " [ns] " 00122 << " Smeared Time = " << time/ns << " [ns]\n" 00123 << " True World = " << tworld/cm << " [cm] " 00124 << " True Local = " << tlocal/cm << " [cm]\n" 00125 << " Smeared World = " << world/cm << " [cm] " 00126 << " Smeared Local = " << local/cm << " [cm]\n" 00127 << G4endl; 00128 }