LM_Hit.cc

Go to the documentation of this file.
00001 //! \file
00002 //!
00003 //! Source file for Luminosity_Monitor Hit class.
00004 //!
00005 //! The LM_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-31
00011 //!
00012 //! \ingroup detector
00013 
00014 // *+****1****+****2****+****3****+****4****+****5****+****6****+****7****+****
00015 
00016 // Include the LM header file and the user header files referenced here.
00017 
00018 #include "LM_Hit.h"
00019 
00020 // Include the GEANT4 header files used here.
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 // LM_Hit source code.
00036 
00037 // Default constructor.
00038 
00039 LM_Hit::LM_Hit(){}
00040 
00041 // Copy constructor.
00042 
00043 LM_Hit::LM_Hit( const LM_Hit & hit ) : G4VHit() {
00044    copyno  = hit.copyno;
00045    trackid = hit.trackid;
00046    edep    = hit.edep;
00047    time    = hit.time;
00048    tworld  = hit.tworld;
00049    tlocal  = hit.tlocal;
00050    world   = hit.world;
00051    local   = hit.local;
00052 }
00053 
00054 // Assignment constructor.
00055 
00056 const LM_Hit & LM_Hit::operator = ( const LM_Hit & hit ) {
00057    copyno  = hit.copyno;
00058    trackid = hit.trackid;
00059    edep    = hit.edep;
00060    time    = hit.time;
00061    tworld  = hit.tworld;
00062    tlocal  = hit.tlocal;
00063    world   = hit.world;
00064    local   = hit.local;
00065    return *this;
00066 }
00067 
00068 // Destructor.
00069 
00070 LM_Hit::~LM_Hit(){}
00071 
00072 // Member functions.
00073 
00074 // Test equivalence.
00075 
00076 G4int LM_Hit::operator == ( const LM_Hit & hit ) const {
00077    return ( this == &hit ) ? 1 : 0;
00078 }
00079 
00080 // Create an allocator for GT_Hits.
00081 
00082 G4Allocator< LM_Hit > LM_HitAllocator;
00083 
00084 // Allocate space for a new hit.
00085 
00086 void * LM_Hit::operator new( size_t ) {
00087    return ( void * ) LM_HitAllocator.MallocSingle();
00088 }
00089 
00090 // Free space for this hit.
00091 
00092 void LM_Hit::operator delete( void * aHit ) {
00093    LM_HitAllocator.FreeSingle( ( LM_Hit * ) aHit );
00094 }
00095 
00096 // Hit drawing routine.
00097 
00098 void LM_Hit::Draw() {
00099 
00100    G4VVisManager * pVVisManager = G4VVisManager::GetConcreteInstance();
00101    if( pVVisManager ) {
00102 
00103       G4Circle circle( world );
00104       circle.SetScreenSize( 5.0 );
00105       circle.SetFillStyle( G4Circle::filled );
00106       circle.SetVisAttributes( G4VisAttributes( G4Colour( 0.0,1.0,0.0) ) );
00107       pVVisManager->Draw( circle );
00108    }
00109 }
00110 
00111 // Hit printing routine.
00112 
00113 void LM_Hit::Print() {
00114    G4cout.precision(3);
00115    G4cout << fixed
00116           << "LM Hit Copy # " << copyno
00117           << "   Track #       = " << trackid   << "\n"
00118           << "   Edep          = " << edep/eV   << " [eV]   "
00119           << "   Time          = " << time/ns   << " [ns]\n"
00120           << "   True World    = " << tworld/cm << " [cm]   " 
00121           << "   True Local    = " << tlocal/cm << " [cm]\n"
00122           << "   Smeared World = " << world/cm  << " [cm]   " 
00123           << "   Smeared Local = " << local/cm  << " [cm]\n"
00124           << G4endl;
00125 }