Skip to content

Commit

Permalink
refactor(Stack): Use more GetParticle
Browse files Browse the repository at this point in the history
GetParticle is a thin wrapper. Let's use it more.
  • Loading branch information
ChristianTackeGSI committed Jan 28, 2025
1 parent c5e1460 commit 4745af1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions examples/common/mcstack/FairStack.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* Copyright (C) 2014-2025 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
Expand Down Expand Up @@ -167,7 +167,7 @@ TParticle* FairStack::PopPrimaryForTracking(Int_t iPrim)

// Return the iPrim-th TParticle from the fParticle array. This should be
// a primary.
TParticle* part = static_cast<TParticle*>(fParticles->At(iPrim));
TParticle* part = GetParticle(iPrim);
if (!(part->GetMother(0) < 0)) {
LOG(fatal) << "Not a primary track!" << iPrim;
}
Expand Down
6 changes: 3 additions & 3 deletions templates/project_root_containers/MyProjData/MyProjStack.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* Copyright (C) 2014-2025 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
Expand Down Expand Up @@ -207,7 +207,7 @@ TParticle* MyProjStack::PopPrimaryForTracking(Int_t iPrim)

// Return the iPrim-th TParticle from the fParticle array. This should be
// a primary.
TParticle* part = (TParticle*)fParticles->At(iPrim);
TParticle* part = GetParticle(iPrim);
if (!(part->GetMother(0) < 0)) {
LOG(fatal) << "MyProjStack:: Not a primary track! " << iPrim;
}
Expand Down Expand Up @@ -425,7 +425,7 @@ TParticle* MyProjStack::GetParticle(Int_t trackID) const
if (trackID < 0 || trackID >= fNParticles) {
LOG(fatal) << "MyProjStack: Particle index " << trackID << " out of range.";
}
return (TParticle*)fParticles->At(trackID);
return static_cast<TParticle*>(fParticles->At(trackID));
}
// -------------------------------------------------------------------------

Expand Down
6 changes: 3 additions & 3 deletions templates/project_stl_containers/MyProjData/MyProjStack.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* Copyright (C) 2014-2025 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
Expand Down Expand Up @@ -207,7 +207,7 @@ TParticle* MyProjStack::PopPrimaryForTracking(Int_t iPrim)

// Return the iPrim-th TParticle from the fParticle array. This should be
// a primary.
TParticle* part = (TParticle*)fParticles->At(iPrim);
TParticle* part = GetParticle(iPrim);
if (!(part->GetMother(0) < 0)) {
LOG(fatal) << "MyProjStack:: Not a primary track! " << iPrim;
}
Expand Down Expand Up @@ -430,7 +430,7 @@ TParticle* MyProjStack::GetParticle(Int_t trackID) const
if (trackID < 0 || trackID >= fNParticles) {
LOG(fatal) << "MyProjStack: Particle index " << trackID << " out of range.";
}
return (TParticle*)fParticles->At(trackID);
return static_cast<TParticle*>(fParticles->At(trackID));
}
// -------------------------------------------------------------------------

Expand Down

0 comments on commit 4745af1

Please sign in to comment.