172 for (Int_t iPoint = 0; iPoint <
fTofCollection->GetEntriesFast(); iPoint++) {
176 Int_t iNCells = tCurrentPoint->
GetNCells();
177 tCurrentPoint->SetTime(tCurrentPoint->GetTime() / iNCells);
178 tCurrentPoint->SetLength(tCurrentPoint->GetLength() / iNCells);
179 tCurrentPoint->SetX(tCurrentPoint->GetX() / iNCells);
180 tCurrentPoint->SetY(tCurrentPoint->GetY() / iNCells);
181 tCurrentPoint->SetZ(tCurrentPoint->GetZ() / iNCells);
182 tCurrentPoint->
SetPx(tCurrentPoint->GetPx() / iNCells);
183 tCurrentPoint->
SetPy(tCurrentPoint->GetPy() / iNCells);
184 tCurrentPoint->
SetPz(tCurrentPoint->GetPz() / iNCells);
186 if (1 == tCurrentPoint->GetNLinks()) {
188 FairLink tLinkToTrack = tCurrentPoint->GetLink(0);
189 tLinkToTrack.SetLink(0,
fOutputTreeEntry, tLinkToTrack.GetType(), tLinkToTrack.GetIndex());
190 tCurrentPoint->SetLink(tLinkToTrack);
198 FairMCEventHeader* tEventHeader = FairRunSim::Instance()->GetMCEventHeader();
200 Double_t dTargetVertexT = tEventHeader->GetT();
202 Double_t dGlobalTargetCoordinates[3] = {tEventHeader->GetX(), tEventHeader->GetY(), tEventHeader->GetZ()};
203 Double_t dGlobalTargetCoordinates1[3] = {tEventHeader->GetX(), tEventHeader->GetY(), tEventHeader->GetZ() + 1.};
204 Double_t dGlobalCounterCoordinates[3] = {0., 0., 0.};
205 Double_t dLocalTargetCoordinates[3] = {0., 0., 0.};
206 Double_t dLocalTargetCoordinates1[3] = {0., 0., 0.};
207 Double_t dLocalCounterCoordinates[3] = {0., 0., 0.};
209 TGeoPhysicalNode* tCurrentNode(NULL);
210 Int_t iModuleType(0);
211 Int_t iModuleIndex(0);
212 Int_t iCounterIndex(0);
213 Int_t iUniqueCounterId(0);
218 iModuleType = std::get<0>(CounterInBeam.first);
219 iModuleIndex = std::get<1>(CounterInBeam.first);
220 iCounterIndex = std::get<2>(CounterInBeam.first);
226 tCurrentNode = (CounterInBeam.second).second;
229 tCurrentNode->GetMatrix()->MasterToLocal(dGlobalTargetCoordinates, dLocalTargetCoordinates);
230 tCurrentNode->GetMatrix()->MasterToLocal(dGlobalTargetCoordinates1, dLocalTargetCoordinates1);
233 dLocalCounterCoordinates[0] = dLocalTargetCoordinates[0]
234 - dLocalTargetCoordinates[2]
235 * (dLocalTargetCoordinates1[0] - dLocalTargetCoordinates[0])
236 / (dLocalTargetCoordinates1[2] - dLocalTargetCoordinates[2]);
237 dLocalCounterCoordinates[1] = dLocalTargetCoordinates[1]
238 - dLocalTargetCoordinates[2]
239 * (dLocalTargetCoordinates1[1] - dLocalTargetCoordinates[1])
240 / (dLocalTargetCoordinates1[2] - dLocalTargetCoordinates[2]);
244 if (tCurrentNode->GetShape()->Contains(dLocalCounterCoordinates)) {
246 tCurrentNode->GetMatrix()->LocalToMaster(dLocalCounterCoordinates, dGlobalCounterCoordinates);
250 Double_t dBeamMomentumLab = FairRunSim::Instance()->GetBeamMom();
251 Double_t dCounterBeamTime = dTargetVertexT;
254 Double_t dCounterTargetDistance = dGlobalCounterCoordinates[2] - dGlobalTargetCoordinates[2];
256 if (0. < dBeamMomentumLab) {
257 Double_t dBeamVelocityLab = dBeamMomentumLab
258 / TMath::Sqrt(TMath::Power(dBeamMomentumLab, 2.) + TMath::Power(0.938271998, 2.))
260 dCounterBeamTime += dCounterTargetDistance / dBeamVelocityLab;
265 tBeamPoint->SetDetectorID(iUniqueCounterId);
267 tBeamPoint->SetTime(dCounterBeamTime * 1.0e09);
268 tBeamPoint->SetLength(dCounterTargetDistance);
269 tBeamPoint->SetX(dGlobalCounterCoordinates[0]);
270 tBeamPoint->SetY(dGlobalCounterCoordinates[1]);
271 tBeamPoint->SetZ(dGlobalCounterCoordinates[2]);
272 tBeamPoint->
SetPz(dBeamMomentumLab);
291 Int_t iTrackID = gMC->GetStack()->GetCurrentTrackNumber();
293 Double_t dTrackEnergyDeposit = gMC->Edep();
296 Bool_t bCounterPointExists = kFALSE;
302 for (Int_t iPoint =
fTofCollection->GetEntriesFast() - 1; iPoint >= 0; iPoint--) {
305 if (tCounterPoint->GetDetectorID() == iCounterID && tCounterPoint->GetTrackID() == iTrackID) {
306 bCounterPointExists = kTRUE;
316 if (gMC->IsTrackEntering()) {
317 Double_t dTrackTime = gMC->TrackTime() * 1.0e09;
318 Double_t dTrackLength = gMC->TrackLength();
319 Double_t dTrackPositionX(0.);
320 Double_t dTrackPositionY(0.);
321 Double_t dTrackPositionZ(0.);
322 gMC->TrackPosition(dTrackPositionX, dTrackPositionY, dTrackPositionZ);
323 Double_t dTrackMomentumX(0.);
324 Double_t dTrackMomentumY(0.);
325 Double_t dTrackMomentumZ(0.);
326 Double_t dTrackEnergy(0.);
327 gMC->TrackMomentum(dTrackMomentumX, dTrackMomentumY, dTrackMomentumZ, dTrackEnergy);
329 if (bCounterPointExists) {
330 tCounterPoint->SetTime(tCounterPoint->GetTime() + dTrackTime);
331 tCounterPoint->SetLength(tCounterPoint->GetLength() + dTrackLength);
332 tCounterPoint->SetEnergyLoss(tCounterPoint->GetEnergyLoss() + dTrackEnergyDeposit);
333 tCounterPoint->SetX(tCounterPoint->GetX() + dTrackPositionX);
334 tCounterPoint->SetY(tCounterPoint->GetY() + dTrackPositionY);
335 tCounterPoint->SetZ(tCounterPoint->GetZ() + dTrackPositionZ);
336 tCounterPoint->
SetPx(tCounterPoint->GetPx() + dTrackMomentumX);
337 tCounterPoint->
SetPy(tCounterPoint->GetPy() + dTrackMomentumY);
338 tCounterPoint->
SetPz(tCounterPoint->GetPz() + dTrackMomentumZ);
343 tCounterPoint->SetTrackID(iTrackID);
344 tCounterPoint->SetDetectorID(iCounterID);
347 tCounterPoint->SetTime(dTrackTime);
348 tCounterPoint->SetLength(dTrackLength);
349 tCounterPoint->SetEnergyLoss(dTrackEnergyDeposit);
350 tCounterPoint->SetX(dTrackPositionX);
351 tCounterPoint->SetY(dTrackPositionY);
352 tCounterPoint->SetZ(dTrackPositionZ);
353 tCounterPoint->
SetPx(dTrackMomentumX);
354 tCounterPoint->
SetPy(dTrackMomentumY);
355 tCounterPoint->
SetPz(dTrackMomentumZ);
366 tCounterPoint->SetEnergyLoss(tCounterPoint->GetEnergyLoss() + dTrackEnergyDeposit);
372 if (gMC->IsTrackEntering()) {
374 fTime = gMC->TrackTime() * 1.0e09;
376 gMC->TrackPosition(
fPos);
377 gMC->TrackMomentum(
fMom);
384 if (((0 == gMC->GetStack()->GetCurrentTrack()->GetPdgCode()) ||
385 (gMC->TrackCharge() != 0))
386 && (gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared())) {
388 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
392 LOG(debug2) <<
"CbmTof::TID: " <<
fTrackID;
400 LOG(debug2) << Form(
" x: %6.2f",
fPos.X());
401 LOG(debug2) << Form(
" y: %6.2f",
fPos.Y());
402 LOG(debug2) << Form(
" z: %6.2f",
fPos.Z());