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