Skip to content

Commit 4745af1

Browse files
refactor(Stack): Use more GetParticle
GetParticle is a thin wrapper. Let's use it more.
1 parent c5e1460 commit 4745af1

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

examples/common/mcstack/FairStack.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2025 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -167,7 +167,7 @@ TParticle* FairStack::PopPrimaryForTracking(Int_t iPrim)
167167

168168
// Return the iPrim-th TParticle from the fParticle array. This should be
169169
// a primary.
170-
TParticle* part = static_cast<TParticle*>(fParticles->At(iPrim));
170+
TParticle* part = GetParticle(iPrim);
171171
if (!(part->GetMother(0) < 0)) {
172172
LOG(fatal) << "Not a primary track!" << iPrim;
173173
}

templates/project_root_containers/MyProjData/MyProjStack.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2025 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -207,7 +207,7 @@ TParticle* MyProjStack::PopPrimaryForTracking(Int_t iPrim)
207207

208208
// Return the iPrim-th TParticle from the fParticle array. This should be
209209
// a primary.
210-
TParticle* part = (TParticle*)fParticles->At(iPrim);
210+
TParticle* part = GetParticle(iPrim);
211211
if (!(part->GetMother(0) < 0)) {
212212
LOG(fatal) << "MyProjStack:: Not a primary track! " << iPrim;
213213
}
@@ -425,7 +425,7 @@ TParticle* MyProjStack::GetParticle(Int_t trackID) const
425425
if (trackID < 0 || trackID >= fNParticles) {
426426
LOG(fatal) << "MyProjStack: Particle index " << trackID << " out of range.";
427427
}
428-
return (TParticle*)fParticles->At(trackID);
428+
return static_cast<TParticle*>(fParticles->At(trackID));
429429
}
430430
// -------------------------------------------------------------------------
431431

templates/project_stl_containers/MyProjData/MyProjStack.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2025 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -207,7 +207,7 @@ TParticle* MyProjStack::PopPrimaryForTracking(Int_t iPrim)
207207

208208
// Return the iPrim-th TParticle from the fParticle array. This should be
209209
// a primary.
210-
TParticle* part = (TParticle*)fParticles->At(iPrim);
210+
TParticle* part = GetParticle(iPrim);
211211
if (!(part->GetMother(0) < 0)) {
212212
LOG(fatal) << "MyProjStack:: Not a primary track! " << iPrim;
213213
}
@@ -430,7 +430,7 @@ TParticle* MyProjStack::GetParticle(Int_t trackID) const
430430
if (trackID < 0 || trackID >= fNParticles) {
431431
LOG(fatal) << "MyProjStack: Particle index " << trackID << " out of range.";
432432
}
433-
return (TParticle*)fParticles->At(trackID);
433+
return static_cast<TParticle*>(fParticles->At(trackID));
434434
}
435435
// -------------------------------------------------------------------------
436436

0 commit comments

Comments
 (0)