BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
BesMucDigit Class Reference

#include <BesMucDigit.hh>

Public Member Functions

 BesMucDigit ()
 
 ~BesMucDigit ()
 
void SetHit (BesMucHit *hit)
 
G4int GetTrackIndex ()
 
G4int GetPart ()
 
G4int GetSeg ()
 
G4int GetGap ()
 
G4VPhysicalVolume * GetNearestStrip ()
 
G4int GetNearestStripNo ()
 
G4VPhysicalVolume * GetStrip (G4int i)
 
G4float GetStripPos (G4VPhysicalVolume *pvStrip)
 
G4int IsNearest (G4int i)
 
 BesMucDigit ()
 
 ~BesMucDigit ()
 
void SetHit (BesMucHit *hit)
 
G4int GetTrackIndex ()
 
G4int GetPart ()
 
G4int GetSeg ()
 
G4int GetGap ()
 
G4VPhysicalVolume * GetNearestStrip ()
 
G4int GetNearestStripNo ()
 
G4VPhysicalVolume * GetStrip (G4int i)
 
G4float GetStripPos (G4VPhysicalVolume *pvStrip)
 
G4int IsNearest (G4int i)
 

Detailed Description

Constructor & Destructor Documentation

◆ BesMucDigit() [1/2]

BesMucDigit::BesMucDigit ( )

Definition at line 21 of file BesMucDigit.cc.

22{
23}

◆ ~BesMucDigit() [1/2]

BesMucDigit::~BesMucDigit ( )

Definition at line 25 of file BesMucDigit.cc.

26{
27}

◆ BesMucDigit() [2/2]

BesMucDigit::BesMucDigit ( )

◆ ~BesMucDigit() [2/2]

BesMucDigit::~BesMucDigit ( )

Member Function Documentation

◆ GetGap() [1/2]

G4int BesMucDigit::GetGap ( )
inline

◆ GetGap() [2/2]

G4int BesMucDigit::GetGap ( )
inline

Definition at line 40 of file Simulation/BOOST/MucSim/MucSim-00-01-03/MucSim/BesMucDigit.hh.

40{ return m_pHit->GetGap(); }

◆ GetNearestStrip() [1/2]

G4VPhysicalVolume * BesMucDigit::GetNearestStrip ( )

Definition at line 53 of file BesMucDigit.cc.

54{
55 m_pvStripDigit = GetStrip( GetNearestStripNo() );
56 if(!m_pvStripDigit) {
57 G4cerr << "Nearest Strip is not found." << G4endl;
58 }
59
60 return m_pvStripDigit;
61}
G4VPhysicalVolume * GetStrip(G4int i)
Definition: BesMucDigit.cc:106
G4int GetNearestStripNo()
Definition: BesMucDigit.cc:63

Referenced by BesMucEfficiency::SetHit().

◆ GetNearestStrip() [2/2]

G4VPhysicalVolume * BesMucDigit::GetNearestStrip ( )

◆ GetNearestStripNo() [1/2]

G4int BesMucDigit::GetNearestStripNo ( )

Definition at line 63 of file BesMucDigit.cc.

64{
65 if(m_pHit->GetTrackID()!=-1){
66 G4float posStrip0 = GetStripPos( GetStrip(0) );
67 G4float posStrip1 = GetStripPos( GetStrip(1) );
68 G4float width = posStrip1 - posStrip0;
69 //G4cout << "posStrip0 " << posStrip0 << " posStrip1 " << posStrip1 << G4endl;
70
71 G4int iGuessStrip = G4int( (m_Pos - posStrip0)/width + 0.5 );
72 // confine iGuessStrip to an extend before check IsNearest.
73 if(iGuessStrip < 0) {
74 iGuessStrip = 0;
75 }
76 else if(iGuessStrip >= 112) {
77 iGuessStrip = 112;
78 }
79 //G4cout << "m_pos=" << m_Pos << "firstly, I guess: " << iGuessStrip << G4endl;
80
81 G4int step = IsNearest(iGuessStrip);
82 while(step != 0) {
83 //G4cout << "guess " << iGuessStrip << " wrong , iGuess " << step << G4endl;
84 iGuessStrip += step;
85 step = IsNearest(iGuessStrip);
86 }
87 //G4cout << " guess " << iGuessStrip << " right " << G4endl;
88
89 //deal with barrel segment 2 gap%2!=0
90 G4int part = m_pHit->GetPart();
91 G4int seg = m_pHit->GetSeg();
92 G4int gap = m_pHit->GetGap();
93 //G4cout<<" in Digit iGuessStrip = "<< iGuessStrip <<G4endl;
94 if(part == 1 && seg == 2 &&gap%2 != 0 && iGuessStrip > 79 ){
95 if(iGuessStrip > 79 && iGuessStrip <= 95 && m_Pos2 < 0) iGuessStrip += 16 ;
96 if(iGuessStrip > 95 && iGuessStrip <= 111 && m_Pos2 > 0) iGuessStrip -= 16 ;
97 //G4cout<<" in barrel segment 2 and gap%2!=0, and strip > 79 strip="<< iGuessStrip<<" posx="<<m_Pos2<<" "<<" posy="<<m_Pos<<G4endl;
98 }
99
100 return iGuessStrip;
101 }
102 else return m_pHit->GetStrip();
103}
G4float GetStripPos(G4VPhysicalVolume *pvStrip)
Definition: BesMucDigit.cc:129
G4int IsNearest(G4int i)
Definition: BesMucDigit.cc:158

