Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TPC MC: Move hit exlusion after Track Ref creation #13749

Merged
merged 2 commits into from
Nov 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions Detectors/TPC/simulation/src/Detector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,25 @@ Bool_t Detector::ProcessHits(FairVolume* vol)
// TODO: Temporary hack to process only one sector
// if (sectorID != 0) return kFALSE;

// ---| momentum and beta gamma |---
static TLorentzVector momentum; // static to make avoid creation/deletion of this expensive object
fMC->TrackMomentum(momentum);

const float time = fMC->TrackTime() * 1.0e9;
const int trackID = fMC->GetStack()->GetCurrentTrackNumber();
const int detID = vol->getMCid();
o2::data::Stack* stack = (o2::data::Stack*)fMC->GetStack();
if (fMC->IsTrackEntering() || fMC->IsTrackExiting()) {
stack->addTrackReference(o2::TrackReference(position.X(), position.Y(), position.Z(), momentum.X(), momentum.Y(),
momentum.Z(), fMC->TrackLength(), time, trackID, GetDetId()));
lastReferenceR = fMC->TrackLength();
}
if (TMath::Abs(lastReferenceR - fMC->TrackLength()) > kMaxDistRef) { /// we can speedup
stack->addTrackReference(o2::TrackReference(position.X(), position.Y(), position.Z(), momentum.X(), momentum.Y(),
momentum.Z(), fMC->TrackLength(), time, trackID, GetDetId()));
lastReferenceR = fMC->TrackLength();
}

// ---| remove clusters between the IFC and the FC strips |---
// those should not enter the active readout area
// do coarse selection before, to limit number of transformations
Expand All @@ -164,24 +183,6 @@ Bool_t Detector::ProcessHits(FairVolume* vol)
}
}

// ---| momentum and beta gamma |---
static TLorentzVector momentum; // static to make avoid creation/deletion of this expensive object
fMC->TrackMomentum(momentum);

const float time = fMC->TrackTime() * 1.0e9;
const int trackID = fMC->GetStack()->GetCurrentTrackNumber();
const int detID = vol->getMCid();
o2::data::Stack* stack = (o2::data::Stack*)fMC->GetStack();
if (fMC->IsTrackEntering() || fMC->IsTrackExiting()) {
stack->addTrackReference(o2::TrackReference(position.X(), position.Y(), position.Z(), momentum.X(), momentum.Y(),
momentum.Z(), fMC->TrackLength(), time, trackID, GetDetId()));
}
if (TMath::Abs(lastReferenceR - fMC->TrackLength()) > kMaxDistRef) { /// we can speedup
stack->addTrackReference(o2::TrackReference(position.X(), position.Y(), position.Z(), momentum.X(), momentum.Y(),
momentum.Z(), fMC->TrackLength(), time, trackID, GetDetId()));
lastReferenceR = fMC->TrackLength();
}

// ===| CONVERT THE ENERGY LOSS TO IONIZATION ELECTRONS |=====================
//
// The energy loss is implemented directly below and taken GEANT3,
Expand Down
Loading