Skip to content

Commit 0850248

Browse files
authored
Merge pull request #31 from Yousif-Elfeky/fix-partice-stack
FIx particle stack not showing Pi0s.
2 parents 390d43a + 8c8439a commit 0850248

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

StRoot/StGeant4Maker/StGeant4Maker.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -417,12 +417,12 @@ struct SD2Table_MTD {
417417
g2t_hit.p[1] = (hit->momentum_in[1] + hit->momentum_out[1]) * 0.5;
418418
g2t_hit.p[2] = (hit->momentum_in[2] + hit->momentum_out[2]) * 0.5;
419419
g2t_hit.s_track = hit->length;
420-
421-
table -> AddAt( &g2t_hit );
422-
423420
int idtruth = hit->idtruth;
424421
g2t_track_st* trk = (g2t_track_st*)track->At(idtruth-1);
425422

423+
g2t_hit.next_tr_hit_p = trk->hit_mtd_p; // store next hit on the linked list
424+
trk->hit_mtd_p = hit->id; // this hit becomes the head of the linked list
425+
table -> AddAt( &g2t_hit );
426426
trk->n_mtd_hit++;
427427

428428
}
@@ -1469,7 +1469,7 @@ void StGeant4Maker::FinishEvent(){
14691469

14701470
AddHits<St_g2t_emc_hit>( "FPDH", {"FLXF","FLGR","FPSC","FOSC"}, "g2t_fpd_hit", sd2table_emc ); // n.b. does not read out the flxf or flgr hit defined in the geom...
14711471

1472-
AddHits<St_g2t_ctf_hit>( "BTOH", {"BRSG"}, "g2t_tfr_hit", sd2table_ctf );
1472+
AddHits<St_g2t_ctf_hit>( "BTOH", {"BRSG" , "GEMG"}, "g2t_tfr_hit", sd2table_ctf );
14731473
AddHits<St_g2t_vpd_hit>( "VPDH", {"VRAD"}, "g2t_vpd_hit", sd2table_vpd );
14741474
AddHits<St_g2t_mtd_hit>( "MUTH", {"MIGG","MTTT","MTTF"}, "g2t_mtd_hit", sd2table_mtd );
14751475

@@ -1644,7 +1644,7 @@ void StGeant4Maker::Stepping(){
16441644
TParticle* current = stack->GetCurrentTrack();
16451645

16461646
// Get access to the current MC truth
1647-
StarMCParticle* truth = stack->GetParticleTable().back();
1647+
StarMCParticle* truth = stack->GetCurrentPersistentTrack();
16481648

16491649
// Update the immediate track history
16501650
UpdateHistory();

StRoot/StGeant4Maker/StMCParticleStack.cxx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,15 @@ void StMCParticleStack::PushTrack( int toDo, int parent, int pdg,
203203
{
204204
vertex->addDaughter( mParticleTable.back() );
205205
}
206-
206+
// Set the vertex parent to the mother track's persistent particle
207+
if ( !isPrimary ) {
208+
int mother = particle->GetFirstMother();
209+
if ( mother >= 0 && mother < mArraySize && mPersistentTrack[mother] ) {
210+
if ( !vertex->parent() ) {
211+
vertex->setParent( mPersistentTrack[mother] );
212+
}
213+
}
214+
}
207215
auto* navigator = gGeoManager->GetCurrentNavigator();
208216
auto* volume = navigator->GetCurrentVolume();
209217
auto* medium = volume->GetMedium();

0 commit comments

Comments
 (0)