00001 //---------------------------------------------------------------------------// 00002 // BOOST --- BESIII Object_Oriented Simulation Tool // 00003 //---------------------------------------------------------------------------// 00004 //Description: 00005 //Author: Dengzy 00006 //Created: Mar, 2004 00007 //Modified: 00008 //Comment: 00009 //---------------------------------------------------------------------------// 00010 // $Id: BesTofHit.cc 00011 00012 #include "BesTofHit.hh" 00013 #include "G4UnitsTable.hh" 00014 #include "G4VVisManager.hh" 00015 #include "G4Circle.hh" 00016 #include "G4Colour.hh" 00017 #include "G4VisAttributes.hh" 00018 #include "G4ios.hh" 00019 00020 G4Allocator<BesTofHit> BesTofHitAllocator; 00021 00022 BesTofHit::BesTofHit() {} 00023 00024 BesTofHit::~BesTofHit() {} 00025 00026 BesTofHit::BesTofHit(const BesTofHit& right) 00027 :G4VHit() 00028 { 00029 m_trackIndex=right.m_trackIndex; 00030 m_g4Index=right.m_g4Index; 00031 m_partId=right.m_partId; 00032 m_scinNb=right.m_scinNb; 00033 m_gapNb=right.m_gapNb; 00034 m_edep=right.m_edep; 00035 m_stepL=right.m_stepL; 00036 m_trackL=right.m_trackL; 00037 m_pos=right.m_pos; 00038 m_time=right.m_time; 00039 m_deltaT=right.m_deltaT; 00040 m_pDirection=right.m_pDirection; 00041 m_momentum=right.m_momentum; 00042 //m_scinMaterial = right.m_scinMaterial; 00043 m_charge = right.m_charge; 00044 m_number_of_ions=right.m_number_of_ions; 00045 m_strip = right.m_strip; 00046 m_locPos = right.m_locPos; 00047 } 00048 00049 00050 const BesTofHit& BesTofHit::operator=(const BesTofHit& right) 00051 { 00052 m_trackIndex=right.m_trackIndex; 00053 m_g4Index=right.m_g4Index; 00054 m_partId=right.m_partId; 00055 m_scinNb=right.m_scinNb; 00056 m_gapNb=right.m_gapNb; 00057 m_edep=right.m_edep; 00058 m_stepL=right.m_stepL; 00059 m_trackL=right.m_trackL; 00060 m_pos=right.m_pos; 00061 m_time=right.m_time; 00062 m_deltaT=right.m_deltaT; 00063 m_pDirection=right.m_pDirection; 00064 m_momentum=right.m_momentum; 00065 //m_scinMaterial = right.m_scinMaterial; 00066 m_charge = right.m_charge; 00067 m_number_of_ions = right.m_number_of_ions; 00068 m_strip = right.m_strip; 00069 m_locPos = right.m_locPos; 00070 00071 return *this; 00072 } 00073 00074 00075 00076 int BesTofHit::operator==(const BesTofHit& right) const 00077 { 00078 return (this==&right) ? 1 : 0; 00079 } 00080 00081 void BesTofHit::AddHit(const BesTofHit& newHit) 00082 { 00083 m_edep += newHit.m_edep; 00084 if (m_edep>newHit.m_edep) 00085 { 00086 m_time = newHit.m_time; 00087 m_pos = newHit.m_pos; 00088 } 00089 } 00090 00091 void BesTofHit::Draw() 00092 { 00093 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance(); 00094 if (pVVisManager) 00095 { 00096 G4Circle circle(m_pos); 00097 circle.SetScreenSize(1.); 00098 circle.SetFillStyle(G4Circle::filled); 00099 G4Colour colour(0.,0.,1.); 00100 G4VisAttributes attribs(colour); 00101 circle.SetVisAttributes(attribs); 00102 pVVisManager->Draw(circle); 00103 } 00104 } 00105 00106 00107 void BesTofHit::Print() 00108 { 00109 G4cout<<m_trackIndex<<" "<<m_g4Index<<" "<<m_partId<<" "<<m_scinNb<<" "; 00110 G4double posx = m_pos.x(); 00111 G4double posy = m_pos.y(); 00112 G4double posr = sqrt(posx*posx + posy*posy); 00113 G4cout<<posr<<" "<<m_edep<<" "<<m_stepL<<G4endl<<G4endl; 00114 } 00115 00116