From 43febf0d5c95e761d9a3e681ddfe1be91e29e6d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Thu, 29 Aug 2024 14:03:57 +0200 Subject: [PATCH] [TOF] add delta MC --- DPG/Tasks/AOTTrack/PID/TOF/qaPIDTOFEvTime.cxx | 142 ++++++++++-------- 1 file changed, 79 insertions(+), 63 deletions(-) diff --git a/DPG/Tasks/AOTTrack/PID/TOF/qaPIDTOFEvTime.cxx b/DPG/Tasks/AOTTrack/PID/TOF/qaPIDTOFEvTime.cxx index 705895970ca..a6e501f88ed 100644 --- a/DPG/Tasks/AOTTrack/PID/TOF/qaPIDTOFEvTime.cxx +++ b/DPG/Tasks/AOTTrack/PID/TOF/qaPIDTOFEvTime.cxx @@ -171,18 +171,21 @@ struct tofPidCollisionTimeQa { return; } const AxisSpec diffAxis{1000, -1000, 1000, "Difference"}; - histos.add("MC/diff/All", "All", HistType::kTH1F, {diffAxis})->GetXaxis()->SetTitle("t_{MC}-t_{All} (ps)"); - histos.add("MC/diff/FT0", "FT0", HistType::kTH1F, {diffAxis})->GetXaxis()->SetTitle("t_{MC}-t_{FT0} (ps)"); - histos.add("MC/diff/TOF", "TOF", HistType::kTH1F, {diffAxis})->GetXaxis()->SetTitle("t_{MC}-t_{TOF} (ps)"); + histos.add("MC/diff/All", "All", HistType::kTH1F, {diffAxis})->GetXaxis()->SetTitle("t^{MC}_{ev}-t^{All}_{ev} (ps)"); + histos.add("MC/diff/FT0", "FT0", HistType::kTH1F, {diffAxis})->GetXaxis()->SetTitle("t^{MC}_{ev}-t_{FT0}_{ev} (ps)"); + histos.add("MC/diff/TOF", "TOF", HistType::kTH1F, {diffAxis})->GetXaxis()->SetTitle("t^{MC}_{ev}-t_{TOF}_{ev} (ps)"); - histos.add("MC/diffvsZ/All", "All", HistType::kTH2F, {diffAxis, {100, -20, 20}})->GetXaxis()->SetTitle("t_{MC}-t_{All} (ps)"); - histos.add("MC/diffvsZ/FT0", "FT0", HistType::kTH2F, {diffAxis, {100, -20, 20}})->GetXaxis()->SetTitle("t_{MC}-t_{FT0} (ps)"); - histos.add("MC/diffvsZ/TOF", "TOF", HistType::kTH2F, {diffAxis, {100, -20, 20}})->GetXaxis()->SetTitle("t_{MC}-t_{TOF} (ps)"); + histos.add("MC/diffvsZ/All", "All", HistType::kTH2F, {diffAxis, {100, -20, 20}})->GetXaxis()->SetTitle("t^{MC}_{ev}-t^{All}_{ev}_{ev} (ps)"); + histos.add("MC/diffvsZ/FT0", "FT0", HistType::kTH2F, {diffAxis, {100, -20, 20}})->GetXaxis()->SetTitle("t^{MC}_{ev}-t_{FT0}_{ev} (ps)"); + histos.add("MC/diffvsZ/TOF", "TOF", HistType::kTH2F, {diffAxis, {100, -20, 20}})->GetXaxis()->SetTitle("t^{MC}_{ev}-t_{TOF}_{ev} (ps)"); // pion - histos.add("MC/particle/pdg211/all/particleDiff", "", HistType::kTH2F, {pAxis, diffAxis}); - histos.add("MC/particle/pdg211/all/delta", "", HistType::kTH2F, {pAxis, diffAxis}); - histos.addClone("MC/particle/pdg211/all/particleDiff", "MC/particle/pdg211/prm/particleDiff"); + histos.add("MC/particle/pdg211/all/particleDiff", "particleDiff", HistType::kTH2F, {ptAxis, diffAxis})->GetYaxis()->SetTitle("t^{MC}_{ev}-t^{part}_{MC} (ps)"); + histos.add("MC/particle/pdg211/all/delta", "delta", HistType::kTH2F, {ptAxis, diffAxis})->GetYaxis()->SetTitle("t_{TOF}-t^{MC}_{ev}-t_{exp} (ps)"); + histos.add("MC/particle/pdg211/all/deltaTRD", "deltaTRD", HistType::kTH2F, {ptAxis, diffAxis})->GetYaxis()->SetTitle("t_{TOF}-t^{MC}_{ev}-t_{exp} (ps)"); + histos.add("MC/particle/pdg211/all/deltaNoTRD", "deltaNoTRD", HistType::kTH2F, {ptAxis, diffAxis})->GetYaxis()->SetTitle("t_{TOF}-t^{MC}_{ev}-t_{exp} (ps)"); + histos.addClone("MC/particle/pdg211/all/", "MC/particle/pdg211/prm/"); + histos.addClone("MC/particle/pdg211/", "MC/particle/pdgNeg211/"); // kaon @@ -446,15 +449,79 @@ struct tofPidCollisionTimeQa { for (auto& trk : tracks) { if (!trk.has_collision()) { // Track was not assigned to a collision continue; - } else if (trk.collisionId() == lastCollisionId) { // Event was already processed - continue; } - lastCollisionId = trk.collisionId(); /// Cache last collision ID const auto& collision = trk.collision_as(); if (!collision.has_mcCollision()) { continue; } const auto& collisionMC = collision.mcCollision_as(); + const int64_t bcMCtime = static_cast((collisionMC.t() + 2.f) / o2::constants::lhc::LHCBunchSpacingNS); + const float eventtimeMC = (collisionMC.t() - bcMCtime * o2::constants::lhc::LHCBunchSpacingNS) * 1000.f; + + if (trk.has_mcParticle()) { + const auto& particle = trk.mcParticle(); + const auto& mcCollTimeMinusFormationTime = particle.vt() - collisionMC.t(); + const auto& mcTOFvalue = trk.tofSignal() - eventtimeMC - trk.tofExpTime(2); + LOG(debug) << "Track " << particle.vt() << " vs " << eventtimeMC; + switch (particle.pdgCode()) { + case 211: + histos.fill(HIST("MC/particle/pdg211/all/particleDiff"), particle.pt(), mcCollTimeMinusFormationTime); + histos.fill(HIST("MC/particle/pdg211/all/delta"), particle.pt(), mcTOFvalue); + if (trk.hasTRD()) { + histos.fill(HIST("MC/particle/pdg211/all/deltaTRD"), particle.pt(), mcTOFvalue); + } else { + histos.fill(HIST("MC/particle/pdg211/all/deltaNoTRD"), particle.pt(), mcTOFvalue); + } + if (particle.isPhysicalPrimary()) { + histos.fill(HIST("MC/particle/pdg211/prm/particleDiff"), particle.pt(), mcCollTimeMinusFormationTime); + } + break; + case -211: + histos.fill(HIST("MC/particle/pdgNeg211/all/particleDiff"), particle.pt(), mcCollTimeMinusFormationTime); + histos.fill(HIST("MC/particle/pdgNeg211/all/delta"), particle.pt(), mcTOFvalue); + histos.fill(HIST("MC/particle/pdgNeg211/all/delta"), particle.pt(), mcTOFvalue); + if (trk.hasTRD()) { + histos.fill(HIST("MC/particle/pdgNeg211/all/deltaTRD"), particle.pt(), mcTOFvalue); + } else { + histos.fill(HIST("MC/particle/pdgNeg211/all/deltaNoTRD"), particle.pt(), mcTOFvalue); + } + if (particle.isPhysicalPrimary()) { + histos.fill(HIST("MC/particle/pdgNeg211/prm/particleDiff"), particle.pt(), mcCollTimeMinusFormationTime); + } + break; + case 321: + histos.fill(HIST("MC/particle/pdg321/all/particleDiff"), particle.pt(), mcCollTimeMinusFormationTime); + if (particle.isPhysicalPrimary()) { + histos.fill(HIST("MC/particle/pdg321/prm/particleDiff"), particle.pt(), mcCollTimeMinusFormationTime); + } + break; + case -321: + histos.fill(HIST("MC/particle/pdgNeg321/all/particleDiff"), particle.pt(), mcCollTimeMinusFormationTime); + if (particle.isPhysicalPrimary()) { + histos.fill(HIST("MC/particle/pdgNeg321/prm/particleDiff"), particle.pt(), mcCollTimeMinusFormationTime); + } + break; + case 2212: + histos.fill(HIST("MC/particle/pdg2212/all/particleDiff"), particle.pt(), mcCollTimeMinusFormationTime); + if (particle.isPhysicalPrimary()) { + histos.fill(HIST("MC/particle/pdg2212/prm/particleDiff"), particle.pt(), mcCollTimeMinusFormationTime); + } + break; + case -2212: + histos.fill(HIST("MC/particle/pdgNeg2212/all/particleDiff"), particle.pt(), mcCollTimeMinusFormationTime); + if (particle.isPhysicalPrimary()) { + histos.fill(HIST("MC/particle/pdgNeg2212/prm/particleDiff"), particle.pt(), mcCollTimeMinusFormationTime); + } + break; + default: + break; + } + } + + if (trk.collisionId() == lastCollisionId) { // Event was already processed + continue; + } + lastCollisionId = trk.collisionId(); /// Cache last collision ID float t0AC[2] = {0.f, 0.f}; // const auto& ft0 = collision.foundFT0(); @@ -515,8 +582,6 @@ struct tofPidCollisionTimeQa { // timeInBCNS + bc2ns(); // bc* o2::constants::lhc::LHCBunchSpacingNS + orbit* o2::constants::lhc::LHCOrbitNS; // int64_t(mcBC.globalBC() * o2::constants::lhc::LHCBunchSpacingNS * 1e-3)) - const int64_t bcMCtime = static_cast((collisionMC.t() + 2.f) / o2::constants::lhc::LHCBunchSpacingNS); - const float eventtimeMC = (collisionMC.t() - bcMCtime * o2::constants::lhc::LHCBunchSpacingNS) * 1000.f; histos.fill(HIST("MC/CollisionTime/eventtimeMC"), eventtimeMC); histos.fill(HIST("MC/CollisionTime/All"), trk.tofEvTime()); @@ -532,55 +597,6 @@ struct tofPidCollisionTimeQa { histos.fill(HIST("MC/diffvsZ/All"), eventtimeMC - trk.tofEvTime(), collisionMC.posZ()); histos.fill(HIST("MC/diffvsZ/FT0"), eventtimeMC - t0AC[0], collisionMC.posZ()); histos.fill(HIST("MC/diffvsZ/TOF"), eventtimeMC - trk.evTimeTOF(), collisionMC.posZ()); - - if (!trk.has_mcParticle()) { - continue; - } - const auto& particle = trk.mcParticle(); - const auto& tMimusFormationTime = collisionMC.t() - particle.vt(); - // const auto & mcTOFvalue = eventtimeMC - trk.tofSignal() - ; - LOG(debug) << "Track " << particle.vt() << " vs " << eventtimeMC; - switch (particle.pdgCode()) { - case 211: - histos.fill(HIST("MC/particle/pdg211/all/particleDiff"), particle.pt(), tMimusFormationTime); - // histos.fill(HIST("MC/particle/pdg211/all/delta"), particle.pt(), mcTOFvalue); - if (particle.isPhysicalPrimary()) { - histos.fill(HIST("MC/particle/pdg211/prm/particleDiff"), particle.pt(), tMimusFormationTime); - } - break; - case -211: - histos.fill(HIST("MC/particle/pdgNeg211/all/particleDiff"), particle.pt(), tMimusFormationTime); - if (particle.isPhysicalPrimary()) { - histos.fill(HIST("MC/particle/pdgNeg211/prm/particleDiff"), particle.pt(), tMimusFormationTime); - } - break; - case 321: - histos.fill(HIST("MC/particle/pdg321/all/particleDiff"), particle.pt(), tMimusFormationTime); - if (particle.isPhysicalPrimary()) { - histos.fill(HIST("MC/particle/pdg321/prm/particleDiff"), particle.pt(), tMimusFormationTime); - } - break; - case -321: - histos.fill(HIST("MC/particle/pdgNeg321/all/particleDiff"), particle.pt(), tMimusFormationTime); - if (particle.isPhysicalPrimary()) { - histos.fill(HIST("MC/particle/pdgNeg321/prm/particleDiff"), particle.pt(), tMimusFormationTime); - } - break; - case 2212: - histos.fill(HIST("MC/particle/pdg2212/all/particleDiff"), particle.pt(), tMimusFormationTime); - if (particle.isPhysicalPrimary()) { - histos.fill(HIST("MC/particle/pdg2212/prm/particleDiff"), particle.pt(), tMimusFormationTime); - } - break; - case -2212: - histos.fill(HIST("MC/particle/pdgNeg2212/all/particleDiff"), particle.pt(), tMimusFormationTime); - if (particle.isPhysicalPrimary()) { - histos.fill(HIST("MC/particle/pdgNeg2212/prm/particleDiff"), particle.pt(), tMimusFormationTime); - } - break; - default: - break; - } } } PROCESS_SWITCH(tofPidCollisionTimeQa, processMC, "Process MC", false);