diff --git a/Common/LegacyDataQA/CMakeLists.txt b/Common/LegacyDataQA/CMakeLists.txt index 7da951c247e..c40882e2376 100644 --- a/Common/LegacyDataQA/CMakeLists.txt +++ b/Common/LegacyDataQA/CMakeLists.txt @@ -17,4 +17,9 @@ o2physics_add_dpl_workflow(otfv0qa o2physics_add_dpl_workflow(centqa SOURCES centqa.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(tpcpidqa + SOURCES tpcpidqa.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/Common/LegacyDataQA/otfv0qa.cxx b/Common/LegacyDataQA/otfv0qa.cxx index a97af78f83a..8dc446d9a01 100644 --- a/Common/LegacyDataQA/otfv0qa.cxx +++ b/Common/LegacyDataQA/otfv0qa.cxx @@ -8,19 +8,6 @@ // 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. -// -// This code calculates output histograms for centrality calibration -// as well as vertex-Z dependencies of raw variables (either for calibration -// of vtx-Z dependencies or for the calibration of those). -// -// This task is not strictly necessary in a typical analysis workflow, -// except for centrality calibration! The necessary task is the multiplicity -// tables. -// -// Comments, suggestions, questions? Please write to: -// - victor.gonzalez@cern.ch -// - david.dobrigkeit.chinellato@cern.ch -// #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -39,20 +26,33 @@ struct OTFV0Qa { // Raw multiplicities HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + Configurable maxGammaMassForXYplot{"maxGammaMassForXYplot", 0.1f, "Max photon mass for XY plot"}; + + ConfigurableAxis axisNCandidates{"axisNCandidates", {500, 0, 500}, "Number of OTF v0s"}; + ConfigurableAxis axisPosition{"axisPosition", {1000, -100, 100}, "position (cm)"}; + ConfigurableAxis axisMass{"axisMass", {100, 0.0f, 1.0f}, "Mass (GeV/c2)"}; + void init(InitContext&) { - const AxisSpec axisEvent{10, 0, 10, "Event counter"}; - const AxisSpec axisNCandidates{500, 0, 500, "Number of OTF v0s"}; + const AxisSpec axisPVz{30, -15, 15, "Primary vertex Z (cm)"}; // Base histograms - histos.add("hEventCounter", "Event counter", kTH1F, {axisEvent}); + histos.add("hPrimaryVertexZ", "Event counter", kTH1F, {axisPVz}); histos.add("hCandidates", "Number of OTF V0s", kTH1F, {axisNCandidates}); + histos.add("hGammaMass", "mass distribution", kTH1F, {axisMass}); + histos.add("h2dPosition", "xy positions", kTH2F, {axisPosition, axisPosition}); } - void process(aod::Collision const&, aod::Run2OTFV0s const& v0s) + void process(aod::Collision const& collision, aod::Run2OTFV0s const& v0s) { - histos.fill(HIST("hEventCounter"), 0.5); + histos.fill(HIST("hPrimaryVertexZ"), collision.posZ()); histos.fill(HIST("hCandidates"), v0s.size()); + for (auto const& v0 : v0s) { + histos.fill(HIST("hGammaMass"), v0.mass()); + if (v0.mass() < maxGammaMassForXYplot) { + histos.fill(HIST("h2dPosition"), v0.x(), v0.y()); + } + } } }; diff --git a/Common/LegacyDataQA/tpcpidqa.cxx b/Common/LegacyDataQA/tpcpidqa.cxx new file mode 100644 index 00000000000..a67043fd342 --- /dev/null +++ b/Common/LegacyDataQA/tpcpidqa.cxx @@ -0,0 +1,119 @@ +// 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. +// +// This task converts tiny PID tables into full PID tables. +// It is meant to be used with Run 2 converted data to maintain +// full compatibility with any task that may subscribe to the Full +// tables (at the cost of some memory consumption). +// It is also able to produce very simple QA plots on the stored +// quantities (optionally disabled for simplicity) +// +// Warning: expected resolution is NOT provided. + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Common/DataModel/PIDResponse.h" +#include "TableHelper.h" + +using namespace o2; +using namespace o2::framework; + +using tinyPidTracks = soa::Join; + +static constexpr int nParameters = 1; +static const std::vector tableNames{"Electron", // 0 + "Muon", // 1 + "Pion", // 2 + "Kaon", // 3 + "Proton", // 4 + "Deuteron", // 5 + "Triton", // 6 + "Helium", // 7 + "Alpha"}; // 8 +static const std::vector parameterNames{"enable"}; +static const int defaultParameters[9][nParameters]{{0}, {0}, {1}, {1}, {1}, {0}, {0}, {0}, {0}}; + +static constexpr int kPidEl = 0; +static constexpr int kPidMu = 1; +static constexpr int kPidPi = 2; +static constexpr int kPidKa = 3; +static constexpr int kPidPr = 4; +static constexpr int kPidDe = 5; +static constexpr int kPidTr = 6; +static constexpr int kPidHe = 7; +static constexpr int kPidAl = 8; +static constexpr int nTables = 9; + +struct TpcPidQa { + Configurable> enabledTables{"enabledTables", + {defaultParameters[0], nTables, nParameters, tableNames, parameterNames}, + "Produce QA for this species: 0 - no, 1 - yes"}; + std::vector mEnabledTables; // Vector of enabled tables + + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + ConfigurableAxis axisMomentum{"axisMomentum", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "momentum"}; + + ConfigurableAxis axisNSigma{"axisNSigma", {48, -6.0f, 6.0f}, "axisNSigma"}; + + void init(InitContext&) + { + mEnabledTables.resize(9, 0); + + for (int i = 0; i < nTables; i++) { + int f = enabledTables->get(tableNames[i].c_str(), "enable"); + if (f == 1) { + mEnabledTables[i] = 1; + histos.add(fmt::format("hNSigmaVsPTot{}", tableNames[i]).c_str(), "", kTH2F, {axisMomentum, axisNSigma}); + } + } + } + + void process(tinyPidTracks const& tracks) + { + for (const auto& track : tracks) { + if (mEnabledTables[kPidEl]) { + histos.fill(HIST("hNSigmaVsPTotElectron"), track.p(), track.tpcNSigmaEl()); + } + if (mEnabledTables[kPidMu]) { + histos.fill(HIST("hNSigmaVsPTotMuon"), track.p(), track.tpcNSigmaMu()); + } + if (mEnabledTables[kPidPi]) { + histos.fill(HIST("hNSigmaVsPTotPion"), track.p(), track.tpcNSigmaPi()); + } + if (mEnabledTables[kPidKa]) { + histos.fill(HIST("hNSigmaVsPTotKaon"), track.p(), track.tpcNSigmaKa()); + } + if (mEnabledTables[kPidPr]) { + histos.fill(HIST("hNSigmaVsPTotProton"), track.p(), track.tpcNSigmaPr()); + } + if (mEnabledTables[kPidDe]) { + histos.fill(HIST("hNSigmaVsPTotDeuteron"), track.p(), track.tpcNSigmaDe()); + } + if (mEnabledTables[kPidTr]) { + histos.fill(HIST("hNSigmaVsPTotTriton"), track.p(), track.tpcNSigmaTr()); + } + if (mEnabledTables[kPidHe]) { + histos.fill(HIST("hNSigmaVsPTotHelium"), track.p(), track.tpcNSigmaHe()); + } + if (mEnabledTables[kPidAl]) { + histos.fill(HIST("hNSigmaVsPTotAlpha"), track.p(), track.tpcNSigmaAl()); + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/Common/TableProducer/Converters/CMakeLists.txt b/Common/TableProducer/Converters/CMakeLists.txt index 646a0b5ade9..13b1fbb38be 100644 --- a/Common/TableProducer/Converters/CMakeLists.txt +++ b/Common/TableProducer/Converters/CMakeLists.txt @@ -104,3 +104,7 @@ o2physics_add_dpl_workflow(run2-tracks-extra-converter PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(run2-tiny-to-full-pid + SOURCES run2TinyToFullPID.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/Common/TableProducer/Converters/run2TinyToFullPID.cxx b/Common/TableProducer/Converters/run2TinyToFullPID.cxx new file mode 100644 index 00000000000..23b6c5a8cbf --- /dev/null +++ b/Common/TableProducer/Converters/run2TinyToFullPID.cxx @@ -0,0 +1,166 @@ +// 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. +// +// This task converts tiny PID tables into full PID tables. +// It is meant to be used with Run 2 converted data to maintain +// full compatibility with any task that may subscribe to the Full +// tables (at the cost of some memory consumption). +// It is also able to produce very simple QA plots on the stored +// quantities (optionally disabled for simplicity) +// +// Warning: expected resolution is NOT provided. + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Common/DataModel/PIDResponse.h" +#include "TableHelper.h" + +using namespace o2; +using namespace o2::framework; + +using tinyPidTracks = soa::Join; + +static constexpr int kPidEl = 0; +static constexpr int kPidMu = 1; +static constexpr int kPidPi = 2; +static constexpr int kPidKa = 3; +static constexpr int kPidPr = 4; +static constexpr int kPidDe = 5; +static constexpr int kPidTr = 6; +static constexpr int kPidHe = 7; +static constexpr int kPidAl = 8; +static constexpr int nTables = 9; + +static constexpr int nParameters = 1; +static const std::vector tableNames{"pidTPCFullEl", // 0 + "pidTPCFullMu", // 1 + "pidTPCFullPi", // 2 + "pidTPCFullKa", // 3 + "pidTPCFullPr", // 4 + "pidTPCFullDe", // 5 + "pidTPCFullTr", // 6 + "pidTPCFullHe", // 7 + "pidTPCFullAl"}; // 8 +static const std::vector parameterNames{"enable"}; +static const int defaultParameters[nTables][nParameters]{{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}}; + +struct Run2TinyToFullPID { + Produces pidTPCFullEl; + Produces pidTPCFullMu; + Produces pidTPCFullPi; + Produces pidTPCFullKa; + Produces pidTPCFullPr; + Produces pidTPCFullDe; + Produces pidTPCFullTr; + Produces pidTPCFullHe; + Produces pidTPCFullAl; + + Configurable> enabledTables{"enabledTables", + {defaultParameters[0], nTables, nParameters, tableNames, parameterNames}, + "Produce full PID tables depending on needs. Autodetect is -1, Force no is 0 and force yes is 1."}; + + std::vector mEnabledTables; // Vector of enabled tables + + void init(InitContext& context) + { + for (int i = 0; i < nTables; i++) { + LOGF(info, "test %i", i); + int f = enabledTables->get(tableNames[i].c_str(), "enable"); + enableFlagIfTableRequired(context, tableNames[i], f); + if (f == 1) { + mEnabledTables.push_back(i); + } + } + } + + void process(tinyPidTracks const& tracks) + { + // reserve memory + for (auto i : mEnabledTables) { + switch (i) { + case kPidEl: + pidTPCFullEl.reserve(tracks.size()); + break; + case kPidMu: + pidTPCFullMu.reserve(tracks.size()); + break; + case kPidPi: + pidTPCFullPi.reserve(tracks.size()); + break; + case kPidKa: + pidTPCFullKa.reserve(tracks.size()); + break; + case kPidPr: + pidTPCFullPr.reserve(tracks.size()); + break; + case kPidDe: + pidTPCFullDe.reserve(tracks.size()); + break; + case kPidTr: + pidTPCFullTr.reserve(tracks.size()); + break; + case kPidHe: + pidTPCFullHe.reserve(tracks.size()); + break; + case kPidAl: + pidTPCFullAl.reserve(tracks.size()); + break; + default: + LOG(fatal) << "Unknown table requested: " << i; + break; + } + } + + for (const auto& track : tracks) { + for (auto i : mEnabledTables) { + switch (i) { + case kPidEl: + pidTPCFullEl(0.0f, track.tpcNSigmaEl()); + break; + case kPidMu: + pidTPCFullMu(0.0f, track.tpcNSigmaMu()); + break; + case kPidPi: + pidTPCFullPi(0.0f, track.tpcNSigmaPi()); + break; + case kPidKa: + pidTPCFullKa(0.0f, track.tpcNSigmaKa()); + break; + case kPidPr: + pidTPCFullPr(0.0f, track.tpcNSigmaPr()); + break; + case kPidDe: + pidTPCFullDe(0.0f, track.tpcNSigmaDe()); + break; + case kPidTr: + pidTPCFullTr(0.0f, track.tpcNSigmaTr()); + break; + case kPidHe: + pidTPCFullHe(0.0f, track.tpcNSigmaHe()); + break; + case kPidAl: + pidTPCFullAl(0.0f, track.tpcNSigmaAl()); + break; + default: + LOG(fatal) << "Unknown table requested: " << i; + break; + } + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/Common/TableProducer/multiplicityTable.cxx b/Common/TableProducer/multiplicityTable.cxx index 579d85ce3e2..6d4411f7058 100644 --- a/Common/TableProducer/multiplicityTable.cxx +++ b/Common/TableProducer/multiplicityTable.cxx @@ -134,6 +134,7 @@ struct MultiplicityTable { TProfile* hVtxZFT0A; TProfile* hVtxZFT0C; TProfile* hVtxZFDDA; + TProfile* hVtxZFDDC; TProfile* hVtxZNTracks; std::vector mEnabledTables; // Vector of enabled tables @@ -160,6 +161,19 @@ struct MultiplicityTable { if (doprocessRun2 == true && doprocessRun3 == true) { LOGF(fatal, "Cannot enable processRun2 and processRun3 at the same time. Please choose one."); } + + // exploratory + auto& workflows = context.services().get(); + for (auto const& device : workflows.devices) { + for (auto const& input : device.inputs) { + // input.print(); + TString devNam = device.name.c_str(); + TString inBin = input.matcher.binding.c_str(); + // TString subSpec = input.matcher.subspec.c_str(); + LOGF(info, Form("device %s input binding %s subspec", devNam.Data(), inBin.Data())); + } + } + bool tEnabled[nTables] = {false}; for (int i = 0; i < nTables; i++) { int f = enabledTables->get(tableNames[i].c_str(), "Enable"); diff --git a/Common/TableProducer/trackPropagation.cxx b/Common/TableProducer/trackPropagation.cxx index 378a2ac06a2..073533a191c 100644 --- a/Common/TableProducer/trackPropagation.cxx +++ b/Common/TableProducer/trackPropagation.cxx @@ -110,7 +110,6 @@ struct TrackPropagation { ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); - lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get(lutPath)); // Histograms for track tuner AxisSpec axisBinsDCA = {600, -0.15f, 0.15f, "#it{dca}_{xy} (cm)"}; registry.add("hDCAxyVsPtRec", "hDCAxyVsPtRec", kTH2F, {axisBinsDCA, axisPtQA}); @@ -145,6 +144,15 @@ struct TrackPropagation { if (runNumber == bc.runNumber()) { return; } + + // load matLUT for this timestamp + if (!lut) { + LOG(info) << "Loading material look-up table for timestamp: " << bc.timestamp(); + lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->getForTimeStamp(lutPath, bc.timestamp())); + } else { + LOG(info) << "Material look-up table already in place. Not reloading."; + } + grpmag = ccdb->getForTimeStamp(grpmagPath, bc.timestamp()); LOG(info) << "Setting magnetic field to current " << grpmag->getL3Current() << " A for run " << bc.runNumber() << " from its GRPMagField CCDB object"; o2::base::Propagator::initFieldFromGRP(grpmag); diff --git a/Common/Tasks/centralityStudy.cxx b/Common/Tasks/centralityStudy.cxx index 6a70a69a7bc..6ba9d1f1451 100644 --- a/Common/Tasks/centralityStudy.cxx +++ b/Common/Tasks/centralityStudy.cxx @@ -472,7 +472,7 @@ struct centralityStudy { } if (multbc.has_ft0Mult()) { - auto multco = multbc.ft0Mult_as>(); + auto multco = multbc.ft0Mult_as>(); if (multbc.multFT0PosZValid()) { histos.fill(HIST("hVertexZ_BCvsCO"), multco.multPVz(), multbc.multFT0PosZ()); } diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniversePairSHCentMultKt.h b/PWGCF/FemtoUniverse/Core/FemtoUniversePairSHCentMultKt.h index 50885a02523..648ce4a598c 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniversePairSHCentMultKt.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniversePairSHCentMultKt.h @@ -22,6 +22,8 @@ #include #include "Framework/HistogramRegistry.h" +using namespace o2::constants::physics; + namespace o2::analysis::femto_universe { @@ -165,11 +167,11 @@ class PairSHCentMultKt if ((absmultval >= centMultBins[0]) && (absmultval < centMultBins[1])) { multbinval = 0; - } else if (absmultval < centMultBins[2]) { + } else if ((absmultval >= centMultBins[1]) && (absmultval < centMultBins[2])) { multbinval = 1; - } else if (absmultval < centMultBins[3]) { + } else if ((absmultval >= centMultBins[2]) && (absmultval < centMultBins[3])) { multbinval = 2; - } else if (absmultval < centMultBins[4]) { + } else if ((absmultval >= centMultBins[3]) && (absmultval < centMultBins[4])) { multbinval = 3; } else { return; @@ -190,14 +192,20 @@ class PairSHCentMultKt int maxl, int multval, float ktval, bool isiden) { int ktbinval = -1; - if ((ktval >= ktBins[0]) && (ktval < ktBins[1])) { + if (ktval >= ktBins[0] && ktval < ktBins[1]) { ktbinval = 0; - } else if (ktval < ktBins[2]) { + } else if (ktval >= ktBins[1] && ktval < ktBins[2]) { ktbinval = 1; - } else if (ktval < ktBins[3]) { + } else if (ktval >= ktBins[2] && ktval < ktBins[3]) { ktbinval = 2; - } else if (ktval < ktBins[4]) { + } else if (ktval >= ktBins[3] && ktval < ktBins[4]) { ktbinval = 3; + } else if (ktval >= ktBins[4] && ktval < ktBins[5]) { + ktbinval = 4; + } else if (ktval >= ktBins[5] && ktval < ktBins[6]) { + ktbinval = 5; + } else if (ktval >= ktBins[6] && ktval < ktBins[7]) { + ktbinval = 6; } else { return; } @@ -207,12 +215,10 @@ class PairSHCentMultKt /// Set the PDG codes of the two particles involved /// \param pdg1 PDG code of particle one /// \param pdg2 PDG code of particle two - void setPDGCodes(const int pdg1, const int pdg2) + void setPionPairMass() { - mMassOne = TDatabasePDG::Instance()->GetParticle(pdg1)->Mass(); - mMassTwo = TDatabasePDG::Instance()->GetParticle(pdg2)->Mass(); - mPDGOne = pdg1; - mPDGTwo = pdg2; + mMassOne = o2::constants::physics::MassPiPlus; // FIXME: Get from the PDG service of the common header + mMassTwo = o2::constants::physics::MassPiPlus; // FIXME: Get from the PDG service of the common header } /// To compute the bin value for cavariance matrix @@ -242,6 +248,7 @@ class PairSHCentMultKt int fKtBin = ktval; std::vector> fYlmBuffer(kMaxJM); std::vector f3d; + setPionPairMass(); f3d = FemtoUniverseMath::newpairfunc(part1, mMassOne, part2, mMassTwo, isiden); @@ -336,7 +343,7 @@ class PairSHCentMultKt void fillMultkTCov(uint8_t ChosenEventType, int MaxJM) { for (int multbinvalcov = 0; - multbinvalcov < static_cast(centMultBins.size() - 2); + multbinvalcov < static_cast(centMultBins.size() - 1); multbinvalcov++) { for (int ktbinvalcov = 0; ktbinvalcov < static_cast(ktBins.size() - 1); ktbinvalcov++) { @@ -346,10 +353,10 @@ class PairSHCentMultKt } private: - std::array, 10>, 4>, 4> fnumsreal{}; - std::array, 10>, 4>, 4> fnumsimag{}; - std::array, 10>, 4>, 4> fdensreal{}; - std::array, 10>, 4>, 4> fdensimag{}; + std::array, 10>, 7>, 4> fnumsreal{}; + std::array, 10>, 7>, 4> fnumsimag{}; + std::array, 10>, 7>, 4> fdensreal{}; + std::array, 10>, 7>, 4> fdensimag{}; TH1D* fbinctn[10][10]; TH1D* fbinctd[10][10]; @@ -357,11 +364,11 @@ class PairSHCentMultKt static constexpr int kMaxL = 2; static constexpr int kMaxJM = (kMaxL + 1) * (kMaxL + 1); - std::array, 4>, 4> fcovmnum{}; ///< Covariance matrix for the numerator - std::array, 4>, 4> fcovmden{}; ///< Covariance matrix for the numerator + std::array, 7>, 4> fcovmnum{}; ///< Covariance matrix for the numerator + std::array, 7>, 4> fcovmden{}; ///< Covariance matrix for the numerator - std::array, 4>, 4> fcovnum{}; - std::array, 4>, 4> fcovden{}; + std::array, 7>, 4> fcovnum{}; + std::array, 7>, 4> fcovden{}; protected: HistogramRegistry* pairSHCentMultKtRegistry = nullptr; diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h b/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h index 923242451b0..5cfef9c433f 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h @@ -106,55 +106,55 @@ class FemtoUniversePairWithCentMultKt if (cent_mult_value >= centMultBins[centMultBins.size() - 1] || cent_mult_value < centMultBins[0]) { pairWithCentMultKtRegistry->fill(HIST("Beyond_Max"), kstar_value); - } else if (cent_mult_value < centMultBins[1]) { + } else if (cent_mult_value >= centMultBins[0] && cent_mult_value < centMultBins[1]) { pairWithCentMultKtRegistry->fill(HIST("mult_0_1/kstar"), kstar_value); if (useKt) { auto histMultFolder = HIST("mult_0_1/"); fillkT(kstar_value, kt_value, histMultFolder); } - } else if (cent_mult_value < centMultBins[2]) { + } else if (cent_mult_value >= centMultBins[1] && cent_mult_value < centMultBins[2]) { pairWithCentMultKtRegistry->fill(HIST("mult_1_2/kstar"), kstar_value); if (useKt) { auto histMultFolder = HIST("mult_1_2/"); fillkT(kstar_value, kt_value, histMultFolder); } - } else if (cent_mult_value < centMultBins[3]) { + } else if (cent_mult_value >= centMultBins[2] && cent_mult_value < centMultBins[3]) { pairWithCentMultKtRegistry->fill(HIST("mult_2_3/kstar"), kstar_value); if (useKt) { auto histMultFolder = HIST("mult_2_3/"); fillkT(kstar_value, kt_value, histMultFolder); } - } else if (cent_mult_value < centMultBins[4]) { + } else if (cent_mult_value >= centMultBins[3] && cent_mult_value < centMultBins[4]) { pairWithCentMultKtRegistry->fill(HIST("mult_3_4/kstar"), kstar_value); if (useKt) { auto histMultFolder = HIST("mult_3_4/"); fillkT(kstar_value, kt_value, histMultFolder); } - } else if (cent_mult_value < centMultBins[5]) { + } else if (cent_mult_value >= centMultBins[4] && cent_mult_value < centMultBins[5]) { pairWithCentMultKtRegistry->fill(HIST("mult_4_5/kstar"), kstar_value); if (useKt) { auto histMultFolder = HIST("mult_4_5/"); fillkT(kstar_value, kt_value, histMultFolder); } - } else if (cent_mult_value < centMultBins[6]) { + } else if (cent_mult_value >= centMultBins[5] && cent_mult_value < centMultBins[6]) { pairWithCentMultKtRegistry->fill(HIST("mult_5_6/kstar"), kstar_value); if (useKt) { auto histMultFolder = HIST("mult_5_6/"); fillkT(kstar_value, kt_value, histMultFolder); } - } else if (cent_mult_value < centMultBins[7]) { + } else if (cent_mult_value >= centMultBins[6] && cent_mult_value < centMultBins[7]) { pairWithCentMultKtRegistry->fill(HIST("mult_6_7/kstar"), kstar_value); if (useKt) { auto histMultFolder = HIST("mult_6_7/"); fillkT(kstar_value, kt_value, histMultFolder); } - } else if (cent_mult_value < centMultBins[8]) { + } else if (cent_mult_value >= centMultBins[7] && cent_mult_value < centMultBins[8]) { pairWithCentMultKtRegistry->fill(HIST("mult_7_8/kstar"), kstar_value); if (useKt) { auto histMultFolder = HIST("mult_7_8/"); fillkT(kstar_value, kt_value, histMultFolder); } - } else if (cent_mult_value < centMultBins[9]) { + } else if (cent_mult_value >= centMultBins[8] && cent_mult_value < centMultBins[9]) { pairWithCentMultKtRegistry->fill(HIST("mult_8_9/kstar"), kstar_value); if (useKt) { auto histMultFolder = HIST("mult_8_9/"); @@ -172,23 +172,23 @@ class FemtoUniversePairWithCentMultKt template void fillkT(t1 kstar_value, t1 kt_value, t2 folder) { - if (kt_value < ktBins[1]) { + if (kt_value >= ktBins[0] && kt_value < ktBins[1]) { pairWithCentMultKtRegistry->fill(folder + HIST("kstar_kt_0_1"), kstar_value); - } else if (kt_value < ktBins[2]) { + } else if (kt_value >= ktBins[1] && kt_value < ktBins[2]) { pairWithCentMultKtRegistry->fill(folder + HIST("kstar_kt_1_2"), kstar_value); - } else if (kt_value < ktBins[3]) { + } else if (kt_value >= ktBins[2] && kt_value < ktBins[3]) { pairWithCentMultKtRegistry->fill(folder + HIST("kstar_kt_2_3"), kstar_value); - } else if (kt_value < ktBins[4]) { + } else if (kt_value >= ktBins[3] && kt_value < ktBins[4]) { pairWithCentMultKtRegistry->fill(folder + HIST("kstar_kt_3_4"), kstar_value); - } else if (kt_value < ktBins[5]) { + } else if (kt_value >= ktBins[4] && kt_value < ktBins[5]) { pairWithCentMultKtRegistry->fill(folder + HIST("kstar_kt_4_5"), kstar_value); - } else if (kt_value < ktBins[6]) { + } else if (kt_value >= ktBins[5] && kt_value < ktBins[6]) { pairWithCentMultKtRegistry->fill(folder + HIST("kstar_kt_5_6"), kstar_value); - } else if (kt_value < ktBins[7]) { + } else if (kt_value >= ktBins[6] && kt_value < ktBins[7]) { pairWithCentMultKtRegistry->fill(folder + HIST("kstar_kt_6_7"), kstar_value); - } else if (kt_value < ktBins[8]) { + } else if (kt_value >= ktBins[7] && kt_value < ktBins[8]) { pairWithCentMultKtRegistry->fill(folder + HIST("kstar_kt_7_8"), kstar_value); - } else if (kt_value < ktBins[9]) { + } else if (kt_value >= ktBins[8] && kt_value < ktBins[9]) { pairWithCentMultKtRegistry->fill(folder + HIST("kstar_kt_8_9"), kstar_value); } } @@ -205,55 +205,55 @@ class FemtoUniversePairWithCentMultKt if (cent_mult_value >= centMultBins[centMultBins.size() - 1] || cent_mult_value < centMultBins[0]) { pairWithCentMultKtRegistry->fill(HIST("Beyond_Max_3D"), qout_value, qside_value, qlong_value); - } else if (cent_mult_value < centMultBins[1]) { + } else if (cent_mult_value >= centMultBins[0] && cent_mult_value < centMultBins[1]) { pairWithCentMultKtRegistry->fill(HIST("mult_0_1/q3D"), qout_value, qside_value, qlong_value); if (use3D) { auto histMultFolder = HIST("mult_0_1/"); fillkT3D(qout_value, qside_value, qlong_value, kt_value, histMultFolder); } - } else if (cent_mult_value < centMultBins[2]) { + } else if (cent_mult_value >= centMultBins[1] && cent_mult_value < centMultBins[2]) { // pairWithCentMultKtRegistry->fill(HIST("mult_1_2/q3D"), qout_value, qside_value, qlong_value); if (use3D) { auto histMultFolder = HIST("mult_1_2/"); fillkT3D(qout_value, qside_value, qlong_value, kt_value, histMultFolder); } - } else if (cent_mult_value < centMultBins[3]) { + } else if (cent_mult_value >= centMultBins[2] && cent_mult_value < centMultBins[3]) { // pairWithCentMultKtRegistry->fill(HIST("mult_2_3/q3D"), qout_value, qside_value, qlong_value); if (use3D) { auto histMultFolder = HIST("mult_2_3/"); fillkT3D(qout_value, qside_value, qlong_value, kt_value, histMultFolder); } - } else if (cent_mult_value < centMultBins[4]) { + } else if (cent_mult_value >= centMultBins[3] && cent_mult_value < centMultBins[4]) { // pairWithCentMultKtRegistry->fill(HIST("mult_3_4/q3D"), qout_value, qside_value, qlong_value); if (use3D) { auto histMultFolder = HIST("mult_3_4/"); fillkT3D(qout_value, qside_value, qlong_value, kt_value, histMultFolder); } - } else if (cent_mult_value < centMultBins[5]) { + } else if (cent_mult_value >= centMultBins[4] && cent_mult_value < centMultBins[5]) { // pairWithCentMultKtRegistry->fill(HIST("mult_4_5/q3D"), qout_value, qside_value, qlong_value); if (use3D) { auto histMultFolder = HIST("mult_4_5/"); fillkT3D(qout_value, qside_value, qlong_value, kt_value, histMultFolder); } - } else if (cent_mult_value < centMultBins[6]) { + } else if (cent_mult_value >= centMultBins[5] && cent_mult_value < centMultBins[6]) { // pairWithCentMultKtRegistry->fill(HIST("mult_5_6/q3D"), qout_value, qside_value, qlong_value); if (use3D) { auto histMultFolder = HIST("mult_5_6/"); fillkT3D(qout_value, qside_value, qlong_value, kt_value, histMultFolder); } - } else if (cent_mult_value < centMultBins[7]) { + } else if (cent_mult_value >= centMultBins[6] && cent_mult_value < centMultBins[7]) { // pairWithCentMultKtRegistry->fill(HIST("mult_6_7/q3D"), qout_value, qside_value, qlong_value); if (use3D) { auto histMultFolder = HIST("mult_6_7/"); fillkT3D(qout_value, qside_value, qlong_value, kt_value, histMultFolder); } - } else if (cent_mult_value < centMultBins[8]) { + } else if (cent_mult_value >= centMultBins[7] && cent_mult_value < centMultBins[8]) { // pairWithCentMultKtRegistry->fill(HIST("mult_7_8/q3D"), qout_value, qside_value, qlong_value); if (use3D) { auto histMultFolder = HIST("mult_7_8/"); fillkT3D(qout_value, qside_value, qlong_value, kt_value, histMultFolder); } - } else if (cent_mult_value < centMultBins[9]) { + } else if (cent_mult_value >= centMultBins[8] && cent_mult_value < centMultBins[9]) { // pairWithCentMultKtRegistry->fill(HIST("mult_8_9/q3D"), qout_value, qside_value, qlong_value); if (use3D) { auto histMultFolder = HIST("mult_8_9/"); @@ -272,12 +272,18 @@ class FemtoUniversePairWithCentMultKt template void fillkT3D(t1 qout_value, t1 qside_value, t1 qlong_value, t1 kt_value, t2 folder) { - if (kt_value < ktBins[1]) { + if (kt_value >= ktBins[0] && kt_value < ktBins[1]) { pairWithCentMultKtRegistry->fill(folder + HIST("q3D_kt_0_1"), qout_value, qside_value, qlong_value); - } else if (kt_value < ktBins[2]) { + } else if (kt_value >= ktBins[1] && kt_value < ktBins[2]) { pairWithCentMultKtRegistry->fill(folder + HIST("q3D_kt_1_2"), qout_value, qside_value, qlong_value); - } else if (kt_value < ktBins[3]) { + } else if (kt_value >= ktBins[2] && kt_value < ktBins[3]) { pairWithCentMultKtRegistry->fill(folder + HIST("q3D_kt_2_3"), qout_value, qside_value, qlong_value); + } else if (kt_value >= ktBins[3] && kt_value < ktBins[4]) { + pairWithCentMultKtRegistry->fill(folder + HIST("q3D_kt_3_4"), qout_value, qside_value, qlong_value); + } else if (kt_value >= ktBins[4] && kt_value < ktBins[5]) { + pairWithCentMultKtRegistry->fill(folder + HIST("q3D_kt_4_5"), qout_value, qside_value, qlong_value); + } else if (kt_value >= ktBins[5] && kt_value < ktBins[6]) { + pairWithCentMultKtRegistry->fill(folder + HIST("q3D_kt_5_6"), qout_value, qside_value, qlong_value); } } diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx index e76f71e7910..7062bcd4c60 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx @@ -10,7 +10,7 @@ // or submit itself to any jurisdiction. /// \file femtoUniversePairTaskTrackCascadeExtended.cxx -/// \brief Task for cascade QA; in the future: for cascade correlations +/// \brief Task for cascade correlations and QA /// \author Barbara Chytla, WUT Warsaw, barbara.chytla@cern.ch /// \author Shirajum Monira, WUT Warsaw, shirajum.monira@cern.ch // o2-linter: disable=name/workflow-file @@ -82,9 +82,10 @@ struct femtoUniversePairTaskTrackCascadeExtended { // o2-linter: disable=name/st Configurable confPhiBins{"ConfPhiBins", 29, "Number of phi bins in deta dphi"}; // o2-linter: disable=name/configurable Configurable confIsMC{"ConfIsMC", false, "Enable additional Histograms in the case of a MonteCarlo Run"}; // o2-linter: disable=name/configurable Configurable confUse3D{"ConfUse3D", false, "Enable three dimensional histogramms (to be used only for analysis with high statistics): k* vs mT vs multiplicity"}; // o2-linter: disable=name/configurable - ConfigurableAxis confVtxBins{"ConfVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; // o2-linter: disable=name/configurable - ConfigurableAxis confTrkTempFitVarpTBins{"ConfTrkTempFitVarpTBins", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot"}; // o2-linter: disable=name/configurable - ConfigurableAxis confTrkTempFitVarBins{"ConfTrkDTempFitVarBins", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; // o2-linter: disable=name/configurable + Configurable confUseCent{"confUseCent", false, "Use centrality in place of multiplicity"}; + ConfigurableAxis confVtxBins{"ConfVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; // o2-linter: disable=name/configurable + ConfigurableAxis confTrkTempFitVarpTBins{"ConfTrkTempFitVarpTBins", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot"}; // o2-linter: disable=name/configurable + ConfigurableAxis confTrkTempFitVarBins{"ConfTrkDTempFitVarBins", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; // o2-linter: disable=name/configurable /// Partition for particle 1 (track) Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == confChargePart1) && (aod::femtouniverseparticle::pt < confHPtPart1) && (aod::femtouniverseparticle::pt > confLPtPart1); @@ -105,6 +106,9 @@ struct femtoUniversePairTaskTrackCascadeExtended { // o2-linter: disable=name/st FemtoUniverseParticleHisto bachHistos; FemtoUniverseParticleHisto cascQAHistos; + /// Histogramming for Event + FemtoUniverseEventHisto eventHisto; + FemtoUniverseContainer sameEventCont; FemtoUniverseContainer mixedEventCont; FemtoUniversePairCleaner pairCleaner; @@ -189,6 +193,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { // o2-linter: disable=name/st rXiQA.add("hDcaBachtoPV", "hDcaBachtoPV", {HistType::kTH1F, {aDCAToPVAxis}}); rXiQA.add("hDcaV0toPV", "hDcaV0toPV", {HistType::kTH1F, {aDCAToPVAxis}}); + eventHisto.init(&qaRegistry); qaRegistry.add("Tracks_pos/nSigmaTPC", "; #it{p} (GeV/#it{c}); n#sigma_{TPC}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("Tracks_pos/nSigmaTOF", "; #it{p} (GeV/#it{c}); n#sigma_{TOF}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("Tracks_neg/nSigmaTPC", "; #it{p} (GeV/#it{c}); n#sigma_{TPC}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); @@ -273,6 +278,10 @@ struct femtoUniversePairTaskTrackCascadeExtended { // o2-linter: disable=name/st auto groupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + eventHisto.fillQA(col); + + const int multCol = confUseCent ? col.multV0M() : col.multNtr(); + for (const auto& part : groupPartsTwo) { if (!invMCascade(part.mLambda(), part.mAntiLambda())) continue; @@ -328,7 +337,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { // o2-linter: disable=name/st if (!isParticleTPC(posChild, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2])) continue; - sameEventCont.setPair(p1, p2, col.multNtr(), confUse3D, 1.0f); + sameEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); } } PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processSameEvent, "Enable processing same event for track - cascade", false); @@ -337,6 +346,10 @@ struct femtoUniversePairTaskTrackCascadeExtended { // o2-linter: disable=name/st { auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + eventHisto.fillQA(col); + + const int multCol = confUseCent ? col.multV0M() : col.multNtr(); + for (const auto& part : groupPartsTwo) { if (!invMCascade(part.mLambda(), part.mAntiLambda())) continue; @@ -382,7 +395,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { // o2-linter: disable=name/st if (!isParticleTPC(posChild2, CascChildTable[confCascType2][0]) || !isParticleTPC(negChild2, CascChildTable[confCascType2][1]) || !isParticleTPC(bachelor2, CascChildTable[confCascType2][2])) return; - sameEventCont.setPair(p1, p2, col.multNtr(), confUse3D, 1.0f); + sameEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); }; if (confCascType1 == confCascType2) { /// Now build the combinations for identical cascades @@ -403,6 +416,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { // o2-linter: disable=name/st ColumnBinningPolicy colBinning{{confVtxBins, confMultBins}, true}; for (const auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { + const int multCol = confUseCent ? collision1.multV0M() : collision1.multNtr(); auto groupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); @@ -432,7 +446,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { // o2-linter: disable=name/st continue; } - mixedEventCont.setPair(p1, p2, collision1.multNtr(), confUse3D, 1.0f); + mixedEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); } } } diff --git a/PWGCF/Flow/Tasks/flowRunbyRun.cxx b/PWGCF/Flow/Tasks/flowRunbyRun.cxx index 79e24786b3b..03c596c9d2a 100644 --- a/PWGCF/Flow/Tasks/flowRunbyRun.cxx +++ b/PWGCF/Flow/Tasks/flowRunbyRun.cxx @@ -38,6 +38,7 @@ #include "GFW.h" #include "GFWCumulant.h" #include "GFWWeights.h" +#include "GFWWeightsList.h" #include "FlowContainer.h" #include "TList.h" #include @@ -62,6 +63,7 @@ struct FlowRunbyRun { O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5, "Chi2 per TPC clusters") O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2.0f, "max DCA to vertex z") O2_DEFINE_CONFIGURABLE(cfgUseNch, bool, false, "Use Nch for flow observables") + O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 30, "Number of subsamples") O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeightsRefPt, bool, false, "NUA weights are filled in ref pt bins") O2_DEFINE_CONFIGURABLE(cfgDynamicRunNumber, bool, false, "Add runNumber during runtime") Configurable> cfgRunNumbers{"cfgRunNumbers", std::vector{544095, 544098, 544116, 544121, 544122, 544123, 544124}, "Preconfigured run numbers"}; @@ -84,7 +86,7 @@ struct FlowRunbyRun { // Define output OutputObj fFC{FlowContainer("FlowContainer")}; - OutputObj fWeightList{"WeightList", OutputObjHandlingPolicy::AnalysisObject, OutputObjSourceType::OutputObjSource}; + OutputObj fGFWWeightsList{GFWWeightsList("GFWWeightsList")}; HistogramRegistry registry{"registry"}; // define global variables @@ -97,7 +99,6 @@ struct FlowRunbyRun { std::vector runNumbers; // vector of run numbers std::map>> th1sList; // map of histograms for all runs std::map>> profilesList; // map of profiles for all runs - std::map weightsList; // map of weights for all runs enum OutputTH1Names { // here are TProfiles for vn-pt correlations that are not implemented in GFW hPhi = 0, @@ -122,9 +123,7 @@ struct FlowRunbyRun { ccdb->setCaching(true); ccdb->setCreatedNotAfter(ccdbNoLaterThan.value); - TList* weightlist = new TList(); - weightlist->SetOwner(true); - fWeightList.setObject(weightlist); + fGFWWeightsList->init("weightList"); // Add output histograms to the registry runNumbers = cfgRunNumbers; @@ -148,7 +147,7 @@ struct FlowRunbyRun { } fFC->SetName("FlowContainer"); fFC->SetXAxis(fPtAxis); - fFC->Initialize(oba, axisIndependent, 1); + fFC->Initialize(oba, axisIndependent, cfgNbootstrap); delete oba; fGFW->AddRegion("full", -0.8, 0.8, 1, 1); @@ -230,11 +229,7 @@ struct FlowRunbyRun { o2::framework::AxisSpec axis = axisPt; int nPtBins = axis.binEdges.size() - 1; double* ptBins = &(axis.binEdges)[0]; - GFWWeights* weight = new GFWWeights(Form("weight_%d", runNumber)); - weight->SetPtBins(nPtBins, ptBins); - weight->Init(true, false); - fWeightList->Add(weight); - weightsList.insert(std::make_pair(runNumber, weight)); + fGFWWeightsList->addGFWWeightsByRun(runNumber, nPtBins, ptBins, true, false); } void process(AodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, AodTracks const& tracks) @@ -277,10 +272,21 @@ struct FlowRunbyRun { fGFW->Fill(track.eta(), 1, track.phi(), wacc * weff, 1); } if (cfgOutputNUAWeightsRefPt) { - if (withinPtRef) - weightsList[runNumber]->Fill(track.phi(), track.eta(), collision.posZ(), track.pt(), cent, 0); + if (withinPtRef) { + GFWWeights* weight = fGFWWeightsList->getGFWWeightsByRun(runNumber); + if (!weight) { + LOGF(fatal, "Could not find the weight for run %d", runNumber); + return; + } + weight->Fill(track.phi(), track.eta(), collision.posZ(), track.pt(), cent, 0); + } } else { - weightsList[runNumber]->Fill(track.phi(), track.eta(), collision.posZ(), track.pt(), cent, 0); + GFWWeights* weight = fGFWWeightsList->getGFWWeightsByRun(runNumber); + if (!weight) { + LOGF(fatal, "Could not find the weight for run %d", runNumber); + return; + } + weight->Fill(track.phi(), track.eta(), collision.posZ(), track.pt(), cent, 0); } } diff --git a/PWGCF/Flow/Tasks/pidcme.cxx b/PWGCF/Flow/Tasks/pidcme.cxx index 5c7714ddce6..8b4dda3f271 100644 --- a/PWGCF/Flow/Tasks/pidcme.cxx +++ b/PWGCF/Flow/Tasks/pidcme.cxx @@ -40,6 +40,7 @@ #include "Common/Core/EventPlaneHelper.h" #include "Common/Core/TrackSelection.h" #include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseITS.h" #include "CommonConstants/PhysicsConstants.h" @@ -70,16 +71,47 @@ struct FillPIDcolums { Configurable cfgPtMaxforTPCOnlyPID{"cfgPtMaxforTPCOnlyPID", 0.4, "Maxmium track pt for TPC only PID,only when onlyTOF and onlyTOFHIT closed"}; Configurable cfgMinPtPID{"cfgMinPtPID", 0.15, "Minimum track #P_{t} for PID"}; Configurable cfgMaxEtaPID{"cfgMaxEtaPID", 0.8, "Maximum track #eta for PID"}; + Configurable cfgnSigmaCutITSPi{"cfgnSigmaCutITSPi", 3.0, "Value of the ITS Nsigma cut for Pions"}; + Configurable cfgnSigmaCutITSKa{"cfgnSigmaCutITSKa", 2.5, "Value of the ITS Nsigma cut for Kaons"}; + Configurable cfgnSigmaCutITSPr{"cfgnSigmaCutITSPr", 2.0, "Value of the ITS Nsigma cut for Protons"}; + Configurable cfgAveClusSizeCoslMinPi{"cfgAveClusSizeCoslMinPi", 0, "Base line for minmum ITS cluster size x cos(#lambda) for Pions"}; + Configurable cfgAveClusSizeCoslMaxPi{"cfgAveClusSizeCoslMaxPi", 1e9, "Base line for maxmum ITS cluster size x cos(#lambda) for Pions"}; + Configurable cfgAveClusSizeCoslMinKa{"cfgAveClusSizeCoslMinKa", 0, "Base line for minmum ITS cluster size x cos(#lambda) for Kaons"}; + Configurable cfgAveClusSizeCoslMaxKa{"cfgAveClusSizeCoslMaxKa", 1e9, "Base line for maxmum ITS cluster size x cos(#lambda) for Kaons"}; + Configurable cfgAveClusSizeCoslMinPr{"cfgAveClusSizeCoslMinPr", 0, "Base line for minmum ITS cluster size x cos(#lambda) for Protons"}; + Configurable cfgAveClusSizeCoslMaxPr{"cfgAveClusSizeCoslMaxPr", 1e9, "Base line for maxmum ITS cluster size x cos(#lambda) for Protons"}; ConfigurableAxis cfgrigidityBins{"cfgrigidityBins", {200, -10.f, 10.f}, "Binning for rigidity #it{p}^{TPC}/#it{z}"}; ConfigurableAxis cfgdedxBins{"cfgdedxBins", {1000, 0.f, 1000.f}, "Binning for dE/dx"}; ConfigurableAxis cfgnSigmaBins{"cfgnSigmaBins", {200, -5.f, 5.f}, "Binning for n sigma"}; - ConfigurableAxis cfgaxisptPID{"cfgaxisptPID", {24, 0, 12}, ""}; + ConfigurableAxis cfgnSigmaBinsCom{"cfgnSigmaBinsCom", {100, 0.f, 10.f}, "Combination Binning for TPC&TOF nsigma"}; + ConfigurableAxis cfgaxisptPID{"cfgaxisptPID", {24, 0, 12}, "Binning for P_{t} PID"}; + ConfigurableAxis cfgaxispPID{"cfgaxispPID", {50, 0, 5}, "Binning for P PID"}; + ConfigurableAxis cfgaxisAverClusterCosl{"cfgaxisAverClusterCosl", {50, 0, 10}, "Binning for average cluster size x cos(#lambda)"}; Configurable onlyTOF{"onlyTOF", false, "only TOF tracks"}; Configurable onlyTOFHIT{"onlyTOFHIT", false, "accept only TOF hit tracks at high pt"}; + Configurable openITSCut{"openITSCut", true, "open ITSnsigma cut"}; bool onlyTPC = true; + static float averageClusterSizeCosl(uint32_t itsClusterSizes, float eta) + { + float average = 0; + int nclusters = 0; + const float cosl = 1. / std::cosh(eta); + + for (int layer = 0; layer < 7; layer++) { + if ((itsClusterSizes >> (layer * 4)) & 0xf) { + nclusters++; + average += (itsClusterSizes >> (layer * 4)) & 0xf; + } + } + if (nclusters == 0) { + return 0; + } + return average * cosl / nclusters; + }; + template bool selTrackPid(const TrackType track) { @@ -105,7 +137,7 @@ struct FillPIDcolums { } template - bool selectionPid(const T& candidate, int8_t PID) + bool selectionPid(const T& candidate, int8_t PID, float clustersize) { if (candidate.pt() > cfgPtMaxforTPCOnlyPID) { onlyTPC = false; @@ -114,74 +146,163 @@ struct FillPIDcolums { if (PID == 0) { if (onlyTOF) { if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < cfgnSigmaCutTOFPi) { - return true; + if (openITSCut) { + if (std::abs(candidate.itsNSigmaPi()) < cfgnSigmaCutITSPi && clustersize > cfgAveClusSizeCoslMinPi && clustersize < cfgAveClusSizeCoslMaxPi) + return true; + } else { + return true; + } } } else if (onlyTOFHIT) { if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < cfgnSigmaCutTOFPi) { - return true; + if (openITSCut) { + if (std::abs(candidate.itsNSigmaPi()) < cfgnSigmaCutITSPi && clustersize > cfgAveClusSizeCoslMinPi && clustersize < cfgAveClusSizeCoslMaxPi) + return true; + } else { + return true; + } } - if (!candidate.hasTOF() && - std::abs(candidate.tpcNSigmaPi()) < cfgnSigmaCutTPCPi) { - return true; + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPi()) < cfgnSigmaCutTPCPi) { + if (openITSCut) { + if (std::abs(candidate.itsNSigmaPi()) < cfgnSigmaCutITSPi && clustersize > cfgAveClusSizeCoslMinPi && clustersize < cfgAveClusSizeCoslMaxPi) + return true; + } else { + return true; + } } } else if (onlyTPC) { if (std::abs(candidate.tpcNSigmaPi()) < cfgnSigmaCutTPCPi) { - return true; + if (openITSCut) { + if (std::abs(candidate.itsNSigmaPi()) < cfgnSigmaCutITSPi && clustersize > cfgAveClusSizeCoslMinPi && clustersize < cfgAveClusSizeCoslMaxPi) + return true; + } else { + return true; + } } } else { if (candidate.hasTOF() && (candidate.tofNSigmaPi() * candidate.tofNSigmaPi() + candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi()) < (cfgnSigmaCutCombine * cfgnSigmaCutCombine)) { - return true; + if (openITSCut) { + if (std::abs(candidate.itsNSigmaPi()) < cfgnSigmaCutITSPi && clustersize > cfgAveClusSizeCoslMinPi && clustersize < cfgAveClusSizeCoslMaxPi) + return true; + } else { + return true; + } } if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPi()) < cfgnSigmaCutTPCPi) { - return true; + if (openITSCut) { + if (std::abs(candidate.itsNSigmaPi()) < cfgnSigmaCutITSPi && clustersize > cfgAveClusSizeCoslMinPi && clustersize < cfgAveClusSizeCoslMaxPi) + return true; + } else { + return true; + } } } } else if (PID == 1) { if (onlyTOF) { if (candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < cfgnSigmaCutTOFKa) { - return true; + if (openITSCut) { + if (std::abs(candidate.itsNSigmaKa()) < cfgnSigmaCutITSKa && clustersize > cfgAveClusSizeCoslMinKa && clustersize < cfgAveClusSizeCoslMaxKa) + return true; + } else { + return true; + } } } else if (onlyTOFHIT) { if (candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < cfgnSigmaCutTOFKa) { - return true; + if (openITSCut) { + if (std::abs(candidate.itsNSigmaKa()) < cfgnSigmaCutITSKa && clustersize > cfgAveClusSizeCoslMinKa && clustersize < cfgAveClusSizeCoslMaxKa) + return true; + } else { + return true; + } } if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < cfgnSigmaCutTPCPi) { - return true; + if (openITSCut) { + if (std::abs(candidate.itsNSigmaKa()) < cfgnSigmaCutITSKa && clustersize > cfgAveClusSizeCoslMinKa && clustersize < cfgAveClusSizeCoslMaxKa) + return true; + } else { + return true; + } } } else if (onlyTPC) { if (std::abs(candidate.tpcNSigmaKa()) < cfgnSigmaCutTPCPi) { - return true; + if (openITSCut) { + if (std::abs(candidate.itsNSigmaKa()) < cfgnSigmaCutITSKa && clustersize > cfgAveClusSizeCoslMinKa && clustersize < cfgAveClusSizeCoslMaxKa) + return true; + } else { + return true; + } } } else { if (candidate.hasTOF() && (candidate.tofNSigmaKa() * candidate.tofNSigmaKa() + candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa()) < (cfgnSigmaCutCombine * cfgnSigmaCutCombine)) { - return true; + if (openITSCut) { + if (std::abs(candidate.itsNSigmaKa()) < cfgnSigmaCutITSKa && clustersize > cfgAveClusSizeCoslMinKa && clustersize < cfgAveClusSizeCoslMaxKa) + return true; + } else { + return true; + } } if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < cfgnSigmaCutTPCPi) { - return true; + if (openITSCut) { + if (std::abs(candidate.itsNSigmaKa()) < cfgnSigmaCutITSKa && clustersize > cfgAveClusSizeCoslMinKa && clustersize < cfgAveClusSizeCoslMaxKa) + return true; + } else { + return true; + } } } } else if (PID == 2) { if (onlyTOF) { if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPr()) < cfgnSigmaCutTOFPr) { - return true; + if (openITSCut) { + if (std::abs(candidate.itsNSigmaPr()) < cfgnSigmaCutITSPr && clustersize > cfgAveClusSizeCoslMinPr && clustersize < cfgAveClusSizeCoslMaxPr) + return true; + } else { + return true; + } } } else if (onlyTOFHIT) { if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPr()) < cfgnSigmaCutTOFPr) { - return true; + if (openITSCut) { + if (std::abs(candidate.itsNSigmaPr()) < cfgnSigmaCutITSPr && clustersize > cfgAveClusSizeCoslMinPr && clustersize < cfgAveClusSizeCoslMaxPr) + return true; + } else { + return true; + } } if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPr()) < cfgnSigmaCutTPCPr) { - return true; + if (openITSCut) { + if (std::abs(candidate.itsNSigmaPr()) < cfgnSigmaCutITSPr && clustersize > cfgAveClusSizeCoslMinPr && clustersize < cfgAveClusSizeCoslMaxPr) + return true; + } else { + return true; + } } } else if (onlyTPC) { if (std::abs(candidate.tpcNSigmaPr()) < cfgnSigmaCutTPCPr) { - return true; + if (openITSCut) { + if (std::abs(candidate.itsNSigmaPr()) < cfgnSigmaCutITSPr && clustersize > cfgAveClusSizeCoslMinPr && clustersize < cfgAveClusSizeCoslMaxPr) + return true; + } else { + return true; + } } } else { if (candidate.hasTOF() && (candidate.tofNSigmaPr() * candidate.tofNSigmaPr() + candidate.tpcNSigmaPr() * candidate.tpcNSigmaPr()) < (cfgnSigmaCutCombine * cfgnSigmaCutCombine)) { - return true; + if (openITSCut) { + if (std::abs(candidate.itsNSigmaPr()) < cfgnSigmaCutITSPr && clustersize > cfgAveClusSizeCoslMinPr && clustersize < cfgAveClusSizeCoslMaxPr) + return true; + } else { + return true; + } } if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPr()) < cfgnSigmaCutTPCPr) { - return true; + if (openITSCut) { + if (std::abs(candidate.itsNSigmaPr()) < cfgnSigmaCutITSPr && clustersize > cfgAveClusSizeCoslMinPr && clustersize < cfgAveClusSizeCoslMaxPr) + return true; + } else { + return true; + } } } } @@ -194,33 +315,132 @@ struct FillPIDcolums { { AxisSpec axisRigidity{cfgrigidityBins, "#it{p}^{TPC}/#it{z}"}; AxisSpec axisdEdx{cfgdedxBins, "d#it{E}/d#it{x}"}; - AxisSpec axisnSigma{cfgnSigmaBins, "n_{#sigma}TPC"}; + AxisSpec axisnSigmaTPC{cfgnSigmaBins, "n_{#sigma}TPC"}; + AxisSpec axisnSigmaTOF{cfgnSigmaBins, "n_{#sigma}TOF"}; + AxisSpec axisnSigmaITS{cfgnSigmaBins, "n_{#sigma}TOF"}; + AxisSpec axisnSigmaCom{cfgnSigmaBinsCom, "hypot(n_{#sigma}TPC,TOF)"}; AxisSpec axisPtPID{cfgaxisptPID, "#it{p}_{T}"}; - + AxisSpec axisPPID{cfgaxispPID, "#it{p}"}; + AxisSpec axisClusterSize{cfgaxisAverClusterCosl, " x "}; + AxisSpec axisPhi = {100, 0, 2.1 * constants::math::PI, "#phi"}; + // TH3D NSigmaTPC,NSigmaTOF,pt + histosQA.add(Form("QA/PID/histnSigma_TPC_TOF_Pi"), "", {HistType::kTH3F, {axisnSigmaTPC, axisnSigmaTOF, axisPtPID}}); + histosQA.add(Form("QA/PID/histnSigma_TPC_TOF_Ka"), "", {HistType::kTH3F, {axisnSigmaTPC, axisnSigmaTOF, axisPtPID}}); + histosQA.add(Form("QA/PID/histnSigma_TPC_TOF_Pr"), "", {HistType::kTH3F, {axisnSigmaTPC, axisnSigmaTOF, axisPtPID}}); + histosQA.add(Form("QA/PID/histnSigma_TPC_TOF_cross_Pi"), "", {HistType::kTH3F, {axisnSigmaTPC, axisnSigmaTOF, axisPtPID}}); + histosQA.add(Form("QA/PID/histnSigma_TPC_TOF_cross_Ka"), "", {HistType::kTH3F, {axisnSigmaTPC, axisnSigmaTOF, axisPtPID}}); + histosQA.add(Form("QA/PID/histnSigma_TPC_TOF_cross_Pr"), "", {HistType::kTH3F, {axisnSigmaTPC, axisnSigmaTOF, axisPtPID}}); + // Hist for PID Averge Cluster Size + histosQA.add(Form("QA/PID/histAverClusterSizeCosl_Pi"), "", {HistType::kTH1F, {axisClusterSize}}); + histosQA.add(Form("QA/PID/histAverClusterSizeCosl_Ka"), "", {HistType::kTH1F, {axisClusterSize}}); + histosQA.add(Form("QA/PID/histAverClusterSizeCosl_Pr"), "", {HistType::kTH1F, {axisClusterSize}}); + histosQA.add(Form("QA/PID/histAverClusterSizeCosl_cross_Pi"), "", {HistType::kTH1F, {axisClusterSize}}); + histosQA.add(Form("QA/PID/histAverClusterSizeCosl_cross_Ka"), "", {HistType::kTH1F, {axisClusterSize}}); + histosQA.add(Form("QA/PID/histAverClusterSizeCosl_cross_Pr"), "", {HistType::kTH1F, {axisClusterSize}}); + histosQA.add(Form("QA/PID/histAverClusterSizeCosl_P_Pi"), "", {HistType::kTH2F, {axisPPID, axisClusterSize}}); + histosQA.add(Form("QA/PID/histAverClusterSizeCosl_P_Ka"), "", {HistType::kTH2F, {axisPPID, axisClusterSize}}); + histosQA.add(Form("QA/PID/histAverClusterSizeCosl_P_Pr"), "", {HistType::kTH2F, {axisPPID, axisClusterSize}}); + histosQA.add(Form("QA/PID/histAverClusterSizeCosl_P_cross_Pi"), "", {HistType::kTH2F, {axisPPID, axisClusterSize}}); + histosQA.add(Form("QA/PID/histAverClusterSizeCosl_P_cross_Ka"), "", {HistType::kTH2F, {axisPPID, axisClusterSize}}); + histosQA.add(Form("QA/PID/histAverClusterSizeCosl_P_cross_Pr"), "", {HistType::kTH2F, {axisPPID, axisClusterSize}}); + histosQA.add(Form("QA/PID/histAverClusterSizeCosl_nSigmaTPC_Pi"), "", {HistType::kTH2F, {axisnSigmaTPC, axisClusterSize}}); + histosQA.add(Form("QA/PID/histAverClusterSizeCosl_nSigmaTPC_Ka"), "", {HistType::kTH2F, {axisnSigmaTPC, axisClusterSize}}); + histosQA.add(Form("QA/PID/histAverClusterSizeCosl_nSigmaTPC_Pr"), "", {HistType::kTH2F, {axisnSigmaTPC, axisClusterSize}}); + histosQA.add(Form("QA/PID/histAverClusterSizeCosl_nSigmaTPC_cross_Pi"), "", {HistType::kTH2F, {axisnSigmaTPC, axisClusterSize}}); + histosQA.add(Form("QA/PID/histAverClusterSizeCosl_nSigmaTPC_cross_Ka"), "", {HistType::kTH2F, {axisnSigmaTPC, axisClusterSize}}); + histosQA.add(Form("QA/PID/histAverClusterSizeCosl_nSigmaTPC_cross_Pr"), "", {HistType::kTH2F, {axisnSigmaTPC, axisClusterSize}}); + // Hist for Nsigma TPC TOF histosQA.add(Form("QA/PID/histdEdxTPC_All"), "", {HistType::kTH2F, {axisRigidity, axisdEdx}}); histosQA.add(Form("QA/PID/histdEdxTPC_Pi"), "", {HistType::kTH2F, {axisRigidity, axisdEdx}}); - histosQA.add(Form("QA/PID/histnSigma_Pi"), "", {HistType::kTH1F, {axisnSigma}}); - histosQA.add(Form("QA/PID/histnSigma_Pt_Pi"), "", {HistType::kTH2F, {axisPtPID, axisnSigma}}); + histosQA.add(Form("QA/PID/histnSigma_Pi"), "", {HistType::kTH1F, {axisnSigmaTPC}}); + histosQA.add(Form("QA/PID/histnSigma_Pt_Pi"), "", {HistType::kTH2F, {axisPtPID, axisnSigmaTPC}}); histosQA.add(Form("QA/PID/histdEdxTPC_Ka"), "", {HistType::kTH2F, {axisRigidity, axisdEdx}}); - histosQA.add(Form("QA/PID/histnSigma_Ka"), "", {HistType::kTH1F, {axisnSigma}}); - histosQA.add(Form("QA/PID/histnSigma_Pt_Ka"), "", {HistType::kTH2F, {axisPtPID, axisnSigma}}); + histosQA.add(Form("QA/PID/histnSigma_Ka"), "", {HistType::kTH1F, {axisnSigmaTPC}}); + histosQA.add(Form("QA/PID/histnSigma_Pt_Ka"), "", {HistType::kTH2F, {axisPtPID, axisnSigmaTPC}}); histosQA.add(Form("QA/PID/histdEdxTPC_Pr"), "", {HistType::kTH2F, {axisRigidity, axisdEdx}}); - histosQA.add(Form("QA/PID/histnSigma_Pr"), "", {HistType::kTH1F, {axisnSigma}}); - histosQA.add(Form("QA/PID/histnSigma_Pt_Pr"), "", {HistType::kTH2F, {axisPtPID, axisnSigma}}); + histosQA.add(Form("QA/PID/histnSigma_Pr"), "", {HistType::kTH1F, {axisnSigmaTPC}}); + histosQA.add(Form("QA/PID/histnSigma_Pt_Pr"), "", {HistType::kTH2F, {axisPtPID, axisnSigmaTPC}}); + histosQA.add(Form("QA/PID/histnSigma_com_Pi"), "", {HistType::kTH1F, {axisnSigmaCom}}); + histosQA.add(Form("QA/PID/histnSigma_com_Ka"), "", {HistType::kTH1F, {axisnSigmaCom}}); + histosQA.add(Form("QA/PID/histnSigma_com_Pr"), "", {HistType::kTH1F, {axisnSigmaCom}}); + histosQA.add(Form("QA/PID/histnSigma_TOF_Pi"), "", {HistType::kTH1F, {axisnSigmaTOF}}); + histosQA.add(Form("QA/PID/histnSigma_TOF_Ka"), "", {HistType::kTH1F, {axisnSigmaTOF}}); + histosQA.add(Form("QA/PID/histnSigma_TOF_Pr"), "", {HistType::kTH1F, {axisnSigmaTOF}}); + histosQA.add(Form("QA/PID/histdEdxTPC_cross_Pi"), "", {HistType::kTH2F, {axisRigidity, axisdEdx}}); + histosQA.add(Form("QA/PID/histnSigma_cross_Pi"), "", {HistType::kTH1F, {axisnSigmaTPC}}); + histosQA.add(Form("QA/PID/histnSigma_Pt_cross_Pi"), "", {HistType::kTH2F, {axisPtPID, axisnSigmaTPC}}); + histosQA.add(Form("QA/PID/histdEdxTPC_cross_Ka"), "", {HistType::kTH2F, {axisRigidity, axisdEdx}}); + histosQA.add(Form("QA/PID/histnSigma_cross_Ka"), "", {HistType::kTH1F, {axisnSigmaTPC}}); + histosQA.add(Form("QA/PID/histnSigma_Pt_cross_Ka"), "", {HistType::kTH2F, {axisPtPID, axisnSigmaTPC}}); + histosQA.add(Form("QA/PID/histdEdxTPC_cross_Pr"), "", {HistType::kTH2F, {axisRigidity, axisdEdx}}); + histosQA.add(Form("QA/PID/histnSigma_cross_Pr"), "", {HistType::kTH1F, {axisnSigmaTPC}}); + histosQA.add(Form("QA/PID/histnSigma_Pt_cross_Pr"), "", {HistType::kTH2F, {axisPtPID, axisnSigmaTPC}}); + // Hist for nSigma ITS + histosQA.add(Form("QA/PID/histnSigma_ITS_Pi"), "", {HistType::kTH1F, {axisnSigmaITS}}); + histosQA.add(Form("QA/PID/histnSigma_ITS_Ka"), "", {HistType::kTH1F, {axisnSigmaITS}}); + histosQA.add(Form("QA/PID/histnSigma_ITS_Pr"), "", {HistType::kTH1F, {axisnSigmaITS}}); + histosQA.add(Form("QA/PID/histnSigma_ITS_cross_Pi"), "", {HistType::kTH1F, {axisnSigmaITS}}); + histosQA.add(Form("QA/PID/histnSigma_ITS_cross_Ka"), "", {HistType::kTH1F, {axisnSigmaITS}}); + histosQA.add(Form("QA/PID/histnSigma_ITS_cross_Pr"), "", {HistType::kTH1F, {axisnSigmaITS}}); + // Hist for checking the PID phi distribution + histosQA.add(Form("QA/PID/histPhi_Dis_Pi"), "", {HistType::kTH1F, {axisPhi}}); + histosQA.add(Form("QA/PID/histPhi_Dis_Ka"), "", {HistType::kTH1F, {axisPhi}}); + histosQA.add(Form("QA/PID/histPhi_Dis_Pr"), "", {HistType::kTH1F, {axisPhi}}); + histosQA.add(Form("QA/PID/histPhi_Dis_cross_Pi"), "", {HistType::kTH1F, {axisPhi}}); + histosQA.add(Form("QA/PID/histPhi_Dis_cross_Ka"), "", {HistType::kTH1F, {axisPhi}}); + histosQA.add(Form("QA/PID/histPhi_Dis_cross_Pr"), "", {HistType::kTH1F, {axisPhi}}); } Produces pidCmeTable; void process(TracksPID const& tracks) { + auto tracksWithITSPid = soa::Attach(tracks); int8_t pidFlag; - for (const auto& track : tracks) { + for (const auto& track : tracksWithITSPid) { + float averClusSizeCosl = averageClusterSizeCosl(track.itsClusterSizes(), track.eta()); if (!selTrackPid(track)) { pidFlag = -1; } else { + if (selectionPid(track, 0, averClusSizeCosl)) { + histosQA.fill(HIST("QA/PID/histnSigma_TPC_TOF_cross_Pi"), track.tpcNSigmaPi(), track.tofNSigmaPi(), track.pt()); + histosQA.fill(HIST("QA/PID/histdEdxTPC_cross_Pi"), track.sign() * track.tpcInnerParam(), track.tpcSignal()); + histosQA.fill(HIST("QA/PID/histnSigma_cross_Pi"), track.tpcNSigmaPi()); + histosQA.fill(HIST("QA/PID/histnSigma_Pt_cross_Pi"), track.pt(), track.tpcNSigmaPi()); + histosQA.fill(HIST("QA/PID/histnSigma_ITS_cross_Pi"), track.itsNSigmaPi()); + histosQA.fill(HIST("QA/PID/histAverClusterSizeCosl_cross_Pi"), averClusSizeCosl); + histosQA.fill(HIST("QA/PID/histAverClusterSizeCosl_P_cross_Pi"), track.p(), averClusSizeCosl); + histosQA.fill(HIST("QA/PID/histAverClusterSizeCosl_nSigmaTPC_cross_Pi"), track.tpcNSigmaPi(), averClusSizeCosl); + histosQA.fill(HIST("QA/PID/histPhi_Dis_cross_Pi"), track.phi()); + } + if (selectionPid(track, 1, averClusSizeCosl)) { + histosQA.fill(HIST("QA/PID/histnSigma_TPC_TOF_cross_Ka"), track.tpcNSigmaKa(), track.tofNSigmaKa(), track.pt()); + histosQA.fill(HIST("QA/PID/histdEdxTPC_cross_Ka"), track.sign() * track.tpcInnerParam(), track.tpcSignal()); + histosQA.fill(HIST("QA/PID/histnSigma_cross_Ka"), track.tpcNSigmaKa()); + histosQA.fill(HIST("QA/PID/histnSigma_Pt_cross_Ka"), track.pt(), track.tpcNSigmaKa()); + histosQA.fill(HIST("QA/PID/histnSigma_ITS_cross_Ka"), track.itsNSigmaKa()); + histosQA.fill(HIST("QA/PID/histAverClusterSizeCosl_cross_Ka"), averClusSizeCosl); + histosQA.fill(HIST("QA/PID/histAverClusterSizeCosl_P_cross_Ka"), track.p(), averClusSizeCosl); + histosQA.fill(HIST("QA/PID/histAverClusterSizeCosl_nSigmaTPC_cross_Ka"), track.tpcNSigmaKa(), averClusSizeCosl); + histosQA.fill(HIST("QA/PID/histPhi_Dis_cross_Ka"), track.phi()); + } + if (selectionPid(track, 2, averClusSizeCosl)) { + histosQA.fill(HIST("QA/PID/histnSigma_TPC_TOF_cross_Pr"), track.tpcNSigmaPr(), track.tofNSigmaPr(), track.pt()); + histosQA.fill(HIST("QA/PID/histdEdxTPC_cross_Pr"), track.sign() * track.tpcInnerParam(), track.tpcSignal()); + histosQA.fill(HIST("QA/PID/histnSigma_cross_Pr"), track.tpcNSigmaPr()); + histosQA.fill(HIST("QA/PID/histnSigma_Pt_cross_Pr"), track.pt(), track.tpcNSigmaPr()); + histosQA.fill(HIST("QA/PID/histnSigma_ITS_cross_Pr"), track.itsNSigmaPr()); + histosQA.fill(HIST("QA/PID/histAverClusterSizeCosl_cross_Pr"), averClusSizeCosl); + histosQA.fill(HIST("QA/PID/histAverClusterSizeCosl_P_cross_Pr"), track.p(), averClusSizeCosl); + histosQA.fill(HIST("QA/PID/histAverClusterSizeCosl_nSigmaTPC_cross_Pr"), track.tpcNSigmaKa(), averClusSizeCosl); + histosQA.fill(HIST("QA/PID/histPhi_Dis_cross_Pr"), track.phi()); + } histosQA.fill(HIST("QA/PID/histdEdxTPC_All"), track.sign() * track.tpcInnerParam(), track.tpcSignal()); float nSigmaArray[3] = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; pidFlag = 0; for (int8_t i = 0; i < 3; i++) { - if (selectionPid(track, i)) + if (selectionPid(track, i, averClusSizeCosl)) pidFlag = pidFlag * 10 + i + 1; if (pidFlag > 10) { // If a track is identified as two different tracks. if (std::abs(nSigmaArray[(pidFlag / 10) - 1]) < std::abs(nSigmaArray[(pidFlag % 10) - 1])) // The track is identified as the particle whose |nsigma| is the least. @@ -232,19 +452,43 @@ struct FillPIDcolums { switch (pidFlag) { case 1: + histosQA.fill(HIST("QA/PID/histnSigma_TPC_TOF_Pi"), track.tpcNSigmaPi(), track.tofNSigmaPi(), track.pt()); histosQA.fill(HIST("QA/PID/histdEdxTPC_Pi"), track.sign() * track.tpcInnerParam(), track.tpcSignal()); histosQA.fill(HIST("QA/PID/histnSigma_Pi"), track.tpcNSigmaPi()); histosQA.fill(HIST("QA/PID/histnSigma_Pt_Pi"), track.pt(), track.tpcNSigmaPi()); + histosQA.fill(HIST("QA/PID/histnSigma_com_Pi"), (track.tpcNSigmaPi() * track.tpcNSigmaPi() + track.tofNSigmaPi() * track.tofNSigmaPi())); + histosQA.fill(HIST("QA/PID/histnSigma_TOF_Pi"), track.tofNSigmaPi()); + histosQA.fill(HIST("QA/PID/histnSigma_ITS_Pi"), track.itsNSigmaPi()); + histosQA.fill(HIST("QA/PID/histAverClusterSizeCosl_Pi"), averClusSizeCosl); + histosQA.fill(HIST("QA/PID/histAverClusterSizeCosl_P_Pi"), track.p(), averClusSizeCosl); + histosQA.fill(HIST("QA/PID/histAverClusterSizeCosl_nSigmaTPC_Pi"), track.tpcNSigmaPi(), averClusSizeCosl); + histosQA.fill(HIST("QA/PID/histPhi_Dis_Pi"), track.phi()); break; case 2: + histosQA.fill(HIST("QA/PID/histnSigma_TPC_TOF_Ka"), track.tpcNSigmaKa(), track.tofNSigmaKa(), track.pt()); histosQA.fill(HIST("QA/PID/histdEdxTPC_Ka"), track.sign() * track.tpcInnerParam(), track.tpcSignal()); histosQA.fill(HIST("QA/PID/histnSigma_Ka"), track.tpcNSigmaKa()); histosQA.fill(HIST("QA/PID/histnSigma_Pt_Ka"), track.pt(), track.tpcNSigmaKa()); + histosQA.fill(HIST("QA/PID/histnSigma_com_Ka"), (track.tpcNSigmaKa() * track.tpcNSigmaKa() + track.tofNSigmaKa() * track.tofNSigmaKa())); + histosQA.fill(HIST("QA/PID/histnSigma_TOF_Ka"), track.tofNSigmaKa()); + histosQA.fill(HIST("QA/PID/histnSigma_ITS_Ka"), track.itsNSigmaKa()); + histosQA.fill(HIST("QA/PID/histAverClusterSizeCosl_Ka"), averClusSizeCosl); + histosQA.fill(HIST("QA/PID/histAverClusterSizeCosl_P_Ka"), track.p(), averClusSizeCosl); + histosQA.fill(HIST("QA/PID/histAverClusterSizeCosl_nSigmaTPC_Ka"), track.tpcNSigmaKa(), averClusSizeCosl); + histosQA.fill(HIST("QA/PID/histPhi_Dis_Ka"), track.phi()); break; case 3: + histosQA.fill(HIST("QA/PID/histnSigma_TPC_TOF_Pr"), track.tpcNSigmaPr(), track.tofNSigmaPr(), track.pt()); histosQA.fill(HIST("QA/PID/histdEdxTPC_Pr"), track.sign() * track.tpcInnerParam(), track.tpcSignal()); histosQA.fill(HIST("QA/PID/histnSigma_Pr"), track.tpcNSigmaPr()); histosQA.fill(HIST("QA/PID/histnSigma_Pt_Pr"), track.pt(), track.tpcNSigmaPr()); + histosQA.fill(HIST("QA/PID/histnSigma_com_Pr"), (track.tpcNSigmaPr() * track.tpcNSigmaPr() + track.tofNSigmaPr() * track.tofNSigmaPr())); + histosQA.fill(HIST("QA/PID/histnSigma_TOF_Pr"), track.tofNSigmaPr()); + histosQA.fill(HIST("QA/PID/histnSigma_ITS_Pr"), track.itsNSigmaPr()); + histosQA.fill(HIST("QA/PID/histAverClusterSizeCosl_Pr"), averClusSizeCosl); + histosQA.fill(HIST("QA/PID/histAverClusterSizeCosl_P_Pr"), track.p(), averClusSizeCosl); + histosQA.fill(HIST("QA/PID/histAverClusterSizeCosl_nSigmaTPC_Pr"), track.tpcNSigmaPr(), averClusSizeCosl); + histosQA.fill(HIST("QA/PID/histPhi_Dis_Pr"), track.phi()); break; } } @@ -280,6 +524,13 @@ struct pidcme { // o2-linter: disable=name/struct ConfigurableAxis cfgaxisdeltaeta{"cfgaxisdeltaeta", {5, 0, 1}, "Binning for #gamma and #delta |#eta(particle1 - particle2)|"}; Configurable cfgkOpeanCME{"cfgkOpeanCME", true, "open PID CME"}; + Configurable cfgkOpeanPiPi{"cfgkOpeanPiPi", true, "open Pi-Pi"}; + Configurable cfgkOpeanKaKa{"cfgkOpeanKaKa", false, "open Ka-Ka"}; + Configurable cfgkOpeanPrPr{"cfgkOpeanPrPr", false, "open Pr-Pr"}; + Configurable cfgkOpeanPiKa{"cfgkOpeanPiKa", true, "open Pi-Ka"}; + Configurable cfgkOpeanPiPr{"cfgkOpeanPiPr", true, "open Pi-Pr"}; + Configurable cfgkOpeanKaPr{"cfgkOpeanKaPr", true, "open Ka-Pr"}; + Configurable cfgkOpeanHaHa{"cfgkOpeanHaHa", false, "open Ha-Ha"}; EventPlaneHelper helperEP; SliceCache cache; @@ -378,57 +629,76 @@ struct pidcme { // o2-linter: disable=name/struct histosQA.add(Form("V2/PID/histCosDetV2_Pr_Neg"), "", {HistType::kTH3F, {axisCentMerged, axisPt, axisCos}}); if (cfgkOpeanCME) { - histosQA.add(Form("PIDCME/histgamama_PiKa_ss"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histgamama_PiKa_os"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histgamama_PiPr_ss"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histgamama_PiPr_os"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histgamama_KaPr_ss"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histgamama_KaPr_os"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histgamama_PiPi_ss"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histgamama_PiPi_os"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histgamama_KaKa_ss"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histgamama_KaKa_os"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histgamama_PrPr_ss"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histgamama_PrPr_os"), "", {HistType::kTProfile, {axisCentMerged}}); - - histosQA.add(Form("PIDCME/histdelta_PiKa_ss"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histdelta_PiKa_os"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histdelta_PiPr_ss"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histdelta_PiPr_os"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histdelta_KaPr_ss"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histdelta_KaPr_os"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histdelta_PiPi_ss"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histdelta_PiPi_os"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histdelta_KaKa_ss"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histdelta_KaKa_os"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histdelta_PrPr_ss"), "", {HistType::kTProfile, {axisCentMerged}}); - histosQA.add(Form("PIDCME/histdelta_PrPr_os"), "", {HistType::kTProfile, {axisCentMerged}}); - - histosQA.add(Form("PIDCME/Differential/histgamama_PiKa_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histgamama_PiKa_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histgamama_PiPr_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histgamama_PiPr_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histgamama_KaPr_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histgamama_KaPr_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histgamama_PiPi_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histgamama_PiPi_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histgamama_KaKa_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histgamama_KaKa_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histgamama_PrPr_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histgamama_PrPr_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - - histosQA.add(Form("PIDCME/Differential/histdelta_PiKa_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histdelta_PiKa_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histdelta_PiPr_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histdelta_PiPr_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histdelta_KaPr_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histdelta_KaPr_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histdelta_PiPi_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histdelta_PiPi_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histdelta_KaKa_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histdelta_KaKa_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histdelta_PrPr_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); - histosQA.add(Form("PIDCME/Differential/histdelta_PrPr_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + if (cfgkOpeanPiPi) { + histosQA.add(Form("PIDCME/histgamama_PiPi_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histgamama_PiPi_os"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_PiPi_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_PiPi_os"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/Differential/histgamama_PiPi_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histgamama_PiPi_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_PiPi_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_PiPi_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + } + if (cfgkOpeanKaKa) { + histosQA.add(Form("PIDCME/histgamama_KaKa_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histgamama_KaKa_os"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_KaKa_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_KaKa_os"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/Differential/histgamama_KaKa_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histgamama_KaKa_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_KaKa_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_KaKa_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + } + if (cfgkOpeanPrPr) { + histosQA.add(Form("PIDCME/histgamama_PrPr_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histgamama_PrPr_os"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_PrPr_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_PrPr_os"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/Differential/histgamama_PrPr_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histgamama_PrPr_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_PrPr_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_PrPr_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + } + if (cfgkOpeanPiKa) { + histosQA.add(Form("PIDCME/histgamama_PiKa_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histgamama_PiKa_os"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_PiKa_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_PiKa_os"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/Differential/histgamama_PiKa_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histgamama_PiKa_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_PiKa_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_PiKa_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + } + if (cfgkOpeanPiPr) { + histosQA.add(Form("PIDCME/histgamama_PiPr_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histgamama_PiPr_os"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_PiPr_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_PiPr_os"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/Differential/histgamama_PiPr_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histgamama_PiPr_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_PiPr_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_PiPr_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + } + if (cfgkOpeanKaPr) { + histosQA.add(Form("PIDCME/histgamama_KaPr_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histgamama_KaPr_os"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_KaPr_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_KaPr_os"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/Differential/histgamama_KaPr_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histgamama_KaPr_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_KaPr_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_KaPr_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + } + if (cfgkOpeanHaHa) { + histosQA.add(Form("PIDCME/histgamama_HaHa_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histgamama_HaHa_os"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_HaHa_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_HaHa_os"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/Differential/histgamama_HaHa_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histgamama_HaHa_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_HaHa_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_HaHa_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + } } } @@ -540,140 +810,152 @@ struct pidcme { // o2-linter: disable=name/struct } } if (cfgkOpeanCME) { - for (const auto& trk1 : track1) { - for (const auto& trk2 : track1) { - if (trk1.globalIndex() == trk2.globalIndex()) - continue; - if (nmode == 2) { - if (trk1.sign() == trk2.sign()) { - histosQA.fill(HIST("PIDCME/histgamama_PiPi_ss"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/histdelta_PiPi_ss"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); - histosQA.fill(HIST("PIDCME/Differential/histgamama_PiPi_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), - std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/Differential/histdelta_PiPi_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), - std::cos((trk1.phi() - trk2.phi()))); - } else { - histosQA.fill(HIST("PIDCME/histgamama_PiPi_os"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/histdelta_PiPi_os"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); - histosQA.fill(HIST("PIDCME/Differential/histgamama_PiPi_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), - std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/Differential/histdelta_PiPi_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), - std::cos((trk1.phi() - trk2.phi()))); + if (cfgkOpeanPiPi) { + for (const auto& trk1 : track1) { + for (const auto& trk2 : track1) { + if (trk1.globalIndex() == trk2.globalIndex()) + continue; + if (nmode == 2) { + if (trk1.sign() == trk2.sign()) { + histosQA.fill(HIST("PIDCME/histgamama_PiPi_ss"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/histdelta_PiPi_ss"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_PiPi_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_PiPi_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() - trk2.phi()))); + } else { + histosQA.fill(HIST("PIDCME/histgamama_PiPi_os"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/histdelta_PiPi_os"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_PiPi_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_PiPi_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() - trk2.phi()))); + } } } } } - for (const auto& trk1 : track2) { - for (const auto& trk2 : track2) { - if (trk1.globalIndex() == trk2.globalIndex()) - continue; - if (nmode == 2) { - if (trk1.sign() == trk2.sign()) { - histosQA.fill(HIST("PIDCME/histgamama_KaKa_ss"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/histdelta_KaKa_ss"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); - histosQA.fill(HIST("PIDCME/Differential/histgamama_KaKa_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), - std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/Differential/histdelta_KaKa_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), - std::cos((trk1.phi() - trk2.phi()))); - } else { - histosQA.fill(HIST("PIDCME/histgamama_KaKa_os"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/histdelta_KaKa_os"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); - histosQA.fill(HIST("PIDCME/Differential/histgamama_KaKa_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), - std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/Differential/histdelta_KaKa_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), - std::cos((trk1.phi() - trk2.phi()))); + if (cfgkOpeanKaKa) { + for (const auto& trk1 : track2) { + for (const auto& trk2 : track2) { + if (trk1.globalIndex() == trk2.globalIndex()) + continue; + if (nmode == 2) { + if (trk1.sign() == trk2.sign()) { + histosQA.fill(HIST("PIDCME/histgamama_KaKa_ss"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/histdelta_KaKa_ss"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_KaKa_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_KaKa_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() - trk2.phi()))); + } else { + histosQA.fill(HIST("PIDCME/histgamama_KaKa_os"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/histdelta_KaKa_os"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_KaKa_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_KaKa_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() - trk2.phi()))); + } } } } } - for (const auto& trk1 : track3) { - for (const auto& trk2 : track3) { - if (trk1.globalIndex() == trk2.globalIndex()) - continue; - if (nmode == 2) { - if (trk1.sign() == trk2.sign()) { - histosQA.fill(HIST("PIDCME/histgamama_PrPr_ss"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/histdelta_PrPr_ss"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); - histosQA.fill(HIST("PIDCME/Differential/histgamama_PrPr_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), - std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/Differential/histdelta_PrPr_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), - std::cos((trk1.phi() - trk2.phi()))); - } else { - histosQA.fill(HIST("PIDCME/histgamama_PrPr_os"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/histdelta_PrPr_os"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); - histosQA.fill(HIST("PIDCME/Differential/histgamama_PrPr_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), - std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/Differential/histdelta_PrPr_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), - std::cos((trk1.phi() - trk2.phi()))); + if (cfgkOpeanPrPr) { + for (const auto& trk1 : track3) { + for (const auto& trk2 : track3) { + if (trk1.globalIndex() == trk2.globalIndex()) + continue; + if (nmode == 2) { + if (trk1.sign() == trk2.sign()) { + histosQA.fill(HIST("PIDCME/histgamama_PrPr_ss"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/histdelta_PrPr_ss"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_PrPr_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_PrPr_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() - trk2.phi()))); + } else { + histosQA.fill(HIST("PIDCME/histgamama_PrPr_os"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/histdelta_PrPr_os"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_PrPr_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_PrPr_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() - trk2.phi()))); + } } } } } - for (const auto& trk1 : track1) { - for (const auto& trk2 : track2) { - if (trk1.globalIndex() == trk2.globalIndex()) - continue; - if (nmode == 2) { - if (trk1.sign() == trk2.sign()) { - histosQA.fill(HIST("PIDCME/histgamama_PiKa_ss"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/histdelta_PiKa_ss"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); - histosQA.fill(HIST("PIDCME/Differential/histgamama_PiKa_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), - std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/Differential/histdelta_PiKa_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), - std::cos((trk1.phi() - trk2.phi()))); - } else { - histosQA.fill(HIST("PIDCME/histgamama_PiKa_os"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/histdelta_PiKa_os"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); - histosQA.fill(HIST("PIDCME/Differential/histgamama_PiKa_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), - std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/Differential/histdelta_PiKa_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), - std::cos((trk1.phi() - trk2.phi()))); + if (cfgkOpeanPiKa) { + for (const auto& trk1 : track1) { + for (const auto& trk2 : track2) { + if (trk1.globalIndex() == trk2.globalIndex()) + continue; + if (nmode == 2) { + if (trk1.sign() == trk2.sign()) { + histosQA.fill(HIST("PIDCME/histgamama_PiKa_ss"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/histdelta_PiKa_ss"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_PiKa_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_PiKa_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() - trk2.phi()))); + } else { + histosQA.fill(HIST("PIDCME/histgamama_PiKa_os"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/histdelta_PiKa_os"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_PiKa_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_PiKa_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() - trk2.phi()))); + } } } } } - for (const auto& trk1 : track1) { - for (const auto& trk3 : track3) { - if (trk1.globalIndex() == trk3.globalIndex()) - continue; - if (nmode == 2) { - if (trk1.sign() == trk3.sign()) { - histosQA.fill(HIST("PIDCME/histgamama_PiPr_ss"), collision.centFT0C(), std::cos((trk1.phi() + trk3.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/histdelta_PiPr_ss"), collision.centFT0C(), std::cos((trk1.phi() - trk3.phi()))); - histosQA.fill(HIST("PIDCME/Differential/histgamama_PiPr_ss_Dif"), collision.centFT0C(), trk1.pt() + trk3.pt(), std::abs(trk1.eta() - trk3.eta()), - std::cos((trk1.phi() + trk3.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/Differential/histdelta_PiPr_ss_Dif"), collision.centFT0C(), trk1.pt() + trk3.pt(), std::abs(trk1.eta() - trk3.eta()), - std::cos((trk1.phi() - trk3.phi()))); - } else { - histosQA.fill(HIST("PIDCME/histgamama_PiPr_os"), collision.centFT0C(), std::cos((trk1.phi() + trk3.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/histdelta_PiPr_os"), collision.centFT0C(), std::cos((trk1.phi() - trk3.phi()))); - histosQA.fill(HIST("PIDCME/Differential/histgamama_PiPr_os_Dif"), collision.centFT0C(), trk1.pt() + trk3.pt(), std::abs(trk1.eta() - trk3.eta()), - std::cos((trk1.phi() + trk3.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/Differential/histdelta_PiPr_os_Dif"), collision.centFT0C(), trk1.pt() + trk3.pt(), std::abs(trk1.eta() - trk3.eta()), - std::cos((trk1.phi() - trk3.phi()))); + if (cfgkOpeanPiPr) { + for (const auto& trk1 : track1) { + for (const auto& trk3 : track3) { + if (trk1.globalIndex() == trk3.globalIndex()) + continue; + if (nmode == 2) { + if (trk1.sign() == trk3.sign()) { + histosQA.fill(HIST("PIDCME/histgamama_PiPr_ss"), collision.centFT0C(), std::cos((trk1.phi() + trk3.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/histdelta_PiPr_ss"), collision.centFT0C(), std::cos((trk1.phi() - trk3.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_PiPr_ss_Dif"), collision.centFT0C(), trk1.pt() + trk3.pt(), std::abs(trk1.eta() - trk3.eta()), + std::cos((trk1.phi() + trk3.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_PiPr_ss_Dif"), collision.centFT0C(), trk1.pt() + trk3.pt(), std::abs(trk1.eta() - trk3.eta()), + std::cos((trk1.phi() - trk3.phi()))); + } else { + histosQA.fill(HIST("PIDCME/histgamama_PiPr_os"), collision.centFT0C(), std::cos((trk1.phi() + trk3.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/histdelta_PiPr_os"), collision.centFT0C(), std::cos((trk1.phi() - trk3.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_PiPr_os_Dif"), collision.centFT0C(), trk1.pt() + trk3.pt(), std::abs(trk1.eta() - trk3.eta()), + std::cos((trk1.phi() + trk3.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_PiPr_os_Dif"), collision.centFT0C(), trk1.pt() + trk3.pt(), std::abs(trk1.eta() - trk3.eta()), + std::cos((trk1.phi() - trk3.phi()))); + } } } } } - for (const auto& trk2 : track2) { - for (const auto& trk3 : track3) { - if (trk2.globalIndex() == trk3.globalIndex()) - continue; - if (nmode == 2) { - if (trk2.sign() == trk3.sign()) { - histosQA.fill(HIST("PIDCME/histgamama_KaPr_ss"), collision.centFT0C(), std::cos((trk2.phi() + trk3.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/histdelta_KaPr_ss"), collision.centFT0C(), std::cos((trk2.phi() - trk3.phi()))); - histosQA.fill(HIST("PIDCME/Differential/histgamama_KaPr_ss_Dif"), collision.centFT0C(), trk2.pt() + trk3.pt(), std::abs(trk2.eta() - trk3.eta()), - std::cos((trk2.phi() + trk3.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/Differential/histdelta_KaPr_ss_Dif"), collision.centFT0C(), trk2.pt() + trk3.pt(), std::abs(trk2.eta() - trk3.eta()), - std::cos((trk2.phi() - trk3.phi()))); - } else { - histosQA.fill(HIST("PIDCME/histgamama_KaPr_os"), collision.centFT0C(), std::cos((trk2.phi() + trk3.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/histdelta_KaPr_os"), collision.centFT0C(), std::cos((trk2.phi() - trk3.phi()))); - histosQA.fill(HIST("PIDCME/Differential/histgamama_KaPr_os_Dif"), collision.centFT0C(), trk2.pt() + trk3.pt(), std::abs(trk2.eta() - trk3.eta()), - std::cos((trk2.phi() + trk3.phi() - static_cast(nmode) * psiN))); - histosQA.fill(HIST("PIDCME/Differential/histdelta_KaPr_os_Dif"), collision.centFT0C(), trk2.pt() + trk3.pt(), std::abs(trk2.eta() - trk3.eta()), - std::cos((trk2.phi() - trk3.phi()))); + if (cfgkOpeanKaPr) { + for (const auto& trk2 : track2) { + for (const auto& trk3 : track3) { + if (trk2.globalIndex() == trk3.globalIndex()) + continue; + if (nmode == 2) { + if (trk2.sign() == trk3.sign()) { + histosQA.fill(HIST("PIDCME/histgamama_KaPr_ss"), collision.centFT0C(), std::cos((trk2.phi() + trk3.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/histdelta_KaPr_ss"), collision.centFT0C(), std::cos((trk2.phi() - trk3.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_KaPr_ss_Dif"), collision.centFT0C(), trk2.pt() + trk3.pt(), std::abs(trk2.eta() - trk3.eta()), + std::cos((trk2.phi() + trk3.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_KaPr_ss_Dif"), collision.centFT0C(), trk2.pt() + trk3.pt(), std::abs(trk2.eta() - trk3.eta()), + std::cos((trk2.phi() - trk3.phi()))); + } else { + histosQA.fill(HIST("PIDCME/histgamama_KaPr_os"), collision.centFT0C(), std::cos((trk2.phi() + trk3.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/histdelta_KaPr_os"), collision.centFT0C(), std::cos((trk2.phi() - trk3.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_KaPr_os_Dif"), collision.centFT0C(), trk2.pt() + trk3.pt(), std::abs(trk2.eta() - trk3.eta()), + std::cos((trk2.phi() + trk3.phi() - static_cast(nmode) * psiN))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_KaPr_os_Dif"), collision.centFT0C(), trk2.pt() + trk3.pt(), std::abs(trk2.eta() - trk3.eta()), + std::cos((trk2.phi() - trk3.phi()))); + } } } } @@ -709,6 +991,29 @@ struct pidcme { // o2-linter: disable=name/struct histosQA.fill(HIST("V2/histCosDetV2"), collision.centFT0C(), trk.pt(), std::cos(static_cast(cfgnMods->at(i)) * (trk.phi() - psiNGlobal))); } + if (cfgkOpeanCME && cfgkOpeanHaHa && cfgnMods->at(i) == 2) { + for (const auto& trk1 : tracks) { + for (const auto& trk2 : tracks) { + if (trk1.globalIndex() == trk2.globalIndex()) + continue; + if (trk1.sign() == trk2.sign()) { + histosQA.fill(HIST("PIDCME/histgamama_HaHa_ss"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(cfgnMods->at(i)) * psiNGlobal))); + histosQA.fill(HIST("PIDCME/histdelta_HaHa_ss"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_HaHa_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() + trk2.phi() - static_cast(cfgnMods->at(i)) * psiNGlobal))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_HaHa_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() - trk2.phi()))); + } else { + histosQA.fill(HIST("PIDCME/histgamama_HaHa_os"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(cfgnMods->at(i)) * psiNGlobal))); + histosQA.fill(HIST("PIDCME/histdelta_HaHa_os"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_HaHa_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() + trk2.phi() - static_cast(cfgnMods->at(i)) * psiNGlobal))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_HaHa_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() - trk2.phi()))); + } + } + } + } fillHistosQvec(collision, cfgnMods->at(i)); fillHistosFlowGammaDelta(collision, tracks1, tracks2, tracks3, cfgnMods->at(i)); } diff --git a/PWGCF/GenericFramework/Core/CMakeLists.txt b/PWGCF/GenericFramework/Core/CMakeLists.txt index b7e0a916db0..c82c4a5c751 100755 --- a/PWGCF/GenericFramework/Core/CMakeLists.txt +++ b/PWGCF/GenericFramework/Core/CMakeLists.txt @@ -16,6 +16,7 @@ o2physics_add_library(GFWCore ProfileSubset.cxx FlowContainer.cxx GFWWeights.cxx + GFWWeightsList.cxx FlowPtContainer.cxx BootstrapProfile.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore) @@ -27,6 +28,7 @@ o2physics_target_root_dictionary(GFWCore ProfileSubset.h FlowContainer.h GFWWeights.h + GFWWeightsList.h GFWConfig.h FlowPtContainer.h BootstrapProfile.h diff --git a/PWGCF/GenericFramework/Core/GFWWeightsList.cxx b/PWGCF/GenericFramework/Core/GFWWeightsList.cxx new file mode 100644 index 00000000000..90ac95d0f0d --- /dev/null +++ b/PWGCF/GenericFramework/Core/GFWWeightsList.cxx @@ -0,0 +1,87 @@ +// 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 GFWWeightsList.cxx +/// \author Zhiyong Lu (zhiyong.lu@cern.ch) +/// \since Dec/25/2024 +/// \brief one object to hold a list of GFWWeights objects, + +#include +#include +#include "GFWWeightsList.h" + +GFWWeightsList::GFWWeightsList() : TNamed("", ""), list(0) +{ + runNumerMap.clear(); +} + +GFWWeightsList::GFWWeightsList(const char* name) : TNamed(name, name), list(0) +{ + runNumerMap.clear(); +} + +GFWWeightsList::~GFWWeightsList() +{ + delete list; + runNumerMap.clear(); +} + +void GFWWeightsList::init(const char* listName) +{ + list = new TObjArray(); + list->SetName(listName); + list->SetOwner(kTRUE); +} + +void GFWWeightsList::addGFWWeightsByName(const char* weightName, int nPtBins, double* ptBins, bool addData, bool addMC) +{ + if (!list) { + init("weightList"); + } + GFWWeights* weight = new GFWWeights(weightName); + weight->SetPtBins(nPtBins, ptBins); + weight->Init(addData, addMC); + list->Add(weight); +} + +GFWWeights* GFWWeightsList::getGFWWeightsByName(const char* weightName) +{ + if (!list) { + printf("Error: weight list is not initialized\n"); + return nullptr; + } + return reinterpret_cast(list->FindObject(weightName)); +} + +void GFWWeightsList::addGFWWeightsByRun(int runNumber, int nPtBins, double* ptBins, bool addData, bool addMC) +{ + if (!list) { + init("weightList"); + } + GFWWeights* weight = new GFWWeights(Form("weight_%d", runNumber)); + weight->SetPtBins(nPtBins, ptBins); + weight->Init(addData, addMC); + list->Add(weight); + runNumerMap.insert(std::make_pair(runNumber, weight)); +} + +GFWWeights* GFWWeightsList::getGFWWeightsByRun(int runNumber) +{ + if (!list) { + printf("Error: weight list is not initialized\n"); + return nullptr; + } + if (!runNumerMap.contains(runNumber)) { + printf("Error: weight for run %d is not found\n", runNumber); + return nullptr; + } + return runNumerMap.at(runNumber); +} diff --git a/PWGCF/GenericFramework/Core/GFWWeightsList.h b/PWGCF/GenericFramework/Core/GFWWeightsList.h new file mode 100644 index 00000000000..278a6e4edc6 --- /dev/null +++ b/PWGCF/GenericFramework/Core/GFWWeightsList.h @@ -0,0 +1,43 @@ +// 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 GFWWeightsList.h +/// \author Zhiyong Lu (zhiyong.lu@cern.ch) +/// \since Dec/25/2024 +/// \brief one object to hold a list of GFWWeights objects, + +#ifndef PWGCF_GENERICFRAMEWORK_CORE_GFWWEIGHTSLIST_H_ +#define PWGCF_GENERICFRAMEWORK_CORE_GFWWEIGHTSLIST_H_ +#include +#include "TObjArray.h" +#include "GFWWeights.h" + +class GFWWeightsList : public TNamed +{ + public: + GFWWeightsList(); + explicit GFWWeightsList(const char* name); + ~GFWWeightsList(); + void init(const char* listName); + void addGFWWeightsByName(const char* weightName, int nPtBins, double* ptBins, bool addData = kTRUE, bool addMC = kTRUE); + GFWWeights* getGFWWeightsByName(const char* weightName); + void addGFWWeightsByRun(int runNumber, int nPtBins, double* ptBins, bool addData = kTRUE, bool addMC = kTRUE); + GFWWeights* getGFWWeightsByRun(int runNumber); + TObjArray* getList() const { return list; } + + private: + TObjArray* list; + std::map runNumerMap; + + ClassDef(GFWWeightsList, 1); +}; + +#endif // PWGCF_GENERICFRAMEWORK_CORE_GFWWEIGHTSLIST_H_ diff --git a/PWGCF/GenericFramework/Core/GenericFrameworkLinkDef.h b/PWGCF/GenericFramework/Core/GenericFrameworkLinkDef.h index 2279a79b473..3fea9523064 100755 --- a/PWGCF/GenericFramework/Core/GenericFrameworkLinkDef.h +++ b/PWGCF/GenericFramework/Core/GenericFrameworkLinkDef.h @@ -22,6 +22,7 @@ #pragma link C++ class ProfileSubset + ; #pragma link C++ class FlowContainer + ; #pragma link C++ class GFWWeights + ; +#pragma link C++ class GFWWeightsList + ; #pragma link C++ class BootstrapProfile + ; #pragma link C++ class FlowPtContainer + ; #pragma link C++ class o2::analysis::genericframework::GFWBinningCuts + ; diff --git a/PWGDQ/Core/HistogramsLibrary.cxx b/PWGDQ/Core/HistogramsLibrary.cxx index 1b08b6c0a60..528ca299c81 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -279,6 +279,7 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "centrFT0C_M11REF_ev", "", true, 100, 0.0, 100.0, VarManager::kCentFT0C, 1000, 0.0, 1000000.0, VarManager::kM11REF); hm->AddHistogram(histClass, "centrFT0C_M11etagap_ev", "", true, 100, 0.0, 100.0, VarManager::kCentFT0C, 1000, 0.0, 10000000.0, VarManager::kM11REFetagap); hm->AddHistogram(histClass, "centrFT0C_M1111REF_ev", "", true, 100, 0.0, 100.0, VarManager::kCentFT0C, 1000, 0.0, 100000000000000.0, VarManager::kM1111REF); + hm->AddHistogram(histClass, "centrFT0C_M11M1111REF_ev", "", true, 100, 0.0, 100.0, VarManager::kCentFT0C, 1000, 0.0, 10000000000000000.0, VarManager::kM11M1111REF); if (subGroupStr.Contains("cross")) { hm->AddHistogram(histClass, "Q1ZNACXX_CentFT0C", "", false, 90, 0.0, 90.0, VarManager::kCentFT0C, 4000, -2, 2, VarManager::kQ1ZNACXX); hm->AddHistogram(histClass, "Q1ZNACYY_CentFT0C", "", false, 90, 0.0, 90.0, VarManager::kCentFT0C, 4000, -2, 2, VarManager::kQ1ZNACYY); @@ -1237,11 +1238,29 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h int bins[4] = {250, 60, 6, 18}; double minBins[4] = {0.0, 0.0, 2.5, 0.0}; double maxBins[4] = {5.0, 30.0, 4.0, 90.0}; + hm->AddHistogram(histClass, "centrFT0C_M11REFoverMp_ev", "", true, 100, 0.0, 100.0, VarManager::kCentFT0C, 1000, 0.0, 1000000.0, VarManager::kM11REFoverMp); + hm->AddHistogram(histClass, "centrFT0C_M1111REFoverMp_ev", "", true, 100, 0.0, 100.0, VarManager::kCentFT0C, 1000, 0.0, 100000000000000.0, VarManager::kM1111REFoverMp); + hm->AddHistogram(histClass, "centrFT0C_M11M1111REFoverMp_ev", "", true, 100, 0.0, 100.0, VarManager::kCentFT0C, 1000, 0.0, 10000000000000000.0, VarManager::kM11M1111REFoverMp); + hm->AddHistogram(histClass, "centrFT0C_Corr2REF_ev", "", true, 100, 0.0, 100.0, VarManager::kCentFT0C, 250, -1.0, 1.0, VarManager::kCORR2REFbydimuons, VarManager::kM11REFoverMp); + hm->AddHistogram(histClass, "centrFT0C_Corr4REF_ev", "", true, 100, 0.0, 100.0, VarManager::kCentFT0C, 250, -1.0, 1.0, VarManager::kCORR4REFbydimuons, VarManager::kM1111REFoverMp); + hm->AddHistogram(histClass, "centrFT0C_Corr2Corr4REF_ev", "", true, 100, 0.0, 100.0, VarManager::kCentFT0C, 250, -1.0, 1.0, VarManager::kCORR2CORR4REF, VarManager::kM11M1111REFoverMp); + hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_M11REFoverMp", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kM11REFoverMp); + hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_M1111REFoverMp", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kM1111REFoverMp); + hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_M01POIoverMp", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kM11REFoverMp); + hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_M0111POIoverMp", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kM1111REFoverMp); + hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_M11M1111REFoverMp", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kM11M1111REFoverMp); + hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_M01M0111overMp", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kM01M0111overMp); + hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_M11M0111overMp", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kM11M0111overMp); + hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_M11M01REFoverMp", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kM11M01overMp); hm->AddHistogram(histClass, "Mass_Pt_Rapidity_CentFT0C", "", 4, var, bins, minBins, maxBins, 0, -1, kTRUE); - hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_Corr2REF", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kCORR2REF, VarManager::kM11REFoverMp); - hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_Corr4REF", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kCORR4REF, VarManager::kM1111REFoverMp); - hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_Corr2POI", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kCORR2POIMp, VarManager::kM01POIoverMp); - hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_Corr4POI", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kCORR4POIMp, VarManager::kM0111POIoverMp); + hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_Corr2REF", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kCORR2REFbydimuons, VarManager::kM11REFoverMp); + hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_Corr4REF", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kCORR4REFbydimuons, VarManager::kM1111REFoverMp); + hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_Corr2POI", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kCORR2POI, VarManager::kM01POIoverMp); + hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_Corr4POI", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kCORR4POI, VarManager::kM0111POIoverMp); + hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_Corr2REFCorr4REF", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kCORR2CORR4REF, VarManager::kM11M1111REFoverMp); + hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_Corr2POICorr4POI", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kCORR2POICORR4POI, VarManager::kM01M0111overMp); + hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_Corr2REFCorr4POI", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kCORR2REFCORR4POI, VarManager::kM11M0111overMp); + hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_Corr2REFCorr2POI", "", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 18, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kCORR2REFCORR2POI, VarManager::kM11M01overMp); } if (subGroupStr.Contains("res-flow-dimuon")) { int varV2[6] = {VarManager::kMass, VarManager::kPt, VarManager::kRap, VarManager::kCentFT0C, VarManager::kR2SP_AB, VarManager::kR2EP_AB}; diff --git a/PWGDQ/Core/VarManager.cxx b/PWGDQ/Core/VarManager.cxx index 91315f7069c..e9a9b6f0e4f 100644 --- a/PWGDQ/Core/VarManager.cxx +++ b/PWGDQ/Core/VarManager.cxx @@ -792,20 +792,40 @@ void VarManager::SetDefaultVarNames() fgVariableUnits[kM01POI] = ""; fgVariableNames[kM1111REF] = "M_{1111}^{REF} "; fgVariableUnits[kM1111REF] = ""; - fgVariableNames[kM11M1111REF] = "M_{11}_{REF}M_{1111}_{REF} "; + fgVariableNames[kM11M1111REF] = "M_{11}_{REF}M_{1111}_{REF}"; fgVariableUnits[kM11M1111REF] = ""; + fgVariableNames[kM11M1111REFoverMp] = "M_{11}_{REF}M_{1111}_{REF} / M_{p} "; + fgVariableUnits[kM11M1111REFoverMp] = ""; + fgVariableNames[kM01M0111POIoverMp] = "M_{01}_{POI}M_{0111}_{POI} / M_{p}"; + fgVariableUnits[kM01M0111POIoverMp] = ""; fgVariableNames[kCORR2CORR4REF] = "<2><4>"; fgVariableUnits[kCORR2CORR4REF] = ""; + fgVariableNames[kCORR2POICORR4POI] = "<2'><4'>"; + fgVariableUnits[kCORR2POICORR4POI] = ""; + fgVariableNames[kCORR2REFCORR4POI] = "<2><4'>"; + fgVariableUnits[kCORR2REFCORR4POI] = ""; + fgVariableNames[kCORR2REFCORR2POI] = "<2><2'>"; + fgVariableUnits[kCORR2REFCORR2POI] = ""; + fgVariableNames[kM01M0111overMp] = "M_{01}_{POI} M_{0111}_{POI} / M_{p} "; + fgVariableUnits[kM01M0111overMp] = ""; + fgVariableNames[kM11M0111overMp] = "M_{11}_{REF}M_{0111}_{POI} / M_{p} "; + fgVariableUnits[kM11M0111overMp] = ""; + fgVariableNames[kM11M01overMp] = "M_{11}_{REF}M_{01}_{POI} / M_{p} "; + fgVariableUnits[kM11M01overMp] = ""; fgVariableNames[kM0111POI] = "M^{'}_{0111}^{POI} "; fgVariableUnits[kM0111POI] = ""; fgVariableNames[kCORR2REF] = "<2> "; fgVariableUnits[kCORR2REF] = ""; + fgVariableNames[kCORR2REFbydimuons] = "<2> only for events with dimuons"; + fgVariableUnits[kCORR2REFbydimuons] = ""; fgVariableNames[kCORR2REFetagap] = "<2-etagap> "; fgVariableUnits[kCORR2REFetagap] = ""; fgVariableNames[kCORR2POI] = "<2'> "; fgVariableUnits[kCORR2POI] = ""; fgVariableNames[kCORR4REF] = "<4> "; fgVariableUnits[kCORR4REF] = ""; + fgVariableNames[kCORR4REFbydimuons] = "<4> only for events with dimuons"; + fgVariableUnits[kCORR4REFbydimuons] = ""; fgVariableNames[kCORR4POI] = "<4'> "; fgVariableUnits[kCORR4POI] = ""; fgVariableNames[kM11REFoverMp] = "M_{11}^{REF}/M_{p} "; diff --git a/PWGDQ/Core/VarManager.h b/PWGDQ/Core/VarManager.h index 02a7ffa4929..4a1ba8b0268 100644 --- a/PWGDQ/Core/VarManager.h +++ b/PWGDQ/Core/VarManager.h @@ -658,12 +658,22 @@ class VarManager : public TObject kM01POI, kM1111REF, kM11M1111REF, - kCORR2CORR4REF, + kM11M1111REFoverMp, + kM01M0111POIoverMp, kM0111POI, kCORR2REF, + kCORR2REFbydimuons, kCORR2REFetagap, kCORR2POI, + kCORR2POICORR4POI, + kCORR2REFCORR4POI, + kCORR2REFCORR2POI, + kM01M0111overMp, + kM11M0111overMp, + kM11M01overMp, + kCORR2CORR4REF, kCORR4REF, + kCORR4REFbydimuons, kCORR4POI, kM11REFoverMp, kM01POIoverMp, @@ -1655,15 +1665,15 @@ void VarManager::FillEvent(T const& event, float* values) } if constexpr ((fillMap & ReducedEventRefFlow) > 0) { - values[kM1111REF] = event.m1111ref(); - values[kM11REF] = event.m11ref(); - values[kM11REFetagap] = event.m11refetagap(); - values[kM11M1111REF] = event.m11ref() * event.m1111ref(); - values[kCORR2REF] = event.corr2ref(); - values[kCORR2REFetagap] = event.corr2refetagap(); - values[kCORR4REF] = event.corr4ref(); - values[kCORR2CORR4REF] = event.corr2ref() * event.corr4ref(); values[kMultA] = event.multa(); + values[kCORR2REFetagap] = event.corr2refetagap(); + values[kM11REFetagap] = event.m11refetagap(); + values[kCORR2REF] = std::isnan(values[kM11REF]) || std::isinf(values[kM11REF]) || std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF]) || std::isnan(values[kM1111REF]) || std::isinf(values[kM1111REF]) || std::isnan(values[kCORR4REF]) || std::isinf(values[kCORR4REF]) ? 0 : event.corr2ref(); + values[kCORR4REF] = std::isnan(values[kM1111REF]) || std::isinf(values[kM1111REF]) || std::isnan(values[kCORR4REF]) || std::isinf(values[kCORR4REF]) || std::isnan(values[kM11REF]) || std::isinf(values[kM11REF]) || std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF]) ? 0 : event.corr4ref(); + values[kCORR2CORR4REF] = std::isnan(values[kM11M1111REF]) || std::isinf(values[kM11M1111REF]) || std::isnan(values[kCORR2CORR4REF]) || std::isinf(values[kCORR2CORR4REF]) ? 0 : event.corr2ref() * event.corr4ref(); + values[kM11REF] = !(std::isnan(values[kM11REF]) || std::isinf(values[kM11REF]) || std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF]) || std::isnan(values[kM1111REF]) || std::isinf(values[kM1111REF]) || std::isnan(values[kCORR4REF]) || std::isinf(values[kCORR4REF])) ? event.m11ref() : 0; + values[kM1111REF] = !(std::isnan(values[kM1111REF]) || std::isinf(values[kM1111REF]) || std::isnan(values[kCORR4REF]) || std::isinf(values[kCORR4REF]) || std::isnan(values[kM11REF]) || std::isinf(values[kM11REF]) || std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF])) ? event.m1111ref() : 0; + values[kM11M1111REF] = !(std::isnan(values[kM11M1111REF]) || std::isinf(values[kM11M1111REF]) || std::isnan(values[kCORR2CORR4REF]) || std::isinf(values[kCORR2CORR4REF])) ? event.m11ref() * event.m1111ref() : 0; } } @@ -4352,14 +4362,22 @@ void VarManager::FillPairVn(T1 const& t1, T2 const& t2, float* values) values[kM0111POI] = values[kMultDimuons] * (values[kS31A] - 3. * values[kS11A] * values[kS12A] + 2. * values[kS13A]); values[kCORR2POI] = (P2 * conj(Q21)).real() / values[kM01POI]; values[kCORR4POI] = (P2 * Q21 * conj(Q21) * conj(Q21) - P2 * Q21 * conj(Q42) - 2. * values[kS12A] * P2 * conj(Q21) + 2. * P2 * conj(Q23)).real() / values[kM0111POI]; - values[kM01POIoverMp] = values[kMultDimuons] > 0 && !(std::isnan(values[kM01POI]) || std::isinf(values[kM01POI]) || std::isnan(values[kCORR2POI]) || std::isinf(values[kCORR2POI])) ? values[kM01POI] / values[kMultDimuons] : 0; - values[kM0111POIoverMp] = values[kMultDimuons] > 0 && !(std::isnan(values[kM0111POI]) || std::isinf(values[kM0111POI]) || std::isnan(values[kCORR4POI]) || std::isinf(values[kCORR4POI])) ? values[kM0111POI] / values[kMultDimuons] : 0; - values[kM11REFoverMp] = values[kMultDimuons] > 0 && !(std::isnan(values[kM11REF]) || std::isinf(values[kM11REF]) || std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF])) ? values[kM11REF] / values[kMultDimuons] : 0; - values[kM1111REFoverMp] = values[kMultDimuons] > 0 && !(std::isnan(values[kM1111REF]) || std::isinf(values[kM1111REF]) || std::isnan(values[kCORR4REF]) || std::isinf(values[kCORR4REF])) ? values[kM1111REF] / values[kMultDimuons] : 0; - values[kCORR2POIMp] = std::isnan(values[kCORR2POI]) || std::isinf(values[kCORR2POI]) || std::isnan(values[kM01POI]) || std::isinf(values[kM01POI]) ? 0 : values[kCORR2POI] * values[kMultDimuons]; - values[kCORR4POIMp] = std::isnan(values[kCORR4POI]) || std::isinf(values[kCORR4POI]) || std::isnan(values[kM0111POI]) || std::isinf(values[kM0111POI]) ? 0 : values[kCORR4POI] * values[kMultDimuons]; - values[kCORR2REF] = std::isnan(values[kM11REFoverMp]) || std::isinf(values[kM11REFoverMp]) || std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF]) ? 0 : values[kCORR2REF]; - values[kCORR4REF] = std::isnan(values[kM1111REFoverMp]) || std::isinf(values[kM1111REFoverMp]) || std::isnan(values[kCORR4REF]) || std::isinf(values[kCORR4REF]) ? 0 : values[kCORR4REF]; + values[kM01POIoverMp] = values[kMultDimuons] > 0 && !(std::isnan(values[kM01POI]) || std::isinf(values[kM01POI]) || std::isnan(values[kCORR2POI]) || std::isinf(values[kCORR2POI]) || std::isnan(values[kM0111POI]) || std::isinf(values[kM0111POI]) || std::isnan(values[kCORR4POI]) || std::isinf(values[kCORR4POI])) ? values[kM01POI] / values[kMultDimuons] : 0; + values[kM0111POIoverMp] = values[kMultDimuons] > 0 && !(std::isnan(values[kM0111POI]) || std::isinf(values[kM0111POI]) || std::isnan(values[kCORR4POI]) || std::isinf(values[kCORR4POI]) || std::isnan(values[kM01POI]) || std::isinf(values[kM01POI]) || std::isnan(values[kCORR2POI]) || std::isinf(values[kCORR2POI])) ? values[kM0111POI] / values[kMultDimuons] : 0; + values[kM11REFoverMp] = values[kMultDimuons] > 0 && !(std::isnan(values[kM11REF]) || std::isinf(values[kM11REF]) || std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF]) || std::isnan(values[kM1111REF]) || std::isinf(values[kM1111REF]) || std::isnan(values[kCORR4REF]) || std::isinf(values[kCORR4REF])) ? values[kM11REF] / values[kMultDimuons] : 0; + values[kM1111REFoverMp] = values[kMultDimuons] > 0 && !(std::isnan(values[kM1111REF]) || std::isinf(values[kM1111REF]) || std::isnan(values[kCORR4REF]) || std::isinf(values[kCORR4REF]) || std::isnan(values[kM11REF]) || std::isinf(values[kM11REF]) || std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF])) ? values[kM1111REF] / values[kMultDimuons] : 0; + values[kCORR2REFbydimuons] = std::isnan(values[kM11REFoverMp]) || std::isinf(values[kM11REFoverMp]) || std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF]) || std::isnan(values[kM1111REFoverMp]) || std::isinf(values[kM1111REFoverMp]) || std::isnan(values[kCORR4REF]) || std::isinf(values[kCORR4REF]) ? 0 : values[kCORR2REF]; + values[kCORR4REFbydimuons] = std::isnan(values[kM1111REFoverMp]) || std::isinf(values[kM1111REFoverMp]) || std::isnan(values[kCORR4REF]) || std::isinf(values[kCORR4REF]) || std::isnan(values[kM11REFoverMp]) || std::isinf(values[kM11REFoverMp]) || std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF]) ? 0 : values[kCORR4REF]; + values[kCORR2POI] = std::isnan(values[kCORR2POI]) || std::isinf(values[kCORR2POI]) || std::isnan(values[kM01POI]) || std::isinf(values[kM01POI]) || std::isnan(values[kCORR4POI]) || std::isinf(values[kCORR4POI]) || std::isnan(values[kM0111POI]) || std::isinf(values[kM0111POI]) ? 0 : values[kCORR2POI]; + values[kCORR4POI] = std::isnan(values[kCORR4POI]) || std::isinf(values[kCORR4POI]) || std::isnan(values[kM0111POI]) || std::isinf(values[kM0111POI]) || std::isnan(values[kCORR2POI]) || std::isinf(values[kCORR2POI]) || std::isnan(values[kM01POI]) || std::isinf(values[kM01POI]) ? 0 : values[kCORR4POI]; + values[kCORR2CORR4REF] = std::isnan(values[kM11M1111REFoverMp]) || std::isinf(values[kM11M1111REFoverMp]) || std::isnan(values[kCORR2CORR4REF]) || std::isinf(values[kCORR2CORR4REF]) ? 0 : values[kCORR2CORR4REF]; + values[kCORR2POICORR4POI] = std::isnan(values[kCORR2POI]) || std::isinf(values[kCORR2POI]) || std::isnan(values[kCORR4POI]) || std::isinf(values[kCORR4POI]) || std::isnan(values[kM01POI]) || std::isinf(values[kM01POI]) || std::isnan(values[kM0111POI]) || std::isinf(values[kM0111POI]) ? 0 : values[kCORR2POI] * values[kCORR4POI]; + values[kCORR2REFCORR4POI] = std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF]) || std::isnan(values[kCORR4POI]) || std::isinf(values[kCORR4POI]) || std::isnan(values[kM11REF]) || std::isinf(values[kM11REF]) || std::isnan(values[kM0111POI]) || std::isinf(values[kM0111POI]) ? 0 : values[kCORR2REF] * values[kCORR4POI]; + values[kCORR2REFCORR2POI] = std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF]) || std::isnan(values[kCORR2POI]) || std::isinf(values[kCORR2POI]) || std::isnan(values[kM11REF]) || std::isinf(values[kM11REF]) || std::isnan(values[kM01POI]) || std::isinf(values[kM01POI]) ? 0 : values[kCORR2REF] * values[kCORR2POI]; + values[kM11M1111REFoverMp] = values[kMultDimuons] > 0 && !(std::isnan(values[kM11M1111REF]) || std::isinf(values[kM11M1111REF]) || std::isnan(values[kCORR2CORR4REF]) || std::isinf(values[kCORR2CORR4REF])) ? values[kM11M1111REF] / values[kMultDimuons] : 0; + values[kM01M0111overMp] = values[kMultDimuons] > 0 && !(std::isnan(values[kM01POI]) || std::isinf(values[kM01POI]) || std::isnan(values[kM0111POI]) || std::isinf(values[kM0111POI]) || std::isnan(values[kCORR2POI]) || std::isinf(values[kCORR2POI]) || std::isnan(values[kCORR4POI]) || std::isinf(values[kCORR4POI])) ? (values[kM01POI] * values[kM0111POI]) / values[kMultDimuons] : 0; + values[kM11M0111overMp] = values[kMultDimuons] > 0 && !(std::isnan(values[kM11REF]) || std::isinf(values[kM11REF]) || std::isnan(values[kM0111POI]) || std::isinf(values[kM0111POI]) || std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF]) || std::isnan(values[kCORR4POI]) || std::isinf(values[kCORR4POI])) ? (values[kM11REF] * values[kM0111POI]) / values[kMultDimuons] : 0; + values[kM11M01overMp] = values[kMultDimuons] > 0 && !(std::isnan(values[kM11REF]) || std::isinf(values[kM11REF]) || std::isnan(values[kM01POI]) || std::isinf(values[kM01POI]) || std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF]) || std::isnan(values[kCORR2POI]) || std::isinf(values[kCORR2POI])) ? (values[kM11REF] * values[kM01POI]) / values[kMultDimuons] : 0; } ROOT::Math::PtEtaPhiMVector v1_vp(v1.Pt(), v1.Eta(), v1.Phi() - Psi2B, v1.M()); diff --git a/PWGEM/Dilepton/Core/DielectronCut.h b/PWGEM/Dilepton/Core/DielectronCut.h index 5c533671795..1cd684caa96 100644 --- a/PWGEM/Dilepton/Core/DielectronCut.h +++ b/PWGEM/Dilepton/Core/DielectronCut.h @@ -487,7 +487,7 @@ class DielectronCut : public TNamed int mMinNClustersITS{0}, mMaxNClustersITS{7}; // range in number of ITS clusters float mMinChi2PerClusterITS{-1e10f}, mMaxChi2PerClusterITS{1e10f}; // max its fit chi2 per ITS cluster float mMaxPinMuonTPConly{0.2f}; // max pin cut for muon ID with TPConly - float mMaxPinForPionRejectionTPC{1e10f}; // max pin cut for muon ID with TPConly + float mMaxPinForPionRejectionTPC{1e10f}; // max pin for pion rejection in TPC bool mRequireITSibAny{true}; bool mRequireITSib1st{false}; float mMinChi2TOF{-1e10f}, mMaxChi2TOF{1e10f}; // max tof chi2 per diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index db7016e79a3..5bd700f28b5 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -75,7 +75,7 @@ using MyCollision = MyCollisions::iterator; using MyCollisionsWithSWT = soa::Join; using MyCollisionWithSWT = MyCollisionsWithSWT::iterator; -using MyElectrons = soa::Join; +using MyElectrons = soa::Join; using MyElectron = MyElectrons::iterator; using FilteredMyElectrons = soa::Filtered; using FilteredMyElectron = FilteredMyElectrons::iterator; @@ -164,7 +164,6 @@ struct Dilepton { Configurable cfg_max_pair_y{"cfg_max_pair_y", +0.8, "max pair rapidity"}; Configurable cfg_min_pair_dca3d{"cfg_min_pair_dca3d", 0.0, "min pair dca3d in sigma"}; Configurable cfg_max_pair_dca3d{"cfg_max_pair_dca3d", 1e+10, "max pair dca3d in sigma"}; - Configurable cfg_apply_pf{"cfg_apply_pf", false, "flag to apply phiv prefilter"}; Configurable cfg_apply_phiv{"cfg_apply_phiv", true, "flag to apply phiv cut"}; Configurable cfg_phiv_slope{"cfg_phiv_slope", 0.0185, "slope for m vs. phiv"}; Configurable cfg_phiv_intercept{"cfg_phiv_intercept", -0.0280, "intercept for m vs. phiv"}; @@ -177,8 +176,11 @@ struct Dilepton { Configurable cfg_max_opang{"cfg_max_opang", 6.4, "max opening angle"}; Configurable cfg_require_diff_sides{"cfg_require_diff_sides", false, "flag to require 2 tracks are from different sides."}; - Configurable cfg_apply_cuts_from_prefilter{"cfg_apply_cuts_from_prefilter", false, "flag to apply phiv cut inherited from prefilter"}; - Configurable cfg_prefilter_bits{"cfg_prefilter_bits", 0, "prefilter bits [kNone : 0, kMee : 1, kPhiV : 2, kSplitOrMergedTrackLS : 4, kSplitOrMergedTrackULS : 8] Please consider logical-OR among them."}; // see PairUtilities.h + Configurable cfg_apply_cuts_from_prefilter{"cfg_apply_cuts_from_prefilter", false, "flag to apply prefilter set when producing derived data"}; + Configurable cfg_prefilter_bits{"cfg_prefilter_bits", 0, "prefilter bits [kNone : 0, kElFromPC : 1, kElFromPi0_1 : 2, kElFromPi0_2 : 4, kElFromPi0_3 : 8] Please consider logical-OR among them."}; // see PairUtilities.h + + Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply pair cut same as prefilter set in derived data"}; + Configurable cfg_prefilter_bits_derived{"cfg_prefilter_bits_derived", 0, "prefilter bits [kNone : 0, kMee : 1, kPhiV : 2, kSplitOrMergedTrackLS : 4, kSplitOrMergedTrackULS : 8] Please consider logical-OR among them."}; // see PairUtilities.h Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.2, "min pT for single track"}; Configurable cfg_max_pt_track{"cfg_max_pt_track", 1e+10, "max pT for single track"}; @@ -217,6 +219,7 @@ struct Dilepton { Configurable cfg_max_TPCNsigmaPr{"cfg_max_TPCNsigmaPr", +3.0, "max. TPC n sigma for proton exclusion"}; Configurable cfg_min_TOFNsigmaEl{"cfg_min_TOFNsigmaEl", -3.0, "min. TOF n sigma for electron inclusion"}; Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3.0, "max. TOF n sigma for electron inclusion"}; + Configurable cfg_max_pin_pirejTPC{"cfg_max_pin_pirejTPC", 1e+10, "max. pin for pion rejection in TPC"}; Configurable enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"}; // configuration for PID ML @@ -646,7 +649,6 @@ struct Dilepton { fDielectronCut.SetPairDCARange(dielectroncuts.cfg_min_pair_dca3d, dielectroncuts.cfg_max_pair_dca3d); // in sigma fDielectronCut.SetMaxMeePhiVDep([&](float phiv) { return dielectroncuts.cfg_phiv_intercept + phiv * dielectroncuts.cfg_phiv_slope; }, dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv); fDielectronCut.ApplyPhiV(dielectroncuts.cfg_apply_phiv); - fDielectronCut.ApplyPrefilter(dielectroncuts.cfg_apply_pf); fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); fDielectronCut.SetPairOpAng(dielectroncuts.cfg_min_opang, dielectroncuts.cfg_max_opang); fDielectronCut.SetRequireDifferentSides(dielectroncuts.cfg_require_diff_sides); @@ -678,6 +680,7 @@ struct Dilepton { fDielectronCut.SetTPCNsigmaKaRange(dielectroncuts.cfg_min_TPCNsigmaKa, dielectroncuts.cfg_max_TPCNsigmaKa); fDielectronCut.SetTPCNsigmaPrRange(dielectroncuts.cfg_min_TPCNsigmaPr, dielectroncuts.cfg_max_TPCNsigmaPr); fDielectronCut.SetTOFNsigmaElRange(dielectroncuts.cfg_min_TOFNsigmaEl, dielectroncuts.cfg_max_TOFNsigmaEl); + fDielectronCut.SetMaxPinForPionRejectionTPC(dielectroncuts.cfg_max_pin_pirejTPC); if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut static constexpr int nClassesMl = 2; @@ -1088,14 +1091,21 @@ struct Dilepton { SliceCache cache; Preslice perCollision_electron = aod::emprimaryelectron::emeventId; Filter trackFilter_electron = dielectroncuts.cfg_min_pt_track < o2::aod::track::pt && dielectroncuts.cfg_min_eta_track < o2::aod::track::eta && o2::aod::track::eta < dielectroncuts.cfg_max_eta_track && dielectroncuts.cfg_min_phi_track < o2::aod::track::phi && o2::aod::track::phi < dielectroncuts.cfg_max_phi_track && o2::aod::track::tpcChi2NCl < dielectroncuts.cfg_max_chi2tpc && o2::aod::track::itsChi2NCl < dielectroncuts.cfg_max_chi2its && nabs(o2::aod::track::dcaXY) < dielectroncuts.cfg_max_dcaxy && nabs(o2::aod::track::dcaZ) < dielectroncuts.cfg_max_dcaz; - Filter pidFilter_electron = (dielectroncuts.cfg_min_TPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < dielectroncuts.cfg_max_TPCNsigmaEl) && (o2::aod::pidtpc::tpcNSigmaPi < dielectroncuts.cfg_min_TPCNsigmaPi || dielectroncuts.cfg_max_TPCNsigmaPi < o2::aod::pidtpc::tpcNSigmaPi); + Filter pidFilter_electron = dielectroncuts.cfg_min_TPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < dielectroncuts.cfg_max_TPCNsigmaEl; Filter ttcaFilter_electron = ifnode(dielectroncuts.enableTTCA.node(), o2::aod::emprimaryelectron::isAssociatedToMPC == true || o2::aod::emprimaryelectron::isAssociatedToMPC == false, o2::aod::emprimaryelectron::isAssociatedToMPC == true); - Filter prefilter_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter.node() && dielectroncuts.cfg_prefilter_bits.node() >= static_cast(1), - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kMee))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kMee))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kPhiV))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kPhiV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLS))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLS))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackULS))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackULS))) <= static_cast(0), true), - o2::aod::emprimaryelectron::pfbpi0 >= static_cast(0)); + Filter prefilter_derived_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter_derived.node() && dielectroncuts.cfg_prefilter_bits_derived.node() >= static_cast(1), + ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kPhiV))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kPhiV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS))) <= static_cast(0), true), + o2::aod::emprimaryelectron::pfbderived >= static_cast(0)); + + Filter prefilter_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter.node() && dielectroncuts.cfg_prefilter_bits.node() >= static_cast(1), + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_2))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_2))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_3))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_3))) <= static_cast(0), true), + o2::aod::emprimaryelectron::pfb >= static_cast(0)); Partition positive_electrons = o2::aod::emprimaryelectron::sign > int8_t(0); Partition negative_electrons = o2::aod::emprimaryelectron::sign < int8_t(0); diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 9d030d1e8ae..b724b66c739 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -65,7 +65,7 @@ using namespace o2::aod::pwgem::dilepton::utils::pairutil; using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; -using MyMCElectrons = soa::Join; +using MyMCElectrons = soa::Join; using MyMCElectron = MyMCElectrons::iterator; using FilteredMyMCElectrons = soa::Filtered; using FilteredMyMCElectron = FilteredMyMCElectrons::iterator; @@ -142,7 +142,6 @@ struct DileptonMC { Configurable cfg_max_pair_y{"cfg_max_pair_y", +0.8, "max pair rapidity"}; Configurable cfg_min_pair_dca3d{"cfg_min_pair_dca3d", 0.0, "min pair dca3d in sigma"}; Configurable cfg_max_pair_dca3d{"cfg_max_pair_dca3d", 1e+10, "max pair dca3d in sigma"}; - Configurable cfg_apply_pf{"cfg_apply_pf", false, "flag to apply phiv prefilter"}; Configurable cfg_apply_phiv{"cfg_apply_phiv", true, "flag to apply phiv cut"}; Configurable cfg_phiv_slope{"cfg_phiv_slope", 0.0185, "slope for m vs. phiv"}; Configurable cfg_phiv_intercept{"cfg_phiv_intercept", -0.0280, "intercept for m vs. phiv"}; @@ -155,8 +154,11 @@ struct DileptonMC { Configurable cfg_max_opang{"cfg_max_opang", 6.4, "max opening angle"}; Configurable cfg_require_diff_sides{"cfg_require_diff_sides", false, "flag to require 2 tracks are from different sides."}; - Configurable cfg_apply_cuts_from_prefilter{"cfg_apply_cuts_from_prefilter", false, "flag to apply phiv cut inherited from prefilter"}; - Configurable cfg_prefilter_bits{"cfg_prefilter_bits", 0, "prefilter bits [kNone : 0, kMee : 1, kPhiV : 2, kSplitOrMergedTrackLS : 4, kSplitOrMergedTrackULS : 8] Please consider logical-OR among them."}; // see PairUtilities.h + Configurable cfg_apply_cuts_from_prefilter{"cfg_apply_cuts_from_prefilter", false, "flag to apply prefilter set when producing derived data"}; + Configurable cfg_prefilter_bits{"cfg_prefilter_bits", 0, "prefilter bits [kNone : 0, kElFromPC : 1, kElFromPi0_1 : 2, kElFromPi0_2 : 4, kElFromPi0_3 : 8] Please consider logical-OR among them."}; // see PairUtilities.h + + Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply phiv cut inherited from prefilter"}; + Configurable cfg_prefilter_bits_derived{"cfg_prefilter_bits_derived", 0, "prefilter bits [kNone : 0, kMee : 1, kPhiV : 2, kSplitOrMergedTrackLS : 4, kSplitOrMergedTrackULS : 8] Please consider logical-OR among them."}; // see PairUtilities.h Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.2, "min pT for single track"}; Configurable cfg_max_pt_track{"cfg_max_pt_track", 1e+10, "max pT for single track"}; @@ -195,6 +197,7 @@ struct DileptonMC { Configurable cfg_max_TPCNsigmaPr{"cfg_max_TPCNsigmaPr", +3.0, "max. TPC n sigma for proton exclusion"}; Configurable cfg_min_TOFNsigmaEl{"cfg_min_TOFNsigmaEl", -3.0, "min. TOF n sigma for electron inclusion"}; Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3.0, "max. TOF n sigma for electron inclusion"}; + Configurable cfg_max_pin_pirejTPC{"cfg_max_pin_pirejTPC", 1e+10, "max. pin for pion rejection in TPC"}; Configurable enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"}; // configuration for PID ML @@ -550,7 +553,6 @@ struct DileptonMC { fDielectronCut.SetPairDCARange(dielectroncuts.cfg_min_pair_dca3d, dielectroncuts.cfg_max_pair_dca3d); // in sigma fDielectronCut.SetMaxMeePhiVDep([&](float phiv) { return dielectroncuts.cfg_phiv_intercept + phiv * dielectroncuts.cfg_phiv_slope; }, dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv); fDielectronCut.ApplyPhiV(dielectroncuts.cfg_apply_phiv); - fDielectronCut.ApplyPrefilter(dielectroncuts.cfg_apply_pf); fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); fDielectronCut.SetPairOpAng(dielectroncuts.cfg_min_opang, dielectroncuts.cfg_max_opang); fDielectronCut.SetRequireDifferentSides(dielectroncuts.cfg_require_diff_sides); @@ -582,6 +584,7 @@ struct DileptonMC { fDielectronCut.SetTPCNsigmaKaRange(dielectroncuts.cfg_min_TPCNsigmaKa, dielectroncuts.cfg_max_TPCNsigmaKa); fDielectronCut.SetTPCNsigmaPrRange(dielectroncuts.cfg_min_TPCNsigmaPr, dielectroncuts.cfg_max_TPCNsigmaPr); fDielectronCut.SetTOFNsigmaElRange(dielectroncuts.cfg_min_TOFNsigmaEl, dielectroncuts.cfg_max_TOFNsigmaEl); + fDielectronCut.SetMaxPinForPionRejectionTPC(dielectroncuts.cfg_max_pin_pirejTPC); if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut static constexpr int nClassesMl = 2; @@ -1028,14 +1031,21 @@ struct DileptonMC { SliceCache cache; Preslice perCollision_electron = aod::emprimaryelectron::emeventId; Filter trackFilter_electron = dielectroncuts.cfg_min_phi_track < o2::aod::track::phi && o2::aod::track::phi < dielectroncuts.cfg_max_phi_track && o2::aod::track::tpcChi2NCl < dielectroncuts.cfg_max_chi2tpc && o2::aod::track::itsChi2NCl < dielectroncuts.cfg_max_chi2its && nabs(o2::aod::track::dcaXY) < dielectroncuts.cfg_max_dcaxy && nabs(o2::aod::track::dcaZ) < dielectroncuts.cfg_max_dcaz; - Filter pidFilter_electron = (dielectroncuts.cfg_min_TPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < dielectroncuts.cfg_max_TPCNsigmaEl) && (o2::aod::pidtpc::tpcNSigmaPi < dielectroncuts.cfg_min_TPCNsigmaPi || dielectroncuts.cfg_max_TPCNsigmaPi < o2::aod::pidtpc::tpcNSigmaPi); + Filter pidFilter_electron = dielectroncuts.cfg_min_TPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < dielectroncuts.cfg_max_TPCNsigmaEl; Filter ttcaFilter_electron = ifnode(dielectroncuts.enableTTCA.node(), o2::aod::emprimaryelectron::isAssociatedToMPC == true || o2::aod::emprimaryelectron::isAssociatedToMPC == false, o2::aod::emprimaryelectron::isAssociatedToMPC == true); - Filter prefilter_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter.node() && dielectroncuts.cfg_prefilter_bits.node() >= static_cast(1), - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kMee))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kMee))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kPhiV))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kPhiV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLS))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLS))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackULS))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackULS))) <= static_cast(0), true), - o2::aod::emprimaryelectron::pfbpi0 >= static_cast(0)); + Filter prefilter_derived_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter_derived.node() && dielectroncuts.cfg_prefilter_bits_derived.node() >= static_cast(1), + ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kPhiV))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kPhiV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS))) <= static_cast(0), true), + o2::aod::emprimaryelectron::pfbderived >= static_cast(0)); + + Filter prefilter_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter.node() && dielectroncuts.cfg_prefilter_bits.node() >= static_cast(1), + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_2))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_2))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_3))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_3))) <= static_cast(0), true), + o2::aod::emprimaryelectron::pfb >= static_cast(0)); Preslice perCollision_muon = aod::emprimarymuon::emeventId; Filter trackFilter_muon = o2::aod::fwdtrack::trackType == dimuoncuts.cfg_track_type && dimuoncuts.cfg_min_phi_track < o2::aod::fwdtrack::phi && o2::aod::fwdtrack::phi < dimuoncuts.cfg_max_phi_track; diff --git a/PWGEM/Dilepton/Core/PhotonHBT.h b/PWGEM/Dilepton/Core/PhotonHBT.h index 699fdeded90..ef0e6b7a1b6 100644 --- a/PWGEM/Dilepton/Core/PhotonHBT.h +++ b/PWGEM/Dilepton/Core/PhotonHBT.h @@ -834,6 +834,7 @@ struct PhotonHBT { auto electrons_per_collision = electrons->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); std::vector, std::pair>> used_pairs_per_collision; used_pairs_per_collision.reserve(std::pow(positrons_per_collision.size() * electrons_per_collision.size(), 2)); + // LOGF(info, "collision.globalIndex() = %d, positrons_per_collision.size() = %d, electrons_per_collision.size() = %d", collision.globalIndex(), positrons_per_collision.size(), electrons_per_collision.size()); for (auto& [pos1, ele1] : combinations(CombinationsFullIndexPolicy(positrons_per_collision, electrons_per_collision))) { if (pos1.trackId() == ele1.trackId()) { // this is protection against pairing identical 2 tracks. // never happens. only for protection. @@ -925,6 +926,7 @@ struct PhotonHBT { ndiphoton++; used_pairs_per_collision.emplace_back(std::make_pair(pair_tmp.first, pair_tmp.second)); used_pairs_per_collision.emplace_back(std::make_pair(pair_tmp.second, pair_tmp.first)); + // LOGF(info, "collision.globalIndex() = %d, pos1.trackId() = %d, ele1.trackId() = %d, pos2.trackId() = %d, ele2.trackId() = %d", collision.globalIndex(), pos1.trackId(), ele1.trackId(), pos2.trackId(), ele2.trackId()); std::tuple tuple_tmp_id1 = std::make_tuple(ndf, collision.globalIndex(), pos1.globalIndex(), ele1.globalIndex()); std::tuple tuple_tmp_id2 = std::make_tuple(ndf, collision.globalIndex(), pos2.globalIndex(), ele2.globalIndex()); @@ -1391,7 +1393,7 @@ struct PhotonHBT { } Filter trackFilter = dielectroncuts.cfg_min_pt_track < o2::aod::track::pt && dielectroncuts.cfg_min_eta_track < o2::aod::track::eta && o2::aod::track::eta < dielectroncuts.cfg_max_eta_track && o2::aod::track::tpcChi2NCl < dielectroncuts.cfg_max_chi2tpc && o2::aod::track::itsChi2NCl < dielectroncuts.cfg_max_chi2its && nabs(o2::aod::track::dcaXY) < dielectroncuts.cfg_max_dcaxy && nabs(o2::aod::track::dcaZ) < dielectroncuts.cfg_max_dcaz; - Filter pidFilter = (dielectroncuts.cfg_min_TPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < dielectroncuts.cfg_max_TPCNsigmaEl) && (o2::aod::pidtpc::tpcNSigmaPi < dielectroncuts.cfg_min_TPCNsigmaPi || dielectroncuts.cfg_max_TPCNsigmaPi < o2::aod::pidtpc::tpcNSigmaPi); + Filter pidFilter = dielectroncuts.cfg_min_TPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < dielectroncuts.cfg_max_TPCNsigmaEl; Filter ttcaFilter = ifnode(dielectroncuts.enableTTCA.node(), o2::aod::emprimaryelectron::isAssociatedToMPC == true || o2::aod::emprimaryelectron::isAssociatedToMPC == false, o2::aod::emprimaryelectron::isAssociatedToMPC == true); Partition positrons = o2::aod::emprimaryelectron::sign > int8_t(0); diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index 30348b17199..9031e5fa608 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -367,7 +367,7 @@ DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN(AmbiguousElectrons, ambiguousElectrons); DECLARE_SOA_COLUMN(IsAssociatedToMPC, isAssociatedToMPC, bool); //! is associated to most probable collision DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! DECLARE_SOA_COLUMN(PrefilterBit, pfb, uint8_t); //! -DECLARE_SOA_COLUMN(PrefilterBitPi0, pfbpi0, uint16_t); //! +DECLARE_SOA_COLUMN(PrefilterBitDerived, pfbderived, uint16_t); //! DECLARE_SOA_DYNAMIC_COLUMN(Signed1Pt, signed1Pt, [](float pt, int8_t sign) -> float { return sign * 1. / pt; }); DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float pt, float eta) -> float { return pt * std::cosh(eta); }); DECLARE_SOA_DYNAMIC_COLUMN(Px, px, [](float pt, float phi) -> float { return pt * std::cos(phi); }); @@ -513,9 +513,9 @@ DECLARE_SOA_TABLE(EMAmbiguousElectronSelfIds, "AOD", "EMAMBELSELFID", emprimarye // iterators using EMAmbiguousElectronSelfId = EMAmbiguousElectronSelfIds::iterator; -DECLARE_SOA_TABLE(EMPrimaryElectronsPrefilterBitPi0, "AOD", "PRMELPFBPI0", emprimaryelectron::PrefilterBitPi0); // To be joined with EMPrimaryElectrons table at analysis level. +DECLARE_SOA_TABLE(EMPrimaryElectronsPrefilterBitDerived, "AOD", "PRMELPFBPI0", emprimaryelectron::PrefilterBitDerived); // To be joined with EMPrimaryElectrons table at analysis level. // iterators -using EMPrimaryElectronPrefilterBitPi0 = EMPrimaryElectronsPrefilterBitPi0::iterator; +using EMPrimaryElectronPrefilterBitDerived = EMPrimaryElectronsPrefilterBitDerived::iterator; namespace emprimarymuon { diff --git a/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx b/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx index 9d60b093bb0..5d57b999491 100644 --- a/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx +++ b/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx @@ -329,128 +329,10 @@ struct AssociateDileptonToEMEvent { PROCESS_SWITCH(AssociateDileptonToEMEvent, processFwdMuon, "process forward muon indexing", false); PROCESS_SWITCH(AssociateDileptonToEMEvent, processDummy, "process dummy", true); }; -struct EMEventPropertyTask { - SliceCache cache; - Preslice perCollision = aod::track::collisionId; - using Run3Tracks = soa::Join; - - Configurable fillQAHistogram{"fillQAHistogram", false, "flag to fill QA histograms"}; - - Produces evprop; - struct : ConfigurableGroup { - std::string prefix = "spherocity_cutgroup"; - Configurable require_isPVContributor{"require_isPVContributor", false, "require tracks to be PV contributors"}; - Configurable min_ntrack{"min_ntrack", 3, "min. number of tracks"}; - Configurable min_pt{"min_pt", 0.15, "min. pT of track in GeV/c"}; - Configurable min_eta{"min_eta", -0.8, "min. eta of track"}; - Configurable max_eta{"max_eta", +0.8, "max. eta of track"}; - Configurable max_dcaxy{"max_dcaxy", 2.4, "max. DCAxy of track in cm"}; - Configurable max_dcaz{"max_dcaz", 3.2, "max. DCAz of track in cm"}; - Configurable min_ncluster_tpc{"min_ncluster_tpc", 50, "min. number of TPC clusters"}; - Configurable max_chi2tpc{"max_chi2tpc", 4.0, "max. chi2/ncls TPC"}; - } spherocity_cuts; - - HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - void init(InitContext&) - { - if (fillQAHistogram) { - fRegistry.add("Spherocity/hPt", "pT;p_{T} (GeV/c)", kTH1F, {{200, 0.0f, 10}}, false); - fRegistry.add("Spherocity/hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{180, 0, 2 * M_PI}, {40, -1.0f, 1.0f}}, false); - fRegistry.add("Spherocity/hSpherocity_ptweighted", "spherocity;Number of used tracks;spherocity", kTH2F, {{101, -0.5, 100.5}, {100, 0.0f, 1}}, false); - fRegistry.add("Spherocity/hSpherocity_ptunweighted", "spherocity;Number of used tracks;spherocity", kTH2F, {{101, -0.5, 100.5}, {100, 0.0f, 1}}, false); - } - } - - template - int getSpherocity(TTracks const& tracks, float& spherocity_ptweighted, float& spherocity_ptunweighted) - { - // Reference for spherocity : https://arxiv.org/pdf/1905.07208, https://arxiv.org/abs/2310.20406, https://arxiv.org/abs/1205.3963 - int used_ntrack_spherocity = 0; - float sum_pt = 0.f, sum_ntrack = 0.f; - - for (auto const& track : tracks) { - if (spherocity_cuts.require_isPVContributor && !track.isPVContributor()) { - continue; - } - if (track.tpcNClsFound() < spherocity_cuts.min_ncluster_tpc) { - continue; - } - - sum_pt += track.pt(); - sum_ntrack += 1.f; - - if (fillQAHistogram) { - fRegistry.fill(HIST("Spherocity/hPt"), track.pt()); - fRegistry.fill(HIST("Spherocity/hEtaPhi"), track.phi(), track.eta()); - } - used_ntrack_spherocity++; - } // end of track loop per collision - - float tempSph = 1.f, tempSph_pt1 = 1.f; - for (int i = 0; i < 360 / 0.1; i++) { - float nx = std::cos(M_PI / 180.f * i * 0.1); - float ny = std::sin(M_PI / 180.f * i * 0.1); - float sum_crossprod = 0.f, sum_crossprod_pt1 = 0.f; - for (auto const& track : tracks) { - if (spherocity_cuts.require_isPVContributor && !track.isPVContributor()) { - continue; - } - if (track.tpcNClsFound() < spherocity_cuts.min_ncluster_tpc) { - continue; - } - float px = track.px(); - float py = track.py(); - sum_crossprod += abs(px * ny - py * nx); - sum_crossprod_pt1 += abs(std::cos(track.phi()) * ny - std::sin(track.phi()) * nx); - } - float sph = std::pow(sum_crossprod / sum_pt, 2); - float sph_pt1 = std::pow(sum_crossprod_pt1 / sum_ntrack, 2); - if (sph < tempSph) { - tempSph = sph; - } - if (sph_pt1 < tempSph_pt1) { - tempSph_pt1 = sph_pt1; - } - } // end of track loop per collision - spherocity_ptweighted = std::pow(M_PI_2, 2) * tempSph; - spherocity_ptunweighted = std::pow(M_PI_2, 2) * tempSph_pt1; - if (used_ntrack_spherocity < spherocity_cuts.min_ntrack) { - spherocity_ptweighted = -1.f; - spherocity_ptunweighted = -1.f; - } - return used_ntrack_spherocity; - } - - Partition tracks_for_spherocity = spherocity_cuts.min_pt < aod::track::pt && spherocity_cuts.min_eta < o2::aod::track::eta && o2::aod::track::eta < spherocity_cuts.max_eta && nabs(o2::aod::track::dcaXY) < spherocity_cuts.max_dcaxy && nabs(o2::aod::track::dcaZ) < spherocity_cuts.max_dcaz && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC) == true && o2::aod::track::tpcChi2NCl < spherocity_cuts.max_chi2tpc; // ITS-TPC matched tracks - - void processProp(aod::EMEvents const& collisions, Run3Tracks const&) - { - for (auto& collision : collisions) { - auto tracks_for_spherocity_per_collision = tracks_for_spherocity->sliceByCached(o2::aod::track::collisionId, collision.collisionId(), cache); - float spherocity_ptweighted = -1.f, spherocity_ptunweighted = -1.f; - int ntrack = getSpherocity(tracks_for_spherocity_per_collision, spherocity_ptweighted, spherocity_ptunweighted); - if (fillQAHistogram) { - fRegistry.fill(HIST("Spherocity/hSpherocity_ptweighted"), ntrack, spherocity_ptweighted); - fRegistry.fill(HIST("Spherocity/hSpherocity_ptunweighted"), ntrack, spherocity_ptunweighted); - } - evprop(spherocity_ptweighted, spherocity_ptunweighted, ntrack); - } // end of collision loop - } - PROCESS_SWITCH(EMEventPropertyTask, processProp, "process event property", true); - - void processDummy(aod::EMEvents const& collisions) - { - for (int i = 0; i < collisions.size(); i++) { - evprop(-1.f, -1.f, 0); - } // end of collision loop - } - PROCESS_SWITCH(EMEventPropertyTask, processDummy, "process dummy", false); -}; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ adaptAnalysisTask(cfgc, TaskName{"create-emevent-dilepton"}), adaptAnalysisTask(cfgc, TaskName{"associate-dilepton-to-emevent"}), - adaptAnalysisTask(cfgc, TaskName{"emevent-property"}), }; } diff --git a/PWGEM/Dilepton/TableProducer/filterDielectronEvent.cxx b/PWGEM/Dilepton/TableProducer/filterDielectronEvent.cxx index 3377fe4f3f6..202149c86c5 100644 --- a/PWGEM/Dilepton/TableProducer/filterDielectronEvent.cxx +++ b/PWGEM/Dilepton/TableProducer/filterDielectronEvent.cxx @@ -74,10 +74,10 @@ struct filterDielectronEvent { Configurable min_ncluster_tpc{"min_ncluster_tpc", 0, "min ncluster tpc"}; Configurable mincrossedrows{"mincrossedrows", 80, "min. crossed rows"}; Configurable min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"}; - Configurable max_mean_its_cluster_size{"max_mean_its_cluster_size", 16.f, "max. x cos(lambda)"}; - Configurable max_p_for_its_cluster_size{"max_p_for_its_cluster_size", 0, "its cluster size cut is applied below this p"}; - Configurable max_pin_for_pion_rejection{"max_pin_for_pion_rejection", -1, "pion rejection is applied below this pin"}; - Configurable minitsncls{"minitsncls", 4, "min. number of ITS clusters"}; + Configurable max_pin_for_pion_rejection{"max_pin_for_pion_rejection", 1e+10, "pion rejection is applied below this pin"}; + Configurable max_frac_shared_clusters_tpc{"max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; + Configurable min_ncluster_its{"min_ncluster_its", 4, "min ncluster its"}; + Configurable min_ncluster_itsib{"min_ncluster_itsib", 1, "min ncluster itsib"}; Configurable maxchi2tpc{"maxchi2tpc", 5.0, "max. chi2/NclsTPC"}; Configurable maxchi2its{"maxchi2its", 6.0, "max. chi2/NclsITS"}; Configurable minpt{"minpt", 0.15, "min pt for track"}; @@ -102,8 +102,6 @@ struct filterDielectronEvent { HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - std::pair> itsRequirement = {1, {0, 1, 2}}; // any hits on 3 ITS ib layers. - int mRunNumber; float d_bz; Service ccdb; @@ -220,25 +218,10 @@ struct filterDielectronEvent { if (!track.hasITS() || !track.hasTPC()) { return false; } - if (track.itsNCls() < minitsncls) { + if (track.itsNCls() < min_ncluster_its) { return false; } - - auto hits = std::count_if(itsRequirement.second.begin(), itsRequirement.second.end(), [&](auto&& requiredLayer) { return track.itsClusterMap() & (1 << requiredLayer); }); - if (hits < itsRequirement.first) { - return false; - } - - uint32_t itsClusterSizes = track.itsClusterSizes(); - int total_cluster_size = 0, nl = 0; - for (unsigned int layer = 0; layer < 7; layer++) { - int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf; - if (cluster_size_per_layer > 0) { - nl++; - } - total_cluster_size += cluster_size_per_layer; - } - if (static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(track.tgl())) > max_mean_its_cluster_size && track.p() < max_p_for_its_cluster_size) { + if (track.itsNClsInnerBarrel() < min_ncluster_itsib) { return false; } @@ -254,6 +237,10 @@ struct filterDielectronEvent { return false; } + if (track.tpcFractionSharedCls() > max_frac_shared_clusters_tpc) { + return false; + } + gpu::gpustd::array dcaInfo; auto track_par_cov_recalc = getTrackParCov(track); track_par_cov_recalc.setPID(o2::track::PID::Electron); @@ -298,7 +285,7 @@ struct filterDielectronEvent { if (track.tpcNSigmaEl() < minTPCNsigmaEl || maxTPCNsigmaEl < track.tpcNSigmaEl()) { return false; } - if (minTPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < maxTPCNsigmaPi) { + if (minTPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < maxTPCNsigmaPi && track.tpcInnerParam() < max_pin_for_pion_rejection) { return false; } if (minTPCNsigmaKa < track.tpcNSigmaKa() && track.tpcNSigmaKa() < maxTPCNsigmaKa) { @@ -316,7 +303,7 @@ struct filterDielectronEvent { template bool isElectron_TOFreq(TTrack const& track) { - if (minTPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < maxTPCNsigmaPi) { + if (minTPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < maxTPCNsigmaPi && track.tpcInnerParam() < max_pin_for_pion_rejection) { return false; } return minTPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < maxTPCNsigmaEl && fabs(track.tofNSigmaEl()) < maxTOFNsigmaEl; diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx index e132db33c06..adb2c9b62c9 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx @@ -13,6 +13,10 @@ /// \author daiki.sekihata@cern.ch #include +#include +#include +#include + #include "Math/Vector4D.h" #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -64,13 +68,12 @@ struct skimmerPrimaryElectron { Configurable min_ncluster_tpc{"min_ncluster_tpc", 10, "min ncluster tpc"}; Configurable mincrossedrows{"mincrossedrows", 70, "min. crossed rows"}; Configurable min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"}; - Configurable max_mean_its_cluster_size{"max_mean_its_cluster_size", 16.f, "max. x cos(lambda)"}; // this is to suppress random combination. default 4 + 1 for skimming. - Configurable max_p_for_its_cluster_size{"max_p_for_its_cluster_size", 0.0, "its cluster size cut is applied below this p"}; - Configurable minitsncls{"minitsncls", 4, "min. number of ITS clusters"}; + Configurable min_ncluster_its{"min_ncluster_its", 4, "min ncluster its"}; + Configurable min_ncluster_itsib{"min_ncluster_itsib", 1, "min ncluster itsib"}; Configurable maxchi2tpc{"maxchi2tpc", 5.0, "max. chi2/NclsTPC"}; Configurable maxchi2its{"maxchi2its", 6.0, "max. chi2/NclsITS"}; Configurable minpt{"minpt", 0.15, "min pt for track"}; - Configurable maxeta{"maxeta", 0.8, "eta acceptance"}; + Configurable maxeta{"maxeta", 0.9, "eta acceptance"}; Configurable dca_xy_max{"dca_xy_max", 1.0f, "max DCAxy in cm"}; Configurable dca_z_max{"dca_z_max", 1.0f, "max DCAz in cm"}; Configurable dca_3d_sigma_max{"dca_3d_sigma_max", 1e+10, "max DCA 3D in sigma"}; @@ -84,11 +87,11 @@ struct skimmerPrimaryElectron { Configurable maxTPCNsigmaPr{"maxTPCNsigmaPr", 2.5, "max. TPC n sigma for proton exclusion"}; Configurable minTPCNsigmaPr{"minTPCNsigmaPr", -2.5, "min. TPC n sigma for proton exclusion"}; Configurable requireTOF{"requireTOF", false, "require TOF hit"}; + Configurable max_pin_for_pion_rejection{"max_pin_for_pion_rejection", 1e+10, "pion rejection is applied below this pin"}; + Configurable max_frac_shared_clusters_tpc{"max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - std::pair> itsRequirement = {1, {0, 1, 2}}; // any hits on 3 ITS ib layers. - int mRunNumber; float d_bz; Service ccdb; @@ -203,25 +206,10 @@ struct skimmerPrimaryElectron { if (!track.hasITS() || !track.hasTPC()) { return false; } - if (track.itsNCls() < minitsncls) { - return false; - } - - auto hits = std::count_if(itsRequirement.second.begin(), itsRequirement.second.end(), [&](auto&& requiredLayer) { return track.itsClusterMap() & (1 << requiredLayer); }); - if (hits < itsRequirement.first) { + if (track.itsNCls() < min_ncluster_its) { return false; } - - uint32_t itsClusterSizes = track.itsClusterSizes(); - int total_cluster_size = 0, nl = 0; - for (unsigned int layer = 0; layer < 7; layer++) { - int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf; - if (cluster_size_per_layer > 0) { - nl++; - } - total_cluster_size += cluster_size_per_layer; - } - if (static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(track.tgl())) > max_mean_its_cluster_size && track.p() < max_p_for_its_cluster_size) { + if (track.itsNClsInnerBarrel() < min_ncluster_itsib) { return false; } @@ -237,6 +225,10 @@ struct skimmerPrimaryElectron { return false; } + if (track.tpcFractionSharedCls() > max_frac_shared_clusters_tpc) { + return false; + } + if (track.hasTOF() && (maxTOFNsigmaEl < fabs(track.tofNSigmaEl()))) { return false; } @@ -285,7 +277,7 @@ struct skimmerPrimaryElectron { if (track.tpcNSigmaEl() < minTPCNsigmaEl || maxTPCNsigmaEl < track.tpcNSigmaEl()) { return false; } - if (minTPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < maxTPCNsigmaPi) { + if (minTPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < maxTPCNsigmaPi && track.tpcInnerParam() < max_pin_for_pion_rejection) { return false; } if (minTPCNsigmaKa < track.tpcNSigmaKa() && track.tpcNSigmaKa() < maxTPCNsigmaKa) { @@ -303,7 +295,7 @@ struct skimmerPrimaryElectron { template bool isElectron_TOFreq(TTrack const& track) { - if (minTPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < maxTPCNsigmaPi) { + if (minTPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < maxTPCNsigmaPi && track.tpcInnerParam() < max_pin_for_pion_rejection) { return false; } return minTPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < maxTPCNsigmaEl && fabs(track.tofNSigmaEl()) < maxTOFNsigmaEl; @@ -404,7 +396,7 @@ struct skimmerPrimaryElectron { Preslice trackIndicesPerCollision = aod::track_association::collisionId; std::vector> stored_trackIds; Filter trackFilter = o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& o2::aod::track::tpcChi2NCl < maxchi2tpc&& o2::aod::track::itsChi2NCl < maxchi2its&& ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC) == true; - Filter pidFilter = minTPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < maxTPCNsigmaEl && (o2::aod::pidtpc::tpcNSigmaPi < minTPCNsigmaPi || maxTPCNsigmaPi < o2::aod::pidtpc::tpcNSigmaPi); + Filter pidFilter = minTPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < maxTPCNsigmaEl; using MyFilteredTracks = soa::Filtered; Partition posTracks = o2::aod::track::signed1Pt > 0.f; @@ -596,10 +588,6 @@ struct skimmerPrimaryElectron { }; struct prefilterPrimaryElectron { - enum class EM_Electron_PF : int { - kElFromPC = 0, // electron from photon conversion - }; - Produces ele_pfb; SliceCache cache; @@ -615,24 +603,26 @@ struct prefilterPrimaryElectron { // Operation and minimisation criteria Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; - Configurable max_pt_itsonly{"max_pt_itsonly", 0.15, "max pT for ITSonly tracks at PV"}; - Configurable min_dcatopv{"min_dcatopv", -1.f, "DCAxy To PV"}; - Configurable minpt{"minpt", 0.05, "min pt for track for loose track sample"}; - Configurable maxeta{"maxeta", 1.2, "eta acceptance for loose track sample"}; - Configurable mincrossedrows{"mincrossedrows", 40, "min crossed rows"}; + Configurable max_dcaxy{"max_dcaxy", 0.3, "DCAxy To PV for loose track sample"}; + Configurable max_dcaz{"max_dcaz", 0.3, "DCAz To PV for loose track sample"}; + Configurable minpt{"minpt", 0.1, "min pt for track for loose track sample"}; + Configurable maxeta{"maxeta", 0.9, "eta acceptance for loose track sample"}; + Configurable min_ncluster_tpc{"min_ncluster_tpc", 0, "min ncluster tpc"}; + Configurable mincrossedrows{"mincrossedrows", 70, "min crossed rows"}; + Configurable max_frac_shared_clusters_tpc{"max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; + Configurable min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"}; Configurable maxchi2tpc{"maxchi2tpc", 5.0, "max chi2/NclsTPC"}; Configurable maxchi2its{"maxchi2its", 6.0, "max chi2/NclsITS"}; + Configurable min_ncluster_its{"min_ncluster_its", 4, "min ncluster its"}; + Configurable min_ncluster_itsib{"min_ncluster_itsib", 1, "min ncluster itsib"}; Configurable minTPCNsigmaEl{"minTPCNsigmaEl", -3.0, "min. TPC n sigma for electron inclusion"}; Configurable maxTPCNsigmaEl{"maxTPCNsigmaEl", 3.0, "max. TPC n sigma for electron inclusion"}; Configurable slope{"slope", 0.0185, "slope for m vs. phiv"}; Configurable intercept{"intercept", -0.0280, "intercept for m vs. phiv"}; - HistogramRegistry fRegistry{ - "fRegistry", - { - {"hMvsPhiV_PV", "mass vs. phiv;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", {HistType::kTH2F, {{90, .0f, TMath::Pi()}, {100, 0, 0.1}}}}, - }, - }; + Configurable> max_mee_vec{"max_mee_vec", std::vector{0.08, 0.10, 0.12}, "vector fo max mee for prefilter in ULS. Please sort this by increasing order."}; // currently, 3 thoresholds are allowed. + + HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; int mRunNumber; float d_bz; @@ -648,6 +638,22 @@ struct prefilterPrimaryElectron { ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); + + if (!doprocessDummy) { + addHistograms(); + } + } + + void addHistograms() + { + fRegistry.add("Track/hPt", "pT;p_{T} (GeV/c)", kTH1F, {{1000, 0.0f, 10}}, false); + fRegistry.add("Track/hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{180, 0, 2 * M_PI}, {40, -1.0f, 1.0f}}, false); + fRegistry.add("Track/hTPCNsigmaEl", "loose track TPC PID", kTH2F, {{1000, 0.f, 10}, {100, -5, +5}}); + fRegistry.add("Pair/before/uls/hMvsPt", "mass vs. pT;m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c)", kTH2F, {{400, 0, 4}, {100, 0, 10}}); + fRegistry.add("Pair/before/uls/hMvsPhiV", "mass vs. phiv;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0.f, M_PI}, {100, 0, 1.f}}); + fRegistry.addClone("Pair/before/uls/", "Pair/before/lspp/"); + fRegistry.addClone("Pair/before/uls/", "Pair/before/lsmm/"); + fRegistry.addClone("Pair/before/", "Pair/after/"); } void initCCDB(aod::BCsWithTimestamps::iterator const& bc) @@ -693,12 +699,6 @@ struct prefilterPrimaryElectron { o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; - template - bool isITSonlyTrack(TTrack const& track) - { - return track.hasITS() && !track.hasTPC() && !track.hasTRD() && !track.hasTOF(); - } - template bool checkTrack(TCollision const& collision, TTrack const& track) { @@ -708,18 +708,33 @@ struct prefilterPrimaryElectron { if (track.itsChi2NCl() > maxchi2its) { return false; } + if (track.itsNCls() < min_ncluster_its) { + return false; + } + if (track.itsNClsInnerBarrel() < min_ncluster_itsib) { + return false; + } - if (track.hasTPC()) { - if (track.tpcNSigmaEl() < minTPCNsigmaEl || maxTPCNsigmaEl < track.tpcNSigmaEl()) { - return false; - } - if (track.tpcNClsCrossedRows() < mincrossedrows) { - return false; - } - - if (track.tpcChi2NCl() > maxchi2its) { - return false; - } + if (!track.hasTPC()) { + return false; + } + if (track.tpcNSigmaEl() < minTPCNsigmaEl || maxTPCNsigmaEl < track.tpcNSigmaEl()) { + return false; + } + if (track.tpcNClsFound() < min_ncluster_tpc) { + return false; + } + if (track.tpcNClsCrossedRows() < mincrossedrows) { + return false; + } + if (track.tpcCrossedRowsOverFindableCls() < min_tpc_cr_findable_ratio) { + return false; + } + if (track.tpcFractionSharedCls() > max_frac_shared_clusters_tpc) { + return false; + } + if (track.tpcChi2NCl() > maxchi2its) { + return false; } gpu::gpustd::array dcaInfo; @@ -728,14 +743,11 @@ struct prefilterPrimaryElectron { o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, track_par_cov_recalc, 2.f, matCorr, &dcaInfo); getPxPyPz(track_par_cov_recalc, pVec_recalc); - if (fabs(dcaInfo[0]) < min_dcatopv) { + if (fabs(dcaInfo[0]) > max_dcaxy || fabs(dcaInfo[1]) > max_dcaz) { return false; } - if (isITSonlyTrack(track) && track_par_cov_recalc.getPt() > max_pt_itsonly) { - return false; - } - if (fabs(track_par_cov_recalc.getEta()) > maxeta) { + if (track_par_cov_recalc.getPt() < minpt || fabs(track_par_cov_recalc.getEta()) > maxeta) { return false; } @@ -745,11 +757,7 @@ struct prefilterPrimaryElectron { template bool reconstructPC(TCollision const& collision, TTrack1 const& ele, TTrack2 const& pos) { - if (pos.sign() * ele.sign() > 0) { // reject same sign pair - return false; - } - - float mee, phiv = 0; + float mee = 0, phiv = 0; gpu::gpustd::array dcaInfo; std::array pVec_recalc = {0, 0, 0}; // px, py, pz @@ -775,8 +783,6 @@ struct prefilterPrimaryElectron { phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos.px(), pos.py(), pos.pz(), pVec_recalc[0], pVec_recalc[1], pVec_recalc[2], pos.sign(), ele.sign(), d_bz); } - fRegistry.fill(HIST("hMvsPhiV_PV"), phiv, mee); - if (mee < slope * phiv + intercept) { return true; } else { @@ -786,7 +792,7 @@ struct prefilterPrimaryElectron { Preslice trackIndicesPerCollision = aod::track_association::collisionId; - Filter trackFilter = o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true; + Filter trackFilter = o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC) == true; using MyFilteredTracks = soa::Filtered; Partition posTracks = o2::aod::track::signed1Pt > 0.f; Partition negTracks = o2::aod::track::signed1Pt < 0.f; @@ -819,7 +825,8 @@ struct prefilterPrimaryElectron { if (!checkTrack(collision, track)) { continue; } - + fRegistry.fill(HIST("Track/hPt"), track.pt()); + fRegistry.fill(HIST("Track/hEtaPhi"), track.phi(), track.eta()); if (track.sign() > 0) { posTracks_per_coll.emplace_back(track); } else { @@ -827,37 +834,125 @@ struct prefilterPrimaryElectron { } } - for (auto& empos : positrons_per_coll) { - // auto pos = tracks.rawIteratorAt(empos.trackId()); // use rawIterator, if the table is filtered. - for (auto& ele : negTracks_per_coll) { - if (!checkTrack(collision, ele)) { - continue; - } + for (auto& ele : negTracks_per_coll) { + if (!checkTrack(collision, ele)) { + continue; + } + gpu::gpustd::array dcaInfo; + std::array pVec_recalc = {0, 0, 0}; // px, py, pz + auto track_par_cov_recalc = getTrackParCov(ele); + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, track_par_cov_recalc, 2.f, matCorr, &dcaInfo); + getPxPyPz(track_par_cov_recalc, pVec_recalc); + + for (auto& empos : positrons_per_coll) { if (empos.trackId() == ele.globalIndex()) { continue; } - bool isPC = reconstructPC<-1>(collision, ele, empos); - if (isPC) { - pfb_map[empos.globalIndex()] |= (uint8_t(1) << static_cast(EM_Electron_PF::kElFromPC)); + + ROOT::Math::PtEtaPhiMVector v1(track_par_cov_recalc.getPt(), track_par_cov_recalc.getEta(), track_par_cov_recalc.getPhi(), o2::constants::physics::MassElectron); // loose track + ROOT::Math::PtEtaPhiMVector v2(empos.pt(), empos.eta(), empos.phi(), o2::constants::physics::MassElectron); // signal track + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(empos.px(), empos.py(), empos.pz(), pVec_recalc[0], pVec_recalc[1], pVec_recalc[2], empos.sign(), ele.sign(), d_bz); + fRegistry.fill(HIST("Pair/before/uls/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/before/uls/hMvsPt"), v12.M(), v12.Pt()); + if (v12.M() < max_mee_vec->at(static_cast(max_mee_vec->size()) - 1)) { + fRegistry.fill(HIST("Track/hTPCNsigmaEl"), ele.tpcInnerParam(), ele.tpcNSigmaEl()); + } + for (int i = 0; i < static_cast(max_mee_vec->size()); i++) { + if (v12.M() < max_mee_vec->at(i)) { + pfb_map[empos.globalIndex()] |= (uint8_t(1) << (static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1) + i)); + } } - } // end of loose electron loop - } // end of signal positon loop - for (auto& emele : electrons_per_coll) { - // auto ele = tracks.rawIteratorAt(emele.trackId()); // use rawIterator, if the table is filtered. - for (auto& pos : posTracks_per_coll) { - if (!checkTrack(collision, pos)) { // track cut is applied to loose sample - continue; + if (v12.M() < slope * phiv + intercept) { + pfb_map[empos.globalIndex()] |= (uint8_t(1) << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC)); } + + } // end of signal positon loop + } // end of loose electron loop + + for (auto& pos : posTracks_per_coll) { + if (!checkTrack(collision, pos)) { // track cut is applied to loose sample + continue; + } + gpu::gpustd::array dcaInfo; + std::array pVec_recalc = {0, 0, 0}; // px, py, pz + auto track_par_cov_recalc = getTrackParCov(pos); + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, track_par_cov_recalc, 2.f, matCorr, &dcaInfo); + getPxPyPz(track_par_cov_recalc, pVec_recalc); + for (auto& emele : electrons_per_coll) { if (emele.trackId() == pos.globalIndex()) { continue; } - bool isPC = reconstructPC<+1>(collision, emele, pos); - if (isPC) { - pfb_map[emele.globalIndex()] |= (uint8_t(1) << static_cast(EM_Electron_PF::kElFromPC)); + + ROOT::Math::PtEtaPhiMVector v1(emele.pt(), emele.eta(), emele.phi(), o2::constants::physics::MassElectron); // signal track + ROOT::Math::PtEtaPhiMVector v2(track_par_cov_recalc.getPt(), track_par_cov_recalc.getEta(), track_par_cov_recalc.getPhi(), o2::constants::physics::MassElectron); // loose track + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pVec_recalc[0], pVec_recalc[1], pVec_recalc[2], emele.px(), emele.py(), emele.pz(), pos.sign(), emele.sign(), d_bz); + fRegistry.fill(HIST("Pair/before/uls/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/before/uls/hMvsPt"), v12.M(), v12.Pt()); + if (v12.M() < max_mee_vec->at(static_cast(max_mee_vec->size()) - 1)) { + fRegistry.fill(HIST("Track/hTPCNsigmaEl"), pos.tpcInnerParam(), pos.tpcNSigmaEl()); + } + for (int i = 0; i < static_cast(max_mee_vec->size()); i++) { + if (v12.M() < max_mee_vec->at(i)) { + pfb_map[emele.globalIndex()] |= (uint8_t(1) << (static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1) + i)); + } + } + + if (v12.M() < slope * phiv + intercept) { + pfb_map[emele.globalIndex()] |= (uint8_t(1) << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC)); + } + } // end of signal electron loop + } // end of loose positon loop + + for (auto& pos : posTracks_per_coll) { + if (!checkTrack(collision, pos)) { // track cut is applied to loose sample + continue; + } + gpu::gpustd::array dcaInfo; + std::array pVec_recalc = {0, 0, 0}; // px, py, pz + auto track_par_cov_recalc = getTrackParCov(pos); + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, track_par_cov_recalc, 2.f, matCorr, &dcaInfo); + getPxPyPz(track_par_cov_recalc, pVec_recalc); + for (auto& empos : positrons_per_coll) { + if (empos.trackId() == pos.globalIndex()) { + continue; } - } // end of loose positon loop - } // end of signal electron loop + + ROOT::Math::PtEtaPhiMVector v1(empos.pt(), empos.eta(), empos.phi(), o2::constants::physics::MassElectron); // signal track + ROOT::Math::PtEtaPhiMVector v2(track_par_cov_recalc.getPt(), track_par_cov_recalc.getEta(), track_par_cov_recalc.getPhi(), o2::constants::physics::MassElectron); // loose track + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pVec_recalc[0], pVec_recalc[1], pVec_recalc[2], empos.px(), empos.py(), empos.pz(), pos.sign(), empos.sign(), d_bz); + fRegistry.fill(HIST("Pair/before/lspp/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/before/lspp/hMvsPt"), v12.M(), v12.Pt()); + } // end of signal positron loop + } // end of loose positon loop + + for (auto& ele : negTracks_per_coll) { + if (!checkTrack(collision, ele)) { + continue; + } + gpu::gpustd::array dcaInfo; + std::array pVec_recalc = {0, 0, 0}; // px, py, pz + auto track_par_cov_recalc = getTrackParCov(ele); + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, track_par_cov_recalc, 2.f, matCorr, &dcaInfo); + getPxPyPz(track_par_cov_recalc, pVec_recalc); + + for (auto& emele : electrons_per_coll) { + if (emele.trackId() == ele.globalIndex()) { + continue; + } + + ROOT::Math::PtEtaPhiMVector v1(track_par_cov_recalc.getPt(), track_par_cov_recalc.getEta(), track_par_cov_recalc.getPhi(), o2::constants::physics::MassElectron); // loose track + ROOT::Math::PtEtaPhiMVector v2(emele.pt(), emele.eta(), emele.phi(), o2::constants::physics::MassElectron); // signal track + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(emele.px(), emele.py(), emele.pz(), pVec_recalc[0], pVec_recalc[1], pVec_recalc[2], emele.sign(), ele.sign(), d_bz); + fRegistry.fill(HIST("Pair/before/lsmm/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/before/lsmm/hMvsPt"), v12.M(), v12.Pt()); + + } // end of signal electron loop + } // end of loose electron loop posTracks_per_coll.clear(); negTracks_per_coll.clear(); @@ -869,6 +964,26 @@ struct prefilterPrimaryElectron { ele_pfb(pfb_map[ele.globalIndex()]); } + // check prefilter + for (auto& collision : collisions) { + auto positrons_per_coll = positrons->sliceByCachedUnsorted(o2::aod::emprimaryelectron::collisionId, collision.globalIndex(), cache); // signal sample + auto electrons_per_coll = electrons->sliceByCachedUnsorted(o2::aod::emprimaryelectron::collisionId, collision.globalIndex(), cache); // signal sample + + for (auto& [ele, pos] : combinations(CombinationsFullIndexPolicy(electrons_per_coll, positrons_per_coll))) { + if (pfb_map[ele.globalIndex()] != 0 || pfb_map[pos.globalIndex()] != 0) { + continue; + } + + ROOT::Math::PtEtaPhiMVector v1(ele.pt(), ele.eta(), ele.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(pos.pt(), pos.eta(), pos.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos.px(), pos.py(), pos.pz(), ele.px(), ele.py(), ele.pz(), pos.sign(), ele.sign(), d_bz); + fRegistry.fill(HIST("Pair/after/uls/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/after/uls/hMvsPt"), v12.M(), v12.Pt()); + + } // end of ULS pairing + } // end of collision loop + pfb_map.clear(); } PROCESS_SWITCH(prefilterPrimaryElectron, processPrefilter_TTCA, "process prefilter with TTCA", false); @@ -890,6 +1005,21 @@ struct prefilterPrimaryElectron { auto positrons_per_coll = positrons->sliceByCachedUnsorted(o2::aod::emprimaryelectron::collisionId, collision.globalIndex(), cache); // signal sample auto electrons_per_coll = electrons->sliceByCachedUnsorted(o2::aod::emprimaryelectron::collisionId, collision.globalIndex(), cache); // signal sample + for (auto& pos : posTracks_per_coll) { + if (!checkTrack(collision, pos)) { // track cut is applied to loose sample + continue; + } + fRegistry.fill(HIST("Track/hPt"), pos.pt()); + fRegistry.fill(HIST("Track/hEtaPhi"), pos.phi(), pos.eta()); + } + for (auto& neg : negTracks_per_coll) { + if (!checkTrack(collision, neg)) { // track cut is applied to loose sample + continue; + } + fRegistry.fill(HIST("Track/hPt"), neg.pt()); + fRegistry.fill(HIST("Track/hEtaPhi"), neg.phi(), neg.eta()); + } + for (auto& [ele, empos] : combinations(CombinationsFullIndexPolicy(negTracks_per_coll, positrons_per_coll))) { // auto pos = tracks.rawIteratorAt(empos.trackId()); // use rawIterator, if the table is filtered. if (!checkTrack(collision, ele)) { // track cut is applied to loose sample @@ -899,11 +1029,26 @@ struct prefilterPrimaryElectron { continue; } - bool isPC = reconstructPC<-1>(collision, ele, empos); - if (isPC) { - pfb_map[empos.globalIndex()] |= (uint8_t(1) << static_cast(EM_Electron_PF::kElFromPC)); + ROOT::Math::PtEtaPhiMVector v1(ele.pt(), ele.eta(), ele.phi(), o2::constants::physics::MassElectron); // loose track + ROOT::Math::PtEtaPhiMVector v2(empos.pt(), empos.eta(), empos.phi(), o2::constants::physics::MassElectron); // signal track + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(empos.px(), empos.py(), empos.pz(), ele.px(), ele.py(), ele.pz(), empos.sign(), ele.sign(), d_bz); + fRegistry.fill(HIST("Pair/before/uls/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/before/uls/hMvsPt"), v12.M(), v12.Pt()); + if (v12.M() < max_mee_vec->at(static_cast(max_mee_vec->size()) - 1)) { + fRegistry.fill(HIST("Track/hTPCNsigmaEl"), ele.tpcInnerParam(), ele.tpcNSigmaEl()); + } + for (int i = 0; i < static_cast(max_mee_vec->size()); i++) { + if (v12.M() < max_mee_vec->at(i)) { + pfb_map[empos.globalIndex()] |= (uint8_t(1) << (static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1) + i)); + } + } + + if (v12.M() < slope * phiv + intercept) { + pfb_map[empos.globalIndex()] |= (uint8_t(1) << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC)); } - } + + } // end of ULS pairing for (auto& [pos, emele] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, electrons_per_coll))) { // auto ele = tracks.rawIteratorAt(emele.trackId()); // use rawIterator, if the table is filtered. @@ -913,17 +1058,87 @@ struct prefilterPrimaryElectron { if (emele.trackId() == pos.globalIndex()) { continue; } - bool isPC = reconstructPC<+1>(collision, emele, pos); - if (isPC) { - pfb_map[emele.globalIndex()] |= (uint8_t(1) << static_cast(EM_Electron_PF::kElFromPC)); + + ROOT::Math::PtEtaPhiMVector v1(emele.pt(), emele.eta(), emele.phi(), o2::constants::physics::MassElectron); // signal track + ROOT::Math::PtEtaPhiMVector v2(pos.pt(), pos.eta(), pos.phi(), o2::constants::physics::MassElectron); // loose track + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos.px(), pos.py(), pos.pz(), emele.px(), emele.py(), emele.pz(), pos.sign(), emele.sign(), d_bz); + fRegistry.fill(HIST("Pair/before/uls/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/before/uls/hMvsPt"), v12.M(), v12.Pt()); + if (v12.M() < max_mee_vec->at(static_cast(max_mee_vec->size()) - 1)) { + fRegistry.fill(HIST("Track/hTPCNsigmaEl"), pos.tpcInnerParam(), pos.tpcNSigmaEl()); + } + for (int i = 0; i < static_cast(max_mee_vec->size()); i++) { + if (v12.M() < max_mee_vec->at(i)) { + pfb_map[emele.globalIndex()] |= (uint8_t(1) << (static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1) + i)); + } } - } + + if (v12.M() < slope * phiv + intercept) { + pfb_map[emele.globalIndex()] |= (uint8_t(1) << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC)); + } + + } // end of ULS pairing + + for (auto& [pos, empos] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, positrons_per_coll))) { + // auto pos = tracks.rawIteratorAt(empos.trackId()); // use rawIterator, if the table is filtered. + if (!checkTrack(collision, pos)) { // track cut is applied to loose sample + continue; + } + if (empos.trackId() == pos.globalIndex()) { + continue; + } + + ROOT::Math::PtEtaPhiMVector v1(pos.pt(), pos.eta(), pos.phi(), o2::constants::physics::MassElectron); // loose track + ROOT::Math::PtEtaPhiMVector v2(empos.pt(), empos.eta(), empos.phi(), o2::constants::physics::MassElectron); // signal track + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(empos.px(), empos.py(), empos.pz(), pos.px(), pos.py(), pos.pz(), empos.sign(), pos.sign(), d_bz); + fRegistry.fill(HIST("Pair/before/lspp/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/before/lspp/hMvsPt"), v12.M(), v12.Pt()); + } // end of LS++ pairing + + for (auto& [ele, emele] : combinations(CombinationsFullIndexPolicy(negTracks_per_coll, electrons_per_coll))) { + // auto ele = tracks.rawIteratorAt(emele.trackId()); // use rawIterator, if the table is filtered. + if (!checkTrack(collision, ele)) { // track cut is applied to loose sample + continue; + } + if (emele.trackId() == ele.globalIndex()) { + continue; + } + + ROOT::Math::PtEtaPhiMVector v1(ele.pt(), ele.eta(), ele.phi(), o2::constants::physics::MassElectron); // loose track + ROOT::Math::PtEtaPhiMVector v2(emele.pt(), emele.eta(), emele.phi(), o2::constants::physics::MassElectron); // signal track + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(emele.px(), emele.py(), emele.pz(), ele.px(), ele.py(), ele.pz(), emele.sign(), ele.sign(), d_bz); + fRegistry.fill(HIST("Pair/before/lsmm/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/before/lsmm/hMvsPt"), v12.M(), v12.Pt()); + } // end of LS-- pairing + } // end of collision loop for (auto& ele : primaryelectrons) { ele_pfb(pfb_map[ele.globalIndex()]); } + // check prefilter + for (auto& collision : collisions) { + auto positrons_per_coll = positrons->sliceByCachedUnsorted(o2::aod::emprimaryelectron::collisionId, collision.globalIndex(), cache); // signal sample + auto electrons_per_coll = electrons->sliceByCachedUnsorted(o2::aod::emprimaryelectron::collisionId, collision.globalIndex(), cache); // signal sample + + for (auto& [ele, pos] : combinations(CombinationsFullIndexPolicy(electrons_per_coll, positrons_per_coll))) { + if (pfb_map[ele.globalIndex()] != 0 || pfb_map[pos.globalIndex()] != 0) { + continue; + } + + ROOT::Math::PtEtaPhiMVector v1(ele.pt(), ele.eta(), ele.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(pos.pt(), pos.eta(), pos.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos.px(), pos.py(), pos.pz(), ele.px(), ele.py(), ele.pz(), pos.sign(), ele.sign(), d_bz); + fRegistry.fill(HIST("Pair/after/uls/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/after/uls/hMvsPt"), v12.M(), v12.Pt()); + } // end of ULS pairing + } // end of collision loop + pfb_map.clear(); } PROCESS_SWITCH(prefilterPrimaryElectron, processPrefilter_SA, "process prefilter standalone", false); diff --git a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx index fcffa3a2ba6..06c3b4c4a54 100644 --- a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx +++ b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -28,6 +29,7 @@ #include "Framework/HistogramRegistry.h" #include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Centrality.h" #include "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPMagField.h" @@ -49,6 +51,9 @@ using namespace o2::soa; using MyCollisions = Join; using MyCollision = MyCollisions::iterator; +using MyCollisionsCent = soa::Join; +using MyCollisionCent = MyCollisionsCent::iterator; + using MyMCTracks = soa::Join; using MyMCTrack = MyMCTracks::iterator; @@ -70,8 +75,10 @@ struct CreateResolutionMap { Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; Configurable cfgEventGeneratorType{"cfgEventGeneratorType", -1, "if positive, select event generator type. i.e. gap or signal"}; + Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; ConfigurableAxis ConfPtGenBins{"ConfPtGenBins", {VARIABLE_WIDTH, 0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.80, 2.90, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50, 4.60, 4.70, 4.80, 4.90, 5.00, 5.50, 6.00, 6.50, 7.00, 7.50, 8.00, 8.50, 9.00, 9.50, 10.00, 11.00, 12.00, 13.00, 14.00, 15.00, 16.00, 17.00, 18.00, 19.00, 20.00}, "gen. pT bins for output histograms"}; + ConfigurableAxis ConfCentBins{"ConfCentBins", {VARIABLE_WIDTH, 0, 10, 30, 50, 110}, "centrality (%) bins for output histograms"}; ConfigurableAxis ConfEtaCBGenBins{"ConfEtaCBGenBins", {30, -1.5, +1.5}, "gen. eta bins at midrapidity for output histograms"}; ConfigurableAxis ConfEtaFWDGenBins{"ConfEtaFWDGenBins", {40, -5.5, -1.5}, "gen. eta bins at forward rapidity for output histograms"}; @@ -88,6 +95,7 @@ struct CreateResolutionMap { Configurable cfg_max_eta_track{"cfg_max_eta_track", +1.5, "max eta for single track"}; Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 4, "min ncluster its"}; + Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 1, "min ncluster itsib"}; Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 80, "min ncrossed rows"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; @@ -102,7 +110,7 @@ struct CreateResolutionMap { std::string prefix = "muoncut_group"; Configurable cfg_track_type{"cfg_track_type", 3, "muon track type [0: MFT-MCH-MID, 3: MCH-MID]"}; Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.01, "min pT for single track"}; - Configurable cfg_min_eta_track{"cfg_min_eta_track", -5.0, "min eta for single track"}; + Configurable cfg_min_eta_track{"cfg_min_eta_track", -5.5, "min eta for single track"}; Configurable cfg_max_eta_track{"cfg_max_eta_track", -1.5, "max eta for single track"}; Configurable cfg_min_ncluster_mft{"cfg_min_ncluster_mft", 5, "min ncluster MFT"}; Configurable cfg_min_ncluster_mch{"cfg_min_ncluster_mch", 5, "min ncluster MCH"}; @@ -129,6 +137,7 @@ struct CreateResolutionMap { ccdb->setFatalWhenNull(false); ccdbApi.init(ccdburl); + const AxisSpec axis_cent{ConfCentBins, "centrality (%)"}; const AxisSpec axis_pt_gen{ConfPtGenBins, "p_{T,l}^{gen} (GeV/c)"}; const AxisSpec axis_eta_cb_gen{ConfEtaCBGenBins, "#eta_{l}^{gen}"}; const AxisSpec axis_eta_fwd_gen{ConfEtaFWDGenBins, "#eta_{l}^{gen}"}; @@ -138,6 +147,7 @@ struct CreateResolutionMap { const AxisSpec axis_dphi{ConfDeltaPhiBins, "#varphi_{l}^{gen} - #varphi_{l}^{rec} (rad.)"}; const AxisSpec axis_charge_gen{3, -1.5, +1.5, "true sign"}; + registry.add("Event/hImpPar_Centrality", "true imapact parameter vs. estimated centrality;impact parameter (fm);centrality (%)", kTH2F, {{200, 0, 20}, {110, 0, 110}}, true); registry.add("Electron/Ptgen_RelDeltaPt", "resolution", kTH2F, {{axis_pt_gen}, {axis_dpt}}, true); registry.add("Electron/Ptgen_DeltaEta", "resolution", kTH2F, {{axis_pt_gen}, {axis_deta}}, true); registry.add("Electron/Ptgen_DeltaPhi_Pos", "resolution", kTH2F, {{axis_pt_gen}, {axis_dphi}}, true); @@ -145,9 +155,9 @@ struct CreateResolutionMap { registry.addClone("Electron/", "StandaloneMuon/"); registry.addClone("Electron/", "GlobalMuon/"); - registry.add("Electron/hs_reso", "7D resolution positive", kTHnSparseF, {axis_pt_gen, axis_eta_cb_gen, axis_phi_gen, axis_charge_gen, axis_dpt, axis_deta, axis_dphi}, true); - registry.add("StandaloneMuon/hs_reso", "7D resolution positive", kTHnSparseF, {axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_charge_gen, axis_dpt, axis_deta, axis_dphi}, true); - registry.add("GlobalMuon/hs_reso", "7D resolution positive", kTHnSparseF, {axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_charge_gen, axis_dpt, axis_deta, axis_dphi}, true); + registry.add("Electron/hs_reso", "8D resolution positive", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_cb_gen, axis_phi_gen, axis_charge_gen, axis_dpt, axis_deta, axis_dphi}, true); + registry.add("StandaloneMuon/hs_reso", "8D resolution positive", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_charge_gen, axis_dpt, axis_deta, axis_dphi}, true); + registry.add("GlobalMuon/hs_reso", "8D resolution positive", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_charge_gen, axis_dpt, axis_deta, axis_dphi}, true); } void initCCDB(aod::BCsWithTimestamps::iterator const& bc) @@ -185,6 +195,9 @@ struct CreateResolutionMap { if (track.itsNCls() < electroncuts.cfg_min_ncluster_its) { return false; } + if (track.itsNClsInnerBarrel() < electroncuts.cfg_min_ncluster_itsib) { + return false; + } auto hits = std::count_if(itsRequirement_ibany.second.begin(), itsRequirement_ibany.second.end(), [&](auto&& requiredLayer) { return track.itsClusterMap() & (1 << requiredLayer); }); if (hits < itsRequirement_ibany.first) { @@ -268,7 +281,7 @@ struct CreateResolutionMap { } template - bool checkFwdTrack(TMuon const& muon, TCollision const& collision) + bool checkFwdTrack(TMuon const& muon, TCollision const& collision, const float centrality) { o2::dataformats::GlobalFwdTrack propmuonAtPV = PropagateMuon(muon, collision, CreateResolutionMap::MuonExtrapolation::kToVertex); float pt = propmuonAtPV.getPt(); @@ -316,7 +329,7 @@ struct CreateResolutionMap { auto mctrack = muon.template mcParticle_as(); if (muon.trackType() == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack)) { - registry.fill(HIST("StandaloneMuon/hs_reso"), mctrack.pt(), mctrack.eta(), mctrack.phi(), -mctrack.pdgCode() / 13, (mctrack.pt() - pt) / mctrack.pt(), mctrack.eta() - eta, mctrack.phi() - phi); + registry.fill(HIST("StandaloneMuon/hs_reso"), centrality, mctrack.pt(), mctrack.eta(), mctrack.phi(), -mctrack.pdgCode() / 13, (mctrack.pt() - pt) / mctrack.pt(), mctrack.eta() - eta, mctrack.phi() - phi); registry.fill(HIST("StandaloneMuon/Ptgen_RelDeltaPt"), mctrack.pt(), (mctrack.pt() - pt) / mctrack.pt()); registry.fill(HIST("StandaloneMuon/Ptgen_DeltaEta"), mctrack.pt(), mctrack.eta() - eta); if (mctrack.pdgCode() == -13) { // positive muon @@ -325,7 +338,7 @@ struct CreateResolutionMap { registry.fill(HIST("StandaloneMuon/Ptgen_DeltaPhi_Neg"), mctrack.pt(), mctrack.phi() - phi); } } else if (muon.trackType() == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack)) { - registry.fill(HIST("GlobalMuon/hs_reso"), mctrack.pt(), mctrack.eta(), mctrack.phi(), -mctrack.pdgCode() / 13, (mctrack.pt() - pt) / mctrack.pt(), mctrack.eta() - eta, mctrack.phi() - phi); + registry.fill(HIST("GlobalMuon/hs_reso"), centrality, mctrack.pt(), mctrack.eta(), mctrack.phi(), -mctrack.pdgCode() / 13, (mctrack.pt() - pt) / mctrack.pt(), mctrack.eta() - eta, mctrack.phi() - phi); registry.fill(HIST("GlobalMuon/Ptgen_RelDeltaPt"), mctrack.pt(), (mctrack.pt() - pt) / mctrack.pt()); registry.fill(HIST("GlobalMuon/Ptgen_DeltaEta"), mctrack.pt(), mctrack.eta() - eta); if (mctrack.pdgCode() == -13) { // positive muon @@ -343,6 +356,7 @@ struct CreateResolutionMap { Filter collisionFilter = o2::aod::evsel::sel8 == true && nabs(o2::aod::collision::posZ) < 10.f; using MyFilteredCollisions = soa::Filtered; + using MyFilteredCollisionsCent = soa::Filtered; Filter trackFilter_mid = o2::aod::track::pt > electroncuts.cfg_min_pt_track&& electroncuts.cfg_min_eta_track < o2::aod::track::eta&& o2::aod::track::eta < electroncuts.cfg_max_eta_track&& o2::aod::track::tpcChi2NCl < electroncuts.cfg_max_chi2tpc&& o2::aod::track::itsChi2NCl < electroncuts.cfg_max_chi2its&& ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC) == true && nabs(o2::aod::track::dcaXY) < electroncuts.cfg_max_dcaxy&& nabs(o2::aod::track::dcaZ) < electroncuts.cfg_max_dcaz; using MyFilteredMCTracks = soa::Filtered; @@ -350,7 +364,8 @@ struct CreateResolutionMap { Partition sa_muons = o2::aod::fwdtrack::trackType == uint8_t(o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack); // MCH-MID Partition global_muons = o2::aod::fwdtrack::trackType == uint8_t(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack); // MFT-MCH-MID - void process(MyFilteredCollisions const& collisions, aod::BCsWithTimestamps const&, MyFilteredMCTracks const& tracks, MyMCFwdTracks const&, aod::McCollisions const&, aod::McParticles const&) + template + void process(TCollisions const& collisions, aod::BCsWithTimestamps const&, MyFilteredMCTracks const& tracks, MyMCFwdTracks const&, aod::McCollisions const&, aod::McParticles const&) { for (auto& collision : collisions) { auto bc = collision.template foundBC_as(); @@ -365,6 +380,13 @@ struct CreateResolutionMap { continue; } + float centrality = 105.f; + if constexpr (std::is_same_v, MyFilteredCollisionsCent>) { + centrality = std::array{collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}[cfgCentEstimator]; + } + + registry.fill(HIST("Event/hImpPar_Centrality"), mccollision.impactParameter(), centrality); + auto tracks_per_coll = tracks.sliceBy(perCollision_mid, collision.globalIndex()); for (auto& track : tracks_per_coll) { if (!track.has_mcParticle()) { @@ -381,7 +403,7 @@ struct CreateResolutionMap { continue; } - registry.fill(HIST("Electron/hs_reso"), mctrack.pt(), mctrack.eta(), mctrack.phi(), -mctrack.pdgCode() / 11, (mctrack.pt() - track.pt()) / mctrack.pt(), mctrack.eta() - track.eta(), mctrack.phi() - track.phi()); + registry.fill(HIST("Electron/hs_reso"), centrality, mctrack.pt(), mctrack.eta(), mctrack.phi(), -mctrack.pdgCode() / 11, (mctrack.pt() - track.pt()) / mctrack.pt(), mctrack.eta() - track.eta(), mctrack.phi() - track.phi()); registry.fill(HIST("Electron/Ptgen_RelDeltaPt"), mctrack.pt(), (mctrack.pt() - track.pt()) / mctrack.pt()); registry.fill(HIST("Electron/Ptgen_DeltaEta"), mctrack.pt(), mctrack.eta() - track.eta()); if (mctrack.pdgCode() == -11) { // positron @@ -406,7 +428,7 @@ struct CreateResolutionMap { if (abs(mctrack.pdgCode()) != 13 || !(mctrack.isPhysicalPrimary() || mctrack.producedByGenerator())) { continue; } - if (!checkFwdTrack(muon, collision)) { + if (!checkFwdTrack(muon, collision, centrality)) { continue; } } // end of standalone muon loop @@ -422,7 +444,7 @@ struct CreateResolutionMap { if (abs(mctrack.pdgCode()) != 13 || !(mctrack.isPhysicalPrimary() || mctrack.producedByGenerator())) { continue; } - if (!checkFwdTrack(muon, collision)) { + if (!checkFwdTrack(muon, collision, centrality)) { continue; } @@ -430,6 +452,8 @@ struct CreateResolutionMap { } // end of collision loop } + PROCESS_SWITCH_FULL(CreateResolutionMap, process, processWithCent, "create resolution map wit centrality", true); + PROCESS_SWITCH_FULL(CreateResolutionMap, process, processWithoutCent, "create resolution map without centrality", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGEM/Dilepton/Tasks/eventQC.cxx b/PWGEM/Dilepton/Tasks/eventQC.cxx index f7b7784d2e3..830a17cda4a 100644 --- a/PWGEM/Dilepton/Tasks/eventQC.cxx +++ b/PWGEM/Dilepton/Tasks/eventQC.cxx @@ -32,6 +32,7 @@ #include "Common/DataModel/Centrality.h" #include "Common/DataModel/Qvectors.h" #include "Common/DataModel/PIDResponse.h" +// #include "Common/DataModel/PIDResponseITS.h" #include "Common/DataModel/TrackSelectionTables.h" #include "CCDB/BasicCCDBManager.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" @@ -65,8 +66,8 @@ struct eventQC { Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; ConfigurableAxis ConfPtBins{"ConfPtBins", {VARIABLE_WIDTH, 0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pT bins for output histograms"}; - Configurable cfgNbinsEta{"cfgNbinsEta", 40, "number of eta bins for output histograms"}; - Configurable cfgNbinsPhi{"cfgNbinsPhi", 360, "number of phi bins for output histograms"}; + Configurable cfgNbinsEta{"cfgNbinsEta", 20, "number of eta bins for output histograms"}; + Configurable cfgNbinsPhi{"cfgNbinsPhi", 36, "number of phi bins for output histograms"}; struct : ConfigurableGroup { std::string prefix = "eventcut_group"; @@ -99,7 +100,7 @@ struct eventQC { Configurable cfg_min_ncrossedrows_tpc{"cfg_min_ncrossedrows_tpc", 80, "min ncrossed rows"}; Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; - Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 1, "min ncluster its"}; + Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 1, "min ncluster itsib"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; Configurable cfg_max_chi2tof{"cfg_max_chi2tof", 1e+10, "max chi2/NclsTOF"}; @@ -288,18 +289,25 @@ struct eventQC { if (cfgFillPID) { fRegistry.add("Track/hTPCdEdx", "TPC dE/dx;p_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); - fRegistry.add("Track/hTOFbeta", "TOF #beta;p_{pv} (GeV/c);#beta", kTH2F, {{1000, 0, 10}, {240, 0, 1.2}}, false); - fRegistry.add("Track/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); on ITS #times cos(#lambda);", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); fRegistry.add("Track/hTPCNsigmaEl", "TPC n sigma el;p_{in} (GeV/c);n #sigma_{e}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTPCNsigmaMu", "TPC n sigma mu;p_{in} (GeV/c);n #sigma_{#mu}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTPCNsigmaPi", "TPC n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTPCNsigmaKa", "TPC n sigma ka;p_{in} (GeV/c);n #sigma_{K}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTPCNsigmaPr", "TPC n sigma pr;p_{in} (GeV/c);n #sigma_{p}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + + fRegistry.add("Track/hTOFbeta", "TOF #beta;p_{pv} (GeV/c);#beta", kTH2F, {{1000, 0, 10}, {240, 0, 1.2}}, false); fRegistry.add("Track/hTOFNsigmaEl", "TOF n sigma el;p_{pv} (GeV/c);n #sigma_{e}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTOFNsigmaMu", "TOF n sigma mu;p_{pv} (GeV/c);n #sigma_{#mu}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTOFNsigmaPi", "TOF n sigma pi;p_{pv} (GeV/c);n #sigma_{#pi}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTOFNsigmaKa", "TOF n sigma ka;p_{pv} (GeV/c);n #sigma_{K}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTOFNsigmaPr", "TOF n sigma pr;p_{pv} (GeV/c);n #sigma_{p}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + + fRegistry.add("Track/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); on ITS #times cos(#lambda);", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); + // fRegistry.add("Track/hITSNsigmaEl", "ITS n sigma el;p_{in} (GeV/c);n #sigma_{e}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + // fRegistry.add("Track/hITSNsigmaMu", "ITS n sigma mu;p_{in} (GeV/c);n #sigma_{#mu}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + // fRegistry.add("Track/hITSNsigmaPi", "ITS n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + // fRegistry.add("Track/hITSNsigmaKa", "ITS n sigma ka;p_{in} (GeV/c);n #sigma_{K}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + // fRegistry.add("Track/hITSNsigmaPr", "ITS n sigma pr;p_{in} (GeV/c);n #sigma_{p}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); } } @@ -352,19 +360,27 @@ struct eventQC { for (int il = 0; il < 7; il++) { nsize += track.itsClsSizeInLayer(il); } + fRegistry.fill(HIST("Track/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); - fRegistry.fill(HIST("Track/hTOFbeta"), track.p(), track.beta()); - fRegistry.fill(HIST("Track/hMeanClusterSizeITS"), track.p(), static_cast(nsize) / static_cast(track.itsNCls()) * std::cos(std::atan(track.tgl()))); fRegistry.fill(HIST("Track/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); fRegistry.fill(HIST("Track/hTPCNsigmaMu"), track.tpcInnerParam(), track.tpcNSigmaMu()); fRegistry.fill(HIST("Track/hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); fRegistry.fill(HIST("Track/hTPCNsigmaKa"), track.tpcInnerParam(), track.tpcNSigmaKa()); fRegistry.fill(HIST("Track/hTPCNsigmaPr"), track.tpcInnerParam(), track.tpcNSigmaPr()); + + fRegistry.fill(HIST("Track/hTOFbeta"), track.p(), track.beta()); fRegistry.fill(HIST("Track/hTOFNsigmaEl"), track.p(), track.tofNSigmaEl()); fRegistry.fill(HIST("Track/hTOFNsigmaMu"), track.p(), track.tofNSigmaMu()); fRegistry.fill(HIST("Track/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); fRegistry.fill(HIST("Track/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); fRegistry.fill(HIST("Track/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); + + fRegistry.fill(HIST("Track/hMeanClusterSizeITS"), track.p(), static_cast(nsize) / static_cast(track.itsNCls()) * std::cos(std::atan(track.tgl()))); + // fRegistry.fill(HIST("Track/hITSNsigmaEl"), track.p(), track.itsNSigmaEl()); + // fRegistry.fill(HIST("Track/hITSNsigmaMu"), track.p(), track.itsNSigmaMu()); + // fRegistry.fill(HIST("Track/hITSNsigmaPi"), track.p(), track.itsNSigmaPi()); + // fRegistry.fill(HIST("Track/hITSNsigmaKa"), track.p(), track.itsNSigmaKa()); + // fRegistry.fill(HIST("Track/hITSNsigmaPr"), track.p(), track.itsNSigmaPr()); } } @@ -820,10 +836,7 @@ struct eventQC { // for V0 PID if constexpr (doV0s) { - auto v0photons_per_coll = v0photons.sliceBy(perCol_pcm, collision.globalIndex()); auto v0hadrons_per_coll = v0strhadrons.sliceBy(perCol_v0, collision.globalIndex()); - // LOGF(info, "v0photons_per_coll.size() = %d, v0hadrons_per_coll.size() = %d", v0photons_per_coll.size(), v0hadrons_per_coll.size()); - for (auto& v0hadron : v0hadrons_per_coll) { fRegistry.fill(HIST("V0/hAP"), v0hadron.alpha(), v0hadron.qtarm()); fRegistry.fill(HIST("V0/hPCA"), v0hadron.dcaV0daughters()); @@ -856,6 +869,7 @@ struct eventQC { } } // end of v0hadron loop + auto v0photons_per_coll = v0photons.sliceBy(perCol_pcm, collision.globalIndex()); for (auto& v0photon : v0photons_per_coll) { fRegistry.fill(HIST("V0/Photon/hMass"), v0photon.mGamma(), v0photon.pt()); fRegistry.fill(HIST("V0/Photon/hXY"), v0photon.vx(), v0photon.vy()); @@ -884,12 +898,14 @@ struct eventQC { void processEventQC(FilteredMyCollisions const& collisions, FilteredMyTracks const& tracks) { + // auto tracksWithITSPid = soa::Attach(tracks); runQC(collisions, tracks, nullptr, nullptr, nullptr); } PROCESS_SWITCH(eventQC, processEventQC, "event QC", true); void processEventQC_Cent_Qvec(FilteredMyCollisions_Qvec const& collisions, FilteredMyTracks const& tracks) { + // auto tracksWithITSPid = soa::Attach(tracks); runQC(collisions, tracks, nullptr, nullptr, nullptr); } PROCESS_SWITCH(eventQC, processEventQC_Cent_Qvec, "event QC + q vector", false); @@ -900,6 +916,7 @@ struct eventQC { void processEventQC_V0_PID(FilteredMyCollisions const& collisions, FilteredMyTracks const& tracks, aod::V0PhotonsKF const& v0photons, aod::V0Legs const& v0legs, filteredV0s const& v0strhadrons) { + // auto tracksWithITSPid = soa::Attach(tracks); runQC(collisions, tracks, v0photons, v0legs, v0strhadrons); } PROCESS_SWITCH(eventQC, processEventQC_V0_PID, "event QC + V0 PID", false); diff --git a/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx b/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx index a34896e5031..59d9d0ac002 100644 --- a/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx +++ b/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx @@ -56,7 +56,7 @@ using MyTracks = soa::Join pfb_pi0; + Produces pfb_derived; // Configurables Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -386,18 +386,18 @@ struct prefilterDielectron { fRegistry.fill(HIST("Pair/before/uls/hDeltaEtaDeltaPhi"), dphi, deta); if (dielectroncuts.cfg_min_mass < v12.M() && v12.M() < dielectroncuts.cfg_max_mass) { - map_pfb[pos.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kMee); - map_pfb[ele.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kMee); + map_pfb[pos.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee); + map_pfb[ele.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee); } if (dielectroncuts.cfg_apply_phiv && ((v12.M() < dielectroncuts.cfg_phiv_slope * phiv + dielectroncuts.cfg_phiv_intercept) && (dielectroncuts.cfg_min_phiv < phiv && phiv < dielectroncuts.cfg_max_phiv))) { - map_pfb[pos.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kPhiV); - map_pfb[ele.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kPhiV); + map_pfb[pos.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kPhiV); + map_pfb[ele.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kPhiV); } if (dielectroncuts.cfg_apply_detadphi_uls && std::pow(deta / dielectroncuts.cfg_min_deta_uls, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi_uls, 2) < 1.f) { - map_pfb[pos.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackULS); - map_pfb[ele.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackULS); + map_pfb[pos.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS); + map_pfb[ele.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS); } } @@ -420,8 +420,8 @@ struct prefilterDielectron { fRegistry.fill(HIST("Pair/before/lspp/hDeltaEtaDeltaPhi"), dphi, deta); if (dielectroncuts.cfg_apply_detadphi_ls && std::pow(deta / dielectroncuts.cfg_min_deta_ls, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi_ls, 2) < 1.f) { - map_pfb[pos1.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLS); - map_pfb[pos2.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLS); + map_pfb[pos1.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS); + map_pfb[pos2.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS); } } @@ -444,8 +444,8 @@ struct prefilterDielectron { fRegistry.fill(HIST("Pair/before/lsmm/hDeltaEtaDeltaPhi"), dphi, deta); if (dielectroncuts.cfg_apply_detadphi_ls && std::pow(deta / dielectroncuts.cfg_min_deta_ls, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi_ls, 2) < 1.f) { - map_pfb[ele1.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLS); - map_pfb[ele2.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLS); + map_pfb[ele1.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS); + map_pfb[ele2.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS); } } @@ -453,7 +453,7 @@ struct prefilterDielectron { for (auto& track : tracks) { // LOGF(info, "map_pfb[%d] = %d", track.globalIndex(), map_pfb[track.globalIndex()]); - pfb_pi0(map_pfb[track.globalIndex()]); + pfb_derived(map_pfb[track.globalIndex()]); } // end of track loop // check pfb. @@ -542,7 +542,7 @@ struct prefilterDielectron { void processDummy(MyTracks const& tracks) { for (int i = 0; i < tracks.size(); i++) { - pfb_pi0(0); + pfb_derived(0); } } PROCESS_SWITCH(prefilterDielectron, processDummy, "dummy", true); diff --git a/PWGEM/Dilepton/Tasks/smearing.cxx b/PWGEM/Dilepton/Tasks/smearing.cxx index 82944dc48a0..0069a283f6f 100644 --- a/PWGEM/Dilepton/Tasks/smearing.cxx +++ b/PWGEM/Dilepton/Tasks/smearing.cxx @@ -13,6 +13,7 @@ // Analysis task to produce smeared pt, eta, phi for electrons/muons in dilepton analysis // Please write to: daiki.sekihata@cern.ch +#include #include #include @@ -24,7 +25,7 @@ #include "Framework/ASoA.h" #include "Framework/DataTypes.h" #include "Framework/HistogramRegistry.h" -#include "PWGDQ/DataModel/ReducedInfoTables.h" // remove this later, because 2 data tables (covariant matrix) in this header confilict against EM tables. +// #include "PWGDQ/DataModel/ReducedInfoTables.h" // remove this later, because 2 data tables (covariant matrix) in this header confilict against EM tables. #include "PWGEM/Dilepton/Utils/MomentumSmearer.h" #include "PWGEM/Dilepton/DataModel/dileptonTables.h" @@ -33,17 +34,30 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::aod; +namespace o2::aod::pwgem::dilepton::smearing +{ +enum class EMAnaType : int { + kEfficiency = 0, + kCocktail = 1, +}; +} // namespace o2::aod::pwgem::dilepton::smearing + struct ApplySmearing { + Produces smearedelectron; Produces smearedmuon; Configurable fFromCcdb{"cfgFromCcdb", false, "get resolution and efficiency histos from CCDB"}; Configurable fConfigCcdbUrl{"cfgCcdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable fTimestamp{"cfgCcdbTimestamp", 10, "valid timestamp of CCDB object"}; + Configurable fCentralityForCocktail{"cfgCentralityForCocktail", 5, "average centrality for cocktail"}; + Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; struct : ConfigurableGroup { std::string prefix = "electron_filename_group"; + Configurable fConfigNDSmearing{"cfgNDSmearing", false, "apply ND-correlated smearing"}; Configurable fConfigResFileName{"cfgResFileName", "", "name of resolution file"}; + Configurable fConfigResNDHistName{"cfgResNDHistName", "hs_reso", "name of ND resolution file"}; Configurable fConfigResPtHistName{"cfgResPtHistName", "RelPtResArrCocktail", "histogram name for pt in resolution file"}; Configurable fConfigResEtaHistName{"cfgResEtaHistName", "EtaResArr", "histogram name for eta in resolution file"}; Configurable fConfigResPhiPosHistName{"cfgResPhiPosHistName", "PhiPosResArr", "histogram name for phi pos in resolution file"}; @@ -55,11 +69,14 @@ struct ApplySmearing { Configurable fConfigCcdbPathRes{"cfgCcdbPathRes", "", "path to the ccdb object for resolution"}; Configurable fConfigCcdbPathEff{"cfgCcdbPahtEff", "", "path to the ccdb object for efficiency"}; Configurable fConfigCcdbPathDCA{"cfgCcdbPahtDCA", "", "path to the ccdb object for dca"}; + Configurable fConfigMinPt{"cfgMinPt", -1, "if ptgen is smaller than this threshold, this value is used as input for ptgen."}; } electron_filenames; struct : ConfigurableGroup { std::string prefix = "sa_muon_filename_group"; + Configurable fConfigNDSmearing{"cfgNDSmearing", false, "apply ND-correlated smearing"}; Configurable fConfigResFileName{"cfgResFileName", "", "name of resolution file"}; + Configurable fConfigResNDHistName{"cfgResNDHistName", "hs_reso", "name of ND resolution file"}; Configurable fConfigResPtHistName{"cfgResPtHistName", "RelPtResArrCocktail", "histogram name for pt in resolution file"}; Configurable fConfigResEtaHistName{"cfgResEtaHistName", "EtaResArr", "histogram name for eta in resolution file"}; Configurable fConfigResPhiPosHistName{"cfgResPhiPosHistName", "PhiPosResArr", "histogram name for phi pos in resolution file"}; @@ -71,11 +88,14 @@ struct ApplySmearing { Configurable fConfigCcdbPathRes{"cfgCcdbPathRes", "", "path to the ccdb object for resolution"}; Configurable fConfigCcdbPathEff{"cfgCcdbPahtEff", "", "path to the ccdb object for efficiency"}; Configurable fConfigCcdbPathDCA{"cfgCcdbPahtDCA", "", "path to the ccdb object for dca"}; + Configurable fConfigMinPt{"cfgMinPt", -1, "if ptgen is smaller than this threshold, this value is used as input for ptgen."}; } sa_muon_filenames; struct : ConfigurableGroup { std::string prefix = "gl_muon_filename_group"; + Configurable fConfigNDSmearing{"cfgNDSmearing", false, "apply ND-correlated smearing"}; Configurable fConfigResFileName{"cfgResFileName", "", "name of resolution file"}; + Configurable fConfigResNDHistName{"cfgResNDHistName", "hs_reso", "name of ND resolution file"}; Configurable fConfigResPtHistName{"cfgResPtHistName", "RelPtResArrCocktail", "histogram name for pt in resolution file"}; Configurable fConfigResEtaHistName{"cfgResEtaHistName", "EtaResArr", "histogram name for eta in resolution file"}; Configurable fConfigResPhiPosHistName{"cfgResPhiPosHistName", "PhiPosResArr", "histogram name for phi pos in resolution file"}; @@ -87,6 +107,7 @@ struct ApplySmearing { Configurable fConfigCcdbPathRes{"cfgCcdbPathRes", "", "path to the ccdb object for resolution"}; Configurable fConfigCcdbPathEff{"cfgCcdbPahtEff", "", "path to the ccdb object for efficiency"}; Configurable fConfigCcdbPathDCA{"cfgCcdbPahtDCA", "", "path to the ccdb object for dca"}; + Configurable fConfigMinPt{"cfgMinPt", -1, "if ptgen is smaller than this threshold, this value is used as input for ptgen."}; } gl_muon_filenames; MomentumSmearer smearer_Electron; @@ -96,7 +117,9 @@ struct ApplySmearing { void init(InitContext&) { + smearer_Electron.setNDSmearing(electron_filenames.fConfigNDSmearing.value); smearer_Electron.setResFileName(TString(electron_filenames.fConfigResFileName)); + smearer_Electron.setResNDHistName(TString(electron_filenames.fConfigResNDHistName)); smearer_Electron.setResPtHistName(TString(electron_filenames.fConfigResPtHistName)); smearer_Electron.setResEtaHistName(TString(electron_filenames.fConfigResEtaHistName)); smearer_Electron.setResPhiPosHistName(TString(electron_filenames.fConfigResPhiPosHistName)); @@ -105,8 +128,11 @@ struct ApplySmearing { smearer_Electron.setEffHistName(TString(electron_filenames.fConfigEffHistName)); smearer_Electron.setDCAFileName(TString(electron_filenames.fConfigDCAFileName)); smearer_Electron.setDCAHistName(TString(electron_filenames.fConfigDCAHistName)); + smearer_Electron.setMinPt(electron_filenames.fConfigMinPt); + smearer_StandaloneMuon.setNDSmearing(sa_muon_filenames.fConfigNDSmearing.value); smearer_StandaloneMuon.setResFileName(TString(sa_muon_filenames.fConfigResFileName)); + smearer_StandaloneMuon.setResNDHistName(TString(sa_muon_filenames.fConfigResNDHistName)); smearer_StandaloneMuon.setResPtHistName(TString(sa_muon_filenames.fConfigResPtHistName)); smearer_StandaloneMuon.setResEtaHistName(TString(sa_muon_filenames.fConfigResEtaHistName)); smearer_StandaloneMuon.setResPhiPosHistName(TString(sa_muon_filenames.fConfigResPhiPosHistName)); @@ -115,8 +141,11 @@ struct ApplySmearing { smearer_StandaloneMuon.setEffHistName(TString(sa_muon_filenames.fConfigEffHistName)); smearer_StandaloneMuon.setDCAFileName(TString(sa_muon_filenames.fConfigDCAFileName)); smearer_StandaloneMuon.setDCAHistName(TString(sa_muon_filenames.fConfigDCAHistName)); + smearer_StandaloneMuon.setMinPt(sa_muon_filenames.fConfigMinPt); + smearer_GlobalMuon.setNDSmearing(gl_muon_filenames.fConfigNDSmearing.value); smearer_GlobalMuon.setResFileName(TString(gl_muon_filenames.fConfigResFileName)); + smearer_GlobalMuon.setResNDHistName(TString(gl_muon_filenames.fConfigResNDHistName)); smearer_GlobalMuon.setResPtHistName(TString(gl_muon_filenames.fConfigResPtHistName)); smearer_GlobalMuon.setResEtaHistName(TString(gl_muon_filenames.fConfigResEtaHistName)); smearer_GlobalMuon.setResPhiPosHistName(TString(gl_muon_filenames.fConfigResPhiPosHistName)); @@ -125,6 +154,7 @@ struct ApplySmearing { smearer_GlobalMuon.setEffHistName(TString(gl_muon_filenames.fConfigEffHistName)); smearer_GlobalMuon.setDCAFileName(TString(gl_muon_filenames.fConfigDCAFileName)); smearer_GlobalMuon.setDCAHistName(TString(gl_muon_filenames.fConfigDCAHistName)); + smearer_GlobalMuon.setMinPt(gl_muon_filenames.fConfigMinPt); if (fFromCcdb) { ccdb->setURL(fConfigCcdbUrl); @@ -155,8 +185,10 @@ struct ApplySmearing { smearer_GlobalMuon.init(); } - template - void applySmearing(TTracksMC const& tracksMC) + PresliceUnsorted recColperMcCollision = aod::emmceventlabel::emmceventId; + + template + void applySmearing(TTracksMC const& tracksMC, TCollisions const& collisions, TMCCollisions const&) { for (auto& mctrack : tracksMC) { float ptgen = mctrack.pt(); @@ -165,6 +197,32 @@ struct ApplySmearing { float efficiency = 1.; float dca = 0.; + float ptsmeared = 0, etasmeared = 0, phismeared = 0; + float centrality = -1.f; + if constexpr (type == o2::aod::pwgem::dilepton::smearing::EMAnaType::kEfficiency) { + auto mccollision = mctrack.template emmcevent_as(); + auto rec_colls_per_mccoll = collisions.sliceBy(recColperMcCollision, mccollision.globalIndex()); + uint32_t maxNumContrib = 0; + int rec_col_globalIndex = -999; + for (auto& rec_col : rec_colls_per_mccoll) { + if (rec_col.numContrib() > maxNumContrib) { + rec_col_globalIndex = rec_col.globalIndex(); + maxNumContrib = rec_col.numContrib(); // assign mc collision to collision where the number of contibutor is lager. LF/MM recommendation + } + } + + if (rec_colls_per_mccoll.size() > 0) { // if mc collisions are not reconstructed, such mc collisions should not enter efficiency calculation. + auto collision = collisions.rawIteratorAt(rec_col_globalIndex); + centrality = std::array{collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}[cfgCentEstimator]; + } else { + ptsmeared = ptgen; + etasmeared = etagen; + phismeared = phigen; + } + } else { + centrality = fCentralityForCocktail; + } + int pdgCode = mctrack.pdgCode(); if (abs(pdgCode) == 11) { int ch = -1; @@ -172,8 +230,7 @@ struct ApplySmearing { ch = 1; } // apply smearing for electrons or muons. - float ptsmeared, etasmeared, phismeared; - smearer_Electron.applySmearing(ch, ptgen, etagen, phigen, ptsmeared, etasmeared, phismeared); + smearer_Electron.applySmearing(centrality, ch, ptgen, etagen, phigen, ptsmeared, etasmeared, phismeared); // get the efficiency efficiency = smearer_Electron.getEfficiency(ptgen, etagen, phigen); // get DCA @@ -188,13 +245,13 @@ struct ApplySmearing { } // apply smearing for muons based on resolution map of standalone muons float ptsmeared_sa = 0.f, etasmeared_sa = 0.f, phismeared_sa = 0.f, efficiency_sa = 1.f, dca_sa = 0.f; - smearer_StandaloneMuon.applySmearing(ch, ptgen, etagen, phigen, ptsmeared_sa, etasmeared_sa, phismeared_sa); + smearer_StandaloneMuon.applySmearing(centrality, ch, ptgen, etagen, phigen, ptsmeared_sa, etasmeared_sa, phismeared_sa); efficiency_sa = smearer_StandaloneMuon.getEfficiency(ptgen, etagen, phigen); dca_sa = smearer_StandaloneMuon.getDCA(ptsmeared_sa); float ptsmeared_gl = 0.f, etasmeared_gl = 0.f, phismeared_gl = 0.f, efficiency_gl = 1.f, dca_gl = 0.f; // apply smearing for muons based on resolution map of global muons - smearer_GlobalMuon.applySmearing(ch, ptgen, etagen, phigen, ptsmeared_gl, etasmeared_gl, phismeared_gl); + smearer_GlobalMuon.applySmearing(centrality, ch, ptgen, etagen, phigen, ptsmeared_gl, etasmeared_gl, phismeared_gl); efficiency_gl = smearer_GlobalMuon.getEfficiency(ptgen, etagen, phigen); dca_gl = smearer_GlobalMuon.getDCA(ptsmeared_gl); smearedmuon(ptsmeared_sa, etasmeared_sa, phismeared_sa, efficiency_sa, dca_sa, ptsmeared_gl, etasmeared_gl, phismeared_gl, efficiency_gl, dca_gl); @@ -205,22 +262,22 @@ struct ApplySmearing { smearedelectron(ptgen, etagen, phigen, efficiency, dca); smearedmuon(ptgen, etagen, phigen, efficiency, dca, ptgen, etagen, phigen, efficiency, dca); } - } + } // end of mc track loop } - void processMCanalysisEM(aod::EMMCParticles const& tracksMC) + void processMCanalysisEM(aod::EMMCParticles const& tracksMC, soa::Join const& collisions, aod::EMMCEvents const& mccollisions) { - applySmearing(tracksMC); + applySmearing(tracksMC, collisions, mccollisions); } - void processMCanalysisDQ(ReducedMCTracks const& tracksMC) - { - applySmearing(tracksMC); - } + // void processMCanalysisDQ(ReducedMCTracks const& tracksMC) + // { + // applySmearing(tracksMC); + // } void processCocktail(aod::McParticles const& tracksMC) { - applySmearing(tracksMC); + applySmearing(tracksMC, nullptr, nullptr); } void processDummyCocktail(aod::McParticles const& tracksMC) @@ -239,19 +296,21 @@ struct ApplySmearing { } } - void processDummyMCanalysis(ReducedMCTracks const&) {} + void processDummyMCanalysisEM(aod::EMMCParticles const&) {} + // void processDummyMCanalysisDQ(ReducedMCTracks const&) {} PROCESS_SWITCH(ApplySmearing, processMCanalysisEM, "Run for MC analysis which uses skimmed EM data format", false); - PROCESS_SWITCH(ApplySmearing, processMCanalysisDQ, "Run for MC analysis which uses skimmed DQ data format", false); + // PROCESS_SWITCH(ApplySmearing, processMCanalysisDQ, "Run for MC analysis which uses skimmed DQ data format", false); PROCESS_SWITCH(ApplySmearing, processCocktail, "Run for cocktail analysis", false); - PROCESS_SWITCH(ApplySmearing, processDummyMCanalysis, "Dummy process function", false); + PROCESS_SWITCH(ApplySmearing, processDummyMCanalysisEM, "Dummy process function", false); + // PROCESS_SWITCH(ApplySmearing, processDummyMCanalysisDQ, "Dummy process function", false); PROCESS_SWITCH(ApplySmearing, processDummyCocktail, "Dummy process function", true); }; struct CheckSmearing { using EMMCParticlesWithSmearing = soa::Join; // this is only for electrons - using MyReducedTracks = soa::Join; // this is only for electrons - using MyCocktailTracks = soa::Join; // this is only for electrons + // using MyReducedTracks = soa::Join; // this is only for electrons + using MyCocktailTracks = soa::Join; // this is only for electrons // Run for electrons or muons Configurable fPdgCode{"cfgPdgCode", 11, "Set the type of particle to be checked"}; @@ -291,14 +350,24 @@ struct CheckSmearing { } } - template - void Check(TTracksMC const& tracksMC) + PresliceUnsorted recColperMcCollision = aod::emmceventlabel::emmceventId; + + template + void Check(TTracksMC const& tracksMC, TCollisions const& collisions, TMCCollisions const&) { for (auto& mctrack : tracksMC) { if (abs(mctrack.pdgCode()) != fPdgCode) { continue; } + if constexpr (type == o2::aod::pwgem::dilepton::smearing::EMAnaType::kEfficiency) { + auto mccollision = mctrack.template emmcevent_as(); + auto rec_colls_per_mccoll = collisions.sliceBy(recColperMcCollision, mccollision.globalIndex()); + if (rec_colls_per_mccoll.size() < 1) { // if mc collisions are not reconstructed, such mc collisions should not enter efficiency calculation. + continue; + } + } + float deltaptoverpt = -1000.; if (mctrack.pt() > 0.) deltaptoverpt = (mctrack.pt() - mctrack.ptSmeared()) / mctrack.pt(); @@ -317,30 +386,30 @@ struct CheckSmearing { } // end of mctrack loop } - void processCheckMCanalysisEM(EMMCParticlesWithSmearing const& tracksMC) + void processCheckMCanalysisEM(EMMCParticlesWithSmearing const& tracksMC, soa::Join const& collisions, aod::EMMCEvents const& mccollisions) { - Check(tracksMC); + Check(tracksMC, collisions, mccollisions); } - void processCheckMCanalysisDQ(MyReducedTracks const& tracksMC) - { - Check(tracksMC); - } + // void processCheckMCanalysisDQ(MyReducedTracks const& tracksMC) + // { + // Check(tracksMC); + // } void processCheckCocktail(MyCocktailTracks const& tracksMC) { - Check(tracksMC); + Check(tracksMC, nullptr, nullptr); } void processDummyMCanalysisEM(aod::EMMCParticles const&) {} - void processDummyMCanalysisDQ(ReducedMCTracks const&) {} + // void processDummyMCanalysisDQ(ReducedMCTracks const&) {} void processDummyCocktail(aod::McParticles const&) {} PROCESS_SWITCH(CheckSmearing, processCheckMCanalysisEM, "Run for MC analysis", false); - PROCESS_SWITCH(CheckSmearing, processCheckMCanalysisDQ, "Run for MC analysis", false); + // PROCESS_SWITCH(CheckSmearing, processCheckMCanalysisDQ, "Run for MC analysis", false); PROCESS_SWITCH(CheckSmearing, processCheckCocktail, "Run for cocktail analysis", false); PROCESS_SWITCH(CheckSmearing, processDummyMCanalysisEM, "Dummy process function", false); - PROCESS_SWITCH(CheckSmearing, processDummyMCanalysisDQ, "Dummy process function", false); + // PROCESS_SWITCH(CheckSmearing, processDummyMCanalysisDQ, "Dummy process function", false); PROCESS_SWITCH(CheckSmearing, processDummyCocktail, "Dummy process function", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGEM/Dilepton/Utils/MomentumSmearer.h b/PWGEM/Dilepton/Utils/MomentumSmearer.h index 002e7d6d247..7e36dcfed0f 100644 --- a/PWGEM/Dilepton/Utils/MomentumSmearer.h +++ b/PWGEM/Dilepton/Utils/MomentumSmearer.h @@ -15,13 +15,18 @@ #ifndef PWGEM_DILEPTON_UTILS_MOMENTUMSMEARER_H_ #define PWGEM_DILEPTON_UTILS_MOMENTUMSMEARER_H_ -#include +#include + +#include +#include +#include +#include #include #include #include #include -#include -#include + +#include "CCDB/BasicCCDBManager.h" #include "Framework/Logger.h" using namespace o2::framework; @@ -48,6 +53,23 @@ class MomentumSmearer init(); } + /// Constructor with resolution ND sparse histogram + MomentumSmearer(TString resFileName, TString resNDHistName) + { + setResFileName(resFileName); + setResNDHistName(resNDHistName); + setResPtHistName(""); + setResEtaHistName(""); + setResPhiPosHistName(""); + setResPhiNegHistName(""); + setEffFileName(""); + setEffHistName(""); + setDCAFileName(""); + setDCAHistName(""); + fDoNDSmearing = true; + init(); + } + /// Constructor with resolution histograms and efficiency MomentumSmearer(TString resFileName, TString resPtHistName, TString resEtaHistName, TString resPhiPosHistName, TString resPhiNegHistName, TString effFileName, TString effHistName) { @@ -115,10 +137,52 @@ class MomentumSmearer } } + void fillVecResoND(THnSparseF* hs_reso) + { + LOGP(info, "prepare TH3D"); + fNCenBins = hs_reso->GetAxis(0)->GetNbins(); + fNPtBins = hs_reso->GetAxis(1)->GetNbins(); + fNEtaBins = hs_reso->GetAxis(2)->GetNbins(); + fNPhiBins = hs_reso->GetAxis(3)->GetNbins(); + fNChBins = hs_reso->GetAxis(4)->GetNbins(); + LOGF(info, "ncen = %d, npt = %d, neta = %d, nphi = %d, nch = %d without under- and overflow bins", fNCenBins, fNPtBins, fNEtaBins, fNPhiBins, fNChBins); + // fVecResoND.reserve(npt * neta * nphi * nch); + + fVecResoND.resize(fNCenBins, std::vector>>>(fNPtBins, std::vector>>(fNEtaBins, std::vector>(fNPhiBins, std::vector(fNChBins))))); + // fVecResoND.resize(fNPtBins, std::vector>>(fNEtaBins, std::vector>(fNPhiBins, std::vector(fNChBins)))); + // auto h3 = reinterpret_cast(hs_reso->Projection(4, 5, 6)); + // h3->SetName(Form("h3reso_pt%d_eta%d_phi%d_ch%d", 0, 0, 0, 0)); + // fVecResoND[0][0][0][0] = h3; + + for (int icen = 0; icen < fNCenBins; icen++) { + hs_reso->GetAxis(0)->SetRange(icen + 1, icen + 1); + for (int ipt = 0; ipt < fNPtBins; ipt++) { + hs_reso->GetAxis(1)->SetRange(ipt + 1, ipt + 1); + for (int ieta = 0; ieta < fNEtaBins; ieta++) { + hs_reso->GetAxis(2)->SetRange(ieta + 1, ieta + 1); + for (int iphi = 0; iphi < fNPhiBins; iphi++) { + hs_reso->GetAxis(3)->SetRange(iphi + 1, iphi + 1); + for (int ich = 0; ich < fNChBins; ich++) { + if (-0.5 < hs_reso->GetAxis(4)->GetBinCenter(ich + 1) && hs_reso->GetAxis(4)->GetBinCenter(ich + 1) < 0.5) { + continue; + } + hs_reso->GetAxis(4)->SetRange(ich + 1, ich + 1); + auto h3 = reinterpret_cast(hs_reso->Projection(5, 6, 7)); + h3->SetName(Form("h3reso_cen%d_pt%d_eta%d_phi%d_ch%d", icen, ipt, ieta, iphi, ich)); + h3->Scale(1.f, "width"); // convert ntrack to probability density + fVecResoND[icen][ipt][ieta][iphi][ich] = h3; + } // end of charge loop + } // end of phi loop + } // end of eta loop + } // end of pt loop + } // end of centrality loop + } + void init() { - if (fInitialized) + if (fInitialized) { return; + } if ((fResFileName.BeginsWith("alien://") || fEffFileName.BeginsWith("alien://") || fDCAFileName.BeginsWith("alien://")) && (!fFromCcdb)) { TGrid::Connect("alien://"); @@ -156,34 +220,48 @@ class MomentumSmearer fFile->Close(); } } - if (fResType != 0) { - fResoPt = reinterpret_cast(listRes->FindObject(fResPtHistName)); - if (!fResoPt) { - LOGP(fatal, "Could not open {} from file {}", fResPtHistName.Data(), fResFileName.Data()); - } - fResoEta = reinterpret_cast(listRes->FindObject(fResEtaHistName)); - if (!fResoEta) { - LOGP(fatal, "Could not open {} from file {}", fResEtaHistName.Data(), fResFileName.Data()); - } + LOGF(info, "Apply ND-correlated smearing: fDoNDSmearing = %d , fResNDHistName = %s", fDoNDSmearing, fResNDHistName.Data()); - fResoPhi_Pos = reinterpret_cast(listRes->FindObject(fResPhiPosHistName)); - if (!fResoPhi_Pos) { - LOGP(fatal, "Could not open {} from file {}", fResPhiPosHistName.Data(), fResFileName.Data()); + if (fDoNDSmearing) { + if (fResType != 0) { + fResoND = reinterpret_cast(listRes->FindObject(fResNDHistName)); + if (!fResoND) { + LOGP(fatal, "Could not open {} from file {}", fResNDHistName.Data(), fResFileName.Data()); + } + fillVecResoND(fResoND); } + } else { + if (fResType != 0) { + fResoPt = reinterpret_cast(listRes->FindObject(fResPtHistName)); + if (!fResoPt) { + LOGP(fatal, "Could not open {} from file {}", fResPtHistName.Data(), fResFileName.Data()); + } + + fResoEta = reinterpret_cast(listRes->FindObject(fResEtaHistName)); + if (!fResoEta) { + LOGP(fatal, "Could not open {} from file {}", fResEtaHistName.Data(), fResFileName.Data()); + } + + fResoPhi_Pos = reinterpret_cast(listRes->FindObject(fResPhiPosHistName)); + if (!fResoPhi_Pos) { + LOGP(fatal, "Could not open {} from file {}", fResPhiPosHistName.Data(), fResFileName.Data()); + } - fResoPhi_Neg = reinterpret_cast(listRes->FindObject(fResPhiNegHistName)); - if (!fResoPhi_Neg) { - LOGP(fatal, "Could not open {} from file {}", fResPhiNegHistName.Data(), fResFileName.Data()); + fResoPhi_Neg = reinterpret_cast(listRes->FindObject(fResPhiNegHistName)); + if (!fResoPhi_Neg) { + LOGP(fatal, "Could not open {} from file {}", fResPhiNegHistName.Data(), fResFileName.Data()); + } + fillVecReso(fResoPt, fVecResoPt); + fillVecReso(fResoEta, fVecResoEta); + fillVecReso(fResoPhi_Pos, fVecResoPhi_Pos); + fillVecReso(fResoPhi_Neg, fVecResoPhi_Neg); } - fillVecReso(fResoPt, fVecResoPt); - fillVecReso(fResoEta, fVecResoEta); - fillVecReso(fResoPhi_Pos, fVecResoPhi_Pos); - fillVecReso(fResoPhi_Neg, fVecResoPhi_Neg); } - if (!fFromCcdb) + if (!fFromCcdb) { delete listRes; + } LOGP(info, "Set efficiency histos"); TList* listEff = new TList(); @@ -237,8 +315,9 @@ class MomentumSmearer } } - if (!fFromCcdb) + if (!fFromCcdb) { delete listEff; + } LOGP(info, "Set DCA histos"); TList* listDCA = new TList(); @@ -280,17 +359,19 @@ class MomentumSmearer fillVecReso(fDCA, fVecDCA); } - if (!fFromCcdb) + if (!fFromCcdb) { delete listDCA; + } fInitialized = true; } - void applySmearing(float ptgen, float vargen, float multiply, float& varsmeared, TH2F* fReso, std::vector& fVecReso) + void applySmearing(const float ptgen, const float vargen, const float multiply, float& varsmeared, TH2F* fReso, std::vector& fVecReso) { + float ptgen_tmp = ptgen > fMinPtGen ? ptgen : fMinPtGen; TAxis* axisPt = fReso->GetXaxis(); int nBinsPt = axisPt->GetNbins(); - int ptbin = axisPt->FindBin(ptgen); + int ptbin = axisPt->FindBin(ptgen_tmp); if (ptbin < 1) { ptbin = 1; } @@ -304,7 +385,7 @@ class MomentumSmearer varsmeared = vargen - smearing; } - void applySmearing(const int ch, const float ptgen, const float etagen, const float phigen, float& ptsmeared, float& etasmeared, float& phismeared) + void applySmearing(const float centrality, const int ch, const float ptgen, const float etagen, const float phigen, float& ptsmeared, float& etasmeared, float& phismeared) { if (fResType == 0) { ptsmeared = ptgen; @@ -312,13 +393,78 @@ class MomentumSmearer phismeared = phigen; return; } - applySmearing(ptgen, ptgen, ptgen, ptsmeared, fResoPt, fVecResoPt); - applySmearing(ptgen, etagen, 1., etasmeared, fResoEta, fVecResoEta); - if (ch > 0) { - applySmearing(ptgen, phigen, 1., phismeared, fResoPhi_Pos, fVecResoPhi_Pos); + + if (fDoNDSmearing) { + if (centrality < 0) { + ptsmeared = ptgen; + etasmeared = etagen; + phismeared = phigen; + return; + } + applySmearingND(centrality, ch, ptgen, etagen, phigen, ptsmeared, etasmeared, phismeared); } else { - applySmearing(ptgen, phigen, 1., phismeared, fResoPhi_Neg, fVecResoPhi_Neg); + applySmearing(ptgen, ptgen, ptgen, ptsmeared, fResoPt, fVecResoPt); + applySmearing(ptgen, etagen, 1., etasmeared, fResoEta, fVecResoEta); + if (ch > 0) { + applySmearing(ptgen, phigen, 1., phismeared, fResoPhi_Pos, fVecResoPhi_Pos); + } else { + applySmearing(ptgen, phigen, 1., phismeared, fResoPhi_Neg, fVecResoPhi_Neg); + } + } + } + + void applySmearingND(const float centrality, const int ch, const float ptgen, const float etagen, const float phigen, float& ptsmeared, float& etasmeared, float& phismeared) + { + float ptgen_tmp = ptgen > fMinPtGen ? ptgen : fMinPtGen; + int cenbin = fResoND->GetAxis(0)->FindBin(centrality); + int ptbin = fResoND->GetAxis(1)->FindBin(ptgen_tmp); + int etabin = fResoND->GetAxis(2)->FindBin(etagen); + int phibin = fResoND->GetAxis(3)->FindBin(phigen); + int chbin = fResoND->GetAxis(4)->FindBin(ch); + + // protection + if (cenbin < 1) { + cenbin = 1; + } else if (cenbin > fNCenBins) { + cenbin = fNCenBins; + } + + // protection + if (ptbin < 1) { + ptbin = 1; + } else if (ptbin > fNPtBins) { + ptbin = fNPtBins; + } + + // protection + if (etabin < 1) { + etabin = 1; + } else if (etabin > fNEtaBins) { + etabin = fNEtaBins; + } + + // protection + if (phibin < 1) { + phibin = 1; + } else if (phibin > fNPhiBins) { + phibin = fNPhiBins; + } + + // protection + if (chbin < 1) { + chbin = 1; + } else if (chbin > fNChBins) { + chbin = fNChBins; + } + + double dpt_rel = 0, deta = 0, dphi = 0; + if (fVecResoND[cenbin - 1][ptbin - 1][etabin - 1][phibin - 1][chbin - 1]->GetEntries() > 0) { + fVecResoND[cenbin - 1][ptbin - 1][etabin - 1][phibin - 1][chbin - 1]->GetRandom3(dpt_rel, deta, dphi); } + ptsmeared = ptgen - dpt_rel * ptgen; + etasmeared = etagen - deta; + phismeared = phigen - dphi; + // LOGF(info, "ptgen = %f (GeV/c), etagen = %f, phigen = %f (rad.), ptsmeared = %f (GeV/c), etasmeared = %f, phismeared = %f (rad.)", ptgen, etagen, phigen, ptsmeared, etasmeared, phismeared); } float getEfficiency(float pt, float eta, float phi) @@ -408,7 +554,9 @@ class MomentumSmearer } // setters + void setNDSmearing(bool flag) { fDoNDSmearing = flag; } void setResFileName(TString resFileName) { fResFileName = resFileName; } + void setResNDHistName(TString resNDHistName) { fResNDHistName = resNDHistName; } void setResPtHistName(TString resPtHistName) { fResPtHistName = resPtHistName; } void setResEtaHistName(TString resEtaHistName) { fResEtaHistName = resEtaHistName; } void setResPhiPosHistName(TString resPhiPosHistName) { fResPhiPosHistName = resPhiPosHistName; } @@ -426,9 +574,12 @@ class MomentumSmearer fFromCcdb = true; } void setTimestamp(int64_t timestamp) { fTimestamp = timestamp; } + void setMinPt(float minpt) { fMinPtGen = minpt; } // getters + bool getNDSmearing() { return fDoNDSmearing; } TString getResFileName() { return fResFileName; } + TString getResNDHistName() { return fResNDHistName; } TString getResPtHistName() { return fResPtHistName; } TString getResEtaHistName() { return fResEtaHistName; } TString getResPhiPosHistName() { return fResPhiPosHistName; } @@ -445,10 +596,13 @@ class MomentumSmearer TString getCcdbPathRes() { return fCcdbPathRes; } TString getCcdbPathEff() { return fCcdbPathEff; } TString getCcdbPathDCA() { return fCcdbPathDCA; } + float getMinPt() { return fMinPtGen; } private: bool fInitialized = false; + bool fDoNDSmearing = false; TString fResFileName; + TString fResNDHistName; TString fResPtHistName; TString fResEtaHistName; TString fResPhiPosHistName; @@ -463,10 +617,17 @@ class MomentumSmearer int fEffType = 0; int fResType = 0; int fDCAType = 0; + THnSparseF* fResoND; TH2F* fResoPt; TH2F* fResoEta; TH2F* fResoPhi_Pos; TH2F* fResoPhi_Neg; + std::vector>>>> fVecResoND; + int fNCenBins = 1; + int fNPtBins = 1; + int fNEtaBins = 1; + int fNPhiBins = 1; + int fNChBins = 1; std::vector fVecResoPt; std::vector fVecResoEta; std::vector fVecResoPhi_Pos; @@ -477,6 +638,7 @@ class MomentumSmearer int64_t fTimestamp; bool fFromCcdb = false; Service fCcdb; + float fMinPtGen = -1.f; }; #endif // PWGEM_DILEPTON_UTILS_MOMENTUMSMEARER_H_ diff --git a/PWGEM/Dilepton/Utils/PairUtilities.h b/PWGEM/Dilepton/Utils/PairUtilities.h index 5e253c3fcee..a1010e76435 100644 --- a/PWGEM/Dilepton/Utils/PairUtilities.h +++ b/PWGEM/Dilepton/Utils/PairUtilities.h @@ -41,7 +41,15 @@ enum class DileptonAnalysisType : int { kVM = 5, kHFll = 6, }; + enum class DileptonPrefilterBit : int { + kElFromPC = 0, // electron from photon conversion + kElFromPi0_1 = 1, // electron from pi0 dalitz decay, threshold 1 + kElFromPi0_2 = 2, // electron from pi0 dalitz decay, threshold 2 + kElFromPi0_3 = 3, // electron from pi0 dalitz decay, threshold 3 +}; + +enum class DileptonPrefilterBitDerived : int { kMee = 0, // reject tracks from pi0 dalitz decays at very low mass where S/B > 1 kPhiV = 1, // reject tracks from photon conversions kSplitOrMergedTrackLS = 2, // reject split or marged tracks in LS pairs based on momentum deta-dphi at PV diff --git a/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx index 1636d5223b3..0ac694501d1 100644 --- a/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx @@ -247,7 +247,7 @@ struct HfTaskDirectedFlowCharmHadrons { case DecayChannel::D0ToPiK: massCand = hfHelper.invMassD0ToPiK(candidate); rapCand = hfHelper.yD0(candidate); - sign = 1; + sign = candidate.isSelD0bar() ? 3 : 1; // 3: reflected D0bar, 1: pure D0 excluding reflected D0bar if constexpr (std::is_same_v) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) outputMl[iclass] = candidate.mlProbD0()[classMl->at(iclass)]; @@ -256,7 +256,7 @@ struct HfTaskDirectedFlowCharmHadrons { case DecayChannel::D0ToKPi: massCand = hfHelper.invMassD0barToKPi(candidate); rapCand = hfHelper.yD0(candidate); - sign = -1; + sign = candidate.isSelD0() ? 3 : 2; // 3: reflected D0, 2: pure D0bar excluding reflected D0 if constexpr (std::is_same_v) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) outputMl[iclass] = candidate.mlProbD0bar()[classMl->at(iclass)]; diff --git a/PWGHF/D2H/Tasks/taskDplus.cxx b/PWGHF/D2H/Tasks/taskDplus.cxx index ca28eacd505..625e12581cc 100644 --- a/PWGHF/D2H/Tasks/taskDplus.cxx +++ b/PWGHF/D2H/Tasks/taskDplus.cxx @@ -17,11 +17,14 @@ /// \author Vít Kučera , CERN /// \author Luca Aglietta , University and INFN Torino +#include + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" +#include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" @@ -30,17 +33,30 @@ using namespace o2; using namespace o2::analysis; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::hf_centrality; + +enum OccupancyEstimator { None = 0, + ITS, + FT0C }; + +enum BHadMothers { NotMatched = 0, + BPlus, + BZero, + Bs, + LambdaBZero }; /// D± analysis task struct HfTaskDplus { Configurable selectionFlagDplus{"selectionFlagDplus", 7, "Selection Flag for DPlus"}; // 7 corresponds to topo+PID cuts Configurable yCandGenMax{"yCandGenMax", 0.5, "max. gen particle rapidity"}; Configurable yCandRecoMax{"yCandRecoMax", 0.8, "max. cand. rapidity"}; + Configurable yGenNBins{"yGenNBins", 100, "number of bins for y axis in sparse for gen candidates"}; + Configurable centEstimator{"centEstimator", 0, "Centrality estimation (None: 0, FT0C: 2, FT0M: 3)"}; + Configurable occEstimator{"occEstimator", 0, "Occupancy estimation (None: 0, ITS: 1, FT0C: 2)"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_dplus_to_pi_k_pi::vecBinsPt}, "pT bin limits"}; Configurable> classMl{"classMl", {0, 1, 2}, "Indexes of ML scores to be stored. Three indexes max."}; - ConfigurableAxis axisMlScore0{"axisMlScore0", {100, 0., 1.}, "axis for ML output score 0"}; - ConfigurableAxis axisMlScore1{"axisMlScore1", {100, 0., 1.}, "axis for ML output score 1"}; - ConfigurableAxis axisMlScore2{"axisMlScore2", {100, 0., 1.}, "axis for ML output score 2"}; + Configurable storeCentrality{"storeCentrality", false, "Flag to store centrality information"}; + Configurable storeOccupancy{"storeOccupancy", false, "Flag to store occupancy information"}; HfHelper hfHelper; @@ -48,10 +64,16 @@ struct HfTaskDplus { using CandDplusDataWithMl = soa::Filtered>; using CandDplusMcReco = soa::Filtered>; using CandDplusMcRecoWithMl = soa::Filtered>; - using McParticles = soa::Join; + using CandDplusMcGen = soa::Join; + + using CollisionsCent = soa::Join; + using McRecoCollisionsCent = soa::Join; Filter filterDplusFlag = (o2::aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_3prong::DecayType::DplusToPiKPi))) != static_cast(0); + Preslice mcParticlesPerMcCollision = aod::mcparticle::mcCollisionId; + PresliceUnsorted recoColPerMcCollision = aod::mccollisionlabel::mcCollisionId; + // data Partition selectedDPlusCandidates = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlagDplus; Partition selectedDPlusCandidatesWithMl = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlagDplus; @@ -64,7 +86,14 @@ struct HfTaskDplus { Partition recoBkgCandidates = nabs(aod::hf_cand_3prong::flagMcMatchRec) != static_cast(BIT(aod::hf_cand_3prong::DecayType::DplusToPiKPi)) && aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlagDplus; Partition recoBkgCandidatesWithMl = nabs(aod::hf_cand_3prong::flagMcMatchRec) != static_cast(BIT(aod::hf_cand_3prong::DecayType::DplusToPiKPi)) && aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlagDplus; - // Generated particles + ConfigurableAxis thnConfigAxisY{"thnConfigAxisY", {40, -1, 1}, "Cand. rapidity bins"}; + ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {110, 0., 110.}, ""}; + ConfigurableAxis thnConfigAxisOccupancy{"thnConfigAxisOccupancy", {14, 0, 14000}, "axis for centrality"}; + ConfigurableAxis thnConfigAxisPtBHad{"thnConfigAxisPtBHad", {25, 0., 50}, "axis for pt of B hadron decayed into D candidate"}; + ConfigurableAxis thnConfigAxisFlagBHad{"thnConfigAxisFlagBHad", {5, 0., 5}, "axis for PDG of B hadron"}; + ConfigurableAxis thnConfigAxisMlScore0{"thnConfigAxisMlScore0", {100, 0., 1.}, "axis for ML output score 0"}; + ConfigurableAxis thnConfigAxisMlScore1{"thnConfigAxisMlScore1", {100, 0., 1.}, "axis for ML output score 1"}; + ConfigurableAxis thnConfigAxisMlScore2{"thnConfigAxisMlScore2", {100, 0., 1.}, "axis for ML output score 2"}; HistogramRegistry registry{ "registry", @@ -84,9 +113,18 @@ struct HfTaskDplus { if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { LOGP(fatal, "Only one process function should be enabled! Please check your configuration!"); } - auto vbins = (std::vector)binsPt; - AxisSpec ptbins = {vbins, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec massbins = {600, 1.67, 2.27, "inv. mass (K#pi#pi) (GeV/#it{c}^{2})"}; + auto vbins = static_cast>(binsPt); + AxisSpec thnAxisPt = {vbins, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec thnAxisMass = {600, 1.67, 2.27, "inv. mass (K#pi#pi) (GeV/#it{c}^{2})"}; + AxisSpec thnAxisY = {thnConfigAxisY, "y"}; + AxisSpec thnAxisMlScore0 = {thnConfigAxisMlScore0, "Score 0"}; + AxisSpec thnAxisMlScore1 = {thnConfigAxisMlScore1, "Score 1"}; + AxisSpec thnAxisMlScore2 = {thnConfigAxisMlScore2, "Score 2"}; + AxisSpec thnAxisPtBHad{thnConfigAxisPtBHad, "#it{p}_{T,B} (GeV/#it{c})"}; + AxisSpec thnAxisFlagBHad{thnConfigAxisFlagBHad, "B Hadron flag"}; + AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality"}; + AxisSpec thnAxisOccupancy{thnConfigAxisOccupancy, "Occupancy"}; + registry.add("hMass", "3-prong candidates;inv. mass (#pi K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{350, 1.7, 2.05}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hEta", "3-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hCt", "3-prong candidates;proper lifetime (D^{#pm}) * #it{c} (cm);entries", {HistType::kTH2F, {{120, -20., 100.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); @@ -124,13 +162,55 @@ struct HfTaskDplus { registry.add("hPtVsYGen", "MC particles (matched);#it{p}_{T}^{gen.}; #it{y}", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); registry.add("hPtVsYGenPrompt", "MC particles (matched, prompt);#it{p}_{T}^{gen.}; #it{y}", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); registry.add("hPtVsYGenNonPrompt", "MC particles (matched, non-prompt);#it{p}_{T}^{gen.}; #it{y}", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); - if (doprocessDataWithMl) { - registry.add("hSparseMass", "THn for Dplus", HistType::kTHnSparseF, {massbins, ptbins, axisMlScore0, axisMlScore1, axisMlScore2}); + + if (doprocessDataWithMl || doprocessData) { + std::vector axes = {thnAxisMass, thnAxisPt}; + + if (doprocessDataWithMl) { + axes.insert(axes.end(), {thnAxisMlScore0, thnAxisMlScore1, thnAxisMlScore2}); + } + if (storeCentrality) { + axes.insert(axes.end(), {thnAxisCent}); + } + if (storeOccupancy) { + axes.insert(axes.end(), {thnAxisOccupancy}); + } + + registry.add("hSparseMass", "THn for Dplus", HistType::kTHnSparseF, axes); } - if (doprocessMcWithMl) { - registry.add("hSparseMassPrompt", "THn for Dplus Prompt", HistType::kTHnSparseF, {massbins, ptbins, axisMlScore0, axisMlScore1, axisMlScore2}); - registry.add("hSparseMassFD", "THn for Dplus FD", HistType::kTHnSparseF, {massbins, ptbins, axisMlScore0, axisMlScore1, axisMlScore2}); - registry.add("hSparseMassBkg", "THn for Dplus Bkg", HistType::kTHnSparseF, {massbins, ptbins, axisMlScore0, axisMlScore1, axisMlScore2}); + if (doprocessMcWithMl || doprocessMc) { + std::vector axes = {thnAxisMass, thnAxisPt}; + std::vector axesFD = {thnAxisMass, thnAxisPt}; + std::vector axesGenPrompt = {thnAxisPt, thnAxisY}; + std::vector axesGenFD = {thnAxisPt, thnAxisY}; + + axesFD.insert(axesFD.end(), {thnAxisPtBHad}); + axesFD.insert(axesFD.end(), {thnAxisFlagBHad}); + axesGenFD.insert(axesGenFD.end(), {thnAxisPtBHad}); + axesGenFD.insert(axesGenFD.end(), {thnAxisFlagBHad}); + + if (doprocessMcWithMl) { + axes.insert(axes.end(), {thnAxisMlScore0, thnAxisMlScore1, thnAxisMlScore2}); + axesFD.insert(axesFD.end(), {thnAxisMlScore0, thnAxisMlScore1, thnAxisMlScore2}); + } + if (storeCentrality) { + axes.insert(axes.end(), {thnAxisCent}); + axesFD.insert(axesFD.end(), {thnAxisCent}); + axesGenPrompt.insert(axesGenPrompt.end(), {thnAxisCent}); + axesGenFD.insert(axesGenFD.end(), {thnAxisCent}); + } + if (storeOccupancy) { + axes.insert(axes.end(), {thnAxisOccupancy}); + axesFD.insert(axesFD.end(), {thnAxisOccupancy}); + axesGenPrompt.insert(axesGenPrompt.end(), {thnAxisOccupancy}); + axesGenFD.insert(axesGenFD.end(), {thnAxisOccupancy}); + } + registry.add("hSparseMassPrompt", "THn for Dplus Prompt", HistType::kTHnSparseF, axes); + registry.add("hSparseMassFD", "THn for Dplus FD", HistType::kTHnSparseF, axesFD); + registry.add("hSparseMassBkg", "THn for Dplus Bkg", HistType::kTHnSparseF, axes); + registry.add("hSparseMassNotMatched", "THn for Dplus not matched", HistType::kTHnSparseF, axes); + registry.add("hSparseMassGenPrompt", "THn for gen Prompt Dplus", HistType::kTHnSparseF, axesGenPrompt); + registry.add("hSparseMassGenFD", "THn for gen FD Dplus", HistType::kTHnSparseF, axesGenFD); } } @@ -167,25 +247,80 @@ struct HfTaskDplus { // Fill THnSparses for the ML analysis /// \param candidate is a particle candidate + /// \param ptbhad transverse momentum of beauty mother for nonprompt candidates + /// \param flagBHad transverse momentum of beauty mother for nonprompt candidates + /// \param centrality collision centrality + /// \param occupancy collision occupancy template - void fillSparseML(const T1& candidate) + void fillSparseML(const T1& candidate, + float ptbhad, + int flagBHad, + float centrality, + float occupancy) { std::vector outputMl = {-999., -999., -999.}; for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)]; } - if constexpr (isMc) { - if constexpr (isMatched) { - if (candidate.originMcRec() == RecoDecay::OriginType::Prompt) { - registry.fill(HIST("hSparseMassPrompt"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); - } else if (candidate.originMcRec() == RecoDecay::OriginType::NonPrompt) { - registry.fill(HIST("hSparseMassFD"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); + if constexpr (isMc) { // MC + if constexpr (isMatched) { // Matched + if (candidate.originMcRec() == RecoDecay::OriginType::Prompt) { // Prompt + + if (storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseMassPrompt"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality, occupancy); + } else if (storeCentrality && !storeOccupancy) { + registry.fill(HIST("hSparseMassPrompt"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality); + } else if (!storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseMassPrompt"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy); + } else { + registry.fill(HIST("hSparseMassPrompt"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); + } + + } else if (candidate.originMcRec() == RecoDecay::OriginType::NonPrompt) { // FD + + if (storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseMassFD"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), ptbhad, flagBHad, outputMl[0], outputMl[1], outputMl[2], centrality, occupancy); + } else if (storeCentrality && !storeOccupancy) { + registry.fill(HIST("hSparseMassFD"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), ptbhad, flagBHad, outputMl[0], outputMl[1], outputMl[2], centrality); + } else if (!storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseMassFD"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), ptbhad, flagBHad, outputMl[0], outputMl[1], outputMl[2], occupancy); + } else { + registry.fill(HIST("hSparseMassFD"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), ptbhad, flagBHad, outputMl[0], outputMl[1], outputMl[2]); + } + + } else { // Bkg + + if (storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseMassBkg"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality, occupancy); + } else if (storeCentrality && !storeOccupancy) { + registry.fill(HIST("hSparseMassBkg"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality); + } else if (!storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseMassBkg"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy); + } else { + registry.fill(HIST("hSparseMassBkg"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); + } } } else { - registry.fill(HIST("hSparseMassBkg"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); + if (storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseMassNotMatched"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality, occupancy); + } else if (storeCentrality && !storeOccupancy) { + registry.fill(HIST("hSparseMassNotMatched"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality); + } else if (!storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseMassNotMatched"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy); + } else { + registry.fill(HIST("hSparseMassNotMatched"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); + } + } + } else { // Data + if (storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseMass"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality, occupancy); + } else if (storeCentrality && !storeOccupancy) { + registry.fill(HIST("hSparseMass"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality); + } else if (!storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseMass"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy); + } else { + registry.fill(HIST("hSparseMass"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); } - } else { - registry.fill(HIST("hSparseMass"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); } } @@ -258,11 +393,52 @@ struct HfTaskDplus { registry.fill(HIST("hEtaGen"), particle.eta()); } + // Fill THnSparse of quantities for generated Dplus particles + /// \param particle is a particle with MC information + /// \param ptGenB transverse momentum of beauty mother for nonprompt candidates + /// \param flagGenB transverse momentum of beauty mother for nonprompt candidates + /// \param centrality collision centrality + /// \param occupancy collision occupancy + template + void fillSparseMcGen(const T1& particle, + float ptGenB, + int flagGenB, + float centrality, + float occupancy) + { + auto yGen = RecoDecay::y(particle.pVector(), o2::constants::physics::MassDPlus); + if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { + if (storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseMassGenPrompt"), particle.pt(), yGen, centrality, occupancy); + } else if (storeCentrality && !storeOccupancy) { + registry.fill(HIST("hSparseMassGenPrompt"), particle.pt(), yGen, centrality); + } else if (!storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseMassGenPrompt"), particle.pt(), yGen, occupancy); + } else { + registry.fill(HIST("hSparseMassGenPrompt"), particle.pt(), yGen); + } + } else { + if (storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseMassGenFD"), particle.pt(), yGen, ptGenB, flagGenB, centrality, occupancy); + } else if (storeCentrality && !storeOccupancy) { + registry.fill(HIST("hSparseMassGenFD"), particle.pt(), yGen, ptGenB, flagGenB, centrality); + } else if (!storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseMassGenFD"), particle.pt(), yGen, ptGenB, flagGenB, occupancy); + } else { + registry.fill(HIST("hSparseMassGenFD"), particle.pt(), yGen, ptGenB, flagGenB); + } + } + } + // Run analysis for the reconstructed Dplus candidates from data /// \param candidates are reconstructed candidates template - void runDataAnalysis(const T1& /*candidates*/) + void runDataAnalysis(const T1& /*candidates*/, CollisionsCent const& /*colls*/) { + float cent{-1.f}; + float occ{-1.f}; + float ptBhad{-1.f}; + int flagBHad{-1}; if constexpr (!fillMl) { for (const auto& candidate : selectedDPlusCandidates) { if ((yCandRecoMax >= 0. && std::abs(hfHelper.yDplus(candidate)) > yCandRecoMax)) { @@ -275,17 +451,34 @@ struct HfTaskDplus { if ((yCandRecoMax >= 0. && std::abs(hfHelper.yDplus(candidate)) > yCandRecoMax)) { continue; } + + if (storeCentrality || storeOccupancy) { + auto collision = candidate.template collision_as(); + if (storeCentrality && centEstimator != CentralityEstimator::None) { + cent = getCentrality(collision); + } + if (storeOccupancy && occEstimator != OccupancyEstimator::None) { + occ = getOccupancy(collision); + } + } + fillHisto(candidate); - fillSparseML(candidate); + fillSparseML(candidate, ptBhad, flagBHad, cent, occ); } } } + // Run analysis for the reconstructed Dplus candidates with MC matching - /// \param candidates are reconstructed candidates - /// \param mcParticles are particles with MC information - template - void runMCAnalysis(const T1& /*recoCandidates*/, const T2& mcParticles) + /// \param recoCandidates are reconstructed candidates + /// \param recoColls are reconstructed collisions + template + void runAnalysisMcRec(McRecoCollisionsCent const& /*recoColls*/) { + float cent{-1}; + float occ{-1}; + float ptBhad{-1}; + int flagBHad{-1}; + // MC rec. w/o Ml if constexpr (!fillMl) { for (const auto& candidate : recoDPlusCandidates) { @@ -307,53 +500,220 @@ struct HfTaskDplus { if ((yCandRecoMax >= 0. && std::abs(hfHelper.yDplus(candidate)) > yCandRecoMax)) { continue; } + ptBhad = candidate.ptBhadMotherPart(); + flagBHad = getBHadMotherFlag(candidate.pdgBhadMotherPart()); + + if (storeCentrality || storeOccupancy) { + auto collision = candidate.template collision_as(); + if (storeCentrality && centEstimator != CentralityEstimator::None) { + cent = getCentrality(collision); + } + if (storeOccupancy && occEstimator != OccupancyEstimator::None) { + occ = getOccupancy(collision); + } + } + fillHisto(candidate); fillHistoMCRec(candidate); - fillSparseML(candidate); + fillSparseML(candidate, ptBhad, flagBHad, cent, occ); } // Bkg + ptBhad = -1; + flagBHad = -1; for (const auto& candidate : recoBkgCandidatesWithMl) { if ((yCandRecoMax >= 0. && std::abs(hfHelper.yDplus(candidate)) > yCandRecoMax)) { continue; } + auto collision = candidate.template collision_as(); + if (storeCentrality && centEstimator != CentralityEstimator::None) { + cent = getCentrality(collision); + } + if (storeOccupancy && occEstimator != OccupancyEstimator::None) { + occ = getOccupancy(collision); + } fillHistoMCRec(candidate); - fillSparseML(candidate); + fillSparseML(candidate, ptBhad, flagBHad, cent, occ); } } + } + + // Run analysis for the generated Dplus candidates + /// \param mcGenCollisions are the generated MC collisions + /// \param mcRecoCollisions are the reconstructed MC collisions + /// \param mcGenParticles are the generated MC particle candidates + template + void runAnalysisMcGen(aod::McCollisions const& mcGenCollisions, + McRecoCollisionsCent const& mcRecoCollisions, + Cand const& mcGenParticles) + { // MC gen. - for (const auto& particle : mcParticles) { - auto yGen = RecoDecay::y(particle.pVector(), o2::constants::physics::MassDPlus); - if ((yCandGenMax >= 0. && std::abs(yGen) > yCandGenMax) || (std::abs(particle.flagMcMatchGen()) != 1 << aod::hf_cand_3prong::DecayType::DplusToPiKPi)) { - continue; + float cent{-1.}; + float occ{-1.}; + float ptGenB{-1.}; + int flagGenB{-1}; + + for (const auto& mcGenCollision : mcGenCollisions) { + const auto recoCollsPerGenMcColl = mcRecoCollisions.sliceBy(recoColPerMcCollision, mcGenCollision.globalIndex()); + const auto mcParticlesPerGenMcColl = mcGenParticles.sliceBy(mcParticlesPerMcCollision, mcGenCollision.globalIndex()); + if (storeCentrality && centEstimator != CentralityEstimator::None) { + cent = getMcGenCollCentrality(recoCollsPerGenMcColl); } - fillHistoMCGen(particle); + if (storeOccupancy && occEstimator != OccupancyEstimator::None) { + occ = getMcGenCollOccupancy(recoCollsPerGenMcColl); + } + + for (const auto& particle : mcParticlesPerGenMcColl) { + ptGenB = -1; + flagGenB = -1; + auto yGen = RecoDecay::y(particle.pVector(), o2::constants::physics::MassDPlus); + if ((yCandGenMax >= 0. && std::abs(yGen) > yCandGenMax) || (std::abs(particle.flagMcMatchGen()) != 1 << aod::hf_cand_3prong::DecayType::DplusToPiKPi)) { + continue; + } + if (particle.originMcGen() == RecoDecay::OriginType::NonPrompt) { + auto bHadMother = mcGenParticles.rawIteratorAt(particle.idxBhadMotherPart() - mcGenParticles.offset()); + flagGenB = getBHadMotherFlag(bHadMother.pdgCode()); + ptGenB = bHadMother.pt(); + } + fillHistoMCGen(particle); + if constexpr (fillMl) { + fillSparseMcGen(particle, ptGenB, flagGenB, cent, occ); + } + } + } + } + + /// Get the occupancy + /// \param collision is the collision with the occupancy information + /// \return collision occupancy + template + float getOccupancy(Coll const& collision) + { + float occupancy = -999.; + switch (occEstimator) { + case OccupancyEstimator::ITS: + occupancy = collision.trackOccupancyInTimeRange(); + break; + case OccupancyEstimator::FT0C: + occupancy = collision.ft0cOccupancyInTimeRange(); + break; + default: + LOG(warning) << "Occupancy estimator not valid. Possible values are ITS or FT0C. Fallback to ITS"; + occupancy = collision.trackOccupancyInTimeRange(); + break; + } + return occupancy; + } + + /// \brief Function to get MC collision occupancy + /// \param collSlice collection of reconstructed collisions associated to a generated one + /// \return generated MC collision occupancy + template + int getMcGenCollOccupancy(CCs const& collSlice) + { + float multiplicity{0.f}; + int occupancy = 0; + for (const auto& collision : collSlice) { + float collMult{0.f}; + collMult = collision.numContrib(); + if (collMult > multiplicity) { + occupancy = getOccupancy(collision); + multiplicity = collMult; + } + } // end loop over collisions + + return occupancy; + } + + /// Get the centrality + /// \param collision is the collision with the centrality information + /// \return collision centrality + template + float getCentrality(Coll const& collision) + { + float cent = -999.; + switch (centEstimator) { + case CentralityEstimator::FT0C: + cent = collision.centFT0C(); + break; + case CentralityEstimator::FT0M: + cent = collision.centFT0M(); + break; + default: + LOG(warning) << "Centrality estimator not valid. Possible values are FT0C, FT0M. Fallback to FT0C"; + cent = collision.centFT0C(); + break; + } + return cent; + } + + /// \brief Function to get MC collision centrality + /// \param collSlice collection of reconstructed collisions associated to a generated one + /// \return generated MC collision centrality + template + float getMcGenCollCentrality(CCs const& collSlice) + { + float centrality{-1}; + float multiplicity{0.f}; + for (const auto& collision : collSlice) { + float collMult = collision.numContrib(); + if (collMult > multiplicity) { + centrality = getCentrality(collision); + multiplicity = collMult; + } + } + return centrality; + } + + /// Convert the B hadron mother PDG for non prompt candidates to a flag + /// \param pdg of the b hadron mother + /// \return integer map to specific mothers' PDG codes + int getBHadMotherFlag(const int& flagBHad) + { + if (std::abs(flagBHad) == o2::constants::physics::kBPlus) { + return BHadMothers::BPlus; + } + if (std::abs(flagBHad) == o2::constants::physics::kB0) { + return BHadMothers::BZero; + } + if (std::abs(flagBHad) == o2::constants::physics::kBS) { + return BHadMothers::Bs; + } + if (std::abs(flagBHad) == o2::constants::physics::kLambdaB0) { + return BHadMothers::LambdaBZero; } + return BHadMothers::NotMatched; } // process functions - void processData(CandDplusData const& candidates) + void processData(CandDplusData const& candidates, CollisionsCent const& collisions) { - runDataAnalysis(candidates); + runDataAnalysis(candidates, collisions); } PROCESS_SWITCH(HfTaskDplus, processData, "Process data w/o ML", true); - void processDataWithMl(CandDplusDataWithMl const& candidates) + void processDataWithMl(CandDplusDataWithMl const& candidates, CollisionsCent const& collisions) { - runDataAnalysis(candidates); + runDataAnalysis(candidates, collisions); } PROCESS_SWITCH(HfTaskDplus, processDataWithMl, "Process data with ML", false); - void processMc(CandDplusMcReco const& candidates, - McParticles const& mcParticles) + void processMc(CandDplusMcReco const&, + CandDplusMcGen const& mcGenParticles, + McRecoCollisionsCent const& mcRecoCollisions, + aod::McCollisions const& mcGenCollisions) { - runMCAnalysis(candidates, mcParticles); + runAnalysisMcRec(mcRecoCollisions); + runAnalysisMcGen(mcGenCollisions, mcRecoCollisions, mcGenParticles); } PROCESS_SWITCH(HfTaskDplus, processMc, "Process MC w/o ML", false); - void processMcWithMl(CandDplusMcRecoWithMl const& candidates, - McParticles const& mcParticles) + void processMcWithMl(CandDplusMcRecoWithMl const&, + CandDplusMcGen const& mcGenParticles, + McRecoCollisionsCent const& mcRecoCollisions, + aod::McCollisions const& mcGenCollisions) { - runMCAnalysis(candidates, mcParticles); + runAnalysisMcRec(mcRecoCollisions); + runAnalysisMcGen(mcGenCollisions, mcRecoCollisions, mcGenParticles); } PROCESS_SWITCH(HfTaskDplus, processMcWithMl, "Process MC with ML", false); }; diff --git a/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx b/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx index 522be398df6..e67a35c0f45 100644 --- a/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx +++ b/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx @@ -15,6 +15,8 @@ /// \author Deependra Sharma , IITB /// \author Fabrizio Grosa , CERN +/// \brief Dstar production analysis task (With and Without ML) + #include #include #include @@ -42,11 +44,14 @@ struct HfTaskDstarToD0Pi { Configurable selectionFlagHfD0ToPiK{"selectionFlagHfD0ToPiK", true, "Selection Flag for HF flagged candidates"}; Configurable> ptBins{"ptBins", std::vector{hf_cuts_dstar_to_d0_pi::vecBinsPt}, "pT bin limits for Dstar"}; + SliceCache cache; + using CandDstarWSelFlag = soa::Join; using CandDstarWSelFlagWMl = soa::Join; /// @brief specially for MC data // full reconstructed Dstar candidate using CandDstarWSelFlagMcRec = soa::Join; + using CandDstarWSelFlagWMlMcRec = soa::Join; using CandDstarMcGen = soa::Join; using CollisionsWCent = soa::Join; @@ -57,9 +62,9 @@ struct HfTaskDstarToD0Pi { Preslice> preslicSelectedCandDstarPerColWMl = aod::hf_cand::collisionId; PresliceUnsorted colsPerMcCollision = aod::mccollisionlabel::mcCollisionId; - SliceCache cache; Partition rowsSelectedCandDstarMcRec = aod::hf_sel_candidate_dstar::isRecoD0Flag == selectionFlagHfD0ToPiK; + Partition rowsSelectedCandDstarMcRecWMl = aod::hf_sel_candidate_dstar::isRecoD0Flag == selectionFlagHfD0ToPiK; ConfigurableAxis binningImpactParam{"binningImpactParam", {1000, 0.1, -0.1}, " Bins of Impact Parameter"}; ConfigurableAxis binningDecayLength{"binningDecayLength", {1000, 0.0, 0.7}, "Bins of Decay Length"}; @@ -82,6 +87,9 @@ struct HfTaskDstarToD0Pi { void init(InitContext&) { + if ((doprocessDataWoML && doprocessDataWML) || (doprocessMcWoMl && doprocessMcWML) || (doprocessDataWoML && doprocessMcWML) || (doprocessDataWML && doprocessMcWoMl)) { + LOGP(fatal, "Only Without-ML or With-ML functions should be enabled at a time! Please check your configuration!"); + } auto vecPtBins = (std::vector)ptBins; AxisSpec axisImpactParam = {binningImpactParam, "impact parameter (cm)"}; @@ -162,9 +170,29 @@ struct HfTaskDstarToD0Pi { registry.add("Efficiency/hNumPvContributorsCandInMass", "PV Contributors; PV Contributor; FT0M Centrality", {HistType::kTH2F, {{100, 0, 300}, {axisCentrality}}}, true); // BDT Score (axisBDTScoreBackground, axisBDTScorePrompt, axisBDTScoreNonPrompt) - registry.add("Yield/hDeltaInvMassVsPtVsCentVsBDTScore", "#Delta #it{M}_{inv} Vs Pt Vs Cent Vs BDTScore", {HistType::kTHnSparseL, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}, {axisBDTScoreBackground}, {axisBDTScorePrompt}, {axisBDTScoreNonPrompt}}}); + if (doprocessDataWML) { + registry.add("Yield/hDeltaInvMassVsPtVsCentVsBDTScore", "#Delta #it{M}_{inv} Vs Pt Vs Cent Vs BDTScore", {HistType::kTHnSparseF, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}, {axisBDTScoreBackground}, {axisBDTScorePrompt}, {axisBDTScoreNonPrompt}}}); + } + if (doprocessMcWML) { + registry.add("Efficiency/hPtPromptVsCentVsBDTScore", "Pt Vs Cent Vs BDTScore", {HistType::kTHnSparseF, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}, {axisBDTScoreBackground}, {axisBDTScorePrompt}, {axisBDTScoreNonPrompt}}}); + registry.add("Efficiency/hPtNonPromptVsCentVsBDTScore", "Pt Vs Cent Vs BDTScore", {HistType::kTHnSparseF, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}, {axisBDTScoreBackground}, {axisBDTScorePrompt}, {axisBDTScoreNonPrompt}}}); + // registry.add("Efficiency/hPtBkgVsCentVsBDTScore", "Pt Vs Cent Vs BDTScore", {HistType::kTHnSparseF, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}, {axisBDTScoreBackground}, {axisBDTScorePrompt}, {axisBDTScoreNonPrompt}}}); + } } + // Comparator function to sort based on the second argument of a tuple + static bool compare(const std::pair::iterator, int>& a, const std::pair::iterator, int>& b) + { + return a.second > b.second; + } + + /// @brief This function runs over Data to obatin yield + /// @tparam T1 type of the candidate + /// @tparam T2 type of preslice used to slice the candidate table + /// @tparam applyMl a boolean to apply ML or not + /// @param cols reconstructed collision with centrality + /// @param selectedCands selected candidates with selection flag + /// @param preslice preslice to slice template void runTaskDstar(CollisionsWCent const& cols, T1 selectedCands, T2 preslice) { @@ -178,7 +206,7 @@ struct HfTaskDstarToD0Pi { auto nCandsCurrentCol = selectedCandsCurrentCol.size(); if (nCandsCurrentCol > 0) { - LOGF(debug, "size of selectedCandsCurrentCol: %d", nCandsCurrentCol); + // LOGF(debug, "size of selectedCandsCurrentCol: %d", nCandsCurrentCol); registry.fill(HIST("Efficiency/hNumPvContributorsCand"), nPVContributors, centrality); } @@ -259,47 +287,34 @@ struct HfTaskDstarToD0Pi { } // collision loop ends } - // process function without susing ML - void processWoML(CollisionsWCent const& cols, soa::Filtered const& selectedCands) + /// @brief This function runs over MC at reco level to obatin efficiency + /// @tparam T1 type of the candidate table + /// @tparam applyMl a boolean to apply ML or not + /// @param candsMcRecSel reconstructed candidates with selection flag + /// @param rowsMcPartilces generated particles table + template + void runMcRecTaskDstar(T1 const& candsMcRecSel, CandDstarMcGen const& rowsMcPartilces) { - runTaskDstar, Preslice>>(cols, selectedCands, preslicSelectedCandDstarPerCol); - } - PROCESS_SWITCH(HfTaskDstarToD0Pi, processWoML, "Process without ML", true); - - // process function with susing ML, Here we store BDT score as well - void processWML(CollisionsWCent const& cols, soa::Filtered const& selectedCands) - { - runTaskDstar, Preslice>>(cols, selectedCands, preslicSelectedCandDstarPerColWMl); - } - PROCESS_SWITCH(HfTaskDstarToD0Pi, processWML, "Process with ML", false); - - void processMC(aod::McCollisions const&, CollisionsWCentMcLabel const& collisions, CandDstarWSelFlagMcRec const&, - CandDstarMcGen const& rowsMcPartilces, - aod::TracksWMc const&) - { - rowsSelectedCandDstarMcRec.bindExternalIndices(&collisions); - + // LOGF(info, "Running MC Rec Task Dstar"); int8_t signDstar = 0; // MC at Reconstruction level - for (const auto& candDstarMcRec : rowsSelectedCandDstarMcRec) { + for (const auto& candDstarMcRec : candsMcRecSel) { + // LOGF(info, "MC Rec Dstar loop"); auto ptDstarRecSig = candDstarMcRec.pt(); auto yDstarRecSig = candDstarMcRec.y(constants::physics::MassDStar); if (yCandDstarRecoMax >= 0. && std::abs(yDstarRecSig) > yCandDstarRecoMax) { continue; } - auto collision = candDstarMcRec.collision_as(); + auto collision = candDstarMcRec.template collision_as(); auto centrality = collision.centFT0M(); // 0-100% if (TESTBIT(std::abs(candDstarMcRec.flagMcMatchRec()), aod::hf_cand_dstar::DecayType::DstarToD0Pi)) { // if MC matching is successful at Reconstruction Level + // LOGF(info, "MC Rec Dstar loop MC Matched"); // get MC Mother particle - auto indexMother = RecoDecay::getMother(rowsMcPartilces, candDstarMcRec.prong0_as().mcParticle_as(), o2::constants::physics::Pdg::kDStar, true, &signDstar, 2); + auto prong0 = candDstarMcRec.template prong0_as(); + auto indexMother = RecoDecay::getMother(rowsMcPartilces, prong0.template mcParticle_as(), o2::constants::physics::Pdg::kDStar, true, &signDstar, 2); auto particleMother = rowsMcPartilces.rawIteratorAt(indexMother); // What is difference between rawIterator() or iteratorAt() methods? registry.fill(HIST("QA/hPtSkimDstarGenSig"), particleMother.pt()); // generator level pt registry.fill(HIST("Efficiency/hPtVsCentSkimDstarGenSig"), particleMother.pt(), centrality); - registry.fill(HIST("Efficiency/hPtVsCentFullRecoDstarRecSig"), ptDstarRecSig, centrality); - - // auto recCollision = candDstarMcRec.collision_as(); - // float centFT0M = recCollision.centFT0M(); - // LOGF(info, "centFT0M: %f", centFT0M); registry.fill(HIST("QA/hPtVsYSkimDstarRecSig"), ptDstarRecSig, yDstarRecSig); // Skimed at level of trackIndexSkimCreator if (candDstarMcRec.isRecoTopol()) { // if Topological selection are passed @@ -308,8 +323,9 @@ struct HfTaskDstarToD0Pi { if (candDstarMcRec.isRecoPid()) { // if PID selection is passed registry.fill(HIST("QA/hPtVsYRecoPidDstarRecSig"), ptDstarRecSig, yDstarRecSig); } - if (candDstarMcRec.isRecoCand()) { // if all selection passed + if (candDstarMcRec.isSelDstarToD0Pi()) { // if all selection passed registry.fill(HIST("QA/hPtFullRecoDstarRecSig"), ptDstarRecSig); + registry.fill(HIST("Efficiency/hPtVsCentFullRecoDstarRecSig"), ptDstarRecSig, centrality); } registry.fill(HIST("QA/hCPASkimD0RecSig"), candDstarMcRec.cpaD0()); registry.fill(HIST("QA/hEtaSkimD0RecSig"), candDstarMcRec.etaD0()); @@ -324,76 +340,81 @@ struct HfTaskDstarToD0Pi { if (candDstarMcRec.isRecoPid()) { // if PID selection is passed registry.fill(HIST("QA/hPtVsYRecoPidPromptDstarRecSig"), ptDstarRecSig, yDstarRecSig); } - if (candDstarMcRec.isRecoCand()) { // if all selection passed + if (candDstarMcRec.isSelDstarToD0Pi()) { // if all selection passed registry.fill(HIST("QA/hPtFullRecoPromptDstarRecSig"), ptDstarRecSig); + if constexpr (applyMl) { + // LOGF(info, "Deep: Prompt MC Rec Task Dstar: ML applied"); + auto bdtScore = candDstarMcRec.mlProbDstarToD0Pi(); + registry.fill(HIST("Efficiency/hPtPromptVsCentVsBDTScore"), ptDstarRecSig, centrality, bdtScore[0], bdtScore[1], bdtScore[2]); + // LOGF(info, "Deep: Prompt MC Rec Task Dstar: ML applied, Efficiency filled"); + } } - } else if (candDstarMcRec.originMcRec() == RecoDecay::OriginType::NonPrompt) { // only non-prompt signal at reconstruction level registry.fill(HIST("QA/hPtVsYSkimNonPromptDstarRecSig"), ptDstarRecSig, yDstarRecSig); if (candDstarMcRec.isRecoTopol()) { // if Topological selection are passed registry.fill(HIST("QA/hPtVsYRecoTopolNonPromptDstarRecSig"), ptDstarRecSig, yDstarRecSig); } - if (candDstarMcRec.isRecoPid()) { + if (candDstarMcRec.isRecoPid()) { // if PID selection is passed registry.fill(HIST("QA/hPtVsYRecoPidNonPromptDstarRecSig"), ptDstarRecSig, yDstarRecSig); } - if (candDstarMcRec.isRecoCand()) { + if (candDstarMcRec.isSelDstarToD0Pi()) { // if all selection passed registry.fill(HIST("QA/hPtFullRecoNonPromptDstarRecSig"), ptDstarRecSig); + if constexpr (applyMl) { + auto bdtScore = candDstarMcRec.mlProbDstarToD0Pi(); + registry.fill(HIST("Efficiency/hPtNonPromptVsCentVsBDTScore"), ptDstarRecSig, centrality, bdtScore[0], bdtScore[1], bdtScore[2]); + } } } } else { // MC Unmatched (Baground at Reconstruction Level) registry.fill(HIST("QA/hCPASkimD0RecBg"), candDstarMcRec.cpaD0()); registry.fill(HIST("QA/hEtaSkimD0RecBg"), candDstarMcRec.etaD0()); registry.fill(HIST("QA/hEtaSkimDstarRecBg"), candDstarMcRec.eta()); - registry.fill(HIST("QA/hPtSkimD0RecBg"), candDstarMcRec.ptD0()); - registry.fill(HIST("QA/hPtSkimDstarRecBg"), candDstarMcRec.pt()); + if (candDstarMcRec.isSelDstarToD0Pi()) { + registry.fill(HIST("QA/hPtSkimDstarRecBg"), candDstarMcRec.pt()); + } } - } + } // candidate loop ends + // LOGF(info, "Deep: MC Rec Task Dstar finished"); + } - // MC at Generator Level - for (const auto& mcParticle : rowsMcPartilces) { + /// @brief This function runs over MC at gen level to obatin efficiency + /// @param collisions reconstructed collision with centrality + /// @param rowsMcPartilces generated particles table + void runMcGenTaskDstar(CollisionsWCentMcLabel const& collisions, CandDstarMcGen const& rowsMcPartilces) + { + // MC Gen level + for (auto const& mcParticle : rowsMcPartilces) { if (TESTBIT(std::abs(mcParticle.flagMcMatchGen()), aod::hf_cand_dstar::DecayType::DstarToD0Pi)) { // MC Matching is successful at Generator Level - auto ptGen = mcParticle.pt(); - // auto yGen = mcParticle.y(); // Can we use this definition? auto yGen = RecoDecay::y(mcParticle.pVector(), o2::constants::physics::MassDStar); if (yCandDstarGenMax >= 0. && std::abs(yGen) > yCandDstarGenMax) { continue; } - - auto mcCollision = mcParticle.mcCollision_as(); + auto mcCollision = mcParticle.template mcCollision_as(); auto recCollisions = collisions.sliceBy(colsPerMcCollision, mcCollision.globalIndex()); - // auto recCollisions = collisions.sliceByCached(aod::mccollisionlabel::mcCollisionId, mcCollision.globalIndex(), cache); - // auto recCollisions = collisions.sliceByCachedUnsorted(aod::mccollisionlabel::mcCollisionId, mcCollision.globalIndex(), cache); - // looking if a generated collision reconstructed more than a times. if (recCollisions.size() > 1) { for (const auto& [c1, c2] : combinations(CombinationsStrictlyUpperIndexPolicy(recCollisions, recCollisions))) { - auto deltaCent = abs(c1.centFT0M() - c2.centFT0M()); + auto deltaCent = std::abs(c1.centFT0M() - c2.centFT0M()); registry.fill(HIST("QA/hDeltaCentGen"), deltaCent); } } - float centFT0MGen; // assigning centrality to MC Collision using max FT0M amplitute from Reconstructed collisions if (recCollisions.size()) { std::vector::iterator, int>> tempRecCols; - for (const auto& recCol : recCollisions) { - // if(recCollisions.size()>1) LOGF(info, "cuurent cent: %f",recCol.centFT0M()); tempRecCols.push_back(std::make_pair(recCol, recCol.numContrib())); } std::sort(tempRecCols.begin(), tempRecCols.end(), compare); centFT0MGen = tempRecCols.at(0).first.centFT0M(); - // if(recCollisions.size()>1) LOGF(info, "assigned cent: %f",centFT0MGen); } else { centFT0MGen = -999.; } - registry.fill(HIST("QA/hEtaDstarGen"), mcParticle.eta()); registry.fill(HIST("QA/hPtDstarGen"), ptGen); registry.fill(HIST("QA/hPtVsYDstarGen"), ptGen, yGen); registry.fill(HIST("Efficiency/hPtVsCentDstarGen"), ptGen, centFT0MGen); - // only promt Dstar candidate at Generator level if (mcParticle.originMcGen() == RecoDecay::OriginType::Prompt) { registry.fill(HIST("QA/hPtPromptDstarGen"), ptGen); @@ -403,15 +424,44 @@ struct HfTaskDstarToD0Pi { registry.fill(HIST("QA/hPtVsYNonPromptDstarGen"), ptGen, yGen); } } - } + } // MC Particle loop ends } - PROCESS_SWITCH(HfTaskDstarToD0Pi, processMC, "Process MC Data", false); - // Comparator function to sort based on the second argument of a tuple - static bool compare(const std::pair::iterator, int>& a, const std::pair::iterator, int>& b) + // process data function without susing ML + void processDataWoML(CollisionsWCent const& cols, soa::Filtered const& selectedCands) { - return a.second > b.second; + runTaskDstar, Preslice>>(cols, selectedCands, preslicSelectedCandDstarPerCol); + } + PROCESS_SWITCH(HfTaskDstarToD0Pi, processDataWoML, "Process Data without ML", true); + + // process data function with using ML, Here we store BDT score as well + void processDataWML(CollisionsWCent const& cols, soa::Filtered const& selectedCands) + { + runTaskDstar, Preslice>>(cols, selectedCands, preslicSelectedCandDstarPerColWMl); + } + PROCESS_SWITCH(HfTaskDstarToD0Pi, processDataWML, "Process Data with ML", false); + + // process MC function without using ML + void processMcWoMl(aod::McCollisions const&, CollisionsWCentMcLabel const& collisions, CandDstarWSelFlagMcRec const&, + CandDstarMcGen const& rowsMcPartilces, + aod::TracksWMc const&) + { + rowsSelectedCandDstarMcRec.bindExternalIndices(&collisions); + runMcRecTaskDstar>(rowsSelectedCandDstarMcRec, rowsMcPartilces); + runMcGenTaskDstar(collisions, rowsMcPartilces); + } + PROCESS_SWITCH(HfTaskDstarToD0Pi, processMcWoMl, "Process MC Data without ML", false); + + // process MC function with using ML + void processMcWML(aod::McCollisions const&, CollisionsWCentMcLabel const& collisions, CandDstarWSelFlagWMlMcRec const&, + CandDstarMcGen const& rowsMcPartilces, + aod::TracksWMc const&) + { + rowsSelectedCandDstarMcRecWMl.bindExternalIndices(&collisions); + runMcRecTaskDstar>(rowsSelectedCandDstarMcRecWMl, rowsMcPartilces); + runMcGenTaskDstar(collisions, rowsMcPartilces); } + PROCESS_SWITCH(HfTaskDstarToD0Pi, processMcWML, "Process MC Data with ML", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx index 5c77f9da21e..761eb974c42 100644 --- a/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx @@ -313,7 +313,7 @@ struct HfCorrelatorLcHadrons { /// Lc-hadron correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) void processData(SelCollisionsWithLc::iterator const& collision, TracksData const& tracks, - CandidatesLcData const& candidates) + CandidatesLcData const& candidates, aod::BCsWithTimestamps const&) { if (candidates.size() == 0) { return; diff --git a/PWGJE/Tasks/CMakeLists.txt b/PWGJE/Tasks/CMakeLists.txt index e5f4c42f1d3..8339072a2d4 100644 --- a/PWGJE/Tasks/CMakeLists.txt +++ b/PWGJE/Tasks/CMakeLists.txt @@ -48,6 +48,10 @@ o2physics_add_dpl_workflow(photon-isolation-qa COMPONENT_NAME Analysis) if(FastJet_FOUND) + o2physics_add_dpl_workflow(jet-background-analysis + SOURCES jetBackgroundAnalysis.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-substructure SOURCES jetSubstructure.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore @@ -132,6 +136,10 @@ o2physics_add_dpl_workflow(jet-substructure-bplus SOURCES jetFinderV0QA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-charged-spectra + SOURCES jetSpectraCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(trigger-correlations SOURCES triggerCorrelations.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::PWGJECore O2Physics::AnalysisCore diff --git a/PWGJE/Tasks/jetBackgroundAnalysis.cxx b/PWGJE/Tasks/jetBackgroundAnalysis.cxx new file mode 100644 index 00000000000..d951ce485ea --- /dev/null +++ b/PWGJE/Tasks/jetBackgroundAnalysis.cxx @@ -0,0 +1,235 @@ +// 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. + +// jet finder QA task +// +/// \author Aimeric Landou +/// \author Nima Zardoshti + +#include +#include +#include +#include "TLorentzVector.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" + +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" + +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetFinder.h" +#include "PWGJE/Core/JetFindingUtilities.h" +#include "PWGJE/DataModel/Jet.h" + +#include "PWGJE/Core/JetDerivedDataUtilities.h" + +#include "EventFiltering/filterTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct JetBackgroundAnalysisTask { + HistogramRegistry registry; + + Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; + Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range for collisions"}; + Configurable centralityMin{"centralityMin", -999.0, "minimum centrality for collisions"}; + Configurable centralityMax{"centralityMax", 999.0, "maximum centrality for collisions"}; + Configurable trackOccupancyInTimeRangeMax{"trackOccupancyInTimeRangeMax", 999999, "maximum track occupancy of collisions in neighbouring collisions in a given time range; only applied to reconstructed collisions (data and mcd jets), not mc collisions (mcp jets)"}; + Configurable trackOccupancyInTimeRangeMin{"trackOccupancyInTimeRangeMin", -999999, "minimum track occupancy of collisions in neighbouring collisions in a given time range; only applied to reconstructed collisions (data and mcd jets), not mc collisions (mcp jets)"}; + + Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum eta acceptance for tracks"}; + Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum eta acceptance for tracks"}; + Configurable trackPtMin{"trackPtMin", 0.15, "minimum pT acceptance for tracks"}; + Configurable trackPtMax{"trackPtMax", 100.0, "maximum pT acceptance for tracks"}; + Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; + + // // If weights are implemented for MCD bkg checks, the cut on pTHatMax of jets should be introduced + // Configurable pTHatMaxMCD{"pTHatMaxMCD", 999.0, "maximum fraction of hard scattering for jet acceptance in detector MC"}; + // Configurable pTHatExponent{"pTHatExponent", 6.0, "exponent of the event weight for the calculation of pTHat"}; + + Configurable randomConeR{"randomConeR", 0.4, "size of random Cone for estimating background fluctuations"}; + Configurable randomConeLeadJetDeltaR{"randomConeLeadJetDeltaR", -99.0, "min distance between leading jet axis and random cone (RC) axis; if negative, min distance is set to automatic value of R_leadJet+R_RC "}; + + int eventSelection = -1; + int trackSelection = -1; + + void init(o2::framework::InitContext&) + { + // selection settings initialisation + eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(eventSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + + // histogram definitions + + if (doprocessRho) { + registry.add("h2_centrality_ntracks", "; centrality; N_{tracks};", {HistType::kTH2F, {{1100, 0., 110.0}, {10000, 0.0, 10000.0}}}); + registry.add("h2_ntracks_rho", "; N_{tracks}; #it{rho} (GeV/area);", {HistType::kTH2F, {{10000, 0.0, 10000.0}, {400, 0.0, 400.0}}}); + registry.add("h2_ntracks_rhom", "; N_{tracks}; #it{rho}_{m} (GeV/area);", {HistType::kTH2F, {{10000, 0.0, 10000.0}, {100, 0.0, 100.0}}}); + registry.add("h2_centrality_rho", "; centrality; #it{rho} (GeV/area);", {HistType::kTH2F, {{1100, 0., 110.}, {400, 0., 400.0}}}); + registry.add("h2_centrality_rhom", ";centrality; #it{rho}_{m} (GeV/area)", {HistType::kTH2F, {{1100, 0., 110.}, {100, 0., 100.0}}}); + } + + if (doprocessBkgFluctuationsData || doprocessBkgFluctuationsMCD) { + registry.add("h2_centrality_rhorandomcone", "; centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho} (GeV/c);", {HistType::kTH2F, {{1100, 0., 110.}, {800, -400.0, 400.0}}}); + registry.add("h2_centrality_rhorandomconerandomtrackdirection", "; centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho} (GeV/c);", {HistType::kTH2F, {{1100, 0., 110.}, {800, -400.0, 400.0}}}); + registry.add("h2_centrality_rhorandomconewithoutleadingjet", "; centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho} (GeV/c);", {HistType::kTH2F, {{1100, 0., 110.}, {800, -400.0, 400.0}}}); + registry.add("h2_centrality_rhorandomconerandomtrackdirectionwithoutoneleadingjets", "; centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho} (GeV/c);", {HistType::kTH2F, {{1100, 0., 110.}, {800, -400.0, 400.0}}}); + registry.add("h2_centrality_rhorandomconerandomtrackdirectionwithouttwoleadingjets", "; centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho} (GeV/c);", {HistType::kTH2F, {{1100, 0., 110.}, {800, -400.0, 400.0}}}); + } + } + + Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); + Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); + + template + bool trackIsInJet(TTracks const& track, TJets const& jet) + { + for (auto const& constituentId : jet.tracksIds()) { + if (constituentId == track.globalIndex()) { + return true; + } + } + return false; + } + + template + void bkgFluctuationsRandomCone(TCollisions const& collision, TJets const& jets, TTracks const& tracks) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + TRandom3 randomNumber(0); + float randomConeEta = randomNumber.Uniform(trackEtaMin + randomConeR, trackEtaMax - randomConeR); + float randomConePhi = randomNumber.Uniform(0.0, 2 * M_PI); + float randomConePt = 0; + for (auto const& track : tracks) { + if (jetderiveddatautilities::selectTrack(track, trackSelection)) { + float dPhi = RecoDecay::constrainAngle(track.phi() - randomConePhi, static_cast(-M_PI)); + float dEta = track.eta() - randomConeEta; + if (TMath::Sqrt(dEta * dEta + dPhi * dPhi) < randomConeR) { + randomConePt += track.pt(); + } + } + } + registry.fill(HIST("h2_centrality_rhorandomcone"), collision.centrality(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho()); + + // randomised eta,phi for tracks, to assess part of fluctuations coming from statistically independently emitted particles + randomConePt = 0; + for (auto const& track : tracks) { + if (jetderiveddatautilities::selectTrack(track, trackSelection)) { + float dPhi = RecoDecay::constrainAngle(randomNumber.Uniform(0.0, 2 * M_PI) - randomConePhi, static_cast(-M_PI)); // ignores actual phi of track + float dEta = randomNumber.Uniform(trackEtaMin, trackEtaMax) - randomConeEta; // ignores actual eta of track + if (TMath::Sqrt(dEta * dEta + dPhi * dPhi) < randomConeR) { + randomConePt += track.pt(); + } + } + } + registry.fill(HIST("h2_centrality_rhorandomconerandomtrackdirection"), collision.centrality(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho()); + + // removing the leading jet from the random cone + if (jets.size() > 0) { // if there are no jets in the acceptance (from the jetfinder cuts) then there can be no leading jet + float dPhiLeadingJet = RecoDecay::constrainAngle(jets.iteratorAt(0).phi() - randomConePhi, static_cast(-M_PI)); + float dEtaLeadingJet = jets.iteratorAt(0).eta() - randomConeEta; + + bool jetWasInCone = false; + while ((randomConeLeadJetDeltaR <= 0 && (TMath::Sqrt(dEtaLeadingJet * dEtaLeadingJet + dPhiLeadingJet * dPhiLeadingJet) < jets.iteratorAt(0).r() / 100.0 + randomConeR)) || (randomConeLeadJetDeltaR > 0 && (TMath::Sqrt(dEtaLeadingJet * dEtaLeadingJet + dPhiLeadingJet * dPhiLeadingJet) < randomConeLeadJetDeltaR))) { + jetWasInCone = true; + randomConeEta = randomNumber.Uniform(trackEtaMin + randomConeR, trackEtaMax - randomConeR); + randomConePhi = randomNumber.Uniform(0.0, 2 * M_PI); + dPhiLeadingJet = RecoDecay::constrainAngle(jets.iteratorAt(0).phi() - randomConePhi, static_cast(-M_PI)); + dEtaLeadingJet = jets.iteratorAt(0).eta() - randomConeEta; + } + if (jetWasInCone) { + randomConePt = 0.0; + for (auto const& track : tracks) { + if (jetderiveddatautilities::selectTrack(track, trackSelection)) { // if track selection is uniformTrack, dcaXY and dcaZ cuts need to be added as they aren't in the selection so that they can be studied here + float dPhi = RecoDecay::constrainAngle(track.phi() - randomConePhi, static_cast(-M_PI)); + float dEta = track.eta() - randomConeEta; + if (TMath::Sqrt(dEta * dEta + dPhi * dPhi) < randomConeR) { + randomConePt += track.pt(); + } + } + } + } + } + + registry.fill(HIST("h2_centrality_rhorandomconewithoutleadingjet"), collision.centrality(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho()); + + // randomised eta,phi for tracks, to assess part of fluctuations coming from statistically independently emitted particles, removing tracks from 2 leading jets + double randomConePtWithoutOneLeadJet = 0; + double randomConePtWithoutTwoLeadJet = 0; + for (auto const& track : tracks) { + if (jetderiveddatautilities::selectTrack(track, trackSelection)) { + float dPhi = RecoDecay::constrainAngle(randomNumber.Uniform(0.0, 2 * M_PI) - randomConePhi, static_cast(-M_PI)); // ignores actual phi of track + float dEta = randomNumber.Uniform(trackEtaMin, trackEtaMax) - randomConeEta; // ignores actual eta of track + if (TMath::Sqrt(dEta * dEta + dPhi * dPhi) < randomConeR) { + if (!trackIsInJet(track, jets.iteratorAt(0))) { + randomConePtWithoutOneLeadJet += track.pt(); + if (!trackIsInJet(track, jets.iteratorAt(1))) { + randomConePtWithoutTwoLeadJet += track.pt(); + } + } + } + } + } + registry.fill(HIST("h2_centrality_rhorandomconerandomtrackdirectionwithoutoneleadingjets"), collision.centrality(), randomConePtWithoutOneLeadJet - M_PI * randomConeR * randomConeR * collision.rho()); + registry.fill(HIST("h2_centrality_rhorandomconerandomtrackdirectionwithouttwoleadingjets"), collision.centrality(), randomConePtWithoutTwoLeadJet - M_PI * randomConeR * randomConeR * collision.rho()); + } + + void processRho(soa::Filtered>::iterator const& collision, soa::Filtered const& tracks) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + int nTracks = 0; + for (auto const& track : tracks) { + if (jetderiveddatautilities::selectTrack(track, trackSelection)) { + nTracks++; + } + } + registry.fill(HIST("h2_centrality_ntracks"), collision.centrality(), nTracks); + registry.fill(HIST("h2_ntracks_rho"), nTracks, collision.rho()); + registry.fill(HIST("h2_ntracks_rhom"), nTracks, collision.rhoM()); + registry.fill(HIST("h2_centrality_rho"), collision.centrality(), collision.rho()); + registry.fill(HIST("h2_centrality_rhom"), collision.centrality(), collision.rhoM()); + } + PROCESS_SWITCH(JetBackgroundAnalysisTask, processRho, "QA for rho-area subtracted jets", false); + + void processBkgFluctuationsData(soa::Filtered>::iterator const& collision, soa::Join const& jets, soa::Filtered const& tracks) + { + bkgFluctuationsRandomCone(collision, jets, tracks); + } + PROCESS_SWITCH(JetBackgroundAnalysisTask, processBkgFluctuationsData, "QA for random cone estimation of background fluctuations in data", false); + + void processBkgFluctuationsMCD(soa::Filtered>::iterator const& collision, soa::Join const& jets, soa::Filtered const& tracks) + { + bkgFluctuationsRandomCone(collision, jets, tracks); + } + PROCESS_SWITCH(JetBackgroundAnalysisTask, processBkgFluctuationsMCD, "QA for random cone estimation of background fluctuations in mcd", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"jet-background-analysis"})}; } diff --git a/PWGJE/Tasks/jetSpectraCharged.cxx b/PWGJE/Tasks/jetSpectraCharged.cxx new file mode 100644 index 00000000000..77d31f5c69a --- /dev/null +++ b/PWGJE/Tasks/jetSpectraCharged.cxx @@ -0,0 +1,615 @@ +// 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. + +// Charged-particle jet spectra task +// +/// \author Nima Zardoshti +/// \author Aimeric Landou +/// \author Wenhui Feng + +#include +#include +#include +#include +#include + +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" + +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" + +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetFinder.h" +#include "PWGJE/Core/JetFindingUtilities.h" +#include "PWGJE/DataModel/Jet.h" + +#include "PWGJE/Core/JetDerivedDataUtilities.h" + +#include "EventFiltering/filterTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct JetSpectraChargedTask { + + using ChargedMCDMatchedJets = soa::Join; + using ChargedMCPMatchedJets = soa::Join; + using ChargedMCDMatchedJetsWeighted = soa::Join; + using ChargedMCPMatchedJetsWeighted = soa::Join; + + HistogramRegistry registry; + + Configurable selectedJetsRadius{"selectedJetsRadius", 0.2, "resolution parameter for histograms without radius"}; + Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; + Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; + Configurable centralityMin{"centralityMin", -999.0, "minimum centrality"}; + Configurable centralityMax{"centralityMax", 999.0, "maximum centrality"}; + Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum eta acceptance for tracks"}; + Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum eta acceptance for tracks"}; + Configurable trackPtMin{"trackPtMin", 0.15, "minimum pT acceptance for tracks"}; + Configurable trackPtMax{"trackPtMax", 100.0, "maximum pT acceptance for tracks"}; + Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; + Configurable pTHatMaxMCD{"pTHatMaxMCD", 999.0, "maximum fraction of hard scattering for jet acceptance in detector MC"}; + Configurable pTHatExponent{"pTHatExponent", 6.0, "exponent of the event weight for the calculation of pTHat"}; + Configurable jetPtMax{"jetPtMax", 200., "set jet pT bin max"}; + Configurable jetEtaMin{"jetEtaMin", -0.7, "minimum jet pseudorapidity"}; + Configurable jetEtaMax{"jetEtaMax", 0.7, "maximum jet pseudorapidity"}; + Configurable nBinsEta{"nBinsEta", 200, "number of bins for eta axes"}; + Configurable jetAreaFractionMin{"jetAreaFractionMin", -99.0, "used to make a cut on the jet areas"}; + Configurable leadingConstituentPtMin{"leadingConstituentPtMin", -99.0, "minimum pT selection on jet constituent"}; + Configurable leadingConstituentPtMax{"leadingConstituentPtMax", 9999.0, "maximum pT selection on jet constituent"}; + Configurable trackOccupancyInTimeRangeMax{"trackOccupancyInTimeRangeMax", 999999, "maximum track occupancy of tracks in neighbouring collisions in a given time range; only applied to reconstructed collisions (data and mcd jets), not mc collisions (mcp jets)"}; + Configurable trackOccupancyInTimeRangeMin{"trackOccupancyInTimeRangeMin", -999999, "minimum track occupancy of tracks in neighbouring collisions in a given time range; only applied to reconstructed collisions (data and mcd jets), not mc collisions (mcp jets)"}; + Configurable checkGeoMatched{"checkGeoMatched", true, "0: turn off geometry matching, 1: do geometry matching "}; + Configurable checkPtMatched{"checkPtMatched", true, "0: turn off pT matching, 1: do pT matching"}; + Configurable checkGeoPtMatched{"checkGeoPtMatched", true, "0: turn off geometry and pT matching, 1: do geometry and pT matching"}; + + int eventSelection = -1; + int trackSelection = -1; + + void init(o2::framework::InitContext&) + { + eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(eventSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + + AxisSpec centralityAxis = {1200, -10., 110., "Centrality"}; + AxisSpec trackPtAxis = {200, -0.5, 199.5, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec trackEtaAxis = {nBinsEta, trackEtaMin, trackEtaMax, "#eta"}; + AxisSpec PhiAxis = {160, -1.0, 7.0, "#varphi"}; + AxisSpec jetPtAxis = {200, 0., 200., "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec jetPtAxisRhoAreaSub = {400, -200., 200., "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec jetEtaAxis = {nBinsEta, jetEtaMin, jetEtaMax, "#eta"}; + + if (doprocessQC || doprocessQCWeighted) { + registry.add("h_collisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); + registry.add("h2_centrality_occupancy", "centrality vs occupancy; centrality; occupancy", {HistType::kTH2F, {centralityAxis, {60, 0, 30000}}}); + registry.add("h_collisions_vertexZ", "position of collision ;#it{Z} (cm)", {HistType::kTH1F, {{300, -15.0, 15.0}}}); + registry.add("h_track_pt", "track pT ; #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH1F, {trackPtAxis}}); + registry.add("h2_track_eta_track_phi", "track eta vs. track phi; #eta; #phi; counts", {HistType::kTH2F, {trackEtaAxis, PhiAxis}}); + registry.add("h_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c}); counts", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h_jet_eta", "jet eta;#eta; counts", {HistType::kTH1F, {jetEtaAxis}}); + registry.add("h_jet_phi", "jet phi;#phi; counts", {HistType::kTH1F, {PhiAxis}}); + if (doprocessQCWeighted) { + registry.add("h_collisions_weighted", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); + } + } + + if (doprocessSpectraData || doprocessSpectraMCD || doprocessSpectraMCDWeighted) { + registry.add("h_jet_pt_rhoareasubtracted", "jet pT;#it{p}_{T,jet} (GeV/#it{c}); counts", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h2_centrality_jet_pt_rhoareasubtracted", "centrality vs. jet pT;centrality; #it{p}_{T,jet} (GeV/#it{c}); counts", {HistType::kTH2F, {centralityAxis, jetPtAxisRhoAreaSub}}); + registry.add("h2_centrality_jet_eta_rhoareasubtracted", "centrality vs. jet eta;centrality; #eta; counts", {HistType::kTH2F, {centralityAxis, jetEtaAxis}}); + registry.add("h2_centrality_jet_phi_rhoareasubtracted", "centrality vs. jet phi;centrality; #varphi; counts", {HistType::kTH2F, {centralityAxis, PhiAxis}}); + registry.add("h2_jet_pt_jet_area_rhoareasubtracted", "jet #it{p}_{T,jet} vs. Area_{jet}; #it{p}_{T,jet} (GeV/#it{c}); Area_{jet}", {HistType::kTH2F, {jetPtAxis, {150, 0., 1.5}}}); + registry.add("h2_jet_pt_jet_ntracks_rhoareasubtracted", "jet #it{p}_{T,jet} vs. N_{jet tracks}; #it{p}_{T,jet} (GeV/#it{c}); N_{jet, tracks}", {HistType::kTH2F, {jetPtAxis, {200, -0.5, 199.5}}}); + registry.add("h2_jet_pt_jet_corr_pt_rhoareasubtracted", "jet #it{p}_{T,jet} vs. #it{p}_{T,corr}; #it{p}_{T,jet} (GeV/#it{c}); #it{p}_{T,corr} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxis, jetPtAxisRhoAreaSub}}); + registry.add("h2_jet_pt_track_pt_rhoareasubtracted", "jet #it{p}_{T,jet} vs. #it{p}_{T,track}; #it{p}_{T,jet} (GeV/#it{c}); #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, trackPtAxis}}); + registry.add("h3_jet_pt_eta_phi_rhoareasubtracted", "jet_pt_eta_phi_rhoareasubtracted", {HistType::kTH3F, {jetPtAxisRhoAreaSub, jetEtaAxis, PhiAxis}}); + if (doprocessSpectraMCDWeighted) { + registry.add("h_jet_phat", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{1000, 0, 1000}}}); + registry.add("h_jet_phat_weighted", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{1000, 0, 1000}}}); + } + } + + if (doprocessEvtWiseConstSubJetsData || doprocessEvtWiseConstSubJetsMCD) { + registry.add("h2_centrality_jet_pt_eventwiseconstituentsubtracted", "centrality vs. jet pT;centrality;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH2F, {centralityAxis, jetPtAxis}}); + registry.add("jet_observables_eventwiseconstituentsubtracted", "jet_observables_eventwiseconstituentsubtracted", HistType::kTHnSparseF, {jetPtAxis, jetEtaAxis, PhiAxis}); + } + + if (doprocessJetsMatched || doprocessJetsMatchedWeighted) { + if (checkGeoMatched) { + registry.add("h2_jet_pt_tag_jet_pt_base_matchedgeo", "pT tag vs. pT base;#it{p}_{T,jet}^{tag} (GeV/#it{c});#it{p}_{T,jet}^{base} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxis, jetPtAxis}}); + registry.add("h2_jet_eta_tag_jet_eta_base_matchedgeo", "Eta tag vs. Eta base;#eta_{jet}^{tag};#eta_{jet}^{base}", {HistType::kTH2F, {jetEtaAxis, jetEtaAxis}}); + registry.add("h2_jet_phi_tag_jet_phi_base_matchedgeo", "Phi tag vs. Phi base;#varphi_{jet}^{tag};#varphi_{jet}^{base}", {HistType::kTH2F, {PhiAxis, PhiAxis}}); + registry.add("h2_jet_ntracks_tag_jet_ntracks_base_matchedgeo", "Ntracks tag vs. Ntracks base;N_{jet tracks}^{tag};N_{jet tracks}^{base}", {HistType::kTH2F, {{200, -0.5, 199.5}, {200, -0.5, 199.5}}}); + registry.add("h2_jet_pt_tag_jet_pt_diff_matchedgeo", "jet tag pT vs. delta pT / jet tag pt;#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxis, {1000, -5.0, 2.0}}}); + registry.add("h2_jet_pt_base_jet_pt_diff_matchedgeo", "jet base pT vs. delta pT / jet base pt;#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxis, {1000, -5.0, 2.0}}}); + } + if (checkPtMatched) { + registry.add("h2_jet_pt_tag_jet_pt_base_matchedpt", "pT tag vs. pT base;#it{p}_{T,jet}^{tag} (GeV/#it{c});#it{p}_{T,jet}^{base} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxis, jetPtAxis}}); + registry.add("h2_jet_eta_tag_jet_eta_base_matchedpt", "Eta tag vs. Eta base;#eta_{jet}^{tag};#eta_{jet}^{base}", {HistType::kTH2F, {jetEtaAxis, jetEtaAxis}}); + registry.add("h2_jet_phi_tag_jet_phi_base_matchedpt", "Phi tag vs. Phi base;#varphi_{jet}^{tag};#varphi_{jet}^{base}", {HistType::kTH2F, {PhiAxis, PhiAxis}}); + registry.add("h2_jet_ntracks_tag_jet_ntracks_base_matchedpt", "Ntracks tag vs. Ntracks base;N_{jet tracks}^{tag};N_{jet tracks}^{base}", {HistType::kTH2F, {{200, -0.5, 199.5}, {200, -0.5, 199.5}}}); + registry.add("h2_jet_pt_tag_jet_pt_diff_matchedpt", "jet tag pT vs. delta pT / jet tag pt;#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxis, {1000, -5.0, 2.0}}}); + registry.add("h2_jet_pt_base_jet_pt_diff_matchedpt", "jet base pT vs. delta pT / jet base pt;#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxis, {1000, -5.0, 2.0}}}); + } + if (checkGeoPtMatched) { + registry.add("h2_jet_pt_tag_jet_pt_base_matchedgeopt", "pT tag vs. pT base;#it{p}_{T,jet}^{tag} (GeV/#it{c});#it{p}_{T,jet}^{base} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxis, jetPtAxis}}); + registry.add("h2_jet_eta_tag_jet_eta_base_matchedgeopt", "Eta tag vs. Eta base;#eta_{jet}^{tag};#eta_{jet}^{base}", {HistType::kTH2F, {jetEtaAxis, jetEtaAxis}}); + registry.add("h2_jet_phi_tag_jet_phi_base_matchedgeopt", "Phi tag vs. Phi base;#varphi_{jet}^{tag};#varphi_{jet}^{base}", {HistType::kTH2F, {PhiAxis, PhiAxis}}); + registry.add("h2_jet_ntracks_tag_jet_ntracks_base_matchedgeopt", "Ntracks tag vs. Ntracks base;N_{jet tracks}^{tag};N_{jet tracks}^{base}", {HistType::kTH2F, {{200, -0.5, 199.5}, {200, -0.5, 199.5}}}); + registry.add("h2_jet_pt_tag_jet_pt_diff_matchedgeopt", "jet tag pT vs. delta pT / jet tag pt;#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxis, {1000, -5.0, 2.0}}}); + registry.add("h2_jet_pt_base_jet_pt_diff_matchedgeopt", "jet base pT vs. delta pT / jet base pt;#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxis, {1000, -5.0, 2.0}}}); + } + } + + if (doprocessJetsMatchedSubtracted) { + registry.add("h2_jet_pt_tag_jet_pt_base_corr_matchedgeo", "pT tag vs. corr pT base;#it{p}_{T,jet}^{tag} (GeV/#it{c});#it{p}_{T,jet}^{base} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxis, jetPtAxis}}); + registry.add("h2_jet_pt_tag_jet_pt_diff_corr_matchedgeo", "jet tag pT vs. corr delta pT / jet tag pt;#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxis, {1000, -5.0, 2.0}}}); + registry.add("h2_jet_pt_base_jet_pt_diff_corr_matchedgeo", "jet base pT vs. corr delta pT / jet base pt;#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxis, {1000, -5.0, 2.0}}}); + } + } + + Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); + Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); + + template + bool isAcceptedJet(TJets const& jet) + { + + if (jetAreaFractionMin > -98.0) { + if (jet.area() < jetAreaFractionMin * M_PI * (jet.r() / 100.0) * (jet.r() / 100.0)) { + return false; + } + } + bool checkConstituentPt = true; + bool checkConstituentMinPt = (leadingConstituentPtMin > -98.0); + bool checkConstituentMaxPt = (leadingConstituentPtMax < 9998.0); + if (!checkConstituentMinPt && !checkConstituentMaxPt) { + checkConstituentPt = false; + } + + if (checkConstituentPt) { + bool isMinLeadingConstituent = !checkConstituentMinPt; + bool isMaxLeadingConstituent = true; + + for (const auto& constituent : jet.template tracks_as()) { + double pt = constituent.pt(); + + if (checkConstituentMinPt && pt >= leadingConstituentPtMin) { + isMinLeadingConstituent = true; + } + if (checkConstituentMaxPt && pt > leadingConstituentPtMax) { + isMaxLeadingConstituent = false; + } + } + return isMinLeadingConstituent && isMaxLeadingConstituent; + } + return true; + } + + template + void fillJetHistograms(TJets const& jet, float centrality, float rho, float weight = 1.0) + { + if (jet.r() == round(selectedJetsRadius * 100.0f)) { + Double_t jetcorrpt = jet.pt() - (rho * jet.area()); + // fill jet histograms after area-based subtraction + registry.fill(HIST("h_jet_pt_rhoareasubtracted"), jetcorrpt, weight); + registry.fill(HIST("h2_centrality_jet_pt_rhoareasubtracted"), centrality, jetcorrpt, weight); + registry.fill(HIST("h2_centrality_jet_eta_rhoareasubtracted"), centrality, jet.eta(), weight); + registry.fill(HIST("h2_centrality_jet_phi_rhoareasubtracted"), centrality, jet.phi(), weight); + registry.fill(HIST("h2_jet_pt_jet_corr_pt_rhoareasubtracted"), jet.pt(), jetcorrpt, weight); + registry.fill(HIST("h3_jet_pt_eta_phi_rhoareasubtracted"), jetcorrpt, jet.eta(), jet.phi(), weight); + if (jetcorrpt > 0) { + registry.fill(HIST("h2_jet_pt_jet_area_rhoareasubtracted"), jetcorrpt, jet.area(), weight); + registry.fill(HIST("h2_jet_pt_jet_ntracks_rhoareasubtracted"), jetcorrpt, jet.tracksIds().size(), weight); + } + } + + for (auto& constituent : jet.template tracks_as()) { + registry.fill(HIST("h2_jet_pt_track_pt_rhoareasubtracted"), jet.pt(), constituent.pt(), weight); + } + } + + template + void fillEventWiseConstituentSubtractedHistograms(TJets const& jet, float centrality, float weight = 1.0) + { + if (jet.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h2_centrality_jet_pt_eventwiseconstituentsubtracted"), centrality, jet.pt(), weight); + registry.fill(HIST("jet_observables_eventwiseconstituentsubtracted"), jet.pt(), jet.eta(), jet.phi(), weight); + } + } + + template + void fillTrackHistograms(TTracks const& track, float weight = 1.0) + { + registry.fill(HIST("h_track_pt"), track.pt(), weight); + registry.fill(HIST("h2_track_eta_track_phi"), track.eta(), track.phi(), weight); + } + + template + void fillMatchedHistograms(TBase const& jetBase, float weight = 1.0) + { + float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); + if (jetBase.pt() > pTHatMaxMCD * pTHat) { + return; + } + // fill geometry matched histograms + if (checkGeoMatched) { + if (jetBase.has_matchedJetGeo()) { + for (auto& jetTag : jetBase.template matchedJetGeo_as>()) { + if (jetTag.pt() > pTHatMaxMCD * pTHat) { + continue; + } + if (jetBase.r() == round(selectedJetsRadius * 100.0f)) { + Double_t dpt = jetTag.pt() - jetBase.pt(); + registry.fill(HIST("h2_jet_pt_tag_jet_pt_base_matchedgeo"), jetTag.pt(), jetBase.pt(), weight); + registry.fill(HIST("h2_jet_eta_tag_jet_eta_base_matchedgeo"), jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h2_jet_phi_tag_jet_phi_base_matchedgeo"), jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h2_jet_ntracks_tag_jet_ntracks_base_matchedgeo"), jetTag.tracksIds().size(), jetBase.tracksIds().size(), weight); + registry.fill(HIST("h2_jet_pt_tag_jet_pt_diff_matchedgeo"), jetTag.pt(), dpt / jetTag.pt(), weight); + registry.fill(HIST("h2_jet_pt_base_jet_pt_diff_matchedgeo"), jetBase.pt(), dpt / jetBase.pt(), weight); + } + } + } + } + // fill pt matched histograms + if (checkPtMatched) { + if (jetBase.has_matchedJetPt()) { + for (auto& jetTag : jetBase.template matchedJetPt_as>()) { + if (jetTag.pt() > pTHatMaxMCD * pTHat) { + continue; + } + if (jetBase.r() == round(selectedJetsRadius * 100.0f)) { + Double_t dpt = jetTag.pt() - jetBase.pt(); + registry.fill(HIST("h2_jet_pt_tag_jet_pt_base_matchedpt"), jetTag.pt(), jetBase.pt(), weight); + registry.fill(HIST("h2_jet_eta_tag_jet_eta_base_matchedpt"), jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h2_jet_phi_tag_jet_phi_base_matchedpt"), jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h2_jet_ntracks_tag_jet_ntracks_base_matchedpt"), jetTag.tracksIds().size(), jetBase.tracksIds().size(), weight); + registry.fill(HIST("h2_jet_pt_tag_jet_pt_diff_matchedpt"), jetTag.pt(), dpt / jetTag.pt(), weight); + registry.fill(HIST("h2_jet_pt_base_jet_pt_diff_matchedpt"), jetBase.pt(), dpt / jetBase.pt(), weight); + } + } + } + } + // fill geometry and pt histograms: + if (checkGeoPtMatched) { + if (jetBase.has_matchedJetGeo() && jetBase.has_matchedJetPt()) { + for (auto& jetTag : jetBase.template matchedJetGeo_as>()) { + if (jetTag.pt() > pTHatMaxMCD * pTHat) { + continue; + } + if (jetBase.template matchedJetGeo_first_as>().globalIndex() == jetBase.template matchedJetPt_first_as>().globalIndex()) { // not a good way to do this + Double_t dpt = jetTag.pt() - jetBase.pt(); + registry.fill(HIST("h2_jet_pt_tag_jet_pt_base_matchedgeopt"), jetTag.pt(), jetBase.pt(), weight); + registry.fill(HIST("h2_jet_eta_tag_jet_eta_base_matchedgeopt"), jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h2_jet_phi_tag_jet_phi_base_matchedgeopt"), jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h2_jet_ntracks_tag_jet_ntracks_base_matchedgeopt"), jetTag.tracksIds().size(), jetBase.tracksIds().size(), weight); + registry.fill(HIST("h2_jet_pt_tag_jet_pt_diff_matchedgeopt"), jetTag.pt(), dpt / jetTag.pt(), weight); + registry.fill(HIST("h2_jet_pt_base_jet_pt_diff_matchedgeopt"), jetBase.pt(), dpt / jetBase.pt(), weight); + } + } + } + } + } + + template + void fillGeoMatchedCorrHistograms(TBase const& jetBase, float rho, float weight = 1.0) + { + float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); + if (jetBase.pt() > pTHatMaxMCD * pTHat) { + return; + } + if (jetBase.has_matchedJetGeo()) { + for (auto& jetTag : jetBase.template matchedJetGeo_as>()) { + if (jetTag.pt() > pTHatMaxMCD * pTHat) { + continue; + } + if (jetBase.r() == round(selectedJetsRadius * 100.0f)) { + Double_t corrBasejetpt = jetBase.pt() - (rho * jetBase.area()); + Double_t dcorrpt = jetTag.pt() - corrBasejetpt; + registry.fill(HIST("h2_jet_pt_tag_jet_pt_base_corr_matchedgeo"), jetTag.pt(), corrBasejetpt, weight); + registry.fill(HIST("h2_jet_pt_tag_jet_pt_diff_corr_matchedgeo"), jetTag.pt(), dcorrpt / jetTag.pt(), weight); + registry.fill(HIST("h2_jet_pt_base_jet_pt_diff_corr_matchedgeo"), corrBasejetpt, dcorrpt / corrBasejetpt, weight); + } + } + } + } + + void processQC(soa::Filtered::iterator const& collision, + soa::Filtered> const& tracks, + soa::Join const& jets) + { + registry.fill(HIST("h_collisions"), 0.5); + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + registry.fill(HIST("h_collisions"), 1.5); + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + registry.fill(HIST("h_collisions"), 2.5); + registry.fill(HIST("h2_centrality_occupancy"), collision.centrality(), collision.trackOccupancyInTimeRange()); + registry.fill(HIST("h_collisions_vertexZ"), collision.posZ()); + + for (auto const& track : tracks) { + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { + continue; + } + fillTrackHistograms(track, collision.centrality()); + } + + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet)) { + continue; + } + registry.fill(HIST("h_jet_pt"), jet.pt()); + registry.fill(HIST("h_jet_eta"), jet.eta()); + registry.fill(HIST("h_jet_phi"), jet.phi()); + } + } + PROCESS_SWITCH(JetSpectraChargedTask, processQC, "collisions and track QC for Data and MCD", true); + + void processQCWeighted(soa::Join::iterator const& collision, + aod::JetMcCollisions const&, + soa::Filtered> const& tracks, + soa::Join const& jets) + { + float eventWeight = collision.mcCollision().weight(); + registry.fill(HIST("h_collisions"), 0.5); + registry.fill(HIST("h_collisions_weighted"), 0.5, eventWeight); + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + registry.fill(HIST("h_collisions"), 1.5); + registry.fill(HIST("h_collisions_weighted"), 1.5, eventWeight); + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + registry.fill(HIST("h_collisions"), 2.5); + registry.fill(HIST("h_collisions_weighted"), 2.5, eventWeight); + registry.fill(HIST("h_collisions_vertexZ"), collision.posZ(), eventWeight); + + for (auto const& track : tracks) { + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { + continue; + } + fillTrackHistograms(track, eventWeight); + } + + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet)) { + continue; + } + registry.fill(HIST("h_jet_pt"), jet.pt(), eventWeight); + registry.fill(HIST("h_jet_eta"), jet.eta(), eventWeight); + registry.fill(HIST("h_jet_phi"), jet.phi(), eventWeight); + } + } + PROCESS_SWITCH(JetSpectraChargedTask, processQCWeighted, "weighted collsions and tracks QC for MC", false); + + void processSpectraData(soa::Filtered>::iterator const& collision, + soa::Join const& jets, + aod::JetTracks const&) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet)) { + continue; + } + fillJetHistograms(jet, collision.centrality(), collision.rho()); + } + } + PROCESS_SWITCH(JetSpectraChargedTask, processSpectraData, "jet spectra for Data", false); + + void processSpectraMCD(soa::Filtered>::iterator const& collision, + soa::Join const& jets, + aod::JetTracks const&) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet)) { + continue; + } + fillJetHistograms(jet, collision.centrality(), collision.rho()); + } + } + PROCESS_SWITCH(JetSpectraChargedTask, processSpectraMCD, "jet spectra for Data", false); + + void processSpectraMCDWeighted(soa::Filtered>::iterator const& collision, + soa::Join const& jets, + aod::JetTracks const&) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet)) { + continue; + } + float jetweight = jet.eventWeight(); + float pTHat = 10. / (std::pow(jetweight, 1.0 / pTHatExponent)); + if (jet.pt() > pTHatMaxMCD * pTHat) { + return; + } + registry.fill(HIST("h_jet_phat"), pTHat); + registry.fill(HIST("h_jet_phat_weighted"), pTHat, jetweight); + fillJetHistograms(jet, collision.centrality(), collision.rho(), jetweight); + } + } + PROCESS_SWITCH(JetSpectraChargedTask, processSpectraMCDWeighted, "jet finder QA mcd with weighted events", false); + + void processEvtWiseConstSubJetsData(soa::Filtered::iterator const& collision, + soa::Join const& jets, + aod::JetTracksSub const&) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet)) { + continue; + } + fillEventWiseConstituentSubtractedHistograms(jet, collision.centrality()); + } + } + PROCESS_SWITCH(JetSpectraChargedTask, processEvtWiseConstSubJetsData, "jet spectrum for eventwise constituent-subtracted jets data", false); + + void processEvtWiseConstSubJetsMCD(soa::Filtered::iterator const& collision, + soa::Join const& jets, + aod::JetTracksSub const&) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet)) { + continue; + } + fillEventWiseConstituentSubtractedHistograms(jet, collision.centrality()); + } + } + PROCESS_SWITCH(JetSpectraChargedTask, processEvtWiseConstSubJetsMCD, "jet spectrum for eventwise constituent-subtracted mcd jets", false); + + void processJetsMatched(soa::Filtered::iterator const& collision, + ChargedMCDMatchedJets const& mcdjets, + ChargedMCPMatchedJets const&, + aod::JetTracks const&, aod::JetParticles const&) + { + registry.fill(HIST("h_collisions"), 0.5); + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + registry.fill(HIST("h_collisions"), 1.5); + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + registry.fill(HIST("h_collisions"), 2.5); + + for (const auto& mcdjet : mcdjets) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(mcdjet)) { + continue; + } + registry.fill(HIST("h_jet_pt_mcd"), mcdjet.pt()); + registry.fill(HIST("h_jet_eta_mcd"), mcdjet.eta()); + registry.fill(HIST("h_jet_phi_mcd"), mcdjet.phi()); + fillMatchedHistograms(mcdjet); + } + } + PROCESS_SWITCH(JetSpectraChargedTask, processJetsMatched, "matched mcp and mcd jets", false); + + void processJetsMatchedWeighted(soa::Filtered::iterator const& collision, + ChargedMCDMatchedJetsWeighted const& mcdjets, + ChargedMCPMatchedJetsWeighted const&, + aod::JetTracks const&, aod::JetParticles const&) + { + registry.fill(HIST("h_collisions"), 0.5); + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + registry.fill(HIST("h_collisions"), 1.5); + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + registry.fill(HIST("h_collisions"), 2.5); + for (const auto& mcdjet : mcdjets) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(mcdjet)) { + continue; + } + fillMatchedHistograms(mcdjet, mcdjet.eventWeight()); + } + } + PROCESS_SWITCH(JetSpectraChargedTask, processJetsMatchedWeighted, "matched mcp and mcd jets with weighted events", false); + + void processJetsMatchedSubtracted(soa::Filtered>::iterator const& collision, + ChargedMCDMatchedJets const& mcdjets, + ChargedMCPMatchedJets const&, + aod::JetTracks const&, aod::JetParticles const&) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + + for (const auto& mcdjet : mcdjets) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(mcdjet)) { + continue; + } + // now only do subtraction for MCD jets, need to add subtraction for MCP jets + fillGeoMatchedCorrHistograms(mcdjet, collision.rho()); + } + } + PROCESS_SWITCH(JetSpectraChargedTask, processJetsMatchedSubtracted, "matched mcp and mcd jets after subtraction", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"jet-charged-spectra"})}; +} diff --git a/PWGLF/TableProducer/Common/spvector.cxx b/PWGLF/TableProducer/Common/spvector.cxx index 12dae20d07d..20f5f738255 100644 --- a/PWGLF/TableProducer/Common/spvector.cxx +++ b/PWGLF/TableProducer/Common/spvector.cxx @@ -272,20 +272,28 @@ struct spvector { int lastRunNumber = -999; TH2D* gainprofile; TProfile* gainprofilevxy; - THnF* hrecentereSp; + /*THnF* hrecentereSp; TH2F* hrecenterecentSp; TH2F* hrecenterevxSp; TH2F* hrecenterevySp; - TH2F* hrecenterevzSp; + TH2F* hrecenterevzSp;*/ + std::array hrecentereSpA; // Array of 6 histograms + std::array hrecenterecentSpA; // Array of 5 histograms + std::array hrecenterevxSpA; // Array of 5 histograms + std::array hrecenterevySpA; // Array of 5 histograms + std::array hrecenterevzSpA; // Array of 5 histograms TProfile3D* shiftprofileA; TProfile3D* shiftprofileC; - Bool_t Correctcoarse(int64_t ts, Configurable& ConfRecentereSpp, bool useRecentereSp, int currentRunNumber, int lastRunNumber, auto centrality, auto vx, auto vy, auto vz, auto& qxZDCA, auto& qyZDCA, auto& qxZDCC, auto& qyZDCC) + // Bool_t Correctcoarse(int64_t ts, Configurable& ConfRecentereSpp, bool useRecentereSp, int currentRunNumber, int lastRunNumber, auto centrality, auto vx, auto vy, auto vz, auto& qxZDCA, auto& qyZDCA, auto& qxZDCC, auto& qyZDCC) + //{ + Bool_t Correctcoarse(const THnF* hrecentereSp, auto centrality, auto vx, auto vy, auto vz, auto& qxZDCA, auto& qyZDCA, auto& qxZDCC, auto& qyZDCC) { + /* if (useRecentereSp && (currentRunNumber != lastRunNumber)) { hrecentereSp = ccdb->getForTimeStamp(ConfRecentereSpp.value, ts); - } + }*/ int binCoords[5]; @@ -328,15 +336,22 @@ struct spvector { return kTRUE; } - Bool_t Correctfine(int64_t ts, Configurable& ConfRecenterecentSpp, Configurable& ConfRecenterevxSpp, Configurable& ConfRecenterevySpp, Configurable& ConfRecenterevzSpp, bool useRecenterefineSp, int currentRunNumber, int lastRunNumber, auto centrality, auto vx, auto vy, auto vz, auto& qxZDCA, auto& qyZDCA, auto& qxZDCC, auto& qyZDCC) + // Bool_t Correctfine(int64_t ts, Configurable& ConfRecenterecentSpp, Configurable& ConfRecenterevxSpp, Configurable& ConfRecenterevySpp, Configurable& ConfRecenterevzSpp, bool useRecenterefineSp, int currentRunNumber, int lastRunNumber, auto centrality, auto vx, auto vy, auto vz, auto& qxZDCA, auto& qyZDCA, auto& qxZDCC, auto& qyZDCC) + //{ + Bool_t Correctfine(TH2F* hrecenterecentSp, TH2F* hrecenterevxSp, TH2F* hrecenterevySp, TH2F* hrecenterevzSp, auto centrality, auto vx, auto vy, auto vz, auto& qxZDCA, auto& qyZDCA, auto& qxZDCC, auto& qyZDCC) { + if (!hrecenterecentSp || !hrecenterevxSp || !hrecenterevySp || !hrecenterevzSp) { + std::cerr << "Error: One or more histograms are null." << std::endl; + return false; + } + /* if (useRecenterefineSp && (currentRunNumber != lastRunNumber)) { hrecenterecentSp = ccdb->getForTimeStamp(ConfRecenterecentSpp.value, ts); hrecenterevxSp = ccdb->getForTimeStamp(ConfRecenterevxSpp.value, ts); hrecenterevySp = ccdb->getForTimeStamp(ConfRecenterevySpp.value, ts); hrecenterevzSp = ccdb->getForTimeStamp(ConfRecenterevzSpp.value, ts); - } + }*/ double meanxAcent = hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality, 0.5)); double meanyAcent = hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality, 1.5)); @@ -517,47 +532,96 @@ struct spvector { Bool_t resfine = 0; if (coarse1) { - res = Correctcoarse(bc.timestamp(), ConfRecentereSp, useRecentereSp, currentRunNumber, lastRunNumber, centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); + if (useRecentereSp && (currentRunNumber != lastRunNumber)) { + hrecentereSpA[0] = ccdb->getForTimeStamp(ConfRecentereSp.value, bc.timestamp()); + } + res = Correctcoarse(hrecentereSpA[0], centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); } if (fine1) { - resfine = Correctfine(bc.timestamp(), ConfRecenterecentSp, ConfRecenterevxSp, ConfRecenterevySp, ConfRecenterevzSp, useRecenterefineSp, currentRunNumber, lastRunNumber, centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); + + if (useRecenterefineSp && (currentRunNumber != lastRunNumber)) { + hrecenterecentSpA[0] = ccdb->getForTimeStamp(ConfRecenterecentSp.value, bc.timestamp()); + hrecenterevxSpA[0] = ccdb->getForTimeStamp(ConfRecenterevxSp.value, bc.timestamp()); + hrecenterevySpA[0] = ccdb->getForTimeStamp(ConfRecenterevySp.value, bc.timestamp()); + hrecenterevzSpA[0] = ccdb->getForTimeStamp(ConfRecenterevzSp.value, bc.timestamp()); + } + resfine = Correctfine(hrecenterecentSpA[0], hrecenterevxSpA[0], hrecenterevySpA[0], hrecenterevzSpA[0], centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); } if (coarse2) { - res = Correctcoarse(bc.timestamp(), ConfRecentereSp2, useRecentereSp, currentRunNumber, lastRunNumber, centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); + if (useRecentereSp && (currentRunNumber != lastRunNumber)) { + hrecentereSpA[1] = ccdb->getForTimeStamp(ConfRecentereSp2.value, bc.timestamp()); + } + res = Correctcoarse(hrecentereSpA[1], centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); } if (fine2) { - resfine = Correctfine(bc.timestamp(), ConfRecenterecentSp2, ConfRecenterevxSp2, ConfRecenterevySp2, ConfRecenterevzSp2, useRecenterefineSp, currentRunNumber, lastRunNumber, centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); + if (useRecenterefineSp && (currentRunNumber != lastRunNumber)) { + hrecenterecentSpA[1] = ccdb->getForTimeStamp(ConfRecenterecentSp2.value, bc.timestamp()); + hrecenterevxSpA[1] = ccdb->getForTimeStamp(ConfRecenterevxSp2.value, bc.timestamp()); + hrecenterevySpA[1] = ccdb->getForTimeStamp(ConfRecenterevySp2.value, bc.timestamp()); + hrecenterevzSpA[1] = ccdb->getForTimeStamp(ConfRecenterevzSp2.value, bc.timestamp()); + } + resfine = Correctfine(hrecenterecentSpA[1], hrecenterevxSpA[1], hrecenterevySpA[1], hrecenterevzSpA[1], centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); } if (coarse3) { - res = Correctcoarse(bc.timestamp(), ConfRecentereSp3, useRecentereSp, currentRunNumber, lastRunNumber, centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); + if (useRecentereSp && (currentRunNumber != lastRunNumber)) { + hrecentereSpA[2] = ccdb->getForTimeStamp(ConfRecentereSp3.value, bc.timestamp()); + } + res = Correctcoarse(hrecentereSpA[2], centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); } if (fine3) { - resfine = Correctfine(bc.timestamp(), ConfRecenterecentSp3, ConfRecenterevxSp3, ConfRecenterevySp3, ConfRecenterevzSp3, useRecenterefineSp, currentRunNumber, lastRunNumber, centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); + if (useRecenterefineSp && (currentRunNumber != lastRunNumber)) { + hrecenterecentSpA[2] = ccdb->getForTimeStamp(ConfRecenterecentSp3.value, bc.timestamp()); + hrecenterevxSpA[2] = ccdb->getForTimeStamp(ConfRecenterevxSp3.value, bc.timestamp()); + hrecenterevySpA[2] = ccdb->getForTimeStamp(ConfRecenterevySp3.value, bc.timestamp()); + hrecenterevzSpA[2] = ccdb->getForTimeStamp(ConfRecenterevzSp3.value, bc.timestamp()); + } + resfine = Correctfine(hrecenterecentSpA[2], hrecenterevxSpA[2], hrecenterevySpA[2], hrecenterevzSpA[2], centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); } if (coarse4) { - res = Correctcoarse(bc.timestamp(), ConfRecentereSp4, useRecentereSp, currentRunNumber, lastRunNumber, centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); + if (useRecentereSp && (currentRunNumber != lastRunNumber)) { + hrecentereSpA[3] = ccdb->getForTimeStamp(ConfRecentereSp4.value, bc.timestamp()); + } + res = Correctcoarse(hrecentereSpA[3], centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); } if (fine4) { - resfine = Correctfine(bc.timestamp(), ConfRecenterecentSp4, ConfRecenterevxSp4, ConfRecenterevySp4, ConfRecenterevzSp4, useRecenterefineSp, currentRunNumber, lastRunNumber, centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); + if (useRecenterefineSp && (currentRunNumber != lastRunNumber)) { + hrecenterecentSpA[3] = ccdb->getForTimeStamp(ConfRecenterecentSp4.value, bc.timestamp()); + hrecenterevxSpA[3] = ccdb->getForTimeStamp(ConfRecenterevxSp4.value, bc.timestamp()); + hrecenterevySpA[3] = ccdb->getForTimeStamp(ConfRecenterevySp4.value, bc.timestamp()); + hrecenterevzSpA[3] = ccdb->getForTimeStamp(ConfRecenterevzSp4.value, bc.timestamp()); + } + resfine = Correctfine(hrecenterecentSpA[3], hrecenterevxSpA[3], hrecenterevySpA[3], hrecenterevzSpA[3], centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); } if (coarse5) { - res = Correctcoarse(bc.timestamp(), ConfRecentereSp5, useRecentereSp, currentRunNumber, lastRunNumber, centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); + if (useRecentereSp && (currentRunNumber != lastRunNumber)) { + hrecentereSpA[4] = ccdb->getForTimeStamp(ConfRecentereSp5.value, bc.timestamp()); + } + res = Correctcoarse(hrecentereSpA[4], centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); } if (fine5) { - resfine = Correctfine(bc.timestamp(), ConfRecenterecentSp5, ConfRecenterevxSp5, ConfRecenterevySp5, ConfRecenterevzSp5, useRecenterefineSp, currentRunNumber, lastRunNumber, centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); + if (useRecenterefineSp && (currentRunNumber != lastRunNumber)) { + hrecenterecentSpA[4] = ccdb->getForTimeStamp(ConfRecenterecentSp5.value, bc.timestamp()); + hrecenterevxSpA[4] = ccdb->getForTimeStamp(ConfRecenterevxSp5.value, bc.timestamp()); + hrecenterevySpA[4] = ccdb->getForTimeStamp(ConfRecenterevySp5.value, bc.timestamp()); + hrecenterevzSpA[4] = ccdb->getForTimeStamp(ConfRecenterevzSp5.value, bc.timestamp()); + } + resfine = Correctfine(hrecenterecentSpA[4], hrecenterevxSpA[4], hrecenterevySpA[4], hrecenterevzSpA[4], centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); } if (coarse6) { - res = Correctcoarse(bc.timestamp(), ConfRecentereSp6, useRecentereSp, currentRunNumber, lastRunNumber, centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); + if (useRecentereSp && (currentRunNumber != lastRunNumber)) { + hrecentereSpA[5] = ccdb->getForTimeStamp(ConfRecentereSp6.value, bc.timestamp()); + } + res = Correctcoarse(hrecentereSpA[5], centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC); } if (res == 0 || resfine == 0) { diff --git a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx index 860272354c4..016dec7e81d 100644 --- a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx +++ b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx @@ -104,10 +104,10 @@ struct he3HadCandidate { float recoPtHe3() const { return signHe3 * std::hypot(momHe3[0], momHe3[1]); } float recoPhiHe3() const { return std::atan2(momHe3[1], momHe3[0]); } - float recoEtaHe3() const { return std::asinh(momHe3[2] / recoPtHe3()); } + float recoEtaHe3() const { return std::asinh(momHe3[2] / std::abs(recoPtHe3())); } float recoPtHad() const { return signHad * std::hypot(momHad[0], momHad[1]); } float recoPhiHad() const { return std::atan2(momHad[1], momHad[0]); } - float recoEtaHad() const { return std::asinh(momHad[2] / recoPtHad()); } + float recoEtaHad() const { return std::asinh(momHad[2] / std::abs(recoPtHad())); } std::array momHe3 = {99.f, 99.f, 99.f}; std::array momHad = {99.f, 99.f, 99.f}; diff --git a/PWGLF/TableProducer/Nuspex/hypKfRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hypKfRecoTask.cxx index 4dcdf0f67ec..f17b5f3c5bc 100644 --- a/PWGLF/TableProducer/Nuspex/hypKfRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hypKfRecoTask.cxx @@ -37,7 +37,7 @@ #include "DCAFitter/DCAFitterN.h" #include "Common/DataModel/PIDResponse.h" #include "PWGLF/DataModel/LFHypernucleiKfTables.h" -#include "TRandom.h" +#include "TRandom3.h" #include "Common/DataModel/CollisionAssociationTables.h" // KFParticle @@ -171,50 +171,36 @@ constexpr double preSelectionsCascades[nCascades][nSelCas]{ //---------------------------------------------------------------------------------------------------------------- struct DaughterParticle { TString name; - int pdgCode; - double mass; - int charge; - double resolution; + int pdgCode, charge; + double mass, resolution; std::vector betheParams; - - DaughterParticle(std::string name_, int pdgCode_, double mass_, int charge_, LabeledArray bethe) + bool active; + DaughterParticle(std::string name_, int pdgCode_, double mass_, int charge_, LabeledArray bethe) : name(name_), pdgCode(pdgCode_), charge(charge_), mass(mass_), active(false) { - name = TString(name_); - pdgCode = pdgCode_; - mass = mass_; - charge = charge_; resolution = bethe.get(name, "resolution"); betheParams.clear(); for (unsigned int i = 0; i < 5; i++) betheParams.push_back(bethe.get(name, i)); } -}; // class DaughterParticle +}; // struct DaughterParticle struct HyperNucleus { TString name; int pdgCode; - double massMax; - double massMin; bool active; - std::vector daughters; - std::vector daughterTrackSigns; - - HyperNucleus(std::string name_, int pdgCode_, bool active_, std::vector daughters_, std::vector daughterTrackSigns_) + std::vector daughters, daughterTrackSigns; + HyperNucleus(std::string name_, int pdgCode_, bool active_, std::vector daughters_, std::vector daughterTrackSigns_) : pdgCode(pdgCode_), active(active_) { - name = TString(name_); - pdgCode = pdgCode_; - active = active_; - for (const int& d : daughters_) - daughters.push_back(d); - for (const int& dc : daughterTrackSigns_) - daughterTrackSigns.push_back(dc); + init(name_, daughters_, daughterTrackSigns_); } - HyperNucleus(std::string name_, int pdgCode_, bool active_, int hypDaughter, std::vector daughters_, std::vector daughterTrackSigns_) + HyperNucleus(std::string name_, int pdgCode_, bool active_, int hypDaughter, std::vector daughters_, std::vector daughterTrackSigns_) : pdgCode(pdgCode_), active(active_) { daughters.push_back(hypDaughter); + init(name_, daughters_, daughterTrackSigns_); + } + void init(std::string name_, std::vector daughters_, std::vector daughterTrackSigns_) + { name = TString(name_); - pdgCode = pdgCode_; - active = active_; for (const int& d : daughters_) daughters.push_back(d); for (const int& dc : daughterTrackSigns_) @@ -223,83 +209,78 @@ struct HyperNucleus { int getNdaughters() { return static_cast(daughters.size()); } const char* motherName() { return name.Contains("->") ? ((TString)name(0, name.First("-"))).Data() : name.Data(); } const char* daughterNames() { return name.Contains("->") ? ((TString)name(name.First("-") + 2, name.Length())).Data() : ""; } -}; // class HyperNucleus +}; // struct HyperNucleus + +struct DaughterKf { + int64_t daughterTrackId; + int hypNucId; + KFParticle daughterKfp; + float dcaToPv, dcaToPvXY, dcaToPvZ; + DaughterKf(int64_t daughterTrackId_, KFParticle daughterKfp_, std::vector vtx) : daughterTrackId(daughterTrackId_), hypNucId(-1), daughterKfp(daughterKfp_) + { + dcaToPvXY = daughterKfp.GetDistanceFromVertexXY(&vtx[0]); + dcaToPv = daughterKfp.GetDistanceFromVertex(&vtx[0]); + dcaToPvZ = std::sqrt(dcaToPv * dcaToPv - dcaToPvXY * dcaToPvXY); + } + DaughterKf(KFParticle daughterKfp_, int hypNucId_) : daughterTrackId(-999), hypNucId(hypNucId_), daughterKfp(daughterKfp_), dcaToPv(-999), dcaToPvXY(-999), dcaToPvZ(-999) {} +}; // struct DaughterKf struct HyperNucCandidate { int species; KFParticle kfp; - std::vector kfpDaughters; HyperNucCandidate* hypNucDaughter; - std::vector daughterTrackIds; + std::vector daughters; std::vector recoSV; - float devToVtx; - float dcaToVtxXY; - float dcaToVtxZ; - float chi2; - bool mcTrue; - bool isPhysPrimary; - bool isPrimaryCandidate, isSecondaryCandidate, isUsedSecondary; + float mass, px, py, pz; + float devToPvXY, dcaToPvXY, dcaToPvZ, dcaToVtxXY, dcaToVtxZ, chi2; + bool mcTrue, isPhysPrimary, isPrimaryCandidate, isSecondaryCandidate, isUsedSecondary; int64_t mcParticleId; int tableId; - - HyperNucCandidate(int species_, std::vector kfpDaughters_, std::vector daughterTrackIds_) : species(species_), hypNucDaughter(0), devToVtx(999), dcaToVtxXY(999), dcaToVtxZ(999), chi2(999), mcTrue(false), isPhysPrimary(false), isPrimaryCandidate(false), isSecondaryCandidate(false), isUsedSecondary(false), mcParticleId(-1), tableId(-1) - { - for (const auto& kfd : kfpDaughters_) - kfpDaughters.push_back(kfd); - for (const auto& dt : daughterTrackIds_) - daughterTrackIds.push_back(dt); - init(); - } - HyperNucCandidate(int species_, HyperNucCandidate* hypNucDaughter_, std::vector kfpDaughters_, std::vector daughterTrackIds_) : species(species_), hypNucDaughter(hypNucDaughter_), devToVtx(999), dcaToVtxXY(999), dcaToVtxZ(999), chi2(999), mcTrue(false), isPhysPrimary(false), isPrimaryCandidate(false), isSecondaryCandidate(false), isUsedSecondary(false), mcParticleId(-1), tableId(-1) - { - for (const auto& kfd : kfpDaughters_) - kfpDaughters.push_back(kfd); - for (const auto& dt : daughterTrackIds_) - daughterTrackIds.push_back(dt); - init(); - } - - void init() + HyperNucCandidate(int species_, HyperNucCandidate* hypNucDaughter_, std::vector daughters_) : species(species_), hypNucDaughter(hypNucDaughter_), devToPvXY(999), dcaToPvXY(999), dcaToPvZ(999), dcaToVtxXY(999), dcaToVtxZ(999), chi2(999), mcTrue(false), isPhysPrimary(false), isPrimaryCandidate(false), isSecondaryCandidate(false), isUsedSecondary(false), mcParticleId(-1), tableId(-1) { + for (const auto& d : daughters_) + daughters.push_back(d); kfp.SetConstructMethod(2); - for (size_t i = 0; i < kfpDaughters.size(); i++) - kfp.AddDaughter(kfpDaughters.at(i)); + for (size_t i = 0; i < daughters.size(); i++) + kfp.AddDaughter(daughters.at(i)->daughterKfp); kfp.TransportToDecayVertex(); chi2 = kfp.GetChi2() / kfp.GetNDF(); recoSV.clear(); recoSV.push_back(kfp.GetX()); recoSV.push_back(kfp.GetY()); recoSV.push_back(kfp.GetZ()); + mass = kfp.GetMass(); + px = kfp.GetPx(); + py = kfp.GetPy(); + pz = kfp.GetPz(); } - bool checkKfp() - { - if (kfp.GetMass() == 0) - return false; - if (std::isnan(kfp.GetMass())) - return false; - return true; - } - int getDaughterTableId() + std::vector daughterTrackIds() { - if (hypNucDaughter) - return hypNucDaughter->tableId; - return -1; + std::vector trackIds; + for (const auto& daughter : daughters) { + const auto& id = daughter->daughterTrackId; + if (id >= 0) + trackIds.push_back(id); + } + return trackIds; } + bool checkKfp() { return mass != 0 && !std::isnan(mass); } + int getDaughterTableId() { return hypNucDaughter ? hypNucDaughter->tableId : -1; } bool isCascade() { return hypNucDaughter != 0; } int getSign() { if (kfp.GetQ() == 0) - return kfpDaughters.front().GetQ() / std::abs(kfpDaughters.front().GetQ()); + return daughters.front()->daughterKfp.GetQ() / std::abs(daughters.front()->daughterKfp.GetQ()); return kfp.GetQ() / std::abs(kfp.GetQ()); } - int getNdaughters() { return static_cast(kfpDaughters.size()); } + int getNdaughters() { return static_cast(daughters.size()); } float getDcaTracks() { return getNdaughters() == 2 ? getDcaTracks2() : getMaxDcaToSv(); } - float getDcaTracks2() { return kfpDaughters.at(0).GetDistanceFromParticle(kfpDaughters.at(1)); } + float getDcaTracks2() { return daughters.at(0)->daughterKfp.GetDistanceFromParticle(daughters.at(1)->daughterKfp); } float getMaxDcaToSv() { float maxDca = std::numeric_limits::lowest(); - for (const auto& daughter : kfpDaughters) { - float dca = daughter.GetDistanceFromVertex(&recoSV[0]); + for (size_t i = 0; i < daughters.size(); i++) { + float dca = daughters.at(i)->daughterKfp.GetDistanceFromVertex(&recoSV[0]); if (dca > maxDca) maxDca = dca; } @@ -309,7 +290,7 @@ struct HyperNucCandidate { double getCpa(std::vector vtx) { kfp.TransportToDecayVertex(); - return RecoDecay::cpa(std::array{vtx[0], vtx[1], vtx[2]}, std::array{recoSV[0], recoSV[1], recoSV[2]}, std::array{kfp.GetPx(), kfp.GetPy(), kfp.GetPz()}); + return RecoDecay::cpa(std::array{vtx[0], vtx[1], vtx[2]}, std::array{recoSV[0], recoSV[1], recoSV[2]}, std::array{px, py, pz}); ; } float getCt(std::vector vtx) @@ -319,7 +300,13 @@ struct HyperNucCandidate { float tmp = recoSV.at(i) - vtx.at(i); dl += (tmp * tmp); } - return std::sqrt(dl) * kfp.GetMass() / kfp.GetP(); + return std::sqrt(dl) * mass / std::sqrt(px * px + py * py + pz * pz); + } + void getDaughterPosMom(int daughter, std::vector& posMom) + { + auto kfpDaughter = daughters.at(daughter)->daughterKfp; + kfpDaughter.TransportToPoint(&recoSV[0]); + posMom.assign({kfpDaughter.GetX(), kfpDaughter.GetY(), kfpDaughter.GetZ(), kfpDaughter.GetPx(), kfpDaughter.GetPy(), kfpDaughter.GetPz()}); } float getDcaMotherToVtxXY(std::vector vtx) { return kfp.GetDistanceFromVertexXY(&vtx[0]); } float getDcaMotherToVtxZ(std::vector vtx) @@ -327,15 +314,17 @@ struct HyperNucCandidate { kfp.TransportToPoint(&vtx[0]); return kfp.GetZ() - vtx[2]; } - void getDaughterPosMom(int daughter, std::vector& posMom) + void calcDcaToVtx(KFPVertex& vtx) { - kfpDaughters.at(daughter).TransportToPoint(&recoSV[0]); - posMom.assign({kfpDaughters.at(daughter).GetX(), kfpDaughters.at(daughter).GetY(), kfpDaughters.at(daughter).GetZ(), kfpDaughters.at(daughter).GetPx(), kfpDaughters.at(daughter).GetPy(), kfpDaughters.at(daughter).GetPz()}); + if (devToPvXY != 999) + return; + devToPvXY = kfp.GetDeviationFromVertexXY(vtx); + dcaToPvXY = kfp.GetDistanceFromVertexXY(vtx); + kfp.TransportToVertex(vtx); + dcaToPvZ = kfp.GetZ() - vtx.GetZ(); } - void calcDevToVtx(KFPVertex& vtx) { devToVtx = kfp.GetDeviationFromVertexXY(vtx); } - void calcDevToVtx(HyperNucCandidate& cand) + void calcDcaToVtx(HyperNucCandidate& cand) { - devToVtx = kfp.GetDeviationFromParticleXY(cand.kfp); dcaToVtxXY = getDcaMotherToVtxXY(cand.recoSV); dcaToVtxZ = getDcaMotherToVtxZ(cand.recoSV); } @@ -343,26 +332,12 @@ struct HyperNucCandidate { { KFParticle subDaughter; subDaughter.SetConstructMethod(2); - subDaughter.AddDaughter(kfpDaughters.at(d1)); - subDaughter.AddDaughter(kfpDaughters.at(d2)); + subDaughter.AddDaughter(daughters.at(d1)->daughterKfp); + subDaughter.AddDaughter(daughters.at(d2)->daughterKfp); subDaughter.TransportToDecayVertex(); return subDaughter.GetMass(); } - KFParticle getDaughterTrackKfp(int track) - { - return kfpDaughters.at(track + (isCascade() ? 1 : 0)); - } - float getDcaTrackToVtxXY(int track, std::vector vtx) - { - return getDaughterTrackKfp(track).GetDistanceFromVertexXY(&vtx[0]); - } - float getDcaTrackToVtxZ(int track, std::vector vtx) - { - auto dKfp = getDaughterTrackKfp(track); - dKfp.TransportToPoint(&vtx[0]); - return dKfp.GetZ() - vtx[2]; - } -}; // class HyperNucCandidate +}; // struct HyperNucCandidate struct IndexPairs { std::vector> pairs; @@ -379,7 +354,7 @@ struct IndexPairs { } return false; } -}; // class IndexPairs +}; // struct IndexPairs struct McCollInfo { bool hasRecoColl; @@ -387,7 +362,7 @@ struct McCollInfo { bool hasRecoParticle; int tableIndex; McCollInfo() : hasRecoColl(false), passedEvSel(false), hasRecoParticle(false), tableIndex(-1) {} -}; // class McCollInfo +}; // struct McCollInfo //---------------------------------------------------------------------------------------------------------------- std::vector> hDeDx; @@ -396,7 +371,7 @@ std::vector> hInvMass; //---------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------- -struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] +struct HypKfRecoTask { Produces outputMcCollisionTable; Produces outputMcParticleTable; @@ -447,22 +422,18 @@ struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] std::vector daughterParticles; std::vector> foundDaughters; - std::vector> singleHyperNucCandidates; // hypernuclei candidates - std::vector> cascadeHyperNucCandidates; // cascade candidates - std::vector singleHyperNuclei; - std::vector cascadeHyperNuclei; - std::vector primVtx; - std::vector cents; + std::vector> foundDaughterKfs, hypNucDaughterKfs; + std::vector> singleHyperNucCandidates, cascadeHyperNucCandidates; + std::vector singleHyperNuclei, cascadeHyperNuclei; + std::vector primVtx, cents; std::vector mcCollInfos; - IndexPairs trackIndices; - IndexPairs mcPartIndices; + IndexPairs trackIndices, mcPartIndices; KFPVertex kfPrimVtx; - bool collHasCandidate, collHasMcTrueCandidate; - bool collPassedEvSel; + bool collHasCandidate, collHasMcTrueCandidate, collPassedEvSel, activeCascade; int64_t mcCollTableIndex; int mRunNumber, occupancy; float dBz; - TRandom rand; + TRandom3 rand; //---------------------------------------------------------------------------------------------------------------- void init(InitContext const&) @@ -482,8 +453,11 @@ struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] for (unsigned int i = 0; i < nHyperNuclei; i++) { // create hypernuclei singleHyperNuclei.push_back(HyperNucleus(hyperNucNames.at(i), cfgHyperNucPdg->get(i, 0u), cfgHyperNucsActive->get(i, 0u), getDaughterVec(i, cfgHyperNucDaughters), getDaughterSignVec(i, cfgHyperNucSigns))); } + activeCascade = false; for (unsigned int i = 0; i < nCascades; i++) { // create cascades cascadeHyperNuclei.push_back(HyperNucleus(cascadeNames.at(i), cfgCascadesPdg->get(i, 0u), cfgCascadesActive->get(i, 0u), getHypDaughterVec(i, cfgCascadeHypDaughter), getDaughterVec(i, cfgCascadeDaughters), getDaughterSignVec(i, cfgCascadeSigns))); + if (cfgCascadesActive->get(i, 0u)) + activeCascade = true; } // define histogram axes const AxisSpec axisMagField{10, -10., 10., "magnetic field"}; @@ -543,10 +517,6 @@ struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] if (std::abs(getTPCnSigma(track, daughterParticles.at(i))) > cfgTrackPIDsettings->get(i, "maxTPCnSigma")) continue; filldedx(track, i); - if (std::abs(track.dcaXY()) < cfgTrackPIDsettings->get(i, "minDcaToPvXY")) - continue; - if (std::abs(track.dcaZ()) < cfgTrackPIDsettings->get(i, "minDcaToPvZ")) - continue; if (getMeanItsClsSize(track) < cfgTrackPIDsettings->get(i, "minITSclsSize")) continue; if (getMeanItsClsSize(track) > cfgTrackPIDsettings->get(i, "maxITSclsSize")) @@ -563,29 +533,83 @@ struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] //---------------------------------------------------------------------------------------------------------------- void checkMCTrueTracks(aod::McTrackLabels const& trackLabels, aod::McParticles const&) { + std::vector activePdgs; + std::vector*> hypNucVectors = {&singleHyperNuclei, &cascadeHyperNuclei}; + for (int vec = 0; vec < 2; vec++) { + for (size_t hyperNucIter = 0; hyperNucIter < hypNucVectors.at(vec)->size(); hyperNucIter++) { + HyperNucleus* hyperNuc = &(hypNucVectors.at(vec)->at(hyperNucIter)); + if (!hyperNuc->active) + continue; + activePdgs.push_back(std::abs(hyperNuc->pdgCode)); + } + } for (int i = 0; i < nDaughterParticles; i++) { auto& daughterVec = foundDaughters.at(i); - for (auto it = daughterVec.begin(); it < daughterVec.end(); it++) { - bool mcTrue = true; + if (!daughterVec.size()) + continue; + for (auto it = daughterVec.end() - 1; it >= daughterVec.begin(); it--) { const auto& mcLab = trackLabels.rawIteratorAt(*it); if (!mcLab.has_mcParticle()) { - mcTrue = false; - } else { - const auto& mcPart = mcLab.mcParticle_as(); - if (std::abs(mcPart.pdgCode()) != daughterParticles.at(i).pdgCode) { - mcTrue = false; - } - if (!mcPart.has_mothers()) { - mcTrue = false; + daughterVec.erase(it); + continue; + } + const auto& mcPart = mcLab.mcParticle_as(); + if (std::abs(mcPart.pdgCode()) != daughterParticles.at(i).pdgCode) { + daughterVec.erase(it); + continue; + } + if (!mcPart.has_mothers()) { + daughterVec.erase(it); + continue; + } + bool isDaughter = false; + for (const auto& mother : mcPart.mothers_as()) { + if (std::find(activePdgs.begin(), activePdgs.end(), std::abs(mother.pdgCode())) != activePdgs.end()) { + isDaughter = true; } } - if (!mcTrue) { + if (!isDaughter) { daughterVec.erase(it); + continue; } } } } //---------------------------------------------------------------------------------------------------------------- + void createKFDaughters(TracksFull const& tracks) + { + std::vector*> hypNucVectors = {&singleHyperNuclei, &cascadeHyperNuclei}; + for (size_t vec = 0; vec < 2; vec++) { + for (const auto& hyperNuc : *(hypNucVectors.at(vec))) { + if (!hyperNuc.active) + continue; + for (size_t i = vec; i < hyperNuc.daughters.size(); i++) { + if (foundDaughters.at(hyperNuc.daughters.at(i)).size() > 0) + daughterParticles.at(hyperNuc.daughters.at(i)).active = true; + else + break; + } + } + } + for (size_t daughterCount = 0; daughterCount < daughterParticles.size(); daughterCount++) { + const auto& daughterParticle = daughterParticles.at(daughterCount); + if (!daughterParticle.active) + continue; + const auto& daughterMass = daughterParticle.mass; + const auto& daughterCharge = daughterParticle.charge; + for (const auto& daughterId : foundDaughters.at(daughterCount)) { + const auto& daughterTrack = tracks.rawIteratorAt(daughterId); + DaughterKf daughter(daughterId, createKFParticle(daughterTrack, daughterMass, daughterCharge), primVtx); + if (std::abs(daughter.dcaToPvXY) < cfgTrackPIDsettings->get(daughterCount, "minDcaToPvXY")) + continue; + if (std::abs(daughter.dcaToPvZ) < cfgTrackPIDsettings->get(daughterCount, "minDcaToPvZ")) + continue; + foundDaughterKfs.at(daughterCount).push_back(daughter); + } + } + } + //---------------------------------------------------------------------------------------------------------------- + void createKFHypernuclei(TracksFull const& tracks) { // loop over all hypernuclei that are to be reconstructed @@ -594,80 +618,69 @@ struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] if (!hyperNuc->active) continue; int nDaughters = hyperNuc->getNdaughters(); - - std::vector::iterator> it; + std::vector::iterator> it; int nCombinations = 1; for (int i = 0; i < nDaughters; i++) { - nCombinations *= foundDaughters.at(hyperNuc->daughters.at(i)).size(); - it.push_back(foundDaughters.at(hyperNuc->daughters.at(i)).begin()); + nCombinations *= foundDaughterKfs.at(hyperNuc->daughters.at(i)).size(); + it.push_back(foundDaughterKfs.at(hyperNuc->daughters.at(i)).begin()); } if (!nCombinations) continue; - while (it[0] != foundDaughters.at(hyperNuc->daughters.at(0)).end()) { - + const float reduceFactor = cfgReduce->get(hyperNucIter, 0u); + const float minMassPrim = cfgPreSelectionsPrimaries->get(hyperNucIter, "minMass"); + const float maxMassPrim = cfgPreSelectionsPrimaries->get(hyperNucIter, "maxMass"); + const float minCtPrim = cfgPreSelectionsPrimaries->get(hyperNucIter, "minCt"); + const float maxCtPrim = cfgPreSelectionsPrimaries->get(hyperNucIter, "maxCt"); + const float minCosPaPrim = cfgPreSelectionsPrimaries->get(hyperNucIter, "minCosPa"); + const float maxDcaTracksPrim = cfgPreSelectionsPrimaries->get(hyperNucIter, "maxDcaTracks"); + const float maxDcaMotherToPvXYPrim = cfgPreSelectionsPrimaries->get(hyperNucIter, "maxDcaMotherToPvXY"); + const float maxDcaMotherToPvZPrim = cfgPreSelectionsPrimaries->get(hyperNucIter, "maxDcaMotherToPvZ"); + const float minMassSec = cfgPreSelectionsSecondaries->get(hyperNucIter, "minMass"); + const float maxMassSec = cfgPreSelectionsSecondaries->get(hyperNucIter, "maxMass"); + const float minCtSec = cfgPreSelectionsSecondaries->get(hyperNucIter, "minCt"); + const float maxCtSec = cfgPreSelectionsSecondaries->get(hyperNucIter, "maxCt"); + const float maxDcaTracksSec = cfgPreSelectionsSecondaries->get(hyperNucIter, "maxDcaTracks"); + while (it[0] != foundDaughterKfs.at(hyperNuc->daughters.at(0)).end()) { // check for correct signs, avoid double usage of tracks bool passedChecks = true; int checkSign = 0; std::vector vec; for (int i = 0; i < nDaughters; i++) { - const auto& daughterTrack = tracks.rawIteratorAt(*(it[i])); + const auto& daughterTrack = tracks.rawIteratorAt(it[i]->daughterTrackId); if (!i) checkSign = daughterTrack.sign(); - if (daughterTrack.sign() != checkSign * hyperNuc->daughterTrackSigns.at(i) || std::find(vec.begin(), vec.end(), *it[i]) != vec.end()) { + if (daughterTrack.sign() != checkSign * hyperNuc->daughterTrackSigns.at(i) || std::find(vec.begin(), vec.end(), it[i]->daughterTrackId) != vec.end()) { passedChecks = false; break; } - vec.push_back(*it[i]); + vec.push_back(it[i]->daughterTrackId); } - if (passedChecks && rand.Rndm() <= cfgReduce->get((unsigned int)hyperNucIter, 0u)) { - // create daugther KFParticles - std::vector daughterIds; - std::vector daughterKfps; + if (passedChecks && rand.Rndm() <= reduceFactor) { + std::vector daughters; for (int i = 0; i < nDaughters; i++) { - const auto& daughterTrack = tracks.rawIteratorAt(*(it[i])); - daughterIds.push_back(*(it[i])); - auto daughterMass = daughterParticles.at(hyperNuc->daughters.at(i)).mass; - auto daughterCharge = daughterParticles.at(hyperNuc->daughters.at(i)).charge; - daughterKfps.push_back(createKFParticle(daughterTrack, daughterMass, daughterCharge)); + daughters.push_back(&(*it[i])); } - - HyperNucCandidate candidate(hyperNucIter, daughterKfps, daughterIds); - bool isPrimCandidate = true, isSecCandidate = true; + HyperNucCandidate candidate(hyperNucIter, static_cast(0), daughters); + // check preselections if (candidate.checkKfp()) { - // apply pre selections - candidate.calcDevToVtx(kfPrimVtx); - if (candidate.kfp.GetMass() < cfgPreSelectionsPrimaries->get(hyperNucIter, "minMass") || candidate.kfp.GetMass() > cfgPreSelectionsPrimaries->get(hyperNucIter, "maxMass")) - isPrimCandidate = false; - if (candidate.getDcaTracks() > cfgPreSelectionsPrimaries->get(hyperNucIter, "maxDcaTracks")) - isPrimCandidate = false; - if (candidate.getCt(primVtx) < cfgPreSelectionsPrimaries->get(hyperNucIter, "minCt") || candidate.getCt(primVtx) > cfgPreSelectionsPrimaries->get(hyperNucIter, "maxCt")) - isPrimCandidate = false; - if (candidate.getCpa(primVtx) < cfgPreSelectionsPrimaries->get(hyperNucIter, "minCosPa")) - isPrimCandidate = false; - if (std::abs(candidate.getDcaMotherToVtxXY(primVtx)) > cfgPreSelectionsPrimaries->get(hyperNucIter, "maxDcaMotherToPvXY")) - isPrimCandidate = false; - if (std::abs(candidate.getDcaMotherToVtxZ(primVtx)) > cfgPreSelectionsPrimaries->get(hyperNucIter, "maxDcaMotherToPvZ")) - isPrimCandidate = false; - if (isPrimCandidate) { - candidate.isPrimaryCandidate = true; - collHasCandidate = true; + if (candidate.mass <= maxMassPrim && candidate.mass >= minMassPrim && candidate.getDcaTracks() <= maxDcaTracksPrim && candidate.getCt(primVtx) <= maxCtPrim && candidate.getCt(primVtx) >= minCtPrim && candidate.getCpa(primVtx) >= minCosPaPrim) { + candidate.calcDcaToVtx(kfPrimVtx); + if (std::abs(candidate.dcaToPvXY) <= maxDcaMotherToPvXYPrim && std::abs(candidate.dcaToPvZ) <= maxDcaMotherToPvZPrim) { + candidate.isPrimaryCandidate = true; + collHasCandidate = true; + } } - if (candidate.kfp.GetMass() < cfgPreSelectionsSecondaries->get(hyperNucIter, "minMass") || candidate.kfp.GetMass() > cfgPreSelectionsSecondaries->get(hyperNucIter, "maxMass")) - isSecCandidate = false; - if (candidate.getDcaTracks() > cfgPreSelectionsSecondaries->get(hyperNucIter, "maxDcaTracks")) - isSecCandidate = false; - if (candidate.getCt(primVtx) < cfgPreSelectionsSecondaries->get(hyperNucIter, "minCt") || candidate.getCt(primVtx) > cfgPreSelectionsSecondaries->get(hyperNucIter, "maxCt")) - isSecCandidate = false; - if (isSecCandidate) { + if (activeCascade && candidate.mass <= maxMassSec && candidate.mass >= minMassSec && candidate.getDcaTracks() <= maxDcaTracksSec && candidate.getCt(primVtx) <= maxCtSec && candidate.getCt(primVtx) >= minCtSec) { + candidate.calcDcaToVtx(kfPrimVtx); candidate.isSecondaryCandidate = true; } - if (isPrimCandidate || isSecCandidate) + if (candidate.isPrimaryCandidate || candidate.isSecondaryCandidate) singleHyperNucCandidates.at(hyperNucIter).push_back(candidate); } } it[nDaughters - 1]++; - for (int i = nDaughters - 1; i && it[i] == foundDaughters.at(hyperNuc->daughters.at(i)).end(); i--) { - it[i] = foundDaughters.at(hyperNuc->daughters.at(i)).begin(); + for (int i = nDaughters - 1; i && it[i] == foundDaughterKfs.at(hyperNuc->daughters.at(i)).end(); i--) { + it[i] = foundDaughterKfs.at(hyperNuc->daughters.at(i)).begin(); it[i - 1]++; } } @@ -676,7 +689,6 @@ struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] //---------------------------------------------------------------------------------------------------------------- void createKFCascades(TracksFull const& tracks) { - // loop over all cascade hypernuclei that are to be reconstructed for (size_t hyperNucIter = 0; hyperNucIter < cascadeHyperNuclei.size(); hyperNucIter++) { HyperNucleus* hyperNuc = &(cascadeHyperNuclei.at(hyperNucIter)); @@ -685,86 +697,75 @@ struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] int nDaughters = hyperNuc->getNdaughters(); int nHypNucDaughters = singleHyperNucCandidates.at(hyperNuc->daughters.at(0)).size(); - std::vector vecHypNucDaughers; for (int64_t i = 0; i < static_cast(nHypNucDaughters); i++) { - vecHypNucDaughers.push_back(i); + if (singleHyperNucCandidates.at(hyperNuc->daughters.at(0)).at(i).isSecondaryCandidate) { + auto hypNucDaughter = &(singleHyperNucCandidates.at(hyperNuc->daughters.at(0)).at(i)); + hypNucDaughterKfs.at(hyperNucIter).push_back(DaughterKf(hypNucDaughter->kfp, i)); + } } - - std::vector::iterator> it; - int nCombinations = 1; - nCombinations *= nHypNucDaughters; - it.push_back(vecHypNucDaughers.begin()); + int nCombinations = hypNucDaughterKfs.at(hyperNucIter).size(); + std::vector::iterator> it; + it.push_back(hypNucDaughterKfs.at(hyperNucIter).begin()); for (int i = 1; i < nDaughters; i++) { - nCombinations *= foundDaughters.at(hyperNuc->daughters.at(i)).size(); - it.push_back(foundDaughters.at(hyperNuc->daughters.at(i)).begin()); + nCombinations *= foundDaughterKfs.at(hyperNuc->daughters.at(i)).size(); + it.push_back(foundDaughterKfs.at(hyperNuc->daughters.at(i)).begin()); } if (!nCombinations) continue; - while (it[0] != vecHypNucDaughers.end()) { - std::vector daughterIds; - std::vector daughterKfps; - + const float minMassCas = cfgPreSelectionsCascades->get(hyperNucIter, "minMass"); + const float maxMassCas = cfgPreSelectionsCascades->get(hyperNucIter, "maxMass"); + const float minCtCas = cfgPreSelectionsCascades->get(hyperNucIter, "minCt"); + const float maxCtCas = cfgPreSelectionsCascades->get(hyperNucIter, "maxCt"); + const float minCosPaCas = cfgPreSelectionsCascades->get(hyperNucIter, "minCosPa"); + const float maxDcaTracksCas = cfgPreSelectionsCascades->get(hyperNucIter, "maxDcaTracks"); + const float maxDcaMotherToPvXYCas = cfgPreSelectionsCascades->get(hyperNucIter, "maxDcaMotherToPvXY"); + const float maxDcaMotherToPvZCas = cfgPreSelectionsCascades->get(hyperNucIter, "maxDcaMotherToPvZ"); + const float minCtSec = cfgPreSelectionsSecondaries->get(hyperNucIter, "minCt"); + const float maxCtSec = cfgPreSelectionsSecondaries->get(hyperNucIter, "maxCt"); + const float minCosPaSvSec = cfgPreSelectionsSecondaries->get(hyperNucIter, "minCosPaSv"); + const float maxDcaMotherToSvXYSec = cfgPreSelectionsSecondaries->get(hyperNucIter, "maxDcaMotherToSvXY"); + const float maxDcaMotherToSvZSec = cfgPreSelectionsSecondaries->get(hyperNucIter, "maxDcaMotherToSvZ"); + + while (it[0] != hypNucDaughterKfs.at(hyperNucIter).end()) { // select hypernuclei daughter KFParticle - auto hypNucDaughter = &(singleHyperNucCandidates.at(hyperNuc->daughters.at(0)).at(*it[0])); + auto hypNucDaughter = &(singleHyperNucCandidates.at(hyperNuc->daughters.at(0)).at(it[0]->hypNucId)); // check for correct signs int checkSign = hypNucDaughter->getSign(); bool passedChecks = true; - std::vector vec = hypNucDaughter->daughterTrackIds; + std::vector vec = hypNucDaughter->daughterTrackIds(); for (int i = 1; i < nDaughters; i++) { - const auto& daughterTrack = tracks.rawIteratorAt(*(it[i])); - if (!i) - checkSign = daughterTrack.sign(); - if (daughterTrack.sign() != checkSign * hyperNuc->daughterTrackSigns.at(i) || std::find(vec.begin(), vec.end(), *it[i]) != vec.end()) { + const auto& daughterTrack = tracks.rawIteratorAt(it[i]->daughterTrackId); + if (daughterTrack.sign() != checkSign * hyperNuc->daughterTrackSigns.at(i) || std::find(vec.begin(), vec.end(), it[i]->daughterTrackId) != vec.end()) { passedChecks = false; break; } - vec.push_back(*it[i]); + vec.push_back(it[i]->daughterTrackId); } - if (passedChecks && hypNucDaughter->isSecondaryCandidate) { - daughterKfps.push_back(hypNucDaughter->kfp); + if (passedChecks) { + std::vector daughters; + daughters.push_back(&(*it[0])); for (int i = 1; i < nDaughters; i++) { - daughterIds.push_back(*(it[i])); - const auto& daughterTrack = tracks.rawIteratorAt(*(it[i])); - auto daughterMass = daughterParticles.at(hyperNuc->daughters.at(i)).mass; - auto daughterCharge = daughterParticles.at(hyperNuc->daughters.at(i)).charge; - daughterKfps.push_back(createKFParticle(daughterTrack, daughterMass, daughterCharge)); + daughters.push_back(&(*it[i])); } - - HyperNucCandidate candidate(hyperNucIter, hypNucDaughter, daughterKfps, daughterIds); + HyperNucCandidate candidate(hyperNucIter, hypNucDaughter, daughters); if (candidate.checkKfp()) { - hypNucDaughter->calcDevToVtx(candidate); - bool isCandidate = true; - // apply pre selections for hypernucleus daughter - if (hypNucDaughter->getCpa(candidate.recoSV) < cfgPreSelectionsSecondaries->get(hyperNuc->daughters.at(0), "minCosPaSv")) - isCandidate = false; - if (hypNucDaughter->getDcaMotherToVtxXY(candidate.recoSV) > cfgPreSelectionsSecondaries->get(hyperNuc->daughters.at(0), "maxDcaMotherToSvXY")) - isCandidate = false; - if (hypNucDaughter->getDcaMotherToVtxZ(candidate.recoSV) > cfgPreSelectionsSecondaries->get(hyperNuc->daughters.at(0), "maxDcaMotherToSvZ")) - isCandidate = false; - // apply pre selections for cascade - if (candidate.kfp.GetMass() < cfgPreSelectionsCascades->get(hyperNucIter, "minMass") || candidate.kfp.GetMass() > cfgPreSelectionsCascades->get(hyperNucIter, "maxMass")) - isCandidate = false; - if (candidate.getDcaTracks() > cfgPreSelectionsCascades->get(hyperNucIter, "maxDcaTracks")) - isCandidate = false; - if (candidate.getCt(primVtx) < cfgPreSelectionsCascades->get(hyperNucIter, "minCt") || candidate.getCt(primVtx) > cfgPreSelectionsCascades->get(hyperNucIter, "maxCt")) - isCandidate = false; - if (candidate.getCpa(primVtx) < cfgPreSelectionsCascades->get(hyperNucIter, "minCosPa")) - isCandidate = false; - if (std::abs(candidate.getDcaMotherToVtxXY(primVtx)) > cfgPreSelectionsCascades->get(hyperNucIter, "maxDcaMotherToPvXY")) - isCandidate = false; - if (std::abs(candidate.getDcaMotherToVtxZ(primVtx)) > cfgPreSelectionsCascades->get(hyperNucIter, "maxDcaMotherToPvZ")) - isCandidate = false; - - if (isCandidate) { - collHasCandidate = true; - hypNucDaughter->isUsedSecondary = true; - cascadeHyperNucCandidates.at(hyperNucIter).push_back(candidate); + // preselections for cascade and hypernucleus daughter + if (candidate.mass <= maxMassCas && candidate.mass >= minMassCas && candidate.getDcaTracks() <= maxDcaTracksCas && candidate.getCt(primVtx) >= minCtCas && candidate.getCt(primVtx) <= maxCtCas && hypNucDaughter->getCt(candidate.recoSV) >= minCtSec && hypNucDaughter->getCt(candidate.recoSV) <= maxCtSec && candidate.getCpa(primVtx) >= minCosPaCas && hypNucDaughter->getCpa(candidate.recoSV) >= minCosPaSvSec) { + candidate.calcDcaToVtx(kfPrimVtx); + if (std::abs(candidate.dcaToPvXY) <= maxDcaMotherToPvXYCas && std::abs(candidate.dcaToPvZ) <= maxDcaMotherToPvZCas) { + hypNucDaughter->calcDcaToVtx(candidate); + if (hypNucDaughter->dcaToVtxXY <= maxDcaMotherToSvXYSec && hypNucDaughter->dcaToVtxZ <= maxDcaMotherToSvZSec) { + collHasCandidate = true; + hypNucDaughter->isUsedSecondary = true; + cascadeHyperNucCandidates.at(hyperNucIter).push_back(candidate); + } + } } } } it[nDaughters - 1]++; - for (int i = nDaughters - 1; i && it[i] == foundDaughters.at(hyperNuc->daughters.at(i)).end(); i--) { - it[i] = foundDaughters.at(hyperNuc->daughters.at(i)).begin(); + for (int i = nDaughters - 1; i && it[i] == foundDaughterKfs.at(hyperNuc->daughters.at(i)).end(); i--) { + it[i] = foundDaughterKfs.at(hyperNuc->daughters.at(i)).begin(); it[i - 1]++; } } @@ -774,7 +775,6 @@ struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] void createMCinfo(aod::McTrackLabels const& trackLabels, aod::McCollisionLabels const&, aod::McParticles const& particlesMC, aod::McCollisions const&, bool cascadesOnly = false) { // check for mcTrue: single (primary & cascade daughter) and cascade hypernuclei - std::vector*> hypNucVectors = {&singleHyperNuclei, &cascadeHyperNuclei}; std::vector>*> candidateVectors = {&singleHyperNucCandidates, &cascadeHyperNucCandidates}; const int nVecs = candidateVectors.size(); @@ -794,16 +794,16 @@ struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] const auto& mcPart = particlesMC.rawIteratorAt(hypCand.hypNucDaughter->mcParticleId); if (!mcPart.has_mothers()) continue; - daughterCount++; for (const auto& mother : mcPart.mothers_as()) { if (mother.pdgCode() == hyperNuc->pdgCode * hypCand.getSign()) { motherIds.push_back(mother.globalIndex()); break; } } + daughterCount++; } - for (const auto& daughter : hypCand.daughterTrackIds) { - const auto& mcLab = trackLabels.rawIteratorAt(daughter); + for (const auto& daughter : hypCand.daughters) { + const auto& mcLab = trackLabels.rawIteratorAt(daughter->daughterTrackId); if (!mcLab.has_mcParticle()) continue; const auto& mcPart = mcLab.mcParticle_as(); @@ -861,10 +861,11 @@ struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] continue; if (saveOnlyMcTrue && !hypCand.mcTrue) continue; - hInvMass[vec * nHyperNuclei + hyperNucIter]->Fill(hypCand.kfp.GetMass()); + hInvMass[vec * nHyperNuclei + hyperNucIter]->Fill(hypCand.mass); std::vector vecDaugtherTracks, vecAddons, vecSubDaughters; int daughterCount = 0; - for (const auto& daughterTrackId : hypCand.daughterTrackIds) { + for (const auto& daughter : hypCand.daughters) { + const auto& daughterTrackId = daughter->daughterTrackId; int trackTableId; if (!trackIndices.getIndex(daughterTrackId, trackTableId)) { auto daught = hyperNuc->daughters.at(daughterCount); @@ -872,7 +873,7 @@ struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] outputTrackTable( hyperNuc->daughters.at(daughterCount) * track.sign(), track.pt(), track.eta(), track.phi(), - hypCand.getDcaTrackToVtxXY(daughterCount, primVtx), hypCand.getDcaTrackToVtxZ(daughterCount, primVtx), + daughter->dcaToPvXY, daughter->dcaToPvZ, track.tpcNClsFound(), track.tpcChi2NCl(), track.itsClusterSizes(), track.itsChi2NCl(), getRigidity(track), track.tpcSignal(), getTPCnSigma(track, daughterParticles.at(daught)), @@ -908,10 +909,10 @@ struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] mcPartIndices.getIndex(hypCand.mcParticleId, mcPartTableId) ? mcPartTableId : -1, outputCollisionTable.lastIndex(), vecDaugtherTracks, vecAddons, hypCand.getDaughterTableId(), vecSubDaughters, (vec * nHyperNuclei + hyperNucIter + 1) * hypCand.getSign(), - hypCand.isPrimaryCandidate, hypCand.kfp.GetMass(), - hypCand.kfp.GetPx(), hypCand.kfp.GetPy(), hypCand.kfp.GetPz(), - hypCand.getDcaMotherToVtxXY(primVtx), hypCand.getDcaMotherToVtxZ(primVtx), - hypCand.devToVtx, hypCand.dcaToVtxXY, hypCand.dcaToVtxZ, hypCand.chi2, + hypCand.isPrimaryCandidate, hypCand.mass, + hypCand.px, hypCand.py, hypCand.pz, + hypCand.dcaToPvXY, hypCand.dcaToPvZ, hypCand.devToPvXY, + hypCand.dcaToVtxXY, hypCand.dcaToVtxZ, hypCand.chi2, hypCand.recoSV.at(0), hypCand.recoSV.at(1), hypCand.recoSV.at(2)); hypCand.tableId = outputHypNucTable.lastIndex(); } @@ -989,6 +990,7 @@ struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] findDaughterParticles(tracksByColl, tracks); if (cfgSaveOnlyMcTrue) checkMCTrueTracks(trackLabelsMC, particlesMC); + createKFDaughters(tracks); createKFHypernuclei(tracks); createMCinfo(trackLabelsMC, collLabels, particlesMC, mcColls); createKFCascades(tracks); @@ -1013,7 +1015,7 @@ struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] fillTree(tracks, cfgSaveOnlyMcTrue); } } - PROCESS_SWITCH(hypKfRecoTask, processMC, "MC analysis", false); + PROCESS_SWITCH(HypKfRecoTask, processMC, "MC analysis", false); //---------------------------------------------------------------------------------------------------------------- void processData(CollisionsFull const& collisions, TracksFull const& tracks, aod::BCsWithTimestamps const&, aod::TrackAssoc const& tracksColl) { @@ -1027,6 +1029,7 @@ struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] const uint64_t collIdx = collision.globalIndex(); auto tracksByColl = tracksColl.sliceBy(perCollision, collIdx); findDaughterParticles(tracksByColl, tracks); + createKFDaughters(tracks); createKFHypernuclei(tracks); createKFCascades(tracks); if (!collHasCandidate) @@ -1035,7 +1038,7 @@ struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] fillTree(tracks); } } - PROCESS_SWITCH(hypKfRecoTask, processData, "data analysis", true); + PROCESS_SWITCH(HypKfRecoTask, processData, "data analysis", true); //---------------------------------------------------------------------------------------------------------------- void initCCDB(aod::BCsWithTimestamps::iterator const& bc) { @@ -1078,6 +1081,10 @@ struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] { foundDaughters.clear(); foundDaughters.resize(nDaughterParticles); + foundDaughterKfs.clear(); + foundDaughterKfs.resize(nDaughterParticles); + hypNucDaughterKfs.clear(); + hypNucDaughterKfs.resize(nCascades); singleHyperNucCandidates.clear(); singleHyperNucCandidates.resize(nHyperNuclei); cascadeHyperNucCandidates.clear(); @@ -1235,7 +1242,7 @@ struct hypKfRecoTask { // o2-linter: disable=[name/workflow-file][name/struct] WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; } //---------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------- diff --git a/PWGLF/TableProducer/Nuspex/hypKfTreeCreator.cxx b/PWGLF/TableProducer/Nuspex/hypKfTreeCreator.cxx index 1eea2943112..bcd2dbe227c 100644 --- a/PWGLF/TableProducer/Nuspex/hypKfTreeCreator.cxx +++ b/PWGLF/TableProducer/Nuspex/hypKfTreeCreator.cxx @@ -320,7 +320,7 @@ DECLARE_SOA_TABLE(HypKfMcCascadeThreeTwoCandidates, "AOD", "HYPKFMCCAND32", HYPK using HypKfMcCascadeThreeTwoCandidate = HypKfMcCascadeThreeTwoCandidates::iterator; } // namespace o2::aod -struct hypKfTreeCreator { // o2-linter: disable=[name/workflow-file][name/struct] +struct HypKfTreeCreator { HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; Produces outputMcGenTable; @@ -370,7 +370,7 @@ struct hypKfTreeCreator { // o2-linter: disable=[name/workflow-file][name/struct fillTable(candidate, hypDaughter); } } - PROCESS_SWITCH(hypKfTreeCreator, processData, "single tree", false); + PROCESS_SWITCH(HypKfTreeCreator, processData, "single tree", false); //___________________________________________________________________________________________________________________________________________________________ void fillTable(HyperNucleus& cand, HyperNucleus& hypDaughter) { @@ -648,7 +648,7 @@ struct hypKfTreeCreator { // o2-linter: disable=[name/workflow-file][name/struct } hPt[2]->Divide(hPt[1].get(), hPt[0].get()); } - PROCESS_SWITCH(hypKfTreeCreator, processMC, "MC Gen tree", false); + PROCESS_SWITCH(HypKfTreeCreator, processMC, "MC Gen tree", false); //___________________________________________________________________________________________________________________________________________________________ std::vector dcaTracksAll(std::vector& posVec, TString opt = "") @@ -770,5 +770,5 @@ struct hypKfTreeCreator { // o2-linter: disable=[name/workflow-file][name/struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; } diff --git a/PWGLF/TableProducer/Resonances/doublephitable.cxx b/PWGLF/TableProducer/Resonances/doublephitable.cxx index b9638e8cec1..ae4e75a26a5 100644 --- a/PWGLF/TableProducer/Resonances/doublephitable.cxx +++ b/PWGLF/TableProducer/Resonances/doublephitable.cxx @@ -58,6 +58,8 @@ struct doublephitable { // events Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; + // Configurable cfgCutCentralityMax{"cfgCutCentralityMax", 0.0f, "Accepted maximum Centrality"}; + // Configurable cfgCutCentralityMin{"cfgCutCentralityMin", 100.0f, "Accepted minimum Centrality"}; // track Configurable useGlobalTrack{"useGlobalTrack", true, "use Global track"}; Configurable cfgCutTOFBeta{"cfgCutTOFBeta", 0.0, "cut TOF beta"}; @@ -74,8 +76,11 @@ struct doublephitable { Configurable cfgDeepAngle{"cfgDeepAngle", 0.04, "Deep Angle cut value"}; ConfigurableAxis configThnAxisInvMass{"configThnAxisInvMass", {120, 0.98, 1.1}, "#it{M} (GeV/#it{c}^{2})"}; ConfigurableAxis configThnAxisPt{"configThnAxisPt", {100, 0.0, 10.}, "#it{p}_{T} (GeV/#it{c})"}; + Configurable minPhiMass{"minPhiMass", 1.01, "Minimum phi mass"}; + Configurable maxPhiMass{"maxPhiMass", 1.03, "Maximum phi mass"}; Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; + // Filter centralityFilter = (nabs(aod::cent::centFT0C) < cfgCutCentralityMax && nabs(aod::cent::centFT0C) > cfgCutCentralityMin); Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT); Filter DCAcutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); Filter PIDcutFilter = nabs(aod::pidtpc::tpcNSigmaKa) < nsigmaCutTPC; @@ -202,7 +207,7 @@ struct doublephitable { KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); PhiMesonMother = KaonPlus + KaonMinus; - if (PhiMesonMother.M() > 1.0 && PhiMesonMother.M() < 1.04) { + if (PhiMesonMother.M() > minPhiMass && PhiMesonMother.M() < maxPhiMass) { numberPhi = numberPhi + 1; ROOT::Math::PtEtaPhiMVector temp1(track1.pt(), track1.eta(), track1.phi(), massKa); ROOT::Math::PtEtaPhiMVector temp2(track2.pt(), track2.eta(), track2.phi(), massKa); @@ -241,11 +246,11 @@ struct doublephitable { } } } // select collision - if (numberPhi >= 2) { + if (numberPhi > 1 && Npostrack > 1 && Nnegtrack > 1) { keepEventDoublePhi = true; } qaRegistry.fill(HIST("hEventstat"), 0.5); - if (keepEventDoublePhi && numberPhi >= 2 && (phiresonance.size() == phiresonanced1.size()) && (phiresonance.size() == phiresonanced2.size())) { + if (keepEventDoublePhi && numberPhi > 1 && Npostrack > 1 && Nnegtrack > 1 && (phiresonance.size() == phiresonanced1.size()) && (phiresonance.size() == phiresonanced2.size())) { qaRegistry.fill(HIST("hEventstat"), 1.5); /////////// Fill collision table/////////////// redPhiEvents(bc.globalBC(), currentRunNumber, bc.timestamp(), collision.posZ(), collision.numContrib(), Npostrack, Nnegtrack); diff --git a/PWGLF/TableProducer/Strangeness/CMakeLists.txt b/PWGLF/TableProducer/Strangeness/CMakeLists.txt index 04e614c1811..1bb6ae5b8d9 100644 --- a/PWGLF/TableProducer/Strangeness/CMakeLists.txt +++ b/PWGLF/TableProducer/Strangeness/CMakeLists.txt @@ -53,7 +53,7 @@ o2physics_add_dpl_workflow(cascqaanalysis o2physics_add_dpl_workflow(hstrangecorrelationfilter SOURCES hStrangeCorrelationFilter.cxx - PUBLIC_LINK_LIBRARIES O2::DCAFitter O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2::DCAFitter O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(double-casc-tree-creator diff --git a/PWGLF/TableProducer/Strangeness/cascadebuilder.cxx b/PWGLF/TableProducer/Strangeness/cascadebuilder.cxx index 71a5d0143ae..3ebe4f4b47e 100644 --- a/PWGLF/TableProducer/Strangeness/cascadebuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadebuilder.cxx @@ -543,8 +543,7 @@ struct cascadeBuilder { } } if (useMatCorrType == 2) { - LOGF(info, "LUT correction requested, loading LUT"); - lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get(ccdbConfigurations.lutPath)); + LOGF(info, "LUT correction requested, will load LUT when initializing with timestamp..."); } if (doprocessRun2 == false && doprocessRun3 == false && doprocessRun3withStrangenessTracking == false && doprocessRun3withKFParticle == false && doprocessFindableRun3 == false) { @@ -756,9 +755,11 @@ struct cascadeBuilder { /// Set magnetic field for KF vertexing KFParticle::SetField(d_bz); - if (useMatCorrType == 2) { + if (useMatCorrType == 2 && !lut) { // setMatLUT only after magfield has been initalized // (setMatLUT has implicit and problematic init field call if not) + LOG(info) << "Loading material look-up table for timestamp: " << timestamp; + lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->getForTimeStamp(ccdbConfigurations.lutPath, timestamp)); o2::base::Propagator::Instance()->setMatLUT(lut); } } diff --git a/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx b/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx index 220670d1e4a..dc7fe18a66a 100644 --- a/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx +++ b/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx @@ -27,8 +27,12 @@ #include "Framework/ASoAHelpers.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/Centrality.h" +#include "CCDB/BasicCCDBManager.h" #include "TF1.h" +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -37,6 +41,8 @@ using namespace o2::framework::expressions; #define bitcheck(var, nbit) ((var) & (1 << (nbit))) struct hstrangecorrelationfilter { + Service ccdb; + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // Operational @@ -45,6 +51,9 @@ struct hstrangecorrelationfilter { Configurable strangedEdxNSigma{"strangedEdxNSigma", 4, "Nsigmas for strange decay daughters"}; Configurable strangedEdxNSigmaTight{"strangedEdxNSigmaTight", 3, "Nsigmas for strange decay daughters"}; + // event filtering + Configurable zorroMask{"zorroMask", "", "zorro trigger class to select on (empty: none)"}; + // Trigger particle selections in phase space Configurable triggerEtaMin{"triggerEtaCutMin", -0.8, "triggeretamin"}; Configurable triggerEtaMax{"triggerEtaCutMax", 0.8, "triggeretamax"}; @@ -125,10 +134,6 @@ struct hstrangecorrelationfilter { Filter preFilterCascade = nabs(aod::cascdata::dcapostopv) > dcaPostopv&& nabs(aod::cascdata::dcanegtopv) > dcaNegtopv&& nabs(aod::cascdata::dcabachtopv) > cascadesetting_dcabachtopv&& aod::cascdata::dcaV0daughters < dcaV0dau&& aod::cascdata::dcacascdaughters < cascadesetting_dcacascdau; - // histogram defined with HistogramRegistry - HistogramRegistry registry{ - "registry", - {}}; using V0LinkedTagged = soa::Join; using CascadesLinkedTagged = soa::Join; using DauTracks = soa::Join; @@ -152,8 +157,15 @@ struct hstrangecorrelationfilter { TF1* fOmegaMean = new TF1("fomegaMean", "[0]+[1]*x+[2]*TMath::Exp(-[3]*x)"); TF1* fOmegaWidth = new TF1("fomegaWidth", "[0]+[1]*x+[2]*TMath::Exp(-[3]*x)"); + Zorro zorro; + OutputObj zorroSummary{"zorroSummary"}; + int mRunNumber; + void init(InitContext const&) { + zorroSummary.setObject(zorro.getZorroSummary()); + mRunNumber = -1; + fK0Mean->SetParameters(massParsK0Mean->at(0), massParsK0Mean->at(1), massParsK0Mean->at(2), massParsK0Mean->at(3)); fK0Width->SetParameters(massParsK0Width->at(0), massParsK0Width->at(1), massParsK0Width->at(2), massParsK0Width->at(3)); fLambdaMean->SetParameters(massParsLambdaMean->at(0), massParsLambdaMean->at(1), massParsLambdaMean->at(2), massParsLambdaMean->at(3)); @@ -172,6 +184,18 @@ struct hstrangecorrelationfilter { histos.add("h3dMassOmegaPlus", "h3dMassOmegaPlus", kTH3F, {axisPtQA, axisOmegaMass, axisMult}); } + void initCCDB(aod::BCsWithTimestamps::iterator const& bc) + { + if (mRunNumber == bc.runNumber()) { + return; + } + + zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), zorroMask.value); + zorro.populateHistRegistry(histos, bc.runNumber()); + + mRunNumber = bc.runNumber(); + } + // reco-level trigger quality checks (N.B.: DCA is filtered, not selected) template bool isValidTrigger(TTrack track) @@ -199,7 +223,7 @@ struct hstrangecorrelationfilter { } // for real data processing - void processTriggers(soa::Join::iterator const& collision, soa::Filtered const& tracks) + void processTriggers(soa::Join::iterator const& collision, soa::Filtered const& tracks, aod::BCsWithTimestamps const&) { // Perform basic event selection if (!collision.sel8()) { @@ -209,6 +233,14 @@ struct hstrangecorrelationfilter { if (TMath::Abs(collision.posZ()) > 10.0) { return; } + if (zorroMask.value != "") { + auto bc = collision.bc_as(); + initCCDB(bc); + bool zorroSelected = zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting + if (!zorroSelected) { + return; + } + } /// _________________________________________________ /// Step 1: Populate table with trigger tracks @@ -224,7 +256,7 @@ struct hstrangecorrelationfilter { } // for MC processing - void processTriggersMC(soa::Join::iterator const& collision, soa::Filtered const& tracks, aod::McParticles const&) + void processTriggersMC(soa::Join::iterator const& collision, soa::Filtered const& tracks, aod::McParticles const&, aod::BCsWithTimestamps const&) { // Perform basic event selection if (!collision.sel8()) { @@ -234,6 +266,14 @@ struct hstrangecorrelationfilter { if (TMath::Abs(collision.posZ()) > 10.0) { return; } + if (zorroMask.value != "") { + auto bc = collision.bc_as(); + initCCDB(bc); + bool zorroSelected = zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting + if (!zorroSelected) { + return; + } + } /// _________________________________________________ /// Step 1: Populate table with trigger tracks @@ -255,7 +295,7 @@ struct hstrangecorrelationfilter { } } - void processAssocPions(soa::Join::iterator const& collision, soa::Filtered const& tracks) + void processAssocPions(soa::Join::iterator const& collision, soa::Filtered const& tracks, aod::BCsWithTimestamps const&) { // Perform basic event selection if (!collision.sel8()) { @@ -265,6 +305,14 @@ struct hstrangecorrelationfilter { if (TMath::Abs(collision.posZ()) > 10.0) { return; } + if (zorroMask.value != "") { + auto bc = collision.bc_as(); + initCCDB(bc); + bool zorroSelected = zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting + if (!zorroSelected) { + return; + } + } /// _________________________________________________ /// Step 1: Populate table with trigger tracks @@ -321,7 +369,7 @@ struct hstrangecorrelationfilter { } } - void processAssocHadrons(soa::Join::iterator const& collision, soa::Filtered> const& tracks) + void processAssocHadrons(soa::Join::iterator const& collision, soa::Filtered> const& tracks, aod::BCsWithTimestamps const&) { // Perform basic event selection if (!collision.sel8()) { @@ -331,6 +379,14 @@ struct hstrangecorrelationfilter { if (TMath::Abs(collision.posZ()) > 10.0) { return; } + if (zorroMask.value != "") { + auto bc = collision.bc_as(); + initCCDB(bc); + bool zorroSelected = zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting + if (!zorroSelected) { + return; + } + } /// _________________________________________________ /// Step 1: Populate table with trigger tracks @@ -355,7 +411,7 @@ struct hstrangecorrelationfilter { } } - void processV0s(soa::Join::iterator const& collision, DauTracks const&, soa::Filtered const& V0s, V0LinkedTagged const&) + void processV0s(soa::Join::iterator const& collision, DauTracks const&, soa::Filtered const& V0s, V0LinkedTagged const&, aod::BCsWithTimestamps const&) { // Perform basic event selection if (!collision.sel8()) { @@ -365,6 +421,15 @@ struct hstrangecorrelationfilter { if (TMath::Abs(collision.posZ()) > 10.0) { return; } + if (zorroMask.value != "") { + auto bc = collision.bc_as(); + initCCDB(bc); + bool zorroSelected = zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting + if (!zorroSelected) { + return; + } + } + /// _________________________________________________ /// Populate table with associated V0s for (auto const& v0 : V0s) { @@ -437,7 +502,7 @@ struct hstrangecorrelationfilter { } } } - void processCascades(soa::Join::iterator const& collision, DauTracks const&, soa::Filtered const& /*V0s*/, soa::Filtered const& Cascades, aod::V0sLinked const&, CascadesLinkedTagged const&) + void processCascades(soa::Join::iterator const& collision, DauTracks const&, soa::Filtered const& /*V0s*/, soa::Filtered const& Cascades, aod::V0sLinked const&, CascadesLinkedTagged const&, aod::BCsWithTimestamps const&) { // Perform basic event selection if (!collision.sel8()) { @@ -447,6 +512,14 @@ struct hstrangecorrelationfilter { if (TMath::Abs(collision.posZ()) > 10.0) { return; } + if (zorroMask.value != "") { + auto bc = collision.bc_as(); + initCCDB(bc); + bool zorroSelected = zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting + if (!zorroSelected) { + return; + } + } /// _________________________________________________ /// Step 3: Populate table with associated Cascades for (auto const& casc : Cascades) { diff --git a/PWGLF/TableProducer/Strangeness/lambdakzerobuilder.cxx b/PWGLF/TableProducer/Strangeness/lambdakzerobuilder.cxx index 376b980a8b0..7097705f7a1 100644 --- a/PWGLF/TableProducer/Strangeness/lambdakzerobuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdakzerobuilder.cxx @@ -543,9 +543,7 @@ struct lambdakzeroBuilder { } } if (dcaFitterConfigurations.useMatCorrType == 2) { - LOGF(info, "LUT correction requested, loading LUT"); - lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get(ccdbConfigurations.lutPath)); - LOGF(info, "LUT load done!"); + LOGF(info, "LUT correction requested, will load LUT when initializing with timestamp..."); } if (doprocessRun2 == false && doprocessRun3 == false && doprocessFindableRun3 == false) { @@ -739,9 +737,11 @@ struct lambdakzeroBuilder { // Set magnetic field value once known fitter.setBz(d_bz); - if (dcaFitterConfigurations.useMatCorrType == 2) { + if (dcaFitterConfigurations.useMatCorrType == 2 && !lut) { // setMatLUT only after magfield has been initalized // (setMatLUT has implicit and problematic init field call if not) + LOG(info) << "Loading material look-up table for timestamp: " << timestamp; + lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->getForTimeStamp(ccdbConfigurations.lutPath, timestamp)); o2::base::Propagator::Instance()->setMatLUT(lut); } } diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index 2af0f0d9ef9..1dbbaa907c5 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -221,6 +221,143 @@ struct strangederivedbuilder { void init(InitContext&) { + LOGF(info, "Initializing now: cross-checking correctness..."); + if (doprocessCollisions + + doprocessCollisionsWithUD + + doprocessCollisionsWithMC + + doprocessCollisionsWithUDWithMC > + 1) { + LOGF(fatal, "You have enabled more than one process function associated to collisions. Please check your configuration! Aborting now."); + } + if (doprocessTrackExtrasV0sOnly + + doprocessTrackExtras + + doprocessTrackExtrasNoPID + + doprocessTrackExtrasMC > + 1) { + LOGF(fatal, "You have enabled more than one process function associated to TracksExtra. Please check your configuration! Aborting now."); + } + + LOGF(info, "====] base information processing [==============================="); + if (doprocessDataframeIDs) { + LOGF(info, "Process data frame IDs............: yes"); + } else { + LOGF(info, "Process data frame IDs............: no"); + } + + // collision processing printout + if (doprocessCollisions) { + LOGF(info, "Collision processing type.........: no UD, no MC"); + } + if (doprocessCollisionsWithUD) { + LOGF(info, "Collision processing type.........: with UD, no MC"); + } + if (doprocessCollisionsWithMC) { + LOGF(info, "Collision processing type.........: with MC, no UD"); + } + if (doprocessCollisionsWithUDWithMC) { + LOGF(info, "Collision processing type.........: with MC, with UD"); + } + + LOGF(info, "====] event characterization processing [========================="); + if (doprocessFT0AQVectors) { + LOGF(info, "Process FT0A Q-vectors............: yes"); + } else { + LOGF(info, "Process FT0A Q-vectors............: no"); + } + if (doprocessFT0CQVectors) { + LOGF(info, "Process FT0C Q-vectors............: yes"); + } else { + LOGF(info, "Process FT0C Q-vectors............: no"); + } + if (doprocessFT0CQVectorsLF) { + LOGF(info, "Process FT0C Q-vectors (LF).......: yes"); + } else { + LOGF(info, "Process FT0C Q-vectors (LF).......: no"); + } + if (doprocessFT0MQVectors) { + LOGF(info, "Process FT0M Q-vectors............: yes"); + } else { + LOGF(info, "Process FT0M Q-vectors............: no"); + } + if (doprocessFV0AQVectors) { + LOGF(info, "Process FV0A Q-vectors............: yes"); + } else { + LOGF(info, "Process FV0A Q-vectors............: no"); + } + if (doprocessTPCQVectors) { + LOGF(info, "Process TPC Q-vectors.............: yes"); + } else { + LOGF(info, "Process TPC Q-vectors.............: no"); + } + if (doprocessTPCQVectorsLF) { + LOGF(info, "Process TPC Q-vectors (LF)........: yes"); + } else { + LOGF(info, "Process TPC Q-vectors (LF)........: no"); + } + if (doprocessZDCSP) { + LOGF(info, "Process ZPC spectator plane.......: yes"); + } else { + LOGF(info, "Process ZPC spectator plane.......: no"); + } + + LOGF(info, "====] daughter track property processing [========================"); + if (doprocessTrackExtrasV0sOnly) { + LOGF(info, "TracksExtra processing type.......: V0s only"); + } + if (doprocessTrackExtras) { + LOGF(info, "TracksExtra processing type.......: V0s + cascades"); + } + if (doprocessTrackExtrasNoPID) { + LOGF(info, "TracksExtra processing type.......: V0s + cascades, no PID"); + } + if (doprocessTrackExtrasMC) { + LOGF(info, "TracksExtra processing type.......: V0s + cascades, Monte Carlo"); + } + LOGF(info, "====] cascade interlink processing [=============================="); + if (doprocessCascadeInterlinkTracked) { + LOGF(info, "Process cascade/tracked interlink.: yes"); + } else { + LOGF(info, "Process cascade/tracked interlink.: no"); + } + if (doprocessCascadeInterlinkKF) { + LOGF(info, "Process cascade/KF interlink......: yes"); + } else { + LOGF(info, "Process cascade/KF interlink......: no"); + } + LOGF(info, "====] simulated information processing [=========================="); + if (doprocessPureSimulation) { + LOGF(info, "Process pure simulation info......: yes"); + } else { + LOGF(info, "Process pure simulation info......: no"); + } + if (doprocessReconstructedSimulation) { + LOGF(info, "Process reco simulation info......: yes"); + } else { + LOGF(info, "Process reco simulation info......: no"); + } + if (doprocessBinnedGenerated) { + LOGF(info, "Process binned simulation info....: yes"); + } else { + LOGF(info, "Process binned simulation info....: no"); + } + if (doprocessStrangeMothers) { + LOGF(info, "Process strange mothers...........: yes"); + } else { + LOGF(info, "Process strange mothers...........: no"); + } + LOGF(info, "====] findable exercise extras [=================================="); + if (doprocessV0FoundTags) { + LOGF(info, "Process found V0 tags.............: yes"); + } else { + LOGF(info, "Process found V0 tags.............: no"); + } + if (doprocessCascFoundTags) { + LOGF(info, "Process found cascade tags........: yes"); + } else { + LOGF(info, "Process found cascade tags........: no"); + } + LOGF(info, "=================================================================="); + // setup map for fast checking if enabled static_for<0, nSpecies - 1>([&](auto i) { constexpr int index = i.value; @@ -583,28 +720,33 @@ struct strangederivedbuilder { tr.tpcNClsFindableMinusFound(), tr.tpcNClsFindableMinusCrossedRows()); + // _________________________________________ // if the table has MC info if constexpr (requires { tr.mcParticle(); }) { // do your thing with the mcParticleIds only in case the table has the MC info dauTrackMCIds(tr.mcParticleId()); // joinable with dauTrackExtras } - // round if requested - if (roundNSigmaVariables) { - dauTrackTPCPIDs(tr.tpcSignal(), - roundToPrecision(tr.tpcNSigmaEl(), precisionNSigmas), - roundToPrecision(tr.tpcNSigmaPi(), precisionNSigmas), - roundToPrecision(tr.tpcNSigmaKa(), precisionNSigmas), - roundToPrecision(tr.tpcNSigmaPr(), precisionNSigmas), - roundToPrecision(tr.tpcNSigmaHe(), precisionNSigmas)); + if constexpr (requires { tr.tpcNSigmaEl(); }) { + if (roundNSigmaVariables) { // round if requested + dauTrackTPCPIDs(tr.tpcSignal(), + roundToPrecision(tr.tpcNSigmaEl(), precisionNSigmas), + roundToPrecision(tr.tpcNSigmaPi(), precisionNSigmas), + roundToPrecision(tr.tpcNSigmaKa(), precisionNSigmas), + roundToPrecision(tr.tpcNSigmaPr(), precisionNSigmas), + roundToPrecision(tr.tpcNSigmaHe(), precisionNSigmas)); + } else { + dauTrackTPCPIDs(tr.tpcSignal(), tr.tpcNSigmaEl(), + tr.tpcNSigmaPi(), tr.tpcNSigmaKa(), + tr.tpcNSigmaPr(), tr.tpcNSigmaHe()); + } + // populate daughter-level TOF information + dauTrackTOFPIDs(tr.tofSignal(), tr.tofEvTime(), tr.length()); } else { - dauTrackTPCPIDs(tr.tpcSignal(), tr.tpcNSigmaEl(), - tr.tpcNSigmaPi(), tr.tpcNSigmaKa(), - tr.tpcNSigmaPr(), tr.tpcNSigmaHe()); + // populate with empty fully-compatible Nsigmas if no corresponding table available + dauTrackTPCPIDs(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + dauTrackTOFPIDs(0.0f, 0.0f, 0.0f); } - - // populate daughter-level TOF information - dauTrackTOFPIDs(tr.tofSignal(), tr.tofEvTime(), tr.length()); } } // done! @@ -613,13 +755,17 @@ struct strangederivedbuilder { void processTrackExtras(aod::V0Datas const& V0s, aod::CascDatas const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, soa::Join const& tracksExtra, aod::V0s const&) { fillTrackExtras(V0s, Cascades, KFCascades, TraCascades, tracksExtra); - // done! + } + + // no TPC services + void processTrackExtrasNoPID(aod::V0Datas const& V0s, aod::CascDatas const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, soa::Join const& tracksExtra, aod::V0s const&) + { + fillTrackExtras(V0s, Cascades, KFCascades, TraCascades, tracksExtra); } void processTrackExtrasMC(aod::V0Datas const& V0s, aod::CascDatas const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, soa::Join const& tracksExtra, aod::V0s const&) { fillTrackExtras(V0s, Cascades, KFCascades, TraCascades, tracksExtra); - // done! } void processStrangeMothers(soa::Join const& V0s, soa::Join const& Cascades, aod::McParticles const& mcParticles) @@ -905,6 +1051,7 @@ struct strangederivedbuilder { // detailed information processing PROCESS_SWITCH(strangederivedbuilder, processTrackExtrasV0sOnly, "Produce track extra information (V0s only)", true); PROCESS_SWITCH(strangederivedbuilder, processTrackExtras, "Produce track extra information (V0s + casc)", true); + PROCESS_SWITCH(strangederivedbuilder, processTrackExtrasNoPID, "Produce track extra information (V0s + casc), no PID", false); PROCESS_SWITCH(strangederivedbuilder, processTrackExtrasMC, "Produce track extra information (V0s + casc)", false); PROCESS_SWITCH(strangederivedbuilder, processStrangeMothers, "Produce tables with mother info for V0s + casc", true); PROCESS_SWITCH(strangederivedbuilder, processCascadeInterlinkTracked, "Produce tables interconnecting cascades", false); diff --git a/PWGLF/Tasks/Nuspex/AngularCorrelationsInJets.cxx b/PWGLF/Tasks/Nuspex/AngularCorrelationsInJets.cxx index 4dc39903415..3fa2f9a4c76 100644 --- a/PWGLF/Tasks/Nuspex/AngularCorrelationsInJets.cxx +++ b/PWGLF/Tasks/Nuspex/AngularCorrelationsInJets.cxx @@ -339,15 +339,24 @@ struct AngularCorrelationsInJets { { // reject any track that has nsigma < 3 for more than 1 species if (track.tpcNSigmaStoreEl() < nsigmaRejection || track.tpcNSigmaStoreMu() < nsigmaRejection || track.tpcNSigmaStorePi() < nsigmaRejection || track.tpcNSigmaStoreKa() < nsigmaRejection || track.tpcNSigmaStoreTr() < nsigmaRejection || track.tpcNSigmaStoreAl() < nsigmaRejection) return false; - switch (species) { - case 1: // (anti)proton - return (track.tpcNSigmaPr() < nsigmaRejection && track.tpcNSigmaDe() > nsigmaRejection && track.tpcNSigmaHe() > nsigmaRejection); + switch (species) { // guard against nsigmaRejection being lower than nsigma cuts that are applied before this function + case 1: // proton + return (track.tpcNSigmaPr() < protonNsigma && track.tpcNSigmaDe() > nsigmaRejection && track.tpcNSigmaHe() > nsigmaRejection); break; - case 2: // (anti)deuteron - return (track.tpcNSigmaDe() < nsigmaRejection && track.tpcNSigmaPr() > nsigmaRejection && track.tpcNSigmaHe() > nsigmaRejection); + case 2: // antiproton + return (track.tpcNSigmaPr() < antiprotonNsigma && track.tpcNSigmaDe() > nsigmaRejection && track.tpcNSigmaHe() > nsigmaRejection); break; - case 3: // (anti)helium-3 - return (track.tpcNSigmaHe() < nsigmaRejection && track.tpcNSigmaDe() > nsigmaRejection && track.tpcNSigmaPr() > nsigmaRejection); + case 3: // deuteron + return (track.tpcNSigmaDe() < nucleiNsigma && track.tpcNSigmaPr() > nsigmaRejection && track.tpcNSigmaHe() > nsigmaRejection); + break; + case 4: // antideuteron + return (track.tpcNSigmaDe() < antinucleiNsigma && track.tpcNSigmaPr() > nsigmaRejection && track.tpcNSigmaHe() > nsigmaRejection); + break; + case 5: // helium-3 + return (track.tpcNSigmaHe() < nucleiNsigma && track.tpcNSigmaDe() > nsigmaRejection && track.tpcNSigmaPr() > nsigmaRejection); + break; + case 6: // antihelium-3 + return (track.tpcNSigmaHe() < antinucleiNsigma && track.tpcNSigmaDe() > nsigmaRejection && track.tpcNSigmaPr() > nsigmaRejection); break; default: return false; @@ -425,7 +434,7 @@ struct AngularCorrelationsInJets { double tofNsigma = track.hasTOF() ? track.tofNSigmaPr() : 999; if ((track.pt() < antiprotonTPCTOFpT && (TMath::Abs(track.tpcNSigmaPr()) > antiprotonNsigma)) || (track.pt() > antiprotonTPCTOFpT && (TMath::Sqrt(track.tpcNSigmaPr() * track.tpcNSigmaPr() + tofNsigma * tofNsigma) > antiprotonNsigma))) return false; - if (!singleSpeciesTPCNSigma(track, 1)) + if (!singleSpeciesTPCNSigma(track, 2)) return false; } else { // for yields // DCA @@ -474,7 +483,7 @@ struct AngularCorrelationsInJets { double tofNsigma = track.hasTOF() ? track.tofNSigmaDe() : 999; if ((track.pt() < nucleiTPCTOFpT && (TMath::Abs(track.tpcNSigmaDe()) > nucleiNsigma)) || (track.pt() > nucleiTPCTOFpT && (TMath::Sqrt(track.tpcNSigmaDe() * track.tpcNSigmaDe() + tofNsigma * tofNsigma) > nucleiNsigma))) return false; - if (!singleSpeciesTPCNSigma(track, 2)) + if (!singleSpeciesTPCNSigma(track, 3)) return false; } else { // for yields // DCA @@ -514,7 +523,7 @@ struct AngularCorrelationsInJets { double tofNsigma = track.hasTOF() ? track.tofNSigmaHe() : 999; if ((track.pt() < nucleiTPCTOFpT && (TMath::Abs(track.tpcNSigmaHe()) > nucleiNsigma)) || (track.pt() > nucleiTPCTOFpT && (TMath::Sqrt(track.tpcNSigmaHe() * track.tpcNSigmaHe() + tofNsigma * tofNsigma) > nucleiNsigma))) return false; - if (!singleSpeciesTPCNSigma(track, 3)) + if (!singleSpeciesTPCNSigma(track, 5)) return false; } else { // for yields // DCA @@ -565,7 +574,7 @@ struct AngularCorrelationsInJets { double tofNsigma = track.hasTOF() ? track.tofNSigmaDe() : 999; if ((track.pt() < antinucleiTPCTOFpT && (TMath::Abs(track.tpcNSigmaDe()) > antinucleiNsigma)) || (track.pt() > antinucleiTPCTOFpT && (TMath::Sqrt(track.tpcNSigmaDe() * track.tpcNSigmaDe() + tofNsigma * tofNsigma) > antinucleiNsigma))) return false; - if (!singleSpeciesTPCNSigma(track, 2)) + if (!singleSpeciesTPCNSigma(track, 4)) return false; } else { // for yields // DCA @@ -605,7 +614,7 @@ struct AngularCorrelationsInJets { double tofNsigma = track.hasTOF() ? track.tofNSigmaHe() : 999; if ((track.pt() < antinucleiTPCTOFpT && (TMath::Abs(track.tpcNSigmaHe()) > antinucleiNsigma)) || (track.pt() > antinucleiTPCTOFpT && (TMath::Sqrt(track.tpcNSigmaHe() * track.tpcNSigmaHe() + tofNsigma * tofNsigma) > antinucleiNsigma))) return false; - if (!singleSpeciesTPCNSigma(track, 3)) + if (!singleSpeciesTPCNSigma(track, 6)) return false; } else { // for yields // DCA @@ -834,7 +843,7 @@ struct AngularCorrelationsInJets { return jetCounter; registryData.fill(HIST("hPtTotalSubJetPerp"), subtractedJetPerp.pt()); registryData.fill(HIST("hPtTotalSubJetArea"), subtractedJetArea.pt()); - registryQA.fill(HIST("hRhoEstimateArea"), jet.pt(), rho); + registryQA.fill(HIST("hRhoEstimateArea"), jet.pt(), rho); // switch to subtracted jet pt registryQA.fill(HIST("hRhoMEstimateArea"), jet.pt(), rhoM); registryQA.fill(HIST("hRhoEstimatePerp"), jet.pt(), rhoPerp); registryQA.fill(HIST("hRhoMEstimatePerp"), jet.pt(), rhoMPerp); diff --git a/PWGLF/Tasks/Nuspex/CMakeLists.txt b/PWGLF/Tasks/Nuspex/CMakeLists.txt index afc9891eb3e..9f730fc29a1 100644 --- a/PWGLF/Tasks/Nuspex/CMakeLists.txt +++ b/PWGLF/Tasks/Nuspex/CMakeLists.txt @@ -144,8 +144,8 @@ o2physics_add_dpl_workflow(ebye-mult PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(he3-from-hypertriton-map - SOURCES he3FromHypertritonMap.cxx +o2physics_add_dpl_workflow(nuclei-from-hypertriton-map + SOURCES nucleiFromHypertritonMap.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/Nuspex/he3FromHypertritonMap.cxx b/PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx similarity index 77% rename from PWGLF/Tasks/Nuspex/he3FromHypertritonMap.cxx rename to PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx index 27f6ed6d5b3..ace8de3fa99 100644 --- a/PWGLF/Tasks/Nuspex/he3FromHypertritonMap.cxx +++ b/PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx @@ -46,7 +46,7 @@ using std::array; using MCTracks = soa::Join; -struct he3FromHypertritonMap { +struct nucleiFromHypertritonMap { HistogramRegistry registryMC{ "registryMC", {}, @@ -70,17 +70,23 @@ struct he3FromHypertritonMap { Configurable max_pt{"max_pt", 10.0f, "maximum pt of the tracks"}; Configurable nbin_pt{"nbin_pt", 50, "number of pt bins"}; Configurable nbin_dca = {"nbin_dca", 50, "number of DCA bins"}; + Configurable saveHelium{"saveHelium", false, "Save helium candidates"}; + int AntideuteronPDG = -1000010020; int AntihePDG = -1000020030; int AntiHypertritonPDG = -1010010030; int AntiHyperHelium4PDG = -1010020040; void init(InitContext const&) { - registryMC.add("he3SecPtRec_from_hypertriton", "he3SecPtRec_from_hypertriton", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); - registryMC.add("he3SecPtRec_from_hyperHe4", "he3SecPtRec_from_hyperHe4", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); registryMC.add("hypertritonPtgen", "hypertritonPtGen", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); - registryMC.add("hyperHe4Ptgen", "hyperHe4PtGen", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); + if (saveHelium) { + registryMC.add("he3SecPtRec_from_hypertriton", "he3SecPtRec_from_hypertriton", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); + registryMC.add("hyperHe4Ptgen", "hyperHe4PtGen", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); + registryMC.add("he3SecPtRec_from_hyperHe4", "he3SecPtRec_from_hyperHe4", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); + } else { + registryMC.add("deutSecPtRec_from_hypertriton", "deutSecPtRec_from_hypertriton", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); + } } void processMC(aod::McParticles const& /*mcParticles*/, const MCTracks& tracks) @@ -90,8 +96,14 @@ struct he3FromHypertritonMap { continue; } auto mcparticle = track.mcParticle(); - if (mcparticle.pdgCode() != AntihePDG || mcparticle.isPhysicalPrimary()) { - continue; + if (saveHelium) { + if (mcparticle.pdgCode() != AntihePDG || mcparticle.isPhysicalPrimary()) { + continue; + } + } else { + if (mcparticle.pdgCode() != AntideuteronPDG || mcparticle.isPhysicalPrimary()) { + continue; + } } for (auto& motherparticle : mcparticle.mothers_as()) { @@ -109,8 +121,12 @@ struct he3FromHypertritonMap { continue; } if (motherparticle.pdgCode() == AntiHypertritonPDG) { - registryMC.fill(HIST("he3SecPtRec_from_hypertriton"), 2 * track.pt()); registryMC.fill(HIST("hypertritonPtgen"), motherparticle.pt()); + if (saveHelium) { + registryMC.fill(HIST("he3SecPtRec_from_hypertriton"), 2 * track.pt()); + } else { + registryMC.fill(HIST("deutSecPtRec_from_hypertriton"), track.pt()); + } } if (motherparticle.pdgCode() == AntiHyperHelium4PDG) { registryMC.fill(HIST("he3SecPtRec_from_hyperHe4"), 2 * track.pt()); @@ -120,10 +136,10 @@ struct he3FromHypertritonMap { } } } - PROCESS_SWITCH(he3FromHypertritonMap, processMC, "Process MC", false); + PROCESS_SWITCH(nucleiFromHypertritonMap, processMC, "Process MC", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/PWGLF/Tasks/Resonances/CMakeLists.txt b/PWGLF/Tasks/Resonances/CMakeLists.txt index 51d07dd381d..3982955c885 100644 --- a/PWGLF/Tasks/Resonances/CMakeLists.txt +++ b/PWGLF/Tasks/Resonances/CMakeLists.txt @@ -183,3 +183,8 @@ o2physics_add_dpl_workflow(kshortlambda SOURCES kshortlambda.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(rho770analysis + SOURCES rho770analysis.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/PWGLF/Tasks/Resonances/doublephimeson.cxx b/PWGLF/Tasks/Resonances/doublephimeson.cxx index 1c0270b2825..097f37dab57 100644 --- a/PWGLF/Tasks/Resonances/doublephimeson.cxx +++ b/PWGLF/Tasks/Resonances/doublephimeson.cxx @@ -17,11 +17,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include "Framework/AnalysisTask.h" #include "Framework/ASoAHelpers.h" @@ -41,7 +43,8 @@ struct doublephimeson { HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; Configurable fillRotation{"fillRotation", 1, "Fill rotation"}; - Configurable strategyPID{"strategyPID", 0, "PID strategy"}; + Configurable strategyPID1{"strategyPID1", 0, "PID strategy 1"}; + Configurable strategyPID2{"strategyPID2", 0, "PID strategy 2"}; Configurable minPhiMass{"minPhiMass", 1.01, "Minimum phi mass"}; Configurable maxPhiMass{"maxPhiMass", 1.03, "Maximum phi mass"}; Configurable additionalEvsel{"additionalEvsel", false, "Additional event selection"}; @@ -54,9 +57,13 @@ struct doublephimeson { // THnsparse bining ConfigurableAxis configThnAxisInvMass{"configThnAxisInvMass", {1500, 2.0, 3.5}, "#it{M} (GeV/#it{c}^{2})"}; + ConfigurableAxis configThnAxisInvMassPhi{"configThnAxisInvMassPhi", {20, 1.01, 1.03}, "#it{M} (GeV/#it{c}^{2})"}; ConfigurableAxis configThnAxisDaugherPt{"configThnAxisDaugherPt", {25, 0.0, 50.}, "#it{p}_{T} (GeV/#it{c})"}; ConfigurableAxis configThnAxisPt{"configThnAxisPt", {40, 0.0, 20.}, "#it{p}_{T} (GeV/#it{c})"}; - ConfigurableAxis configThnAxisKstar{"configThnAxisKstar", {50, 0.0, 0.5}, "#it{k}^{*} (GeV/#it{c})"}; + ConfigurableAxis configThnAxisKstar{"configThnAxisKstar", {200, 0.0, 2.0}, "#it{k}^{*} (GeV/#it{c})"}; + ConfigurableAxis configThnAxisDeltaR{"configThnAxisDeltaR", {200, 0.0, 2.0}, "#it{k}^{*} (GeV/#it{c})"}; + ConfigurableAxis configThnAxisCosTheta{"configThnAxisCosTheta", {5, 0.0, 1.0}, "cos #theta{*}"}; + // ConfigurableAxis configThnAxisPhiMult{"configThnAxisPhiMult", {10, 0.5, 10.5}, "#Phi Multiplicity"}; // Initialize the ananlysis task void init(o2::framework::InitContext&) @@ -68,15 +75,17 @@ struct doublephimeson { histos.add("hPhid2Mass", "hPhid2Mass", kTH2F, {{40, 1.0, 1.04f}, {100, 0.0f, 10.0f}}); const AxisSpec thnAxisInvMass{configThnAxisInvMass, "#it{M} (GeV/#it{c}^{2})"}; + const AxisSpec thnAxisInvMassPhi{configThnAxisInvMassPhi, "#it{M} (GeV/#it{c}^{2})"}; const AxisSpec thnAxisDaughterPt{configThnAxisDaugherPt, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec thnAxisPt{configThnAxisPt, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec thnAxisKstar{configThnAxisKstar, "#it{k}^{*} (GeV/#it{c})"}; - - histos.add("SEMassUnlike", "SEMassUnlike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisDaughterPt, thnAxisDaughterPt, thnAxisKstar}); - histos.add("SEMassRot", "SEMassRot", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisDaughterPt, thnAxisDaughterPt, thnAxisKstar}); - - histos.add("MEMassUnlike", "MEMassUnlike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisDaughterPt, thnAxisDaughterPt, thnAxisKstar}); - histos.add("MEMassRot", "MEMassRot", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisDaughterPt, thnAxisDaughterPt, thnAxisKstar}); + const AxisSpec thnAxisDeltaR{configThnAxisDeltaR, "#Delta R)"}; + const AxisSpec thnAxisCosTheta{configThnAxisCosTheta, "cos #theta{*}"}; + // const AxisSpec thnAxisPhiMult{configThnAxisPhiMult, "#Phi Multiplicity)"}; + histos.add("SEMass", "SEMass", HistType::kTHnSparseF, {thnAxisInvMassPhi, thnAxisInvMassPhi, thnAxisDaughterPt, thnAxisDaughterPt}); + histos.add("SEMassUnlike", "SEMassUnlike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisKstar, thnAxisCosTheta, thnAxisDeltaR}); + histos.add("SEMassRot", "SEMassRot", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisKstar, thnAxisCosTheta, thnAxisDeltaR}); + histos.add("MEMassUnlike", "MEMassUnlike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisKstar, thnAxisCosTheta, thnAxisDeltaR}); } // get kstar @@ -101,6 +110,25 @@ struct doublephimeson { trackRelK = PartOneCMS - PartTwoCMS; return 0.5 * trackRelK.P(); } + + // get cosTheta + TLorentzVector daughterCMS; + ROOT::Math::XYZVector threeVecDauCM, threeVecMother; + float getCosTheta(const TLorentzVector mother, + const TLorentzVector daughter) + { + threeVecMother = mother.Vect(); + const float beta = mother.Beta(); + const float betax = beta * std::cos(mother.Phi()) * std::sin(mother.Theta()); + const float betay = beta * std::sin(mother.Phi()) * std::sin(mother.Theta()); + const float betaz = beta * std::cos(mother.Theta()); + const ROOT::Math::Boost boostPRF = ROOT::Math::Boost(-betax, -betay, -betaz); + daughterCMS = boostPRF(daughter); + threeVecDauCM = daughterCMS.Vect(); + float cosThetaStar = TMath::Abs(threeVecDauCM.Dot(threeVecMother) / std::sqrt(threeVecMother.Mag2()) / std::sqrt(threeVecDauCM.Mag2())); + return cosThetaStar; + } + bool selectionPID(float nsigmaTPC, float nsigmaTOF, int TOFHit, int PIDStrategy, float ptcand) { if (PIDStrategy == 0) { @@ -116,7 +144,7 @@ struct doublephimeson { } } if (PIDStrategy == 1) { - if (ptcand < 0.6) { + if (ptcand < 0.5) { if (TOFHit != 1 && TMath::Abs(nsigmaTPC) < cutNsigmaTPC) { return true; } @@ -124,14 +152,14 @@ struct doublephimeson { return true; } } - if (ptcand >= 0.6) { + if (ptcand >= 0.5) { if (TOFHit == 1 && TMath::Abs(nsigmaTOF) < cutNsigmaTOF) { return true; } } } if (PIDStrategy == 2) { - if (ptcand < 0.6) { + if (ptcand < 0.5) { if (TOFHit != 1 && TMath::Abs(nsigmaTPC) < cutNsigmaTPC) { return true; } @@ -139,7 +167,7 @@ struct doublephimeson { return true; } } - if (ptcand >= 0.6 && ptcand < 1.2) { + if (ptcand >= 0.5 && ptcand < 1.2) { if (TOFHit == 1 && TMath::Abs(nsigmaTOF) < cutNsigmaTOF) { return true; } @@ -157,7 +185,7 @@ struct doublephimeson { } } if (PIDStrategy == 3) { - if (ptcand < 0.6) { + if (ptcand < 0.5) { if (TOFHit != 1 && TMath::Abs(nsigmaTPC) < cutNsigmaTPC) { return true; } @@ -165,7 +193,7 @@ struct doublephimeson { return true; } } - if (ptcand >= 0.6 && ptcand < 1.2) { + if (ptcand >= 0.5 && ptcand < 1.2) { if (TOFHit == 1 && TMath::Abs(nsigmaTOF) < cutNsigmaTOF) { return true; } @@ -197,13 +225,13 @@ struct doublephimeson { auto kaonplusd1pt = TMath::Sqrt(phitrackd1.phid1Px() * phitrackd1.phid1Px() + phitrackd1.phid1Py() * phitrackd1.phid1Py()); auto kaonminusd1pt = TMath::Sqrt(phitrackd1.phid2Px() * phitrackd1.phid2Px() + phitrackd1.phid2Py() * phitrackd1.phid2Py()); - if (!selectionPID(phitrackd1.phid1TPC(), phitrackd1.phid1TOF(), phitrackd1.phid1TOFHit(), strategyPID, kaonplusd1pt)) { + if (!selectionPID(phitrackd1.phid1TPC(), phitrackd1.phid1TOF(), phitrackd1.phid1TOFHit(), strategyPID1, kaonplusd1pt)) { continue; } - if (!selectionPID(phitrackd1.phid2TPC(), phitrackd1.phid2TOF(), phitrackd1.phid2TOFHit(), strategyPID, kaonminusd1pt)) { + if (!selectionPID(phitrackd1.phid2TPC(), phitrackd1.phid2TOF(), phitrackd1.phid2TOFHit(), strategyPID1, kaonminusd1pt)) { continue; } - + // LOGF(info, "pass TOF hit: (%d, %d)", phitrackd1.phid1TOFHit(), phitrackd1.phid2TOFHit()); histos.fill(HIST("hnsigmaTPCKaonPlus"), phitrackd1.phid1TPC(), kaonplusd1pt); histos.fill(HIST("hnsigmaTPCKaonMinus"), phitrackd1.phid2TPC(), kaonminusd1pt); Phid1.SetXYZM(phitrackd1.phiPx(), phitrackd1.phiPy(), phitrackd1.phiPz(), phitrackd1.phiMass()); @@ -220,10 +248,10 @@ struct doublephimeson { auto kaonplusd2pt = TMath::Sqrt(phitrackd2.phid1Px() * phitrackd2.phid1Px() + phitrackd2.phid1Py() * phitrackd2.phid1Py()); auto kaonminusd2pt = TMath::Sqrt(phitrackd2.phid2Px() * phitrackd2.phid2Px() + phitrackd2.phid2Py() * phitrackd2.phid2Py()); - if (!selectionPID(phitrackd2.phid1TPC(), phitrackd2.phid1TOF(), phitrackd2.phid1TOFHit(), strategyPID, kaonplusd2pt)) { + if (!selectionPID(phitrackd2.phid1TPC(), phitrackd2.phid1TOF(), phitrackd2.phid1TOFHit(), strategyPID2, kaonplusd2pt)) { continue; } - if (!selectionPID(phitrackd2.phid2TPC(), phitrackd2.phid2TOF(), phitrackd2.phid2TOFHit(), strategyPID, kaonminusd2pt)) { + if (!selectionPID(phitrackd2.phid2TPC(), phitrackd2.phid2TOF(), phitrackd2.phid2TOFHit(), strategyPID2, kaonminusd2pt)) { continue; } if (phitrackd1.phid1Index() == phitrackd2.phid1Index()) { @@ -234,10 +262,13 @@ struct doublephimeson { } Phid2.SetXYZM(phitrackd2.phiPx(), phitrackd2.phiPy(), phitrackd2.phiPz(), phitrackd2.phiMass()); exotic = Phid1 + Phid2; + auto cosThetaStar = getCosTheta(exotic, Phid1); auto kstar = getkstar(Phid1, Phid2); - histos.fill(HIST("SEMassUnlike"), exotic.M(), exotic.Pt(), Phid1.Pt(), Phid2.Pt(), kstar); + auto deltaR = TMath::Sqrt(TMath::Power(Phid1.Phi() - Phid2.Phi(), 2.0) + TMath::Power(Phid1.Eta() - Phid2.Eta(), 2.0)); + histos.fill(HIST("SEMassUnlike"), exotic.M(), exotic.Pt(), kstar, cosThetaStar, deltaR); + histos.fill(HIST("SEMass"), Phid1.M(), Phid2.M(), Phid1.Pt(), Phid2.Pt()); if (fillRotation) { - for (int nrotbkg = 0; nrotbkg < 9; nrotbkg++) { + for (int nrotbkg = 0; nrotbkg < 5; nrotbkg++) { auto anglestart = 5.0 * TMath::Pi() / 6.0; auto angleend = 7.0 * TMath::Pi() / 6.0; auto anglestep = (angleend - anglestart) / (1.0 * (9.0 - 1.0)); @@ -246,8 +277,10 @@ struct doublephimeson { auto rotd1py = Phid1.Px() * std::sin(rotangle) + Phid1.Py() * std::cos(rotangle); Phid1Rot.SetXYZM(rotd1px, rotd1py, Phid1.Pz(), Phid1.M()); exoticRot = Phid1Rot + Phid2; + auto cosThetaStar_rot = getCosTheta(exoticRot, Phid1Rot); auto kstar_rot = getkstar(Phid1Rot, Phid2); - histos.fill(HIST("SEMassRot"), exoticRot.M(), exoticRot.Pt(), Phid1Rot.Pt(), Phid2.Pt(), kstar_rot); + auto deltaR_rot = TMath::Sqrt(TMath::Power(Phid1Rot.Phi() - Phid2.Phi(), 2.0) + TMath::Power(Phid1Rot.Eta() - Phid2.Eta(), 2.0)); + histos.fill(HIST("SEMassRot"), exoticRot.M(), exoticRot.Pt(), kstar_rot, cosThetaStar_rot, deltaR_rot); } } } @@ -266,54 +299,46 @@ struct doublephimeson { if (collision1.index() == collision2.index()) { continue; } + if (additionalEvsel && (collision1.numPos() < 2 || collision1.numNeg() < 2)) { + continue; + } + if (additionalEvsel && (collision2.numPos() < 2 || collision2.numNeg() < 2)) { + continue; + } for (auto& [phitrackd1, phitrackd2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { if (phitrackd1.phiMass() < minPhiMass || phitrackd1.phiMass() > maxPhiMass) { continue; } - + if (phitrackd2.phiMass() < minPhiMass || phitrackd2.phiMass() > maxPhiMass) { + continue; + } auto kaonplusd1pt = TMath::Sqrt(phitrackd1.phid1Px() * phitrackd1.phid1Px() + phitrackd1.phid1Py() * phitrackd1.phid1Py()); auto kaonminusd1pt = TMath::Sqrt(phitrackd1.phid2Px() * phitrackd1.phid2Px() + phitrackd1.phid2Py() * phitrackd1.phid2Py()); auto kaonplusd2pt = TMath::Sqrt(phitrackd2.phid1Px() * phitrackd2.phid1Px() + phitrackd2.phid1Py() * phitrackd2.phid1Py()); auto kaonminusd2pt = TMath::Sqrt(phitrackd2.phid2Px() * phitrackd2.phid2Px() + phitrackd2.phid2Py() * phitrackd2.phid2Py()); - - if (!selectionPID(phitrackd1.phid1TPC(), phitrackd1.phid1TOF(), phitrackd1.phid1TOFHit(), strategyPID, kaonplusd1pt)) { + if (!selectionPID(phitrackd1.phid1TPC(), phitrackd1.phid1TOF(), phitrackd1.phid1TOFHit(), strategyPID1, kaonplusd1pt)) { continue; } - if (!selectionPID(phitrackd1.phid2TPC(), phitrackd1.phid2TOF(), phitrackd1.phid2TOFHit(), strategyPID, kaonminusd1pt)) { + if (!selectionPID(phitrackd1.phid2TPC(), phitrackd1.phid2TOF(), phitrackd1.phid2TOFHit(), strategyPID1, kaonminusd1pt)) { continue; } Phid1.SetXYZM(phitrackd1.phiPx(), phitrackd1.phiPy(), phitrackd1.phiPz(), phitrackd1.phiMass()); - if (phitrackd2.phiMass() < minPhiMass || phitrackd2.phiMass() > maxPhiMass) { - continue; - } - if (!selectionPID(phitrackd2.phid1TPC(), phitrackd2.phid1TOF(), phitrackd2.phid1TOFHit(), strategyPID, kaonplusd2pt)) { + if (!selectionPID(phitrackd2.phid1TPC(), phitrackd2.phid1TOF(), phitrackd2.phid1TOFHit(), strategyPID2, kaonplusd2pt)) { continue; } - if (!selectionPID(phitrackd2.phid2TPC(), phitrackd2.phid2TOF(), phitrackd2.phid2TOFHit(), strategyPID, kaonminusd2pt)) { + if (!selectionPID(phitrackd2.phid2TPC(), phitrackd2.phid2TOF(), phitrackd2.phid2TOFHit(), strategyPID2, kaonminusd2pt)) { continue; } Phid2.SetXYZM(phitrackd2.phiPx(), phitrackd2.phiPy(), phitrackd2.phiPz(), phitrackd2.phiMass()); exotic = Phid1 + Phid2; + auto cosThetaStar = getCosTheta(exotic, Phid1); auto kstar = getkstar(Phid1, Phid2); - histos.fill(HIST("MEMassUnlike"), exotic.M(), exotic.Pt(), Phid1.Pt(), Phid2.Pt(), kstar); - if (fillRotation) { - for (int nrotbkg = 0; nrotbkg < 9; nrotbkg++) { - auto anglestart = 5.0 * TMath::Pi() / 6.0; - auto angleend = 7.0 * TMath::Pi() / 6.0; - auto anglestep = (angleend - anglestart) / (1.0 * (9.0 - 1.0)); - auto rotangle = anglestart + nrotbkg * anglestep; - auto rotd1px = Phid1.Px() * std::cos(rotangle) - Phid1.Py() * std::sin(rotangle); - auto rotd1py = Phid1.Px() * std::sin(rotangle) + Phid1.Py() * std::cos(rotangle); - Phid1Rot.SetXYZM(rotd1px, rotd1py, Phid1.Pz(), Phid1.M()); - exoticRot = Phid1Rot + Phid2; - auto kstar_rot = getkstar(Phid1Rot, Phid2); - histos.fill(HIST("MEMassRot"), exoticRot.M(), exoticRot.Pt(), Phid1Rot.Pt(), Phid2.Pt(), kstar_rot); - } - } + auto deltaR = TMath::Sqrt(TMath::Power(Phid1.Phi() - Phid2.Phi(), 2.0) + TMath::Power(Phid1.Eta() - Phid2.Eta(), 2.0)); + histos.fill(HIST("MEMassUnlike"), exotic.M(), exotic.Pt(), kstar, cosThetaStar, deltaR); } } } - PROCESS_SWITCH(doublephimeson, processMixedEvent, "Process EventMixing for combinatorial background", true); + PROCESS_SWITCH(doublephimeson, processMixedEvent, "Process EventMixing for combinatorial background", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx b/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx index 85ad1180b23..febb7eeec96 100644 --- a/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx +++ b/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx @@ -239,9 +239,6 @@ struct f0980pbpbanalysis { bool PIDSelected(const TrackType track) { if (cfgUSETOF) { - if (!track.hasTOF()) { - return 0; - } if (std::fabs(track.tofNSigmaPi()) > cMaxTOFnSigmaPion) { return 0; } diff --git a/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx b/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx index 8d2f04c7ee2..f356a4f67f3 100644 --- a/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx +++ b/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx @@ -62,7 +62,7 @@ struct f1protoncorrelation { // Event Mixing Configurable nEvtMixing{"nEvtMixing", 10, "Number of events to mix"}; ConfigurableAxis CfgVtxBins{"CfgVtxBins", {10, -10, 10}, "Mixing bins - z-vertex"}; - ConfigurableAxis CfgMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0.0, 20.0, 40.0, 60.0, 80.0, 500.0}, "Mixing bins - number of contributor"}; + ConfigurableAxis CfgMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0.0, 40.0, 80.0, 500.0}, "Mixing bins - number of contributor"}; // THnsparse bining ConfigurableAxis configThnAxisInvMass{"configThnAxisInvMass", {100, 1.0, 1.4}, "#it{M} (GeV/#it{c}^{2})"}; @@ -71,9 +71,12 @@ struct f1protoncorrelation { ConfigurableAxis configThnAxisPtProton{"configThnAxisPtProton", {20, 0.0, 4.}, "#it{p}_{T} (GeV/#it{c})"}; ConfigurableAxis configThnAxisNsigma{"configThnAxisNsigma", {90, -9.0, 9.0}, "NsigmaCombined"}; + // mix event bining policy + ColumnBinningPolicy colBinningFemto{{CfgVtxBins, CfgMultBins}, true}; // Initialize the ananlysis task void init(o2::framework::InitContext&) { + colBinningFemto = {{CfgVtxBins, CfgMultBins}, true}; // register histograms histos.add("hNsigmaProtonTPC", "Nsigma Proton TPC distribution", kTH2F, {{100, -5.0f, 5.0f}, {100, 0.0f, 10.0f}}); histos.add("hNsigmaKaonTPC", "Nsigma Kaon TPC distribution", kTH2F, {{100, -5.0f, 5.0f}, {100, 0.0f, 10.0f}}); @@ -155,13 +158,13 @@ struct f1protoncorrelation { if (Kaon.Pt() > 0.7 && Kaon.Pt() <= 1.0 && (f1track.f1d2TPC() < -1.0 || f1track.f1d2TPC() > 2.5)) { continue; } - if (Kaon.Pt() > 1.0 && (f1track.f1d2TPC() < -2.0 || f1track.f1d2TPC() > 2.0)) { + if (Kaon.Pt() > 1.0 && (f1track.f1d2TPC() < -2.5 || f1track.f1d2TPC() > 2.5)) { continue; } if (Pion.Pt() < 2.0 && (f1track.f1d1TPC() < -2.5 || f1track.f1d1TPC() > 2.5)) { continue; } - if (Pion.Pt() > 2.0 && (f1track.f1d1TPC() < -2.0 || f1track.f1d1TPC() > 2.0)) { + if (Pion.Pt() > 2.0 && (f1track.f1d1TPC() < -2.5 || f1track.f1d1TPC() > 2.5)) { continue; } } @@ -276,13 +279,13 @@ struct f1protoncorrelation { if (Kaon.Pt() > 0.7 && Kaon.Pt() <= 1.0 && (t1.f1d2TPC() < -1.0 || t1.f1d2TPC() > 2.5)) { continue; } - if (Kaon.Pt() > 1.0 && (t1.f1d2TPC() < -2.0 || t1.f1d2TPC() > 2.0)) { + if (Kaon.Pt() > 1.0 && (t1.f1d2TPC() < -2.5 || t1.f1d2TPC() > 2.5)) { continue; } if (Pion.Pt() < 2.0 && (t1.f1d1TPC() < -2.5 || t1.f1d1TPC() > 2.5)) { continue; } - if (Pion.Pt() > 2.0 && (t1.f1d1TPC() < -2.0 || t1.f1d1TPC() > 2.0)) { + if (Pion.Pt() > 2.0 && (t1.f1d1TPC() < -2.5 || t1.f1d1TPC() > 2.5)) { continue; } } @@ -344,6 +347,108 @@ struct f1protoncorrelation { } } PROCESS_SWITCH(f1protoncorrelation, processME, "Process EventMixing for combinatorial background", false); + void processMEOpti(aod::RedF1PEvents& collisions, aod::F1Tracks& f1tracks, aod::ProtonTracks& protontracks) + { + // for (auto const& [collision1, collision2] : combinations(soa::CombinationsBlockFullIndexPolicy(colBinningFemto, nEvtMixing, -1, collisions, collisions))){ + for (auto const& [collision1, collision2] : selfCombinations(colBinning, nEvtMixing, -1, collisions, collisions)) { + // LOGF(info, "Mixed event collisions: (%d, %d)", collision1.index(), collision2.index()); + if (collision1.index() == collision2.index()) { + continue; + } + auto groupF1 = f1tracks.sliceBy(tracksPerCollisionPresliceF1, collision1.globalIndex()); + auto groupProton = protontracks.sliceBy(tracksPerCollisionPresliceP, collision2.globalIndex()); + // auto groupF1 = f1tracks.sliceByCached(aod::f1protondaughter::redF1PEventId, collision1.globalIndex(), cache); + // auto groupProton = protontracks.sliceByCached(aod::f1protondaughter::redF1PEventId, collision2.globalIndex(), cache); + for (auto& [t1, t2] : soa::combinations(o2::soa::CombinationsFullIndexPolicy(groupF1, groupProton))) { + if (t1.f1MassKaonKshort() > maxKKS0Mass) { + continue; + } + F1.SetXYZM(t1.f1Px(), t1.f1Py(), t1.f1Pz(), t1.f1Mass()); + Pion.SetXYZM(t1.f1d1Px(), t1.f1d1Py(), t1.f1d1Pz(), 0.139); + Kaon.SetXYZM(t1.f1d2Px(), t1.f1d2Py(), t1.f1d2Pz(), 0.493); + Kshort.SetXYZM(t1.f1d3Px(), t1.f1d3Py(), t1.f1d3Pz(), 0.497); + KaonKshortPair = Kaon + Kshort; + if (Pion.Pt() > maxMomentumPion || Kaon.Pt() > maxMomentumKaon) { + continue; + } + if (pdepPID) { + if (Kaon.Pt() <= 0.5 && (t1.f1d2TPC() < -2.5 || t1.f1d2TPC() > 2.5)) { + continue; + } + if (Kaon.Pt() > 0.5 && Kaon.Pt() <= 0.7 && (t1.f1d2TPC() < -1.5 || t1.f1d2TPC() > 2.5)) { + continue; + } + if (Kaon.Pt() > 0.7 && Kaon.Pt() <= 1.0 && (t1.f1d2TPC() < -1.0 || t1.f1d2TPC() > 2.5)) { + continue; + } + if (Kaon.Pt() > 1.0 && (t1.f1d2TPC() < -2.5 || t1.f1d2TPC() > 2.5)) { + continue; + } + if (Pion.Pt() < 2.0 && (t1.f1d1TPC() < -2.5 || t1.f1d1TPC() > 2.5)) { + continue; + } + if (Pion.Pt() > 2.0 && (t1.f1d1TPC() < -2.5 || t1.f1d1TPC() > 2.5)) { + continue; + } + } + if (strategyPIDPion == 1 && Pion.Pt() > momentumTOFPionMin && Pion.Pt() <= momentumTOFPionMax && t1.f1d1TOFHit() != 1) { + continue; + } + if (strategyPIDKaon == 1 && Kaon.Pt() > momentumTOFKaonMin && Kaon.Pt() <= momentumTOFKaonMax && t1.f1d2TOFHit() != 1) { + continue; + } + if (typeofCombined == 0) { + combinedTPC = TMath::Sqrt(t1.f1d1TPC() * t1.f1d1TPC() + t1.f1d2TPC() * t1.f1d2TPC()); + } + if (typeofCombined == 1) { + combinedTPC = (t1.f1d1TPC() - t1.f1d2TPC()) / (t1.f1d1TPC() + t1.f1d2TPC()); + } + Proton.SetXYZM(t2.protonPx(), t2.protonPy(), t2.protonPz(), 0.938); + if (Proton.Pt() > momentumProtonMax) { + continue; + } + if (Proton.P() < momentumTOFProton && TMath::Abs(t2.protonNsigmaTPC()) > 2.5) { + continue; + } + if (Proton.P() >= momentumTOFProton && (t2.protonTOFHit() != 1 || TMath::Abs(t2.protonNsigmaTOF()) > 2.5)) { + continue; + } + auto relative_momentum = getkstar(F1, Proton); + if (t1.f1SignalStat() == 1) { + histos.fill(HIST("h2MixEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M()); // F1 sign = 1 unlike, F1 sign = -1 like + if (fillSparse) { + histos.fill(HIST("MEMassUnlike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC); + } + } + if (t1.f1SignalStat() == -1) { + histos.fill(HIST("h2MixEventInvariantMassLike_mass"), relative_momentum, F1.Pt(), F1.M()); + if (fillSparse) { + histos.fill(HIST("MEMassLike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC); + } + } + if (fillRotation) { + for (int nrotbkg = 0; nrotbkg < 9; nrotbkg++) { + auto anglestart = 5.0 * TMath::Pi() / 6.0; + auto angleend = 7.0 * TMath::Pi() / 6.0; + auto anglestep = (angleend - anglestart) / (1.0 * (9.0 - 1.0)); + auto rotangle = anglestart + nrotbkg * anglestep; + auto rotKKPx = KaonKshortPair.Px() * std::cos(rotangle) - KaonKshortPair.Py() * std::sin(rotangle); + auto rotKKPy = KaonKshortPair.Px() * std::sin(rotangle) + KaonKshortPair.Py() * std::cos(rotangle); + KaonKshortPairRot.SetXYZM(rotKKPx, rotKKPy, KaonKshortPair.Pz(), KaonKshortPair.M()); + F1Rot = Pion + KaonKshortPairRot; + auto relative_momentum_rot = getkstar(F1Rot, Proton); + if (t1.f1SignalStat() == 1) { + histos.fill(HIST("h2MixEventInvariantMassRot_mass"), relative_momentum_rot, F1Rot.Pt(), F1Rot.M()); + if (fillSparse) { + histos.fill(HIST("MEMassRot"), F1Rot.M(), F1Rot.Pt(), Proton.Pt(), relative_momentum_rot, combinedTPC); + } + } + } + } + } + } + } + PROCESS_SWITCH(f1protoncorrelation, processMEOpti, "Process EventMixing for combinatorial background Optimal", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx index d9e3eb99f44..51af74455f2 100644 --- a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx @@ -78,7 +78,8 @@ struct phianalysisrun3_PbPb { Configurable nsigmaCutCombined{"nsigmaCutCombined", 3.0, "Value of the TOF Nsigma cut"}; Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"}; Configurable fillOccupancy{"fillOccupancy", true, "fill Occupancy"}; - Configurable cfgOccupancyCut{"cfgOccupancyCut", 2500, "Occupancy cut"}; + Configurable cfgOccupancyCut1{"cfgOccupancyCut1", 500, "Occupancy cut"}; + Configurable cfgOccupancyCut2{"cfgOccupancyCut2", 1500, "Occupancy cut"}; Configurable isNoTOF{"isNoTOF", false, "isNoTOF"}; Configurable additionalEvSel2{"additionalEvSel2", true, "Additional evsel2"}; Configurable additionalEvSel3{"additionalEvSel3", true, "Additional evsel3"}; @@ -98,12 +99,10 @@ struct phianalysisrun3_PbPb { Configurable avoidsplitrackMC{"avoidsplitrackMC", false, "avoid split track in MC"}; void init(o2::framework::InitContext&) { - std::vector occupancyBinning = {0.0, 500.0, 1000.0, 1500.0, 2000.0, 3000.0, 4000.0, 5000.0, 50000.0}; - AxisSpec occupancyAxis = {occupancyBinning, "Occupancy"}; histos.add("hCentrality", "Centrality distribution", kTH1F, {{200, 0.0, 200.0}}); histos.add("hVtxZ", "Vertex distribution in Z;Z (cm)", kTH1F, {{400, -20.0, 20.0}}); - histos.add("hOccupancy", "Occupancy distribution", kTH1F, {occupancyAxis}); + histos.add("hOccupancy", "Occupancy distribution", kTH1F, {{500, 0, 50000}}); if (!isMC) { histos.add("h3PhiInvMassUnlikeSign", "Invariant mass of Phi meson Unlike Sign", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); histos.add("h3PhiInvMassMixed", "Invariant mass of Phi meson Mixed", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); @@ -120,6 +119,7 @@ struct phianalysisrun3_PbPb { histos.add("h1Phimassgen", "Phi meson gen", kTH1F, {{200, 0.9, 1.1}}); histos.add("h1Phimassrec", "Phi meson Rec", kTH1F, {{200, 0.9, 1.1}}); histos.add("h1Phipt", "Phi meson Rec", kTH1F, {{200, 0.0f, 20.0f}}); + histos.add("hOccupancy1", "Occupancy distribution", kTH1F, {{500, 0, 50000}}); } // DCA QA @@ -262,8 +262,7 @@ struct phianalysisrun3_PbPb { return; } int occupancy = collision.trackOccupancyInTimeRange(); - if (fillOccupancy && occupancy > cfgOccupancyCut) // occupancy info is available for this collision (*) - { + if (fillOccupancy && !(occupancy > cfgOccupancyCut1 && occupancy < cfgOccupancyCut2)) { return; } float multiplicity{-1}; @@ -344,8 +343,10 @@ struct phianalysisrun3_PbPb { } int occupancy1 = c1.trackOccupancyInTimeRange(); int occupancy2 = c2.trackOccupancyInTimeRange(); - if (fillOccupancy && occupancy1 > cfgOccupancyCut && occupancy2 > cfgOccupancyCut) // occupancy info is available for this collision (*) - { + if (fillOccupancy && !(occupancy1 > cfgOccupancyCut1 && occupancy1 < cfgOccupancyCut2)) { + return; + } + if (fillOccupancy && !(occupancy2 > cfgOccupancyCut1 && occupancy2 < cfgOccupancyCut2)) { return; } float multiplicity; @@ -400,8 +401,7 @@ struct phianalysisrun3_PbPb { continue; } int occupancy = RecCollision.trackOccupancyInTimeRange(); - if (fillOccupancy && occupancy > cfgOccupancyCut) // occupancy info is available for this collision (*) - { + if (fillOccupancy && !(occupancy > cfgOccupancyCut1 && occupancy < cfgOccupancyCut2)) { return; } if (TMath::Abs(RecCollision.posZ()) > cfgCutVertex) { @@ -582,10 +582,10 @@ struct phianalysisrun3_PbPb { continue; } int occupancy = collision.trackOccupancyInTimeRange(); - if (fillOccupancy && occupancy > cfgOccupancyCut) // occupancy info is available for this collision (*) - { - continue; + if (fillOccupancy && !(occupancy > cfgOccupancyCut1 && occupancy < cfgOccupancyCut2)) { + return; } + histos.fill(HIST("hOccupancy1"), occupancy); multiplicity = collision.centFT0C(); histos.fill(HIST("Centgen"), multiplicity); SelectedEvents[nevts++] = collision.mcCollision_as().globalIndex(); @@ -636,8 +636,7 @@ struct phianalysisrun3_PbPb { return; } int occupancy = collision.trackOccupancyInTimeRange(); - if (fillOccupancy && occupancy > cfgOccupancyCut) // occupancy info is available for this collision (*) - { + if (fillOccupancy && !(occupancy > cfgOccupancyCut1 && occupancy < cfgOccupancyCut2)) { return; } auto multiplicity = collision.centFT0C(); diff --git a/PWGLF/Tasks/Resonances/rho770analysis.cxx b/PWGLF/Tasks/Resonances/rho770analysis.cxx new file mode 100644 index 00000000000..8e7932fdb81 --- /dev/null +++ b/PWGLF/Tasks/Resonances/rho770analysis.cxx @@ -0,0 +1,406 @@ +// 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 rho770analysis.cxx +/// \brief rho(770)0 analysis in pp 13 & 13.6 TeV +/// \author Hyunji Lim (hyunji.lim@cern.ch) +/// \since 12/04/2024 + +#include +#include +#include "TVector2.h" + +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/PIDResponse.h" +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "PWGLF/DataModel/LFResonanceTables.h" +#include "CommonConstants/PhysicsConstants.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; +using namespace o2::constants::physics; + +struct rho770analysis { + SliceCache cache; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + Configurable cfgMinPt{"cfgMinPt", 0.15, "Minimum transverse momentum for charged track"}; + Configurable cfgMaxEta{"cfgMaxEta", 0.8, "Maximum pseudorapidiy for charged track"}; + Configurable cfgMaxDCArToPVcut{"cfgMaxDCArToPVcut", 0.15, "Maximum transverse DCA"}; + Configurable cfgMaxDCAzToPVcut{"cfgMaxDCAzToPVcut", 2.0, "Maximum longitudinal DCA"}; + Configurable cfgMaxTPC{"cfgMaxTPC", 5.0, "Maximum TPC PID with TOF"}; + Configurable cfgMaxTOF{"cfgMaxTOF", 3.0, "Maximum TOF PID with TPC"}; + Configurable cfgMinRap{"cfgMinRap", -0.5, "Minimum rapidity for pair"}; + Configurable cfgMaxRap{"cfgMaxRap", 0.5, "Maximum rapidity for pair"}; + + // Track selection + Configurable cfgPrimaryTrack{"cfgPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | + // kTPCNCls | kTPCCrossedRows | + // kTPCCrossedRowsOverNCls | + // kTPCChi2NDF | kTPCRefit | + // kITSNCls | kITSChi2NDF | + // kITSRefit | kITSHits) | + // kInAcceptanceTracks (kPtRange | + // kEtaRange) + Configurable cfgPVContributor{"cfgPVContributor", true, "PV contributor track selection"}; // PV Contriuibutor + Configurable cfgGlobalTrack{"cfgGlobalTrack", false, "Global track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; + Configurable cfgTPCcluster{"cfgTPCcluster", 0, "Number of TPC cluster"}; + Configurable cfgRatioTPCRowsOverFindableCls{"cfgRatioTPCRowsOverFindableCls", 0.0f, "TPC Crossed Rows to Findable Clusters"}; + Configurable cfgITSChi2NCl{"cfgITSChi2NCl", 999.0, "ITS Chi2/NCl"}; + Configurable cfgTPCChi2NCl{"cfgTPCChi2NCl", 999.0, "TPC Chi2/NCl"}; + Configurable cfgUseTPCRefit{"cfgUseTPCRefit", false, "Require TPC Refit"}; + Configurable cfgUseITSRefit{"cfgUseITSRefit", false, "Require ITS Refit"}; + Configurable cfgHasITS{"cfgHasITS", false, "Require ITS"}; + Configurable cfgHasTPC{"cfgHasTPC", false, "Require TPC"}; + Configurable cfgHasTOF{"cfgHasTOF", false, "Require TOF"}; + + // PID + Configurable cMaxTOFnSigmaPion{"cMaxTOFnSigmaPion", 3.0, "TOF nSigma cut for Pion"}; // TOF + Configurable cMaxTPCnSigmaPion{"cMaxTPCnSigmaPion", 3.0, "TPC nSigma cut for Pion"}; // TPC + Configurable nsigmaCutCombinedPion{"nsigmaCutCombinedPion", 3.0, "Combined nSigma cut for Pion"}; + Configurable selectType{"selectType", 0, "PID selection type"}; + + // Axis + ConfigurableAxis massAxis{"massAxis", {400, 0.2, 2.2}, "Invariant mass axis"}; + ConfigurableAxis massK0sAxis{"massK0sAxis", {200, 0.46, 0.54}, "K0s Invariant mass axis"}; + ConfigurableAxis massKstarAxis{"massKstarAxis", {200, 0.7, 1.1}, "Kstar Invariant mass axis"}; + ConfigurableAxis ptAxis{"ptAxis", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 10.0, 13.0, 20.0}, "Transverse momentum Binning"}; + ConfigurableAxis centAxis{"centAxis", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 35.0, 40.0, 45.0, 50.0, 55.0, 60.0, 65.0, 70.0, 75.0, 80.0, 95.0, 100.0, 105.0, 110.0}, "Centrality Binning"}; + + void init(o2::framework::InitContext&) + { + AxisSpec pidqaAxis = {120, -6, 6}; + AxisSpec pTqaAxis = {200, 0, 20}; + + histos.add("hInvMass_rho770_US", "unlike invariant mass", {HistType::kTHnSparseF, {massAxis, ptAxis, centAxis}}); + histos.add("hInvMass_rho770_LSpp", "++ invariant mass", {HistType::kTHnSparseF, {massAxis, ptAxis, centAxis}}); + histos.add("hInvMass_rho770_LSmm", "-- invariant mass", {HistType::kTHnSparseF, {massAxis, ptAxis, centAxis}}); + + histos.add("hInvMass_K0s_US", "K0s unlike invariant mass", {HistType::kTHnSparseF, {massK0sAxis, ptAxis, centAxis}}); + histos.add("hInvMass_K0s_LSpp", "K0s ++ invariant mass", {HistType::kTHnSparseF, {massK0sAxis, ptAxis, centAxis}}); + histos.add("hInvMass_K0s_LSmm", "K0s -- invariant mass", {HistType::kTHnSparseF, {massK0sAxis, ptAxis, centAxis}}); + + histos.add("hInvMass_Kstar_US", "Kstar unlike invariant mass", {HistType::kTHnSparseF, {massKstarAxis, ptAxis, centAxis}}); + histos.add("hInvMass_Kstar_LSpp", "Kstar ++ invariant mass", {HistType::kTHnSparseF, {massKstarAxis, ptAxis, centAxis}}); + histos.add("hInvMass_Kstar_LSmm", "Kstar -- invariant mass", {HistType::kTHnSparseF, {massKstarAxis, ptAxis, centAxis}}); + + histos.add("QA/Nsigma_TPC", "", {HistType::kTH2F, {pTqaAxis, pidqaAxis}}); + histos.add("QA/Nsigma_TOF", "", {HistType::kTH2F, {pTqaAxis, pidqaAxis}}); + histos.add("QA/TPC_TOF", "", {HistType::kTH2F, {pidqaAxis, pidqaAxis}}); + + if (doprocessMCLight) { + histos.add("MCL/hpT_rho770_GEN", "generated rho770 signals", HistType::kTH1F, {ptAxis}); + histos.add("MCL/hpT_rho770_REC", "reconstructed rho770 signals", HistType::kTHnSparseF, {massAxis, ptAxis, centAxis}); + histos.add("MCL/hpT_omega_REC", "reconstructed omega signals", HistType::kTHnSparseF, {massAxis, ptAxis, centAxis}); + histos.add("MCL/hpT_K0s_REC", "reconstructed K0s signals", HistType::kTHnSparseF, {massAxis, ptAxis, centAxis}); + histos.add("MCL/hpT_Kstar_REC", "reconstructed Kstar signals", HistType::kTHnSparseF, {massAxis, ptAxis, centAxis}); + histos.add("MCL/hpT_K0s_pipi_REC", "reconstructed K0s signals in pipi hist", HistType::kTHnSparseF, {massK0sAxis, ptAxis, centAxis}); + histos.add("MCL/hpT_Kstar_Kpi_REC", "reconstructed rho770 signals in KK hist", HistType::kTHnSparseF, {massKstarAxis, ptAxis, centAxis}); + } + + histos.print(); + } + + double massPi = MassPionCharged; + double massKa = MassKaonCharged; + + template + bool selTrack(const TrackType track) + { + if (std::abs(track.pt()) < cfgMinPt) + return false; + if (std::fabs(track.eta()) > cfgMaxEta) + return false; + if (std::abs(track.dcaXY()) > cfgMaxDCArToPVcut) + return false; + if (std::abs(track.dcaZ()) > cfgMaxDCAzToPVcut) + return false; + if (track.itsNCls() < cfgITScluster) + return false; + if (track.tpcNClsFound() < cfgTPCcluster) + return false; + if (track.tpcCrossedRowsOverFindableCls() < cfgRatioTPCRowsOverFindableCls) + return false; + if (track.itsChi2NCl() >= cfgITSChi2NCl) + return false; + if (track.tpcChi2NCl() >= cfgTPCChi2NCl) + return false; + if (cfgHasITS && !track.hasITS()) + return false; + if (cfgHasTPC && !track.hasTPC()) + return false; + if (cfgHasTOF && !track.hasTOF()) + return false; + if (cfgUseITSRefit && !track.passedITSRefit()) + return false; + if (cfgUseTPCRefit && !track.passedTPCRefit()) + return false; + if (cfgPVContributor && !track.isPVContributor()) + return false; + if (cfgPrimaryTrack && !track.isPrimaryTrack()) + return false; + if (cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) + return false; + if (cfgGlobalTrack && !track.isGlobalTrack()) + return false; + + return true; + } + + template + bool selPion(const TrackType track) + { + if (selectType == 0) { + if (std::fabs(track.tpcNSigmaPi()) >= cMaxTPCnSigmaPion || std::fabs(track.tofNSigmaPi()) >= cMaxTOFnSigmaPion) + return false; + } + if (selectType == 1) { + if (std::fabs(track.tpcNSigmaPi()) >= cMaxTPCnSigmaPion) + return false; + } + if (selectType == 2) { + if (track.tpcNSigmaPi() * track.tpcNSigmaPi() + track.tofNSigmaPi() * track.tofNSigmaPi() >= nsigmaCutCombinedPion * nsigmaCutCombinedPion) + return false; + } + return true; + } + + template + bool selKaon(const TrackType track) + { + if (selectType == 0) { + if (std::fabs(track.tpcNSigmaKa()) >= cMaxTPCnSigmaPion || std::fabs(track.tofNSigmaKa()) >= cMaxTOFnSigmaPion) + return false; + } + if (selectType == 1) { + if (std::fabs(track.tpcNSigmaKa()) >= cMaxTPCnSigmaPion) + return false; + } + if (selectType == 2) { + if (track.tpcNSigmaKa() * track.tpcNSigmaKa() + track.tofNSigmaKa() * track.tofNSigmaKa() >= nsigmaCutCombinedPion * nsigmaCutCombinedPion) + return false; + } + return true; + } + + template + void fillHistograms(const CollisionType& collision, const TracksType& dTracks) + { + TLorentzVector part1, part2, reco; + for (const auto& [trk1, trk2] : combinations(CombinationsUpperIndexPolicy(dTracks, dTracks))) { + if (trk1.index() == trk2.index()) { + if (!selTrack(trk1)) + continue; + + histos.fill(HIST("QA/Nsigma_TPC"), trk1.pt(), trk1.tpcNSigmaPi()); + histos.fill(HIST("QA/Nsigma_TOF"), trk1.pt(), trk1.tofNSigmaPi()); + histos.fill(HIST("QA/TPC_TOF"), trk1.tpcNSigmaPi(), trk1.tofNSigmaPi()); + continue; + } + + if (!selTrack(trk1) || !selTrack(trk2)) + continue; + + if (selPion(trk1) && selPion(trk2)) { + part1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPi); + part2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi); + reco = part1 + part2; + + if (reco.Rapidity() > cfgMaxRap || reco.Rapidity() < cfgMinRap) + continue; + + if (trk1.sign() * trk2.sign() < 0) { + histos.fill(HIST("hInvMass_rho770_US"), reco.M(), reco.Pt(), collision.cent()); + histos.fill(HIST("hInvMass_K0s_US"), reco.M(), reco.Pt(), collision.cent()); + + if constexpr (IsMC) { + if (trk1.motherId() != trk2.motherId()) + continue; + if (std::abs(trk1.pdgCode()) == 211 && std::abs(trk2.pdgCode()) == 211) { + if (std::abs(trk1.motherPDG()) == 113) { + histos.fill(HIST("MCL/hpT_rho770_REC"), reco.M(), reco.Pt(), collision.cent()); + } else if (std::abs(trk1.motherPDG()) == 223) { + histos.fill(HIST("MCL/hpT_omega_REC"), reco.M(), reco.Pt(), collision.cent()); + } else if (std::abs(trk1.motherPDG()) == 310) { + histos.fill(HIST("MCL/hpT_K0s_REC"), reco.M(), reco.Pt(), collision.cent()); + histos.fill(HIST("MCL/hpT_K0s_pipi_REC"), reco.M(), reco.Pt(), collision.cent()); + } + } else if ((std::abs(trk1.pdgCode()) == 211 && std::abs(trk2.pdgCode()) == 321) || (std::abs(trk1.pdgCode()) == 321 && std::abs(trk2.pdgCode()) == 211)) { + if (std::abs(trk1.motherPDG()) == 313) + histos.fill(HIST("MCL/hpT_Kstar_REC"), reco.M(), reco.Pt(), collision.cent()); + histos.fill(HIST("QA/Nsigma_TPC"), trk1.pt(), trk1.tpcNSigmaPi()); + histos.fill(HIST("QA/Nsigma_TOF"), trk1.pt(), trk1.tofNSigmaPi()); + histos.fill(HIST("QA/TPC_TOF"), trk1.tpcNSigmaPi(), trk1.tofNSigmaPi()); + continue; + } + + if (!selTrack(trk1) || !selTrack(trk2)) + continue; + + if (selPion(trk1) && selPion(trk2)) { + part1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPi); + part2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi); + reco = part1 + part2; + + if (reco.Rapidity() > cfgMaxRap || reco.Rapidity() < cfgMinRap) + continue; + + if (trk1.sign() * trk2.sign() < 0) { + histos.fill(HIST("hInvMass_rho770_US"), reco.M(), reco.Pt(), collision.cent()); + histos.fill(HIST("hInvMass_K0s_US"), reco.M(), reco.Pt(), collision.cent()); + + if constexpr (IsMC) { + if (trk1.motherId() != trk2.motherId()) + continue; + if (std::abs(trk1.pdgCode()) == 211 && std::abs(trk2.pdgCode()) == 211) { + if (std::abs(trk1.motherPDG()) == 113) { + histos.fill(HIST("MCL/hpT_rho770_REC"), reco.M(), reco.Pt(), collision.cent()); + } else if (std::abs(trk1.motherPDG()) == 223) { + histos.fill(HIST("MCL/hpT_omega_REC"), reco.M(), reco.Pt(), collision.cent()); + } else if (std::abs(trk1.motherPDG()) == 310) { + histos.fill(HIST("MCL/hpT_K0s_REC"), reco.M(), reco.Pt(), collision.cent()); + histos.fill(HIST("MCL/hpT_K0s_pipi_REC"), reco.M(), reco.Pt(), collision.cent()); + } + } else if ((std::abs(trk1.pdgCode()) == 211 && std::abs(trk2.pdgCode()) == 321) || (std::abs(trk1.pdgCode()) == 321 && std::abs(trk2.pdgCode()) == 211)) { + if (std::abs(trk1.motherPDG()) == 313) + histos.fill(HIST("MCL/hpT_Kstar_REC"), reco.M(), reco.Pt(), collision.cent()); + } + } + } else if (trk1.sign() > 0 && trk2.sign() > 0) { + histos.fill(HIST("hInvMass_rho770_LSpp"), reco.M(), reco.Pt(), collision.cent()); + histos.fill(HIST("hInvMass_K0s_LSpp"), reco.M(), reco.Pt(), collision.cent()); + } else if (trk1.sign() < 0 && trk2.sign() < 0) { + histos.fill(HIST("hInvMass_rho770_LSmm"), reco.M(), reco.Pt(), collision.cent()); + histos.fill(HIST("hInvMass_K0s_LSmm"), reco.M(), reco.Pt(), collision.cent()); + } + } + + if ((selPion(trk1) && selKaon(trk2)) || (selKaon(trk1) && selPion(trk2))) { + if (selPion(trk1)) { + part1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPi); + part2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); + } else if (selPion(trk2)) { + part1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); + part2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi); + } + reco = part1 + part2; + + if (reco.Rapidity() > cfgMaxRap || reco.Rapidity() < cfgMinRap) + continue; + + if (trk1.sign() * trk2.sign() < 0) { + histos.fill(HIST("hInvMass_Kstar_US"), reco.M(), reco.Pt(), collision.cent()); + + if constexpr (IsMC) { + if (trk1.motherId() != trk2.motherId()) + continue; + + if ((std::abs(trk1.pdgCode()) == 211 && std::abs(trk2.pdgCode()) == 321) || (std::abs(trk1.pdgCode()) == 321 && std::abs(trk2.pdgCode()) == 211)) { + if (std::abs(trk1.motherPDG()) == 313) + histos.fill(HIST("MCL/hpT_Kstar_Kpi_REC"), reco.M(), reco.Pt(), collision.cent()); + } + } + } else if (trk1.sign() > 0 && trk2.sign() > 0) { + histos.fill(HIST("hInvMass_Kstar_LSpp"), reco.M(), reco.Pt(), collision.cent()); + } else if (trk1.sign() < 0 && trk2.sign() < 0) { + histos.fill(HIST("hInvMass_Kstar_LSmm"), reco.M(), reco.Pt(), collision.cent()); + } + } + } + } else if (trk1.sign() > 0 && trk2.sign() > 0) { + histos.fill(HIST("hInvMass_rho770_LSpp"), reco.M(), reco.Pt(), collision.cent()); + histos.fill(HIST("hInvMass_K0s_LSpp"), reco.M(), reco.Pt(), collision.cent()); + } else if (trk1.sign() < 0 && trk2.sign() < 0) { + histos.fill(HIST("hInvMass_rho770_LSmm"), reco.M(), reco.Pt(), collision.cent()); + histos.fill(HIST("hInvMass_K0s_LSmm"), reco.M(), reco.Pt(), collision.cent()); + } + } + + if ((selPion(trk1) && selKaon(trk2)) || (selKaon(trk1) && selPion(trk2))) { + if (selPion(trk1)) { + part1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPi); + part2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); + } else if (selPion(trk2)) { + part1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); + part2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi); + } + reco = part1 + part2; + + if (reco.Rapidity() > cfgMaxRap || reco.Rapidity() < cfgMinRap) + continue; + + if (trk1.sign() * trk2.sign() < 0) { + histos.fill(HIST("hInvMass_Kstar_US"), reco.M(), reco.Pt(), collision.cent()); + + if constexpr (IsMC) { + if (trk1.motherId() != trk2.motherId()) + continue; + + if ((std::abs(trk1.pdgCode()) == 211 && std::abs(trk2.pdgCode()) == 321) || (std::abs(trk1.pdgCode()) == 321 && std::abs(trk2.pdgCode()) == 211)) { + if (std::abs(trk1.motherPDG()) == 313) + histos.fill(HIST("MCL/hpT_Kstar_Kpi_REC"), reco.M(), reco.Pt(), collision.cent()); + } + } + } else if (trk1.sign() > 0 && trk2.sign() > 0) { + histos.fill(HIST("hInvMass_Kstar_LSpp"), reco.M(), reco.Pt(), collision.cent()); + } else if (trk1.sign() < 0 && trk2.sign() < 0) { + histos.fill(HIST("hInvMass_Kstar_LSmm"), reco.M(), reco.Pt(), collision.cent()); + } + } + } + } + + void processData(aod::ResoCollision const& collision, aod::ResoTracks const& resotracks) + { + fillHistograms(collision, resotracks); + } + PROCESS_SWITCH(rho770analysis, processData, "Process Event for data", true); + + void processMCLight(aod::ResoCollision const& collision, soa::Join const& resotracks) + { + fillHistograms(collision, resotracks); + } + PROCESS_SWITCH(rho770analysis, processMCLight, "Process Event for MC", false); + + void processMCTrue(aod::ResoMCParents const& resoParents) + { + for (const auto& part : resoParents) { // loop over all pre-filtered MC particles + if (std::abs(part.pdgCode()) != 113) + continue; + if (!part.producedByGenerator()) + continue; + if (part.y() < cfgMinRap || part.y() > cfgMaxRap) + continue; + bool pass = false; + if ((std::abs(part.daughterPDG1()) == 211 && std::abs(part.daughterPDG2()) == 211)) + pass = true; + if (!pass) // If we have both decay products + continue; + + histos.fill(HIST("MCL/hpT_rho770_GEN"), part.pt()); + } + }; + PROCESS_SWITCH(rho770analysis, processMCTrue, "Process Event for MC", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/Tasks/Strangeness/CMakeLists.txt b/PWGLF/Tasks/Strangeness/CMakeLists.txt index 839b94a14fd..9abdcafb4e3 100644 --- a/PWGLF/Tasks/Strangeness/CMakeLists.txt +++ b/PWGLF/Tasks/Strangeness/CMakeLists.txt @@ -76,7 +76,7 @@ o2physics_add_dpl_workflow(cascpostprocessing o2physics_add_dpl_workflow(hstrangecorrelation SOURCES hStrangeCorrelation.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(sigmaanalysis @@ -85,7 +85,7 @@ o2physics_add_dpl_workflow(sigmaanalysis COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(phik0shortanalysis - SOURCES phik0sanalysis.cxx + SOURCES phik0shortanalysis.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx index f04a66337e6..d6e77a1bdc9 100644 --- a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -79,28 +79,34 @@ struct derivedlambdakzeroanalysis { Configurable analyseAntiLambda{"analyseAntiLambda", true, "process AntiLambda-like candidates"}; Configurable calculateFeeddownMatrix{"calculateFeeddownMatrix", true, "fill feeddown matrix if MC"}; - Configurable requireSel8{"requireSel8", true, "require sel8 event selection"}; - Configurable requireTriggerTVX{"requireTriggerTVX", true, "require FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level"}; - Configurable rejectITSROFBorder{"rejectITSROFBorder", true, "reject events at ITS ROF border"}; - Configurable rejectTFBorder{"rejectTFBorder", true, "reject events at TF border"}; - Configurable requireIsVertexITSTPC{"requireIsVertexITSTPC", false, "require events with at least one ITS-TPC track"}; - Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference"}; - Configurable requireIsVertexTOFmatched{"requireIsVertexTOFmatched", false, "require events with at least one of vertex contributors matched to TOF"}; - Configurable requireIsVertexTRDmatched{"requireIsVertexTRDmatched", false, "require events with at least one of vertex contributors matched to TRD"}; - Configurable rejectSameBunchPileup{"rejectSameBunchPileup", true, "reject collisions in case of pileup with another collision in the same foundBC"}; - Configurable requireNoCollInTimeRangeStd{"requireNoCollInTimeRangeStd", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 2 microseconds or mult above a certain threshold in -4 - -2 microseconds"}; - Configurable requireNoCollInTimeRangeStrict{"requireNoCollInTimeRangeStrict", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 10 microseconds"}; - Configurable requireNoCollInTimeRangeNarrow{"requireNoCollInTimeRangeNarrow", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 2 microseconds"}; - Configurable requireNoCollInTimeRangeVzDep{"requireNoCollInTimeRangeVzDep", false, "reject collisions corrupted by the cannibalism, with other collisions with pvZ of drifting TPC tracks from past/future collisions within 2.5 cm the current pvZ"}; - Configurable requireNoCollInROFStd{"requireNoCollInROFStd", false, "reject collisions corrupted by the cannibalism, with other collisions within the same ITS ROF with mult. above a certain threshold"}; - Configurable requireNoCollInROFStrict{"requireNoCollInROFStrict", false, "reject collisions corrupted by the cannibalism, with other collisions within the same ITS ROF"}; - - Configurable maxZVtxPosition{"maxZVtxPosition", 10., "max Z vtx position"}; - - Configurable useFT0CbasedOccupancy{"useFT0CbasedOccupancy", false, "Use sum of FT0-C amplitudes for estimating occupancy? (if not, use track-based definition)"}; - // fast check on occupancy - Configurable minOccupancy{"minOccupancy", -1, "minimum occupancy from neighbouring collisions"}; - Configurable maxOccupancy{"maxOccupancy", -1, "maximum occupancy from neighbouring collisions"}; + Configurable doPPAnalysis{"doPPAnalysis", false, "if in pp, set to true"}; + + struct : ConfigurableGroup { + Configurable requireSel8{"requireSel8", true, "require sel8 event selection"}; + Configurable requireTriggerTVX{"requireTriggerTVX", true, "require FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level"}; + Configurable rejectITSROFBorder{"rejectITSROFBorder", true, "reject events at ITS ROF border"}; + Configurable rejectTFBorder{"rejectTFBorder", true, "reject events at TF border"}; + Configurable requireIsVertexITSTPC{"requireIsVertexITSTPC", false, "require events with at least one ITS-TPC track"}; + Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference"}; + Configurable requireIsVertexTOFmatched{"requireIsVertexTOFmatched", false, "require events with at least one of vertex contributors matched to TOF"}; + Configurable requireIsVertexTRDmatched{"requireIsVertexTRDmatched", false, "require events with at least one of vertex contributors matched to TRD"}; + Configurable rejectSameBunchPileup{"rejectSameBunchPileup", true, "reject collisions in case of pileup with another collision in the same foundBC"}; + Configurable requireNoCollInTimeRangeStd{"requireNoCollInTimeRangeStd", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 2 microseconds or mult above a certain threshold in -4 - -2 microseconds"}; + Configurable requireNoCollInTimeRangeStrict{"requireNoCollInTimeRangeStrict", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 10 microseconds"}; + Configurable requireNoCollInTimeRangeNarrow{"requireNoCollInTimeRangeNarrow", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 2 microseconds"}; + Configurable requireNoCollInTimeRangeVzDep{"requireNoCollInTimeRangeVzDep", false, "reject collisions corrupted by the cannibalism, with other collisions with pvZ of drifting TPC tracks from past/future collisions within 2.5 cm the current pvZ"}; + Configurable requireNoCollInROFStd{"requireNoCollInROFStd", false, "reject collisions corrupted by the cannibalism, with other collisions within the same ITS ROF with mult. above a certain threshold"}; + Configurable requireNoCollInROFStrict{"requireNoCollInROFStrict", false, "reject collisions corrupted by the cannibalism, with other collisions within the same ITS ROF"}; + Configurable requireINEL0{"requireINEL0", true, "require INEL>0 event selection"}; + Configurable requireINEL1{"requireINEL1", false, "require INEL>1 event selection"}; + + Configurable maxZVtxPosition{"maxZVtxPosition", 10., "max Z vtx position"}; + + Configurable useFT0CbasedOccupancy{"useFT0CbasedOccupancy", false, "Use sum of FT0-C amplitudes for estimating occupancy? (if not, use track-based definition)"}; + // fast check on occupancy + Configurable minOccupancy{"minOccupancy", -1, "minimum occupancy from neighbouring collisions"}; + Configurable maxOccupancy{"maxOccupancy", -1, "maximum occupancy from neighbouring collisions"}; + } eventSelections; struct : ConfigurableGroup { Configurable v0TypeSelection{"v0TypeSelection", 1, "select on a certain V0 type (leave negative if no selection desired)"}; @@ -411,12 +417,24 @@ struct derivedlambdakzeroanalysis { histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(15, "kNoCollInTimeRangeVzDep"); histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(16, "kNoCollInRofStd"); histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(17, "kNoCollInRofStrict"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(18, "Below min occup."); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(19, "Above max occup."); + if (doPPAnalysis) { + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(18, "INEL>0"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(19, "INEL>1"); + } else { + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(18, "Below min occup."); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(19, "Above max occup."); + } histos.add("hEventCentrality", "hEventCentrality", kTH1F, {{100, 0.0f, +100.0f}}); histos.add("hCentralityVsNch", "hCentralityVsNch", kTH2F, {axisCentrality, axisNch}); + histos.add("hEventPVz", "hEventPVz", kTH1F, {{100, -20.0f, +20.0f}}); + histos.add("hCentralityVsPVz", "hCentralityVsPVz", kTH2F, {axisCentrality, {100, -20.0f, +20.0f}}); + if (doprocessGenerated) { + histos.add("hEventPVzMC", "hEventPVzMC", kTH1F, {{100, -20.0f, +20.0f}}); + histos.add("hCentralityVsPVzMC", "hCentralityVsPVzMC", kTH2F, {axisCentrality, {100, -20.0f, +20.0f}}); + } + histos.add("hEventOccupancy", "hEventOccupancy", kTH1F, {axisOccupancy}); histos.add("hCentralityVsOccupancy", "hCentralityVsOccupancy", kTH2F, {axisCentrality, axisOccupancy}); @@ -1438,114 +1456,129 @@ struct derivedlambdakzeroanalysis { if (fillHists) histos.fill(HIST("hEventSelection"), 0. /* all collisions */); - if (requireSel8 && !collision.sel8()) { + if (eventSelections.requireSel8 && !collision.sel8()) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 1 /* sel8 collisions */); - if (requireTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + if (eventSelections.requireTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 2 /* FT0 vertex (acceptable FT0C-FT0A time difference) collisions */); - if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + if (eventSelections.rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 3 /* Not at ITS ROF border */); - if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + if (eventSelections.rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 4 /* Not at TF border */); - if (std::abs(collision.posZ()) > maxZVtxPosition) { + if (std::abs(collision.posZ()) > eventSelections.maxZVtxPosition) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 5 /* vertex-Z selected */); - if (requireIsVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + if (eventSelections.requireIsVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 6 /* Contains at least one ITS-TPC track */); - if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + if (eventSelections.requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 7 /* PV position consistency check */); - if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + if (eventSelections.requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 8 /* PV with at least one contributor matched with TOF */); - if (requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { + if (eventSelections.requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 9 /* PV with at least one contributor matched with TRD */); - if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + if (eventSelections.rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 10 /* Not at same bunch pile-up */); - if (requireNoCollInTimeRangeStd && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + if (eventSelections.requireNoCollInTimeRangeStd && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 11 /* No other collision within +/- 2 microseconds or mult above a certain threshold in -4 - -2 microseconds*/); - if (requireNoCollInTimeRangeStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { + if (eventSelections.requireNoCollInTimeRangeStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 12 /* No other collision within +/- 10 microseconds */); - if (requireNoCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { + if (eventSelections.requireNoCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 13 /* No other collision within +/- 2 microseconds */); - if (requireNoCollInTimeRangeVzDep && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeVzDependent)) { + if (eventSelections.requireNoCollInTimeRangeVzDep && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeVzDependent)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 14 /* No other collision with pvZ of drifting TPC tracks from past/future collisions within 2.5 cm the current pvZ */); - if (requireNoCollInROFStd && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + if (eventSelections.requireNoCollInROFStd && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 15 /* No other collision within the same ITS ROF with mult. above a certain threshold */); - if (requireNoCollInROFStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { + if (eventSelections.requireNoCollInROFStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 16 /* No other collision within the same ITS ROF */); - float collisionOccupancy = useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); - if (minOccupancy >= 0 && collisionOccupancy < minOccupancy) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 17 /* Below min occupancy */); + if (doPPAnalysis) { // we are in pp + if (eventSelections.requireINEL0 && collision.multNTracksPVeta1() < 1) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 17 /* INEL > 0 */); - if (maxOccupancy >= 0 && collisionOccupancy > maxOccupancy) { - return false; + if (eventSelections.requireINEL1 && collision.multNTracksPVeta1() < 2) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 18 /* INEL > 1 */); + + } else { // we are in Pb-Pb + float collisionOccupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + if (eventSelections.minOccupancy >= 0 && collisionOccupancy < eventSelections.minOccupancy) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 17 /* Below min occupancy */); + + if (eventSelections.maxOccupancy >= 0 && collisionOccupancy > eventSelections.maxOccupancy) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 18 /* Above max occupancy */); } - if (fillHists) - histos.fill(HIST("hEventSelection"), 18 /* Above max occupancy */); return true; } @@ -1597,7 +1630,7 @@ struct derivedlambdakzeroanalysis { if (biggestNContribs < collision.multPVTotalContributors()) { biggestNContribs = collision.multPVTotalContributors(); - centrality = collision.centFT0C(); + centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); } nCollisions++; @@ -1608,6 +1641,8 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("hCentralityVsNcoll_afterEvSel"), centrality, nCollisions); histos.fill(HIST("hCentralityVsMultMC"), centrality, mcCollision.multMCNParticlesEta05()); + histos.fill(HIST("hCentralityVsPVzMC"), centrality, mcCollision.posZ()); + histos.fill(HIST("hEventPVzMC"), mcCollision.posZ()); if (atLeastOne) { histos.fill(HIST("hGenEvents"), mcCollision.multMCNParticlesEta05(), 1 /* at least 1 rec. event*/); @@ -1633,12 +1668,12 @@ struct derivedlambdakzeroanalysis { return; } - float centrality = collision.centFT0C(); + float centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); if (qaCentrality) { auto hRawCentrality = histos.get(HIST("hRawCentrality")); - centrality = hRawCentrality->GetBinContent(hRawCentrality->FindBin(collision.multFT0C())); + centrality = hRawCentrality->GetBinContent(hRawCentrality->FindBin(doPPAnalysis ? collision.multFT0A() + collision.multFT0C() : collision.multFT0C())); } - float collisionOccupancy = useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + float collisionOccupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); // gap side int gapSide = collision.gapSide(); @@ -1656,6 +1691,9 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("hCentralityVsNch"), centrality, collision.multNTracksPVeta1()); + histos.fill(HIST("hCentralityVsPVz"), centrality, collision.posZ()); + histos.fill(HIST("hEventPVz"), collision.posZ()); + histos.fill(HIST("hEventOccupancy"), collisionOccupancy); histos.fill(HIST("hCentralityVsOccupancy"), centrality, collisionOccupancy); @@ -1710,12 +1748,12 @@ struct derivedlambdakzeroanalysis { return; } - float centrality = collision.centFT0C(); + float centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); if (qaCentrality) { auto hRawCentrality = histos.get(HIST("hRawCentrality")); - centrality = hRawCentrality->GetBinContent(hRawCentrality->FindBin(collision.multFT0C())); + centrality = hRawCentrality->GetBinContent(hRawCentrality->FindBin(doPPAnalysis ? collision.multFT0A() + collision.multFT0C() : collision.multFT0C())); } - float collisionOccupancy = useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + float collisionOccupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); // gap side int gapSide = collision.gapSide(); @@ -1733,6 +1771,9 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("hCentralityVsNch"), centrality, collision.multNTracksPVeta1()); + histos.fill(HIST("hCentralityVsPVz"), centrality, collision.posZ()); + histos.fill(HIST("hEventPVz"), collision.posZ()); + histos.fill(HIST("hEventOccupancy"), collisionOccupancy); histos.fill(HIST("hCentralityVsOccupancy"), centrality, collisionOccupancy); @@ -1745,6 +1786,9 @@ struct derivedlambdakzeroanalysis { if (std::abs(v0.negativeeta()) > v0Selections.daughterEtaCut || std::abs(v0.positiveeta()) > v0Selections.daughterEtaCut) continue; // remove acceptance that's badly reproduced by MC / superfluous in future + if (v0.v0Type() != v0Selections.v0TypeSelection && v0Selections.v0TypeSelection > -1) + continue; // skip V0s that are not standard + if (!v0.has_v0MCCore()) continue; @@ -1825,16 +1869,26 @@ struct derivedlambdakzeroanalysis { continue; auto mcCollision = v0MC.straMCCollision_as>(); + if (doPPAnalysis) { // we are in pp + if (eventSelections.requireINEL0 && mcCollision.multMCNParticlesEta10() < 1) { + continue; + } + + if (eventSelections.requireINEL1 && mcCollision.multMCNParticlesEta10() < 2) { + continue; + } + } + float centrality = 100.5f; if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); - centrality = collision.centFT0C(); - float collisionOccupancy = useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + float collisionOccupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); - if (minOccupancy >= 0 && collisionOccupancy < minOccupancy) { + if (eventSelections.minOccupancy >= 0 && collisionOccupancy < eventSelections.minOccupancy) { continue; } - if (maxOccupancy >= 0 && collisionOccupancy > maxOccupancy) { + if (eventSelections.maxOccupancy >= 0 && collisionOccupancy > eventSelections.maxOccupancy) { continue; } @@ -1881,16 +1935,26 @@ struct derivedlambdakzeroanalysis { continue; auto mcCollision = cascMC.straMCCollision_as>(); + if (doPPAnalysis) { // we are in pp + if (eventSelections.requireINEL0 && mcCollision.multMCNParticlesEta10() < 1) { + continue; + } + + if (eventSelections.requireINEL1 && mcCollision.multMCNParticlesEta10() < 2) { + continue; + } + } + float centrality = 100.5f; if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); - centrality = collision.centFT0C(); - float collisionOccupancy = useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + float collisionOccupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); - if (minOccupancy >= 0 && collisionOccupancy < minOccupancy) { + if (eventSelections.minOccupancy >= 0 && collisionOccupancy < eventSelections.minOccupancy) { continue; } - if (maxOccupancy >= 0 && collisionOccupancy > maxOccupancy) { + if (eventSelections.maxOccupancy >= 0 && collisionOccupancy > eventSelections.maxOccupancy) { continue; } diff --git a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx index f43dc16f02f..0126854b3b5 100644 --- a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx @@ -36,6 +36,9 @@ #include "Framework/StaticFor.h" #include "CCDB/BasicCCDBManager.h" +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" + using namespace o2; using namespace o2::constants::math; using namespace o2::framework; @@ -56,6 +59,12 @@ struct correlateStrangeness { HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + // event filtering + Configurable zorroMask{"zorroMask", "", "zorro trigger class to select on (empty: none)"}; + + Zorro zorro; + OutputObj zorroSummary{"zorroSummary"}; + Configurable doCorrelationHadron{"doCorrelationHadron", false, "do Hadron correlation"}; Configurable doCorrelationK0Short{"doCorrelationK0Short", true, "do K0Short correlation"}; Configurable doCorrelationLambda{"doCorrelationLambda", false, "do Lambda correlation"}; @@ -173,6 +182,7 @@ struct correlateStrangeness { uint16_t doCorrelation; int mRunNumber; + int mRunNumberZorro; std::vector> axisRanges; @@ -191,6 +201,20 @@ struct correlateStrangeness { return deltaPhi; } + /// Function to load zorro + /// \param bc provided such that the run number + timestamp can be used + void initZorro(aod::BCsWithTimestamps::iterator const& bc) + { + if (mRunNumberZorro == bc.runNumber()) { + return; + } + + zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), zorroMask.value); + zorro.populateHistRegistry(histos, bc.runNumber()); + + mRunNumberZorro = bc.runNumber(); + } + /// Function to load efficiencies to memory from CCDB /// \param bc provided such that the run number can be used void initEfficiencyFromCCDB(aod::BCsWithTimestamps::iterator const& bc) @@ -509,7 +533,9 @@ struct correlateStrangeness { void init(InitContext const&) { + zorroSummary.setObject(zorro.getZorroSummary()); mRunNumber = 0; + mRunNumberZorro = 0; hEfficiencyPion = 0x0; hEfficiencyK0Short = 0x0; hEfficiencyLambda = 0x0; @@ -795,6 +821,35 @@ struct correlateStrangeness { } } + // this function allows for all event selections to be done in a modular way + template + bool isCollisionSelected(TCollision const& collision) + { + // ________________________________________________ + // Perform basic event selection + if (!collision.sel8()) { + return false; + } + if (TMath::Abs(collision.posZ()) > zVertexCut) { + return false; + } + if (collision.centFT0M() > axisRanges[5][1] || collision.centFT0M() < axisRanges[5][0]) { + return false; + } + if (!collision.isInelGt0() && selectINELgtZERO) { + return false; + } + if (zorroMask.value != "") { + auto bc = collision.template bc_as(); + initZorro(bc); + bool zorroSelected = zorro.isSelected(collision.template bc_as().globalBC()); /// Just let Zorro do the accounting + if (!zorroSelected) { + return false; + } + } + return true; + } + // if this process function is enabled, it will be such that only events with trigger particles within a given // trigger pt bin are taken for the entire processing. This allows for the calculation of e.g. efficiencies // within an event class that has a trigger (which may differ with respect to other cases, to be checked) @@ -812,16 +867,7 @@ struct correlateStrangeness { for (auto const& collision : collisions) { // ________________________________________________ // Perform basic event selection - if (!collision.sel8()) { - continue; - } - if (TMath::Abs(collision.posZ()) > zVertexCut) { - continue; - } - if (collision.centFT0M() > axisRanges[5][1] || collision.centFT0M() < axisRanges[5][0]) { - continue; - } - if (!collision.isInelGt0() && selectINELgtZERO) { + if (!isCollisionSelected(collision)) { continue; } @@ -851,16 +897,7 @@ struct correlateStrangeness { // ________________________________________________ // Perform basic event selection - if (!collision.sel8()) { - return; - } - if (TMath::Abs(collision.posZ()) > zVertexCut) { - return; - } - if (collision.centFT0M() > axisRanges[5][1] || collision.centFT0M() < axisRanges[5][0]) { - return; - } - if (!collision.isInelGt0() && selectINELgtZERO) { + if (!isCollisionSelected(collision)) { return; } // ________________________________________________ @@ -906,16 +943,7 @@ struct correlateStrangeness { // ________________________________________________ // Perform basic event selection - if (!collision.sel8()) { - return; - } - if (TMath::Abs(collision.posZ()) > zVertexCut) { - return; - } - if (collision.centFT0M() > axisRanges[5][1] || collision.centFT0M() < axisRanges[5][0]) { - return; - } - if (!collision.isInelGt0() && selectINELgtZERO) { + if (!isCollisionSelected(collision)) { return; } // ________________________________________________ @@ -1004,16 +1032,7 @@ struct correlateStrangeness { // ________________________________________________ // Perform basic event selection - if (!collision.sel8()) { - return; - } - if (TMath::Abs(collision.posZ()) > zVertexCut) { - return; - } - if (collision.centFT0M() > axisRanges[5][1] || collision.centFT0M() < axisRanges[5][0]) { - return; - } - if (!collision.isInelGt0() && selectINELgtZERO) { + if (!isCollisionSelected(collision)) { return; } // ________________________________________________ @@ -1105,16 +1124,7 @@ struct correlateStrangeness { // ________________________________________________ // Perform basic event selection - if (!collision.sel8()) { - return; - } - if (TMath::Abs(collision.posZ()) > zVertexCut) { - return; - } - if (collision.centFT0M() > axisRanges[5][1] || collision.centFT0M() < axisRanges[5][0]) { - return; - } - if (!collision.isInelGt0() && selectINELgtZERO) { + if (!isCollisionSelected(collision)) { return; } // ________________________________________________ @@ -1161,16 +1171,13 @@ struct correlateStrangeness { // ________________________________________________ // Perform basic event selection on both collisions - if (!collision1.sel8() || !collision2.sel8()) - continue; - if (TMath::Abs(collision1.posZ()) > zVertexCut || TMath::Abs(collision2.posZ()) > zVertexCut) + if (!isCollisionSelected(collision1) || !isCollisionSelected(collision2)) { continue; + } if (collision1.centFT0M() > axisRanges[5][1] || collision1.centFT0M() < axisRanges[5][0]) continue; if (collision2.centFT0M() > axisRanges[5][1] || collision2.centFT0M() < axisRanges[5][0]) continue; - if ((!collision1.isInelGt0() || !collision2.isInelGt0()) && selectINELgtZERO) - continue; if (collision1.globalIndex() == collision2.globalIndex()) { histos.fill(HIST("MixingQA/hMixingQA"), 0.0f); // same-collision pair counting @@ -1202,20 +1209,17 @@ struct correlateStrangeness { // ________________________________________________ // skip if desired trigger not found if (triggerPresenceMap.size() > 0 && (!bitcheck(triggerPresenceMap[collision1.globalIndex()], triggerBinToSelect) || !bitcheck(triggerPresenceMap[collision2.globalIndex()], triggerBinToSelect))) { - return; + continue; } // Perform basic event selection on both collisions - if (!collision1.sel8() || !collision2.sel8()) - continue; - if (TMath::Abs(collision1.posZ()) > zVertexCut || TMath::Abs(collision2.posZ()) > zVertexCut) + if (!isCollisionSelected(collision1) || !isCollisionSelected(collision2)) { continue; + } if (collision1.centFT0M() > axisRanges[5][1] || collision1.centFT0M() < axisRanges[5][0]) continue; if (collision2.centFT0M() > axisRanges[5][1] || collision2.centFT0M() < axisRanges[5][0]) continue; - if ((!collision1.isInelGt0() || !collision2.isInelGt0()) && selectINELgtZERO) - continue; if (!doprocessMixedEventHCascades) { if (collision1.globalIndex() == collision2.globalIndex()) { @@ -1247,20 +1251,17 @@ struct correlateStrangeness { // ________________________________________________ // skip if desired trigger not found if (triggerPresenceMap.size() > 0 && (!bitcheck(triggerPresenceMap[collision1.globalIndex()], triggerBinToSelect) || !bitcheck(triggerPresenceMap[collision2.globalIndex()], triggerBinToSelect))) { - return; + continue; } // Perform basic event selection on both collisions - if (!collision1.sel8() || !collision2.sel8()) - continue; - if (TMath::Abs(collision1.posZ()) > zVertexCut || TMath::Abs(collision2.posZ()) > zVertexCut) + if (!isCollisionSelected(collision1) || !isCollisionSelected(collision2)) { continue; + } if (collision1.centFT0M() > axisRanges[5][1] || collision1.centFT0M() < axisRanges[5][0]) continue; if (collision2.centFT0M() > axisRanges[5][1] || collision2.centFT0M() < axisRanges[5][0]) continue; - if ((!collision1.isInelGt0() || !collision2.isInelGt0()) && selectINELgtZERO) - continue; if (collision1.globalIndex() == collision2.globalIndex()) { histos.fill(HIST("MixingQA/hMixingQA"), 0.0f); // same-collision pair counting @@ -1287,21 +1288,18 @@ struct correlateStrangeness { // ________________________________________________ // skip if desired trigger not found if (triggerPresenceMap.size() > 0 && (!bitcheck(triggerPresenceMap[collision1.globalIndex()], triggerBinToSelect) || !bitcheck(triggerPresenceMap[collision2.globalIndex()], triggerBinToSelect))) { - return; + continue; } // ________________________________________________ // Perform basic event selection on both collisions - if (!collision1.sel8() || !collision2.sel8()) - continue; - if (TMath::Abs(collision1.posZ()) > zVertexCut || TMath::Abs(collision2.posZ()) > zVertexCut) + if (!isCollisionSelected(collision1) || !isCollisionSelected(collision2)) { continue; + } if (collision1.centFT0M() > axisRanges[5][1] || collision1.centFT0M() < axisRanges[5][0]) continue; if (collision2.centFT0M() > axisRanges[5][1] || collision2.centFT0M() < axisRanges[5][0]) continue; - if ((!collision1.isInelGt0() || !collision2.isInelGt0()) && selectINELgtZERO) - continue; if (collision1.globalIndex() == collision2.globalIndex()) { histos.fill(HIST("MixingQA/hMixingQA"), 0.0f); // same-collision pair counting diff --git a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx index 9cc2bd3462e..0c43956bc71 100644 --- a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx +++ b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx @@ -250,17 +250,21 @@ struct NonPromptCascadeTask { return; } mRunNumber = bc.runNumber(); - auto timestamp = bc.timestamp(); - if (o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp(cfgGRPpath, timestamp)) { + if (o2::parameters::GRPObject* grpo = ccdb->getForRun(cfgGRPpath, mRunNumber)) { o2::base::Propagator::initFieldFromGRP(grpo); bz = grpo->getNominalL3Field(); - } else if (o2::parameters::GRPMagField* grpmag = ccdb->getForTimeStamp(cfgGRPmagPath, timestamp)) { + } else if (o2::parameters::GRPMagField* grpmag = ccdb->getForRun(cfgGRPmagPath, mRunNumber)) { o2::base::Propagator::initFieldFromGRP(grpmag); bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); LOG(debug) << "bz = " << bz; } else { - LOG(fatal) << "Got nullptr from CCDB for path " << cfgGRPmagPath << " of object GRPMagField and " << cfgGRPpath << " of object GRPObject for timestamp " << timestamp; + LOG(fatal) << "Got nullptr from CCDB for path " << cfgGRPmagPath << " of object GRPMagField and " << cfgGRPpath << " of object GRPObject for run " << mRunNumber; + } + + if (static_cast(cfgMaterialCorrection.value) == o2::base::Propagator::MatCorrType::USEMatCorrLUT) { + auto* lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->getForRun("GLO/Param/MatLUT", mRunNumber)); + o2::base::Propagator::Instance(true)->setMatLUT(lut); } } @@ -271,11 +275,6 @@ struct NonPromptCascadeTask { ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); - if (static_cast(cfgMaterialCorrection.value) == o2::base::Propagator::MatCorrType::USEMatCorrLUT) { - auto* lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get("GLO/Param/MatLUT")); - o2::base::Propagator::Instance(true)->setMatLUT(lut); - } - std::vector ptBinning = {0.4, 0.8, 1.2, 1.6, 2.0, 2.4, 2.8, 3.2, 3.6, 4.0, 4.4, 4.8, 5.2, 5.6, 6.0}; AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; diff --git a/PWGLF/Tasks/Strangeness/phik0sanalysis.cxx b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx similarity index 58% rename from PWGLF/Tasks/Strangeness/phik0sanalysis.cxx rename to PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx index 02c5a6970e1..9fc76115b6a 100644 --- a/PWGLF/Tasks/Strangeness/phik0sanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. /// -/// \file phik0sanalysis.cxx +/// \file phik0shortanalysis.cxx /// \brief Analysis task for the Phi and K0S rapidity correlations analysis /// \author Stefano Cannito (stefano.cannito@cern.ch) @@ -53,26 +53,26 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -struct phik0shortanalysis { +struct Phik0shortanalysis { // Histograms are defined with HistogramRegistry - HistogramRegistry eventHist{"eventHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry MCeventHist{"MCeventHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry PhicandHist{"PhicandHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry K0SHist{"K0SHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry PhipurHist{"PhipurHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry PhiK0SHist{"PhiK0SHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry MCPhiK0SHist{"MCPhiK0SHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry PhiPionHist{"PhiPionHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry MCPhiPionHist{"MCPhiPionHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry PhieffHist{"PhieffHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry K0SeffHist{"K0SeffHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry PioneffHist{"PioneffHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry closureMCPhipurHist{"closureMCPhipurHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry dataEventHist{"dataEventHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry mcEventHist{"mcEventHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry candPhiHist{"candPhiHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry candK0SHist{"candK0SHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry dataPhiHist{"dataPhiHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry dataPhiK0SHist{"dataPhiK0SHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry mcPhiK0SHist{"mcPhiK0SHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry dataPhiPionHist{"dataPhiPionHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry mcPhiPionHist{"mcPhiPionHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry mcPhiHist{"mcPhiHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry mcK0SHist{"mcK0SHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry mcPionHist{"mcPionHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry closureMCPhiHist{"closureMCPhiHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry closureMCPhiK0SHist{"closureMCPhiK0SHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry closureMCPhiPionHist{"closureMCPhiPionHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; // Configurable for event selection - Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; + Configurable cutZVertex{"cutZVertex", 10.0f, "Accepted z-vertex range (cm)"}; // Configurable on multiplicity bins Configurable> binsMult{"binsMult", {0.0, 1.0, 5.0, 10.0, 15.0, 20.0, 30.0, 40.0, 50.0, 70.0, 100.0}, "Multiplicity bin limits"}; @@ -83,24 +83,24 @@ struct phik0shortanalysis { Configurable maxChi2TPC{"maxChi2TPC", 4.0f, "max chi2 per cluster TPC"}; Configurable etaMax{"etaMax", 0.8f, "eta max"}; - Configurable v0setting_cospa{"v0setting_cospa", 0.98, "V0 CosPA"}; - Configurable v0setting_radius{"v0setting_radius", 0.5, "v0radius"}; - Configurable v0setting_dcav0dau{"v0setting_dcav0dau", 1, "DCA V0 Daughters"}; - Configurable v0setting_dcapostopv{"v0setting_dcapostopv", 0.06, "DCA Pos To PV"}; - Configurable v0setting_dcanegtopv{"v0setting_dcanegtopv", 0.06, "DCA Neg To PV"}; - Configurable NSigmaTPCPion{"NSigmaTPCPion", 4.0, "NSigmaTPCPion"}; + Configurable v0SettingCosPA{"v0SettingCosPA", 0.98, "V0 CosPA"}; + Configurable v0SettingRadius{"v0SettingRadius", 0.5, "v0radius"}; + Configurable v0SettingDCAV0Dau{"v0SettingDCAV0Dau", 1, "DCA V0 Daughters"}; + Configurable v0SettingDCAPosToPV{"v0SettingDCAPosToPV", 0.06, "DCA Pos To PV"}; + Configurable v0SettingDCANegToPV{"v0SettingDCANegToPV", 0.06, "DCA Neg To PV"}; + Configurable nSigmaCutTPCPion{"nSigmaCutTPCPion", 4.0, "Value of the TPC Nsigma cut for Pions"}; // Configurables on K0S mass - Configurable lowmK0S{"lowmK0S", 0.48, "Lower limit on K0Short mass"}; - Configurable upmK0S{"upmK0S", 0.52, "Upper limit on K0Short mass"}; + Configurable lowMK0S{"lowMK0S", 0.48, "Lower limit on K0Short mass"}; + Configurable upMK0S{"upMK0S", 0.52, "Upper limit on K0Short mass"}; // Configurable on K0S pT bins Configurable> binspTK0S{"binspTK0S", {0.0, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0}, "pT bin limits for K0S"}; // Configurables on Phi mass - Configurable nBinsmPhi{"nBinsmPhi", 13, "N bins in cfgPhimassaxis"}; - Configurable lowmPhi{"lowmPhiMB", 1.0095, "Upper limits on Phi mass for signal extraction"}; - Configurable upmPhi{"upmPhiMB", 1.029, "Upper limits on Phi mass for signal extraction"}; + Configurable nBinsMPhi{"nBinsMPhi", 13, "N bins in cfgmassPhiaxis"}; + Configurable lowMPhi{"lowMPhi", 1.0095, "Upper limits on Phi mass for signal extraction"}; + Configurable upMPhi{"upMPhi", 1.029, "Upper limits on Phi mass for signal extraction"}; // Configurables for phi selection Configurable cfgCutCharge{"cfgCutCharge", 0.0, "Cut on charge"}; @@ -114,25 +114,24 @@ struct phik0shortanalysis { Configurable cMaxDCArToPV3{"cMaxDCArToPV3", 1.0f, "Track DCAr cut to PV config 3"}; Configurable isNoTOF{"isNoTOF", false, "isNoTOF"}; - Configurable nsigmaCutTPCKa{"nsigmacutTPC", 3.0, "Value of the TPC Nsigma cut"}; - Configurable nsigmaCutCombinedKa{"nsigmaCutCombined", 3.0, "Value of the TOF Nsigma cut"}; + Configurable nSigmaCutTPCKa{"nSigmaCutTPCKa", 3.0, "Value of the TPC Nsigma cut for Kaons"}; + Configurable nSigmaCutCombinedKa{"nSigmaCutCombinedKa", 3.0, "Value of the TOF Nsigma cut for Kaons"}; // Configurables for pions selection(extra with respect to a few of those defined for V0) Configurable minITSnCls{"minITSnCls", 4, "min number of ITS clusters"}; Configurable maxChi2ITS{"maxChi2ITS", 36.0f, "max chi2 per cluster ITS"}; Configurable dcaxyMax{"dcaxyMax", 0.1f, "Maximum DCAxy to primary vertex"}; Configurable dcazMax{"dcazMax", 0.1f, "Maximum DCAz to primary vertex"}; - Configurable NSigmaTOFPion{"NSigmaTOFPion", 5.0, "NSigmaTOFPion"}; // Configurable on pion pT bins Configurable> binspTPi{"binspTPi", {0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.5, 2.0, 3.0}, "pT bin limits for pions"}; // Configurables for delta y selection Configurable nBinsy{"nBinsy", 80, "Number of bins in y and deltay axis"}; - Configurable cfgyAcceptance{"cfgyAcceptance", 0.5f, "Rapidity acceptance"}; - Configurable cfgFirstCutonDeltay{"cgfFirstCutonDeltay", 0.5f, "First upper bound on Deltay selection"}; - Configurable cfgSecondCutonDeltay{"cgfSecondCutonDeltay", 0.1f, "Second upper bound on Deltay selection"}; - Configurable cfgyAcceptanceSmear{"cfgyAcceptanceSmear", 0.8f, "Rapidity acceptance for smearing matrix study"}; + Configurable cfgYAcceptance{"cfgYAcceptance", 0.5f, "Rapidity acceptance"}; + Configurable cfgFCutOnDeltaY{"cfgFCutOnDeltaY", 0.5f, "First upper bound on Deltay selection"}; + Configurable cfgSCutOnDeltaY{"cfgSCutOnDeltaY", 0.1f, "Second upper bound on Deltay selection"}; + Configurable cfgYAcceptanceSmear{"cfgYAcceptanceSmear", 0.8f, "Rapidity acceptance for smearing matrix study"}; // Configurable for RecMC Configurable cfgiskNoITSROFrameBorder{"cfgiskNoITSROFrameBorder", false, "kNoITSROFrameBorder request on RecMC collisions"}; @@ -144,10 +143,10 @@ struct phik0shortanalysis { // Defining filters for events (event selection) // Processed events will be already fulfilling the event selection requirements Filter eventFilter = (o2::aod::evsel::sel8 == true); - Filter posZFilter = (nabs(o2::aod::collision::posZ) < cutzvertex); + Filter posZFilter = (nabs(o2::aod::collision::posZ) < cutZVertex); // Defining filters on V0s (cannot filter on dynamic columns) - Filter preFilterV0 = (nabs(aod::v0data::dcapostopv) > v0setting_dcapostopv && nabs(aod::v0data::dcanegtopv) > v0setting_dcanegtopv && aod::v0data::dcaV0daughters < v0setting_dcav0dau); + Filter preFilterV0 = (nabs(aod::v0data::dcapostopv) > v0SettingDCAPosToPV && nabs(aod::v0data::dcanegtopv) > v0SettingDCANegToPV && aod::v0data::dcaV0daughters < v0SettingDCAV0Dau); // Defining the type of the collisions for data and MC using SelCollisions = soa::Join; @@ -182,11 +181,11 @@ struct phik0shortanalysis { void init(InitContext&) { // Axes - AxisSpec K0SmassAxis = {200, 0.45f, 0.55f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; - AxisSpec PhimassAxis = {200, 0.9f, 1.2f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; - AxisSpec sigPhimassAxis = {nBinsmPhi, lowmPhi, upmPhi, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; + AxisSpec massK0SAxis = {200, 0.45f, 0.55f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; + AxisSpec massPhiAxis = {200, 0.9f, 1.2f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; + AxisSpec sigmassPhiAxis = {nBinsMPhi, lowMPhi, upMPhi, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; AxisSpec vertexZAxis = {100, -15.f, 15.f, "vrtx_{Z} [cm]"}; - AxisSpec yAxis = {nBinsy, -cfgyAcceptanceSmear, cfgyAcceptanceSmear, "#it{y}"}; + AxisSpec yAxis = {nBinsy, -cfgYAcceptanceSmear, cfgYAcceptanceSmear, "#it{y}"}; AxisSpec deltayAxis = {nBinsy, 0.0f, 1.6f, "|#it{#Deltay}|"}; AxisSpec multAxis = {120, 0.0f, 120.0f, "centFT0M"}; AxisSpec binnedmultAxis{(std::vector)binsMult, "centFT0M"}; @@ -197,175 +196,175 @@ struct phik0shortanalysis { // Histograms // Number of events per selection - eventHist.add("hEventSelection", "hEventSelection", kTH1F, {{5, -0.5f, 4.5f}}); - eventHist.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); - eventHist.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(2, "sel8 cut"); - eventHist.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(3, "posZ cut"); - eventHist.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(4, "INEL>0 cut"); - eventHist.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(5, "With at least a #phi cand"); + dataEventHist.add("hEventSelection", "hEventSelection", kTH1F, {{5, -0.5f, 4.5f}}); + dataEventHist.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); + dataEventHist.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(2, "sel8 cut"); + dataEventHist.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(3, "posZ cut"); + dataEventHist.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(4, "INEL>0 cut"); + dataEventHist.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(5, "With at least a #phi cand"); // Event information - eventHist.add("hVertexZ", "hVertexZ", kTH1F, {vertexZAxis}); - eventHist.add("hMultiplicityPercent", "Multiplicity Percentile", kTH1F, {multAxis}); + dataEventHist.add("hVertexZ", "hVertexZ", kTH1F, {vertexZAxis}); + dataEventHist.add("hMultiplicityPercent", "Multiplicity Percentile", kTH1F, {multAxis}); // Number of MC events per selection for Rec and Gen - MCeventHist.add("hRecMCEventSelection", "hRecMCEventSelection", kTH1F, {{8, -0.5f, 7.5f}}); - MCeventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); - MCeventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(2, "kIsTriggerTVX"); - MCeventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(3, "kNoTimeFrameBorder"); - MCeventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(4, "kNoITSROFrameBorder"); - MCeventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(5, "posZ cut"); - MCeventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(6, "INEL>0 cut"); - MCeventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(7, "With at least a gen coll"); - MCeventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(8, "With at least a #phi"); - - MCeventHist.add("hGenMCEventSelection", "hGenMCEventSelection", kTH1F, {{5, -0.5f, 4.5f}}); - MCeventHist.get(HIST("hGenMCEventSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); - MCeventHist.get(HIST("hGenMCEventSelection"))->GetXaxis()->SetBinLabel(2, "posZ cut"); - MCeventHist.get(HIST("hGenMCEventSelection"))->GetXaxis()->SetBinLabel(3, "INEL>0 cut"); - MCeventHist.get(HIST("hGenMCEventSelection"))->GetXaxis()->SetBinLabel(4, "With at least a #phi"); - MCeventHist.get(HIST("hGenMCEventSelection"))->GetXaxis()->SetBinLabel(5, "With at least a reco coll"); + mcEventHist.add("hRecMCEventSelection", "hRecMCEventSelection", kTH1F, {{8, -0.5f, 7.5f}}); + mcEventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); + mcEventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(2, "kIsTriggerTVX"); + mcEventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(3, "kNoTimeFrameBorder"); + mcEventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(4, "kNoITSROFrameBorder"); + mcEventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(5, "posZ cut"); + mcEventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(6, "INEL>0 cut"); + mcEventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(7, "With at least a gen coll"); + mcEventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(8, "With at least a #phi"); + + mcEventHist.add("hGenMCEventSelection", "hGenMCEventSelection", kTH1F, {{5, -0.5f, 4.5f}}); + mcEventHist.get(HIST("hGenMCEventSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); + mcEventHist.get(HIST("hGenMCEventSelection"))->GetXaxis()->SetBinLabel(2, "posZ cut"); + mcEventHist.get(HIST("hGenMCEventSelection"))->GetXaxis()->SetBinLabel(3, "INEL>0 cut"); + mcEventHist.get(HIST("hGenMCEventSelection"))->GetXaxis()->SetBinLabel(4, "With at least a #phi"); + mcEventHist.get(HIST("hGenMCEventSelection"))->GetXaxis()->SetBinLabel(5, "With at least a reco coll"); // MC Event information for Rec and Gen - MCeventHist.add("hRecMCVertexZ", "hRecMCVertexZ", kTH1F, {vertexZAxis}); - MCeventHist.add("hRecMCMultiplicityPercent", "RecMC Multiplicity Percentile", kTH1F, {multAxis}); - MCeventHist.add("hRecMCGenMultiplicityPercent", "RecMC Gen Multiplicity Percentile", kTH1F, {binnedmultAxis}); + mcEventHist.add("hRecMCVertexZ", "hRecMCVertexZ", kTH1F, {vertexZAxis}); + mcEventHist.add("hRecMCMultiplicityPercent", "RecMC Multiplicity Percentile", kTH1F, {multAxis}); + mcEventHist.add("hRecMCGenMultiplicityPercent", "RecMC Gen Multiplicity Percentile", kTH1F, {binnedmultAxis}); - MCeventHist.add("hGenMCVertexZ", "hGenMCVertexZ", kTH1F, {vertexZAxis}); - MCeventHist.add("hGenMCMultiplicityPercent", "GenMC Multiplicity Percentile", kTH1F, {binnedmultAxis}); + mcEventHist.add("hGenMCVertexZ", "hGenMCVertexZ", kTH1F, {vertexZAxis}); + mcEventHist.add("hGenMCMultiplicityPercent", "GenMC Multiplicity Percentile", kTH1F, {binnedmultAxis}); // Phi tpological/PID cuts - PhicandHist.add("hEta", "Eta distribution", kTH1F, {{200, -1.0f, 1.0f}}); - PhicandHist.add("hDcaxy", "Dcaxy distribution", kTH1F, {{200, -1.0f, 1.0f}}); - PhicandHist.add("hDcaz", "Dcaz distribution", kTH1F, {{200, -1.0f, 1.0f}}); - PhicandHist.add("hNsigmaKaonTPC", "NsigmaKaon TPC distribution", kTH2F, {ptK0SAxis, {100, -10.0f, 10.0f}}); - PhicandHist.add("hNsigmaKaonTOF", "NsigmaKaon TOF distribution", kTH2F, {ptK0SAxis, {100, -10.0f, 10.0f}}); + candPhiHist.add("hEta", "Eta distribution", kTH1F, {{200, -1.0f, 1.0f}}); + candPhiHist.add("hDcaxy", "Dcaxy distribution", kTH1F, {{200, -1.0f, 1.0f}}); + candPhiHist.add("hDcaz", "Dcaz distribution", kTH1F, {{200, -1.0f, 1.0f}}); + candPhiHist.add("hNsigmaKaonTPC", "NsigmaKaon TPC distribution", kTH2F, {ptK0SAxis, {100, -10.0f, 10.0f}}); + candPhiHist.add("hNsigmaKaonTOF", "NsigmaKaon TOF distribution", kTH2F, {ptK0SAxis, {100, -10.0f, 10.0f}}); // K0S topological/PID cuts - K0SHist.add("hDCAV0Daughters", "hDCAV0Daughters", kTH1F, {{55, 0.0f, 2.2f}}); - K0SHist.add("hV0CosPA", "hV0CosPA", kTH1F, {{100, 0.95f, 1.f}}); - K0SHist.add("hNSigmaPosPionFromK0S", "hNSigmaPosPionFromK0Short", kTH2F, {ptK0SAxis, {100, -5.f, 5.f}}); - K0SHist.add("hNSigmaNegPionFromK0S", "hNSigmaNegPionFromK0Short", kTH2F, {ptK0SAxis, {100, -5.f, 5.f}}); + candK0SHist.add("hDCAV0Daughters", "hDCAV0Daughters", kTH1F, {{55, 0.0f, 2.2f}}); + candK0SHist.add("hV0CosPA", "hV0CosPA", kTH1F, {{100, 0.95f, 1.f}}); + candK0SHist.add("hNSigmaPosPionFromK0S", "hNSigmaPosPionFromK0Short", kTH2F, {ptK0SAxis, {100, -5.f, 5.f}}); + candK0SHist.add("hNSigmaNegPionFromK0S", "hNSigmaNegPionFromK0Short", kTH2F, {ptK0SAxis, {100, -5.f, 5.f}}); // Phi invariant mass for computing purities and normalisation - PhipurHist.add("h2PhipurInvMass", "Invariant mass of Phi for Purity (no K0S/Pi)", kTH2F, {binnedmultAxis, PhimassAxis}); + dataPhiHist.add("h2PhipurInvMass", "Invariant mass of Phi for Purity (no K0S/Pi)", kTH2F, {binnedmultAxis, massPhiAxis}); - PhipurHist.add("h3PhipurK0SInvMassInc", "Invariant mass of Phi for Purity (K0S) Inclusive", kTH3F, {binnedmultAxis, binnedptK0SAxis, PhimassAxis}); - PhipurHist.add("h3PhipurK0SInvMassFCut", "Invariant mass of Phi for Purity (K0S) Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, PhimassAxis}); - PhipurHist.add("h3PhipurK0SInvMassSCut", "Invariant mass of Phi for Purity (K0S) Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, PhimassAxis}); + dataPhiHist.add("h3PhipurK0SInvMassInc", "Invariant mass of Phi for Purity (K0S) Inclusive", kTH3F, {binnedmultAxis, binnedptK0SAxis, massPhiAxis}); + dataPhiHist.add("h3PhipurK0SInvMassFCut", "Invariant mass of Phi for Purity (K0S) Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, massPhiAxis}); + dataPhiHist.add("h3PhipurK0SInvMassSCut", "Invariant mass of Phi for Purity (K0S) Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, massPhiAxis}); - PhipurHist.add("h3PhipurPiInvMassInc", "Invariant mass of Phi for Purity (Pi) Inclusive", kTH3F, {binnedmultAxis, binnedptPiAxis, PhimassAxis}); - PhipurHist.add("h3PhipurPiInvMassFCut", "Invariant mass of Phi for Purity (Pi) Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptPiAxis, PhimassAxis}); - PhipurHist.add("h3PhipurPiInvMassSCut", "Invariant mass of Phi for Purity (Pi) Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptPiAxis, PhimassAxis}); + dataPhiHist.add("h3PhipurPiInvMassInc", "Invariant mass of Phi for Purity (Pi) Inclusive", kTH3F, {binnedmultAxis, binnedptPiAxis, massPhiAxis}); + dataPhiHist.add("h3PhipurPiInvMassFCut", "Invariant mass of Phi for Purity (Pi) Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptPiAxis, massPhiAxis}); + dataPhiHist.add("h3PhipurPiInvMassSCut", "Invariant mass of Phi for Purity (Pi) Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptPiAxis, massPhiAxis}); // MCPhi invariant mass for computing purities - closureMCPhipurHist.add("h2MCPhipurInvMass", "Invariant mass of Phi for Purity (no K0S/Pi)", kTH2F, {binnedmultAxis, PhimassAxis}); + closureMCPhiHist.add("h2MCPhipurInvMass", "Invariant mass of Phi for Purity (no K0S/Pi)", kTH2F, {binnedmultAxis, massPhiAxis}); - closureMCPhipurHist.add("h3MCPhipurK0SInvMassInc", "Invariant mass of Phi for Purity (K0S) Inclusive", kTH3F, {binnedmultAxis, binnedptK0SAxis, PhimassAxis}); - closureMCPhipurHist.add("h3MCPhipurK0SInvMassFCut", "Invariant mass of Phi for Purity (K0S) Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, PhimassAxis}); - closureMCPhipurHist.add("h3MCPhipurK0SInvMassSCut", "Invariant mass of Phi for Purity (K0S) Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, PhimassAxis}); + closureMCPhiHist.add("h3MCPhipurK0SInvMassInc", "Invariant mass of Phi for Purity (K0S) Inclusive", kTH3F, {binnedmultAxis, binnedptK0SAxis, massPhiAxis}); + closureMCPhiHist.add("h3MCPhipurK0SInvMassFCut", "Invariant mass of Phi for Purity (K0S) Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, massPhiAxis}); + closureMCPhiHist.add("h3MCPhipurK0SInvMassSCut", "Invariant mass of Phi for Purity (K0S) Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, massPhiAxis}); - closureMCPhipurHist.add("h3MCPhipurPiInvMassInc", "Invariant mass of Phi for Purity (Pi) Inclusive", kTH3F, {binnedmultAxis, binnedptPiAxis, PhimassAxis}); - closureMCPhipurHist.add("h3MCPhipurPiInvMassFCut", "Invariant mass of Phi for Purity (Pi) Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptPiAxis, PhimassAxis}); - closureMCPhipurHist.add("h3MCPhipurPiInvMassSCut", "Invariant mass of Phi for Purity (Pi) Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptPiAxis, PhimassAxis}); + closureMCPhiHist.add("h3MCPhipurPiInvMassInc", "Invariant mass of Phi for Purity (Pi) Inclusive", kTH3F, {binnedmultAxis, binnedptPiAxis, massPhiAxis}); + closureMCPhiHist.add("h3MCPhipurPiInvMassFCut", "Invariant mass of Phi for Purity (Pi) Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptPiAxis, massPhiAxis}); + closureMCPhiHist.add("h3MCPhipurPiInvMassSCut", "Invariant mass of Phi for Purity (Pi) Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptPiAxis, massPhiAxis}); // 2D mass for Phi and K0S for Data - PhiK0SHist.add("h4PhiK0SSEInc", "2D Invariant mass of Phi and K0Short for Same Event Inclusive", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis, sigPhimassAxis}); - PhiK0SHist.add("h4PhiK0SSEFCut", "2D Invariant mass of Phi and K0Short for Same Event Deltay < FirstCut", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis, sigPhimassAxis}); - PhiK0SHist.add("h4PhiK0SSESCut", "2D Invariant mass of Phi and K0Short for Same Event Deltay < SecondCut", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis, sigPhimassAxis}); + dataPhiK0SHist.add("h4PhiK0SSEInc", "2D Invariant mass of Phi and K0Short for Same Event Inclusive", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, massK0SAxis, sigmassPhiAxis}); + dataPhiK0SHist.add("h4PhiK0SSEFCut", "2D Invariant mass of Phi and K0Short for Same Event Deltay < FirstCut", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, massK0SAxis, sigmassPhiAxis}); + dataPhiK0SHist.add("h4PhiK0SSESCut", "2D Invariant mass of Phi and K0Short for Same Event Deltay < SecondCut", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, massK0SAxis, sigmassPhiAxis}); // RecMC K0S coupled to Phi - MCPhiK0SHist.add("h3RecMCPhiK0SSEInc", "2D Invariant mass of Phi and K0Short for RecMC Inclusive", kTH3F, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis}); - MCPhiK0SHist.add("h3RecMCPhiK0SSEFCut", "2D Invariant mass of Phi and K0Short for RecMC Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis}); - MCPhiK0SHist.add("h3RecMCPhiK0SSESCut", "2D Invariant mass of Phi and K0Short for RecMC Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis}); + mcPhiK0SHist.add("h3RecMCPhiK0SSEInc", "2D Invariant mass of Phi and K0Short for RecMC Inclusive", kTH3F, {binnedmultAxis, binnedptK0SAxis, massK0SAxis}); + mcPhiK0SHist.add("h3RecMCPhiK0SSEFCut", "2D Invariant mass of Phi and K0Short for RecMC Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, massK0SAxis}); + mcPhiK0SHist.add("h3RecMCPhiK0SSESCut", "2D Invariant mass of Phi and K0Short for RecMC Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, massK0SAxis}); // GenMC K0S coupled to Phi - MCPhiK0SHist.add("h2PhiK0SGenMCInc", "K0Short coupled to Phi for GenMC Inclusive", kTH2F, {binnedmultAxis, binnedptK0SAxis}); - MCPhiK0SHist.add("h2PhiK0SGenMCFCut", "K0Short coupled to Phi for GenMC Deltay < FirstCut", kTH2F, {binnedmultAxis, binnedptK0SAxis}); - MCPhiK0SHist.add("h2PhiK0SGenMCSCut", "K0Short coupled to Phi for GenMC Deltay < SecondCut", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + mcPhiK0SHist.add("h2PhiK0SGenMCInc", "K0Short coupled to Phi for GenMC Inclusive", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + mcPhiK0SHist.add("h2PhiK0SGenMCFCut", "K0Short coupled to Phi for GenMC Deltay < FirstCut", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + mcPhiK0SHist.add("h2PhiK0SGenMCSCut", "K0Short coupled to Phi for GenMC Deltay < SecondCut", kTH2F, {binnedmultAxis, binnedptK0SAxis}); - MCPhiK0SHist.add("h2PhiK0SGenMCIncAssocReco", "K0Short coupled to Phi for GenMC Inclusive Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptK0SAxis}); - MCPhiK0SHist.add("h2PhiK0SGenMCFCutAssocReco", "K0Short coupled to Phi for GenMC Deltay < FirstCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptK0SAxis}); - MCPhiK0SHist.add("h2PhiK0SGenMCSCutAssocReco", "K0Short coupled to Phi for GenMC Deltay < SecondCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + mcPhiK0SHist.add("h2PhiK0SGenMCIncAssocReco", "K0Short coupled to Phi for GenMC Inclusive Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + mcPhiK0SHist.add("h2PhiK0SGenMCFCutAssocReco", "K0Short coupled to Phi for GenMC Deltay < FirstCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + mcPhiK0SHist.add("h2PhiK0SGenMCSCutAssocReco", "K0Short coupled to Phi for GenMC Deltay < SecondCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptK0SAxis}); // 2D mass for Phi and K0S for Closure Test - closureMCPhiK0SHist.add("h4ClosureMCPhiK0SSEInc", "2D Invariant mass of Phi and K0Short for Same Event Inclusive for Closure Test", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis, sigPhimassAxis}); - closureMCPhiK0SHist.add("h4ClosureMCPhiK0SSEFCut", "2D Invariant mass of Phi and K0Short for Same Event Deltay < FirstCut for Closure Test", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis, sigPhimassAxis}); - closureMCPhiK0SHist.add("h4ClosureMCPhiK0SSESCut", "2D Invariant mass of Phi and K0Short for Same Event Deltay < SecondCut for Closure Test", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis, sigPhimassAxis}); + closureMCPhiK0SHist.add("h4ClosureMCPhiK0SSEInc", "2D Invariant mass of Phi and K0Short for Same Event Inclusive for Closure Test", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, massK0SAxis, sigmassPhiAxis}); + closureMCPhiK0SHist.add("h4ClosureMCPhiK0SSEFCut", "2D Invariant mass of Phi and K0Short for Same Event Deltay < FirstCut for Closure Test", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, massK0SAxis, sigmassPhiAxis}); + closureMCPhiK0SHist.add("h4ClosureMCPhiK0SSESCut", "2D Invariant mass of Phi and K0Short for Same Event Deltay < SecondCut for Closure Test", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, massK0SAxis, sigmassPhiAxis}); // Phi mass vs Pion NSigma dE/dx for Data - PhiPionHist.add("h5PhiPiSEInc", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Inclusive", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigPhimassAxis}); - PhiPionHist.add("h5PhiPiSEFCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Deltay < FirstCut", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigPhimassAxis}); - PhiPionHist.add("h5PhiPiSESCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Deltay < SecondCut", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigPhimassAxis}); + dataPhiPionHist.add("h5PhiPiSEInc", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Inclusive", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigmassPhiAxis}); + dataPhiPionHist.add("h5PhiPiSEFCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Deltay < FirstCut", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigmassPhiAxis}); + dataPhiPionHist.add("h5PhiPiSESCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Deltay < SecondCut", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigmassPhiAxis}); // RecMC Pion coupled to Phi - MCPhiPionHist.add("h4RecMCPhiPiSEInc", "Phi Invariant mass vs Pion nSigma TPC/TOF for RecMC Inclusive", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}}); - MCPhiPionHist.add("h4RecMCPhiPiSEFCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for RecMC Deltay < FirstCut", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}}); - MCPhiPionHist.add("h4RecMCPhiPiSESCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for RecMC Deltay < SecondCut", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}}); + mcPhiPionHist.add("h4RecMCPhiPiSEInc", "Phi Invariant mass vs Pion nSigma TPC/TOF for RecMC Inclusive", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}}); + mcPhiPionHist.add("h4RecMCPhiPiSEFCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for RecMC Deltay < FirstCut", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}}); + mcPhiPionHist.add("h4RecMCPhiPiSESCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for RecMC Deltay < SecondCut", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}}); // GenMC Pion coupled to Phi - MCPhiPionHist.add("h2PhiPiGenMCInc", "Pion coupled to Phi for GenMC Inclusive", kTH2F, {binnedmultAxis, binnedptPiAxis}); - MCPhiPionHist.add("h2PhiPiGenMCFCut", "Pion coupled to Phi for GenMC Deltay < FirstCut", kTH2F, {binnedmultAxis, binnedptPiAxis}); - MCPhiPionHist.add("h2PhiPiGenMCSCut", "Pion coupled to Phi for GenMC Deltay < SecondCut", kTH2F, {binnedmultAxis, binnedptPiAxis}); + mcPhiPionHist.add("h2PhiPiGenMCInc", "Pion coupled to Phi for GenMC Inclusive", kTH2F, {binnedmultAxis, binnedptPiAxis}); + mcPhiPionHist.add("h2PhiPiGenMCFCut", "Pion coupled to Phi for GenMC Deltay < FirstCut", kTH2F, {binnedmultAxis, binnedptPiAxis}); + mcPhiPionHist.add("h2PhiPiGenMCSCut", "Pion coupled to Phi for GenMC Deltay < SecondCut", kTH2F, {binnedmultAxis, binnedptPiAxis}); - MCPhiPionHist.add("h2PhiPiGenMCIncAssocReco", "Pion coupled to Phi for GenMC Inclusive Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptPiAxis}); - MCPhiPionHist.add("h2PhiPiGenMCFCutAssocReco", "Pion coupled to Phi for GenMC Deltay < FirstCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptPiAxis}); - MCPhiPionHist.add("h2PhiPiGenMCSCutAssocReco", "Pion coupled to Phi for GenMC Deltay < SecondCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptPiAxis}); + mcPhiPionHist.add("h2PhiPiGenMCIncAssocReco", "Pion coupled to Phi for GenMC Inclusive Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptPiAxis}); + mcPhiPionHist.add("h2PhiPiGenMCFCutAssocReco", "Pion coupled to Phi for GenMC Deltay < FirstCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptPiAxis}); + mcPhiPionHist.add("h2PhiPiGenMCSCutAssocReco", "Pion coupled to Phi for GenMC Deltay < SecondCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptPiAxis}); // Phi mass vs Pion NSigma dE/dx for Closure Test - closureMCPhiPionHist.add("h5ClosureMCPhiPiSEInc", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Inclusive for Closure Test", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigPhimassAxis}); - closureMCPhiPionHist.add("h5ClosureMCPhiPiSEFCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Deltay < FirstCut for Closure Test", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigPhimassAxis}); - closureMCPhiPionHist.add("h5ClosureMCPhiPiSESCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Deltay < SecondCut for Closure Test", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigPhimassAxis}); + closureMCPhiPionHist.add("h5ClosureMCPhiPiSEInc", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Inclusive for Closure Test", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigmassPhiAxis}); + closureMCPhiPionHist.add("h5ClosureMCPhiPiSEFCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Deltay < FirstCut for Closure Test", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigmassPhiAxis}); + closureMCPhiPionHist.add("h5ClosureMCPhiPiSESCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Deltay < SecondCut for Closure Test", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigmassPhiAxis}); // MCPhi invariant mass for computing efficiencies and MCnormalisation - PhieffHist.add("h2PhieffInvMass", "Invariant mass of Phi for Efficiency (no K0S/Pi)", kTH2F, {binnedmultAxis, PhimassAxis}); + mcPhiHist.add("h2PhieffInvMass", "Invariant mass of Phi for Efficiency (no K0S/Pi)", kTH2F, {binnedmultAxis, massPhiAxis}); - PhieffHist.add("h3PhieffK0SInvMassInc", "Invariant mass of Phi for Efficiency (K0S) Inclusive", kTH3F, {binnedmultAxis, binnedptK0SAxis, PhimassAxis}); - PhieffHist.add("h3PhieffK0SInvMassFCut", "Invariant mass of Phi for Efficiency (K0S) Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, PhimassAxis}); - PhieffHist.add("h3PhieffK0SInvMassSCut", "Invariant mass of Phi for Efficiency (K0S) Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, PhimassAxis}); + mcPhiHist.add("h3PhieffK0SInvMassInc", "Invariant mass of Phi for Efficiency (K0S) Inclusive", kTH3F, {binnedmultAxis, binnedptK0SAxis, massPhiAxis}); + mcPhiHist.add("h3PhieffK0SInvMassFCut", "Invariant mass of Phi for Efficiency (K0S) Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, massPhiAxis}); + mcPhiHist.add("h3PhieffK0SInvMassSCut", "Invariant mass of Phi for Efficiency (K0S) Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, massPhiAxis}); - PhieffHist.add("h3PhieffPiInvMassInc", "Invariant mass of Phi for Efficiency (Pi) Inclusive", kTH3F, {binnedmultAxis, binnedptPiAxis, PhimassAxis}); - PhieffHist.add("h3PhieffPiInvMassFCut", "Invariant mass of Phi for Efficiency (Pi) Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptPiAxis, PhimassAxis}); - PhieffHist.add("h3PhieffPiInvMassSCut", "Invariant mass of Phi for Efficiency (Pi) Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptPiAxis, PhimassAxis}); + mcPhiHist.add("h3PhieffPiInvMassInc", "Invariant mass of Phi for Efficiency (Pi) Inclusive", kTH3F, {binnedmultAxis, binnedptPiAxis, massPhiAxis}); + mcPhiHist.add("h3PhieffPiInvMassFCut", "Invariant mass of Phi for Efficiency (Pi) Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptPiAxis, massPhiAxis}); + mcPhiHist.add("h3PhieffPiInvMassSCut", "Invariant mass of Phi for Efficiency (Pi) Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptPiAxis, massPhiAxis}); // GenMC Phi and Phi coupled to K0S and Pion - PhieffHist.add("h1PhiGenMC", "Phi for GenMC", kTH1F, {binnedmultAxis}); - PhieffHist.add("h1PhiGenMCAssocReco", "Phi for GenMC Associated Reco Collision", kTH1F, {binnedmultAxis}); + mcPhiHist.add("h1PhiGenMC", "Phi for GenMC", kTH1F, {binnedmultAxis}); + mcPhiHist.add("h1PhiGenMCAssocReco", "Phi for GenMC Associated Reco Collision", kTH1F, {binnedmultAxis}); - PhieffHist.add("h2PhieffK0SGenMCInc", "Phi coupled to K0Short for GenMC Inclusive", kTH2F, {binnedmultAxis, binnedptK0SAxis}); - PhieffHist.add("h2PhieffK0SGenMCFCut", "Phi coupled to K0Short for GenMC Deltay < FirstCut", kTH2F, {binnedmultAxis, binnedptK0SAxis}); - PhieffHist.add("h2PhieffK0SGenMCSCut", "Phi coupled to K0Short for GenMC Deltay < SecondCut", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + mcPhiHist.add("h2PhieffK0SGenMCInc", "Phi coupled to K0Short for GenMC Inclusive", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + mcPhiHist.add("h2PhieffK0SGenMCFCut", "Phi coupled to K0Short for GenMC Deltay < FirstCut", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + mcPhiHist.add("h2PhieffK0SGenMCSCut", "Phi coupled to K0Short for GenMC Deltay < SecondCut", kTH2F, {binnedmultAxis, binnedptK0SAxis}); - PhieffHist.add("h2PhieffK0SGenMCIncAssocReco", "Phi coupled to K0Short for GenMC Inclusive Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptK0SAxis}); - PhieffHist.add("h2PhieffK0SGenMCFCutAssocReco", "Phi coupled to K0Short for GenMC Deltay < FirstCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptK0SAxis}); - PhieffHist.add("h2PhieffK0SGenMCSCutAssocReco", "Phi coupled to K0Short for GenMC Deltay < SecondCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + mcPhiHist.add("h2PhieffK0SGenMCIncAssocReco", "Phi coupled to K0Short for GenMC Inclusive Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + mcPhiHist.add("h2PhieffK0SGenMCFCutAssocReco", "Phi coupled to K0Short for GenMC Deltay < FirstCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + mcPhiHist.add("h2PhieffK0SGenMCSCutAssocReco", "Phi coupled to K0Short for GenMC Deltay < SecondCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptK0SAxis}); - PhieffHist.add("h2PhieffPiGenMCInc", "Phi coupled to Pion for GenMC Inclusive", kTH2F, {binnedmultAxis, binnedptPiAxis}); - PhieffHist.add("h2PhieffPiGenMCFCut", "Phi coupled to Pion for GenMC Deltay < FirstCut", kTH2F, {binnedmultAxis, binnedptPiAxis}); - PhieffHist.add("h2PhieffPiGenMCSCut", "Phi coupled to Pion for GenMC Deltay < SecondCut", kTH2F, {binnedmultAxis, binnedptPiAxis}); + mcPhiHist.add("h2PhieffPiGenMCInc", "Phi coupled to Pion for GenMC Inclusive", kTH2F, {binnedmultAxis, binnedptPiAxis}); + mcPhiHist.add("h2PhieffPiGenMCFCut", "Phi coupled to Pion for GenMC Deltay < FirstCut", kTH2F, {binnedmultAxis, binnedptPiAxis}); + mcPhiHist.add("h2PhieffPiGenMCSCut", "Phi coupled to Pion for GenMC Deltay < SecondCut", kTH2F, {binnedmultAxis, binnedptPiAxis}); - PhieffHist.add("h2PhieffPiGenMCIncAssocReco", "Phi coupled to Pion for GenMC Inclusive Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptPiAxis}); - PhieffHist.add("h2PhieffPiGenMCFCutAssocReco", "Phi coupled to Pion for GenMC Deltay < FirstCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptPiAxis}); - PhieffHist.add("h2PhieffPiGenMCSCutAssocReco", "Phi coupled to Pion for GenMC Deltay < SecondCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptPiAxis}); + mcPhiHist.add("h2PhieffPiGenMCIncAssocReco", "Phi coupled to Pion for GenMC Inclusive Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptPiAxis}); + mcPhiHist.add("h2PhieffPiGenMCFCutAssocReco", "Phi coupled to Pion for GenMC Deltay < FirstCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptPiAxis}); + mcPhiHist.add("h2PhieffPiGenMCSCutAssocReco", "Phi coupled to Pion for GenMC Deltay < SecondCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptPiAxis}); // Rapidity smearing matrix for Phi - PhieffHist.add("h3PhiRapiditySmearing", "Rapidity Smearing Matrix for Phi", kTH3F, {binnedmultAxis, yAxis, yAxis}); + mcPhiHist.add("h3PhiRapiditySmearing", "Rapidity Smearing Matrix for Phi", kTH3F, {binnedmultAxis, yAxis, yAxis}); // MCK0S invariant mass and GenMC K0S for computing efficiencies - K0SeffHist.add("h3K0SeffInvMass", "Invariant mass of K0Short for Efficiency", kTH3F, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis}); - K0SeffHist.add("h2K0SGenMC", "K0Short for GenMC", kTH2F, {binnedmultAxis, binnedptK0SAxis}); - K0SeffHist.add("h2K0SGenMCAssocReco", "K0Short for GenMC Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + mcK0SHist.add("h3K0SeffInvMass", "Invariant mass of K0Short for Efficiency", kTH3F, {binnedmultAxis, binnedptK0SAxis, massK0SAxis}); + mcK0SHist.add("h2K0SGenMC", "K0Short for GenMC", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + mcK0SHist.add("h2K0SGenMCAssocReco", "K0Short for GenMC Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptK0SAxis}); // Rapidity smearing matrix for K0S - K0SeffHist.add("h4K0SRapiditySmearing", "Rapidity Smearing Matrix for K0Short", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, yAxis, yAxis}); + mcK0SHist.add("h4K0SRapiditySmearing", "Rapidity Smearing Matrix for K0Short", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, yAxis, yAxis}); // MCPion invariant mass and GenMC Pion for computing efficiencies - PioneffHist.add("h4PieffInvMass", "Invariant mass of Pion for Efficiency", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}}); - PioneffHist.add("h2PiGenMC", "Pion for GenMC", kTH2F, {binnedmultAxis, binnedptPiAxis}); - PioneffHist.add("h2PiGenMCAssocReco", "Pion for GenMC Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptPiAxis}); + mcPionHist.add("h4PieffInvMass", "Invariant mass of Pion for Efficiency", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}}); + mcPionHist.add("h2PiGenMC", "Pion for GenMC", kTH2F, {binnedmultAxis, binnedptPiAxis}); + mcPionHist.add("h2PiGenMCAssocReco", "Pion for GenMC Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptPiAxis}); // Rapidity smearing matrix for Pion - PioneffHist.add("h4PiRapiditySmearing", "Rapidity Smearing Matrix for Pion", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, yAxis, yAxis}); + mcPionHist.add("h4PiRapiditySmearing", "Rapidity Smearing Matrix for Pion", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, yAxis, yAxis}); } // Event selection and QA filling @@ -374,47 +373,47 @@ struct phik0shortanalysis { { if constexpr (!isMC) { // data event if (QA) - eventHist.fill(HIST("hEventSelection"), 0); // all collisions + dataEventHist.fill(HIST("hEventSelection"), 0); // all collisions if (!collision.sel8()) return false; if (QA) - eventHist.fill(HIST("hEventSelection"), 1); // sel8 collisions - if (std::abs(collision.posZ()) >= cutzvertex) + dataEventHist.fill(HIST("hEventSelection"), 1); // sel8 collisions + if (std::abs(collision.posZ()) >= cutZVertex) return false; if (QA) { - eventHist.fill(HIST("hEventSelection"), 2); // vertex-Z selected - eventHist.fill(HIST("hVertexZ"), collision.posZ()); + dataEventHist.fill(HIST("hEventSelection"), 2); // vertex-Z selected + dataEventHist.fill(HIST("hVertexZ"), collision.posZ()); } if (!collision.isInelGt0()) return false; if (QA) - eventHist.fill(HIST("hEventSelection"), 3); // INEL>0 collisions + dataEventHist.fill(HIST("hEventSelection"), 3); // INEL>0 collisions return true; } else { // RecMC event if (QA) - MCeventHist.fill(HIST("hRecMCEventSelection"), 0); // all collisions + mcEventHist.fill(HIST("hRecMCEventSelection"), 0); // all collisions if (!collision.selection_bit(aod::evsel::kIsTriggerTVX)) return false; if (QA) - MCeventHist.fill(HIST("hRecMCEventSelection"), 1); // kIsTriggerTVX collisions + mcEventHist.fill(HIST("hRecMCEventSelection"), 1); // kIsTriggerTVX collisions if (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) return false; if (QA) - MCeventHist.fill(HIST("hRecMCEventSelection"), 2); // kNoTimeFrameBorder collisions + mcEventHist.fill(HIST("hRecMCEventSelection"), 2); // kNoTimeFrameBorder collisions if (cfgiskNoITSROFrameBorder && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) return false; if (QA) - MCeventHist.fill(HIST("hRecMCEventSelection"), 3); // kNoITSROFrameBorder collisions (by default not requested by the selection) - if (std::abs(collision.posZ()) > cutzvertex) + mcEventHist.fill(HIST("hRecMCEventSelection"), 3); // kNoITSROFrameBorder collisions (by default not requested by the selection) + if (std::abs(collision.posZ()) > cutZVertex) return false; if (QA) { - MCeventHist.fill(HIST("hRecMCEventSelection"), 4); // vertex-Z selected - MCeventHist.fill(HIST("hRecMCVertexZ"), collision.posZ()); + mcEventHist.fill(HIST("hRecMCEventSelection"), 4); // vertex-Z selected + mcEventHist.fill(HIST("hRecMCVertexZ"), collision.posZ()); } if (!collision.isInelGt0()) return false; if (QA) - MCeventHist.fill(HIST("hRecMCEventSelection"), 5); // INEL>0 collisions + mcEventHist.fill(HIST("hRecMCEventSelection"), 5); // INEL>0 collisions return true; } } @@ -441,14 +440,14 @@ struct phik0shortanalysis { if (!selectionTrackStrangeness(daughter1) || !selectionTrackStrangeness(daughter2)) return false; - if (v0.v0cosPA() < v0setting_cospa) + if (v0.v0cosPA() < v0SettingCosPA) return false; - if (v0.v0radius() < v0setting_radius) + if (v0.v0radius() < v0SettingRadius) return false; - if (std::abs(daughter1.tpcNSigmaPi()) > NSigmaTPCPion) + if (std::abs(daughter1.tpcNSigmaPi()) > nSigmaCutTPCPion) return false; - if (std::abs(daughter2.tpcNSigmaPi()) > NSigmaTPCPion) + if (std::abs(daughter2.tpcNSigmaPi()) > nSigmaCutTPCPion) return false; return true; } @@ -479,11 +478,11 @@ struct phik0shortanalysis { template bool selectionPIDKaon(const T& candidate) { - if (!isNoTOF && candidate.hasTOF() && (candidate.tofNSigmaKa() * candidate.tofNSigmaKa() + candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa()) < (nsigmaCutCombinedKa * nsigmaCutCombinedKa)) + if (!isNoTOF && candidate.hasTOF() && (candidate.tofNSigmaKa() * candidate.tofNSigmaKa() + candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa()) < (nSigmaCutCombinedKa * nSigmaCutCombinedKa)) return true; - if (!isNoTOF && !candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa) + if (!isNoTOF && !candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nSigmaCutTPCKa) return true; - if (isNoTOF && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa) + if (isNoTOF && std::abs(candidate.tpcNSigmaKa()) < nSigmaCutTPCKa) return true; return false; } @@ -491,9 +490,9 @@ struct phik0shortanalysis { template bool selectionPIDKaonpTdependent(const T& candidate) { - if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa) + if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaKa()) < nSigmaCutTPCKa) return true; - if (candidate.pt() >= 0.5 && candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nsigmaCutCombinedKa * nsigmaCutCombinedKa)) + if (candidate.pt() >= 0.5 && candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nSigmaCutCombinedKa * nSigmaCutCombinedKa)) return true; return false; } @@ -554,19 +553,19 @@ struct phik0shortanalysis { { for (const auto& Phi : listPhi) { if constexpr (!isMC) { // same event - PhiK0SHist.fill(HIST("h4PhiK0SSEInc"), multiplicity, V0.pt(), V0.mK0Short(), Phi.M(), weights.at(0)); - if (std::abs(V0.yK0Short() - Phi.Rapidity()) > cfgFirstCutonDeltay) + dataPhiK0SHist.fill(HIST("h4PhiK0SSEInc"), multiplicity, V0.pt(), V0.mK0Short(), Phi.M(), weights.at(0)); + if (std::abs(V0.yK0Short() - Phi.Rapidity()) > cfgFCutOnDeltaY) continue; - PhiK0SHist.fill(HIST("h4PhiK0SSEFCut"), multiplicity, V0.pt(), V0.mK0Short(), Phi.M(), weights.at(1)); - if (std::abs(V0.yK0Short() - Phi.Rapidity()) > cfgSecondCutonDeltay) + dataPhiK0SHist.fill(HIST("h4PhiK0SSEFCut"), multiplicity, V0.pt(), V0.mK0Short(), Phi.M(), weights.at(1)); + if (std::abs(V0.yK0Short() - Phi.Rapidity()) > cfgSCutOnDeltaY) continue; - PhiK0SHist.fill(HIST("h4PhiK0SSESCut"), multiplicity, V0.pt(), V0.mK0Short(), Phi.M(), weights.at(2)); + dataPhiK0SHist.fill(HIST("h4PhiK0SSESCut"), multiplicity, V0.pt(), V0.mK0Short(), Phi.M(), weights.at(2)); } else { // MC event closureMCPhiK0SHist.fill(HIST("h4ClosureMCPhiK0SSEInc"), multiplicity, V0.pt(), V0.mK0Short(), Phi.M(), weights.at(0)); - if (std::abs(V0.yK0Short() - Phi.Rapidity()) > cfgFirstCutonDeltay) + if (std::abs(V0.yK0Short() - Phi.Rapidity()) > cfgFCutOnDeltaY) continue; closureMCPhiK0SHist.fill(HIST("h4ClosureMCPhiK0SSEFCut"), multiplicity, V0.pt(), V0.mK0Short(), Phi.M(), weights.at(1)); - if (std::abs(V0.yK0Short() - Phi.Rapidity()) > cfgSecondCutonDeltay) + if (std::abs(V0.yK0Short() - Phi.Rapidity()) > cfgSCutOnDeltaY) continue; closureMCPhiK0SHist.fill(HIST("h4ClosureMCPhiK0SSESCut"), multiplicity, V0.pt(), V0.mK0Short(), Phi.M(), weights.at(2)); } @@ -582,19 +581,19 @@ struct phik0shortanalysis { for (const auto& Phi : listPhi) { if constexpr (!isMC) { // same event - PhiPionHist.fill(HIST("h5PhiPiSEInc"), multiplicity, Pi.pt(), nSigmaTPCPi, nSigmaTOFPi, Phi.M(), weights.at(0)); - if (std::abs(Pi.rapidity(massPi) - Phi.Rapidity()) > cfgFirstCutonDeltay) + dataPhiPionHist.fill(HIST("h5PhiPiSEInc"), multiplicity, Pi.pt(), nSigmaTPCPi, nSigmaTOFPi, Phi.M(), weights.at(0)); + if (std::abs(Pi.rapidity(massPi) - Phi.Rapidity()) > cfgFCutOnDeltaY) continue; - PhiPionHist.fill(HIST("h5PhiPiSEFCut"), multiplicity, Pi.pt(), nSigmaTPCPi, nSigmaTOFPi, Phi.M(), weights.at(1)); - if (std::abs(Pi.rapidity(massPi) - Phi.Rapidity()) > cfgSecondCutonDeltay) + dataPhiPionHist.fill(HIST("h5PhiPiSEFCut"), multiplicity, Pi.pt(), nSigmaTPCPi, nSigmaTOFPi, Phi.M(), weights.at(1)); + if (std::abs(Pi.rapidity(massPi) - Phi.Rapidity()) > cfgSCutOnDeltaY) continue; - PhiPionHist.fill(HIST("h5PhiPiSESCut"), multiplicity, Pi.pt(), nSigmaTPCPi, nSigmaTOFPi, Phi.M(), weights.at(2)); + dataPhiPionHist.fill(HIST("h5PhiPiSESCut"), multiplicity, Pi.pt(), nSigmaTPCPi, nSigmaTOFPi, Phi.M(), weights.at(2)); } else { // MC event closureMCPhiPionHist.fill(HIST("h5ClosureMCPhiPiSEInc"), multiplicity, Pi.pt(), nSigmaTPCPi, nSigmaTOFPi, Phi.M(), weights.at(0)); - if (std::abs(Pi.rapidity(massPi) - Phi.Rapidity()) > cfgFirstCutonDeltay) + if (std::abs(Pi.rapidity(massPi) - Phi.Rapidity()) > cfgFCutOnDeltaY) continue; closureMCPhiPionHist.fill(HIST("h5ClosureMCPhiPiSEFCut"), multiplicity, Pi.pt(), nSigmaTPCPi, nSigmaTOFPi, Phi.M(), weights.at(1)); - if (std::abs(Pi.rapidity(massPi) - Phi.Rapidity()) > cfgSecondCutonDeltay) + if (std::abs(Pi.rapidity(massPi) - Phi.Rapidity()) > cfgSCutOnDeltaY) continue; closureMCPhiPionHist.fill(HIST("h5ClosureMCPhiPiSESCut"), multiplicity, Pi.pt(), nSigmaTPCPi, nSigmaTOFPi, Phi.M(), weights.at(2)); } @@ -608,7 +607,7 @@ struct phik0shortanalysis { return; float multiplicity = collision.centFT0M(); - eventHist.fill(HIST("hMultiplicityPercent"), multiplicity); + dataEventHist.fill(HIST("hMultiplicityPercent"), multiplicity); // Defining positive and negative tracks for phi reconstruction auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); @@ -621,11 +620,11 @@ struct phik0shortanalysis { if (!selectionTrackResonance(track1) || !selectionPIDKaonpTdependent(track1)) continue; // topological and PID selection - PhicandHist.fill(HIST("hEta"), track1.eta()); - PhicandHist.fill(HIST("hDcaxy"), track1.dcaXY()); - PhicandHist.fill(HIST("hDcaz"), track1.dcaZ()); - PhicandHist.fill(HIST("hNsigmaKaonTPC"), track1.tpcInnerParam(), track1.tpcNSigmaKa()); - PhicandHist.fill(HIST("hNsigmaKaonTOF"), track1.tpcInnerParam(), track1.tofNSigmaKa()); + candPhiHist.fill(HIST("hEta"), track1.eta()); + candPhiHist.fill(HIST("hDcaxy"), track1.dcaXY()); + candPhiHist.fill(HIST("hDcaz"), track1.dcaZ()); + candPhiHist.fill(HIST("hNsigmaKaonTPC"), track1.tpcInnerParam(), track1.tpcNSigmaKa()); + candPhiHist.fill(HIST("hNsigmaKaonTOF"), track1.tpcInnerParam(), track1.tofNSigmaKa()); auto track1ID = track1.globalIndex(); @@ -639,15 +638,15 @@ struct phik0shortanalysis { continue; // condition to avoid double counting of pair TLorentzVector recPhi = recMother(track1, track2, massKa, massKa); - if (std::abs(recPhi.Rapidity()) > cfgyAcceptance) + if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) continue; if (!isCountedPhi) { - eventHist.fill(HIST("hEventSelection"), 4); // at least a Phi candidate in the event + dataEventHist.fill(HIST("hEventSelection"), 4); // at least a Phi candidate in the event isCountedPhi = true; } - PhipurHist.fill(HIST("h2PhipurInvMass"), multiplicity, recPhi.M()); + dataPhiHist.fill(HIST("h2PhipurInvMass"), multiplicity, recPhi.M()); std::array isCountedK0S{false, false, false}; @@ -661,32 +660,32 @@ struct phik0shortanalysis { continue; if (!isFilledhV0) { - K0SHist.fill(HIST("hDCAV0Daughters"), v0.dcaV0daughters()); - K0SHist.fill(HIST("hV0CosPA"), v0.v0cosPA()); + candK0SHist.fill(HIST("hDCAV0Daughters"), v0.dcaV0daughters()); + candK0SHist.fill(HIST("hV0CosPA"), v0.v0cosPA()); // Filling the PID of the V0 daughters in the region of the K0 peak - if (lowmK0S < v0.mK0Short() && v0.mK0Short() < upmK0S) { - K0SHist.fill(HIST("hNSigmaPosPionFromK0S"), posDaughterTrack.tpcInnerParam(), posDaughterTrack.tpcNSigmaPi()); - K0SHist.fill(HIST("hNSigmaNegPionFromK0S"), negDaughterTrack.tpcInnerParam(), negDaughterTrack.tpcNSigmaPi()); + if (lowMK0S < v0.mK0Short() && v0.mK0Short() < upMK0S) { + candK0SHist.fill(HIST("hNSigmaPosPionFromK0S"), posDaughterTrack.tpcInnerParam(), posDaughterTrack.tpcNSigmaPi()); + candK0SHist.fill(HIST("hNSigmaNegPionFromK0S"), negDaughterTrack.tpcInnerParam(), negDaughterTrack.tpcNSigmaPi()); } } - if (std::abs(v0.yK0Short()) > cfgyAcceptance) + if (std::abs(v0.yK0Short()) > cfgYAcceptance) continue; if (!isCountedK0S.at(0)) { - PhipurHist.fill(HIST("h3PhipurK0SInvMassInc"), multiplicity, v0.pt(), recPhi.M()); + dataPhiHist.fill(HIST("h3PhipurK0SInvMassInc"), multiplicity, v0.pt(), recPhi.M()); isCountedK0S.at(0) = true; } - if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgFirstCutonDeltay) + if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgFCutOnDeltaY) continue; if (!isCountedK0S.at(1)) { - PhipurHist.fill(HIST("h3PhipurK0SInvMassFCut"), multiplicity, v0.pt(), recPhi.M()); + dataPhiHist.fill(HIST("h3PhipurK0SInvMassFCut"), multiplicity, v0.pt(), recPhi.M()); isCountedK0S.at(1) = true; } - if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgSecondCutonDeltay) + if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgSCutOnDeltaY) continue; if (!isCountedK0S.at(2)) { - PhipurHist.fill(HIST("h3PhipurK0SInvMassSCut"), multiplicity, v0.pt(), recPhi.M()); + dataPhiHist.fill(HIST("h3PhipurK0SInvMassSCut"), multiplicity, v0.pt(), recPhi.M()); isCountedK0S.at(2) = true; } } @@ -700,22 +699,22 @@ struct phik0shortanalysis { if (!selectionPion(track)) continue; - if (std::abs(track.rapidity(massPi)) > cfgyAcceptance) + if (std::abs(track.rapidity(massPi)) > cfgYAcceptance) continue; if (!isCountedPi.at(0)) { - PhipurHist.fill(HIST("h3PhipurPiInvMassInc"), multiplicity, track.pt(), recPhi.M()); + dataPhiHist.fill(HIST("h3PhipurPiInvMassInc"), multiplicity, track.pt(), recPhi.M()); isCountedPi.at(0) = true; } - if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgFirstCutonDeltay) + if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgFCutOnDeltaY) continue; if (!isCountedPi.at(1)) { - PhipurHist.fill(HIST("h3PhipurPiInvMassFCut"), multiplicity, track.pt(), recPhi.M()); + dataPhiHist.fill(HIST("h3PhipurPiInvMassFCut"), multiplicity, track.pt(), recPhi.M()); isCountedPi.at(1) = true; } - if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgSecondCutonDeltay) + if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgSCutOnDeltaY) continue; if (!isCountedPi.at(2)) { - PhipurHist.fill(HIST("h3PhipurPiInvMassSCut"), multiplicity, track.pt(), recPhi.M()); + dataPhiHist.fill(HIST("h3PhipurPiInvMassSCut"), multiplicity, track.pt(), recPhi.M()); isCountedPi.at(2) = true; } } @@ -723,7 +722,7 @@ struct phik0shortanalysis { } } - PROCESS_SWITCH(phik0shortanalysis, processQAPurity, "Process for QA and Phi Purities", true); + PROCESS_SWITCH(Phik0shortanalysis, processQAPurity, "Process for QA and Phi Purities", true); void processSEPhiK0S(soa::Filtered::iterator const& collision, FullTracks const&, FullV0s const& V0s, V0DauTracks const&) { @@ -731,7 +730,7 @@ struct phik0shortanalysis { return; float multiplicity = collision.centFT0M(); - eventHist.fill(HIST("hMultiplicityPercent"), multiplicity); + dataEventHist.fill(HIST("hMultiplicityPercent"), multiplicity); // Defining positive and negative tracks for phi reconstruction auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); @@ -746,7 +745,7 @@ struct phik0shortanalysis { if (!selectionV0(v0, posDaughterTrack, negDaughterTrack)) continue; - if (std::abs(v0.yK0Short()) > cfgyAcceptance) + if (std::abs(v0.yK0Short()) > cfgYAcceptance) continue; std::vector listrecPhi; @@ -771,17 +770,17 @@ struct phik0shortanalysis { TLorentzVector recPhi = recMother(track1, track2, massKa, massKa); - if (recPhi.M() < lowmPhi || recPhi.M() > upmPhi) + if (recPhi.M() < lowMPhi || recPhi.M() > upMPhi) continue; - if (std::abs(recPhi.Rapidity()) > cfgyAcceptance) + if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) continue; listrecPhi.push_back(recPhi); counts.at(0)++; - if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgFirstCutonDeltay) + if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgFCutOnDeltaY) continue; counts.at(1)++; - if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgSecondCutonDeltay) + if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgSCutOnDeltaY) continue; counts.at(2)++; } @@ -796,7 +795,7 @@ struct phik0shortanalysis { } } - PROCESS_SWITCH(phik0shortanalysis, processSEPhiK0S, "Process Same Event for Phi-K0S Analysis", false); + PROCESS_SWITCH(Phik0shortanalysis, processSEPhiK0S, "Process Same Event for Phi-K0S Analysis", false); void processSEPhiPion(soa::Filtered::iterator const& collision, FullTracks const& fullTracks) { @@ -804,7 +803,7 @@ struct phik0shortanalysis { return; float multiplicity = collision.centFT0M(); - eventHist.fill(HIST("hMultiplicityPercent"), multiplicity); + dataEventHist.fill(HIST("hMultiplicityPercent"), multiplicity); // Defining positive and negative tracks for phi reconstruction auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); @@ -817,7 +816,7 @@ struct phik0shortanalysis { if (!selectionPion(track)) continue; - if (std::abs(track.rapidity(massPi)) > cfgyAcceptance) + if (std::abs(track.rapidity(massPi)) > cfgYAcceptance) continue; std::vector listrecPhi; @@ -842,17 +841,17 @@ struct phik0shortanalysis { TLorentzVector recPhi = recMother(track1, track2, massKa, massKa); - if (recPhi.M() < lowmPhi || recPhi.M() > upmPhi) + if (recPhi.M() < lowMPhi || recPhi.M() > upMPhi) continue; - if (std::abs(recPhi.Rapidity()) > cfgyAcceptance) + if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) continue; listrecPhi.push_back(recPhi); counts.at(0)++; - if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgFirstCutonDeltay) + if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgFCutOnDeltaY) continue; counts.at(1)++; - if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgSecondCutonDeltay) + if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgSCutOnDeltaY) continue; counts.at(2)++; } @@ -867,7 +866,7 @@ struct phik0shortanalysis { } } - PROCESS_SWITCH(phik0shortanalysis, processSEPhiPion, "Process Same Event for Phi-Pion Analysis", false); + PROCESS_SWITCH(Phik0shortanalysis, processSEPhiPion, "Process Same Event for Phi-Pion Analysis", false); void processRecMCPhiQA(SimCollisions::iterator const& collision, FullMCTracks const& fullMCTracks, FullMCV0s const& V0s, V0DauMCTracks const&, MCCollisions const&, aod::McParticles const&) { @@ -875,15 +874,15 @@ struct phik0shortanalysis { return; float multiplicity = collision.centFT0M(); - MCeventHist.fill(HIST("hRecMCMultiplicityPercent"), multiplicity); + mcEventHist.fill(HIST("hRecMCMultiplicityPercent"), multiplicity); if (!collision.has_mcCollision()) return; - MCeventHist.fill(HIST("hRecMCEventSelection"), 6); // with at least a gen collision + mcEventHist.fill(HIST("hRecMCEventSelection"), 6); // with at least a gen collision const auto& mcCollision = collision.mcCollision_as(); float genmultiplicity = mcCollision.centFT0M(); - MCeventHist.fill(HIST("hRecMCGenMultiplicityPercent"), genmultiplicity); + mcEventHist.fill(HIST("hRecMCGenMultiplicityPercent"), genmultiplicity); // Defining positive and negative tracks for phi reconstruction auto posThisColl = posMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); @@ -899,8 +898,8 @@ struct phik0shortanalysis { if (!track1.has_mcParticle()) continue; - auto MCtrack1 = track1.mcParticle_as(); - if (MCtrack1.pdgCode() != 321 || !MCtrack1.isPhysicalPrimary()) + auto mcTrack1 = track1.mcParticle_as(); + if (mcTrack1.pdgCode() != 321 || !mcTrack1.isPhysicalPrimary()) continue; // Loop over all negative candidates @@ -914,16 +913,16 @@ struct phik0shortanalysis { if (!track2.has_mcParticle()) continue; - auto MCtrack2 = track2.mcParticle_as(); - if (MCtrack2.pdgCode() != -321 || !MCtrack2.isPhysicalPrimary()) + auto mcTrack2 = track2.mcParticle_as(); + if (mcTrack2.pdgCode() != -321 || !mcTrack2.isPhysicalPrimary()) continue; bool isMCMotherPhi = false; - auto MCMotherPhi = MCtrack1.mothers_as()[0]; - for (const auto& MotherOfMCtrack1 : MCtrack1.mothers_as()) { - for (const auto& MotherOfMCtrack2 : MCtrack2.mothers_as()) { - if (MotherOfMCtrack1 == MotherOfMCtrack2 && MotherOfMCtrack1.pdgCode() == 333) { - MCMotherPhi = MotherOfMCtrack1; + auto mcMotherPhi = mcTrack1.mothers_as()[0]; + for (const auto& MotherOfmcTrack1 : mcTrack1.mothers_as()) { + for (const auto& MotherOfmcTrack2 : mcTrack2.mothers_as()) { + if (MotherOfmcTrack1 == MotherOfmcTrack2 && MotherOfmcTrack1.pdgCode() == 333) { + mcMotherPhi = MotherOfmcTrack1; isMCMotherPhi = true; } } @@ -934,17 +933,17 @@ struct phik0shortanalysis { TLorentzVector recPhi = recMother(track1, track2, massKa, massKa); - PhieffHist.fill(HIST("h3PhiRapiditySmearing"), genmultiplicity, recPhi.Rapidity(), MCMotherPhi.y()); + mcPhiHist.fill(HIST("h3PhiRapiditySmearing"), genmultiplicity, recPhi.Rapidity(), mcMotherPhi.y()); - if (std::abs(recPhi.Rapidity()) > cfgyAcceptance) + if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) continue; if (!isCountedPhi) { - MCeventHist.fill(HIST("hRecMCEventSelection"), 7); // at least a Phi in the event + mcEventHist.fill(HIST("hRecMCEventSelection"), 7); // at least a Phi in the event isCountedPhi = true; } - PhieffHist.fill(HIST("h2PhieffInvMass"), genmultiplicity, recPhi.M()); + mcPhiHist.fill(HIST("h2PhieffInvMass"), genmultiplicity, recPhi.M()); std::array isCountedK0S{false, false, false}; @@ -965,22 +964,22 @@ struct phik0shortanalysis { if (!selectionV0(v0, posDaughterTrack, negDaughterTrack)) continue; - if (std::abs(v0.yK0Short()) > cfgyAcceptance) + if (std::abs(v0.yK0Short()) > cfgYAcceptance) continue; if (!isCountedK0S.at(0)) { - PhieffHist.fill(HIST("h3PhieffK0SInvMassInc"), genmultiplicity, v0.pt(), recPhi.M()); + mcPhiHist.fill(HIST("h3PhieffK0SInvMassInc"), genmultiplicity, v0.pt(), recPhi.M()); isCountedK0S.at(0) = true; } - if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgFirstCutonDeltay) + if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgFCutOnDeltaY) continue; if (!isCountedK0S.at(1)) { - PhieffHist.fill(HIST("h3PhieffK0SInvMassFCut"), genmultiplicity, v0.pt(), recPhi.M()); + mcPhiHist.fill(HIST("h3PhieffK0SInvMassFCut"), genmultiplicity, v0.pt(), recPhi.M()); isCountedK0S.at(1) = true; } - if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgSecondCutonDeltay) + if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgSCutOnDeltaY) continue; if (!isCountedK0S.at(2)) { - PhieffHist.fill(HIST("h3PhieffK0SInvMassSCut"), genmultiplicity, v0.pt(), recPhi.M()); + mcPhiHist.fill(HIST("h3PhieffK0SInvMassSCut"), genmultiplicity, v0.pt(), recPhi.M()); isCountedK0S.at(2) = true; } } @@ -992,29 +991,29 @@ struct phik0shortanalysis { if (!track.has_mcParticle()) continue; - auto MCtrack = track.mcParticle_as(); - if (std::abs(MCtrack.pdgCode()) != 211 || !MCtrack.isPhysicalPrimary()) + auto mcTrack = track.mcParticle_as(); + if (std::abs(mcTrack.pdgCode()) != 211 || !mcTrack.isPhysicalPrimary()) continue; if (!selectionPion(track)) continue; - if (std::abs(track.rapidity(massPi)) > cfgyAcceptance) + if (std::abs(track.rapidity(massPi)) > cfgYAcceptance) continue; if (!isCountedPi.at(0)) { - PhieffHist.fill(HIST("h3PhieffPiInvMassInc"), genmultiplicity, track.pt(), recPhi.M()); + mcPhiHist.fill(HIST("h3PhieffPiInvMassInc"), genmultiplicity, track.pt(), recPhi.M()); isCountedPi.at(0) = true; } - if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgFirstCutonDeltay) + if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgFCutOnDeltaY) continue; if (!isCountedPi.at(1)) { - PhieffHist.fill(HIST("h3PhieffPiInvMassFCut"), genmultiplicity, track.pt(), recPhi.M()); + mcPhiHist.fill(HIST("h3PhieffPiInvMassFCut"), genmultiplicity, track.pt(), recPhi.M()); isCountedPi.at(1) = true; } - if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgSecondCutonDeltay) + if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgSCutOnDeltaY) continue; if (!isCountedPi.at(2)) { - PhieffHist.fill(HIST("h3PhieffPiInvMassSCut"), genmultiplicity, track.pt(), recPhi.M()); + mcPhiHist.fill(HIST("h3PhieffPiInvMassSCut"), genmultiplicity, track.pt(), recPhi.M()); isCountedPi.at(2) = true; } } @@ -1022,173 +1021,174 @@ struct phik0shortanalysis { } } - PROCESS_SWITCH(phik0shortanalysis, processRecMCPhiQA, "Process for ReCMCQA and Phi in RecMC", false); + PROCESS_SWITCH(Phik0shortanalysis, processRecMCPhiQA, "Process for ReCMCQA and Phi in RecMC", false); - void processRecMCPhiK0S(SimCollisions::iterator const& collision, FullMCTracks const&, FullMCV0s const& V0s, V0DauMCTracks const&, MCCollisions const&, aod::McParticles const& mcParticles) + void processRecMCPhiK0S(SimCollisions const& collisions, FullMCTracks const&, FullMCV0s const& V0s, V0DauMCTracks const&, MCCollisions const&, aod::McParticles const& mcParticles) { - if (!acceptEventQA(collision, false)) - return; + for (const auto& collision : collisions) { + if (!acceptEventQA(collision, false)) + continue; - if (!collision.has_mcCollision()) - return; + if (!collision.has_mcCollision()) + continue; - const auto& mcCollision = collision.mcCollision_as(); - float genmultiplicity = mcCollision.centFT0M(); + const auto& mcCollision = collision.mcCollision_as(); + float genmultiplicity = mcCollision.centFT0M(); - // Defining positive and negative tracks for phi reconstruction - auto posThisColl = posMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - auto negThisColl = negMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + // Defining V0s in the collision + auto v0sThisColl = V0s.sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - // Defining McParticles in the collision - auto mcParticlesThisColl = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache); + // Defining McParticles in the collision + auto mcParticlesThisColl = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache); - // V0 already reconstructed by the builder - for (const auto& v0 : V0s) { - if (!v0.has_mcParticle()) - continue; + // V0 already reconstructed by the builder + for (const auto& v0 : v0sThisColl) { + if (!v0.has_mcParticle()) + continue; - auto v0mcparticle = v0.mcParticle(); - if (v0mcparticle.pdgCode() != 310 || !v0mcparticle.isPhysicalPrimary()) - continue; + auto v0mcparticle = v0.mcParticle(); + if (v0mcparticle.pdgCode() != 310 || !v0mcparticle.isPhysicalPrimary()) + continue; - const auto& posDaughterTrack = v0.posTrack_as(); - const auto& negDaughterTrack = v0.negTrack_as(); + const auto& posDaughterTrack = v0.posTrack_as(); + const auto& negDaughterTrack = v0.negTrack_as(); - if (!selectionV0(v0, posDaughterTrack, negDaughterTrack)) - continue; + if (!selectionV0(v0, posDaughterTrack, negDaughterTrack)) + continue; - K0SeffHist.fill(HIST("h4K0SRapiditySmearing"), genmultiplicity, v0.pt(), v0.yK0Short(), v0mcparticle.y()); + mcK0SHist.fill(HIST("h4K0SRapiditySmearing"), genmultiplicity, v0.pt(), v0.yK0Short(), v0mcparticle.y()); - if (std::abs(v0mcparticle.y()) > cfgyAcceptance) - continue; + if (std::abs(v0mcparticle.y()) > cfgYAcceptance) + continue; - K0SeffHist.fill(HIST("h3K0SeffInvMass"), genmultiplicity, v0.pt(), v0.mK0Short()); + mcK0SHist.fill(HIST("h3K0SeffInvMass"), genmultiplicity, v0.pt(), v0.mK0Short()); - std::array isCountedMCPhi{false, false, false}; + std::array isCountedMCPhi{false, false, false}; - for (const auto& mcParticle : mcParticlesThisColl) { - if (mcParticle.pdgCode() != 333) - continue; - auto kDaughters = mcParticle.daughters_as(); - if (kDaughters.size() != 2) - continue; - bool isPosKaon = false, isNegKaon = false; - for (const auto& kDaughter : kDaughters) { - if (kDaughter.pdgCode() == 321) - isPosKaon = true; - if (kDaughter.pdgCode() == -321) - isNegKaon = true; - } - if (!isPosKaon || !isNegKaon) - continue; - if (std::abs(mcParticle.y()) > cfgyAcceptance) - continue; + for (const auto& mcParticle : mcParticlesThisColl) { + if (mcParticle.pdgCode() != 333) + continue; + auto kDaughters = mcParticle.daughters_as(); + if (kDaughters.size() != 2) + continue; + bool isPosKaon = false, isNegKaon = false; + for (const auto& kDaughter : kDaughters) { + if (kDaughter.pdgCode() == 321) + isPosKaon = true; + if (kDaughter.pdgCode() == -321) + isNegKaon = true; + } + if (!isPosKaon || !isNegKaon) + continue; + if (std::abs(mcParticle.y()) > cfgYAcceptance) + continue; - if (!isCountedMCPhi.at(0)) { - MCPhiK0SHist.fill(HIST("h3RecMCPhiK0SSEInc"), genmultiplicity, v0.pt(), v0.mK0Short()); - isCountedMCPhi.at(0) = true; - } - if (std::abs(v0mcparticle.y() - mcParticle.y()) > cfgFirstCutonDeltay) - continue; - if (!isCountedMCPhi.at(1)) { - MCPhiK0SHist.fill(HIST("h3RecMCPhiK0SSEFCut"), genmultiplicity, v0.pt(), v0.mK0Short()); - isCountedMCPhi.at(1) = true; - } - if (std::abs(v0mcparticle.y() - mcParticle.y()) > cfgSecondCutonDeltay) - continue; - if (!isCountedMCPhi.at(2)) { - MCPhiK0SHist.fill(HIST("h3RecMCPhiK0SSESCut"), genmultiplicity, v0.pt(), v0.mK0Short()); - isCountedMCPhi.at(2) = true; + if (!isCountedMCPhi.at(0)) { + mcPhiK0SHist.fill(HIST("h3RecMCPhiK0SSEInc"), genmultiplicity, v0.pt(), v0.mK0Short()); + isCountedMCPhi.at(0) = true; + } + if (std::abs(v0mcparticle.y() - mcParticle.y()) > cfgFCutOnDeltaY) + continue; + if (!isCountedMCPhi.at(1)) { + mcPhiK0SHist.fill(HIST("h3RecMCPhiK0SSEFCut"), genmultiplicity, v0.pt(), v0.mK0Short()); + isCountedMCPhi.at(1) = true; + } + if (std::abs(v0mcparticle.y() - mcParticle.y()) > cfgSCutOnDeltaY) + continue; + if (!isCountedMCPhi.at(2)) { + mcPhiK0SHist.fill(HIST("h3RecMCPhiK0SSESCut"), genmultiplicity, v0.pt(), v0.mK0Short()); + isCountedMCPhi.at(2) = true; + } } } } } - PROCESS_SWITCH(phik0shortanalysis, processRecMCPhiK0S, "Process RecMC for Phi-K0S Analysis", false); + PROCESS_SWITCH(Phik0shortanalysis, processRecMCPhiK0S, "Process RecMC for Phi-K0S Analysis", false); - void processRecMCPhiPion(SimCollisions::iterator const& collision, FullMCTracks const& fullMCTracks, MCCollisions const&, aod::McParticles const& mcParticles) + void processRecMCPhiPion(SimCollisions const& collisions, FullMCTracks const& fullMCTracks, MCCollisions const&, aod::McParticles const& mcParticles) { - if (!acceptEventQA(collision, false)) - return; - - if (!collision.has_mcCollision()) - return; + for (const auto& collision : collisions) { + if (!acceptEventQA(collision, false)) + continue; - const auto& mcCollision = collision.mcCollision_as(); - float genmultiplicity = mcCollision.centFT0M(); + if (!collision.has_mcCollision()) + continue; - // Defining positive and negative tracks for phi reconstruction - auto posThisColl = posMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - auto negThisColl = negMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + const auto& mcCollision = collision.mcCollision_as(); + float genmultiplicity = mcCollision.centFT0M(); - // Defining McParticles in the collision - auto mcParticlesThisColl = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache); + // Defining tracks in the collision + auto mcTracksThisColl = fullMCTracks.sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - // Loop over all primary pion candidates - for (const auto& track : fullMCTracks) { + // Defining McParticles in the collision + auto mcParticlesThisColl = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache); - if (!track.has_mcParticle()) - continue; + // Loop over all primary pion candidates + for (const auto& track : mcTracksThisColl) { + if (!track.has_mcParticle()) + continue; - auto MCtrack = track.mcParticle_as(); - if (std::abs(MCtrack.pdgCode()) != 211 || !MCtrack.isPhysicalPrimary()) - continue; + auto mcTrack = track.mcParticle_as(); + if (std::abs(mcTrack.pdgCode()) != 211 || !mcTrack.isPhysicalPrimary()) + continue; - // Pion selection - if (!selectionPion(track)) - continue; + // Pion selection + if (!selectionPion(track)) + continue; - PioneffHist.fill(HIST("h4PiRapiditySmearing"), genmultiplicity, track.pt(), track.rapidity(massPi), MCtrack.y()); + mcPionHist.fill(HIST("h4PiRapiditySmearing"), genmultiplicity, track.pt(), track.rapidity(massPi), mcTrack.y()); - if (std::abs(MCtrack.y()) > cfgyAcceptance) - continue; + if (std::abs(mcTrack.y()) > cfgYAcceptance) + continue; - float nsigmaTPC = (track.hasTPC() ? track.tpcNSigmaPi() : -999); - float nsigmaTOF = (track.hasTOF() ? track.tofNSigmaPi() : -999); + float nsigmaTPC = (track.hasTPC() ? track.tpcNSigmaPi() : -999); + float nsigmaTOF = (track.hasTOF() ? track.tofNSigmaPi() : -999); - PioneffHist.fill(HIST("h4PieffInvMass"), genmultiplicity, track.pt(), nsigmaTPC, nsigmaTOF); + mcPionHist.fill(HIST("h4PieffInvMass"), genmultiplicity, track.pt(), nsigmaTPC, nsigmaTOF); - std::array isCountedMCPhi{false, false, false}; + std::array isCountedMCPhi{false, false, false}; - for (const auto& mcParticle : mcParticlesThisColl) { - if (mcParticle.pdgCode() != 333) - continue; - auto kDaughters = mcParticle.daughters_as(); - if (kDaughters.size() != 2) - continue; - bool isPosKaon = false, isNegKaon = false; - for (const auto& kDaughter : kDaughters) { - if (kDaughter.pdgCode() == 321) - isPosKaon = true; - if (kDaughter.pdgCode() == -321) - isNegKaon = true; - } - if (!isPosKaon || !isNegKaon) - continue; - if (std::abs(mcParticle.y()) > cfgyAcceptance) - continue; + for (const auto& mcParticle : mcParticlesThisColl) { + if (mcParticle.pdgCode() != 333) + continue; + auto kDaughters = mcParticle.daughters_as(); + if (kDaughters.size() != 2) + continue; + bool isPosKaon = false, isNegKaon = false; + for (const auto& kDaughter : kDaughters) { + if (kDaughter.pdgCode() == 321) + isPosKaon = true; + if (kDaughter.pdgCode() == -321) + isNegKaon = true; + } + if (!isPosKaon || !isNegKaon) + continue; + if (std::abs(mcParticle.y()) > cfgYAcceptance) + continue; - if (!isCountedMCPhi.at(0)) { - MCPhiPionHist.fill(HIST("h4RecMCPhiPiSEInc"), genmultiplicity, track.pt(), nsigmaTPC, nsigmaTOF); - isCountedMCPhi.at(0) = true; - } - if (std::abs(MCtrack.y() - mcParticle.y()) > cfgFirstCutonDeltay) - continue; - if (!isCountedMCPhi.at(1)) { - MCPhiPionHist.fill(HIST("h4RecMCPhiPiSEFCut"), genmultiplicity, track.pt(), nsigmaTPC, nsigmaTOF); - isCountedMCPhi.at(1) = true; - } - if (std::abs(MCtrack.y() - mcParticle.y()) > cfgSecondCutonDeltay) - continue; - if (!isCountedMCPhi.at(2)) { - MCPhiPionHist.fill(HIST("h4RecMCPhiPiSESCut"), genmultiplicity, track.pt(), nsigmaTPC, nsigmaTOF); - isCountedMCPhi.at(2) = true; + if (!isCountedMCPhi.at(0)) { + mcPhiPionHist.fill(HIST("h4RecMCPhiPiSEInc"), genmultiplicity, track.pt(), nsigmaTPC, nsigmaTOF); + isCountedMCPhi.at(0) = true; + } + if (std::abs(mcTrack.y() - mcParticle.y()) > cfgFCutOnDeltaY) + continue; + if (!isCountedMCPhi.at(1)) { + mcPhiPionHist.fill(HIST("h4RecMCPhiPiSEFCut"), genmultiplicity, track.pt(), nsigmaTPC, nsigmaTOF); + isCountedMCPhi.at(1) = true; + } + if (std::abs(mcTrack.y() - mcParticle.y()) > cfgSCutOnDeltaY) + continue; + if (!isCountedMCPhi.at(2)) { + mcPhiPionHist.fill(HIST("h4RecMCPhiPiSESCut"), genmultiplicity, track.pt(), nsigmaTPC, nsigmaTOF); + isCountedMCPhi.at(2) = true; + } } } } } - PROCESS_SWITCH(phik0shortanalysis, processRecMCPhiPion, "Process RecMC for Phi-Pion Analysis", false); + PROCESS_SWITCH(Phik0shortanalysis, processRecMCPhiPion, "Process RecMC for Phi-Pion Analysis", false); void processRecMCClosurePhiQA(SimCollisions::iterator const& collision, FullMCTracks const& fullMCTracks, FullV0s const& V0s, V0DauMCTracks const&, MCCollisions const&) { @@ -1197,11 +1197,11 @@ struct phik0shortanalysis { if (!collision.has_mcCollision()) return; - MCeventHist.fill(HIST("hRecMCEventSelection"), 6); // with at least a gen collision + mcEventHist.fill(HIST("hRecMCEventSelection"), 6); // with at least a gen collision const auto& mcCollision = collision.mcCollision_as(); float genmultiplicity = mcCollision.centFT0M(); - MCeventHist.fill(HIST("hRecMCGenMultiplicityPercent"), genmultiplicity); + mcEventHist.fill(HIST("hRecMCGenMultiplicityPercent"), genmultiplicity); // Defining positive and negative tracks for phi reconstruction auto posThisColl = posMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); @@ -1225,15 +1225,15 @@ struct phik0shortanalysis { continue; // condition to avoid double counting of pair TLorentzVector recPhi = recMother(track1, track2, massKa, massKa); - if (std::abs(recPhi.Rapidity()) > cfgyAcceptance) + if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) continue; if (!isCountedPhi) { - MCeventHist.fill(HIST("hRecMCEventSelection"), 7); // at least a Phi in the event + mcEventHist.fill(HIST("hRecMCEventSelection"), 7); // at least a Phi in the event isCountedPhi = true; } - closureMCPhipurHist.fill(HIST("h2MCPhipurInvMass"), genmultiplicity, recPhi.M()); + closureMCPhiHist.fill(HIST("h2MCPhipurInvMass"), genmultiplicity, recPhi.M()); std::array isCountedK0S{false, false, false}; @@ -1245,23 +1245,23 @@ struct phik0shortanalysis { if (!selectionV0(v0, posDaughterTrack, negDaughterTrack)) continue; - if (std::abs(v0.yK0Short()) > cfgyAcceptance) + if (std::abs(v0.yK0Short()) > cfgYAcceptance) continue; if (!isCountedK0S.at(0)) { - closureMCPhipurHist.fill(HIST("h3MCPhipurK0SInvMassInc"), genmultiplicity, v0.pt(), recPhi.M()); + closureMCPhiHist.fill(HIST("h3MCPhipurK0SInvMassInc"), genmultiplicity, v0.pt(), recPhi.M()); isCountedK0S.at(0) = true; } - if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgFirstCutonDeltay) + if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgFCutOnDeltaY) continue; if (!isCountedK0S.at(1)) { - closureMCPhipurHist.fill(HIST("h3MCPhipurK0SInvMassFCut"), genmultiplicity, v0.pt(), recPhi.M()); + closureMCPhiHist.fill(HIST("h3MCPhipurK0SInvMassFCut"), genmultiplicity, v0.pt(), recPhi.M()); isCountedK0S.at(1) = true; } - if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgSecondCutonDeltay) + if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgSCutOnDeltaY) continue; if (!isCountedK0S.at(2)) { - closureMCPhipurHist.fill(HIST("h3MCPhipurK0SInvMassSCut"), genmultiplicity, v0.pt(), recPhi.M()); + closureMCPhiHist.fill(HIST("h3MCPhipurK0SInvMassSCut"), genmultiplicity, v0.pt(), recPhi.M()); isCountedK0S.at(2) = true; } } @@ -1274,23 +1274,23 @@ struct phik0shortanalysis { if (!selectionPion(track)) continue; - if (std::abs(track.rapidity(massPi)) > cfgyAcceptance) + if (std::abs(track.rapidity(massPi)) > cfgYAcceptance) continue; if (!isCountedPi.at(0)) { - closureMCPhipurHist.fill(HIST("h3MCPhipurPiInvMassInc"), genmultiplicity, track.pt(), recPhi.M()); + closureMCPhiHist.fill(HIST("h3MCPhipurPiInvMassInc"), genmultiplicity, track.pt(), recPhi.M()); isCountedPi.at(0) = true; } - if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgFirstCutonDeltay) + if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgFCutOnDeltaY) continue; if (!isCountedPi.at(1)) { - closureMCPhipurHist.fill(HIST("h3MCPhipurPiInvMassFCut"), genmultiplicity, track.pt(), recPhi.M()); + closureMCPhiHist.fill(HIST("h3MCPhipurPiInvMassFCut"), genmultiplicity, track.pt(), recPhi.M()); isCountedPi.at(1) = true; } - if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgSecondCutonDeltay) + if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgSCutOnDeltaY) continue; if (!isCountedPi.at(2)) { - closureMCPhipurHist.fill(HIST("h3MCPhipurPiInvMassSCut"), genmultiplicity, track.pt(), recPhi.M()); + closureMCPhiHist.fill(HIST("h3MCPhipurPiInvMassSCut"), genmultiplicity, track.pt(), recPhi.M()); isCountedPi.at(2) = true; } } @@ -1298,7 +1298,7 @@ struct phik0shortanalysis { } } - PROCESS_SWITCH(phik0shortanalysis, processRecMCClosurePhiQA, "Process for ReCMCQA and Phi in RecMCClosure", false); + PROCESS_SWITCH(Phik0shortanalysis, processRecMCClosurePhiQA, "Process for ReCMCQA and Phi in RecMCClosure", false); void processRecMCClosurePhiK0S(SimCollisions::iterator const& collision, FullMCTracks const&, FullV0s const& V0s, V0DauMCTracks const&, MCCollisions const&) { @@ -1323,7 +1323,7 @@ struct phik0shortanalysis { if (!selectionV0(v0, posDaughterTrack, negDaughterTrack)) continue; - if (std::abs(v0.yK0Short()) > cfgyAcceptance) + if (std::abs(v0.yK0Short()) > cfgYAcceptance) continue; std::vector listrecPhi; @@ -1346,17 +1346,17 @@ struct phik0shortanalysis { TLorentzVector recPhi = recMother(track1, track2, massKa, massKa); - if (recPhi.M() < lowmPhi || recPhi.M() > upmPhi) + if (recPhi.M() < lowMPhi || recPhi.M() > upMPhi) continue; - if (std::abs(recPhi.Rapidity()) > cfgyAcceptance) + if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) continue; listrecPhi.push_back(recPhi); counts.at(0)++; - if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgFirstCutonDeltay) + if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgFCutOnDeltaY) continue; counts.at(1)++; - if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgSecondCutonDeltay) + if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgSCutOnDeltaY) continue; counts.at(2)++; } @@ -1371,7 +1371,7 @@ struct phik0shortanalysis { } } - PROCESS_SWITCH(phik0shortanalysis, processRecMCClosurePhiK0S, "Process RecMC for MCClosure Phi-K0S Analysis", false); + PROCESS_SWITCH(Phik0shortanalysis, processRecMCClosurePhiK0S, "Process RecMC for MCClosure Phi-K0S Analysis", false); void processRecMCClosurePhiPion(SimCollisions::iterator const& collision, FullMCTracks const& fullMCTracks, MCCollisions const&) { @@ -1395,7 +1395,7 @@ struct phik0shortanalysis { if (!selectionPion(track)) continue; - if (std::abs(track.rapidity(massPi)) > cfgyAcceptance) + if (std::abs(track.rapidity(massPi)) > cfgYAcceptance) continue; std::vector listrecPhi; @@ -1418,17 +1418,17 @@ struct phik0shortanalysis { TLorentzVector recPhi = recMother(track1, track2, massKa, massKa); - if (recPhi.M() < lowmPhi || recPhi.M() > upmPhi) + if (recPhi.M() < lowMPhi || recPhi.M() > upMPhi) continue; - if (std::abs(recPhi.Rapidity()) > cfgyAcceptance) + if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) continue; listrecPhi.push_back(recPhi); counts.at(0)++; - if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgFirstCutonDeltay) + if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgFCutOnDeltaY) continue; counts.at(1)++; - if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgSecondCutonDeltay) + if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgSCutOnDeltaY) continue; counts.at(2)++; } @@ -1443,18 +1443,18 @@ struct phik0shortanalysis { } } - PROCESS_SWITCH(phik0shortanalysis, processRecMCClosurePhiPion, "Process RecMC for MCClosure Phi-Pion Analysis", false); + PROCESS_SWITCH(Phik0shortanalysis, processRecMCClosurePhiPion, "Process RecMC for MCClosure Phi-Pion Analysis", false); void processGenMCPhiQA(MCCollisions::iterator const& mcCollision, soa::SmallGroups const& collisions, aod::McParticles const& mcParticles) { - MCeventHist.fill(HIST("hGenMCEventSelection"), 0); // all collisions - if (std::abs(mcCollision.posZ()) > cutzvertex) + mcEventHist.fill(HIST("hGenMCEventSelection"), 0); // all collisions + if (std::abs(mcCollision.posZ()) > cutZVertex) return; - MCeventHist.fill(HIST("hGenMCEventSelection"), 1); // vertex-Z selected - MCeventHist.fill(HIST("hGenMCVertexZ"), mcCollision.posZ()); + mcEventHist.fill(HIST("hGenMCEventSelection"), 1); // vertex-Z selected + mcEventHist.fill(HIST("hGenMCVertexZ"), mcCollision.posZ()); if (!pwglf::isINELgtNmc(mcParticles, 0, pdgDB)) return; - MCeventHist.fill(HIST("hGenMCEventSelection"), 2); // INEL>0 collisions + mcEventHist.fill(HIST("hGenMCEventSelection"), 2); // INEL>0 collisions bool isAssocColl = false; for (const auto& collision : collisions) { @@ -1465,7 +1465,7 @@ struct phik0shortanalysis { } float genmultiplicity = mcCollision.centFT0M(); - MCeventHist.fill(HIST("hGenMCMultiplicityPercent"), genmultiplicity); + mcEventHist.fill(HIST("hGenMCMultiplicityPercent"), genmultiplicity); bool isCountedPhi = false; @@ -1484,19 +1484,19 @@ struct phik0shortanalysis { } if (!isPosKaon || !isNegKaon) continue; - if (std::abs(mcParticle1.y()) > cfgyAcceptance) + if (std::abs(mcParticle1.y()) > cfgYAcceptance) continue; if (!isCountedPhi) { - MCeventHist.fill(HIST("hGenMCEventSelection"), 3); // at least a Phi in the event + mcEventHist.fill(HIST("hGenMCEventSelection"), 3); // at least a Phi in the event if (isAssocColl) - MCeventHist.fill(HIST("hGenMCEventSelection"), 4); // with at least a reco collision + mcEventHist.fill(HIST("hGenMCEventSelection"), 4); // with at least a reco collision isCountedPhi = true; } - PhieffHist.fill(HIST("h1PhiGenMC"), genmultiplicity); + mcPhiHist.fill(HIST("h1PhiGenMC"), genmultiplicity); if (isAssocColl) - PhieffHist.fill(HIST("h1PhiGenMCAssocReco"), genmultiplicity); + mcPhiHist.fill(HIST("h1PhiGenMCAssocReco"), genmultiplicity); std::array isCountedK0S = {false, false, false}; @@ -1518,28 +1518,28 @@ struct phik0shortanalysis { if (!isPosPion || !isNegPion) continue; - if (std::abs(mcParticle2.y()) > cfgyAcceptance) + if (std::abs(mcParticle2.y()) > cfgYAcceptance) continue; if (!isCountedK0S.at(0)) { - PhieffHist.fill(HIST("h2PhieffK0SGenMCInc"), genmultiplicity, mcParticle2.pt()); + mcPhiHist.fill(HIST("h2PhieffK0SGenMCInc"), genmultiplicity, mcParticle2.pt()); if (isAssocColl) - PhieffHist.fill(HIST("h2PhieffK0SGenMCFCutAssocReco"), genmultiplicity, mcParticle2.pt()); + mcPhiHist.fill(HIST("h2PhieffK0SGenMCFCutAssocReco"), genmultiplicity, mcParticle2.pt()); isCountedK0S.at(0) = true; } - if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgFirstCutonDeltay) + if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgFCutOnDeltaY) continue; if (!isCountedK0S.at(1)) { - PhieffHist.fill(HIST("h2PhieffK0SGenMCFCut"), genmultiplicity, mcParticle2.pt()); + mcPhiHist.fill(HIST("h2PhieffK0SGenMCFCut"), genmultiplicity, mcParticle2.pt()); if (isAssocColl) - PhieffHist.fill(HIST("h2PhieffK0SGenMCFCutAssocReco"), genmultiplicity, mcParticle2.pt()); + mcPhiHist.fill(HIST("h2PhieffK0SGenMCFCutAssocReco"), genmultiplicity, mcParticle2.pt()); isCountedK0S.at(1) = true; } - if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgSecondCutonDeltay) + if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgSCutOnDeltaY) continue; if (!isCountedK0S.at(2)) { - PhieffHist.fill(HIST("h2PhieffK0SGenMCSCut"), genmultiplicity, mcParticle2.pt()); + mcPhiHist.fill(HIST("h2PhieffK0SGenMCSCut"), genmultiplicity, mcParticle2.pt()); if (isAssocColl) - PhieffHist.fill(HIST("h2PhieffK0SGenMCSCutAssocReco"), genmultiplicity, mcParticle2.pt()); + mcPhiHist.fill(HIST("h2PhieffK0SGenMCSCutAssocReco"), genmultiplicity, mcParticle2.pt()); isCountedK0S.at(2) = true; } } @@ -1552,39 +1552,39 @@ struct phik0shortanalysis { if (!mcParticle2.isPhysicalPrimary()) continue; - if (std::abs(mcParticle2.y()) > cfgyAcceptance) + if (std::abs(mcParticle2.y()) > cfgYAcceptance) continue; if (!isCountedPi.at(0)) { - PhieffHist.fill(HIST("h2PhieffPiGenMCInc"), genmultiplicity, mcParticle2.pt()); + mcPhiHist.fill(HIST("h2PhieffPiGenMCInc"), genmultiplicity, mcParticle2.pt()); if (isAssocColl) - PhieffHist.fill(HIST("h2PhieffPiGenMCIncAssocReco"), genmultiplicity, mcParticle2.pt()); + mcPhiHist.fill(HIST("h2PhieffPiGenMCIncAssocReco"), genmultiplicity, mcParticle2.pt()); isCountedPi.at(0) = true; } - if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgFirstCutonDeltay) + if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgFCutOnDeltaY) continue; if (!isCountedPi.at(1)) { - PhieffHist.fill(HIST("h2PhieffPiGenMCFCut"), genmultiplicity, mcParticle2.pt()); + mcPhiHist.fill(HIST("h2PhieffPiGenMCFCut"), genmultiplicity, mcParticle2.pt()); if (isAssocColl) - PhieffHist.fill(HIST("h2PhieffPiGenMCFCutAssocReco"), genmultiplicity, mcParticle2.pt()); + mcPhiHist.fill(HIST("h2PhieffPiGenMCFCutAssocReco"), genmultiplicity, mcParticle2.pt()); isCountedPi.at(1) = true; } - if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgSecondCutonDeltay) + if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgSCutOnDeltaY) continue; if (!isCountedPi.at(2)) { - PhieffHist.fill(HIST("h2PhieffPiGenMCSCut"), genmultiplicity, mcParticle2.pt()); + mcPhiHist.fill(HIST("h2PhieffPiGenMCSCut"), genmultiplicity, mcParticle2.pt()); if (isAssocColl) - PhieffHist.fill(HIST("h2PhieffPiGenMCSCutAssocReco"), genmultiplicity, mcParticle2.pt()); + mcPhiHist.fill(HIST("h2PhieffPiGenMCSCutAssocReco"), genmultiplicity, mcParticle2.pt()); isCountedPi.at(2) = true; } } } } - PROCESS_SWITCH(phik0shortanalysis, processGenMCPhiQA, "Process for ReCMCQA and Phi in RecMC", false); + PROCESS_SWITCH(Phik0shortanalysis, processGenMCPhiQA, "Process for ReCMCQA and Phi in RecMC", false); void processGenMCPhiK0S(MCCollisions::iterator const& mcCollision, soa::SmallGroups const& collisions, aod::McParticles const& mcParticles) { - if (std::abs(mcCollision.posZ()) > cutzvertex) + if (std::abs(mcCollision.posZ()) > cutZVertex) return; if (!pwglf::isINELgtNmc(mcParticles, 0, pdgDB)) return; @@ -1598,7 +1598,7 @@ struct phik0shortanalysis { } float genmultiplicity = mcCollision.centFT0M(); - MCeventHist.fill(HIST("hGenMCMultiplicityPercent"), genmultiplicity); + mcEventHist.fill(HIST("hGenMCMultiplicityPercent"), genmultiplicity); for (const auto& mcParticle1 : mcParticles) { if (mcParticle1.pdgCode() != 310) @@ -1617,12 +1617,12 @@ struct phik0shortanalysis { } if (!isPosPion || !isNegPion) continue; - if (std::abs(mcParticle1.y()) > cfgyAcceptance) + if (std::abs(mcParticle1.y()) > cfgYAcceptance) continue; - K0SeffHist.fill(HIST("h2K0SGenMC"), genmultiplicity, mcParticle1.pt()); + mcK0SHist.fill(HIST("h2K0SGenMC"), genmultiplicity, mcParticle1.pt()); if (isAssocColl) - K0SeffHist.fill(HIST("h2K0SGenMCAssocReco"), genmultiplicity, mcParticle1.pt()); + mcK0SHist.fill(HIST("h2K0SGenMCAssocReco"), genmultiplicity, mcParticle1.pt()); std::array isCountedPhi = {false, false, false}; @@ -1642,39 +1642,39 @@ struct phik0shortanalysis { if (!isPosKaon || !isNegKaon) continue; - if (std::abs(mcParticle2.y()) > cfgyAcceptance) + if (std::abs(mcParticle2.y()) > cfgYAcceptance) continue; if (!isCountedPhi.at(0)) { - MCPhiK0SHist.fill(HIST("h2PhiK0SGenMCInc"), genmultiplicity, mcParticle1.pt()); + mcPhiK0SHist.fill(HIST("h2PhiK0SGenMCInc"), genmultiplicity, mcParticle1.pt()); if (isAssocColl) - MCPhiK0SHist.fill(HIST("h2PhiK0SGenMCIncAssocReco"), genmultiplicity, mcParticle1.pt()); + mcPhiK0SHist.fill(HIST("h2PhiK0SGenMCIncAssocReco"), genmultiplicity, mcParticle1.pt()); isCountedPhi.at(0) = true; } - if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgFirstCutonDeltay) + if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgFCutOnDeltaY) continue; if (!isCountedPhi.at(1)) { - MCPhiK0SHist.fill(HIST("h2PhiK0SGenMCFCut"), genmultiplicity, mcParticle1.pt()); + mcPhiK0SHist.fill(HIST("h2PhiK0SGenMCFCut"), genmultiplicity, mcParticle1.pt()); if (isAssocColl) - MCPhiK0SHist.fill(HIST("h2PhiK0SGenMCFCutAssocReco"), genmultiplicity, mcParticle1.pt()); + mcPhiK0SHist.fill(HIST("h2PhiK0SGenMCFCutAssocReco"), genmultiplicity, mcParticle1.pt()); isCountedPhi.at(1) = true; } - if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgSecondCutonDeltay) + if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgSCutOnDeltaY) continue; if (!isCountedPhi.at(2)) { - MCPhiK0SHist.fill(HIST("h2PhiK0SGenMCSCut"), genmultiplicity, mcParticle1.pt()); + mcPhiK0SHist.fill(HIST("h2PhiK0SGenMCSCut"), genmultiplicity, mcParticle1.pt()); if (isAssocColl) - MCPhiK0SHist.fill(HIST("h2PhiK0SGenMCSCutAssocReco"), genmultiplicity, mcParticle1.pt()); + mcPhiK0SHist.fill(HIST("h2PhiK0SGenMCSCutAssocReco"), genmultiplicity, mcParticle1.pt()); isCountedPhi.at(2) = true; } } } } - PROCESS_SWITCH(phik0shortanalysis, processGenMCPhiK0S, "Process GenMC for Phi-K0S Analysis", false); + PROCESS_SWITCH(Phik0shortanalysis, processGenMCPhiK0S, "Process GenMC for Phi-K0S Analysis", false); void processGenMCPhiPion(MCCollisions::iterator const& mcCollision, soa::SmallGroups const& collisions, aod::McParticles const& mcParticles) { - if (std::abs(mcCollision.posZ()) > cutzvertex) + if (std::abs(mcCollision.posZ()) > cutZVertex) return; if (!pwglf::isINELgtNmc(mcParticles, 0, pdgDB)) return; @@ -1688,19 +1688,19 @@ struct phik0shortanalysis { } float genmultiplicity = mcCollision.centFT0M(); - MCeventHist.fill(HIST("hGenMCMultiplicityPercent"), genmultiplicity); + mcEventHist.fill(HIST("hGenMCMultiplicityPercent"), genmultiplicity); for (const auto& mcParticle1 : mcParticles) { if (std::abs(mcParticle1.pdgCode()) != 211) continue; if (!mcParticle1.isPhysicalPrimary()) continue; - if (std::abs(mcParticle1.y()) > cfgyAcceptance) + if (std::abs(mcParticle1.y()) > cfgYAcceptance) continue; - PioneffHist.fill(HIST("h2PiGenMC"), genmultiplicity, mcParticle1.pt()); + mcPionHist.fill(HIST("h2PiGenMC"), genmultiplicity, mcParticle1.pt()); if (isAssocColl) - PioneffHist.fill(HIST("h2PiGenMCAssocReco"), genmultiplicity, mcParticle1.pt()); + mcPionHist.fill(HIST("h2PiGenMCAssocReco"), genmultiplicity, mcParticle1.pt()); std::array isCountedPhi = {false, false, false}; @@ -1720,39 +1720,39 @@ struct phik0shortanalysis { if (!isPosKaon || !isNegKaon) continue; - if (std::abs(mcParticle2.y()) > cfgyAcceptance) + if (std::abs(mcParticle2.y()) > cfgYAcceptance) continue; if (!isCountedPhi.at(0)) { - MCPhiPionHist.fill(HIST("h2PhiPiGenMCInc"), genmultiplicity, mcParticle1.pt()); + mcPhiPionHist.fill(HIST("h2PhiPiGenMCInc"), genmultiplicity, mcParticle1.pt()); if (isAssocColl) - MCPhiPionHist.fill(HIST("h2PhiPiGenMCIncAssocReco"), genmultiplicity, mcParticle1.pt()); + mcPhiPionHist.fill(HIST("h2PhiPiGenMCIncAssocReco"), genmultiplicity, mcParticle1.pt()); isCountedPhi.at(0) = true; } - if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgFirstCutonDeltay) + if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgFCutOnDeltaY) continue; if (!isCountedPhi.at(1)) { - MCPhiPionHist.fill(HIST("h2PhiPiGenMCFCut"), genmultiplicity, mcParticle1.pt()); + mcPhiPionHist.fill(HIST("h2PhiPiGenMCFCut"), genmultiplicity, mcParticle1.pt()); if (isAssocColl) - MCPhiPionHist.fill(HIST("h2PhiPiGenMCFCutAssocReco"), genmultiplicity, mcParticle1.pt()); + mcPhiPionHist.fill(HIST("h2PhiPiGenMCFCutAssocReco"), genmultiplicity, mcParticle1.pt()); isCountedPhi.at(1) = true; } - if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgSecondCutonDeltay) + if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgSCutOnDeltaY) continue; if (!isCountedPhi.at(2)) { - MCPhiPionHist.fill(HIST("h2PhiPiGenMCSCut"), genmultiplicity, mcParticle1.pt()); + mcPhiPionHist.fill(HIST("h2PhiPiGenMCSCut"), genmultiplicity, mcParticle1.pt()); if (isAssocColl) - MCPhiPionHist.fill(HIST("h2PhiPiGenMCSCutAssocReco"), genmultiplicity, mcParticle1.pt()); + mcPhiPionHist.fill(HIST("h2PhiPiGenMCSCutAssocReco"), genmultiplicity, mcParticle1.pt()); isCountedPhi.at(2) = true; } } } } - PROCESS_SWITCH(phik0shortanalysis, processGenMCPhiPion, "Process GenMC for Phi-Pion Analysis", false); + PROCESS_SWITCH(Phik0shortanalysis, processGenMCPhiPion, "Process GenMC for Phi-Pion Analysis", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"lf-phik0shortanalysis"})}; + adaptAnalysisTask(cfgc)}; } diff --git a/PWGUD/TableProducer/UPCCandidateProducer.cxx b/PWGUD/TableProducer/UPCCandidateProducer.cxx index f93bea732b4..360f82113bb 100644 --- a/PWGUD/TableProducer/UPCCandidateProducer.cxx +++ b/PWGUD/TableProducer/UPCCandidateProducer.cxx @@ -1600,28 +1600,41 @@ struct UpcCandProducer { std::vector selTrackIdsGlobal{}; - // storing n-prong matches int32_t candID = 0; - auto midIt = bcsMatchedTrIdsMID.begin(); + for (auto& pair : bcsMatchedTrIdsGlobal) { // candidates with MFT auto globalBC = static_cast(pair.first); - const auto& fwdTrackIDs = pair.second; + const auto& fwdTrackIDs = pair.second; // Forward tracks uint32_t nMFTs = fwdTrackIDs.size(); - if (nMFTs > fNFwdProngs) // too many tracks - continue; std::vector trkCandIDs{}; - const auto& midTrackIDs = midIt->second; // to retrieve corresponding MCH-MID tracks + + // Find corresponding midTrackIDs using std::find_if + auto midIt = std::find_if(bcsMatchedTrIdsMID.begin(), bcsMatchedTrIdsMID.end(), + [globalBC](const auto& midPair) { + return midPair.first == static_cast(globalBC); + }); + + const auto* midTrackIDs = (midIt != bcsMatchedTrIdsMID.end()) ? &midIt->second : nullptr; + + if (nMFTs > fNFwdProngs) // Skip if too many tracks + continue; + if (nMFTs == fNFwdProngs) { + for (auto iMft : fwdTrackIDs) { auto trk = fwdTracks.iteratorAt(iMft); auto trkEta = trk.eta(); - if (trkEta > fMinEtaMFT && trkEta < fMaxEtaMFT) { // If the track is in the MFT acceptance, store the global track - trkCandIDs.insert(trkCandIDs.end(), fwdTrackIDs.begin(), fwdTrackIDs.end()); - } else { // If the track is not in the MFT acceptance, store the MCH-MID track - trkCandIDs.insert(trkCandIDs.end(), midTrackIDs.begin(), midTrackIDs.end()); + + if (trkEta > fMinEtaMFT && trkEta < fMaxEtaMFT) { + // Track is within MFT acceptance, store forward track IDs + trkCandIDs.push_back(iMft); + } else if (midTrackIDs) { + // Track is outside MFT acceptance, store corresponding MID track IDs + trkCandIDs.insert(trkCandIDs.end(), midTrackIDs->begin(), midTrackIDs->end()); } } } + uint64_t closestBcMCH = 0; upchelpers::FITInfo fitInfo{}; fitInfo.timeFT0A = -999.f; @@ -1732,7 +1745,6 @@ struct UpcCandProducer { amplitudesV0A, relBCsV0A); candID++; - midIt++; trkCandIDs.clear(); } diff --git a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx index 647b999b5a2..f5a44f5848e 100644 --- a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx +++ b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx @@ -8,12 +8,14 @@ // 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. -// \Single Gap Event Analyzer -// \author Anantha Padmanabhan M Nair, anantha.manoj.nair@cern.ch -// \since May 2024 + +/// \file exclusiveRhoTo4Pi.cxx +/// \brief Task for analyzing exclusive rho decays to 4 pions +/// \author Anantha Padmanabhan M Nair #include #include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -37,36 +39,36 @@ using namespace o2::framework; using namespace o2::framework::expressions; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -struct exclusiveRhoTo4Pi { +struct exclusiveRhoTo4Pi { // o2-linter: disable=name/workflow-file,name/struct SGSelector sgSelector; HistogramRegistry histos{"HistoReg", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Configurable FV0_cut{"FV0", 50., "FV0A threshold"}; - Configurable FT0A_cut{"FT0A", 150., "FT0A threshold"}; - Configurable FT0C_cut{"FT0C", 50., "FT0C threshold"}; - Configurable FDDA_cut{"FDDA", 10000., "FDDA threshold"}; - Configurable FDDC_cut{"FDDC", 10000., "FDDC threshold"}; - Configurable ZDC_cut{"ZDC", 10., "ZDC threshold"}; - - Configurable PV_cut{"PV_cut", 1.0, "Use Only PV tracks"}; - Configurable dcaZ_cut{"dcaZ_cut", 3.2, "dcaZ cut"}; - Configurable dcaXY_cut{"dcaXY_cut", 2.4, "dcaXY cut (0 for Pt-function)"}; - Configurable tpcChi2_cut{"tpcChi2_cut", 4, "Max tpcChi2NCl"}; - Configurable tpcNClsFindable_cut{"tpcNClsFindable_cut", 80, "Min tpcNClsFindable"}; - Configurable itsChi2_cut{"itsChi2_cut", 36, "Max itsChi2NCl"}; - Configurable eta_cut{"eta_cut", 0.9, "Track Pseudorapidity"}; - Configurable pt_cut{"pt_cut", 0, "Track Pt"}; - - Configurable nSigmaTPC_cut{"nsigmatpccut", 3, "TPC cut"}; - Configurable nSigmaTOF_cut{"nsigmatofcut", 3, "TOF cut"}; - Configurable StrictEventSelection{"StrictEventSelection", true, "Event Selection"}; - - Configurable nBins_pT{"nBins_pT", 1000, "Number of bins for pT"}; - Configurable nBins_IM{"nBins_IM", 1000, "Number of bins for Invariant Mass"}; - Configurable nBins_y{"nBins_y", 1000, "Number of bins for Rapidity"}; - Configurable nBins_Phi{"nBins_phi", 360, "Number of bins for Phi"}; - Configurable nBins_CosTheta{"nBins_cosTheta", 360, "Number of bins for cos Theta"}; + Configurable fv0Cut{"fv0Cut", 50., "FV0A threshold"}; + Configurable ft0aCut{"ft0aCut", 150., "FT0A threshold"}; + Configurable ft0cCut{"ft0cCut", 50., "FT0C threshold"}; + Configurable fddaCut{"fddaCut", 10000., "FDDA threshold"}; + Configurable fddcCut{"fddcCut", 10000., "FDDC threshold"}; + Configurable zdcCut{"zdcCut", 10., "ZDC threshold"}; + + Configurable pvCut{"pvCut", 1.0, "Use Only PV tracks"}; + Configurable dcaZcut{"dcaZcut", 3.2, "dcaZ cut"}; + Configurable dcaXYcut{"dcaXYcut", 2.4, "dcaXY cut (0 for Pt-function)"}; + Configurable tpcChi2Cut{"tpcChi2Cut", 4, "Max tpcChi2NCl"}; + Configurable tpcNClsFindableCut{"tpcNClsFindableCut", 80, "Min tpcNClsFindable"}; + Configurable itsChi2Cut{"itsChi2Cut", 36, "Max itsChi2NCl"}; + Configurable etaCut{"etaCut", 0.9, "Track Pseudorapidity"}; + Configurable pTcut{"pTcut", 0, "Track Pt"}; + + Configurable nSigmaTPCcut{"nSigmaTPCcut", 3, "TPC cut"}; + Configurable nSigmaTOFcut{"nSigmaTOFcut", 3, "TOF cut"}; + Configurable strictEventSelection{"strictEventSelection", true, "Event Selection"}; + + Configurable nBinsPt{"nBinsPt", 1000, "Number of bins for pT"}; + Configurable nBinsInvariantMass{"nBinsInvariantMass", 1000, "Number of bins for Invariant Mass"}; + Configurable nBinsRapidity{"nBinsRapidity", 1000, "Number of bins for Rapidity"}; + Configurable nBinsPhi{"nBinsPhi", 360, "Number of bins for Phi"}; + Configurable nBinsCosTheta{"nBinsCosTheta", 360, "Number of bins for cos Theta"}; //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // Begin of Init Function----------------------------------------------------------------------------------------------------------------------------------------------------- @@ -75,7 +77,7 @@ struct exclusiveRhoTo4Pi { histos.add("GapSide", "Gap Side; Events", kTH1F, {{4, -1.5, 2.5}}); histos.add("TrueGapSide", "Gap Side; Events", kTH1F, {{4, -1.5, 2.5}}); - histos.add("EventCounts", "Total Events; Events", kTH1F, {{10, 0, 10}}); // 2=#Events, 3= #Selected Events, 5=#Selected Events with Zero Net charge, 6=Selected Events with Non-Zero Net charge + histos.add("EventCounts", "Total Events; Events", kTH1F, {{10, 0, 10}}); // TPC nSigma histos.add("tpcNSigmaPi_WOTS", "TPC nSigma Pion without track selection; Events", kTH1F, {{1000, -15, 15}}); @@ -100,15 +102,15 @@ struct exclusiveRhoTo4Pi { histos.add("tofNSigmaPi_WTS_PID_Pi_Mu", "TOF nSigma Muon with track selection and PID Selection of Pion; Entries", kTH1F, {{1000, -15, 15}}); // Track Transverse Momentum - histos.add("pT_track_WOTS", "pT without track selection; pT [GeV/c]; Events", kTH1F, {{nBins_pT, 0, 2}}); - histos.add("pT_track_WTS", "pT with track selection; pT [GeV/c]; Events", kTH1F, {{nBins_pT, 0, 2}}); - histos.add("pT_track_WTS_PID_Pi", "pT with track selection and PID selection of Pi; pT [GeV/c]; Events", kTH1F, {{nBins_pT, 0, 2}}); + histos.add("pT_track_WOTS", "pT without track selection; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); + histos.add("pT_track_WTS", "pT with track selection; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); + histos.add("pT_track_WTS_PID_Pi", "pT with track selection and PID selection of Pi; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); // Zero charge Event Transverse Momentum - histos.add("pT_event_0charge_WTS_PID_Pi", "Event pT in 0 Charge Events With Track Selection and PID Selection of Pi; pT [GeV/c]; Counts", kTH1F, {{nBins_pT, 0, 2}}); + histos.add("pT_event_0charge_WTS_PID_Pi", "Event pT in 0 Charge Events With Track Selection and PID Selection of Pi; pT [GeV/c]; Counts", kTH1F, {{nBinsPt, 0, 2}}); // Non Zero charge Event Transverse Momentum - histos.add("pT_event_non0charge_WTS_PID_Pi", "Event pT in Non 0 Charge Events With Track Selection and PID Selection of Pi; pT [GeV/c]; Counts", kTH1F, {{nBins_pT, 0, 2}}); + histos.add("pT_event_non0charge_WTS_PID_Pi", "Event pT in Non 0 Charge Events With Track Selection and PID Selection of Pi; pT [GeV/c]; Counts", kTH1F, {{nBinsPt, 0, 2}}); // Rapidity of 0 charge Events histos.add("rapidity_event_0charge_WTS_PID_Pi_domainA", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} < 0.15 GeV/c; y; Counts", kTH1F, {{1000, -2.5, 2.5}}); @@ -116,19 +118,19 @@ struct exclusiveRhoTo4Pi { histos.add("rapidity_event_0charge_WTS_PID_Pi_domainC", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} > 0.80 GeV/c; y; Counts", kTH1F, {{1000, -2.5, 2.5}}); // Rapidity of non 0 charge Events - histos.add("rapidity_event_non0charge_WTS_PID_Pi_domainA", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} < 0.15 GeV/c; y; Counts", kTH1F, {{nBins_y, -2.5, 2.5}}); - histos.add("rapidity_event_non0charge_WTS_PID_Pi_domainB", "Rapidity of Events With Track Selection and PID Selection of Pi for 0.15< p_{T} < 0.80 GeV/c$; y; Counts", kTH1F, {{nBins_y, -2.5, 2.5}}); - histos.add("rapidity_event_non0charge_WTS_PID_Pi_domainC", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} > 0.80 GeV/c; y; Counts", kTH1F, {{nBins_y, -2.5, 2.5}}); + histos.add("rapidity_event_non0charge_WTS_PID_Pi_domainA", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} < 0.15 GeV/c; y; Counts", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); + histos.add("rapidity_event_non0charge_WTS_PID_Pi_domainB", "Rapidity of Events With Track Selection and PID Selection of Pi for 0.15< p_{T} < 0.80 GeV/c$; y; Counts", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); + histos.add("rapidity_event_non0charge_WTS_PID_Pi_domainC", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} > 0.80 GeV/c; y; Counts", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); // Invariant Mass of 0 charge events - histos.add("invMass_event_0charge_WTS_PID_Pi_domainA", "Invariant Mass Distribution of 0 charge Events with PID Selection of Pi for p_{T} < 0.15 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBins_IM, 0.8, 2.5}}); // pT < 0.15GeV - histos.add("invMass_event_0charge_WTS_PID_Pi_domainB", "Invariant Mass Distribution of 0 charge Events with PID Selection of Pi for 0.15< p_{T} < 0.80 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBins_IM, 0.8, 2.5}}); // 0.15GeV < pT < 0.8GeV - histos.add("invMass_event_0charge_WTS_PID_Pi_domainC", "Invariant Mass Distribution of 0 charge Events with PID Selection of Pi for p_{T} > 0.80 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBins_IM, 0.8, 2.5}}); // 0.8GeV < pT + histos.add("invMass_event_0charge_WTS_PID_Pi_domainA", "Invariant Mass Distribution of 0 charge Events with PID Selection of Pi for p_{T} < 0.15 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBinsInvariantMass, 0.8, 2.5}}); // pT < 0.15GeV + histos.add("invMass_event_0charge_WTS_PID_Pi_domainB", "Invariant Mass Distribution of 0 charge Events with PID Selection of Pi for 0.15< p_{T} < 0.80 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBinsInvariantMass, 0.8, 2.5}}); // 0.15GeV < pT < 0.8GeV + histos.add("invMass_event_0charge_WTS_PID_Pi_domainC", "Invariant Mass Distribution of 0 charge Events with PID Selection of Pi for p_{T} > 0.80 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBinsInvariantMass, 0.8, 2.5}}); // 0.8GeV < pT // Invariant mass of non 0 charge events - histos.add("invMass_event_non0charge_WTS_PID_Pi_domainA", "Invariant Mass Distribution of non 0 charge Events with PID Selection of Pi for p_{T} < 0.15 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBins_IM, 0.8, 2.5}}); // pT < 0.15GeV - histos.add("invMass_event_non0charge_WTS_PID_Pi_domainB", "Invariant Mass Distribution of non 0 charge Events with PID Selection of Pi for 0.15< p_{T} < 0.80 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBins_IM, 0.8, 2.5}}); // 0.15GeV < pT < 0.8GeV - histos.add("invMass_event_non0charge_WTS_PID_Pi_domainC", "Invariant Mass Distribution of non 0 charge Events with PID Selection of Pi for p_{T} > 0.80 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBins_IM, 0.8, 2.5}}); // 0.8GeV < pT + histos.add("invMass_event_non0charge_WTS_PID_Pi_domainA", "Invariant Mass Distribution of non 0 charge Events with PID Selection of Pi for p_{T} < 0.15 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBinsInvariantMass, 0.8, 2.5}}); // pT < 0.15GeV + histos.add("invMass_event_non0charge_WTS_PID_Pi_domainB", "Invariant Mass Distribution of non 0 charge Events with PID Selection of Pi for 0.15< p_{T} < 0.80 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBinsInvariantMass, 0.8, 2.5}}); // 0.15GeV < pT < 0.8GeV + histos.add("invMass_event_non0charge_WTS_PID_Pi_domainC", "Invariant Mass Distribution of non 0 charge Events with PID Selection of Pi for p_{T} > 0.80 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBinsInvariantMass, 0.8, 2.5}}); // 0.8GeV < pT // tpc signal histos.add("tpcSignal", "TPC dEdx vs p; p [GeV/c]; dEdx [a.u.]", kTH2F, {{500, 0, 10}, {5000, 0.0, 5000.0}}); @@ -146,30 +148,30 @@ struct exclusiveRhoTo4Pi { histos.add("V0A", "V0A amplitude", kTH1F, {{1000, 0.0, 100}}); // Collin Soper Theta and Phi - histos.add("CS_phi_pair_1", "#phi Distribution; #phi; Entries", kTH1F, {{nBins_Phi, -3.2, 3.2}}); - histos.add("CS_phi_pair_2", "#phi Distribution; #phi; Entries", kTH1F, {{nBins_Phi, -3.2, 3.2}}); - histos.add("CS_costheta_pair_1", "#theta Distribution;cos(#theta); Entries", kTH1F, {{nBins_CosTheta, -1, 1}}); - histos.add("CS_costheta_pair_2", "#theta Distribution;cos(#theta); Entries", kTH1F, {{nBins_CosTheta, -1, 1}}); + histos.add("CS_phi_pair_1", "#phi Distribution; #phi; Entries", kTH1F, {{nBinsPhi, -3.2, 3.2}}); + histos.add("CS_phi_pair_2", "#phi Distribution; #phi; Entries", kTH1F, {{nBinsPhi, -3.2, 3.2}}); + histos.add("CS_costheta_pair_1", "#theta Distribution;cos(#theta); Entries", kTH1F, {{nBinsCosTheta, -1, 1}}); + histos.add("CS_costheta_pair_2", "#theta Distribution;cos(#theta); Entries", kTH1F, {{nBinsCosTheta, -1, 1}}); } // End of init function //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - using udtracks = soa::Join; - using udtracksfull = soa::Join; + // using udtracks = soa::Join; + using UDtracksfull = soa::Join; using UDCollisionsFull = soa::Join; // using UDCollisionFull = UDCollisionsFull::iterator; //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // Calculate the Collins-Soper Frame---------------------------------------------------------------------------------------------------------------------------- - Double_t CosThetaCollinsSoperFrame(ROOT::Math::PtEtaPhiMVector pair1, ROOT::Math::PtEtaPhiMVector pair2, ROOT::Math::PtEtaPhiMVector fourpion) + double cosThetaCollinsSoperFrame(ROOT::Math::PtEtaPhiMVector pair1, ROOT::Math::PtEtaPhiMVector pair2, ROOT::Math::PtEtaPhiMVector fourpion) { - Double_t HalfSqrtSnn = 2680.; - Double_t MassOfLead208 = 193.6823; - Double_t MomentumBeam = TMath::Sqrt(HalfSqrtSnn * HalfSqrtSnn * 208 * 208 - MassOfLead208 * MassOfLead208); + double halfSqrtSnn = 2680.; + double massOfLead208 = 193.6823; + double momentumBeam = std::sqrt(halfSqrtSnn * halfSqrtSnn * 208 * 208 - massOfLead208 * massOfLead208); - TLorentzVector pProjCM(0., 0., -MomentumBeam, HalfSqrtSnn * 208); // projectile - TLorentzVector pTargCM(0., 0., MomentumBeam, HalfSqrtSnn * 208); // target + TLorentzVector pProjCM(0., 0., -momentumBeam, halfSqrtSnn * 208); // projectile + TLorentzVector pTargCM(0., 0., momentumBeam, halfSqrtSnn * 208); // target // TVector3 beta = (-1. / fourpion.E()) * fourpion.Vect(); ROOT::Math::PtEtaPhiMVector v1 = pair1; @@ -178,54 +180,54 @@ struct exclusiveRhoTo4Pi { // Boost to center of mass frame ROOT::Math::Boost boostv12{v12.BoostToCM()}; - ROOT::Math::XYZVectorF v1_CM{(boostv12(v1).Vect()).Unit()}; - ROOT::Math::XYZVectorF v2_CM{(boostv12(v2).Vect()).Unit()}; - ROOT::Math::XYZVectorF Beam1_CM{(boostv12(pProjCM).Vect()).Unit()}; - ROOT::Math::XYZVectorF Beam2_CM{(boostv12(pTargCM).Vect()).Unit()}; + ROOT::Math::XYZVectorF v1CM{(boostv12(v1).Vect()).Unit()}; + ROOT::Math::XYZVectorF v2CM{(boostv12(v2).Vect()).Unit()}; + ROOT::Math::XYZVectorF beam1CM{(boostv12(pProjCM).Vect()).Unit()}; + ROOT::Math::XYZVectorF beam2CM{(boostv12(pTargCM).Vect()).Unit()}; // Axes - ROOT::Math::XYZVectorF zaxis_CS{((Beam1_CM.Unit() - Beam2_CM.Unit()).Unit())}; + ROOT::Math::XYZVectorF zaxisCS{((beam1CM.Unit() - beam2CM.Unit()).Unit())}; - Double_t CosThetaCS = zaxis_CS.Dot((v1_CM)); - return CosThetaCS; - } // End of CosThetaCollinsSoperFrame function------------------------------------------------------------------------------------------------------------------------ + double cosThetaCS = zaxisCS.Dot((v1CM)); + return cosThetaCS; + } // End of cosThetaCollinsSoperFrame function------------------------------------------------------------------------------------------------------------------------ // Calculate Phi in Collins-Soper Frame------------------------------------------------------------------------------------------------------------------------ - Double_t PhiCollinsSoperFrame(ROOT::Math::PtEtaPhiMVector pair1, ROOT::Math::PtEtaPhiMVector pair2, ROOT::Math::PtEtaPhiMVector fourpion) + double phiCollinsSoperFrame(ROOT::Math::PtEtaPhiMVector pair1, ROOT::Math::PtEtaPhiMVector pair2, ROOT::Math::PtEtaPhiMVector fourpion) { // Half of the energy per pair of the colliding nucleons. - Double_t HalfSqrtSnn = 2680.; - Double_t MassOfLead208 = 193.6823; - Double_t MomentumBeam = TMath::Sqrt(HalfSqrtSnn * HalfSqrtSnn * 208 * 208 - MassOfLead208 * MassOfLead208); + double halfSqrtSnn = 2680.; + double massOfLead208 = 193.6823; + double momentumBeam = std::sqrt(halfSqrtSnn * halfSqrtSnn * 208 * 208 - massOfLead208 * massOfLead208); - TLorentzVector pProjCM(0., 0., -MomentumBeam, HalfSqrtSnn * 208); // projectile - TLorentzVector pTargCM(0., 0., MomentumBeam, HalfSqrtSnn * 208); // target + TLorentzVector pProjCM(0., 0., -momentumBeam, halfSqrtSnn * 208); // projectile + TLorentzVector pTargCM(0., 0., momentumBeam, halfSqrtSnn * 208); // target ROOT::Math::PtEtaPhiMVector v1 = pair1; ROOT::Math::PtEtaPhiMVector v2 = pair2; ROOT::Math::PtEtaPhiMVector v12 = fourpion; // Boost to center of mass frame ROOT::Math::Boost boostv12{v12.BoostToCM()}; - ROOT::Math::XYZVectorF v1_CM{(boostv12(v1).Vect()).Unit()}; - ROOT::Math::XYZVectorF v2_CM{(boostv12(v2).Vect()).Unit()}; - ROOT::Math::XYZVectorF Beam1_CM{(boostv12(pProjCM).Vect()).Unit()}; - ROOT::Math::XYZVectorF Beam2_CM{(boostv12(pTargCM).Vect()).Unit()}; + ROOT::Math::XYZVectorF v1CM{(boostv12(v1).Vect()).Unit()}; + ROOT::Math::XYZVectorF v2CM{(boostv12(v2).Vect()).Unit()}; + ROOT::Math::XYZVectorF beam1CM{(boostv12(pProjCM).Vect()).Unit()}; + ROOT::Math::XYZVectorF beam2CM{(boostv12(pTargCM).Vect()).Unit()}; // Axes - ROOT::Math::XYZVectorF zaxis_CS{((Beam1_CM.Unit() - Beam2_CM.Unit()).Unit())}; - ROOT::Math::XYZVectorF yaxis_CS{(Beam1_CM.Cross(Beam2_CM)).Unit()}; - ROOT::Math::XYZVectorF xaxis_CS{(yaxis_CS.Cross(zaxis_CS)).Unit()}; + ROOT::Math::XYZVectorF zaxisCS{((beam1CM.Unit() - beam2CM.Unit()).Unit())}; + ROOT::Math::XYZVectorF yaxisCS{(beam1CM.Cross(beam2CM)).Unit()}; + ROOT::Math::XYZVectorF xaxisCS{(yaxisCS.Cross(zaxisCS)).Unit()}; - Double_t phi = TMath::ATan2(yaxis_CS.Dot(v1_CM), xaxis_CS.Dot(v1_CM)); + double phi = std::atan2(yaxisCS.Dot(v1CM), xaxisCS.Dot(v1CM)); return phi; - } // End of PhiCollinsSoperFrame function------------------------------------------------------------------------------------------------------------------------ + } // End of phiCollinsSoperFrame function------------------------------------------------------------------------------------------------------------------------ // Begin of Process function-------------------------------------------------------------------------------------------------------------------------------------------------- - void process(UDCollisionFull const& collision, udtracksfull const& tracks) + void process(UDCollisionFull const& collision, UDtracksfull const& tracks) { int gapSide = collision.gapSide(); - float FIT_cut[5] = {FV0_cut, FT0A_cut, FT0C_cut, FDDA_cut, FDDC_cut}; - std::vector parameters = {PV_cut, dcaZ_cut, dcaXY_cut, tpcChi2_cut, tpcNClsFindable_cut, itsChi2_cut, eta_cut, pt_cut}; - int truegapSide = sgSelector.trueGap(collision, FIT_cut[0], FIT_cut[1], FIT_cut[2], ZDC_cut); + float fitCuts[5] = {fv0Cut, ft0aCut, ft0cCut, fddaCut, fddcCut}; + std::vector parameters = {pvCut, dcaZcut, dcaXYcut, tpcChi2Cut, tpcNClsFindableCut, itsChi2Cut, etaCut, pTcut}; + int truegapSide = sgSelector.trueGap(collision, fitCuts[0], fitCuts[1], fitCuts[2], zdcCut); histos.fill(HIST("GapSide"), gapSide); histos.fill(HIST("TrueGapSide"), truegapSide); histos.fill(HIST("EventCounts"), 1); @@ -241,7 +243,7 @@ struct exclusiveRhoTo4Pi { histos.fill(HIST("ZDC_A"), collision.energyCommonZNA()); histos.fill(HIST("ZDC_C"), collision.energyCommonZNC()); - if (StrictEventSelection) { + if (strictEventSelection) { if (collision.numContrib() != 4) { return; } @@ -257,14 +259,14 @@ struct exclusiveRhoTo4Pi { std::vector Pi_plus_tracks; std::vector Pi_minus_tracks; - for (auto& t0 : tracks) { + for (const auto& t0 : tracks) { WOTS_tracks.push_back(t0); if (trackselector(t0, parameters)) { WTS_tracks.push_back(t0); - if (selectionPIDPion(t0, true, nSigmaTPC_cut, nSigmaTOF_cut)) { + if (selectionPIDPion(t0, true, nSigmaTPCcut, nSigmaTOFcut)) { WTS_PID_Pi_tracks.push_back(t0); if (t0.sign() == 1) { Pi_plus_tracks.push_back(t0); @@ -278,31 +280,31 @@ struct exclusiveRhoTo4Pi { } // End of loop over tracks - int len_WOTS = static_cast(WOTS_tracks.size()); - int len_WTS = static_cast(WTS_tracks.size()); - int len_WTS_PID_Pi = static_cast(WTS_PID_Pi_tracks.size()); - int len_Pi_plus = static_cast(Pi_plus_tracks.size()); - int len_Pi_minus = static_cast(Pi_minus_tracks.size()); + int numTracksWOTS = static_cast(WOTS_tracks.size()); + int numTracksWTS = static_cast(WTS_tracks.size()); + int numTracksWTSandPIDpi = static_cast(WTS_PID_Pi_tracks.size()); + int numPiPlusTracks = static_cast(Pi_plus_tracks.size()); + int numPionMinusTRacks = static_cast(Pi_minus_tracks.size()); - for (int i = 0; i < len_WOTS; i++) { + for (int i = 0; i < numTracksWOTS; i++) { histos.fill(HIST("tpcNSigmaPi_WOTS"), WOTS_tracks[i].tpcNSigmaPi()); histos.fill(HIST("tofNSigmaPi_WOTS"), WOTS_tracks[i].tofNSigmaPi()); - histos.fill(HIST("pT_track_WOTS"), TMath::Sqrt(WOTS_tracks[i].px() * WOTS_tracks[i].px() + WOTS_tracks[i].py() * WOTS_tracks[i].py())); + histos.fill(HIST("pT_track_WOTS"), std::sqrt(WOTS_tracks[i].px() * WOTS_tracks[i].px() + WOTS_tracks[i].py() * WOTS_tracks[i].py())); } // End of loop over tracks without selection - for (int i = 0; i < len_WTS; i++) { + for (int i = 0; i < numTracksWTS; i++) { - histos.fill(HIST("tpcSignal"), TMath::Sqrt(WTS_tracks[i].px() * WTS_tracks[i].px() + WTS_tracks[i].py() * WTS_tracks[i].py() + WTS_tracks[i].pz() * WTS_tracks[i].pz()), WTS_tracks[i].tpcSignal()); - histos.fill(HIST("tofBeta"), TMath::Sqrt(WTS_tracks[i].px() * WTS_tracks[i].px() + WTS_tracks[i].py() * WTS_tracks[i].py() + WTS_tracks[i].pz() * WTS_tracks[i].pz()), WTS_tracks[i].beta()); + histos.fill(HIST("tpcSignal"), std::sqrt(WTS_tracks[i].px() * WTS_tracks[i].px() + WTS_tracks[i].py() * WTS_tracks[i].py() + WTS_tracks[i].pz() * WTS_tracks[i].pz()), WTS_tracks[i].tpcSignal()); + histos.fill(HIST("tofBeta"), std::sqrt(WTS_tracks[i].px() * WTS_tracks[i].px() + WTS_tracks[i].py() * WTS_tracks[i].py() + WTS_tracks[i].pz() * WTS_tracks[i].pz()), WTS_tracks[i].beta()); histos.fill(HIST("tpcNSigmaPi_WTS"), WTS_tracks[i].tpcNSigmaPi()); histos.fill(HIST("tofNSigmaPi_WTS"), WTS_tracks[i].tofNSigmaPi()); - histos.fill(HIST("pT_track_WTS"), TMath::Sqrt(WTS_tracks[i].px() * WTS_tracks[i].px() + WTS_tracks[i].py() * WTS_tracks[i].py())); + histos.fill(HIST("pT_track_WTS"), std::sqrt(WTS_tracks[i].px() * WTS_tracks[i].px() + WTS_tracks[i].py() * WTS_tracks[i].py())); } // End of loop over tracks with selection only - for (int i = 0; i < len_WTS_PID_Pi; i++) { + for (int i = 0; i < numTracksWTSandPIDpi; i++) { - histos.fill(HIST("tpcSignal_Pi"), TMath::Sqrt(WTS_PID_Pi_tracks[i].px() * WTS_PID_Pi_tracks[i].px() + WTS_PID_Pi_tracks[i].py() * WTS_PID_Pi_tracks[i].py() + WTS_PID_Pi_tracks[i].pz() * WTS_PID_Pi_tracks[i].pz()), WTS_PID_Pi_tracks[i].tpcSignal()); - histos.fill(HIST("tofBeta_Pi"), TMath::Sqrt(WTS_PID_Pi_tracks[i].px() * WTS_PID_Pi_tracks[i].px() + WTS_PID_Pi_tracks[i].py() * WTS_PID_Pi_tracks[i].py() + WTS_PID_Pi_tracks[i].pz() * WTS_PID_Pi_tracks[i].pz()), WTS_PID_Pi_tracks[i].beta()); + histos.fill(HIST("tpcSignal_Pi"), std::sqrt(WTS_PID_Pi_tracks[i].px() * WTS_PID_Pi_tracks[i].px() + WTS_PID_Pi_tracks[i].py() * WTS_PID_Pi_tracks[i].py() + WTS_PID_Pi_tracks[i].pz() * WTS_PID_Pi_tracks[i].pz()), WTS_PID_Pi_tracks[i].tpcSignal()); + histos.fill(HIST("tofBeta_Pi"), std::sqrt(WTS_PID_Pi_tracks[i].px() * WTS_PID_Pi_tracks[i].px() + WTS_PID_Pi_tracks[i].py() * WTS_PID_Pi_tracks[i].py() + WTS_PID_Pi_tracks[i].pz() * WTS_PID_Pi_tracks[i].pz()), WTS_PID_Pi_tracks[i].beta()); histos.fill(HIST("tpcNSigmaPi_WTS_PID_Pi"), WTS_PID_Pi_tracks[i].tpcNSigmaPi()); histos.fill(HIST("tpcNSigmaPi_WTS_PID_Pi_Ka"), WTS_PID_Pi_tracks[i].tpcNSigmaKa()); @@ -316,15 +318,15 @@ struct exclusiveRhoTo4Pi { histos.fill(HIST("tofNSigmaPi_WTS_PID_Pi_El"), WTS_PID_Pi_tracks[i].tofNSigmaEl()); histos.fill(HIST("tofNSigmaPi_WTS_PID_Pi_Mu"), WTS_PID_Pi_tracks[i].tofNSigmaMu()); - histos.fill(HIST("pT_track_WTS_PID_Pi"), TMath::Sqrt(WTS_PID_Pi_tracks[i].px() * WTS_PID_Pi_tracks[i].px() + WTS_PID_Pi_tracks[i].py() * WTS_PID_Pi_tracks[i].py())); + histos.fill(HIST("pT_track_WTS_PID_Pi"), std::sqrt(WTS_PID_Pi_tracks[i].px() * WTS_PID_Pi_tracks[i].px() + WTS_PID_Pi_tracks[i].py() * WTS_PID_Pi_tracks[i].py())); } // End of loop over tracks with selection and PID selection of Pions - if (len_WTS_PID_Pi != 4) { + if (numTracksWTSandPIDpi != 4) { return; } // Selecting Events with net charge = 0 - if (len_Pi_minus == 2 && len_Pi_plus == 2) { + if (numPionMinusTRacks == 2 && numPiPlusTracks == 2) { TLorentzVector p1, p2, p3, p4, p1234; ROOT::Math::PtEtaPhiMVector k1, k2, k3, k4, k1234, k13, k14, k23, k24; @@ -353,15 +355,15 @@ struct exclusiveRhoTo4Pi { histos.fill(HIST("rapidity_event_0charge_WTS_PID_Pi_domainA"), p1234.Rapidity()); histos.fill(HIST("invMass_event_0charge_WTS_PID_Pi_domainA"), p1234.M()); - auto phi_pair_1 = PhiCollinsSoperFrame(k13, k24, k1234); - auto phi_pair_2 = PhiCollinsSoperFrame(k14, k23, k1234); - auto cos_theta_1 = CosThetaCollinsSoperFrame(k13, k24, k1234); - auto cos_theta_2 = CosThetaCollinsSoperFrame(k14, k23, k1234); + auto phiPair1 = phiCollinsSoperFrame(k13, k24, k1234); + auto phiPair2 = phiCollinsSoperFrame(k14, k23, k1234); + auto cosThetaPair1 = cosThetaCollinsSoperFrame(k13, k24, k1234); + auto cosThetaPair2 = cosThetaCollinsSoperFrame(k14, k23, k1234); - histos.fill(HIST("CS_phi_pair_1"), phi_pair_1); - histos.fill(HIST("CS_phi_pair_2"), phi_pair_2); - histos.fill(HIST("CS_costheta_pair_1"), cos_theta_1); - histos.fill(HIST("CS_costheta_pair_2"), cos_theta_2); + histos.fill(HIST("CS_phi_pair_1"), phiPair1); + histos.fill(HIST("CS_phi_pair_2"), phiPair2); + histos.fill(HIST("CS_costheta_pair_1"), cosThetaPair1); + histos.fill(HIST("CS_costheta_pair_2"), cosThetaPair2); } if (p1234.Pt() > 0.15 && p1234.Pt() < 0.80) { histos.fill(HIST("rapidity_event_0charge_WTS_PID_Pi_domainB"), p1234.Rapidity()); @@ -376,7 +378,7 @@ struct exclusiveRhoTo4Pi { } // End of Analysis for 0 charge events // Selecting Events with net charge != 0 for estimation of background - if (len_Pi_minus != 2 && len_Pi_plus != 2) { + if (numPionMinusTRacks != 2 && numPiPlusTracks != 2) { TLorentzVector p1, p2, p3, p4, p1234; p1.SetXYZM(WTS_PID_Pi_tracks[0].px(), WTS_PID_Pi_tracks[0].py(), WTS_PID_Pi_tracks[0].pz(), o2::constants::physics::MassPionCharged);