Skip to content

Commit 5769b5a

Browse files
refactor(Stack): Use more GetParticle
GetParticle is thin wrapper. Let's use it more.
1 parent 7865555 commit 5769b5a

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

examples/common/mcstack/FairStack.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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)