BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
BesMucHit.cc
Go to the documentation of this file.
1//---------------------------------------------------------------------------//
2// BOOST --- BESIII Object_Oriented Simulation Tool //
3//---------------------------------------------------------------------------//
4//Description:
5//Author: Youzy Peking University mail: [email protected]
6//Created: Nov, 2003
7//Modified:
8//Comment:
9//---------------------------------------------------------------------------//
10
11//
12// $Id: BesMucHit
13
14#include "BesMucHit.hh"
15#include "G4UnitsTable.hh"
16#include "G4VVisManager.hh"
17#include "G4Circle.hh"
18#include "G4Colour.hh"
19#include "G4VisAttributes.hh"
20#include "G4ios.hh"
21#include "strstream"
22
23G4Allocator<BesMucHit> BesMucHitAllocator;
24
26{ }
27
28BesMucHit::BesMucHit(int prt, int seg, int lay, int str, int trId, int trIndex)
29{
30 m_Part = prt;
31 m_Seg = seg;
32 m_Gap = lay;
33 m_Strip = str;
34 m_TrackID = trId;
35 m_TrackIndex = trIndex;
36}
37
39{ }
40
42 :G4VHit()
43{
44 m_TrackID = right.m_TrackID;
45 m_TrackIndex = right.m_TrackIndex;
46 m_PDGCode = right.m_PDGCode;
47 m_Edep = right.m_Edep;
48 m_Energy = right.m_Energy;
49 m_Time = right.m_Time;
50 m_Pos = right.m_Pos;
51 m_PosLocal = right.m_PosLocal;
52 m_Dir = right.m_Dir;
53 m_Momentum = right.m_Momentum;
54 m_Volume = right.m_Volume;
55 m_VolumeName = right.m_VolumeName;
56 m_Part = right.m_Part;
57 m_Seg = right.m_Seg;
58 m_Gap = right.m_Gap;
59 m_Panel = right.m_Panel;
60 m_GasChamber = right.m_GasChamber; //now it means up or down RPC! 2006.10.17
61 m_Strip = right.m_Strip;
62}
63
65{
66 m_TrackID = right.m_TrackID;
67 m_TrackIndex = right.m_TrackIndex;
68 m_PDGCode = right.m_PDGCode;
69 m_Edep = right.m_Edep;
70 m_Energy = right.m_Energy;
71 m_Time = right.m_Time;
72 m_Pos = right.m_Pos;
73 m_PosLocal = right.m_PosLocal;
74 m_Dir = right.m_Dir;
75 m_Momentum = right.m_Momentum;
76 m_Volume = right.m_Volume;
77 m_VolumeName = right.m_VolumeName;
78 m_Part = right.m_Part;
79 m_Seg = right.m_Seg;
80 m_Gap = right.m_Gap;
81 m_Panel = right.m_Panel;
82 m_GasChamber = right.m_GasChamber;
83 m_Strip = right.m_Strip;
84 return *this;
85}
86
87int BesMucHit::operator==(const BesMucHit& right) const
88{
89 return (this==&right) ? 1 : 0;
90}
91
92void BesMucHit::SetVolume(G4VPhysicalVolume* pv)
93{
94 m_Volume = pv;
95 m_VolumeName = pv->GetLogicalVolume()->GetName();
96
97 G4LogicalVolume *lvGap = pv->GetMotherLogical();
98 G4String GapName = lvGap->GetName();
99
100 //G4cout<<" in BesMucHit ---- "<<m_VolumeName<<" "<<GapName<<G4endl;
101// // "logicalMucPart1Seg0Gap4Panel1GasChamber0"
102// // "logicalMucPart1Seg4Gap0"
103// G4String strPart = m_VolumeName.substr(14,1);
104// G4String strSeg = GapName.substr(18,1);
105// G4String strGap = m_VolumeName.substr(22,1);
106// G4String strPanel = m_VolumeName.substr(28,1);
107// G4String strGasChamber = m_VolumeName.substr(39,1);
108
109 // "logicalMucPart0Seg0Gap0RpcUpDown0Panel0GasChamber" 2006.10.17 liangyt
110 // "logicalMucPart0Seg0Gap0"
111
112 // "lMucP0S0G0R0Pn0C" 2006.12.05 liangyt
113 // "lMucP0S0G0"
114 G4String strPart = m_VolumeName.substr(5,1);
115 G4String strSeg = GapName.substr(7,1);
116 G4String strGap = m_VolumeName.substr(9,1);
117 G4String strGasChamber = m_VolumeName.substr(11,1); //same as rpcupdown
118 G4String strPanel = m_VolumeName.substr(14,1);
119// G4String strPart = m_VolumeName.substr(14,1);
120// G4String strSeg = GapName.substr(18,1);
121// G4String strGap = m_VolumeName.substr(22,1);
122// G4String strGasChamber = m_VolumeName.substr(32,1); //same as rpcupdown
123// G4String strPanel = m_VolumeName.substr(38,1);
124
125 std::istrstream partBuf(strPart.c_str(), strlen(strPart.c_str()));
126 std::istrstream segBuf(strSeg.c_str(), strlen(strSeg.c_str()));
127 std::istrstream gapBuf(strGap.c_str(), strlen(strGap.c_str()));
128 std::istrstream panelBuf(strPanel.c_str(), strlen(strPanel.c_str()));
129 std::istrstream gasChamberBuf(strGasChamber.c_str(), strlen(strGasChamber.c_str()));
130
131 partBuf >> m_Part ;
132 segBuf >> m_Seg;
133 gapBuf >> m_Gap;
134 panelBuf >> m_Panel;
135 gasChamberBuf >> m_GasChamber;
136}
137
138
140{
141 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
142 if(pVVisManager)
143 {
144 G4Circle circle(m_Pos);
145 circle.SetScreenSize(4.);
146 circle.SetFillStyle(G4Circle::filled);
147 G4Colour colour(0.,0.,1.);
148 G4VisAttributes attribs(colour);
149 circle.SetVisAttributes(attribs);
150 pVVisManager->Draw(circle);
151
152 //re-visualize a physical volume where a hit is detected
153 //
154 //
155 /* const G4ThreeVector& thrVector=G4ThreeVector(1.,0.,0.);
156 const G4RotationMatrix &rot =
157 G4RotationMatrix(thrVector,0.*deg);
158
159 G4Transform3D trans(rot, pos);
160 G4VisAttributes att;
161 const G4VPhysicalVolume* pPhys= detector->GetPhysicalTrap();
162 const G4LogicalVolume* logVol=
163 pPhys->GetLogicalVolume();
164 const G4VisAttributes* pVA=logVol->GetVisAttributes();
165 if(pVA) att=*pVA;
166 G4Colour col(1.,0.,0.);
167 att.SetColour(col);
168 att.SetForceSolid(true);
169
170 pVVisManager->Draw(*pPhys,att,trans);*/
171 }
172}
173
175{
176
177 G4cout << " Track id: " << m_TrackID
178 << " pdg code: " << m_PDGCode
179 << G4endl
180 << " energy deposit: " << G4BestUnit(m_Edep, "Energy")
181 << " pos: " << G4BestUnit(m_Pos, "Length")
182 << " posLocal: " << G4BestUnit(m_PosLocal, "Length")
183 << G4endl
184 << " energy: " << G4BestUnit(m_Energy, "Energy")
185 << " direction: " << m_Dir
186 << " time: " << G4BestUnit(m_Time,"Time")
187 << " volume name: " << m_VolumeName
188 << G4endl;
189}
190
191
192
193
G4Allocator< BesMucHit > BesMucHitAllocator
Definition: BesMucHit.cc:23
#define prt(n)
void SetVolume(G4VPhysicalVolume *pv)
Definition: BesMucHit.cc:92
void Draw()
Definition: BesMucHit.cc:139
int operator==(const BesMucHit &) const
Definition: BesMucHit.cc:87
~BesMucHit()
Definition: BesMucHit.cc:38
void Print()
Definition: BesMucHit.cc:174
const BesMucHit & operator=(const BesMucHit &)
Definition: BesMucHit.cc:64