Skip to content

Commit

Permalink
PWGLF: add TOF information to hyp task (#8186)
Browse files Browse the repository at this point in the history
Co-authored-by: Francesco Mazzaschi <[email protected]>
  • Loading branch information
fmazzasc and Francesco Mazzaschi authored Oct 29, 2024
1 parent 72bf3a9 commit 926cf55
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 46 deletions.
88 changes: 46 additions & 42 deletions PWGLF/DataModel/LFHypernucleiTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,49 +34,50 @@ DECLARE_SOA_COLUMN(MultFT0C, multFT0C, float); // Multiplicity with
DECLARE_SOA_COLUMN(PsiTPC, psiTPC, float); // Psi with TPC estimator
DECLARE_SOA_COLUMN(MultTPC, multTPC, float); // Multiplicity with TPC estimator

DECLARE_SOA_COLUMN(IsMatter, isMatter, bool); // bool: true for matter
DECLARE_SOA_COLUMN(PtHe3, ptHe3, float); // Pt of the He daughter
DECLARE_SOA_COLUMN(PhiHe3, phiHe3, float); // Phi of the He daughter
DECLARE_SOA_COLUMN(EtaHe3, etaHe3, float); // Eta of the He daughter
DECLARE_SOA_COLUMN(PtPi, ptPi, float); // Pt of the Pi daughter
DECLARE_SOA_COLUMN(PhiPi, phiPi, float); // Phi of the Pi daughter
DECLARE_SOA_COLUMN(EtaPi, etaPi, float); // Eta of the Pi daughter
DECLARE_SOA_COLUMN(XPrimVtx, xPrimVtx, float); // Decay vertex of the candidate (x direction)
DECLARE_SOA_COLUMN(YPrimVtx, yPrimVtx, float); // Decay vertex of the candidate (y direction)
DECLARE_SOA_COLUMN(ZPrimVtx, zPrimVtx, float); // Decay vertex of the candidate (z direction)
DECLARE_SOA_COLUMN(XDecVtx, xDecVtx, float); // Decay vertex of the candidate (x direction)
DECLARE_SOA_COLUMN(YDecVtx, yDecVtx, float); // Decay vertex of the candidate (y direction)
DECLARE_SOA_COLUMN(ZDecVtx, zDecVtx, float); // Decay vertex of the candidate (z direction)
DECLARE_SOA_COLUMN(MassH3L, massH3L, float); // Squared mass w/ hypertriton mass hypo
DECLARE_SOA_COLUMN(MassH4L, massH4L, float); // Squared mass w/ H4L mass hypo
DECLARE_SOA_COLUMN(DcaV0Daug, dcaV0Daug, float); // DCA between daughters
DECLARE_SOA_COLUMN(CosPA, cosPA, double); // Cosine of the pointing angle
DECLARE_SOA_COLUMN(NSigmaHe, nSigmaHe, float); // Number of sigmas of the He daughter
DECLARE_SOA_COLUMN(NTPCclusHe, nTPCclusHe, uint8_t); // Number of TPC clusters of the He daughter
DECLARE_SOA_COLUMN(NTPCclusPi, nTPCclusPi, uint8_t); // Number of TPC clusters of the Pi daughter
DECLARE_SOA_COLUMN(TPCsignalHe, tpcSignalHe, uint16_t); // TPC signal of the He daughter
DECLARE_SOA_COLUMN(TPCsignalPi, tpcSignalPi, uint16_t); // TPC signal of the Pi daughter
DECLARE_SOA_COLUMN(TPCChi2He, tpcChi2He, float); // TPC chi2 of the He daughter
DECLARE_SOA_COLUMN(TrackedClSize, trackedClSize, int); // int: zero for non-tracked candidates
DECLARE_SOA_COLUMN(Flags, flags, uint8_t); // Flags for PID in tracking (bits [0, 3] for negative daughter, [4,7] for positive daughter)
DECLARE_SOA_COLUMN(TPCmomHe, tpcMomHe, float); // TPC momentum of the He daughter
DECLARE_SOA_COLUMN(TPCmomPi, tpcMomPi, float); // TPC momentum of the Pi daughter
DECLARE_SOA_COLUMN(ITSclusterSizesHe, itsClusterSizesHe, uint32_t); // ITS cluster size of the He daughter
DECLARE_SOA_COLUMN(ITSclusterSizesPi, itsClusterSizesPi, uint32_t); // ITS cluster size of the Pi daughter
DECLARE_SOA_COLUMN(IsMatter, isMatter, bool); // bool: true for matter
DECLARE_SOA_COLUMN(PtHe3, ptHe3, float); // Pt of the He daughter
DECLARE_SOA_COLUMN(PhiHe3, phiHe3, float); // Phi of the He daughter
DECLARE_SOA_COLUMN(EtaHe3, etaHe3, float); // Eta of the He daughter
DECLARE_SOA_COLUMN(PtPi, ptPi, float); // Pt of the Pi daughter
DECLARE_SOA_COLUMN(PhiPi, phiPi, float); // Phi of the Pi daughter
DECLARE_SOA_COLUMN(EtaPi, etaPi, float); // Eta of the Pi daughter
DECLARE_SOA_COLUMN(XPrimVtx, xPrimVtx, float); // Decay vertex of the candidate (x direction)
DECLARE_SOA_COLUMN(YPrimVtx, yPrimVtx, float); // Decay vertex of the candidate (y direction)
DECLARE_SOA_COLUMN(ZPrimVtx, zPrimVtx, float); // Decay vertex of the candidate (z direction)
DECLARE_SOA_COLUMN(XDecVtx, xDecVtx, float); // Decay vertex of the candidate (x direction)
DECLARE_SOA_COLUMN(YDecVtx, yDecVtx, float); // Decay vertex of the candidate (y direction)
DECLARE_SOA_COLUMN(ZDecVtx, zDecVtx, float); // Decay vertex of the candidate (z direction)
DECLARE_SOA_COLUMN(MassH3L, massH3L, float); // Squared mass w/ hypertriton mass hypo
DECLARE_SOA_COLUMN(MassH4L, massH4L, float); // Squared mass w/ H4L mass hypo
DECLARE_SOA_COLUMN(DcaV0Daug, dcaV0Daug, float); // DCA between daughters
DECLARE_SOA_COLUMN(CosPA, cosPA, double); // Cosine of the pointing angle
DECLARE_SOA_COLUMN(NSigmaHe, nSigmaHe, float); // Number of sigmas of the He daughter
DECLARE_SOA_COLUMN(NTPCclusHe, nTPCclusHe, uint8_t); // Number of TPC clusters of the He daughter
DECLARE_SOA_COLUMN(NTPCclusPi, nTPCclusPi, uint8_t); // Number of TPC clusters of the Pi daughter
DECLARE_SOA_COLUMN(TPCsignalHe, tpcSignalHe, uint16_t); // TPC signal of the He daughter
DECLARE_SOA_COLUMN(TPCsignalPi, tpcSignalPi, uint16_t); // TPC signal of the Pi daughter
DECLARE_SOA_COLUMN(TPCChi2He, tpcChi2He, float); // TPC chi2 of the He daughter
DECLARE_SOA_COLUMN(TrackedClSize, trackedClSize, int); // int: zero for non-tracked candidates
DECLARE_SOA_COLUMN(Flags, flags, uint8_t); // Flags for PID in tracking (bits [0, 3] for negative daughter, [4,7] for positive daughter)
DECLARE_SOA_COLUMN(TPCmomHe, tpcMomHe, float); // TPC momentum of the He daughter
DECLARE_SOA_COLUMN(TPCmomPi, tpcMomPi, float); // TPC momentum of the Pi daughter
DECLARE_SOA_COLUMN(TOFMass, tofMass, float); // TOF mass of the candidate
DECLARE_SOA_COLUMN(ITSclusterSizesHe, itsClusterSizesHe, uint32_t); // ITS cluster size of the He daughter
DECLARE_SOA_COLUMN(ITSclusterSizesPi, itsClusterSizesPi, uint32_t); // ITS cluster size of the Pi daughter
DECLARE_SOA_COLUMN(ITSclusterSizesHyp, itsClusterSizesHyp, uint32_t); // ITS cluster size of the Pi daughter
DECLARE_SOA_COLUMN(DcaHe, dcaHe, float); // DCA between He daughter and V0
DECLARE_SOA_COLUMN(DcaPi, dcaPi, float); // DCA between pi daughter and V0
DECLARE_SOA_COLUMN(GenPt, genPt, float); // Pt of the hypertriton
DECLARE_SOA_COLUMN(GenPhi, genPhi, float); // Phi of the hypertriton
DECLARE_SOA_COLUMN(GenEta, genEta, float); // Eta of the hypertriton
DECLARE_SOA_COLUMN(GenPtHe3, genPtHe3, float); // Pt of the He daughter (to be used for the recalibration)
DECLARE_SOA_COLUMN(GenXDecVtx, genXDecVtx, float); // Decay vertex of the candidate (x direction)
DECLARE_SOA_COLUMN(GenYDecVtx, genYDecVtx, float); // Decay vertex of the candidate (y direction)
DECLARE_SOA_COLUMN(GenZDecVtx, genZDecVtx, float); // Decay vertex of the candidate (z direction)
DECLARE_SOA_COLUMN(IsReco, isReco, bool); // bool: true for reco
DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); // bool: true for signal
DECLARE_SOA_COLUMN(IsRecoMCCollision, isRecoMCCollision, bool); // bool: true for reco MC collision
DECLARE_SOA_COLUMN(IsSurvEvSel, isSurvEvSel, bool); // bool: true for survived event selection
DECLARE_SOA_COLUMN(DcaHe, dcaHe, float); // DCA between He daughter and V0
DECLARE_SOA_COLUMN(DcaPi, dcaPi, float); // DCA between pi daughter and V0
DECLARE_SOA_COLUMN(GenPt, genPt, float); // Pt of the hypertriton
DECLARE_SOA_COLUMN(GenPhi, genPhi, float); // Phi of the hypertriton
DECLARE_SOA_COLUMN(GenEta, genEta, float); // Eta of the hypertriton
DECLARE_SOA_COLUMN(GenPtHe3, genPtHe3, float); // Pt of the He daughter (to be used for the recalibration)
DECLARE_SOA_COLUMN(GenXDecVtx, genXDecVtx, float); // Decay vertex of the candidate (x direction)
DECLARE_SOA_COLUMN(GenYDecVtx, genYDecVtx, float); // Decay vertex of the candidate (y direction)
DECLARE_SOA_COLUMN(GenZDecVtx, genZDecVtx, float); // Decay vertex of the candidate (z direction)
DECLARE_SOA_COLUMN(IsReco, isReco, bool); // bool: true for reco
DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); // bool: true for signal
DECLARE_SOA_COLUMN(IsRecoMCCollision, isRecoMCCollision, bool); // bool: true for reco MC collision
DECLARE_SOA_COLUMN(IsSurvEvSel, isSurvEvSel, bool); // bool: true for survived event selection
} // namespace hyperrec

