diff --git a/ALICE3/TableProducer/alice3-dileptonsmearing.cxx b/ALICE3/TableProducer/alice3-dileptonsmearing.cxx index cca45f14c38..4136e34da82 100644 --- a/ALICE3/TableProducer/alice3-dileptonsmearing.cxx +++ b/ALICE3/TableProducer/alice3-dileptonsmearing.cxx @@ -89,8 +89,42 @@ struct alice3dileptonsmearer { Configurable cfgMinPt{"cfgMinPt", -1, "if ptgen is smaller than this threshold, this value is used as input for ptgen."}; } pion_filenames; + struct : ConfigurableGroup { + std::string prefix = "kaon_filename_group"; + Configurable cfgNDSmearing{"cfgNDSmearing", false, "apply ND-correlated smearing"}; + Configurable cfgResFileName{"cfgResFileName", "", "name of resolution file"}; + Configurable cfgResNDHistName{"cfgResNDHistName", "hs_reso", "name of ND resolution file"}; + Configurable cfgResPtHistName{"cfgResPtHistName", "RelPtResArrCocktail", "histogram name for pt in resolution file"}; + Configurable cfgResEtaHistName{"cfgResEtaHistName", "EtaResArr", "histogram name for eta in resolution file"}; + Configurable cfgResPhiPosHistName{"cfgResPhiPosHistName", "PhiPosResArr", "histogram name for phi pos in resolution file"}; + Configurable cfgResPhiNegHistName{"cfgResPhiNegHistName", "PhiEleResArr", "hisogram for phi neg in resolution file"}; + Configurable cfgEffFileName{"cfgEffFileName", "", "name of efficiency file"}; + Configurable cfgEffHistName{"cfgEffHistName", "fhwEffpT", "name of efficiency histogram"}; + Configurable cfgCcdbPathRes{"cfgCcdbPathRes", "", "path to the ccdb object for resolution"}; + Configurable cfgCcdbPathEff{"cfgCcdbPathEff", "", "path to the ccdb object for efficiency"}; + Configurable cfgMinPt{"cfgMinPt", -1, "if ptgen is smaller than this threshold, this value is used as input for ptgen."}; + } kaon_filenames; + + struct : ConfigurableGroup { + std::string prefix = "proton_filename_group"; + Configurable cfgNDSmearing{"cfgNDSmearing", false, "apply ND-correlated smearing"}; + Configurable cfgResFileName{"cfgResFileName", "", "name of resolution file"}; + Configurable cfgResNDHistName{"cfgResNDHistName", "hs_reso", "name of ND resolution file"}; + Configurable cfgResPtHistName{"cfgResPtHistName", "RelPtResArrCocktail", "histogram name for pt in resolution file"}; + Configurable cfgResEtaHistName{"cfgResEtaHistName", "EtaResArr", "histogram name for eta in resolution file"}; + Configurable cfgResPhiPosHistName{"cfgResPhiPosHistName", "PhiPosResArr", "histogram name for phi pos in resolution file"}; + Configurable cfgResPhiNegHistName{"cfgResPhiNegHistName", "PhiEleResArr", "hisogram for phi neg in resolution file"}; + Configurable cfgEffFileName{"cfgEffFileName", "", "name of efficiency file"}; + Configurable cfgEffHistName{"cfgEffHistName", "fhwEffpT", "name of efficiency histogram"}; + Configurable cfgCcdbPathRes{"cfgCcdbPathRes", "", "path to the ccdb object for resolution"}; + Configurable cfgCcdbPathEff{"cfgCcdbPathEff", "", "path to the ccdb object for efficiency"}; + Configurable cfgMinPt{"cfgMinPt", -1, "if ptgen is smaller than this threshold, this value is used as input for ptgen."}; + } proton_filenames; + MomentumSmearer smearer_Electron; MomentumSmearer smearer_Pion; + MomentumSmearer smearer_Kaon; + MomentumSmearer smearer_Proton; Service ccdb; void init(InitContext&) @@ -129,6 +163,32 @@ struct alice3dileptonsmearer { smearer_Pion.setDCAHistName(""); smearer_Pion.setMinPt(pion_filenames.cfgMinPt); + smearer_Kaon.setNDSmearing(kaon_filenames.cfgNDSmearing.value); + smearer_Kaon.setResFileName(TString(kaon_filenames.cfgResFileName)); + smearer_Kaon.setResNDHistName(TString(kaon_filenames.cfgResNDHistName)); + smearer_Kaon.setResPtHistName(TString(kaon_filenames.cfgResPtHistName)); + smearer_Kaon.setResEtaHistName(TString(kaon_filenames.cfgResEtaHistName)); + smearer_Kaon.setResPhiPosHistName(TString(kaon_filenames.cfgResPhiPosHistName)); + smearer_Kaon.setResPhiNegHistName(TString(kaon_filenames.cfgResPhiNegHistName)); + smearer_Kaon.setEffFileName(TString(kaon_filenames.cfgEffFileName)); + smearer_Kaon.setEffHistName(TString(kaon_filenames.cfgEffHistName)); + smearer_Kaon.setDCAFileName(""); + smearer_Kaon.setDCAHistName(""); + smearer_Kaon.setMinPt(kaon_filenames.cfgMinPt); + + smearer_Proton.setNDSmearing(proton_filenames.cfgNDSmearing.value); + smearer_Proton.setResFileName(TString(proton_filenames.cfgResFileName)); + smearer_Proton.setResNDHistName(TString(proton_filenames.cfgResNDHistName)); + smearer_Proton.setResPtHistName(TString(proton_filenames.cfgResPtHistName)); + smearer_Proton.setResEtaHistName(TString(proton_filenames.cfgResEtaHistName)); + smearer_Proton.setResPhiPosHistName(TString(proton_filenames.cfgResPhiPosHistName)); + smearer_Proton.setResPhiNegHistName(TString(proton_filenames.cfgResPhiNegHistName)); + smearer_Proton.setEffFileName(TString(proton_filenames.cfgEffFileName)); + smearer_Proton.setEffHistName(TString(proton_filenames.cfgEffHistName)); + smearer_Proton.setDCAFileName(""); + smearer_Proton.setDCAHistName(""); + smearer_Proton.setMinPt(proton_filenames.cfgMinPt); + if (cfgFromCcdb) { ccdb->setURL(cfgCcdbUrl); ccdb->setCaching(true); @@ -148,10 +208,26 @@ struct alice3dileptonsmearer { smearer_Pion.setCcdbPathDCA(""); smearer_Pion.setTimestamp(timestamp); smearer_Pion.setCcdb(ccdb); + + smearer_Kaon.setCcdbPathRes(TString(kaon_filenames.cfgCcdbPathRes)); + smearer_Kaon.setCcdbPathEff(TString(kaon_filenames.cfgCcdbPathEff)); + // smearer_Kaon.setCcdbPathDCA(TString(kaon_filenames.fConfigCcdbPathDCA)); + smearer_Kaon.setCcdbPathDCA(""); + smearer_Kaon.setTimestamp(timestamp); + smearer_Kaon.setCcdb(ccdb); + + smearer_Proton.setCcdbPathRes(TString(proton_filenames.cfgCcdbPathRes)); + smearer_Proton.setCcdbPathEff(TString(proton_filenames.cfgCcdbPathEff)); + // smearer_Proton.setCcdbPathDCA(TString(proton_filenames.fConfigCcdbPathDCA)); + smearer_Proton.setCcdbPathDCA(""); + smearer_Proton.setTimestamp(timestamp); + smearer_Proton.setCcdb(ccdb); } smearer_Electron.init(); smearer_Pion.init(); + smearer_Kaon.init(); + smearer_Proton.init(); } void processACTSHybrid(MyTracks const& tracks, const aod::McParticles& /*mcParticles*/) @@ -211,6 +287,54 @@ struct alice3dileptonsmearer { } // fill the table smearedelectron(ptsmeared, etasmeared, phismeared, selected); + } else if (std::abs(mcParticle.pdgCode()) == PDG_t::kKPlus) { + int ch = -1; + if (mcParticle.pdgCode() < 0) { + ch = 1; + } + float ptsmeared = 0, etasmeared = 0, phismeared = 0; + // apply smearing for electrons or muons. + smearer_Kaon.applySmearing(centrality, ch, ptgen, etagen, phigen, ptsmeared, etasmeared, phismeared); + // get the efficiency if there, otherwise applied zero + if ((TString(kaon_filenames.cfgCcdbPathEff).CompareTo("") != 0) || (TString(kaon_filenames.cfgEffFileName).CompareTo("") != 0)) { + float efficiency = smearer_Kaon.getEfficiency(ptgen, etagen, phigen); + // Generate a random double between 0 and 1 + double myRandom = gRandom->Uniform(0, 1); + // Select + if (myRandom < efficiency) { + selected = true; + } else { + selected = false; + } + } else { + selected = false; + } + // fill the table + smearedelectron(ptsmeared, etasmeared, phismeared, selected); + } else if (std::abs(mcParticle.pdgCode()) == PDG_t::kProton) { + int ch = -1; + if (mcParticle.pdgCode() < 0) { + ch = 1; + } + float ptsmeared = 0, etasmeared = 0, phismeared = 0; + // apply smearing for electrons or muons. + smearer_Proton.applySmearing(centrality, ch, ptgen, etagen, phigen, ptsmeared, etasmeared, phismeared); + // get the efficiency if there, otherwise applied zero + if ((TString(proton_filenames.cfgCcdbPathEff).CompareTo("") != 0) || (TString(proton_filenames.cfgEffFileName).CompareTo("") != 0)) { + float efficiency = smearer_Proton.getEfficiency(ptgen, etagen, phigen); + // Generate a random double between 0 and 1 + double myRandom = gRandom->Uniform(0, 1); + // Select + if (myRandom < efficiency) { + selected = true; + } else { + selected = false; + } + } else { + selected = false; + } + // fill the table + smearedelectron(ptsmeared, etasmeared, phismeared, selected); } else { // don't apply smearing and reject completely smearedelectron(ptgen, etagen, phigen, false); @@ -247,36 +371,40 @@ struct alice3dileptonchecksmearer { void init(o2::framework::InitContext&) { - registry.add("Electron/hCorrelation_Pt", "pT correlation;p_{T,l}^{gen} (GeV/c);p_{T,l}^{smeared} (GeV/c)", {HistType::kTH2F, {{1000, 0.0f, 10.0f}, {1000, 0.0f, 10.0f}}}); - registry.add("Electron/hCorrelation_Eta", "eta correlation;#eta_{l}^{gen};#eta_{l}^{smeared}", {HistType::kTH2F, {{200, -1.0f, +1.0f}, {200, -1.0f, +1.0f}}}); - registry.add("Electron/hCorrelation_Phi", "phi correlation;#varphi_{l}^{gen} (rad.);#varphi_{l}^{smeared} (rad.)", {HistType::kTH2F, {{100, 0.0f, TMath::TwoPi()}, {100, 0.0f, TMath::TwoPi()}}}); - - // Binning for resolution - AxisSpec axisPtRes{ptResBins, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}; - AxisSpec axisDeltaptRes{deltaptResBins, "(p^{gen}_{T} - p^{rec}_{T}) / p^{gen}_{T}"}; - AxisSpec axisDeltaetaRes{deltaetaResBins, "#eta^{gen} - #eta^{rec}"}; - AxisSpec axisDeltaphiRes{deltaphiResBins, "#varphi^{gen} - #varphi^{rec} (rad.)"}; - // Binning for efficiency - AxisSpec axiseta{etaBins, "#eta"}; - - if (!cfgUsePtVecRes) { - registry.add("Electron/PtGen_DeltaPtOverPtGen", "", HistType::kTH2D, {axisPtRes, axisDeltaptRes}, true); - registry.add("Electron/PtGen_DeltaEta", "", HistType::kTH2D, {axisPtRes, axisDeltaetaRes}, true); - registry.add("Electron/PtGen_DeltaPhi_Neg", "", HistType::kTH2D, {axisPtRes, axisDeltaphiRes}, true); - registry.add("Electron/PtGen_DeltaPhi_Pos", "", HistType::kTH2D, {axisPtRes, axisDeltaphiRes}, true); - registry.add("Electron/PtEtaGen", "", HistType::kTH2D, {axisPtRes, axiseta}, true); - registry.add("Electron/PtEtaRec", "", HistType::kTH2D, {axisPtRes, axiseta}, true); - } else { - registry.add("Electron/PtGen_DeltaPtOverPtGen", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axisDeltaptRes}, true); - registry.add("Electron/PtGen_DeltaEta", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axisDeltaetaRes}, true); - registry.add("Electron/PtGen_DeltaPhi_Neg", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axisDeltaphiRes}, true); - registry.add("Electron/PtGen_DeltaPhi_Pos", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axisDeltaphiRes}, true); - registry.add("Electron/PtEtaGen", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axiseta}, true); - registry.add("Electron/PtEtaRec", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axiseta}, true); - } + if (doprocessCheckACTSHybrid) { + registry.add("Electron/hCorrelation_Pt", "pT correlation;p_{T,l}^{gen} (GeV/c);p_{T,l}^{smeared} (GeV/c)", {HistType::kTH2F, {{1000, 0.0f, 10.0f}, {1000, 0.0f, 10.0f}}}); + registry.add("Electron/hCorrelation_Eta", "eta correlation;#eta_{l}^{gen};#eta_{l}^{smeared}", {HistType::kTH2F, {{200, -1.0f, +1.0f}, {200, -1.0f, +1.0f}}}); + registry.add("Electron/hCorrelation_Phi", "phi correlation;#varphi_{l}^{gen} (rad.);#varphi_{l}^{smeared} (rad.)", {HistType::kTH2F, {{100, 0.0f, TMath::TwoPi()}, {100, 0.0f, TMath::TwoPi()}}}); + + // Binning for resolution + AxisSpec axisPtRes{ptResBins, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}; + AxisSpec axisDeltaptRes{deltaptResBins, "(p^{gen}_{T} - p^{rec}_{T}) / p^{gen}_{T}"}; + AxisSpec axisDeltaetaRes{deltaetaResBins, "#eta^{gen} - #eta^{rec}"}; + AxisSpec axisDeltaphiRes{deltaphiResBins, "#varphi^{gen} - #varphi^{rec} (rad.)"}; + // Binning for efficiency + AxisSpec axiseta{etaBins, "#eta"}; + + if (!cfgUsePtVecRes) { + registry.add("Electron/PtGen_DeltaPtOverPtGen", "", HistType::kTH2D, {axisPtRes, axisDeltaptRes}, true); + registry.add("Electron/PtGen_DeltaEta", "", HistType::kTH2D, {axisPtRes, axisDeltaetaRes}, true); + registry.add("Electron/PtGen_DeltaPhi_Neg", "", HistType::kTH2D, {axisPtRes, axisDeltaphiRes}, true); + registry.add("Electron/PtGen_DeltaPhi_Pos", "", HistType::kTH2D, {axisPtRes, axisDeltaphiRes}, true); + registry.add("Electron/PtEtaGen", "", HistType::kTH2D, {axisPtRes, axiseta}, true); + registry.add("Electron/PtEtaRec", "", HistType::kTH2D, {axisPtRes, axiseta}, true); + } else { + registry.add("Electron/PtGen_DeltaPtOverPtGen", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axisDeltaptRes}, true); + registry.add("Electron/PtGen_DeltaEta", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axisDeltaetaRes}, true); + registry.add("Electron/PtGen_DeltaPhi_Neg", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axisDeltaphiRes}, true); + registry.add("Electron/PtGen_DeltaPhi_Pos", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axisDeltaphiRes}, true); + registry.add("Electron/PtEtaGen", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axiseta}, true); + registry.add("Electron/PtEtaRec", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axiseta}, true); + } - registry.addClone("Electron/", "Others/"); - registry.addClone("Electron/", "Pions/"); + registry.addClone("Electron/", "Other/"); + registry.addClone("Electron/", "Pion/"); + registry.addClone("Electron/", "Kaon/"); + registry.addClone("Electron/", "Proton/"); + } } void processCheckACTSHybrid(MyTracksWithSmearing const& tracks, const aod::McParticles& /*mcParticles*/) @@ -309,36 +437,68 @@ struct alice3dileptonchecksmearer { registry.fill(HIST("Electron/PtEtaRec"), mcParticle.pt(), mcParticle.eta()); } } else if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus) { - registry.fill(HIST("Pions/PtGen_DeltaPtOverPtGen"), mcParticle.pt(), deltaptoverpt); - registry.fill(HIST("Pions/PtGen_DeltaEta"), mcParticle.pt(), deltaeta); + registry.fill(HIST("Pion/PtGen_DeltaPtOverPtGen"), mcParticle.pt(), deltaptoverpt); + registry.fill(HIST("Pion/PtGen_DeltaEta"), mcParticle.pt(), deltaeta); + if (mcParticle.pdgCode() < 0) { // e+ + registry.fill(HIST("Pion/PtGen_DeltaPhi_Pos"), mcParticle.pt(), deltaphi); + } else { // e- + registry.fill(HIST("Pion/PtGen_DeltaPhi_Neg"), mcParticle.pt(), deltaphi); + } + registry.fill(HIST("Pion/hCorrelation_Pt"), mcParticle.pt(), track.ptSmeared()); + registry.fill(HIST("Pion/hCorrelation_Eta"), mcParticle.eta(), track.etaSmeared()); + registry.fill(HIST("Pion/hCorrelation_Phi"), mcParticle.phi(), track.phiSmeared()); + // efficiency + registry.fill(HIST("Pion/PtEtaGen"), mcParticle.pt(), mcParticle.eta()); + if (track.selected()) { + registry.fill(HIST("Pion/PtEtaRec"), mcParticle.pt(), mcParticle.eta()); + } + } else if (std::abs(mcParticle.pdgCode()) == PDG_t::kKPlus) { + registry.fill(HIST("Kaon/PtGen_DeltaPtOverPtGen"), mcParticle.pt(), deltaptoverpt); + registry.fill(HIST("Kaon/PtGen_DeltaEta"), mcParticle.pt(), deltaeta); + if (mcParticle.pdgCode() < 0) { // e+ + registry.fill(HIST("Kaon/PtGen_DeltaPhi_Pos"), mcParticle.pt(), deltaphi); + } else { // e- + registry.fill(HIST("Kaon/PtGen_DeltaPhi_Neg"), mcParticle.pt(), deltaphi); + } + registry.fill(HIST("Kaon/hCorrelation_Pt"), mcParticle.pt(), track.ptSmeared()); + registry.fill(HIST("Kaon/hCorrelation_Eta"), mcParticle.eta(), track.etaSmeared()); + registry.fill(HIST("Kaon/hCorrelation_Phi"), mcParticle.phi(), track.phiSmeared()); + // efficiency + registry.fill(HIST("Kaon/PtEtaGen"), mcParticle.pt(), mcParticle.eta()); + if (track.selected()) { + registry.fill(HIST("Kaon/PtEtaRec"), mcParticle.pt(), mcParticle.eta()); + } + } else if (std::abs(mcParticle.pdgCode()) == PDG_t::kProton) { + registry.fill(HIST("Proton/PtGen_DeltaPtOverPtGen"), mcParticle.pt(), deltaptoverpt); + registry.fill(HIST("Proton/PtGen_DeltaEta"), mcParticle.pt(), deltaeta); if (mcParticle.pdgCode() < 0) { // e+ - registry.fill(HIST("Pions/PtGen_DeltaPhi_Pos"), mcParticle.pt(), deltaphi); + registry.fill(HIST("Proton/PtGen_DeltaPhi_Pos"), mcParticle.pt(), deltaphi); } else { // e- - registry.fill(HIST("Pions/PtGen_DeltaPhi_Neg"), mcParticle.pt(), deltaphi); + registry.fill(HIST("Proton/PtGen_DeltaPhi_Neg"), mcParticle.pt(), deltaphi); } - registry.fill(HIST("Pions/hCorrelation_Pt"), mcParticle.pt(), track.ptSmeared()); - registry.fill(HIST("Pions/hCorrelation_Eta"), mcParticle.eta(), track.etaSmeared()); - registry.fill(HIST("Pions/hCorrelation_Phi"), mcParticle.phi(), track.phiSmeared()); + registry.fill(HIST("Proton/hCorrelation_Pt"), mcParticle.pt(), track.ptSmeared()); + registry.fill(HIST("Proton/hCorrelation_Eta"), mcParticle.eta(), track.etaSmeared()); + registry.fill(HIST("Proton/hCorrelation_Phi"), mcParticle.phi(), track.phiSmeared()); // efficiency - registry.fill(HIST("Pions/PtEtaGen"), mcParticle.pt(), mcParticle.eta()); + registry.fill(HIST("Proton/PtEtaGen"), mcParticle.pt(), mcParticle.eta()); if (track.selected()) { - registry.fill(HIST("Pions/PtEtaRec"), mcParticle.pt(), mcParticle.eta()); + registry.fill(HIST("Proton/PtEtaRec"), mcParticle.pt(), mcParticle.eta()); } } else { - registry.fill(HIST("Others/PtGen_DeltaPtOverPtGen"), mcParticle.pt(), deltaptoverpt); - registry.fill(HIST("Others/PtGen_DeltaEta"), mcParticle.pt(), deltaeta); + registry.fill(HIST("Other/PtGen_DeltaPtOverPtGen"), mcParticle.pt(), deltaptoverpt); + registry.fill(HIST("Other/PtGen_DeltaEta"), mcParticle.pt(), deltaeta); if (mcParticle.pdgCode() < 0) { // e+ - registry.fill(HIST("Others/PtGen_DeltaPhi_Pos"), mcParticle.pt(), deltaphi); + registry.fill(HIST("Other/PtGen_DeltaPhi_Pos"), mcParticle.pt(), deltaphi); } else { // e- - registry.fill(HIST("Others/PtGen_DeltaPhi_Neg"), mcParticle.pt(), deltaphi); + registry.fill(HIST("Other/PtGen_DeltaPhi_Neg"), mcParticle.pt(), deltaphi); } - registry.fill(HIST("Others/hCorrelation_Pt"), mcParticle.pt(), track.ptSmeared()); - registry.fill(HIST("Others/hCorrelation_Eta"), mcParticle.eta(), track.etaSmeared()); - registry.fill(HIST("Others/hCorrelation_Phi"), mcParticle.phi(), track.phiSmeared()); + registry.fill(HIST("Other/hCorrelation_Pt"), mcParticle.pt(), track.ptSmeared()); + registry.fill(HIST("Other/hCorrelation_Eta"), mcParticle.eta(), track.etaSmeared()); + registry.fill(HIST("Other/hCorrelation_Phi"), mcParticle.phi(), track.phiSmeared()); // efficiency - registry.fill(HIST("Others/PtEtaGen"), mcParticle.pt(), mcParticle.eta()); + registry.fill(HIST("Other/PtEtaGen"), mcParticle.pt(), mcParticle.eta()); if (track.selected()) { - registry.fill(HIST("Others/PtEtaRec"), mcParticle.pt(), mcParticle.eta()); + registry.fill(HIST("Other/PtEtaRec"), mcParticle.pt(), mcParticle.eta()); } } } // end of loop diff --git a/ALICE3/Tasks/alice3-dilepton.cxx b/ALICE3/Tasks/alice3-dilepton.cxx index f9b3d5e0d5f..e6fa5079cc3 100644 --- a/ALICE3/Tasks/alice3-dilepton.cxx +++ b/ALICE3/Tasks/alice3-dilepton.cxx @@ -528,7 +528,8 @@ struct Alice3Dilepton { SliceCache cache_rec; Configurable pdg{"pdg", 11, "pdg code for analysis. dielectron:11, dimuon:13"}; - Configurable requireHFEid{"requireHFEid", true, "Require HFE identification"}; + Configurable requireDCid{"requireDCid", false, "Require pi0 or photon as mother"}; + Configurable requireHFEid{"requireHFEid", false, "Require HFE identification"}; Configurable contamination{"contamination", false, "Fill only pairs with one misidentifixed electrons"}; Configurable ptMin{"ptMin", 0.f, "Lower limit in pT"}; Configurable ptMax{"ptMax", 5.f, "Upper limit in pT"}; @@ -630,6 +631,26 @@ struct Alice3Dilepton { } } + template + bool IsDC(TTrack const& track, TMCParticles const& mcparticles) + { + if (!track.has_mcParticle()) { + return false; + } + const auto p1 = track.template mcParticle_as(); + if (!p1.has_mothers()) { + return false; + } + int motherId = p1.mothersIds()[0]; + if (motherId > -1) { + auto mp = mcparticles.rawIteratorAt(motherId); + if ((std::abs(mp.pdgCode()) == PDG_t::kPi0) || (std::abs(mp.pdgCode()) == PDG_t::kGamma)) { + return true; + } + } + return false; + } + template bool IsHF(TTrack const& track, TMCParticles const& mcparticles) { @@ -843,6 +864,11 @@ struct Alice3Dilepton { continue; } } + if (requireDCid) { + if (!IsDC(t1, mcParticles) && !IsDC(t2, mcParticles)) { + continue; + } + } float pair_dca_xy = 999.f; ROOT::Math::PtEtaPhiMVector v12 = buildPairDCA(t1, t2, pair_dca_xy); @@ -873,6 +899,11 @@ struct Alice3Dilepton { continue; } } + if (requireDCid) { + if (!IsDC(t1, mcParticles) && !IsDC(t2, mcParticles)) { + continue; + } + } float pair_dca_xy = 999.f; ROOT::Math::PtEtaPhiMVector v12 = buildPairDCA(t1, t2, pair_dca_xy);