Referenced by BesMucDigitizer::Digitize(), GetNearestStrip(), BesMucSD::ProcessHits(), and BesMucEfficiency::SetHit().

◆ GetNearestStripNo() [2/2]

G4int BesMucDigit::GetNearestStripNo ( )

◆ GetPart() [1/2]

G4int BesMucDigit::GetPart ( )
inline

Definition at line 38 of file InstallArea/include/MucSim/MucSim/BesMucDigit.hh.

38{ return m_pHit->GetPart(); }

Referenced by BesMucDigitizer::Digitize(), and BesMucSD::ProcessHits().

◆ GetPart() [2/2]

G4int BesMucDigit::GetPart ( )
inline

Definition at line 38 of file Simulation/BOOST/MucSim/MucSim-00-01-03/MucSim/BesMucDigit.hh.

38{ return m_pHit->GetPart(); }

◆ GetSeg() [1/2]

G4int BesMucDigit::GetSeg ( )
inline

Definition at line 39 of file InstallArea/include/MucSim/MucSim/BesMucDigit.hh.

39{ return m_pHit->GetSeg(); }

Referenced by BesMucDigitizer::Digitize(), and BesMucSD::ProcessHits().

◆ GetSeg() [2/2]

G4int BesMucDigit::GetSeg ( )
inline

Definition at line 39 of file Simulation/BOOST/MucSim/MucSim-00-01-03/MucSim/BesMucDigit.hh.

39{ return m_pHit->GetSeg(); }

◆ GetStrip() [1/2]

G4VPhysicalVolume * BesMucDigit::GetStrip ( G4int  i)

Definition at line 106 of file BesMucDigit.cc.

107{
108 // If no strip get, return 0.
109 // If i > daughtersNo, there will be run error.
110 G4LogicalVolume *lvStripPlane = m_lvGap->GetDaughter(0)->GetLogicalVolume();
111 G4int daughtersNo = lvStripPlane->GetNoDaughters();
112
113 if(i >= 0 && i < daughtersNo) {
114 G4VPhysicalVolume* pvStrip = lvStripPlane->GetDaughter(i);
115 G4String strStrip = pvStrip->GetLogicalVolume()->GetName();
116 //G4cout << "length " << strStrip.length() << G4endl;
117 //if(strStrip.length() == 30) { //use name length to determine whether it is a strip
118
119 if (strStrip.find("s") == 10) { //"Strip" at 23 of "logicalMucPart1Seg0Gap0Strip111"
120 //"s" at 10 of lMucP0S0G0s001
121 return pvStrip;
122 }
123 //return pvStrip;
124 }
125
126 return 0;
127}

Referenced by GetNearestStrip(), GetNearestStripNo(), and IsNearest().

◆ GetStrip() [2/2]

G4VPhysicalVolume * BesMucDigit::GetStrip ( G4int  i)

◆ GetStripPos() [1/2]

G4float BesMucDigit::GetStripPos ( G4VPhysicalVolume *  pvStrip)

Definition at line 129 of file BesMucDigit.cc.

130{
131 G4float pos = 1.0e38;
132 if (!pvStrip) return pos;
133
134 G4int part = m_pHit->GetPart();
135 G4int gap = m_pHit->GetGap();
136
137 pos = pvStrip->GetObjectTranslation().x();
138 if ( (part == 1 && gap%2 != 0) || (part != 1 && gap%2 == 0) ) {
139 pos = pvStrip->GetObjectTranslation().y();
140 }
141
142 G4String striptype= pvStrip->GetLogicalVolume()->GetSolid()->GetEntityType();
143// G4String striplenght= pvStrip->GetLogicalVolume()->GetName();
144 G4Box *temp;
145 temp=(G4Box *)pvStrip->GetLogicalVolume()->GetSolid();
146 G4double length=temp->GetXHalfLength();
147// std::ostream length;
148// pvStrip->GetLogicalVolume()->GetSolid()->StreamInfo( length);
149
150 G4float box1,box2,box3;
151// length>>box1>>box2>>box3;
152 //G4cout<<length<<" "<<striptype<<" in GetStripPos "<<pvStrip->GetObjectTranslation().x()<<" "<<pvStrip->GetObjectTranslation().y()<<" "<<pvStrip->GetObjectTranslation().z()<<G4endl;
153 return pos;
154}

