Skip to content

Commit a5a9edd

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

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

examples/common/mcstack/FairStack.cxx

Lines changed: 2 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, *
@@ -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
}
@@ -195,7 +195,6 @@ void FairStack::AddParticle(TParticle* oldPart)
195195

196196
void FairStack::FillTrackArray()
197197
{
198-
199198
LOG(debug) << "Filling MCTrack array...";
200199

201200
// --> Reset index map and number of output tracks

templates/project_root_containers/MyProjData/MyProjStack.cxx

Lines changed: 3 additions & 5 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
}
@@ -241,7 +241,6 @@ void MyProjStack::AddParticle(TParticle* oldPart)
241241
// ----- Public method FillTrackArray ----------------------------------
242242
void MyProjStack::FillTrackArray()
243243
{
244-
245244
LOG(debug) << "MyProjStack: Filling MCTrack array...";
246245

247246
// --> Reset index map and number of output tracks
@@ -425,14 +424,13 @@ TParticle* MyProjStack::GetParticle(Int_t trackID) const
425424
if (trackID < 0 || trackID >= fNParticles) {
426425
LOG(fatal) << "MyProjStack: Particle index " << trackID << " out of range.";
427426
}
428-
return (TParticle*)fParticles->At(trackID);
427+
return static_cast<TParticle*>(fParticles->At(trackID));
429428
}
430429
// -------------------------------------------------------------------------
431430

432431
// ----- Private method SelectTracks -----------------------------------
433432
void MyProjStack::SelectTracks()
434433
{
435-
436434
// --> Clear storage map
437435
fStoreMap.clear();
438436

templates/project_stl_containers/MyProjData/MyProjStack.cxx

Lines changed: 3 additions & 5 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
}
@@ -241,7 +241,6 @@ void MyProjStack::AddParticle(TParticle* oldPart)
241241
// ----- Public method FillTrackArray ----------------------------------
242242
void MyProjStack::FillTrackArray()
243243
{
244-
245244
LOG(debug) << "MyProjStack: Filling MCTrack array...";
246245

247246
// --> Reset index map and number of output tracks
@@ -430,14 +429,13 @@ TParticle* MyProjStack::GetParticle(Int_t trackID) const
430429
if (trackID < 0 || trackID >= fNParticles) {
431430
LOG(fatal) << "MyProjStack: Particle index " << trackID << " out of range.";
432431
}
433-
return (TParticle*)fParticles->At(trackID);
432+
return static_cast<TParticle*>(fParticles->At(trackID));
434433
}
435434
// -------------------------------------------------------------------------
436435

437436
// ----- Private method SelectTracks -----------------------------------
438437
void MyProjStack::SelectTracks()
439438
{
440-
441439
// --> Clear storage map
442440
fStoreMap.clear();
443441

0 commit comments

Comments
 (0)