DECLARE_SOA_TABLE(DataHypCands, "AOD", "HYPCANDS",
Expand All @@ -91,6 +92,7 @@ DECLARE_SOA_TABLE(DataHypCands, "AOD", "HYPCANDS",
hyperrec::DcaV0Daug, hyperrec::DcaHe, hyperrec::DcaPi,
hyperrec::NSigmaHe, hyperrec::NTPCclusHe, hyperrec::NTPCclusPi,
hyperrec::TPCmomHe, hyperrec::TPCmomPi, hyperrec::TPCsignalHe, hyperrec::TPCsignalPi, hyperrec::TPCChi2He,
hyperrec::TOFMass,
hyperrec::ITSclusterSizesHe, hyperrec::ITSclusterSizesPi,
hyperrec::Flags, hyperrec::TrackedClSize);

Expand All @@ -109,6 +111,7 @@ DECLARE_SOA_TABLE(DataHypCandsFlow, "AOD", "HYPCANDSFLOW",
hyperrec::DcaV0Daug, hyperrec::DcaHe, hyperrec::DcaPi,
hyperrec::NSigmaHe, hyperrec::NTPCclusHe, hyperrec::NTPCclusPi,
hyperrec::TPCmomHe, hyperrec::TPCmomPi, hyperrec::TPCsignalHe, hyperrec::TPCsignalPi, hyperrec::TPCChi2He,
hyperrec::TOFMass,
hyperrec::ITSclusterSizesHe, hyperrec::ITSclusterSizesPi,
hyperrec::Flags, hyperrec::TrackedClSize);

Expand All @@ -124,6 +127,7 @@ DECLARE_SOA_TABLE(MCHypCands, "AOD", "MCHYPCANDS",
hyperrec::DcaV0Daug, hyperrec::DcaHe, hyperrec::DcaPi,
hyperrec::NSigmaHe, hyperrec::NTPCclusHe, hyperrec::NTPCclusPi,
hyperrec::TPCmomHe, hyperrec::TPCmomPi, hyperrec::TPCsignalHe, hyperrec::TPCsignalPi, hyperrec::TPCChi2He,
hyperrec::TOFMass,
hyperrec::ITSclusterSizesHe, hyperrec::ITSclusterSizesPi,
hyperrec::Flags, hyperrec::TrackedClSize,
hyperrec::GenPt,
Expand Down
22 changes: 18 additions & 4 deletions PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include "EventFiltering/ZorroSummary.h"

#include "Common/Core/PID/TPCPIDResponse.h"
#include "Common/Core/PID/PIDTOF.h"
#include "Common/TableProducer/PID/pidTOFBase.h"
#include "DataFormatsTPC/BetheBlochAleph.h"
#include "DCAFitter/DCAFitterN.h"
#include "PWGLF/Utils/svPoolCreator.h"
Expand All @@ -44,7 +46,7 @@ using namespace o2::framework;
using namespace o2::framework::expressions;
using std::array;
using CollBracket = o2::math_utils::Bracket<int>;
using TracksFull = soa::Join<aod::TracksIU, aod::TracksExtra, aod::TracksCovIU>;
using TracksFull = soa::Join<aod::TracksIU, aod::TracksExtra, aod::TracksCovIU, aod::TOFSignal, aod::TOFEvTime>;
using CollisionsFull = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0As, aod::CentFT0Cs, aod::CentFT0Ms>;
using CollisionsFullMC = soa::Join<aod::Collisions, aod::McCollisionLabels, aod::EvSels, aod::CentFT0As, aod::CentFT0Cs, aod::CentFT0Ms>;

Expand All @@ -54,7 +56,7 @@ namespace
{
constexpr double betheBlochDefault[1][6]{{-1.e32, -1.e32, -1.e32, -1.e32, -1.e32, -1.e32}};
static const std::vector<std::string> betheBlochParNames{"p0", "p1", "p2", "p3", "p4", "resolution"};
static const std::vector<std::string> particleNames{"He3"};
static const std::vector<std::string> particleName{"He3"};
std::shared_ptr<TH1> hEvents;
std::shared_ptr<TH1> hZvtx;
std::shared_ptr<TH1> hCentFT0A;
Expand Down Expand Up @@ -103,6 +105,7 @@ struct hyperCandidate {
uint16_t tpcSignalHe3 = 0u;
uint16_t tpcSignalPi = 0u;
float tpcChi2He3 = 0.f;
float massTOFHe3 = 0.f;
uint8_t nTPCClustersHe3 = 0u;
uint8_t nTPCClustersPi = 0u;
uint32_t clusterSizeITSHe3 = 0u;
Expand Down Expand Up @@ -152,6 +155,8 @@ struct hyperRecoTask {
o2::vertexing::DCAFitterN<2> fitter;
svPoolCreator svCreator{heDauPdg, 211};

o2::pid::tof::Beta<TracksFull::iterator> responseBeta;

// daughter masses
float he3Mass = o2::constants::physics::MassHelium3;
float he4Mass = o2::constants::physics::MassAlpha;
Expand All @@ -160,7 +165,7 @@ struct hyperRecoTask {
Configurable<bool> useCustomVertexer{"useCustomVertexer", false, "Use custom vertexer"};
Configurable<bool> skipAmbiTracks{"skipAmbiTracks", false, "Skip ambiguous tracks"};
Configurable<float> customVertexerTimeMargin{"customVertexerTimeMargin", 800, "Time margin for custom vertexer (ns)"};
Configurable<LabeledArray<double>> cfgBetheBlochParams{"cfgBetheBlochParams", {betheBlochDefault[0], 1, 6, particleNames, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for He3"};
Configurable<LabeledArray<double>> cfgBetheBlochParams{"cfgBetheBlochParams", {betheBlochDefault[0], 1, 6, particleName, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for He3"};
Configurable<bool> cfgCompensatePIDinTracking{"cfgCompensatePIDinTracking", true, "If true, divide tpcInnerParam by the electric charge"};
Configurable<int> cfgMaterialCorrection{"cfgMaterialCorrection", static_cast<int>(o2::base::Propagator::MatCorrType::USEMatCorrNONE), "Type of material correction"};

Expand Down Expand Up @@ -500,6 +505,12 @@ struct hyperRecoTask {
hypCand.piTrackID = piTrack.globalIndex();
hypCand.collisionID = collision.globalIndex();

if (heTrack.hasTOF()) {
float beta = responseBeta.GetBeta(heTrack);
beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked
hypCand.massTOFHe3 = hypCand.momHe3TPC * 2.f * std::sqrt(1.f / (beta * beta) - 1.f);
}

hDeDx3HeSel->Fill(heTrack.sign() * hypCand.momHe3TPC, heTrack.tpcSignal());
hNsigma3HeSel->Fill(heTrack.sign() * hypCand.momHe3TPC, hypCand.nSigmaHe3);
hyperCandidates.push_back(hypCand);
Expand Down Expand Up @@ -653,6 +664,7 @@ struct hyperRecoTask {
hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY,
hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi,
hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, hypCand.tpcChi2He3,
hypCand.massTOFHe3,
hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedHypClSize);
}
}
Expand Down Expand Up @@ -683,6 +695,7 @@ struct hyperRecoTask {
hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY,
hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi,
hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, hypCand.tpcChi2He3,
hypCand.massTOFHe3,
hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedHypClSize);
}
}
Expand Down Expand Up @@ -717,6 +730,7 @@ struct hyperRecoTask {
hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY,
hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi,
hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, hypCand.tpcChi2He3,
hypCand.massTOFHe3,
hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedHypClSize,
chargeFactor * hypCand.genPt(), hypCand.genPhi(), hypCand.genEta(), hypCand.genPtHe3(),
hypCand.gDecVtx[0], hypCand.gDecVtx[1], hypCand.gDecVtx[2],
Expand Down Expand Up @@ -789,7 +803,7 @@ struct hyperRecoTask {
-1, -1, -1,
-1, -1, -1,
-1, -1, -1,
-1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1,
-1, -1, -1, false,
chargeFactor * hypCand.genPt(), hypCand.genPhi(), hypCand.genEta(), hypCand.genPtHe3(),
hypCand.gDecVtx[0], hypCand.gDecVtx[1], hypCand.gDecVtx[2],
Expand Down

0 comments on commit 926cf55

Please sign in to comment.