Referenced by GetNearestStripNo(), and IsNearest().

◆ GetStripPos() [2/2]

G4float BesMucDigit::GetStripPos ( G4VPhysicalVolume *  pvStrip)

◆ GetTrackIndex() [1/2]

G4int BesMucDigit::GetTrackIndex ( )
inline

◆ GetTrackIndex() [2/2]

G4int BesMucDigit::GetTrackIndex ( )
inline

Definition at line 37 of file Simulation/BOOST/MucSim/MucSim-00-01-03/MucSim/BesMucDigit.hh.

37{ return m_pHit->GetTrackIndex(); }

◆ IsNearest() [1/2]

G4int BesMucDigit::IsNearest ( G4int  i)

Definition at line 158 of file BesMucDigit.cc.

159{
160 G4float posMax = 1.0e38;
161 G4float posLeftStrip;
162 G4float posRightStrip;
163 G4float posCurrentStrip;
164
165 G4VPhysicalVolume* pvLeftStrip = GetStrip(i-1);
166 G4VPhysicalVolume* pvRightStrip = GetStrip(i+1);
167 G4VPhysicalVolume* pvCurrentStrip = GetStrip(i);
168
169 if(i < 0) {
170 return i;
171 }
172 else if(i == 0) {
173 posLeftStrip = -1.0*posMax;
174 posRightStrip = GetStripPos( pvRightStrip );
175 }
176 else if(!pvCurrentStrip) {
177 // i > Max.
178 return -1;
179 }
180 else if(!pvRightStrip) {
181 // i = Max.
182 posLeftStrip = GetStripPos( pvLeftStrip );
183 posRightStrip = posMax;
184 }
185 else {
186 // 0 < i < Max.
187 posLeftStrip = GetStripPos( pvLeftStrip );
188 posRightStrip = GetStripPos( pvRightStrip );
189 }
190 posCurrentStrip = GetStripPos( pvCurrentStrip );
191
192 G4float distCurrent = std::abs(m_Pos - posCurrentStrip);
193 G4float distLeft = std::abs(m_Pos - posLeftStrip);
194 G4float distRight = std::abs(m_Pos - posRightStrip);
195
196 //G4cout << "left " << distLeft << " current " << distCurrent << " right " << distRight << G4endl;
197
198 if( (distCurrent <= distLeft) && (distCurrent <= distRight) ) {
199 return 0;
200 }
201 else if(distCurrent > distLeft) {
202 return -1;
203 }
204 else {
205 return 1;
206 }
207
208}

Referenced by GetNearestStripNo().

◆ IsNearest() [2/2]

G4int BesMucDigit::IsNearest ( G4int  i)

◆ SetHit() [1/2]

void BesMucDigit::SetHit ( BesMucHit hit)

Definition at line 29 of file BesMucDigit.cc.

30{
31 m_pHit = hit;
32
33 G4int part = m_pHit->GetPart();
34 G4int seg = m_pHit->GetSeg();
35 G4int gap = m_pHit->GetGap();
36 m_Pos = m_pHit->GetPosLocal().x();
37 if ( (part == 1 && gap%2 != 0) || (part != 1 && gap%2 == 0) ) {
38 m_Pos = m_pHit->GetPosLocal().y();
39 }
40
41 if(part == 1 && seg == 2 &&gap%2 != 0) m_Pos2 = m_pHit->GetPosLocal().x();
42
43 G4VPhysicalVolume* pvGasChamber = m_pHit->GetVolume();
44 if(m_pHit->GetTrackID()!=-1){
45 m_lvGap = pvGasChamber->GetMotherLogical(); //after update gdml, mother of gaschamber change to be aluminumbox, but i still use the name m_lvGap
46 m_lvGapName = m_lvGap->GetName();
47
48 //G4cout<<"in digit----"<<m_lvGapName<<" "<<m_lvGap->GetDaughter(1)->GetLogicalVolume()->GetName()<<G4endl;
49 }
50}

Referenced by BesMucDigitizer::Digitize(), BesMucSD::ProcessHits(), and BesMucEfficiency::SetHit().

◆ SetHit() [2/2]

void BesMucDigit::SetHit ( BesMucHit hit)

The documentation for this class was generated from the following files: