@@ -214,6 +214,7 @@ bool HFTrackEfficiency::findTracks(PHCompositeNode *topNode, Decay decay)
214214 m_true_mother_pT = mother->momentum ().perp ();
215215 m_true_mother_p = std::sqrt (std::pow (mother->momentum ().px (), 2 ) + std::pow (mother->momentum ().py (), 2 ) + std::pow (mother->momentum ().pz (), 2 )); // Must have an old HepMC build, no mag function
216216 m_true_mother_eta = mother->momentum ().eta ();
217+ m_true_mother_phi = mother->momentum ().phi ();
217218
218219 HepMC::GenVertex *thisVtx = mother->production_vertex ();
219220 m_primary_vtx_x = thisVtx->point3d ().x ();
@@ -229,13 +230,17 @@ bool HFTrackEfficiency::findTracks(PHCompositeNode *topNode, Decay decay)
229230 }
230231 }
231232
233+ int index = -1 ;
234+
232235 for (unsigned int i = 1 ; i < decay.size (); ++i)
233236 {
234237 m_dst_track = nullptr ;
235238 int truth_ID = -1 ;
239+
236240 if (std::find (std::begin (trackableParticles), std::end (trackableParticles),
237241 std::abs (decay[i].second )) != std::end (trackableParticles))
238242 {
243+ ++index;
239244 if (theEvent && decay[i].first .second > -1 )
240245 {
241246 HepMC::GenParticle *daughterHepMC = theEvent->barcode_to_particle (decay[i].first .second );
@@ -247,7 +252,7 @@ bool HFTrackEfficiency::findTracks(PHCompositeNode *topNode, Decay decay)
247252 daughterTrueLV->setVectM (CLHEP::Hep3Vector (daughterHepMC->momentum ().px (), daughterHepMC->momentum ().py (), daughterHepMC->momentum ().pz ()), getParticleMass (decay[i].second ));
248253 daughterSumTrueLV += *daughterTrueLV;
249254
250- m_true_track_PID[i - 1 ] = daughterHepMC->pdg_id ();
255+ m_true_track_PID[index ] = daughterHepMC->pdg_id ();
251256
252257 // Now get the decay vertex position
253258 HepMC::GenVertex *thisVtx = daughterHepMC->production_vertex ();
@@ -306,6 +311,7 @@ bool HFTrackEfficiency::findTracks(PHCompositeNode *topNode, Decay decay)
306311 m_true_mother_pT = motherTrueLV->perp ();
307312 m_true_mother_p = mother3Vector->mag ();
308313 m_true_mother_eta = motherTrueLV->pseudoRapidity ();
314+ m_true_mother_phi = motherTrueLV->phi ();
309315
310316 PHG4VtxPoint *thisVtx = m_truthInfo->GetVtx (motherG4->get_vtx_id ());
311317 m_primary_vtx_x = thisVtx->get_x ();
@@ -321,18 +327,19 @@ bool HFTrackEfficiency::findTracks(PHCompositeNode *topNode, Decay decay)
321327 m_secondary_vtx_y = thisVtx->get_y ();
322328 m_secondary_vtx_z = thisVtx->get_z ();
323329
324- m_true_track_PID[i - 1 ] = daughterG4->get_pid ();
330+ m_true_track_PID[index ] = daughterG4->get_pid ();
325331 truth_ID = daughterG4->get_track_id ();
326332
327333 delete mother3Vector;
328334 }
329335 }
330336 }
331337
332- m_true_track_pT[i - 1 ] = (float ) daughterTrueLV->perp ();
333- m_true_track_eta[i - 1 ] = (float ) daughterTrueLV->pseudoRapidity ();
334- m_min_true_track_pT = std::min (m_true_track_pT[i - 1 ], m_min_true_track_pT);
335- m_max_true_track_pT = std::max (m_true_track_pT[i - 1 ], m_max_true_track_pT);
338+ m_true_track_pT[index] = (float ) daughterTrueLV->perp ();
339+ m_true_track_eta[index] = (float ) daughterTrueLV->pseudoRapidity ();
340+ m_true_track_phi[index] = (float ) daughterTrueLV->phi ();
341+ m_min_true_track_pT = std::min (m_true_track_pT[index], m_min_true_track_pT);
342+ m_max_true_track_pT = std::max (m_true_track_pT[index], m_max_true_track_pT);
336343
337344 if (m_dst_truth_reco_map && truth_ID >= 0 )
338345 {
@@ -350,7 +357,7 @@ bool HFTrackEfficiency::findTracks(PHCompositeNode *topNode, Decay decay)
350357 m_dst_track = m_input_trackMap->get (best_reco_id);
351358 if (m_dst_track)
352359 {
353- m_used_truth_reco_map[i - 1 ] = true ;
360+ m_used_truth_reco_map[index ] = true ;
354361 recoTrackFound = true ;
355362 }
356363 }
@@ -378,24 +385,25 @@ bool HFTrackEfficiency::findTracks(PHCompositeNode *topNode, Decay decay)
378385 {
379386 m_dst_track->identify ();
380387 }
381- m_reco_track_exists[i - 1 ] = true ;
382- m_reco_track_pT[i - 1 ] = m_dst_track->get_pt ();
383- m_reco_track_eta[i - 1 ] = m_dst_track->get_eta ();
384- m_reco_track_chi2nDoF[i - 1 ] = m_dst_track->get_chisq () / m_dst_track->get_ndf ();
388+ m_reco_track_exists[index] = true ;
389+ m_reco_track_pT[index] = m_dst_track->get_pt ();
390+ m_reco_track_eta[index] = m_dst_track->get_eta ();
391+ m_reco_track_phi[index] = m_dst_track->get_phi ();
392+ m_reco_track_chi2nDoF[index] = m_dst_track->get_chisq () / m_dst_track->get_ndf ();
385393 if (m_dst_track->get_silicon_seed ())
386394 {
387- m_reco_track_silicon_seeds[i - 1 ] = static_cast <int >(m_dst_track->get_silicon_seed ()->size_cluster_keys ());
395+ m_reco_track_silicon_seeds[index ] = static_cast <int >(m_dst_track->get_silicon_seed ()->size_cluster_keys ());
388396 }
389397 else
390398 {
391- m_reco_track_silicon_seeds[i - 1 ] = 0 ;
399+ m_reco_track_silicon_seeds[index ] = 0 ;
392400 }
393- m_reco_track_tpc_seeds[i - 1 ] = static_cast <int >(m_dst_track->get_tpc_seed ()->size_cluster_keys ());
394- m_min_reco_track_pT = std::min (m_reco_track_pT[i - 1 ], m_min_reco_track_pT);
395- m_max_reco_track_pT = std::max (m_reco_track_pT[i - 1 ], m_max_reco_track_pT);
401+ m_reco_track_tpc_seeds[index ] = static_cast <int >(m_dst_track->get_tpc_seed ()->size_cluster_keys ());
402+ m_min_reco_track_pT = std::min (m_reco_track_pT[index ], m_min_reco_track_pT);
403+ m_max_reco_track_pT = std::max (m_reco_track_pT[index ], m_max_reco_track_pT);
396404
397405 CLHEP::HepLorentzVector *daughterRecoLV = new CLHEP::HepLorentzVector ();
398- daughterRecoLV->setVectM (CLHEP::Hep3Vector (m_dst_track->get_px (), m_dst_track->get_py (), m_dst_track->get_pz ()), getParticleMass (m_true_track_PID[i - 1 ]));
406+ daughterRecoLV->setVectM (CLHEP::Hep3Vector (m_dst_track->get_px (), m_dst_track->get_py (), m_dst_track->get_pz ()), getParticleMass (m_true_track_PID[index ]));
399407
400408 motherRecoLV += *daughterRecoLV;
401409 delete daughterRecoLV;
@@ -410,6 +418,7 @@ bool HFTrackEfficiency::findTracks(PHCompositeNode *topNode, Decay decay)
410418 if (selectedTracks.size () == m_nDaughters)
411419 {
412420 m_reco_mother_mass = motherRecoLV.m ();
421+ m_reco_mother_pT = motherRecoLV.perp ();
413422 if (m_write_track_map)
414423 {
415424 m_output_trackMap = findNode::getClass<SvtxTrackMap>(topNode, outputNodeName);
@@ -444,8 +453,10 @@ void HFTrackEfficiency::initializeBranches()
444453 m_tree->Branch (" true_mother_mass" , &m_true_mother_mass, " true_mother_mass/F" );
445454 m_tree->Branch (" reco_mother_mass" , &m_reco_mother_mass, " reco_mother_mass/F" );
446455 m_tree->Branch (" true_mother_pT" , &m_true_mother_pT, " true_mother_pT/F" );
456+ m_tree->Branch (" reco_mother_pT" , &m_reco_mother_pT, " reco_mother_pT/F" );
447457 m_tree->Branch (" true_mother_p" , &m_true_mother_p, " true_mother_p/F" );
448458 m_tree->Branch (" true_mother_eta" , &m_true_mother_eta, " true_mother_eta/F" );
459+ m_tree->Branch (" true_mother_phi" , &m_true_mother_phi, " true_mother_phi/F" );
449460 m_tree->Branch (" min_true_track_pT" , &m_min_true_track_pT, " min_true_track_pT/F" );
450461 m_tree->Branch (" min_reco_track_pT" , &m_min_reco_track_pT, " min_reco_track_pT/F" );
451462 m_tree->Branch (" max_true_track_pT" , &m_max_true_track_pT, " max_true_track_pT/F" );
@@ -460,6 +471,8 @@ void HFTrackEfficiency::initializeBranches()
460471 m_tree->Branch (" reco_" + TString (daughter_number) + " _pT" , &m_reco_track_pT[iTrack], " reco_" + TString (daughter_number) + " _pT/F" );
461472 m_tree->Branch (" true_" + TString (daughter_number) + " _eta" , &m_true_track_eta[iTrack], " true_" + TString (daughter_number) + " _eta/F" );
462473 m_tree->Branch (" reco_" + TString (daughter_number) + " _eta" , &m_reco_track_eta[iTrack], " reco_" + TString (daughter_number) + " _eta/F" );
474+ m_tree->Branch (" true_" + TString (daughter_number) + " _phi" , &m_true_track_phi[iTrack], " true_" + TString (daughter_number) + " _phi/F" );
475+ m_tree->Branch (" reco_" + TString (daughter_number) + " _phi" , &m_reco_track_phi[iTrack], " reco_" + TString (daughter_number) + " _phi/F" );
463476 m_tree->Branch (" true_" + TString (daughter_number) + " _PID" , &m_true_track_PID[iTrack], " true_" + TString (daughter_number) + " _PID/F" );
464477 m_tree->Branch (" reco_" + TString (daughter_number) + " _chi2nDoF" , &m_reco_track_chi2nDoF[iTrack], " reco_" + TString (daughter_number) + " _chi2nDoF/F" );
465478 m_tree->Branch (" reco_" + TString (daughter_number) + " _silicon_seeds" , &m_reco_track_silicon_seeds[iTrack], " reco_" + TString (daughter_number) + " _silicon_seeds/I" );
@@ -481,6 +494,7 @@ void HFTrackEfficiency::resetBranches()
481494 m_true_mother_mass = std::numeric_limits<float >::quiet_NaN ();
482495 m_reco_mother_mass = std::numeric_limits<float >::quiet_NaN ();
483496 m_true_mother_pT = std::numeric_limits<float >::quiet_NaN ();
497+ m_reco_mother_pT = std::numeric_limits<float >::quiet_NaN ();
484498 m_true_mother_p = std::numeric_limits<float >::quiet_NaN ();
485499 m_true_mother_eta = std::numeric_limits<float >::quiet_NaN ();
486500 m_min_true_track_pT = std::numeric_limits<float >::max ();
@@ -495,6 +509,8 @@ void HFTrackEfficiency::resetBranches()
495509 m_reco_track_pT[iTrack] = std::numeric_limits<float >::quiet_NaN ();
496510 m_true_track_eta[iTrack] = std::numeric_limits<float >::quiet_NaN ();
497511 m_reco_track_eta[iTrack] = std::numeric_limits<float >::quiet_NaN ();
512+ m_true_track_phi[iTrack] = std::numeric_limits<float >::quiet_NaN ();
513+ m_reco_track_phi[iTrack] = std::numeric_limits<float >::quiet_NaN ();
498514 m_true_track_PID[iTrack] = std::numeric_limits<float >::quiet_NaN ();
499515 m_reco_track_chi2nDoF[iTrack] = std::numeric_limits<float >::quiet_NaN ();
500516 m_reco_track_silicon_seeds[iTrack] = 0 ;
0 commit comments