79 {
80
81 G4double chg = aStep->GetTrack()->GetDefinition()->GetPDGCharge();
82 G4double edep = aStep->GetTotalEnergyDeposit();
83 G4double stepL = aStep->GetStepLength();
84 G4double deltaT = aStep->GetDeltaTime();
85 G4StepPoint* preStep = aStep->GetPreStepPoint();
86 G4ThreeVector pDirection = preStep->GetMomentumDirection();
87 G4String particleName = aStep->GetTrack()->GetDefinition()->GetParticleName();
88 G4Material* scinMaterial = aStep->GetTrack()->GetMaterial();
89 G4double charge = aStep->GetTrack()->GetDefinition()->GetPDGCharge();
90 G4int pdgcode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
91
92 if ( chg == 0 && edep == 0 && stepL == 0 ) { return false; }
93
94 BesTofHit* newHit = new BesTofHit();
95 G4int trackId = aStep->GetTrack()->GetTrackID();
96
99 newHit->
SetG4Index( aStep->GetTrack()->GetTrackID() );
102
103 newHit->
SetTrackL( aStep->GetTrack()->GetTrackLength() );
104 G4ThreeVector pos = preStep->GetPosition();
106 G4double globalTime = preStep->GetGlobalTime();
111
114
115
116 G4ThreeVector locPos( 0, 0, 0 );
117 G4TouchableHistory* theTouchable = (G4TouchableHistory*)( preStep->GetTouchable() );
118
119
120
121
122 G4String name;
123
124
125
126
127
128 name = theTouchable->GetVolume( 0 )->GetName();
129
130 G4int partId = -1, scinNb = -1, gapNb = -1, number = -1;
131 G4int strip = -1;
132 gapNb = theTouchable->GetReplicaNumber( 0 );
133 number = theTouchable->GetReplicaNumber( 2 );
134
135
136 if ( name.contains( "physical_gasLayer" ) )
137 {
138 locPos = theTouchable->GetHistory()->GetTopTransform().TransformPoint( pos );
139 number = theTouchable->GetReplicaNumber( 3 );
140 scinNb = number;
141
142 G4String name1 = theTouchable->GetVolume( 4 )->GetName();
143 if ( name1 == "physicalEcTofEast" ) partId = 3;
144 else if ( name1 == "physicalEcTofWest" ) partId = 4;
145
146 }
147
148 else if ( name == "logical_gasLayer" )
149 {
150 locPos = theTouchable->GetHistory()->GetTopTransform().TransformPoint( pos );
151 number = theTouchable->GetReplicaNumber( 3 );
152 scinNb = 35 - number;
153
154 G4String name1 = theTouchable->GetVolume( 4 )->GetName();
155 if ( name1 == "logicalEcTofEast" ) partId = 3;
156 else if ( name1 == "logicalEcTofWest" ) partId = 4;
157
158 }
159
160
161 else if ( name == "physicalScinBr1" )
162 {
163 partId = 1;
164 scinNb = number;
165
166 }
167 else if ( name == "physicalScinBr2" )
168 {
169 partId = 1;
170 scinNb = number + 88;
171
172 }
173 else if ( name == "physicalScinEcWest" )
174 {
175 partId = 2;
176 scinNb = number;
177
178 }
179 else if ( name == "physicalScinEcEast" )
180 {
181 partId = 0;
182 scinNb = number;
183
184 }
185
186
187 else if ( name == "logicalScinBr1" || name == "logicalScinBr2" )
188 {
189 partId = 1;
190 scinNb = ( 527 - number ) / 3;
191 }
192
193 else if ( name == "logicalScinEcEast" )
194 {
195 partId = 0;
196 scinNb = ( 95 - number ) / 2;
197 }
198 else if ( name == "logicalScinEcWest" )
199 {
200 partId = 2;
201 scinNb = ( 95 - number ) / 2;
202 }
203 else { return false; }
204
205 if ( name.contains( "physical_gasLayer" ) || name.contains( "logical_gasLayer" ) )
206 {
207 G4double zz = locPos.z() - 0.5 * mm +
208 ( 24 + 3 ) * mm * 6;
209 if ( zz <= 0 ) { strip = 0; }
210 else if ( zz > 0 && zz < 12 * 27 * mm )
211 {
212 for ( G4int i = 0; i < 12; i++ )
213 {
214 if ( zz > i * 27 * mm && zz <= ( i + 1 ) * 27 * mm )
215 {
216 strip = i;
217
218 break;
219 }
220 }
221 }
222 else { strip = 11; }
223 if ( strip < 0 ) strip = 0;
224 if ( strip > 11 ) strip = 11;
225 }
226
233
235
236
237 G4int trackIndex, g4TrackId;
240
241 if ( edep > 0 ) { m_besTofCollection->insert( newHit ); }
242
243
244 if ( m_besTofList )
245 {
246 G4int trackIndex, g4TrackId;
249 if ( m_trackIndex != trackIndex )
250 {
251 m_trackIndex = trackIndex;
252
253
254
255
256
257
258
259
260
262 G4int pdg =
abs( aStep->GetTrack()->GetDefinition()->GetPDGEncoding() );
263 if ( pdg == 12 || pdg == 14 || pdg == 16 ) {
flag = 0; }
264 if (
flag && aStep->GetTrack()->GetTrackID() == g4TrackId )
265 {
266 m_trackIndexes.push_back( trackIndex );
267 BesTofHit* truHit = new BesTofHit();
268 *truHit = *newHit;
269 m_besTofList->insert( truHit );
270 }
271 }
272 }
273 if ( edep <= 0 ) { delete newHit; }
274
275 return true;
276
277}
void GetCurrentTrackIndex(G4int &trackIndex, G4int &g4TrackId) const
void SetEvent(G4double event)
void SetModule(G4int module)
void SetPos(G4ThreeVector pos)
void SetDeltaT(G4double deltaT)
void SetCharge(G4double charge)
void SetPDGcode(G4int pdgcode)
void SetTrackIndex(G4int trackIndex)
void SetPDirection(G4ThreeVector pDirection)
void SetPartId(G4int partId)
void SetLocPos(G4ThreeVector locPos)
void SetScinNb(G4int scinNb)
void SetGapNb(G4int gapNb)
void SetStrip(G4int strip)
void SetStepL(G4double stepL)
void SetTrackL(G4double length)
void SetTime(G4double time)
void SetEdep(G4double edep)
void SetMomentum(G4ThreeVector momentum)
void SetG4Index(G4int index)
G4int SampleNumberOfIonsAlongStep(const G4Step *, G4ElectronIonPair *)