125 G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
127 G4TouchableHandle pTouchableHandle = pPreStepPoint->GetTouchableHandle();
130 int gasID = pTouchableHandle->GetReplicaNumber();
131 int strawID = pTouchableHandle->GetReplicaNumber(
depth++);
132 int ringID = pTouchableHandle->GetReplicaNumber(
depth++);
133 int moduleID = pTouchableHandle->GetReplicaNumber(
depth);
135 int hitID = gasID % 2;
137 G4Track* pTrack = pStep->GetTrack();
141 G4ThreeVector globalPreStepPoint = pPreStepPoint->GetPosition();
143 G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
144 G4ThreeVector globalPostStepPoint = pPostStepPoint->GetPosition();
147 const G4TouchableHistory* pTouchableHistory =
148 static_cast<const G4TouchableHistory*
>(pPreStepPoint->GetTouchable());
150 const G4AffineTransform& topTransform = pTouchableHistory->GetHistory()->
153 G4ThreeVector localPreStepPoint = topTransform.TransformPoint(globalPreStepPoint);
154 G4ThreeVector localPostStepPoint = topTransform.TransformPoint(globalPostStepPoint);
156 double preStepZ = localPreStepPoint.z();
157 double postStepZ = localPostStepPoint.z();
160 double preStepX = localPreStepPoint.x();
161 double preStepY = localPreStepPoint.y();
163 double postStepX = localPostStepPoint.x();
164 double postStepY = localPostStepPoint.y();
168 double preStepR = std::sqrt(preStepX * preStepX + preStepY * preStepY);
169 double postStepR = std::sqrt(postStepX * postStepX + postStepY * postStepY);
171 if (preStepR > 2.0000001 || postStepR > 2.0000001)
177 std::cout <<
"!!!!! Barrel. Error in local coordinates of hits!" << std::endl;
178 std::cout <<
" barrelID=" << hitID <<
" ringID=" << ringID
179 <<
" moduleID=" << moduleID <<
" strawID=" << strawID
180 <<
" trackID=" << trHelp.GetUniqueID() << std::endl;
181 std::cout <<
" particleEncoding=" << particleEncoding;
183 if (kineticEnergy < 0.0001)
184 std::cout <<
" kineticEnergy=" << kineticEnergy * 1000000. <<
" eV";
185 else if (kineticEnergy < 0.1)
186 std::cout <<
" kineticEnergy=" << kineticEnergy * 1000. <<
" keV";
187 else if (kineticEnergy >= 100.)
188 std::cout <<
" kineticEnergy=" << kineticEnergy / 1000. <<
" GeV";
189 else if (kineticEnergy >= 100000.)
190 std::cout <<
" kineticEnergy=" << kineticEnergy / 1000000. <<
" TeV";
192 std::cout <<
" kineticEnergy=" << kineticEnergy <<
" MeV";
195 std::cout <<
" energyDeposit=" <<
energyDeposit * 1000. <<
" eV"
198 std::cout <<
" energyDeposit=" <<
energyDeposit / 1000. <<
" MeV"
201 std::cout <<
" energyDeposit=" <<
energyDeposit <<
" keV" << std::endl;
203 std::cout <<
" preStepX=" << preStepX <<
" mm preStepY=" << preStepY
204 <<
" mm preStepR=" << preStepR <<
" mm" << std::endl;
205 std::cout <<
" postStepX=" << postStepX <<
" mm postStepY=" << postStepY
206 <<
" mm postStepR=" << postStepR <<
" mm" << std::endl << std::endl;
210 double preStepGlobalTime = pPreStepPoint->GetGlobalTime();
211 double postStepGlobalTime = pPostStepPoint->GetGlobalTime();
212 double globalTime = (preStepGlobalTime + postStepGlobalTime) / 2.;
222 hitID += (ringID << 15);
223 hitID += (moduleID << 10);
224 hitID += (layerID << 5);