Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions PWGEM/Dilepton/DataModel/lmeeMLTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
{
DECLARE_SOA_COLUMN(CollisionId, collisionId, int); //!
DECLARE_SOA_COLUMN(HadronicRate, hadronicRate, float); //!
DECLARE_SOA_COLUMN(PIDLabel, pidlabel, uint8_t); //!

Check failure on line 49 in PWGEM/Dilepton/DataModel/lmeeMLTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(TrackType, tracktype, uint8_t); //!

Check failure on line 50 in PWGEM/Dilepton/DataModel/lmeeMLTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(TPCNClsFound, tpcNClsFound, uint8_t); //!

Check failure on line 51 in PWGEM/Dilepton/DataModel/lmeeMLTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(TPCNClsCrossedRows, tpcNClsCrossedRows, uint8_t); //!

Check failure on line 52 in PWGEM/Dilepton/DataModel/lmeeMLTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(TPCNClsPID, tpcNClsPID, uint8_t); //!

Check failure on line 53 in PWGEM/Dilepton/DataModel/lmeeMLTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(IsForValidation, isForValidation, bool); //!
DECLARE_SOA_COLUMN(Sign, sign, short); //!
DECLARE_SOA_COLUMN(P, p, float); //!
Expand All @@ -61,7 +61,7 @@
// DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float pt, float eta) -> float { return pt * std::cosh(eta); });
DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITS, meanClusterSizeITS, [](uint32_t itsClusterSizes) -> float {
int total_cluster_size = 0, nl = 0;
for (unsigned int layer = 0; layer < 7; layer++) {

Check failure on line 64 in PWGEM/Dilepton/DataModel/lmeeMLTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf;
if (cluster_size_per_layer > 0) {
nl++;
Expand All @@ -76,7 +76,7 @@
});
DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITSob, meanClusterSizeITSob, [](uint32_t itsClusterSizes) -> float {
int total_cluster_size = 0, nl = 0;
for (unsigned int layer = 3; layer < 7; layer++) {

Check failure on line 79 in PWGEM/Dilepton/DataModel/lmeeMLTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf;
if (cluster_size_per_layer > 0) {
nl++;
Expand Down Expand Up @@ -192,6 +192,40 @@
// iterators
using EMFwdTrackErrForML = EMFwdTrackErrsForML::iterator;

// for SemiCharmTag at midrapidity, only electrons
namespace emmllhpair
{
DECLARE_SOA_COLUMN(Signed1PtL, signed1PtL, float); //! signed1Pt of lepton
DECLARE_SOA_COLUMN(EtaL, etaL, float); //! eta of lepton
DECLARE_SOA_COLUMN(DcaL, dcaL, float); //! dca of lepton
DECLARE_SOA_COLUMN(DcaLSigma, dcaLsigma, float); //! dca of lepton

Check failure on line 201 in PWGEM/Dilepton/DataModel/lmeeMLTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.

DECLARE_SOA_COLUMN(Signed1PtH, signed1PtH, float); //! signed1Pt of hadron
DECLARE_SOA_COLUMN(EtaH, etaH, float); //! eta of hadron
DECLARE_SOA_COLUMN(DcaH, dcaH, float); //! dca of hadron
DECLARE_SOA_COLUMN(DcaHSigma, dcaHsigma, float); //! dca resolution of hadron

Check failure on line 206 in PWGEM/Dilepton/DataModel/lmeeMLTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(NSigmaKa, nSigmaKa, float); //! PID n sigma with respect to charged Kaon

DECLARE_SOA_COLUMN(Mass, mass, float); //! invariant mass of LH assuming kaon
DECLARE_SOA_COLUMN(DcaLH, dcalh, float); //! DCA between lepton and hadron

Check failure on line 210 in PWGEM/Dilepton/DataModel/lmeeMLTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(CosPA, cospa, float); //! flight direction of LH pair
DECLARE_SOA_COLUMN(Lxyz, lxyz, float); //! decay length of LH pair
DECLARE_SOA_COLUMN(LxyzSigma, lxyzSigma, float); //! decay length resolution of LH pair

DECLARE_SOA_COLUMN(PdgCodeH, pdgCodeH, int); //! pdg code of associated hadron
DECLARE_SOA_COLUMN(PdgCodeHFH, pdgCodeHFH, int); //! pdg code of HF hadron
} // namespace emmllhpair

DECLARE_SOA_TABLE(EMMLLHPairs, "AOD", "EMMLLHPAIR", //!
o2::soa::Index<>, collision::NumContrib, evsel::NumTracksInTimeRange, evsel::SumAmpFT0CInTimeRange,
emmllhpair::Signed1PtL, emmllhpair::EtaL, emmllhpair::DcaL, emmllhpair::DcaLSigma,
emmllhpair::Signed1PtH, emmllhpair::EtaH, emmllhpair::DcaH, emmllhpair::DcaHSigma, emmllhpair::NSigmaKa,
emmllhpair::Mass, emmllhpair::DcaLH, emmllhpair::CosPA, emmllhpair::Lxyz, emmllhpair::LxyzSigma,
emmllhpair::PdgCodeH, emmllhpair::PdgCodeHFH);

// iterators
using EMMLLHPair = EMMLLHPairs::iterator;

} // namespace o2::aod

#endif // PWGEM_DILEPTON_DATAMODEL_LMEEMLTABLES_H_
73 changes: 59 additions & 14 deletions PWGEM/Dilepton/Tasks/taggingHFE.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
/// \brief a task to study tagging e from charm hadron decays in MC
/// \author daiki.sekihata@cern.ch

#include "PWGEM/Dilepton/DataModel/lmeeMLTables.h"
#include "PWGEM/Dilepton/Utils/MCUtilities.h"
#include "PWGEM/Dilepton/Utils/SemiCharmTag.h"
#include "PWGLF/DataModel/LFStrangenessTables.h"
Expand Down Expand Up @@ -82,15 +83,7 @@ struct taggingHFE {
using MyV0s = soa::Join<aod::V0Datas, aod::V0Covs>;
using MyCascades = soa::Join<aod::CascDatas, aod::CascCovs>;

struct EBPair { // electron-baryon pair
float mass{-999.f};
float dca2legs{-999.f};
float cospa{-999.f};
float lxy{-999.f};
float lz{-999.f};
float ptepv{-999.f};
float dca3dinsigma{-999.f};
};
Produces<aod::EMMLLHPairs> emmllhpair;

// Configurables
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Expand Down Expand Up @@ -124,8 +117,8 @@ struct taggingHFE {
std::string prefix = "electronCut";
Configurable<float> cfg_min_pt_track{"cfg_min_pt_track", 0.4, "min pT for single track"};
Configurable<float> cfg_max_pt_track{"cfg_max_pt_track", 1e+10, "max pT for single track"};
Configurable<float> cfg_min_eta_track{"cfg_min_eta_track", -0.5, "min eta for single track"};
Configurable<float> cfg_max_eta_track{"cfg_max_eta_track", +0.5, "max eta for single track"};
Configurable<float> cfg_min_eta_track{"cfg_min_eta_track", -0.8, "min eta for single track"};
Configurable<float> cfg_max_eta_track{"cfg_max_eta_track", +0.8, "max eta for single track"};
Configurable<float> cfg_min_cr2findable_ratio_tpc{"cfg_min_cr2findable_ratio_tpc", 0.8, "min. TPC Ncr/Nf ratio"};
Configurable<float> cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"};
Configurable<int> cfg_min_ncrossedrows_tpc{"cfg_min_ncrossedrows_tpc", 80, "min ncrossed rows"};
Expand Down Expand Up @@ -658,9 +651,9 @@ struct taggingHFE {
return false;
}

if (!isKaon(track)) {
return false;
}
// if (!isKaon(track)) {
// return false;
// }

return true;
}
Expand Down Expand Up @@ -905,6 +898,20 @@ struct taggingHFE {
}
}

template <typename TTrack>
float combinedNSigmaKa(TTrack const& track)
{
if (track.hasTOF()) {
if (track.tpcNSigmaKa() > 0.f) {
return std::sqrt((std::pow(track.tpcNSigmaKa(), 2) + std::pow(track.tofNSigmaKa(), 2)) / 2.);
} else {
return -1 * std::sqrt((std::pow(track.tpcNSigmaKa(), 2) + std::pow(track.tofNSigmaKa(), 2)) / 2.);
}
} else {
return track.tpcNSigmaKa();
}
}

template <typename TMCParticle, typename TMCParticles>
bool isSemiLeptonic(TMCParticle const& mcParticle, TMCParticles const& mcParticles, const int pdgLepton, const int pdgNeutrino, const int pdgStrHad)
{
Expand Down Expand Up @@ -1123,7 +1130,10 @@ struct taggingHFE {
o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, leptonParCov, 2.f, matCorr, &mDcaInfoCov);
float dcaXY_lepton = mDcaInfoCov.getY();
float dcaZ_lepton = mDcaInfoCov.getZ();
float dca3D_lepton = std::hypot(dcaXY_lepton, dcaZ_lepton);
float dca3DinSigma_lepton = dca3DinSigmaOTF(dcaXY_lepton, dcaZ_lepton, leptonParCov.getSigmaY2(), leptonParCov.getSigmaZ2(), leptonParCov.getSigmaZY());
float sigma3D_lepton = dca3D_lepton / dca3DinSigma_lepton;

const auto& mcpos = pos.template mcParticle_as<aod::McParticles>();

// D0 -> e+ nu_e K-, br = 0.03538, ctau = 123.01 um, m = 1864 MeV/c2
Expand All @@ -1135,7 +1145,9 @@ struct taggingHFE {
o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov);
float dcaXY_kaon = mDcaInfoCov.getY();
float dcaZ_kaon = mDcaInfoCov.getZ();
float dca3D_kaon = std::hypot(dcaXY_kaon, dcaZ_kaon);
float dca3DinSigma_kaon = dca3DinSigmaOTF(dcaXY_kaon, dcaZ_kaon, trackParCov.getSigmaY2(), trackParCov.getSigmaZ2(), trackParCov.getSigmaZY());
float sigma3D_kaon = dca3D_kaon / dca3DinSigma_kaon;

if (positronId == kaonId) {
continue;
Expand All @@ -1162,6 +1174,20 @@ struct taggingHFE {
// const auto& mcD0 = mcParticles.rawIteratorAt(mcD0Id);
fRegistry.fill(HIST("MC/eKfromDpm/hs"), leptonParCov.getPt(), dca3DinSigma_lepton, trackParCov.getPt(), dca3DinSigma_kaon, eKpair.mass, eKpair.lxyz / eKpair.lxyzErr, eKpair.cospa, eKpair.dca2legs);
}

int mcMotherId = FindCommonMotherFrom2ProngsWithoutPDG(mcpos, mckaon);
int pdgCodeMother = 0;
if (mcMotherId > -1) {
auto mcMother = mcParticles.rawIteratorAt(mcMotherId);
pdgCodeMother = mcMother.pdgCode();
} else {
pdgCodeMother = 0;
}
emmllhpair(collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange(),
leptonParCov.getQ2Pt(), leptonParCov.getEta(), dca3D_lepton, sigma3D_lepton,
trackParCov.getQ2Pt(), trackParCov.getEta(), dca3D_kaon, sigma3D_kaon, combinedNSigmaKa(kaon),
eKpair.mass, eKpair.dca2legs, eKpair.cospa, eKpair.lxyz, eKpair.lxyzErr, mckaon.pdgCode(), pdgCodeMother);

} // end of kaon loop

// D+ -> e+ K0S nu_e
Expand Down Expand Up @@ -1300,7 +1326,10 @@ struct taggingHFE {
o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, leptonParCov, 2.f, matCorr, &mDcaInfoCov);
float dcaXY_lepton = mDcaInfoCov.getY();
float dcaZ_lepton = mDcaInfoCov.getZ();
float dca3D_lepton = std::hypot(dcaXY_lepton, dcaZ_lepton);
float dca3DinSigma_lepton = dca3DinSigmaOTF(dcaXY_lepton, dcaZ_lepton, leptonParCov.getSigmaY2(), leptonParCov.getSigmaZ2(), leptonParCov.getSigmaZY());
float sigma3D_lepton = dca3D_lepton / dca3DinSigma_lepton;

const auto& mcele = ele.template mcParticle_as<aod::McParticles>();

// D0bar -> e- anti-nu_e K+, br = 0.03538, ctau = 123.01 um, m = 1864 MeV/c2
Expand All @@ -1312,7 +1341,9 @@ struct taggingHFE {
o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov);
float dcaXY_kaon = mDcaInfoCov.getY();
float dcaZ_kaon = mDcaInfoCov.getZ();
float dca3D_kaon = std::hypot(dcaXY_kaon, dcaZ_kaon);
float dca3DinSigma_kaon = dca3DinSigmaOTF(dcaXY_kaon, dcaZ_kaon, trackParCov.getSigmaY2(), trackParCov.getSigmaZ2(), trackParCov.getSigmaZY());
float sigma3D_kaon = dca3D_kaon / dca3DinSigma_kaon;

if (electronId == kaonId) {
continue;
Expand All @@ -1337,6 +1368,20 @@ struct taggingHFE {
// const auto& mcD0 = mcParticles.rawIteratorAt(mcD0Id);
fRegistry.fill(HIST("MC/eKfromDpm/hs"), leptonParCov.getPt(), dca3DinSigma_lepton, trackParCov.getPt(), dca3DinSigma_kaon, eKpair.mass, eKpair.lxyz / eKpair.lxyzErr, eKpair.cospa, eKpair.dca2legs);
}

int mcMotherId = FindCommonMotherFrom2ProngsWithoutPDG(mcele, mckaon);
int pdgCodeMother = 0;
if (mcMotherId > -1) {
auto mcMother = mcParticles.rawIteratorAt(mcMotherId);
pdgCodeMother = mcMother.pdgCode();
} else {
pdgCodeMother = 0;
}
emmllhpair(collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange(),
leptonParCov.getQ2Pt(), leptonParCov.getEta(), dca3D_lepton, sigma3D_lepton,
trackParCov.getQ2Pt(), trackParCov.getEta(), dca3D_kaon, sigma3D_kaon, combinedNSigmaKa(kaon),
eKpair.mass, eKpair.dca2legs, eKpair.cospa, eKpair.lxyz, eKpair.lxyzErr, mckaon.pdgCode(), pdgCodeMother);

} // end of kaon loop

// D- -> e0 anti-K0S anti-nu_e
Expand Down
Loading