diff --git a/PWGLF/Tasks/Resonances/CMakeLists.txt b/PWGLF/Tasks/Resonances/CMakeLists.txt index 8e3cd7a9251..5bd98a8342f 100644 --- a/PWGLF/Tasks/Resonances/CMakeLists.txt +++ b/PWGLF/Tasks/Resonances/CMakeLists.txt @@ -388,3 +388,8 @@ o2physics_add_dpl_workflow(chkstar-spin SOURCES chKstarSpin.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(dstar2380analysis + SOURCES dstar2380analysis.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/Resonances/dstar2380analysis.cxx b/PWGLF/Tasks/Resonances/dstar2380analysis.cxx new file mode 100644 index 00000000000..2fc3f90c7cc --- /dev/null +++ b/PWGLF/Tasks/Resonances/dstar2380analysis.cxx @@ -0,0 +1,272 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file dstar2380analysis.cxx +/// \brief non-strange dibaryon analysis +/// \author Junlee Kim (jikim1290@gmail.com) + +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ASoA.h" +#include "Framework/Configurable.h" +#include "Framework/Expressions.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/HistogramSpec.h" +#include "Framework/InitContext.h" +#include "Framework/OutputObjHeader.h" +#include "Framework/runDataProcessing.h" + +#include // IWYU pragma: keep (do not replace with Math/Vector4Dfwd.h) +#include + +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct dstar2380analysis { + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + Service ccdb{}; + + Configurable cfgUrl{"cfgUrl", "http://alice-ccdb.cern.ch", "CCDB URL"}; + + Configurable cfgCutVertex{"cfgCutVertex", 10.f, "Vertex z cut"}; + + struct : ConfigurableGroup { + Configurable cfgDePtThres{"cfgDePtThres", 1.0, "pt threshold"}; + Configurable cfgDeSTPCnSigma{"cfgDeSTPCnSigma", 3.0, "standalone tpc n sigma for de"}; + Configurable cfgDeCombnSigma{"cfgDeCombnSigma", 3.0, "combined n sigma for de"}; + Configurable cfgDeLength{"cfgDeLength", 350.0, "flight length"}; + Configurable cfgDeDCAxy{"cfgDeDCAxy", 0.1, "dcaxy for de"}; + Configurable cfgDeDCAz{"cfgDeDCAz", 1.0, "dcaz for de"}; + Configurable cfgDeRap{"cfgDeRap", 0.5, "rapidity for de"}; + } deuteronSel; + + struct : ConfigurableGroup { + Configurable cfgPiCombnSigma{"cfgPiCombnSigma", 3.0, "combined n sigma for pi"}; + Configurable cfgPiSTPCnSigma{"cfgPiSTPCnSigma", 1.0, "standalone tpc n sigma for pi"}; + } pionSel; + + Configurable cfgPtMin{"cfgPtMin", 0.2, "minimum track pt"}; + Configurable cfgEtaMax{"cfgEtaMax", 0.8, "maximum track eta"}; + Configurable cfgDstarYMax{"cfgDstarYMax", 0.5, "maximum mother rapidity"}; + + ConfigurableAxis cfgAxisInvMass{"cfgAxisInvMass", {350, 2.15, 3.9}, "Mass bins"}; + ConfigurableAxis cfgAxisPt{"cfgAxisPt", {VARIABLE_WIDTH, 0., 0.5, 1., 1.5, 2., 3., 4., 6., 8., 12.}, "Pt bins"}; + ConfigurableAxis cfgAxisMult{"cfgAxisMult", {VARIABLE_WIDTH, 0., 10., 20., 40., 60., 100.}, "Centrality percentile"}; + ConfigurableAxis cfgAxisPiPiMass{"cfgAxisPiPiMass", {150, 0.07, 5}, "Pi Pi Mass"}; + ConfigurableAxis cfgAxisDePiMass{"cfgAxisDePiMass", {150, 4.0, 15}, "De Pi Mass"}; + + Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; + Filter trackFilter = nabs(aod::track::eta) < cfgEtaMax && aod::track::pt > cfgPtMin; + + using Collisions = soa::Filtered>; + using Tracks = soa::Filtered>; + + void init(InitContext const&) { + AxisSpec mass{cfgAxisInvMass, "M(d#pi#pi) (GeV/c^{2})"}; + AxisSpec pt{cfgAxisPt, "p_{T} (GeV/c)"}; + AxisSpec cent{cfgAxisMult, "FT0M centrality"}; + AxisSpec mpipi{cfgAxisPiPiMass, "M^{2}(#pi#pi)"}; + AxisSpec mdepi{cfgAxisDePiMass, "M^{2}(d#pi)"}; + + histos.add("hCentDist", "", HistType::kTH1F, {{120, 0, 120}}); + histos.add("hPVzDist", "", HistType::kTH1F, {{200, -12, 12}}); + + histos.add("hTPCNSigmaPi", "charged pi TPC PID", HistType::kTH2F, {{500, 0, 10}, {120, -6., 6.}}); + histos.add("hTOFNSigmaPi", "charged pi TOF PID", HistType::kTH2F, {{500, 0, 10}, {120, -6., 6.}}); + histos.add("hTPCNSigmaDe", "charged De TPC PID", HistType::kTH2F, {{500, 0, 10}, {120, -6., 6.}}); + histos.add("hTOFNSigmaDe", "charged De TOF PID", HistType::kTH2F, {{500, 0, 10}, {120, -6., 6.}}); + + histos.add("hDeuteron", "Deuteron distribution", HistType::kTH2F, {{200, 0, 10}, {100, 0, 100}}); + histos.add("hADeuteron", "Anti Deuteron distribution", HistType::kTH2F, {{200, 0, 10}, {100, 0, 100}}); + + histos.add("hInvMassUSDe", "dpipi invariant mass", HistType::kCompactTHnSparseF, {mass, pt, cent, mpipi, mdepi}); + histos.add("hInvMassUSADe", "adpipi invariant mass", HistType::kCompactTHnSparseF, {mass, pt, cent, mpipi, mdepi}); + histos.add("hInvMassLSpp", "dpipi++ invariant mass", HistType::kCompactTHnSparseF, {mass, pt, cent, mpipi, mdepi}); + histos.add("hInvMassLSmm", "dpipi-- invariant mass", HistType::kCompactTHnSparseF, {mass, pt, cent, mpipi, mdepi}); + + ccdb->setURL(cfgUrl.value); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + } + + template + bool selectEvent(C const& collision) + { + if (!collision.sel8()) { + return false; + } + return true; + } + + template + bool selectPion(T const& track, bool QA) + { + if (!track.isGlobalTrack()) { + return false; + } + if (QA) { + histos.fill(HIST("hTPCNSigmaPi"), track.pt(), track.tpcNSigmaPi()); + } + if (track.hasTOF()) { + if (QA) { + histos.fill(HIST("hTOFNSigmaPi"), track.pt(), track.tofNSigmaPi()); + } + if (std::hypot(track.tpcNSigmaPi(), track.tofNSigmaPi()) > pionSel.cfgPiCombnSigma) { + return false; + } + return true; + } + if (std::abs(track.tpcNSigmaPi()) > pionSel.cfgPiSTPCnSigma) { + return false; + } + return true; + } + + template + bool selectDeuteron(T const& track, bool QA) + { + double nsigmaTPC = track.tpcNSigmaDe(); + double nsigmaTOF = track.tofNSigmaDe(); + double mass = o2::constants::physics::MassDeuteron; + double p = track.p(); + double pz = track.pz(); + double E = std::sqrt(mass * mass + p * p); + double y = 0.5 * std::log((E + pz) / (E - pz)); + + if (std::abs(track.dcaXY()) > deuteronSel.cfgDeDCAxy) { + return false; + } + if (std::abs(track.dcaZ()) > deuteronSel.cfgDeDCAz) { + return false; + } + if (std::abs(y) > deuteronSel.cfgDeRap) { + return false; + } + if (QA) { + histos.fill(HIST("hTPCNSigmaDe"), track.pt(), nsigmaTPC); + } + if (track.pt() > deuteronSel.cfgDePtThres) { + if (!track.hasTOF()) { + return false; + } + if (track.length() < deuteronSel.cfgDeLength) { + return false; + } + if (QA) { + histos.fill(HIST("hTOFNSigmaDe"), track.pt(), nsigmaTOF); + } + if (std::hypot(nsigmaTPC, nsigmaTOF) > deuteronSel.cfgDeCombnSigma) { + return false; + } + return true; + } + if (std::abs(nsigmaTPC) > deuteronSel.cfgDeSTPCnSigma) { + return false; + } + return true; + } + + template + void fillHistograms(C const& collision, T const& track) + { + for (const auto& dtracks1 : track) { + if (selectDeuteron(dtracks1, true)) { + if (dtracks1.sign() > 0) { + histos.fill(HIST("hDeuteron"), dtracks1.pt(), collision.centFT0M()); + } + if (dtracks1.sign() < 0) { + histos.fill(HIST("hADeuteron"), dtracks1.pt(), collision.centFT0M()); + } + } + if (!selectPion(dtracks1, true)) { + continue; + } + for (const auto& dtracks2 : track) { + if (dtracks2.globalIndex() <= dtracks1.globalIndex()) { + continue; + } + if (!selectPion(dtracks2, false)) { + continue; + } + for (const auto& dtracks3 : track) { + if (dtracks1.globalIndex() == dtracks3.globalIndex() || dtracks2.globalIndex() == dtracks3.globalIndex()) { + continue; + } + if (!selectDeuteron(dtracks3, false)) { + continue; + } + + ROOT::Math::PxPyPzMVector pi1(dtracks1.px(), dtracks1.py(), dtracks1.pz(), o2::constants::physics::MassPionCharged); + ROOT::Math::PxPyPzMVector pi2(dtracks2.px(), dtracks2.py(), dtracks2.pz(), o2::constants::physics::MassPionCharged); + ROOT::Math::PxPyPzMVector de(dtracks3.px(), dtracks3.py(), dtracks3.pz(), o2::constants::physics::MassDeuteron); + + auto mother = de + pi1 + pi2; + if (std::abs(mother.Rapidity()) > cfgDstarYMax) { + continue; + } + + float massPiPi = std::pow((pi1 + pi2).M(), 2); + float massDePi = std::pow((de + pi1).M(), 2); + + if (dtracks1.sign() * dtracks2.sign() < 0) { + if (dtracks3.sign() > 0) { + histos.fill(HIST("hInvMassUSDe"), mother.M(), mother.Pt(), collision.centFT0M(), massPiPi, massDePi); + } + if (dtracks3.sign() < 0) { + histos.fill(HIST("hInvMassUSADe"), mother.M(), mother.Pt(), collision.centFT0M(), massPiPi, massDePi); + } + } + if (dtracks1.sign() > 0 && dtracks2.sign() > 0) { + histos.fill(HIST("hInvMassLSpp"), mother.M(), mother.Pt(), collision.centFT0M(), massPiPi, massDePi); + } + if (dtracks1.sign() < 0 && dtracks2.sign() < 0) { + histos.fill(HIST("hInvMassLSmm"), mother.M(), mother.Pt(), collision.centFT0M(), massPiPi, massDePi); + } + } + } + } + } + + void processDataSame(Collisions::iterator const& collision, Tracks const& tracks) + { + if (!selectEvent(collision)) { + return; + } + + histos.fill(HIST("hCentDist"), collision.centFT0M()); + histos.fill(HIST("hPVzDist"), collision.posZ()); + + fillHistograms(collision, tracks); + }; + PROCESS_SWITCH(dstar2380analysis, processDataSame, "Process Event for data", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +}