@@ -273,20 +273,20 @@ struct ValidationRecLevel {
273273 std::array<std::shared_ptr<TH1 >, nCharmHadrons> histDeltaPt, histDeltaPx, histDeltaPy, histDeltaPz, histDeltaSecondaryVertexX, histDeltaSecondaryVertexY, histDeltaSecondaryVertexZ, histDeltaDecayLength;
274274 std::array<std::array<std::array<std::shared_ptr<TH1 >, 3 >, 2 >, nCharmHadrons> histPtDau, histEtaDau, histImpactParameterDau;
275275 std::array<std::array<std::shared_ptr<TH1 >, 2 >, nCharmHadrons> histPtReco;
276- std::array<std::shared_ptr<TH2 >, 4 > histOriginTracks;
276+ std::array<std::shared_ptr<THnSparse >, 4 > histOriginTracks;
277277
278278 HistogramRegistry registry{" registry" , {}};
279279 void init (o2::framework::InitContext&)
280280 {
281- histOriginTracks[0 ] = registry.add <TH2 >(" histOriginNonAssociatedTracks" , " ;origin;#it{p}_{T}^{reco} (GeV/#it{c})" , HistType::kTH2F , {{4 , -1.5 , 2.5 }, {50 , 0 ., 10 .}}); // tracks not associated to any collision
282- histOriginTracks[1 ] = registry.add <TH2 >(" histOriginAssociatedTracks" , " ;origin;#it{p}_{T}^{reco} (GeV/#it{c})" , HistType::kTH2F , {{4 , -1.5 , 2.5 }, {50 , 0 ., 10 .}}); // tracks associasted to a collision
283- histOriginTracks[2 ] = registry.add <TH2 >(" histOriginGoodAssociatedTracks" , " ;origin;#it{p}_{T}^{reco} (GeV/#it{c})" , HistType::kTH2F , {{4 , -1.5 , 2.5 }, {50 , 0 ., 10 .}}); // tracks associated to the correct collision (considering the MC collision index)
284- histOriginTracks[3 ] = registry.add <TH2 >(" histOriginWrongAssociatedTracks" , " ;origin;#it{p}_{T}^{reco} (GeV/#it{c})" , HistType::kTH2F , {{4 , -1.5 , 2.5 }, {50 , 0 ., 10 .}}); // tracks associated to the wrong collision (considering the MC collision index)
281+ histOriginTracks[0 ] = registry.add <THnSparse >(" histOriginNonAssociatedTracks" , " ;origin;#it{p}_{T}^{reco} (GeV/#it{c});#it{#eta}^{reco};#it{Z}_{vtx}^{reco}#minus#it{Z}_{vtx}^{gen} (cm) " , HistType::kTHnSparseF , {{4 , -1.5 , 2.5 }, {50 , 0 ., 10 .}, { 40 , - 1 ., 1 .}, { 200 , - 1 ., 1 .}}); // tracks not associated to any collision
282+ histOriginTracks[1 ] = registry.add <THnSparse >(" histOriginAssociatedTracks" , " ;origin;#it{p}_{T}^{reco} (GeV/#it{c});#it{#eta}^{reco};#it{Z}_{vtx}^{reco}#minus#it{Z}_{vtx}^{gen} (cm) " , HistType::kTHnSparseF , {{4 , -1.5 , 2.5 }, {50 , 0 ., 10 .}, { 40 , - 1 ., 1 .}, { 200 , - 1 ., 1 .}}); // tracks associasted to a collision
283+ histOriginTracks[2 ] = registry.add <THnSparse >(" histOriginGoodAssociatedTracks" , " ;origin;#it{p}_{T}^{reco} (GeV/#it{c});#it{#eta}^{reco};#it{Z}_{vtx}^{reco}#minus#it{Z}_{vtx}^{gen} (cm) " , HistType::kTHnSparseF , {{4 , -1.5 , 2.5 }, {50 , 0 ., 10 .}, { 40 , - 1 ., 1 .}, { 200 , - 1 ., 1 .}}); // tracks associated to the correct collision (considering the MC collision index)
284+ histOriginTracks[3 ] = registry.add <THnSparse >(" histOriginWrongAssociatedTracks" , " ;origin;#it{p}_{T}^{reco} (GeV/#it{c});#it{#eta}^{reco};#it{Z}_{vtx}^{reco}#minus#it{Z}_{vtx}^{gen} (cm) " , HistType::kTHnSparseF , {{4 , -1.5 , 2.5 }, {50 , 0 ., 10 .}, { 40 , - 1 ., 1 .}, { 200 , - 1 ., 1 .}}); // tracks associated to the wrong collision (considering the MC collision index)
285285 for (std::size_t iHist{0 }; iHist < histOriginTracks.size (); ++iHist) {
286- histOriginTracks[iHist]->GetXaxis ( )->SetBinLabel (1 , " no MC particle" );
287- histOriginTracks[iHist]->GetXaxis ( )->SetBinLabel (2 , " no quark" );
288- histOriginTracks[iHist]->GetXaxis ( )->SetBinLabel (3 , " charm" );
289- histOriginTracks[iHist]->GetXaxis ( )->SetBinLabel (4 , " beauty" );
286+ histOriginTracks[iHist]->GetAxis ( 0 )->SetBinLabel (1 , " no MC particle" );
287+ histOriginTracks[iHist]->GetAxis ( 0 )->SetBinLabel (2 , " no quark" );
288+ histOriginTracks[iHist]->GetAxis ( 0 )->SetBinLabel (3 , " charm" );
289+ histOriginTracks[iHist]->GetAxis ( 0 )->SetBinLabel (4 , " beauty" );
290290 }
291291 for (auto iHad = 0 ; iHad < nCharmHadrons; ++iHad) {
292292 histDeltaPt[iHad] = registry.add <TH1 >(Form (" histDeltaPt%s" , particleNames[iHad].data ()), Form (" Pt difference reco - MC %s; #it{p}_{T}^{reco} - #it{p}_{T}^{gen} (GeV/#it{c}); entries" , labels[iHad].data ()), HistType::kTH1F , {{2000 , -1 ., 1 .}});
@@ -311,27 +311,33 @@ struct ValidationRecLevel {
311311 using HfCandProng2WithMCRec = soa::Join<aod::HfCandProng2, aod::HfCandProng2MCRec>;
312312 using HfCandProng3WithMCRec = soa::Join<aod::HfCandProng3, aod::HfCandProng3MCRec>;
313313 using CollisionsWithMCLabels = soa::Join<aod::Collisions, aod::McCollisionLabels>;
314+ using TracksWithSel = soa::Join<aod::BigTracksMC, aod::TrackSelection>;
314315
315- void process (HfCandProng2WithMCRec const & cand2Prongs, HfCandProng3WithMCRec const & cand3Prongs, aod::BigTracksMC const & tracks, aod::McParticles const & particlesMC, aod::McCollisions const & mcCollisions, CollisionsWithMCLabels const & collisions)
316+ void process (HfCandProng2WithMCRec const & cand2Prongs, HfCandProng3WithMCRec const & cand3Prongs, TracksWithSel const & tracks, aod::McParticles const & particlesMC, aod::McCollisions const & mcCollisions, CollisionsWithMCLabels const & collisions)
316317 {
317318 // loop over tracks
318319 for (auto & track : tracks) {
320+ if (track.isGlobalTrackWoDCA () != (uint8_t ) true ) {
321+ continue ;
322+ }
319323 uint index = uint (track.collisionId () >= 0 );
320324 if (track.has_mcParticle ()) {
321325 auto particle = track.mcParticle (); // get corresponding MC particle to check origin
322326 auto origin = RecoDecay::getCharmHadronOrigin (particlesMC, particle, true );
323- histOriginTracks[index]-> Fill (origin, track. pt ()) ;
327+ float deltaZ = - 999 . f ;
324328 if (index) {
325329 auto collision = track.collision_as <CollisionsWithMCLabels>();
326330 auto mcCollision = particle.mcCollision ();
331+ deltaZ = collision.posZ () - mcCollision.posZ ();
327332 uint index2 = 2 ;
328- if (( collision.mcCollisionId () == particle.mcCollisionId ()) && std::abs (collision. posZ () - mcCollision. posZ ()) < 0.02 ) { // 200 microns compatibility of Z vertex position also required
333+ if (collision.mcCollisionId () == particle.mcCollisionId ()) {
329334 index2 = 1 ;
330335 }
331- histOriginTracks[index + index2]->Fill (origin, track.pt ());
336+ histOriginTracks[index + index2]->Fill (origin, track.pt (), track. eta (), deltaZ );
332337 }
338+ histOriginTracks[index]->Fill (origin, track.pt (), track.eta (), deltaZ);
333339 } else {
334- histOriginTracks[index]->Fill (-1 ., track.pt ());
340+ histOriginTracks[index]->Fill (-1 .f , track.pt (), track. eta (), - 999 . f );
335341 }
336342 }
337343
@@ -359,8 +365,8 @@ struct ValidationRecLevel {
359365
360366 if (whichHad >= 0 && whichOrigin >= 0 ) {
361367 int indexParticle = 0 ;
362- if (cand2Prong.index0_as <aod::BigTracksMC >().has_mcParticle ()) {
363- indexParticle = RecoDecay::getMother (particlesMC, cand2Prong.index0_as <aod::BigTracksMC >().mcParticle (), PDGArrayParticle[whichHad], true );
368+ if (cand2Prong.index0_as <TracksWithSel >().has_mcParticle ()) {
369+ indexParticle = RecoDecay::getMother (particlesMC, cand2Prong.index0_as <TracksWithSel >().mcParticle (), PDGArrayParticle[whichHad], true );
364370 }
365371 auto mother = particlesMC.rawIteratorAt (indexParticle);
366372 histDeltaPt[whichHad]->Fill (cand2Prong.pt () - mother.pt ());
@@ -424,8 +430,8 @@ struct ValidationRecLevel {
424430
425431 if (whichHad >= 0 ) {
426432 int indexParticle = 0 ;
427- if (cand3Prong.index0_as <aod::BigTracksMC >().has_mcParticle ()) {
428- indexParticle = RecoDecay::getMother (particlesMC, cand3Prong.index0_as <aod::BigTracksMC >().mcParticle (), PDGArrayParticle[whichHad], true );
433+ if (cand3Prong.index0_as <TracksWithSel >().has_mcParticle ()) {
434+ indexParticle = RecoDecay::getMother (particlesMC, cand3Prong.index0_as <TracksWithSel >().mcParticle (), PDGArrayParticle[whichHad], true );
429435 }
430436 auto mother = particlesMC.rawIteratorAt (indexParticle);
431437 histDeltaPt[whichHad]->Fill (cand3Prong.pt () - mother.pt ());
0 commit comments