00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "BesMucHit.hh"
00015 #include "G4UnitsTable.hh"
00016 #include "G4VVisManager.hh"
00017 #include "G4Circle.hh"
00018 #include "G4Colour.hh"
00019 #include "G4VisAttributes.hh"
00020 #include "G4ios.hh"
00021 #include "strstream"
00022
00023 G4Allocator<BesMucHit> BesMucHitAllocator;
00024
00025 BesMucHit::BesMucHit()
00026 { }
00027
00028 BesMucHit::BesMucHit(int prt, int seg, int lay, int str, int trId, int trIndex)
00029 {
00030 m_Part = prt;
00031 m_Seg = seg;
00032 m_Gap = lay;
00033 m_Strip = str;
00034 m_TrackID = trId;
00035 m_TrackIndex = trIndex;
00036 }
00037
00038 BesMucHit::~BesMucHit()
00039 { }
00040
00041 BesMucHit::BesMucHit(const BesMucHit& right)
00042 :G4VHit()
00043 {
00044 m_TrackID = right.m_TrackID;
00045 m_TrackIndex = right.m_TrackIndex;
00046 m_PDGCode = right.m_PDGCode;
00047 m_Edep = right.m_Edep;
00048 m_Energy = right.m_Energy;
00049 m_Time = right.m_Time;
00050 m_Pos = right.m_Pos;
00051 m_PosLocal = right.m_PosLocal;
00052 m_Dir = right.m_Dir;
00053 m_Momentum = right.m_Momentum;
00054 m_Volume = right.m_Volume;
00055 m_VolumeName = right.m_VolumeName;
00056 m_Part = right.m_Part;
00057 m_Seg = right.m_Seg;
00058 m_Gap = right.m_Gap;
00059 m_Panel = right.m_Panel;
00060 m_GasChamber = right.m_GasChamber;
00061 m_Strip = right.m_Strip;
00062 }
00063
00064 const BesMucHit& BesMucHit::operator=(const BesMucHit& right)
00065 {
00066 m_TrackID = right.m_TrackID;
00067 m_TrackIndex = right.m_TrackIndex;
00068 m_PDGCode = right.m_PDGCode;
00069 m_Edep = right.m_Edep;
00070 m_Energy = right.m_Energy;
00071 m_Time = right.m_Time;
00072 m_Pos = right.m_Pos;
00073 m_PosLocal = right.m_PosLocal;
00074 m_Dir = right.m_Dir;
00075 m_Momentum = right.m_Momentum;
00076 m_Volume = right.m_Volume;
00077 m_VolumeName = right.m_VolumeName;
00078 m_Part = right.m_Part;
00079 m_Seg = right.m_Seg;
00080 m_Gap = right.m_Gap;
00081 m_Panel = right.m_Panel;
00082 m_GasChamber = right.m_GasChamber;
00083 m_Strip = right.m_Strip;
00084 return *this;
00085 }
00086
00087 int BesMucHit::operator==(const BesMucHit& right) const
00088 {
00089 return (this==&right) ? 1 : 0;
00090 }
00091
00092 void BesMucHit::SetVolume(G4VPhysicalVolume* pv)
00093 {
00094 m_Volume = pv;
00095 m_VolumeName = pv->GetLogicalVolume()->GetName();
00096
00097 G4LogicalVolume *lvGap = pv->GetMotherLogical();
00098 G4String GapName = lvGap->GetName();
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114 G4String strPart = m_VolumeName.substr(5,1);
00115 G4String strSeg = GapName.substr(7,1);
00116 G4String strGap = m_VolumeName.substr(9,1);
00117 G4String strGasChamber = m_VolumeName.substr(11,1);
00118 G4String strPanel = m_VolumeName.substr(14,1);
00119
00120
00121
00122
00123
00124
00125 std::istrstream partBuf(strPart.c_str(), strlen(strPart.c_str()));
00126 std::istrstream segBuf(strSeg.c_str(), strlen(strSeg.c_str()));
00127 std::istrstream gapBuf(strGap.c_str(), strlen(strGap.c_str()));
00128 std::istrstream panelBuf(strPanel.c_str(), strlen(strPanel.c_str()));
00129 std::istrstream gasChamberBuf(strGasChamber.c_str(), strlen(strGasChamber.c_str()));
00130
00131 partBuf >> m_Part ;
00132 segBuf >> m_Seg;
00133 gapBuf >> m_Gap;
00134 panelBuf >> m_Panel;
00135 gasChamberBuf >> m_GasChamber;
00136 }
00137
00138
00139 void BesMucHit::Draw()
00140 {
00141 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
00142 if(pVVisManager)
00143 {
00144 G4Circle circle(m_Pos);
00145 circle.SetScreenSize(4.);
00146 circle.SetFillStyle(G4Circle::filled);
00147 G4Colour colour(0.,0.,1.);
00148 G4VisAttributes attribs(colour);
00149 circle.SetVisAttributes(attribs);
00150 pVVisManager->Draw(circle);
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171 }
00172 }
00173
00174 void BesMucHit::Print()
00175 {
00176
00177 G4cout << " Track id: " << m_TrackID
00178 << " pdg code: " << m_PDGCode
00179 << G4endl
00180 << " energy deposit: " << G4BestUnit(m_Edep, "Energy")
00181 << " pos: " << G4BestUnit(m_Pos, "Length")
00182 << " posLocal: " << G4BestUnit(m_PosLocal, "Length")
00183 << G4endl
00184 << " energy: " << G4BestUnit(m_Energy, "Energy")
00185 << " direction: " << m_Dir
00186 << " time: " << G4BestUnit(m_Time,"Time")
00187 << " volume name: " << m_VolumeName
00188 << G4endl;
00189 }
00190
00191
00192
00193