Skip to content

Commit 7acefbb

Browse files
preghenellasawenzel
authored andcommitted
Propagate first and second daughters to the Stack
1 parent cba1c82 commit 7acefbb

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

DataFormats/simulation/include/SimulationDataFormat/Stack.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ class Stack : public FairGenericStack
8888
Double_t vx, Double_t vy, Double_t vz, Double_t time, Double_t polx, Double_t poly, Double_t polz,
8989
TMCProcess proc, Int_t& ntr, Double_t weight, Int_t is, Int_t secondParentId) override;
9090

91+
void PushTrack(Int_t toBeDone, Int_t parentID, Int_t pdgCode, Double_t px, Double_t py, Double_t pz, Double_t e,
92+
Double_t vx, Double_t vy, Double_t vz, Double_t time, Double_t polx, Double_t poly, Double_t polz,
93+
TMCProcess proc, Int_t& ntr, Double_t weight, Int_t is, Int_t secondParentId, Int_t daughter1Id, Int_t daughter2Id);
94+
9195
// similar function taking a particle
9296
void PushTrack(Int_t toBeDone, TParticle&);
9397

DataFormats/simulation/src/Stack.cxx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,13 @@ void Stack::PushTrack(Int_t toBeDone, Int_t parentId, Int_t pdgCode, Double_t px
182182
void Stack::PushTrack(Int_t toBeDone, Int_t parentId, Int_t pdgCode, Double_t px, Double_t py, Double_t pz, Double_t e,
183183
Double_t vx, Double_t vy, Double_t vz, Double_t time, Double_t polx, Double_t poly, Double_t polz,
184184
TMCProcess proc, Int_t& ntr, Double_t weight, Int_t is, Int_t secondparentId)
185+
{
186+
PushTrack(toBeDone, parentId, pdgCode, px, py, pz, e, vx, vy, vz, time, polx, poly, polz, proc, ntr, weight, is, secondparentId, -1, -1);
187+
}
188+
189+
void Stack::PushTrack(Int_t toBeDone, Int_t parentId, Int_t pdgCode, Double_t px, Double_t py, Double_t pz, Double_t e,
190+
Double_t vx, Double_t vy, Double_t vz, Double_t time, Double_t polx, Double_t poly, Double_t polz,
191+
TMCProcess proc, Int_t& ntr, Double_t weight, Int_t is, Int_t secondparentId, Int_t daughter1Id, Int_t daughter2Id)
185192
{
186193
// printf("Pushing %s toBeDone %5d parentId %5d pdgCode %5d is %5d entries %5d \n",
187194
// proc == kPPrimary ? "Primary: " : "Secondary: ",
@@ -200,8 +207,8 @@ void Stack::PushTrack(Int_t toBeDone, Int_t parentId, Int_t pdgCode, Double_t px
200207
Int_t trackId = mNumberOfEntriesInParticles;
201208
// Set track variable
202209
ntr = trackId;
203-
Int_t daughter1Id = -1;
204-
Int_t daughter2Id = -1;
210+
// Int_t daughter1Id = -1;
211+
// Int_t daughter2Id = -1;
205212
Int_t iStatus = (proc == kPPrimary) ? is : trackId;
206213
TParticle p(pdgCode, iStatus, parentId, secondparentId, daughter1Id, daughter2Id, px, py, pz, e, vx, vy, vz, time);
207214
p.SetPolarisation(polx, poly, polz);

Generators/src/PrimaryGenerator.cxx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "Generators/Generator.h"
1515
#include "Generators/InteractionDiamondParam.h"
1616
#include "SimulationDataFormat/MCEventHeader.h"
17+
#include "SimulationDataFormat/Stack.h"
1718
#include "FairLogger.h"
1819

1920
#include "FairGenericStack.h"
@@ -186,9 +187,14 @@ void PrimaryGenerator::AddTrack(Int_t pdgid, Double_t px, Double_t py, Double_t
186187
}
187188

188189
/** add track to stack **/
189-
fStack->PushTrack(doTracking, mother1, pdgid, px, py, pz,
190-
e, vx, vy, vz, tof, polx, poly, polz, proc, ntr,
191-
weight, status, mother2);
190+
auto stack = dynamic_cast<o2::data::Stack*>(fStack);
191+
if (!stack) {
192+
LOG(FATAL) << "Stack must be an o2::data:Stack";
193+
return; // must be the o2 stack
194+
}
195+
stack->PushTrack(doTracking, mother1, pdgid, px, py, pz,
196+
e, vx, vy, vz, tof, polx, poly, polz, proc, ntr,
197+
weight, status, mother2, daughter1, daughter2);
192198

193199
fNTracks++;
194200
}

0 commit comments

Comments
 (0)