diff --git a/Common/CCDB/CMakeLists.txt b/Common/CCDB/CMakeLists.txt index 0ae8e9fd0f7..63584528a38 100644 --- a/Common/CCDB/CMakeLists.txt +++ b/Common/CCDB/CMakeLists.txt @@ -12,9 +12,11 @@ o2physics_add_library(AnalysisCCDB SOURCES EventSelectionParams.cxx SOURCES TriggerAliases.cxx + SOURCES ctpRateFetcher.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore) o2physics_target_root_dictionary(AnalysisCCDB HEADERS EventSelectionParams.h HEADERS TriggerAliases.h + HEADERS ctpRateFetcher.h LINKDEF AnalysisCCDBLinkDef.h) diff --git a/Common/CCDB/ctpRateFetcher.cxx b/Common/CCDB/ctpRateFetcher.cxx new file mode 100644 index 00000000000..418fcc74b07 --- /dev/null +++ b/Common/CCDB/ctpRateFetcher.cxx @@ -0,0 +1,137 @@ +// 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. + +#include "ctpRateFetcher.h" + +#include +#include + +#include "CommonConstants/LHCConstants.h" +#include "DataFormatsCTP/Configuration.h" +#include "DataFormatsCTP/Scalers.h" +#include "DataFormatsParameters/GRPLHCIFData.h" +#include "CCDB/BasicCCDBManager.h" + +namespace o2 +{ + +using framework::Service; + +double ctpRateFetcher::fetch(Service& ccdb, uint64_t timeStamp, int runNumber, std::string sourceName) +{ + if (sourceName.find("ZNC") != std::string::npos) { + if (runNumber < 544448) { + return fetchCTPratesInputs(ccdb, timeStamp, runNumber, 26) / (sourceName.find("hadronic") != std::string::npos ? 28. : 1.); + } else { + return fetchCTPratesClasses(ccdb, timeStamp, runNumber, "C1ZNC-B-NOPF-CRU", 6) / (sourceName.find("hadronic") != std::string::npos ? 28. : 1.); + } + } else if (sourceName == "T0CE") { + return fetchCTPratesClasses(ccdb, timeStamp, runNumber, "CMTVXTCE-B-NOPF-CRU"); + } else if (sourceName == "T0SC") { + return fetchCTPratesClasses(ccdb, timeStamp, runNumber, "CMTVXTSC-B-NOPF-CRU"); + } else if (sourceName == "T0VTX") { + if (runNumber < 534202) { + return fetchCTPratesClasses(ccdb, timeStamp, runNumber, "minbias_TVX_L0"); // 2022 + } else { + return fetchCTPratesClasses(ccdb, timeStamp, runNumber, "CMTVX-B-NOPF-CRU"); + } + } + LOG(error) << "CTP rate for " << sourceName << " not available"; + return -1.; +} + +double ctpRateFetcher::fetchCTPratesClasses(Service& ccdb, uint64_t timeStamp, int runNumber, std::string className, int inputType) +{ + getCTPscalers(ccdb, timeStamp, runNumber); + getCTPconfig(ccdb, timeStamp, runNumber); + + std::vector ctpcls = mConfig->getCTPClasses(); + std::vector clslist = mConfig->getTriggerClassList(); + int classIndex = -1; + for (size_t i = 0; i < clslist.size(); i++) { + if (ctpcls[i].name == className) { + classIndex = i; + break; + } + } + if (classIndex == -1) { + LOG(fatal) << "Trigger class " << className << " not found in CTPConfiguration"; + } + + auto rate{mScalers->getRateGivenT(timeStamp, classIndex, inputType)}; + + return pileUpCorrection(rate.second); +} + +double ctpRateFetcher::fetchCTPratesInputs(Service& ccdb, uint64_t timeStamp, int runNumber, int input) +{ + getCTPscalers(ccdb, timeStamp, runNumber); + getLHCIFdata(ccdb, timeStamp, runNumber); + + std::vector recs = mScalers->getScalerRecordO2(); + if (recs[0].scalersInps.size() == 48) { + return pileUpCorrection(mScalers->getRateGivenT(timeStamp, input, 7).second); + } else { + LOG(error) << "Inputs not available"; + return -1.; + } +} + +void ctpRateFetcher::getCTPscalers(Service& ccdb, uint64_t timeStamp, int runNumber) +{ + if (runNumber == mRunNumber && mScalers != nullptr) { + return; + } + std::map metadata; + metadata["runNumber"] = std::to_string(runNumber); + mScalers = ccdb->getSpecific("CTP/Calib/Scalers", timeStamp, metadata); + if (mScalers == nullptr) { + LOG(fatal) << "CTPRunScalers not in database, timestamp:" << timeStamp; + } + mScalers->convertRawToO2(); +} + +void ctpRateFetcher::getLHCIFdata(Service& ccdb, uint64_t timeStamp, int runNumber) +{ + if (runNumber == mRunNumber && mLHCIFdata != nullptr) { + return; + } + std::map metadata; + mLHCIFdata = ccdb->getSpecific("GLO/Config/GRPLHCIF", timeStamp, metadata); + if (mLHCIFdata == nullptr) { + LOG(fatal) << "GRPLHCIFData not in database, timestamp:" << timeStamp; + } +} + +void ctpRateFetcher::getCTPconfig(Service& ccdb, uint64_t timeStamp, int runNumber) +{ + if (runNumber == mRunNumber && mConfig != nullptr) { + return; + } + std::map metadata; + metadata["runNumber"] = std::to_string(runNumber); + mConfig = ccdb->getSpecific("CTP/Config/Config", timeStamp, metadata); + if (mConfig == nullptr) { + LOG(fatal) << "CTPRunConfig not in database, timestamp:" << timeStamp; + } +} + +double ctpRateFetcher::pileUpCorrection(double triggerRate) +{ + auto bfilling = mLHCIFdata->getBunchFilling(); + std::vector bcs = bfilling.getFilledBCs(); + double nbc = bcs.size(); + double nTriggersPerFilledBC = triggerRate / nbc / constants::lhc::LHCRevFreq; + double mu = -std::log(1 - nTriggersPerFilledBC); + return mu * nbc * constants::lhc::LHCRevFreq; +} + +} // namespace o2 diff --git a/Common/CCDB/ctpRateFetcher.h b/Common/CCDB/ctpRateFetcher.h new file mode 100644 index 00000000000..c6dc3840f50 --- /dev/null +++ b/Common/CCDB/ctpRateFetcher.h @@ -0,0 +1,55 @@ +// 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. + +#ifndef COMMON_CCDB_CTPRATEFETCHER_H_ +#define COMMON_CCDB_CTPRATEFETCHER_H_ + +#include + +#include "CCDB/BasicCCDBManager.h" +#include "Framework/AnalysisHelpers.h" + +namespace o2 +{ + +namespace ctp +{ +class CTPRunScalers; +class CTPConfiguration; +} // namespace ctp + +namespace parameters +{ +class GRPLHCIFData; +} + +class ctpRateFetcher +{ + public: + ctpRateFetcher() = default; + double fetch(framework::Service& ccdb, uint64_t timeStamp, int runNumber, std::string sourceName); + + private: + void getCTPconfig(framework::Service& ccdb, uint64_t timeStamp, int runNumber); + void getCTPscalers(framework::Service& ccdb, uint64_t timeStamp, int runNumber); + void getLHCIFdata(framework::Service& ccdb, uint64_t timeStamp, int runNumber); + double fetchCTPratesInputs(framework::Service& ccdb, uint64_t timeStamp, int runNumber, int input); + double fetchCTPratesClasses(framework::Service& ccdb, uint64_t timeStamp, int runNumber, std::string className, int inputType = 1); + double pileUpCorrection(double rate); + + int mRunNumber = -1; + ctp::CTPConfiguration* mConfig = nullptr; + ctp::CTPRunScalers* mScalers = nullptr; + parameters::GRPLHCIFData* mLHCIFdata = nullptr; +}; +} // namespace o2 + +#endif // COMMON_CCDB_CTPRATEFETCHER_H_ diff --git a/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt b/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt index 3c389200fbd..09823918213 100644 --- a/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt +++ b/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt @@ -15,7 +15,7 @@ o2physics_add_dpl_workflow(meanpt-fluctuations COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(mean-pt-fluc-id - SOURCES EbyEmeanPtFlucIdentified.cxx + SOURCES MeanPtFlucIdentified.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore COMPONENT_NAME Analysis) diff --git a/PWGCF/EbyEFluctuations/Tasks/EbyEmeanPtFlucIdentified.cxx b/PWGCF/EbyEFluctuations/Tasks/EbyEmeanPtFlucIdentified.cxx deleted file mode 100644 index 8721b374e9d..00000000000 --- a/PWGCF/EbyEFluctuations/Tasks/EbyEmeanPtFlucIdentified.cxx +++ /dev/null @@ -1,777 +0,0 @@ -// 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 EbyEmeanPtFluc.cxx -/// \brief Calculate EbyE fluctuations with cummulant method. -/// For charged particles and identified particles. -/// -/// \author Tanu Gahlaut - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/HistogramSpec.h" -#include "TDatabasePDG.h" -#include "TLorentzVector.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; - -double massPi = TDatabasePDG::Instance()->GetParticle(211)->Mass(); -double massKa = TDatabasePDG::Instance()->GetParticle(321)->Mass(); -double massPr = TDatabasePDG::Instance()->GetParticle(2212)->Mass(); - -struct meanPtFlucId { - Configurable ptMax{"ptMax", 2.0, "maximum pT"}; - Configurable ptMin{"ptMin", 0.15, "minimum pT"}; - Configurable etaCut{"etaCut", 0.8, "Eta cut"}; - Configurable rapCut{"rapCut", 0.5, "Rapidity Cut"}; - Configurable dcaXYCut{"dcaXYCut", 0.12, "DCAxy cut"}; - Configurable dcaZCut{"dcaZCut", 1.0, "DCAz cut"}; - Configurable posZCut{"posZCut", 7.0, "cut for vertex Z"}; - Configurable nSigCut1{"nSigCut1", 1.0, "nSigma cut (1)"}; - Configurable nSigCut2{"nSigCut2", 2.0, "nSigma cut (2)"}; - Configurable nSigCut3{"nSigCut3", 3.0, "nSigma cut (3)"}; - Configurable nSigCut4{"nSigCut4", 4.0, "nSigma cut (4)"}; - Configurable nSigCut5{"nSigCut5", 5.0, "nSigma cut (5)"}; - Configurable nSigCut15{"nSigCut15", 1.5, "nSigma cut (1.5)"}; - Configurable nSigCut25{"nSigCut25", 2.5, "nSigma cut (2.5)"}; - Configurable piP1{"piP1", 0.65, "pion p (1)"}; - Configurable piP2{"piP2", 0.70, "pion p (2)"}; - Configurable piP3{"piP3", 1.40, "pion p (3)"}; - Configurable piP4{"piP4", 1.70, "pion p (4)"}; - Configurable kaP1{"kaP1", 0.20, "min kaon p (1)"}; - Configurable kaP2{"kaP2", 0.5, "kaon p (2)"}; - Configurable kaP3{"kaP3", 0.55, "kaon p (3)"}; - Configurable kaP4{"kaP4", 0.60, "kaon p (4)"}; - Configurable kaP5{"kaP5", 0.65, "kaon p (5)"}; - Configurable kaP6{"kaP6", 1.10, "kaon p (6)"}; - Configurable kaP7{"kaP7", 1.28, "kaon p (7)"}; - Configurable kaP8{"kaP8", 1.50, "kaon p (8)"}; - Configurable prP1{"prP1", 0.40, "min proton p (1)"}; - Configurable prP2{"prP2", 0.95, "proton p (2)"}; - Configurable prP3{"prP3", 1.00, "proton p (3)"}; - Configurable prP4{"prP4", 1.05, "proton p (4)"}; - Configurable prP5{"prP5", 1.13, "proton p (5)"}; - Configurable prP6{"prP6", 1.18, "proton p (6)"}; - - using MyAllTracks = soa::Join; - using MyAllCollisions = soa::Join; - - Filter collisionZFilter = nabs(aod::collision::posZ) < posZCut; - Filter collisionTrigger = o2::aod::evsel::sel8 == true; - Filter trackDCA = nabs(aod::track::dcaXY) < dcaXYCut && nabs(aod::track::dcaZ) < dcaZCut; - Filter trackEta = nabs(aod::track::eta) < etaCut; - Filter trackPt = aod::track::pt > ptMin&& aod::track::pt < ptMax; - Filter trackGobal = requireGlobalTrackInFilter(); - // Filter trackGobal = requirePrimaryTracksInFilter(); - using MyFilteredTracks = soa::Filtered; - using MyFilteredCollisions = soa::Filtered; - - HistogramRegistry hist{"hist", {}, OutputObjHandlingPolicy::AnalysisObject}; - void init(InitContext const&) - { - const AxisSpec axisEvents{5, 0, 5, "Counts"}; - const AxisSpec axisEta{100, -1., +1., "#eta"}; - const AxisSpec axisY{100, -1., +1., "Rapidity"}; - const AxisSpec axisPt{300, 0., 3., "p_{T} (GeV/c)"}; - const AxisSpec axisP{300, 0., 3., "p (GeV/c)"}; - const AxisSpec axisPart{500, 0., 5., " "}; - const AxisSpec axisMeanPt{100, 0., 3., "M(p_{T}) (GeV/c)"}; - const AxisSpec axisMult{100, 0, 100, "N_{ch}"}; - const AxisSpec axisMultTPC{200, 0, 800, "N_{TPC} "}; - const AxisSpec axisMultFT0M{150, 0, 15000, "N_{FT0M}"}; - const AxisSpec axisCentFT0M{50, 0, 101, "FT0M (%)"}; - const AxisSpec axisVtxZ{80, -20., 20., "V_{Z} (cm)"}; - const AxisSpec axisDCAz{100, -1.2, 1.2, "DCA_{Z} (cm)"}; - const AxisSpec axisDCAxy{100, -0.15, 0.15, "DCA_{XY} (cm)"}; - const AxisSpec axisTPCNsigma{500, -5., 5., "n #sigma_{TPC}"}; - const AxisSpec axisTOFNsigma{500, -5., 5., "n #sigma_{TOF}"}; - const AxisSpec axisTPCSignal{180, 20., 200., "#frac{dE}{dx}"}; - const AxisSpec axisTOFSignal{100, 0.2, 1.2, "TOF #beta"}; - const AxisSpec axisChi2{50, 0., 50., "Chi2"}; - const AxisSpec axisCrossedTPC{500, 0, 500, "Crossed TPC"}; - - // QA checks: - hist.add("QA/before/h_Counts", "Counts before cuts", kTH1D, {axisEvents}); - hist.add("QA/before/h_VtxZ", "V_{Z}", kTH1D, {axisVtxZ}); - - hist.add("QA/before/h_TPCChi2perCluster", "TPC #Chi^{2}/Cluster", kTH1D, {axisChi2}); - hist.add("QA/before/h_ITSChi2perCluster", "ITS #Chi^{2}/Cluster", kTH1D, {axisChi2}); - hist.add("QA/before/h_crossedTPC", "Crossed TPC", kTH1D, {axisCrossedTPC}); - - hist.add("QA/before/Charged/h_Eta_ch", "#eta Charged Particles", kTH1D, {axisEta}); - hist.add("QA/before/Charged/h_Pt_ch", "p_{T} Charged Particles", kTH1D, {axisPt}); - hist.add("QA/before/Charged/h2_DcaZ_ch", "DCA_{Z}", kTH2D, {{axisPt}, {axisDCAz}}); - hist.add("QA/before/Charged/h2_DcaXY_ch", "DCA_{XY}", kTH2D, {{axisPt}, {axisDCAxy}}); - - hist.add("QA/before/h2_TPCSignal_b", "TPC Signal (before)", kTH2D, {{axisP}, {axisTPCSignal}}); - hist.add("QA/before/h2_TOFSignal_b", "TOF Signal (before)", kTH2D, {{axisP}, {axisTOFSignal}}); - - hist.add("QA/before/Pion/h2_TPCNsigma_pi", "n #sigma_{TPC} (Pions)", - kTH2D, {{axisP}, {axisTPCNsigma}}); - hist.add("QA/before/Pion/h2_TOFNsigma_pi", "n #sigma_{TOF} (Pions)", - kTH2D, {{axisP}, {axisTOFNsigma}}); - hist.add("QA/before/Pion/h2_TpcTofNsigma_pi", "n #sigma_{TPC} vs n #sigma_{TOF} (Pions)", - kTH2D, {{{axisTPCNsigma}, {axisTOFNsigma}}}); - hist.add("QA/before/Kaon/h2_TPCNsigma_ka", "n #sigma_{TPC} Kaons", - kTH2D, {{axisP}, {axisTPCNsigma}}); - hist.add("QA/before/Kaon/h2_TOFNsigma_ka", "n #sigma_{TOF} Kaons", - kTH2D, {{axisP}, {axisTOFNsigma}}); - hist.add("QA/before/Kaon/h2_TpcTofNsigma_ka", "N_{TPC} igma vs n #sigma_{TOF} Kaons", - kTH2D, {{{axisTPCNsigma}, {axisTOFNsigma}}}); - hist.add("QA/before/Proton/h2_TPCNsigma_pr", "n #sigma_{TPC} Protons", - kTH2D, {{axisP}, {axisTPCNsigma}}); - hist.add("QA/before/Proton/h2_TOFNsigma_pr", "n #sigma_{TOF} Protons", - kTH2D, {{axisP}, {axisTOFNsigma}}); - hist.add("QA/before/Proton/h2_TpcTofNsigma_pr", "n #sigma_{TPC} vs n #sigma_{TOF} Protons", - kTH2D, {{{axisTPCNsigma}, {axisTOFNsigma}}}); - - // after - hist.add("QA/after/h_Counts", "Counts after cuts", kTH1D, {axisEvents}); - hist.add("QA/after/h_VtxZ", "V_{Z} (after)", kTH1D, {axisVtxZ}); - - hist.add("QA/after/h_NTPC", "N_{TPC}", kTH1D, {axisMultTPC}); - hist.add("QA/after/h_NFT0M", "FT0M Multiplicity", kTH1D, {axisMultFT0M}); - hist.add("QA/after/h_Cent", "FT0M (%)", kTH1D, {axisCentFT0M}); - hist.add("QA/after/h2_NTPC_NFT0M", "N_{TPC} vs N_{FT0M}", kTH2D, {{axisMultFT0M}, {axisMultTPC}}); - hist.add("QA/after/p_NTPC_NFT0M", "N_{TPC} vs N_{FT0M} (Profile)", kTProfile, {{axisMultFT0M}}); - hist.add("QA/after/p_NFT0M_NTPC", "N_{FT0M} vs N_{TPC} (Profile)", kTProfile, {{axisMultTPC}}); - hist.add("QA/after/h2_NTPC_Cent", "N_{TPC} vs FT0M(%)", kTH2D, {{axisCentFT0M}, {axisMultTPC}}); - hist.add("QA/after/p_NTPC_Cent", "N_{TPC} vs FT0M(%) (Profile)", kTProfile, {{axisCentFT0M}}); - hist.add("QA/after/h2_NTPC_Nch", "N_{ch} vs N_{TPC}", kTH2D, {{axisMultTPC}, {axisMult}}); - - hist.add("QA/after/h_TPCChi2perCluster", "TPC #Chi^{2}/Cluster (after)", kTH1D, {axisChi2}); - hist.add("QA/after/h_ITSChi2perCluster", "ITS #Chi^{2}/Cluster (after)", kTH1D, {axisChi2}); - hist.add("QA/after/h_crossedTPC", "Crossed TPC", kTH1D, {axisCrossedTPC}); - - hist.add("QA/after/Charged/h_Mult_ch", "Multiplicity Charged Prticles", kTH1D, {axisMult}); - hist.add("QA/after/Charged/h_Eta_ch", "#eta Charged Particles (after)", kTH1D, {axisEta}); - hist.add("QA/after/Charged/h_Pt_ch", "p_{T} Charged Particles (after)", kTH1D, {axisPt}); - hist.add("QA/after/Charged/h2_DcaZ_ch", "DCA_{Z} Charged Particles (after)", - kTH2D, {{axisPt}, {axisDCAz}}); - hist.add("QA/after/Charged/h2_DcaXY_ch", "DCA_{XY} Charged Particles (after)", - kTH2D, {{axisPt}, {axisDCAxy}}); - hist.add("QA/after/Charged/h2_Pt_Eta_ch", "p_{T} vs #eta (Charged Particles)", - kTH2D, {{axisEta}, {axisPt}}); - - hist.add("QA/after/h2_TPCSignal_a", "TPC Signal (after)", kTH2D, {{axisP}, {axisTPCSignal}}); - hist.add("QA/after/h2_TOFSignal_a", "TOF Signal (after)", kTH2D, {{axisP}, {axisTOFSignal}}); - - hist.add("QA/after/TPC/Pion/h_Pt_pi_TPC", "p_{T} (Pions) TPC", kTH1D, {axisPt}); - hist.add("QA/after/TPC/Kaon/h_Pt_ka_TPC", "p_{T} (Kaons) TPC", kTH1D, {axisPt}); - hist.add("QA/after/TPC/Proton/h_Pt_pr_TPC", "p_{T} (Protons) TPC ", kTH1D, {axisPt}); - hist.add("QA/after/TPC/Pion/h_rap_pi_TPC", "y (Pions) TPC ", kTH1D, {axisY}); - hist.add("QA/after/TPC/Kaon/h_rap_ka_TPC", "y (Kaons) TPC", kTH1D, {axisY}); - hist.add("QA/after/TPC/Proton/h_rap_pr_TPC", "y (Protons) TPC", kTH1D, {axisY}); - hist.add("QA/after/TPC/Pion/h2_TPCSignal_pi_b", "TPC Signal Pions", - kTH2D, {{axisP}, {axisTPCSignal}}); - hist.add("QA/after/TPC/Pion/h2_ExpTPCSignal_pi_b", "Expected TPC Signal Pions", - kTH2D, {{axisP}, {axisTPCSignal}}); - hist.add("QA/after/TPC/Kaon/h2_TPCSignal_ka_b", "TPC Signal Kaons", - kTH2D, {{axisP}, {axisTPCSignal}}); - hist.add("QA/after/TPC/Kaon/h2_ExpTPCSignal_ka_b", "Expected TPC Signal Kaons", - kTH2D, {{axisP}, {axisTPCSignal}}); - hist.add("QA/after/TPC/Proton/h2_TPCSignal_pr_b", "TPC Signal Protons", - kTH2D, {{axisP}, {axisTPCSignal}}); - hist.add("QA/after/TPC/Proton/h2_ExpTPCSignal_pr_b", "Expected TPC Signal Protons", - kTH2D, {{axisP}, {axisTPCSignal}}); - hist.add("QA/after/TOF/Pion/h_Pt_pi_TOF", "p_{T} (Pions) TPC+TOF", kTH1D, {axisPt}); - hist.add("QA/after/TOF/Kaon/h_Pt_ka_TOF", "p_{T} (Kaons) TPC+TOF", kTH1D, {axisPt}); - hist.add("QA/after/TOF/Proton/h_Pt_pr_TOF", "p_{T} (Protons) TPC+TOF", kTH1D, {axisPt}); - hist.add("QA/after/TOF/Pion/h_rap_pi_TOF", "y (Pions) TPC+TOF ", kTH1D, {axisY}); - hist.add("QA/after/TOF/Kaon/h_rap_ka_TOF", "y (Kaons) TPC+TOF", kTH1D, {axisY}); - hist.add("QA/after/TOF/Proton/h_rap_pr_TOF", "y (Protons) TPC+TOF", kTH1D, {axisY}); - hist.add("QA/after/TOF/Pion/h2_TOFSignal_pi_b", "TOF Signal Pions", - kTH2D, {{axisP}, {axisTOFSignal}}); - hist.add("QA/after/TOF/Pion/h2_ExpTOFSignal_pi_b", "Expected TOF Signal Pions", - kTH2D, {{axisP}, {axisTOFSignal}}); - hist.add("QA/after/TOF/Kaon/h2_TOFSignal_ka_b", "TOF Signal Kaons", - kTH2D, {{axisP}, {axisTOFSignal}}); - hist.add("QA/after/TOF/Kaon/h2_ExpTOFSignal_ka_b", "Expected TOF Signal Kaons", - kTH2D, {{axisP}, {axisTOFSignal}}); - hist.add("QA/after/TOF/Proton/h2_TOFSignal_pr_b", "TOF Signal Protons", - kTH2D, {{axisP}, {axisTOFSignal}}); - hist.add("QA/after/TOF/Proton/h2_ExpTOFSignal_pr_b", "Expected TOF Signal Protons", - kTH2D, {{axisP}, {axisTOFSignal}}); - - hist.add("QA/after/Pion/h_Mult_pi", "Multiplicity Pion", kTH1D, {axisMult}); - hist.add("QA/after/Pion/h_Pt_pi", "p_{T} (Pions) TPC and TPC+TOF", kTH1D, {axisPt}); - hist.add("QA/after/Pion/h_rap_pi", "y (Pions) TPC and TPC+TOF", kTH1D, {axisY}); - hist.add("QA/after/Pion/h2_Pt_rap_pi", "p_{T} vs y (Pions)", kTH2D, {{axisY}, {axisPt}}); - hist.add("QA/after/Pion/h2_DcaZ_pi", "DCA_{z} (Pions)", kTH2D, {{axisPt}, {axisDCAz}}); - hist.add("QA/after/Pion/h2_DcaXY_pi", "DCA_{xy} (Pions)", kTH2D, {{axisPt}, {axisDCAxy}}); - hist.add("QA/after/Pion/h2_TPCNsigma_pi", "n #sigma_{TPC} (Pions)", - kTH2D, {{axisP}, {axisTPCNsigma}}); - hist.add("QA/after/Pion/h2_TOFNsigma_pi", "n #sigma_{TOF} (Pions)", - kTH2D, {{axisP}, {axisTOFNsigma}}); - hist.add("QA/after/Pion/h2_TpcTofNsigma_pi", "n #sigma_{TPC} vs n #sigma_{TOF} (Pions)", - kTH2D, {{{axisTPCNsigma}, {axisTOFNsigma}}}); - hist.add("QA/after/Pion/h2_TPCSignal_pi_a", "TPC Signal Pions (after)", - kTH2D, {{axisP}, {axisTPCSignal}}); - hist.add("QA/after/Pion/h2_TOFSignal_pi_a", "TOF Signal Pions (after)", - kTH2D, {{axisP}, {axisTOFSignal}}); - hist.add("QA/after/Pion/h2_ExpTPCSignal_pi_a", "Expected TPC Signal Pions (after)", - kTH2D, {{axisP}, {axisTPCSignal}}); - hist.add("QA/after/Pion/h2_ExpTOFSignal_pi_a", "Expected TOF Signal Pions (after)", - kTH2D, {{axisP}, {axisTOFSignal}}); - - hist.add("QA/after/Kaon/h_Mult_ka", "Multiplicity Kaon", kTH1D, {axisMult}); - hist.add("QA/after/Kaon/h_Pt_ka", "p_{T} (Kaons) TPC and TPC+TOF", kTH1D, {axisPt}); - hist.add("QA/after/Kaon/h_rap_ka", "y (Kaons) TPC and TPC+TOF", kTH1D, {axisY}); - hist.add("QA/after/Kaon/h2_Pt_rap_ka", "p_{T} vs y (Kaons)", kTH2D, {{axisY}, {axisPt}}); - hist.add("QA/after/Kaon/h2_DcaZ_ka", "DCA_{z} Kaons", kTH2D, {{axisPt}, {axisDCAz}}); - hist.add("QA/after/Kaon/h2_DcaXY_ka", "DCA_{xy} Kaons", kTH2D, {{axisPt}, {axisDCAxy}}); - hist.add("QA/after/Kaon/h2_TPCNsigma_ka", "n #sigma_{TPC} Kaons", - kTH2D, {{axisP}, {axisTPCNsigma}}); - hist.add("QA/after/Kaon/h2_TOFNsigma_ka", "n #sigma_{TOF} Kaons", - kTH2D, {{axisP}, {axisTOFNsigma}}); - hist.add("QA/after/Kaon/h2_TpcTofNsigma_ka", "n #sigma_{TPC} vs n #sigma_{TOF} Kaons", - kTH2D, {{axisTPCNsigma}, {axisTOFNsigma}}); - hist.add("QA/after/Kaon/h2_TPCSignal_ka_a", "TPC Signal Kaons (after)", - kTH2D, {{axisP}, {axisTPCSignal}}); - hist.add("QA/after/Kaon/h2_TOFSignal_ka_a", "TOF Signal Kaons (after)", - kTH2D, {{axisP}, {axisTOFSignal}}); - hist.add("QA/after/Kaon/h2_ExpTPCSignal_ka_a", "Expected TPC Signal Kaons (after)", - kTH2D, {{axisP}, {axisTPCSignal}}); - hist.add("QA/after/Kaon/h2_ExpTOFSignal_ka_a", "Expected TOF Signal Kaons (after)", - kTH2D, {{axisP}, {axisTOFSignal}}); - - hist.add("QA/after/Proton/h_Mult_pr", "Multiplicity Proton", kTH1D, {axisMult}); - hist.add("QA/after/Proton/h_Pt_pr", "p_{T} (Protons) TPC and TPC+TOF", kTH1D, {axisPt}); - hist.add("QA/after/Proton/h_rap_pr", "y(Protons) TPC and TPC+TOF", kTH1D, {axisY}); - hist.add("QA/after/Proton/h2_Pt_rap_pr", "p_{T} vs y (Protons)", kTH2D, {{axisY}, {axisPt}}); - hist.add("QA/after/Proton/h2_DcaZ_pr", "DCA_{z} (Protons)", kTH2D, {{axisPt}, {axisDCAz}}); - hist.add("QA/after/Proton/h2_DcaXY_pr", "DCA_{xy} (Protons)", kTH2D, {{axisPt}, {axisDCAxy}}); - hist.add("QA/after/Proton/h2_TPCNsigma_pr", "n #sigma_{TPC} (Protons)", - kTH2D, {{axisP}, {axisTPCNsigma}}); - hist.add("QA/after/Proton/h2_TOFNsigma_pr", "n #sigma_{TOF} (Protons)", - kTH2D, {{axisP}, {axisTOFNsigma}}); - hist.add("QA/after/Proton/h2_TpcTofNsigma_pr", "n #sigma_{TPC} vs n #sigma_{TOF} (Protons)", - kTH2D, {{{axisTPCNsigma}, {axisTOFNsigma}}}); - hist.add("QA/after/Proton/h2_TPCSignal_pr_a", "TPC Signal Protons (after)", - kTH2D, {{axisP}, {axisTPCSignal}}); - hist.add("QA/after/Proton/h2_TOFSignal_pr_a", "TOF Signal Protons (after)", - kTH2D, {{axisP}, {axisTOFSignal}}); - hist.add("QA/after/Proton/h2_ExpTPCSignal_pr_a", "Expected TPC Signal Protons (after)", - kTH2D, {{axisP}, {axisTPCSignal}}); - hist.add("QA/after/Proton/h2_ExpTOFSignal_pr_a", "Expected TOF Signal Protons (after)", - kTH2D, {{axisP}, {axisTOFSignal}}); - - // Analysis: - // Charged Particles - hist.add("Analysis/Charged/h_Mult_ch", "Multiplicity of Charged Prticles", kTH1D, {axisMult}); - hist.add("Analysis/Charged/h_mean_Q1_ch", "mean p_{T} (Charged particles)", kTH1D, {axisMeanPt}); - hist.add("Analysis/Charged/p_mean_Q1_ch", "mean p_{T} (Charged particles)", kTProfile, {axisMult}); - hist.add("Analysis/Charged/h_mean_Q1_Mult_ch", "Mean p_{T} vs N_{ch} (Charged Particles)", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Charged/h_twopart_Mult_ch", "Twopart vs N_{ch} (Charged Particles)", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Charged/h_threepart_Mult_ch", "Threepart vs N_{ch} (Charged Particles)", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Charged/h_fourpart_Mult_ch", "Fourpart vs N_{ch} (Charged Particles)", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - - // Pions - hist.add("Analysis/Pion/h_Mult_pi", "Multiplicity Pion", kTH1D, {axisMult}); - hist.add("Analysis/Pion/h_mean_Q1_pi", "mean p_{T} Pion", kTH1D, {axisMeanPt}); - hist.add("Analysis/Pion/p_mean_Q1_pi", "mean p_{T} Pion", kTProfile, {axisMult}); - hist.add("Analysis/Pion/h_mean_Q1_Mult_pi", "mean_Q1_Mult Pion", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Pion/h_twopart_Mult_pi", "twopart_Mult Pion", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Pion/h_threepart_Mult_pi", "threepart_Mult Pion", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Pion/h_fourpart_Mult_pi", "fourpart_Mult Pion", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - - // Kaons - hist.add("Analysis/Kaon/h_Mult_ka", "Multiplicity Kaon", kTH1D, {axisMult}); - hist.add("Analysis/Kaon/h_mean_Q1_ka", "mean p_{T} Kaon", kTH1D, {axisMeanPt}); - hist.add("Analysis/Kaon/p_mean_Q1_ka", "mean p_{T} Kaon", kTProfile, {axisMult}); - hist.add("Analysis/Kaon/h_mean_Q1_Mult_ka", "mean_Q1_Mult Kaon", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Kaon/h_twopart_Mult_ka", "twopart_Mult Kaon", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Kaon/h_threepart_Mult_ka", "threepart_Mult Kaon", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Kaon/h_fourpart_Mult_ka", "fourpart_Mult Kaon", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - - // Protons - hist.add("Analysis/Proton/h_Mult_pr", "Multiplicity Proton", kTH1D, {axisMult}); - hist.add("Analysis/Proton/h_mean_Q1_pr", "mean p_{T} Proton", kTH1D, {axisMeanPt}); - hist.add("Analysis/Proton/p_mean_Q1_pr", "mean p_{T} Proton", kTProfile, {axisMult}); - hist.add("Analysis/Proton/h_mean_Q1_Mult_pr", "mean_Q1_Mult Proton", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Proton/h_twopart_Mult_pr", "twopart_Mult Proton", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Proton/h_threepart_Mult_pr", "threepart_Mult Proton", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Proton/h_fourpart_Mult_pr", "fourpart_Mult Proton", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - - // Additional QA - hist.add("Analysis/Charged/h_mean_Q1_Mult_ch_tof", "mean_Q1_Mult (Charged Particles) (TOF+TPC)", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Charged/h_twopart_Mult_ch_tof", "twopart_Mult (Charged Particles) (TOF+TPC)", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Pion/h_mean_Q1_Mult_pi_tof", "mean_Q1_Mult Pion (TOF+TPC)", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Pion/h_mean_Q1_Mult_pi_tpc", "mean_Q1_Mult Pion (TPC)", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Pion/h_twopart_Mult_pi_tof", "twopart_Mult Pion (TOF+TPC)", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Pion/h_twopart_Mult_pi_tpc", "twopart_Mult Pion (TPC)", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Proton/h_mean_Q1_Mult_pr_tof", "mean_Q1_Mult Proton (TOF+TPC)", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Proton/h_mean_Q1_Mult_pr_tpc", "mean_Q1_Mult Proton (TPC)", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Proton/h_twopart_Mult_pr_tof", "twopart_Mult Proton (TOF+TPC)", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Proton/h_twopart_Mult_pr_tpc", "twopart_Mult Proton (TPC)", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Kaon/h_mean_Q1_Mult_ka_tof", "mean_Q1_Mult Kaon (TOF+TPC)", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Kaon/h_mean_Q1_Mult_ka_tpc", "mean_Q1_Mult Kaon (TPC)", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Kaon/h_twopart_Mult_ka_tof", "twopart_Mult Kaon (TOF+TPC)", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - hist.add("Analysis/Kaon/h_twopart_Mult_ka_tpc", "twopart_Mult Kaon (TPC)", - kTHnSparseD, {{axisMultTPC}, {axisPart}, {axisMultFT0M}}); - } - - void process_QA(MyAllCollisions::iterator const& myCol, MyAllTracks const& myTracks) - { - for (auto& myTrack : myTracks) { - hist.fill(HIST("QA/before/Charged/h_Eta_ch"), myTrack.eta()); - hist.fill(HIST("QA/before/Charged/h_Pt_ch"), myTrack.pt()); - hist.fill(HIST("QA/before/h_TPCChi2perCluster"), myTrack.tpcChi2NCl()); - hist.fill(HIST("QA/before/h_ITSChi2perCluster"), myTrack.itsChi2NCl()); - hist.fill(HIST("QA/before/h_crossedTPC"), myTrack.tpcNClsCrossedRows()); - hist.fill(HIST("QA/before/Charged/h2_DcaXY_ch"), myTrack.pt(), myTrack.dcaXY()); - hist.fill(HIST("QA/before/Charged/h2_DcaZ_ch"), myTrack.pt(), myTrack.dcaZ()); - } - hist.fill(HIST("QA/before/h_VtxZ"), myCol.posZ()); - hist.fill(HIST("QA/before/h_Counts"), 2); - } - PROCESS_SWITCH(meanPtFlucId, process_QA, "process QA", true); - - void process(MyFilteredCollisions::iterator const& col, MyFilteredTracks const& tracks) - { - double Cent_FT0M = 0; - int N_Pi = 0, N_Ka = 0, N_Pr = 0; - int Nch = 0, NTPC = 0, N_FT0M = 0; - int N_Ka_tpc = 0, N_Pr_tpc = 0, N_Pi_tpc = 0; - int Nch_tof = 0, N_Ka_tof = 0, N_Pr_tof = 0, N_Pi_tof = 0; - double pt_ch = 0, Q1_ch = 0, Q2_ch = 0, Q3_ch = 0, Q4_ch = 0; - double pt_Pi = 0, Q1_Pi = 0, Q2_Pi = 0, Q3_Pi = 0, Q4_Pi = 0; - double pt_Pr = 0, Q1_Pr = 0, Q2_Pr = 0, Q3_Pr = 0, Q4_Pr = 0; - double pt_Ka = 0, Q1_Ka = 0, Q2_Ka = 0, Q3_Ka = 0, Q4_Ka = 0; - double Q1_tof = 0, Q1_Pi_tof = 0, Q1_Pr_tof = 0, Q1_Ka_tof = 0; - double Q1_Pi_tpc = 0, Q1_Pr_tpc = 0, Q1_Ka_tpc = 0; - double Q2_tof = 0, Q2_Pi_tof = 0, Q2_Pr_tof = 0, Q2_Ka_tof = 0; - double Q2_Pi_tpc = 0, Q2_Pr_tpc = 0, Q2_Ka_tpc = 0; - - for (auto& track : tracks) { - Nch++; - pt_ch = track.pt(); - Q1_ch += pt_ch; - Q2_ch += pt_ch * pt_ch; - Q3_ch += pt_ch * pt_ch * pt_ch; - Q4_ch += pt_ch * pt_ch * pt_ch * pt_ch; - - hist.fill(HIST("QA/after/Charged/h_Eta_ch"), track.eta()); - hist.fill(HIST("QA/after/Charged/h_Pt_ch"), track.pt()); - hist.fill(HIST("QA/after/Charged/h2_Pt_Eta_ch"), track.eta(), track.pt()); - hist.fill(HIST("QA/after/Charged/h2_DcaXY_ch"), track.pt(), track.dcaXY()); - hist.fill(HIST("QA/after/Charged/h2_DcaZ_ch"), track.pt(), track.dcaZ()); - - hist.fill(HIST("QA/after/h_TPCChi2perCluster"), track.tpcChi2NCl()); - hist.fill(HIST("QA/after/h_ITSChi2perCluster"), track.itsChi2NCl()); - hist.fill(HIST("QA/after/h_crossedTPC"), track.tpcNClsCrossedRows()); - - hist.fill(HIST("QA/before/h2_TOFSignal_b"), track.p(), track.beta()); - hist.fill(HIST("QA/before/h2_TPCSignal_b"), track.p(), track.tpcSignal()); - - hist.fill(HIST("QA/before/Pion/h2_TPCNsigma_pi"), track.p(), track.tpcNSigmaPi()); - hist.fill(HIST("QA/before/Pion/h2_TOFNsigma_pi"), track.p(), track.tofNSigmaPi()); - hist.fill(HIST("QA/before/Pion/h2_TpcTofNsigma_pi"), track.tpcNSigmaPi(), track.tofNSigmaPi()); - hist.fill(HIST("QA/before/Proton/h2_TPCNsigma_pr"), track.p(), track.tpcNSigmaPr()); - hist.fill(HIST("QA/before/Proton/h2_TOFNsigma_pr"), track.p(), track.tofNSigmaPr()); - hist.fill(HIST("QA/before/Proton/h2_TpcTofNsigma_pr"), track.tpcNSigmaPr(), track.tofNSigmaPr()); - hist.fill(HIST("QA/before/Kaon/h2_TPCNsigma_ka"), track.p(), track.tpcNSigmaKa()); - hist.fill(HIST("QA/before/Kaon/h2_TOFNsigma_ka"), track.p(), track.tofNSigmaKa()); - hist.fill(HIST("QA/before/Kaon/h2_TpcTofNsigma_ka"), track.tpcNSigmaKa(), track.tofNSigmaKa()); - - // ###################################################// - // TPC (Without p cuts) // - // ###################################################// - if (abs(track.tpcNSigmaPi()) < nSigCut3) { - if (abs(track.rapidity(massPi)) >= 0.5) - continue; - N_Pi_tpc++; - Q1_Pi_tpc += track.pt(); - Q2_Pi_tpc += track.pt() * track.pt(); - hist.fill(HIST("QA/after/TPC/Pion/h_Pt_pi_TPC"), track.pt()); - hist.fill(HIST("QA/after/TPC/Pion/h_rap_pi_TPC"), track.rapidity(massPi)); - hist.fill(HIST("QA/after/TPC/Pion/h2_TPCSignal_pi_b"), track.p(), track.tpcSignal()); - hist.fill(HIST("QA/after/TPC/Pion/h2_ExpTPCSignal_pi_b"), track.p(), track.tpcExpSignalPi(track.tpcSignal())); - } - if (abs(track.tpcNSigmaKa()) < nSigCut3) { - if (abs(track.rapidity(massKa)) >= 0.5) - continue; - N_Ka_tpc++; - Q1_Ka_tpc += track.pt(); - Q2_Ka_tpc += track.pt() * track.pt(); - hist.fill(HIST("QA/after/TPC/Kaon/h_Pt_ka_TPC"), track.pt()); - hist.fill(HIST("QA/after/TPC/Kaon/h_rap_ka_TPC"), track.rapidity(massKa)); - hist.fill(HIST("QA/after/TPC/Kaon/h2_TPCSignal_ka_b"), track.p(), track.tpcSignal()); - hist.fill(HIST("QA/after/TPC/Kaon/h2_ExpTPCSignal_ka_b"), track.p(), track.tpcExpSignalKa(track.tpcSignal())); - } - if (abs(track.tpcNSigmaPr()) < nSigCut3) { - if (abs(track.rapidity(massPr)) >= 0.5) - continue; - N_Pr_tpc++; - Q1_Pr_tpc += track.pt(); - Q2_Pr_tpc += track.pt() * track.pt(); - hist.fill(HIST("QA/after/TPC/Proton/h_Pt_pr_TPC"), track.pt()); - hist.fill(HIST("QA/after/TPC/Proton/h_rap_pr_TPC"), track.rapidity(massPr)); - hist.fill(HIST("QA/after/TPC/Proton/h2_TPCSignal_pr_b"), track.p(), track.tpcSignal()); - hist.fill(HIST("QA/after/TPC/Proton/h2_ExpTPCSignal_pr_b"), track.p(), track.tpcExpSignalPr(track.tpcSignal())); - } - - // ###################################################// - // TPC + TOF (Without p cuts) // - // ###################################################// - if (track.hasTOF()) { - Nch_tof++; - Q1_tof += track.pt(); - Q2_tof += track.pt() * track.pt(); - - if ((std::pow(track.tpcNSigmaPi(), 2) + std::pow(track.tofNSigmaPi(), 2)) < 6.0) { - if (abs(track.rapidity(massPi)) >= 0.5) - continue; - N_Pi_tof++; - Q1_Pi_tof += track.pt(); - Q2_Pi_tof += track.pt() * track.pt(); - hist.fill(HIST("QA/after/TOF/Pion/h_Pt_pi_TOF"), track.pt()); - hist.fill(HIST("QA/after/TOF/Pion/h_rap_pi_TOF"), track.rapidity(massPi)); - hist.fill(HIST("QA/after/TOF/Pion/h2_TOFSignal_pi_b"), track.p(), track.beta()); - hist.fill(HIST("QA/after/TOF/Pion/h2_ExpTOFSignal_pi_b"), track.p(), track.tofExpSignalPi(track.beta())); - } - if ((std::pow(track.tpcNSigmaKa(), 2) + std::pow(track.tofNSigmaKa(), 2)) < 6.0) { - if (abs(track.rapidity(massKa)) >= 0.5) - continue; - N_Ka_tof++; - Q1_Ka_tof += track.pt(); - Q2_Ka_tof += track.pt() * track.pt(); - hist.fill(HIST("QA/after/TOF/Kaon/h_Pt_ka_TOF"), track.pt()); - hist.fill(HIST("QA/after/TOF/Kaon/h_rap_ka_TOF"), track.rapidity(massKa)); - hist.fill(HIST("QA/after/TOF/Kaon/h2_TOFSignal_ka_b"), track.p(), track.beta()); - hist.fill(HIST("QA/after/TOF/Kaon/h2_ExpTOFSignal_ka_b"), track.p(), track.tofExpSignalKa(track.beta())); - } - if ((std::pow(track.tpcNSigmaPr(), 2) + std::pow(track.tofNSigmaPr(), 2)) < 6.0) { - if (abs(track.rapidity(massPr)) >= 0.5) - continue; - N_Pr_tof++; - Q1_Pr_tof += track.pt(); - Q2_Pr_tof += track.pt() * track.pt(); - hist.fill(HIST("QA/after/TOF/Proton/h_Pt_pr_TOF"), track.pt()); - hist.fill(HIST("QA/after/TOF/Proton/h_rap_pr_TOF"), track.rapidity(massPr)); - hist.fill(HIST("QA/after/TOF/Proton/h2_TOFSignal_pr_b"), track.p(), track.beta()); - hist.fill(HIST("QA/after/TOF/Proton/h2_ExpTOFSignal_pr_b"), track.p(), track.tofExpSignalPr(track.beta())); - } - } - - // ####################################################// - // TPC and TPC+TOF nSigma Cuts (with p cuts) // - // ####################################################// - // For Pions: - if ((track.hasTOF() == false && - ((abs(track.tpcNSigmaPi()) < nSigCut3 && track.p() <= piP1) || (abs(track.tpcNSigmaPi()) < nSigCut2 && track.p() > piP1 && track.p() <= piP2))) || - (track.hasTOF() && abs(track.tpcNSigmaPi()) < nSigCut4 && abs(track.tofNSigmaEl()) > nSigCut1 && - ((abs(track.tofNSigmaPi()) < nSigCut3 && track.p() <= piP3) || (abs(track.tofNSigmaPi()) < nSigCut25 && track.p() > piP3 && track.p() <= piP4) || (abs(track.tofNSigmaPi()) < nSigCut2 && track.p() > piP4)))) { - if (abs(track.rapidity(massPi)) >= 0.5) - continue; - N_Pi++; - pt_Pi = track.pt(); - Q1_Pi += pt_Pi; - Q2_Pi += pt_Pi * pt_Pi; - Q3_Pi += pt_Pi * pt_Pi * pt_Pi; - Q4_Pi += pt_Pi * pt_Pi * pt_Pi * pt_Pi; - hist.fill(HIST("QA/after/Pion/h_Pt_pi"), track.pt()); - hist.fill(HIST("QA/after/Pion/h_rap_pi"), track.rapidity(massPi)); - hist.fill(HIST("QA/after/Pion/h2_Pt_rap_pi"), track.rapidity(massPi), track.pt()); - hist.fill(HIST("QA/after/Pion/h2_DcaXY_pi"), track.pt(), track.dcaXY()); - hist.fill(HIST("QA/after/Pion/h2_DcaZ_pi"), track.pt(), track.dcaZ()); - hist.fill(HIST("QA/after/Pion/h2_TPCNsigma_pi"), track.p(), track.tpcNSigmaPi()); - hist.fill(HIST("QA/after/Pion/h2_TOFNsigma_pi"), track.p(), track.tofNSigmaPi()); - hist.fill(HIST("QA/after/Pion/h2_TpcTofNsigma_pi"), track.tpcNSigmaPi(), track.tofNSigmaPi()); - hist.fill(HIST("QA/after/h2_TOFSignal_a"), track.p(), track.beta()); - hist.fill(HIST("QA/after/Pion/h2_TOFSignal_pi_a"), track.p(), track.beta()); - hist.fill(HIST("QA/after/h2_TPCSignal_a"), track.p(), track.tpcSignal()); - hist.fill(HIST("QA/after/Pion/h2_TPCSignal_pi_a"), track.p(), track.tpcSignal()); - hist.fill(HIST("QA/after/Pion/h2_ExpTOFSignal_pi_a"), track.p(), track.tofExpSignalPi(track.beta())); - hist.fill(HIST("QA/after/Pion/h2_ExpTPCSignal_pi_a"), track.p(), track.tpcExpSignalPi(track.tpcSignal())); - } - - // For Kaons: - if ((track.hasTOF() == false && - ((abs(track.tpcNSigmaKa()) < nSigCut3 && track.pt() > kaP1 && track.p() <= kaP2) || (abs(track.tpcNSigmaKa()) < nSigCut25 && track.p() > kaP2 && track.p() <= kaP3) || (abs(track.tpcNSigmaKa()) < nSigCut2 && track.p() > kaP3 && track.p() <= kaP4) || (abs(track.tpcNSigmaKa()) < nSigCut15 && track.p() > kaP4 && track.p() <= kaP5))) || - (track.hasTOF() && abs(track.tpcNSigmaKa()) < nSigCut4 && abs(track.tofNSigmaEl()) > nSigCut1 && - ((abs(track.tofNSigmaKa()) < nSigCut3 && track.pt() > kaP1 && track.p() <= kaP6) || (abs(track.tofNSigmaKa()) < nSigCut2 && track.p() > kaP6 && track.p() <= kaP7) || (abs(track.tofNSigmaKa()) < nSigCut15 && track.p() > kaP7 && track.p() <= kaP8) || (abs(track.tofNSigmaKa()) < nSigCut1 && track.p() > kaP8)))) { - if (abs(track.rapidity(massKa)) >= 0.5) - continue; - pt_Ka = track.pt(); - Q1_Ka += pt_Ka; - Q2_Ka += pt_Ka * pt_Ka; - Q3_Ka += pt_Ka * pt_Ka * pt_Ka; - Q4_Ka += pt_Ka * pt_Ka * pt_Ka * pt_Ka; - N_Ka++; - hist.fill(HIST("QA/after/Kaon/h_Pt_ka"), track.pt()); - hist.fill(HIST("QA/after/Kaon/h_rap_ka"), track.rapidity(massKa)); - hist.fill(HIST("QA/after/Kaon/h2_Pt_rap_ka"), track.rapidity(massKa), track.pt()); - hist.fill(HIST("QA/after/Kaon/h2_DcaXY_ka"), track.pt(), track.dcaXY()); - hist.fill(HIST("QA/after/Kaon/h2_DcaZ_ka"), track.pt(), track.dcaZ()); - hist.fill(HIST("QA/after/Kaon/h2_TPCNsigma_ka"), track.p(), track.tpcNSigmaKa()); - hist.fill(HIST("QA/after/Kaon/h2_TOFNsigma_ka"), track.p(), track.tofNSigmaKa()); - hist.fill(HIST("QA/after/Kaon/h2_TpcTofNsigma_ka"), track.tpcNSigmaKa(), track.tofNSigmaKa()); - hist.fill(HIST("QA/after/h2_TOFSignal_a"), track.p(), track.beta()); - hist.fill(HIST("QA/after/Kaon/h2_TOFSignal_ka_a"), track.p(), track.beta()); - hist.fill(HIST("QA/after/h2_TPCSignal_a"), track.p(), track.tpcSignal()); - hist.fill(HIST("QA/after/Kaon/h2_TPCSignal_ka_a"), track.p(), track.tpcSignal()); - hist.fill(HIST("QA/after/Kaon/h2_ExpTOFSignal_ka_a"), track.p(), track.tofExpSignalKa(track.beta())); - hist.fill(HIST("QA/after/Kaon/h2_ExpTPCSignal_ka_a"), track.p(), track.tpcExpSignalKa(track.tpcSignal())); - } - - // For Protons: - if ((track.hasTOF() == false && - ((abs(track.tpcNSigmaPr()) < nSigCut3 && track.pt() > prP1 && track.p() <= prP2) || (abs(track.tpcNSigmaPr()) < nSigCut25 && track.p() > prP2 && track.p() <= prP3) || (abs(track.tpcNSigmaPr()) < nSigCut2 && track.p() > prP3 && track.p() <= prP4) || (abs(track.tpcNSigmaPr()) < nSigCut15 && track.p() > prP4 && track.p() <= prP5) || (abs(track.tpcNSigmaPr()) < nSigCut1 && track.p() > prP5 && track.p() <= prP6))) || - (track.hasTOF() && abs(track.tpcNSigmaPr()) < nSigCut4 && abs(track.tofNSigmaEl()) > nSigCut1 && abs(track.tofNSigmaPr()) < nSigCut3 && track.pt() > prP1)) { - if (abs(track.rapidity(massPr)) >= 0.5) - continue; - pt_Pr = track.pt(); - Q1_Pr += pt_Pr; - Q2_Pr += pt_Pr * pt_Pr; - Q3_Pr += pt_Pr * pt_Pr * pt_Pr; - Q4_Pr += pt_Pr * pt_Pr * pt_Pr * pt_Pr; - N_Pr++; - hist.fill(HIST("QA/after/Proton/h_Pt_pr"), track.pt()); - hist.fill(HIST("QA/after/Proton/h_rap_pr"), track.rapidity(massPr)); - hist.fill(HIST("QA/after/Proton/h2_DcaZ_pr"), track.pt(), track.dcaZ()); - hist.fill(HIST("QA/after/Proton/h2_DcaXY_pr"), track.pt(), track.dcaXY()); - hist.fill(HIST("QA/after/Proton/h2_Pt_rap_pr"), track.rapidity(massPr), track.pt()); - hist.fill(HIST("QA/after/Proton/h2_TPCNsigma_pr"), track.p(), track.tpcNSigmaPr()); - hist.fill(HIST("QA/after/Proton/h2_TOFNsigma_pr"), track.p(), track.tofNSigmaPr()); - hist.fill(HIST("QA/after/Proton/h2_TpcTofNsigma_pr"), track.tpcNSigmaPr(), track.tofNSigmaPr()); - hist.fill(HIST("QA/after/Proton/h2_TPCSignal_pr_a"), track.p(), track.tpcSignal()); - hist.fill(HIST("QA/after/h2_TPCSignal_a"), track.p(), track.tpcSignal()); - hist.fill(HIST("QA/after/h2_TOFSignal_a"), track.p(), track.beta()); - hist.fill(HIST("QA/after/Proton/h2_TOFSignal_pr_a"), track.p(), track.beta()); - hist.fill(HIST("QA/after/Proton/h2_ExpTOFSignal_pr_a"), track.p(), track.tofExpSignalPr(track.beta())); - hist.fill(HIST("QA/after/Proton/h2_ExpTPCSignal_pr_a"), track.p(), track.tpcExpSignalPr(track.tpcSignal())); - } - } - - NTPC = col.multTPC(); - N_FT0M = col.multFT0M(); - Cent_FT0M = col.centFT0M(); - hist.fill(HIST("QA/after/h_VtxZ"), col.posZ()); - hist.fill(HIST("QA/after/h_Counts"), 2); - hist.fill(HIST("QA/after/h_NTPC"), NTPC); - hist.fill(HIST("QA/after/h_Cent"), Cent_FT0M); - hist.fill(HIST("QA/after/h_NFT0M"), N_FT0M); - hist.fill(HIST("QA/after/h2_NTPC_NFT0M"), N_FT0M, NTPC); - hist.fill(HIST("QA/after/h2_NTPC_Cent"), Cent_FT0M, NTPC); - hist.fill(HIST("QA/after/p_NTPC_Cent"), Cent_FT0M, NTPC); - hist.fill(HIST("QA/after/p_NTPC_NFT0M"), N_FT0M, NTPC); - hist.fill(HIST("QA/after/p_NFT0M_NTPC"), NTPC, N_FT0M); - hist.fill(HIST("QA/after/h2_NTPC_Nch"), NTPC, Nch); - - hist.fill(HIST("Analysis/Charged/h_Mult_ch"), Nch); - hist.fill(HIST("Analysis/Pion/h_Mult_pi"), N_Pi); - hist.fill(HIST("Analysis/Kaon/h_Mult_ka"), N_Ka); - hist.fill(HIST("Analysis/Proton/h_Mult_pr"), N_Pr); - - hist.fill(HIST("QA/after/Charged/h_Mult_ch"), Nch); - hist.fill(HIST("QA/after/Pion/h_Mult_pi"), N_Pi); - hist.fill(HIST("QA/after/Kaon/h_Mult_ka"), N_Ka); - hist.fill(HIST("QA/after/Proton/h_Mult_pr"), N_Pr); - - // Charged Particles: - if (Nch > 1) { - auto Nch2 = static_cast(Nch) * (static_cast(Nch) - 1); - auto mean_Q1 = Q1_ch / static_cast(Nch); - auto twopart = ((Q1_ch * Q1_ch) - Q2_ch); - auto twopart1 = (twopart) / (Nch2); - hist.fill(HIST("Analysis/Charged/h_mean_Q1_ch"), mean_Q1); - hist.fill(HIST("Analysis/Charged/p_mean_Q1_ch"), NTPC, mean_Q1); - hist.fill(HIST("Analysis/Charged/h_mean_Q1_Mult_ch"), NTPC, mean_Q1, N_FT0M); - hist.fill(HIST("Analysis/Charged/h_twopart_Mult_ch"), NTPC, twopart1, N_FT0M); - } - - if (Nch > 2) { - auto Nch3 = static_cast(Nch) * (static_cast(Nch) - 1) * (static_cast(Nch) - 2); - auto threepart = ((Q1_ch * Q1_ch * Q1_ch) - (3 * Q2_ch * Q1_ch) + 2 * Q3_ch); - auto threepart1 = threepart / Nch3; - hist.fill(HIST("Analysis/Charged/h_threepart_Mult_ch"), NTPC, threepart1, N_FT0M); - } - - if (Nch > 3) { - auto Nch4 = static_cast(Nch) * (static_cast(Nch) - 1) * (static_cast(Nch) - 2) * (static_cast(Nch) - 3); - auto fourpart = ((Q1_ch * Q1_ch * Q1_ch * Q1_ch) - (6 * Q2_ch * Q1_ch * Q1_ch) + (3 * Q2_ch * Q2_ch) + (8 * Q3_ch * Q1_ch) - 6 * Q4_ch); - auto fourpart1 = fourpart / Nch4; - hist.fill(HIST("Analysis/Charged/h_fourpart_Mult_ch"), NTPC, fourpart1, N_FT0M); - } - - // Pions: - if (N_Pi > 1) { - auto Nch2_Pi = static_cast(N_Pi) * (static_cast(N_Pi) - 1); - auto mean_Q1_Pi = Q1_Pi / static_cast(N_Pi); - auto twopart_Pi = ((Q1_Pi * Q1_Pi) - Q2_Pi); - auto twopart1_Pi = (twopart_Pi) / (Nch2_Pi); - hist.fill(HIST("Analysis/Pion/h_mean_Q1_pi"), mean_Q1_Pi); - hist.fill(HIST("Analysis/Pion/p_mean_Q1_pi"), NTPC, mean_Q1_Pi); - hist.fill(HIST("Analysis/Pion/h_mean_Q1_Mult_pi"), NTPC, mean_Q1_Pi, N_FT0M); - hist.fill(HIST("Analysis/Pion/h_twopart_Mult_pi"), NTPC, twopart1_Pi, N_FT0M); - } - - if (N_Pi > 2) { - auto Nch3_Pi = static_cast(N_Pi) * (static_cast(N_Pi) - 1) * (static_cast(N_Pi) - 2); - auto threepart_Pi = ((Q1_Pi * Q1_Pi * Q1_Pi) - (3 * Q2_Pi * Q1_Pi) + 2 * Q3_Pi); - auto threepart1_Pi = threepart_Pi / Nch3_Pi; - hist.fill(HIST("Analysis/Pion/h_threepart_Mult_pi"), NTPC, threepart1_Pi, N_FT0M); - } - - if (N_Pi > 3) { - auto Nch4_Pi = static_cast(N_Pi) * (static_cast(N_Pi) - 1) * (static_cast(N_Pi) - 2) * (static_cast(N_Pi) - 3); - auto fourpart_Pi = ((Q1_Pi * Q1_Pi * Q1_Pi * Q1_Pi) - (6 * Q2_Pi * Q1_Pi * Q1_Pi) + (3 * Q2_Pi * Q2_Pi) + (8 * Q3_Pi * Q1_Pi) - 6 * Q4_Pi); - auto fourpart1_Pi = fourpart_Pi / Nch4_Pi; - hist.fill(HIST("Analysis/Pion/h_fourpart_Mult_pi"), NTPC, fourpart1_Pi, N_FT0M); - } - - // Kaons: - if (N_Ka > 1) { - auto Nch2_Ka = static_cast(N_Ka) * (static_cast(N_Ka) - 1); - auto mean_Q1_Ka = Q1_Ka / static_cast(N_Ka); - auto twopart_Ka = ((Q1_Ka * Q1_Ka) - Q2_Ka); - auto twopart1_Ka = (twopart_Ka) / (Nch2_Ka); - hist.fill(HIST("Analysis/Kaon/h_mean_Q1_ka"), mean_Q1_Ka); - hist.fill(HIST("Analysis/Kaon/p_mean_Q1_ka"), NTPC, mean_Q1_Ka); - hist.fill(HIST("Analysis/Kaon/h_mean_Q1_Mult_ka"), NTPC, mean_Q1_Ka, N_FT0M); - hist.fill(HIST("Analysis/Kaon/h_twopart_Mult_ka"), NTPC, twopart1_Ka, N_FT0M); - } - - if (N_Ka > 2) { - auto Nch3_Ka = static_cast(N_Ka) * (static_cast(N_Ka) - 1) * (static_cast(N_Ka) - 2); - auto threepart_Ka = ((Q1_Ka * Q1_Ka * Q1_Ka) - (3 * Q2_Ka * Q1_Ka) + 2 * Q3_Ka); - auto threepart1_Ka = threepart_Ka / Nch3_Ka; - hist.fill(HIST("Analysis/Kaon/h_threepart_Mult_ka"), NTPC, threepart1_Ka, N_FT0M); - } - - if (N_Ka > 3) { - auto Nch4_Ka = static_cast(N_Ka) * (static_cast(N_Ka) - 1) * (static_cast(N_Ka) - 2) * (static_cast(N_Ka) - 3); - auto fourpart_Ka = ((Q1_Ka * Q1_Ka * Q1_Ka * Q1_Ka) - (6 * Q2_Ka * Q1_Ka * Q1_Ka) + (3 * Q2_Ka * Q2_Ka) + (8 * Q3_Ka * Q1_Ka) - 6 * Q4_Ka); - auto fourpart1_Ka = fourpart_Ka / Nch4_Ka; - hist.fill(HIST("Analysis/Kaon/h_fourpart_Mult_ka"), NTPC, fourpart1_Ka, N_FT0M); - } - - // Protons: - if (N_Pr > 1) { - auto Nch2_Pr = static_cast(N_Pr) * (static_cast(N_Pr) - 1); - auto mean_Q1_Pr = Q1_Pr / static_cast(N_Pr); - auto twopart_Pr = ((Q1_Pr * Q1_Pr) - Q2_Pr); - auto twopart1_Pr = (twopart_Pr) / (Nch2_Pr); - hist.fill(HIST("Analysis/Proton/h_mean_Q1_pr"), mean_Q1_Pr); - hist.fill(HIST("Analysis/Proton/p_mean_Q1_pr"), NTPC, mean_Q1_Pr); - hist.fill(HIST("Analysis/Proton/h_mean_Q1_Mult_pr"), NTPC, mean_Q1_Pr, N_FT0M); - hist.fill(HIST("Analysis/Proton/h_twopart_Mult_pr"), NTPC, twopart1_Pr, N_FT0M); - } - - if (N_Pr > 2) { - auto Nch3_Pr = static_cast(N_Pr) * (static_cast(N_Pr) - 1) * (static_cast(N_Pr) - 2); - auto threepart_Pr = ((Q1_Pr * Q1_Pr * Q1_Pr) - (3 * Q2_Pr * Q1_Pr) + 2 * Q3_Pr); - auto threepart1_Pr = threepart_Pr / Nch3_Pr; - hist.fill(HIST("Analysis/Proton/h_threepart_Mult_pr"), NTPC, threepart1_Pr, N_FT0M); - } - - if (N_Pr > 3) { - auto Nch4_Pr = static_cast(N_Pr) * (static_cast(N_Pr) - 1) * (static_cast(N_Pr) - 2) * (static_cast(N_Pr) - 3); - auto fourpart_Pr = ((Q1_Pr * Q1_Pr * Q1_Pr * Q1_Pr) - (6 * Q2_Pr * Q1_Pr * Q1_Pr) + (3 * Q2_Pr * Q2_Pr) + (8 * Q3_Pr * Q1_Pr) - 6 * Q4_Pr); - auto fourpart1_Pr = fourpart_Pr / Nch4_Pr; - hist.fill(HIST("Analysis/Proton/h_fourpart_Mult_pr"), NTPC, fourpart1_Pr, Cent_FT0M); - } - - //----------------------------- TPC (No p cuts)---------------------------// - if (N_Pi_tpc > 1) { - double mean_Q1_Pi_tpc = Q1_Pi_tpc / static_cast(N_Pi_tpc); - double twopart_Pi_tpc = ((Q1_Pi_tpc * Q1_Pi_tpc) - Q2_Pi_tpc) / (static_cast(N_Pi_tpc) * (static_cast(N_Pi_tpc) - 1)); - hist.fill(HIST("Analysis/Pion/h_mean_Q1_Mult_pi_tpc"), NTPC, mean_Q1_Pi_tpc, N_FT0M); - hist.fill(HIST("Analysis/Pion/h_twopart_Mult_pi_tpc"), NTPC, twopart_Pi_tpc, N_FT0M); - } - if (N_Ka_tpc > 1) { - double mean_Q1_Ka_tpc = Q1_Ka_tpc / static_cast(N_Ka_tpc); - double twopart_Ka_tpc = ((Q1_Ka_tpc * Q1_Ka_tpc) - Q2_Ka_tpc) / (static_cast(N_Ka_tpc) * (static_cast(N_Ka_tpc) - 1)); - hist.fill(HIST("Analysis/Kaon/h_mean_Q1_Mult_ka_tpc"), NTPC, mean_Q1_Ka_tpc, N_FT0M); - hist.fill(HIST("Analysis/Kaon/h_twopart_Mult_ka_tpc"), NTPC, twopart_Ka_tpc, N_FT0M); - } - if (N_Pr_tpc > 1) { - double mean_Q1_Pr_tpc = Q1_Pr_tpc / static_cast(N_Pr_tpc); - double twopart_Pr_tpc = ((Q1_Pr_tpc * Q1_Pr_tpc) - Q2_Pr_tpc) / (static_cast(N_Pr_tpc) * (static_cast(N_Pr_tpc) - 1)); - hist.fill(HIST("Analysis/Proton/h_mean_Q1_Mult_pr_tpc"), NTPC, mean_Q1_Pr_tpc, N_FT0M); - hist.fill(HIST("Analysis/Proton/h_twopart_Mult_pr_tpc"), NTPC, twopart_Pr_tpc, N_FT0M); - } - - //-----------------------TPC + TOF (No p cuts)--------------------------// - if (Nch_tof > 1) { - double mean_Q1_tof = Q1_tof / static_cast(Nch_tof); - double twopart_tof = ((Q1_tof * Q1_tof) - Q2_tof) / (static_cast(Nch_tof) * (static_cast(Nch_tof) - 1)); - hist.fill(HIST("Analysis/Charged/h_mean_Q1_Mult_ch_tof"), NTPC, mean_Q1_tof, N_FT0M); - hist.fill(HIST("Analysis/Charged/h_twopart_Mult_ch_tof"), NTPC, twopart_tof, N_FT0M); - } - if (N_Pi_tof > 1) { - double mean_Q1_Pi_tof = Q1_Pi_tof / static_cast(N_Pi_tof); - double twopart_Pi_tof = ((Q1_Pi_tof * Q1_Pi_tof) - Q2_Pi_tof) / (static_cast(N_Pi_tof) * (static_cast(N_Pi_tof) - 1)); - hist.fill(HIST("Analysis/Pion/h_mean_Q1_Mult_pi_tof"), NTPC, mean_Q1_Pi_tof, N_FT0M); - hist.fill(HIST("Analysis/Pion/h_twopart_Mult_pi_tof"), NTPC, twopart_Pi_tof, N_FT0M); - } - if (N_Ka_tof > 1) { - double mean_Q1_Ka_tof = Q1_Ka_tof / static_cast(N_Ka_tof); - double twopart_Ka_tof = ((Q1_Ka_tof * Q1_Ka_tof) - Q2_Ka_tof) / (static_cast(N_Ka_tof) * (static_cast(N_Ka_tof) - 1)); - hist.fill(HIST("Analysis/Kaon/h_mean_Q1_Mult_ka_tof"), NTPC, mean_Q1_Ka_tof, N_FT0M); - hist.fill(HIST("Analysis/Kaon/h_twopart_Mult_ka_tof"), NTPC, twopart_Ka_tof, N_FT0M); - } - if (N_Pr_tof > 1) { - double mean_Q1_Pr_tof = Q1_Pr_tof / static_cast(N_Pr_tof); - double twopart_Pr_tof = ((Q1_Pr_tof * Q1_Pr_tof) - Q2_Pr_tof) / (static_cast(N_Pr_tof) * (static_cast(N_Pr_tof) - 1)); - hist.fill(HIST("Analysis/Proton/h_mean_Q1_Mult_pr_tof"), NTPC, mean_Q1_Pr_tof, N_FT0M); - hist.fill(HIST("Analysis/Proton/h_twopart_Mult_pr_tof"), NTPC, twopart_Pr_tof, N_FT0M); - } - } -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{adaptAnalysisTask(cfgc)}; -} diff --git a/PWGCF/EbyEFluctuations/Tasks/MeanPtFlucIdentified.cxx b/PWGCF/EbyEFluctuations/Tasks/MeanPtFlucIdentified.cxx new file mode 100644 index 00000000000..ddbbe9d6a9b --- /dev/null +++ b/PWGCF/EbyEFluctuations/Tasks/MeanPtFlucIdentified.cxx @@ -0,0 +1,710 @@ +// 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 MeanPtFlucIdentified.cxx +/// \brief Calculate EbyE fluctuations with moments method. +/// For charged particles and identified particles. +/// +/// \author Tanu Gahlaut + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/Centrality.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/HistogramSpec.h" +#include "TDatabasePDG.h" +#include "TLorentzVector.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace std; + +double massPi = TDatabasePDG::Instance()->GetParticle(211)->Mass(); +double massKa = TDatabasePDG::Instance()->GetParticle(321)->Mass(); +double massPr = TDatabasePDG::Instance()->GetParticle(2212)->Mass(); + +struct meanPtFlucId { + Configurable nPtBins{"nPtBins", 300, ""}; + Configurable nPartBins{"nPartBins", 500, ""}; + Configurable nCentBins{"nCentBins", 101, ""}; + Configurable nEtaBins{"nEtaBins", 100, ""}; + Configurable ptMax{"ptMax", 2.0, "maximum pT"}; + Configurable ptMin{"ptMin", 0.15, "minimum pT"}; + Configurable etaCut{"etaCut", 0.8, "Eta cut"}; + Configurable rapCut{"rapCut", 0.5, "Rapidity Cut"}; + Configurable dcaXYCut{"dcaXYCut", 0.12, "DCAxy cut"}; + Configurable dcaZCut{"dcaZCut", 1.0, "DCAz cut"}; + Configurable posZCut{"posZCut", 7.0, "cut for vertex Z"}; + Configurable nSigCut1{"nSigCut1", 1.0, "nSigma cut (1)"}; + Configurable nSigCut2{"nSigCut2", 2.0, "nSigma cut (2)"}; + Configurable nSigCut3{"nSigCut3", 3.0, "nSigma cut (3)"}; + Configurable nSigCut4{"nSigCut4", 4.0, "nSigma cut (4)"}; + Configurable nSigCut5{"nSigCut5", 5.0, "nSigma cut (5)"}; + Configurable nSigCut15{"nSigCut15", 1.5, "nSigma cut (1.5)"}; + Configurable nSigCut25{"nSigCut25", 2.5, "nSigma cut (2.5)"}; + Configurable piP1{"piP1", 0.65, "pion p (1)"}; + Configurable piP2{"piP2", 0.70, "pion p (2)"}; + Configurable piP3{"piP3", 1.40, "pion p (3)"}; + Configurable piP4{"piP4", 1.70, "pion p (4)"}; + Configurable kaP1{"kaP1", 0.20, "min kaon p (1)"}; + Configurable kaP2{"kaP2", 0.5, "kaon p (2)"}; + Configurable kaP3{"kaP3", 0.55, "kaon p (3)"}; + Configurable kaP4{"kaP4", 0.60, "kaon p (4)"}; + Configurable kaP5{"kaP5", 0.65, "kaon p (5)"}; + Configurable kaP6{"kaP6", 1.10, "kaon p (6)"}; + Configurable kaP7{"kaP7", 1.28, "kaon p (7)"}; + Configurable kaP8{"kaP8", 1.50, "kaon p (8)"}; + Configurable prP1{"prP1", 0.40, "min proton p (1)"}; + Configurable prP2{"prP2", 0.95, "proton p (2)"}; + Configurable prP3{"prP3", 1.00, "proton p (3)"}; + Configurable prP4{"prP4", 1.05, "proton p (4)"}; + Configurable prP5{"prP5", 1.13, "proton p (5)"}; + Configurable prP6{"prP6", 1.18, "proton p (6)"}; + ConfigurableAxis multTPCBins{"multTPCBins", {200, 0, 1000}, "TPC Multiplicity bins"}; + ConfigurableAxis multFT0MBins{"multFT0MBins", {150, 0, 15000}, "Forward Multiplicity bins"}; + ConfigurableAxis dcaXYBins{"dcaXYBins", {100, -0.15, 0.15}, "dcaXY bins"}; + ConfigurableAxis dcaZBins{"dcaZBins", {100, -1.2, 1.2}, "dcaZ bins"}; + + using MyAllTracks = soa::Join; + using MyAllCollisions = soa::Join; + + HistogramRegistry hist{"hist", {}, OutputObjHandlingPolicy::AnalysisObject}; + void init(InitContext const&) + { + const AxisSpec axisEvents{5, 0, 5, "Counts"}; + const AxisSpec axisEta{nEtaBins, -1., +1., "#eta"}; + const AxisSpec axisY{nEtaBins, -1., +1., "Rapidity"}; + const AxisSpec axisPt{nPtBins, 0., 3., "p_{T} (GeV/c)"}; + const AxisSpec axisP{nPtBins, 0., 3., "p (GeV/c)"}; + const AxisSpec axisPart{nPartBins, 0., 5., " "}; + const AxisSpec axisMeanPt{100, 0., 3., "M(p_{T}) (GeV/c)"}; + const AxisSpec axisMult{100, 0, 100, "N_{ch}"}; + const AxisSpec axisMultTPC{multTPCBins, "N_{TPC} "}; + const AxisSpec axisMultFT0M{multFT0MBins, "N_{FT0M}"}; + const AxisSpec axisCentFT0M{nCentBins, 0, 101, "FT0M (%)"}; + const AxisSpec axisVtxZ{80, -20., 20., "V_{Z} (cm)"}; + const AxisSpec axisDCAz{dcaZBins, "DCA_{Z} (cm)"}; + const AxisSpec axisDCAxy{dcaXYBins, "DCA_{XY} (cm)"}; + const AxisSpec axisTPCNsigma{500, -5., 5., "n #sigma_{TPC}"}; + const AxisSpec axisTOFNsigma{500, -5., 5., "n #sigma_{TOF}"}; + const AxisSpec axisTPCSignal{180, 20., 200., "#frac{dE}{dx}"}; + const AxisSpec axisTOFSignal{100, 0.2, 1.2, "TOF #beta"}; + const AxisSpec axisChi2{50, 0., 50., "Chi2"}; + const AxisSpec axisCrossedTPC{500, 0, 500, "Crossed TPC"}; + + HistogramConfigSpec QnHist({HistType::kTHnSparseD, {axisMultTPC, axisPart, axisMultFT0M}}); + HistogramConfigSpec TOFnSigmaHist({HistType::kTH2D, {axisP, axisTOFNsigma}}); + HistogramConfigSpec TOFSignalHist({HistType::kTH2D, {axisP, axisTOFSignal}}); + HistogramConfigSpec TPCnSigmaHist({HistType::kTH2D, {axisP, axisTPCNsigma}}); + HistogramConfigSpec TPCSignalHist({HistType::kTH2D, {axisP, axisTPCSignal}}); + HistogramConfigSpec TPCTOFHist({HistType::kTH2D, {axisTPCNsigma, axisTOFNsigma}}); + + // QA Plots: + hist.add("QA/before/h_Counts", "Counts", kTH1D, {axisEvents}); + hist.add("QA/before/h_VtxZ", "V_{Z}", kTH1D, {axisVtxZ}); + hist.add("QA/before/h_TPCChi2perCluster", "TPC #Chi^{2}/Cluster", kTH1D, {axisChi2}); + hist.add("QA/before/h_ITSChi2perCluster", "ITS #Chi^{2}/Cluster", kTH1D, {axisChi2}); + hist.add("QA/before/h_crossedTPC", "Crossed TPC", kTH1D, {axisCrossedTPC}); + hist.add("QA/before/h_Pt", "p_{T}", kTH1D, {axisPt}); + hist.add("QA/before/h_Eta", "#eta ", kTH1D, {axisEta}); + hist.add("QA/before/h2_Pt_Eta", "p_{T} vs #eta ", kTH2D, {{axisEta}, {axisPt}}); + hist.add("QA/before/h2_DcaZ", "DCA_{Z}", kTH2D, {{axisPt}, {axisDCAz}}); + hist.add("QA/before/h2_DcaXY", "DCA_{XY}", kTH2D, {{axisPt}, {axisDCAxy}}); + hist.add("QA/before/h_NTPC", "N_{TPC}", kTH1D, {axisMultTPC}); + hist.add("QA/before/h_NFT0M", "FT0M Multiplicity", kTH1D, {axisMultFT0M}); + hist.add("QA/before/h_Cent", "FT0M (%)", kTH1D, {axisCentFT0M}); + hist.add("QA/before/h2_NTPC_Cent", "N_{TPC} vs FT0M(%)", kTH2D, {{axisCentFT0M}, {axisMultTPC}}); + hist.add("QA/before/h2_NTPC_NFT0M", "N_{TPC} vs N_{FT0M}", kTH2D, {{axisMultFT0M}, {axisMultTPC}}); + hist.add("QA/before/h2_TPCSignal", "TPC Signal", TPCSignalHist); + hist.add("QA/before/h2_TOFSignal", "TOF Signal", TOFSignalHist); + + hist.addClone("QA/before/", "QA/after/"); + + hist.add("QA/after/p_NTPC_NFT0M", "N_{TPC} vs N_{FT0M} (Profile)", kTProfile, {{axisMultFT0M}}); + hist.add("QA/after/p_NFT0M_NTPC", "N_{FT0M} vs N_{TPC} (Profile)", kTProfile, {{axisMultTPC}}); + hist.add("QA/after/p_NTPC_Cent", "N_{TPC} vs FT0M(%) (Profile)", kTProfile, {{axisCentFT0M}}); + hist.add("QA/after/h2_NTPC_Nch", "N_{ch} vs N_{TPC}", kTH2D, {{axisMultTPC}, {axisMult}}); + + hist.add("QA/Pion/h_Mult", "Multiplicity", kTH1D, {axisMult}); + hist.add("QA/Pion/h_Pt", "p_{T} (TPC & TPC+TOF)", kTH1D, {axisPt}); + hist.add("QA/Pion/h_rap", "y (TPC & TPC+TOF)", kTH1D, {axisY}); + hist.add("QA/Pion/h2_Pt_rap", "p_{T} vs y", kTH2D, {{axisY}, {axisPt}}); + hist.add("QA/Pion/h2_DcaZ", "DCA_{z}", kTH2D, {{axisPt}, {axisDCAz}}); + hist.add("QA/Pion/h2_DcaXY", "DCA_{xy}", kTH2D, {{axisPt}, {axisDCAxy}}); + hist.add("QA/Pion/before/h2_TPCNsigma", "n #sigma_{TPC}", TPCnSigmaHist); + hist.add("QA/Pion/before/h2_TOFNsigma", "n #sigma_{TOF}", TOFnSigmaHist); + hist.add("QA/Pion/before/h2_TpcTofNsigma", "n #sigma_{TPC} vs n #sigma_{TOF}", TPCTOFHist); + hist.add("QA/Pion/h2_TPCNsigma", "n #sigma_{TPC}", TPCnSigmaHist); + hist.add("QA/Pion/h2_TOFNsigma", "n #sigma_{TOF}", TOFnSigmaHist); + hist.add("QA/Pion/h2_TpcTofNsigma", "n #sigma_{TPC} vs n #sigma_{TOF}", TPCTOFHist); + hist.add("QA/Pion/h2_TPCSignal", "TPC Signal Pions", TPCSignalHist); + hist.add("QA/Pion/h2_TOFSignal", "TOF Signal Pions", TOFSignalHist); + hist.add("QA/Pion/h2_ExpTPCSignal", "Expected TPC Signal Pions", TPCSignalHist); + // extra QA + hist.add("QA/Pion/TPC/h_Pt_TPC", "p_{T} TPC", kTH1D, {axisPt}); + hist.add("QA/Pion/TPC/h_rap_TPC", "y TPC ", kTH1D, {axisY}); + hist.add("QA/Pion/TPC/h2_TPCSignal", "TPC Signal ", TPCSignalHist); + hist.add("QA/Pion/TPC/h2_ExpTPCSignal", "Expected TPC Signal", TPCSignalHist); + hist.add("QA/Pion/TOF/h_Pt_TOF", "p_{T} TPC+TOF", kTH1D, {axisPt}); + hist.add("QA/Pion/TOF/h_rap_TOF", "y TPC+TOF ", kTH1D, {axisY}); + hist.add("QA/Pion/TOF/h2_TOFSignal", "TOF Signal ", TOFSignalHist); + + hist.addClone("QA/Pion/", "QA/Kaon/"); + hist.addClone("QA/Pion/", "QA/Proton/"); + + // Analysis Plots: + hist.add("Analysis/Charged/h_Mult", "Multiplicity", kTH1D, {axisMult}); + hist.add("Analysis/Charged/h_mean_Q1", " ", kTH1D, {axisMeanPt}); + hist.add("Analysis/Charged/p_mean_Q1", " ", kTProfile, {axisMult}); + hist.add("Analysis/Charged/h_mean_Q1_Mult", " vs N_{ch} ", QnHist); + hist.add("Analysis/Charged/h_twopart_Mult", "Twopart vs N_{ch} ", QnHist); + hist.add("Analysis/Charged/h_threepart_Mult", "Threepart vs N_{ch} ", QnHist); + hist.add("Analysis/Charged/h_fourpart_Mult", "Fourpart vs N_{ch} ", QnHist); + hist.add("Analysis/Charged/h_mean_Q1_Mult_tpc", "mean_Q1_Mult (TPC)", QnHist); + hist.add("Analysis/Charged/h_twopart_Mult_tpc", "twopart_Mult (TPC)", QnHist); + hist.add("Analysis/Charged/h_mean_Q1_Mult_tof", "mean_Q1_Mult (TOF+TPC)", QnHist); + hist.add("Analysis/Charged/h_twopart_Mult_tof", "twopart_Mult (TOF+TPC)", QnHist); + + hist.addClone("Analysis/Charged/", "Analysis/Pion/"); + hist.addClone("Analysis/Charged/", "Analysis/Kaon/"); + hist.addClone("Analysis/Charged/", "Analysis/Proton/"); + } + + template + bool selCol(T const& col) + { + if (col.posZ() > posZCut) + return false; + + if (!col.sel8()) + return false; + + return true; + } + + template + bool selTrack(T const& track) + { + + if (track.pt() < ptMin) + return false; + + if (track.pt() > ptMax) + return false; + + if (std::abs(track.eta()) > etaCut) + return false; + + if (std::abs(track.dcaZ()) > dcaZCut) + return false; + + if (std::abs(track.dcaXY()) > dcaXYCut) + return false; + + if (!track.isGlobalTrack()) + return false; + + return true; + } + + template + bool selPiTPC(T const& track) + { + if (abs(track.tpcNSigmaPi()) > nSigCut3) + return false; + + if (abs(track.rapidity(massPi)) >= 0.5) + return false; + + return true; + } + + template + bool selKaTPC(T const& track) + { + if (abs(track.tpcNSigmaKa()) > nSigCut3) + return false; + + if (abs(track.rapidity(massKa)) >= 0.5) + return false; + + return true; + } + + template + bool selPrTPC(T const& track) + { + if (abs(track.tpcNSigmaPr()) > nSigCut3) + return false; + + if (abs(track.rapidity(massPr)) >= 0.5) + return false; + + return true; + } + + template + bool selPiTOF(T const& track) + { + if ((std::pow(track.tpcNSigmaPi(), 2) + std::pow(track.tofNSigmaPi(), 2)) > 6.0) + return false; + + if (abs(track.rapidity(massPi)) >= 0.5) + return false; + + return true; + } + + template + bool selKaTOF(T const& track) + { + if ((std::pow(track.tpcNSigmaKa(), 2) + std::pow(track.tofNSigmaKa(), 2)) > 6.0) + return false; + + if (abs(track.rapidity(massKa)) >= 0.5) + return false; + + return true; + } + + template + bool selPrTOF(T const& track) + { + if ((std::pow(track.tpcNSigmaPr(), 2) + std::pow(track.tofNSigmaPr(), 2)) > 6.0) + return false; + + if (abs(track.rapidity(massPr)) >= 0.5) + return false; + + return true; + } + + template + bool selPions(T const& track) + { + if (((!track.hasTOF()) && + ((std::abs(track.tpcNSigmaPi()) < nSigCut3 && track.p() <= piP1) || (std::abs(track.tpcNSigmaPi()) < nSigCut2 && track.p() > piP1 && track.p() <= piP2))) || + (track.hasTOF() && std::abs(track.tpcNSigmaPi()) < nSigCut4 && std::abs(track.tofNSigmaEl()) > nSigCut1 && + ((std::abs(track.tofNSigmaPi()) < nSigCut3 && track.p() <= piP3) || (std::abs(track.tofNSigmaPi()) < nSigCut25 && track.p() > piP3 && track.p() <= piP4) || (std::abs(track.tofNSigmaPi()) < nSigCut2 && track.p() > piP4)))) { + if (abs(track.rapidity(massPi)) < 0.5) + return true; + } + + return false; + } + + template + bool selKaons(T const& track) + { + if (((!track.hasTOF()) && + ((std::abs(track.tpcNSigmaKa()) < nSigCut3 && track.pt() > kaP1 && track.p() <= kaP2) || (std::abs(track.tpcNSigmaKa()) < nSigCut25 && track.p() > kaP2 && track.p() <= kaP3) || (std::abs(track.tpcNSigmaKa()) < nSigCut2 && track.p() > kaP3 && track.p() <= kaP4) || (std::abs(track.tpcNSigmaKa()) < nSigCut15 && track.p() > kaP4 && track.p() <= kaP5))) || + (track.hasTOF() && std::abs(track.tpcNSigmaKa()) < nSigCut4 && std::abs(track.tofNSigmaEl()) > nSigCut1 && + ((std::abs(track.tofNSigmaKa()) < nSigCut3 && track.pt() > kaP1 && track.p() <= kaP6) || (std::abs(track.tofNSigmaKa()) < nSigCut2 && track.p() > kaP6 && track.p() <= kaP7) || (std::abs(track.tofNSigmaKa()) < nSigCut15 && track.p() > kaP7 && track.p() <= kaP8) || (std::abs(track.tofNSigmaKa()) < nSigCut1 && track.p() > kaP8)))) { + if (abs(track.rapidity(massKa)) < 0.5) + return true; + } + + return false; + } + + template + bool selProtons(T const& track) + { + if (((!track.hasTOF()) && + ((std::abs(track.tpcNSigmaPr()) < nSigCut3 && track.pt() > prP1 && track.p() <= prP2) || (std::abs(track.tpcNSigmaPr()) < nSigCut25 && track.p() > prP2 && track.p() <= prP3) || (std::abs(track.tpcNSigmaPr()) < nSigCut2 && track.p() > prP3 && track.p() <= prP4) || (std::abs(track.tpcNSigmaPr()) < nSigCut15 && track.p() > prP4 && track.p() <= prP5) || (std::abs(track.tpcNSigmaPr()) < nSigCut1 && track.p() > prP5 && track.p() <= prP6))) || + (track.hasTOF() && std::abs(track.tpcNSigmaPr()) < nSigCut4 && std::abs(track.tofNSigmaEl()) > nSigCut1 && std::abs(track.tofNSigmaPr()) < nSigCut3 && track.pt() > prP1)) { + if (abs(track.rapidity(massPr)) < 0.5) + return true; + } + + return false; + } + + template + void moments(U pt, T Q1, T Q2, T Q3, T Q4) + { + *Q1 += pt; + *Q2 += pt * pt; + *Q3 += pt * pt * pt; + *Q4 += pt * pt * pt * pt; + } + + template + void parts(V Q1, V Q2, V Q3, V Q4, U N, T mean_Q1, T twopart, T threepart, T fourpart) + { + if (N > 1) { + *mean_Q1 = Q1 / static_cast(N); + *twopart = ((Q1 * Q1) - Q2) / (static_cast(N) * (static_cast(N) - 1)); + } + if (N > 2) { + *threepart = ((Q1 * Q1 * Q1) - (3 * Q2 * Q1) + 2 * Q3) / (static_cast(N) * (static_cast(N) - 1) * (static_cast(N) - 2)); + } + if (N > 3) { + *fourpart = ((Q1 * Q1 * Q1 * Q1) - (6 * Q2 * Q1 * Q1) + (3 * Q2 * Q2) + (8 * Q3 * Q1) - 6 * Q4) / (static_cast(N) * (static_cast(N) - 1) * (static_cast(N) - 2) * (static_cast(N) - 3)); + } + } + + template + void testParts(V Q1, V Q2, U N, T mean_Q1, T twopart) + { + if (N > 1) { + *mean_Q1 = Q1 / static_cast(N); + *twopart = ((Q1 * Q1) - Q2) / (static_cast(N) * (static_cast(N) - 1)); + } + } + + void process(MyAllCollisions::iterator const& col, MyAllTracks const& tracks) + { + // Before Collision and Track Cuts: + for (auto& myTrack : tracks) { + hist.fill(HIST("QA/before/h_Eta"), myTrack.eta()); + hist.fill(HIST("QA/before/h_Pt"), myTrack.pt()); + hist.fill(HIST("QA/before/h2_Pt_Eta"), myTrack.eta(), myTrack.pt()); + hist.fill(HIST("QA/before/h_TPCChi2perCluster"), myTrack.tpcChi2NCl()); + hist.fill(HIST("QA/before/h_ITSChi2perCluster"), myTrack.itsChi2NCl()); + hist.fill(HIST("QA/before/h_crossedTPC"), myTrack.tpcNClsCrossedRows()); + hist.fill(HIST("QA/before/h2_DcaXY"), myTrack.pt(), myTrack.dcaXY()); + hist.fill(HIST("QA/before/h2_DcaZ"), myTrack.pt(), myTrack.dcaZ()); + } + hist.fill(HIST("QA/before/h_VtxZ"), col.posZ()); + hist.fill(HIST("QA/before/h_Counts"), 2); + + hist.fill(HIST("QA/before/h_NTPC"), col.multTPC()); + hist.fill(HIST("QA/before/h_Cent"), col.centFT0M()); + hist.fill(HIST("QA/before/h_NFT0M"), col.multFT0M()); + hist.fill(HIST("QA/before/h2_NTPC_NFT0M"), col.multFT0M(), col.multTPC()); + hist.fill(HIST("QA/before/h2_NTPC_Cent"), col.centFT0M(), col.multTPC()); + + // After Collision and Track Cuts: + if (selCol(col)) { + int N_Pi = 0, N_Ka = 0, N_Pr = 0; + int Nch = 0, NTPC = 0, N_FT0M = 0; + int N_Ka_tpc = 0, N_Pr_tpc = 0, N_Pi_tpc = 0; + int Nch_tof = 0, N_Ka_tof = 0, N_Pr_tof = 0, N_Pi_tof = 0; + double Cent_FT0M = 0; + double pt_ch = 0, Q1_ch = 0, Q2_ch = 0, Q3_ch = 0, Q4_ch = 0; + double pt_Pi = 0, Q1_Pi = 0, Q2_Pi = 0, Q3_Pi = 0, Q4_Pi = 0; + double pt_Pr = 0, Q1_Pr = 0, Q2_Pr = 0, Q3_Pr = 0, Q4_Pr = 0; + double pt_Ka = 0, Q1_Ka = 0, Q2_Ka = 0, Q3_Ka = 0, Q4_Ka = 0; + double Q1_Pi_tpc = 0, Q1_Pr_tpc = 0, Q1_Ka_tpc = 0; + double Q2_Pi_tpc = 0, Q2_Pr_tpc = 0, Q2_Ka_tpc = 0; + double Q1_Ch_tof = 0, Q1_Pi_tof = 0, Q1_Pr_tof = 0, Q1_Ka_tof = 0; + double Q2_Ch_tof = 0, Q2_Pi_tof = 0, Q2_Pr_tof = 0, Q2_Ka_tof = 0; + double mean_Q1_Ch, mean_Q1_Pi, mean_Q1_Ka, mean_Q1_Pr; + double twopart_Ch, twopart_Pi, twopart_Ka, twopart_Pr; + double threepart_Ch, threepart_Pi, threepart_Ka, threepart_Pr; + double fourpart_Ch, fourpart_Pi, fourpart_Ka, fourpart_Pr; + double mean_Q1_Pi_tpc, mean_Q1_Ka_tpc, mean_Q1_Pr_tpc; + double twopart_Pi_tpc, twopart_Ka_tpc, twopart_Pr_tpc; + double mean_Q1_Ch_tof, mean_Q1_Pi_tof, mean_Q1_Ka_tof, mean_Q1_Pr_tof; + double twopart_Ch_tof, twopart_Pi_tof, twopart_Ka_tof, twopart_Pr_tof; + + for (auto& track : tracks) { + if (!selTrack(track)) + continue; + + Nch++; + pt_ch = track.pt(); + moments(pt_ch, &Q1_ch, &Q2_ch, &Q3_ch, &Q4_ch); + + hist.fill(HIST("QA/after/h_Eta"), track.eta()); + hist.fill(HIST("QA/after/h_Pt"), track.pt()); + hist.fill(HIST("QA/after/h2_Pt_Eta"), track.eta(), track.pt()); + hist.fill(HIST("QA/after/h2_DcaXY"), track.pt(), track.dcaXY()); + hist.fill(HIST("QA/after/h2_DcaZ"), track.pt(), track.dcaZ()); + + hist.fill(HIST("QA/after/h_TPCChi2perCluster"), track.tpcChi2NCl()); + hist.fill(HIST("QA/after/h_ITSChi2perCluster"), track.itsChi2NCl()); + hist.fill(HIST("QA/after/h_crossedTPC"), track.tpcNClsCrossedRows()); + + hist.fill(HIST("QA/before/h2_TOFSignal"), track.p(), track.beta()); + hist.fill(HIST("QA/before/h2_TPCSignal"), track.p(), track.tpcSignal()); + + hist.fill(HIST("QA/Pion/before/h2_TPCNsigma"), track.p(), track.tpcNSigmaPi()); + hist.fill(HIST("QA/Pion/before/h2_TOFNsigma"), track.p(), track.tofNSigmaPi()); + hist.fill(HIST("QA/Pion/before/h2_TpcTofNsigma"), track.tpcNSigmaPi(), track.tofNSigmaPi()); + hist.fill(HIST("QA/Proton/before/h2_TPCNsigma"), track.p(), track.tpcNSigmaPr()); + hist.fill(HIST("QA/Proton/before/h2_TOFNsigma"), track.p(), track.tofNSigmaPr()); + hist.fill(HIST("QA/Proton/before/h2_TpcTofNsigma"), track.tpcNSigmaPr(), track.tofNSigmaPr()); + hist.fill(HIST("QA/Kaon/before/h2_TPCNsigma"), track.p(), track.tpcNSigmaKa()); + hist.fill(HIST("QA/Kaon/before/h2_TOFNsigma"), track.p(), track.tofNSigmaKa()); + hist.fill(HIST("QA/Kaon/before/h2_TpcTofNsigma"), track.tpcNSigmaKa(), track.tofNSigmaKa()); + + // For Pions: + if (selPions(track)) { + N_Pi++; + pt_Pi = track.pt(); + moments(pt_Pi, &Q1_Pi, &Q2_Pi, &Q3_Pi, &Q4_Pi); + hist.fill(HIST("QA/Pion/h_Pt"), track.pt()); + hist.fill(HIST("QA/Pion/h_rap"), track.rapidity(massPi)); + hist.fill(HIST("QA/Pion/h2_Pt_rap"), track.rapidity(massPi), track.pt()); + hist.fill(HIST("QA/Pion/h2_DcaXY"), track.pt(), track.dcaXY()); + hist.fill(HIST("QA/Pion/h2_DcaZ"), track.pt(), track.dcaZ()); + + hist.fill(HIST("QA/Pion/h2_TPCNsigma"), track.p(), track.tpcNSigmaPi()); + hist.fill(HIST("QA/Pion/h2_TOFNsigma"), track.p(), track.tofNSigmaPi()); + hist.fill(HIST("QA/Pion/h2_TpcTofNsigma"), track.tpcNSigmaPi(), track.tofNSigmaPi()); + hist.fill(HIST("QA/Pion/h2_TOFSignal"), track.p(), track.beta()); + hist.fill(HIST("QA/Pion/h2_TPCSignal"), track.p(), track.tpcSignal()); + hist.fill(HIST("QA/Pion/h2_ExpTPCSignal"), track.p(), track.tpcExpSignalPi(track.tpcSignal())); + hist.fill(HIST("QA/after/h2_TOFSignal"), track.p(), track.beta()); + hist.fill(HIST("QA/after/h2_TPCSignal"), track.p(), track.tpcSignal()); + } + + // For Kaons: + if (selKaons(track)) { + N_Ka++; + pt_Ka = track.pt(); + moments(pt_Ka, &Q1_Ka, &Q2_Ka, &Q3_Ka, &Q4_Ka); + hist.fill(HIST("QA/Kaon/h_Pt"), track.pt()); + hist.fill(HIST("QA/Kaon/h_rap"), track.rapidity(massKa)); + hist.fill(HIST("QA/Kaon/h2_Pt_rap"), track.rapidity(massKa), track.pt()); + hist.fill(HIST("QA/Kaon/h2_DcaXY"), track.pt(), track.dcaXY()); + hist.fill(HIST("QA/Kaon/h2_DcaZ"), track.pt(), track.dcaZ()); + + hist.fill(HIST("QA/Kaon/h2_TPCNsigma"), track.p(), track.tpcNSigmaKa()); + hist.fill(HIST("QA/Kaon/h2_TOFNsigma"), track.p(), track.tofNSigmaKa()); + hist.fill(HIST("QA/Kaon/h2_TpcTofNsigma"), track.tpcNSigmaKa(), track.tofNSigmaKa()); + hist.fill(HIST("QA/Kaon/h2_TOFSignal"), track.p(), track.beta()); + hist.fill(HIST("QA/Kaon/h2_TPCSignal"), track.p(), track.tpcSignal()); + hist.fill(HIST("QA/Kaon/h2_ExpTPCSignal"), track.p(), track.tpcExpSignalKa(track.tpcSignal())); + hist.fill(HIST("QA/after/h2_TOFSignal"), track.p(), track.beta()); + hist.fill(HIST("QA/after/h2_TPCSignal"), track.p(), track.tpcSignal()); + } + + // For Protons: + if (selProtons(track)) { + N_Pr++; + pt_Pr = track.pt(); + moments(pt_Pr, &Q1_Pr, &Q2_Pr, &Q3_Pr, &Q4_Pr); + hist.fill(HIST("QA/Proton/h_Pt"), track.pt()); + hist.fill(HIST("QA/Proton/h_rap"), track.rapidity(massPr)); + hist.fill(HIST("QA/Proton/h2_Pt_rap"), track.rapidity(massPr), track.pt()); + hist.fill(HIST("QA/Proton/h2_DcaZ"), track.pt(), track.dcaZ()); + hist.fill(HIST("QA/Proton/h2_DcaXY"), track.pt(), track.dcaXY()); + + hist.fill(HIST("QA/Proton/h2_TPCNsigma"), track.p(), track.tpcNSigmaPr()); + hist.fill(HIST("QA/Proton/h2_TOFNsigma"), track.p(), track.tofNSigmaPr()); + hist.fill(HIST("QA/Proton/h2_TpcTofNsigma"), track.tpcNSigmaPr(), track.tofNSigmaPr()); + hist.fill(HIST("QA/Proton/h2_TPCSignal"), track.p(), track.tpcSignal()); + hist.fill(HIST("QA/Proton/h2_TOFSignal"), track.p(), track.beta()); + hist.fill(HIST("QA/Proton/h2_ExpTPCSignal"), track.p(), track.tpcExpSignalPr(track.tpcSignal())); + hist.fill(HIST("QA/after/h2_TPCSignal"), track.p(), track.tpcSignal()); + hist.fill(HIST("QA/after/h2_TOFSignal"), track.p(), track.beta()); + } + + // ---------------- only TPC (no p-dependent cuts) ----------------------// + // Pions: + if (selPiTPC(track)) { + N_Pi_tpc++; + Q1_Pi_tpc += track.pt(); + Q2_Pi_tpc += track.pt() * track.pt(); + hist.fill(HIST("QA/Pion/TPC/h_Pt_TPC"), track.pt()); + hist.fill(HIST("QA/Pion/TPC/h_rap_TPC"), track.rapidity(massPi)); + hist.fill(HIST("QA/Pion/TPC/h2_TPCSignal"), track.p(), track.tpcSignal()); + hist.fill(HIST("QA/Pion/TPC/h2_ExpTPCSignal"), track.p(), track.tpcExpSignalPi(track.tpcSignal())); + } + // Kaons: + if (selKaTPC(track)) { + N_Ka_tpc++; + Q1_Ka_tpc += track.pt(); + Q2_Ka_tpc += track.pt() * track.pt(); + hist.fill(HIST("QA/Kaon/TPC/h_Pt_TPC"), track.pt()); + hist.fill(HIST("QA/Kaon/TPC/h_rap_TPC"), track.rapidity(massKa)); + hist.fill(HIST("QA/Kaon/TPC/h2_TPCSignal"), track.p(), track.tpcSignal()); + hist.fill(HIST("QA/Kaon/TPC/h2_ExpTPCSignal"), track.p(), track.tpcExpSignalKa(track.tpcSignal())); + } + // Protons: + if (selPrTPC(track)) { + N_Pr_tpc++; + Q1_Pr_tpc += track.pt(); + Q2_Pr_tpc += track.pt() * track.pt(); + hist.fill(HIST("QA/Proton/TPC/h_Pt_TPC"), track.pt()); + hist.fill(HIST("QA/Proton/TPC/h_rap_TPC"), track.rapidity(massPr)); + hist.fill(HIST("QA/Proton/TPC/h2_TPCSignal"), track.p(), track.tpcSignal()); + hist.fill(HIST("QA/Proton/TPC/h2_ExpTPCSignal"), track.p(), track.tpcExpSignalPr(track.tpcSignal())); + } + + // ----------------- TPC with TOF (no p-dependent cuts) ---------------// + if (track.hasTOF()) { + Nch_tof++; + Q1_Ch_tof += track.pt(); + Q2_Ch_tof += track.pt() * track.pt(); + // Pions: + if (selPiTOF(track)) { + N_Pi_tof++; + Q1_Pi_tof += track.pt(); + Q2_Pi_tof += track.pt() * track.pt(); + hist.fill(HIST("QA/Pion/TOF/h_Pt_TOF"), track.pt()); + hist.fill(HIST("QA/Pion/TOF/h_rap_TOF"), track.rapidity(massPi)); + hist.fill(HIST("QA/Pion/TOF/h2_TOFSignal"), track.p(), track.beta()); + } + // Kaons: + if (selKaTOF(track)) { + N_Ka_tof++; + Q1_Ka_tof += track.pt(); + Q2_Ka_tof += track.pt() * track.pt(); + hist.fill(HIST("QA/Kaon/TOF/h_Pt_TOF"), track.pt()); + hist.fill(HIST("QA/Kaon/TOF/h_rap_TOF"), track.rapidity(massKa)); + hist.fill(HIST("QA/Kaon/TOF/h2_TOFSignal"), track.p(), track.beta()); + } + // Protons: + if (selPrTOF(track)) { + N_Pr_tof++; + Q1_Pr_tof += track.pt(); + Q2_Pr_tof += track.pt() * track.pt(); + hist.fill(HIST("QA/Proton/TOF/h_Pt_TOF"), track.pt()); + hist.fill(HIST("QA/Proton/TOF/h_rap_TOF"), track.rapidity(massPr)); + hist.fill(HIST("QA/Proton/TOF/h2_TOFSignal"), track.p(), track.beta()); + } + } + } + NTPC = col.multTPC(); + N_FT0M = col.multFT0M(); + Cent_FT0M = col.centFT0M(); + + hist.fill(HIST("QA/after/h_VtxZ"), col.posZ()); + hist.fill(HIST("QA/after/h_Counts"), 2); + hist.fill(HIST("QA/after/h_NTPC"), NTPC); + hist.fill(HIST("QA/after/h_Cent"), Cent_FT0M); + hist.fill(HIST("QA/after/h_NFT0M"), N_FT0M); + hist.fill(HIST("QA/after/h2_NTPC_NFT0M"), N_FT0M, NTPC); + hist.fill(HIST("QA/after/h2_NTPC_Cent"), Cent_FT0M, NTPC); + hist.fill(HIST("QA/after/p_NTPC_Cent"), Cent_FT0M, NTPC); + hist.fill(HIST("QA/after/p_NTPC_NFT0M"), N_FT0M, NTPC); + hist.fill(HIST("QA/after/p_NFT0M_NTPC"), NTPC, N_FT0M); + hist.fill(HIST("QA/after/h2_NTPC_Nch"), NTPC, Nch); + + static constexpr std::string_view dire[] = {"Analysis/Charged/", "Analysis/Pion/", "Analysis/Kaon/", "Analysis/Proton/"}; + + hist.fill(HIST(dire[0]) + HIST("h_Mult"), Nch); + hist.fill(HIST(dire[1]) + HIST("h_Mult"), N_Pi); + hist.fill(HIST(dire[2]) + HIST("h_Mult"), N_Ka); + hist.fill(HIST(dire[3]) + HIST("h_Mult"), N_Pr); + + parts(Q1_ch, Q2_ch, Q3_ch, Q4_ch, Nch, &mean_Q1_Ch, &twopart_Ch, &threepart_Ch, &fourpart_Ch); + if (Nch > 1) { + hist.fill(HIST(dire[0]) + HIST("h_mean_Q1"), mean_Q1_Ch); + hist.fill(HIST(dire[0]) + HIST("p_mean_Q1"), NTPC, mean_Q1_Ch); + hist.fill(HIST(dire[0]) + HIST("h_mean_Q1_Mult"), NTPC, mean_Q1_Ch, N_FT0M); + hist.fill(HIST(dire[0]) + HIST("h_twopart_Mult"), NTPC, twopart_Ch, N_FT0M); + } + if (Nch > 2) { + hist.fill(HIST(dire[0]) + HIST("h_threepart_Mult"), NTPC, threepart_Ch, N_FT0M); + } + if (Nch > 3) { + hist.fill(HIST(dire[0]) + HIST("h_fourpart_Mult"), NTPC, fourpart_Ch, N_FT0M); + } + + parts(Q1_Pi, Q2_Pi, Q3_Pi, Q4_Pi, N_Pi, &mean_Q1_Pi, &twopart_Pi, &threepart_Pi, &fourpart_Pi); + if (N_Pi > 1) { + hist.fill(HIST(dire[1]) + HIST("h_mean_Q1"), mean_Q1_Pi); + hist.fill(HIST(dire[1]) + HIST("p_mean_Q1"), NTPC, mean_Q1_Pi); + hist.fill(HIST(dire[1]) + HIST("h_mean_Q1_Mult"), NTPC, mean_Q1_Pi, N_FT0M); + hist.fill(HIST(dire[1]) + HIST("h_twopart_Mult"), NTPC, twopart_Pi, N_FT0M); + } + if (N_Pi > 2) { + hist.fill(HIST(dire[1]) + HIST("h_threepart_Mult"), NTPC, threepart_Pi, N_FT0M); + } + if (N_Pi > 3) { + hist.fill(HIST(dire[1]) + HIST("h_fourpart_Mult"), NTPC, fourpart_Pi, N_FT0M); + } + + parts(Q1_Ka, Q2_Ka, Q3_Ka, Q4_Ka, N_Ka, &mean_Q1_Ka, &twopart_Ka, &threepart_Ka, &fourpart_Ka); + if (N_Ka > 1) { + hist.fill(HIST(dire[2]) + HIST("h_mean_Q1"), mean_Q1_Ka); + hist.fill(HIST(dire[2]) + HIST("p_mean_Q1"), NTPC, mean_Q1_Ka); + hist.fill(HIST(dire[2]) + HIST("h_mean_Q1_Mult"), NTPC, mean_Q1_Ka, N_FT0M); + hist.fill(HIST(dire[2]) + HIST("h_twopart_Mult"), NTPC, twopart_Ka, N_FT0M); + } + if (N_Ka > 2) { + hist.fill(HIST(dire[2]) + HIST("h_threepart_Mult"), NTPC, threepart_Ka, N_FT0M); + } + if (N_Ka > 3) { + hist.fill(HIST(dire[2]) + HIST("h_fourpart_Mult"), NTPC, fourpart_Ka, N_FT0M); + } + + parts(Q1_Pr, Q2_Pr, Q3_Pr, Q4_Pr, N_Pr, &mean_Q1_Pr, &twopart_Pr, &threepart_Pr, &fourpart_Pr); + if (N_Pr > 1) { + hist.fill(HIST(dire[3]) + HIST("h_mean_Q1"), mean_Q1_Pr); + hist.fill(HIST(dire[3]) + HIST("p_mean_Q1"), NTPC, mean_Q1_Pr); + hist.fill(HIST(dire[3]) + HIST("h_mean_Q1_Mult"), NTPC, mean_Q1_Pr, N_FT0M); + hist.fill(HIST(dire[3]) + HIST("h_twopart_Mult"), NTPC, twopart_Pr, N_FT0M); + } + if (N_Pr > 2) { + hist.fill(HIST(dire[3]) + HIST("h_threepart_Mult"), NTPC, threepart_Pr, N_FT0M); + } + if (N_Pr > 3) { + hist.fill(HIST(dire[3]) + HIST("h_fourpart_Mult"), NTPC, fourpart_Pr, N_FT0M); + } + + //----------------------------- TPC (No p cuts) ---------------------------// + testParts(Q1_Pi_tpc, Q2_Pi_tpc, N_Pi_tpc, &mean_Q1_Pi_tpc, &twopart_Pi_tpc); + if (N_Pi_tpc > 1) { + hist.fill(HIST(dire[1]) + HIST("h_mean_Q1_Mult_tpc"), NTPC, mean_Q1_Pi_tpc, N_FT0M); + hist.fill(HIST(dire[1]) + HIST("h_twopart_Mult_tpc"), NTPC, twopart_Pi_tpc, N_FT0M); + } + + testParts(Q1_Ka_tpc, Q2_Ka_tpc, N_Ka_tpc, &mean_Q1_Ka_tpc, &twopart_Ka_tpc); + if (N_Ka_tpc > 1) { + hist.fill(HIST(dire[2]) + HIST("h_mean_Q1_Mult_tpc"), NTPC, mean_Q1_Ka_tpc, N_FT0M); + hist.fill(HIST(dire[2]) + HIST("h_twopart_Mult_tpc"), NTPC, twopart_Ka_tpc, N_FT0M); + } + + testParts(Q1_Pr_tpc, Q2_Pr_tpc, N_Pr_tpc, &mean_Q1_Pr_tpc, &twopart_Pr_tpc); + if (N_Pr_tpc > 1) { + hist.fill(HIST(dire[3]) + HIST("h_mean_Q1_Mult_tpc"), NTPC, mean_Q1_Pr_tpc, N_FT0M); + hist.fill(HIST(dire[3]) + HIST("h_twopart_Mult_tpc"), NTPC, twopart_Pr_tpc, N_FT0M); + } + + //----------------------- TPC + TOF (No p cuts) --------------------------// + + testParts(Q1_Ch_tof, Q2_Ch_tof, Nch_tof, &mean_Q1_Ch_tof, &twopart_Ch_tof); + if (Nch_tof > 1) { + hist.fill(HIST(dire[0]) + HIST("h_mean_Q1_Mult_tof"), NTPC, mean_Q1_Ch_tof, N_FT0M); + hist.fill(HIST(dire[0]) + HIST("h_twopart_Mult_tof"), NTPC, twopart_Ch_tof, N_FT0M); + } + + testParts(Q1_Pi_tof, Q2_Pi_tof, N_Pi_tof, &mean_Q1_Pi_tof, &twopart_Pi_tof); + if (N_Pi_tpc > 1) { + hist.fill(HIST(dire[1]) + HIST("h_mean_Q1_Mult_tof"), NTPC, mean_Q1_Pi_tof, N_FT0M); + hist.fill(HIST(dire[1]) + HIST("h_twopart_Mult_tof"), NTPC, twopart_Pi_tof, N_FT0M); + } + + testParts(Q1_Ka_tof, Q2_Ka_tof, N_Ka_tof, &mean_Q1_Ka_tof, &twopart_Ka_tof); + if (N_Ka_tpc > 1) { + hist.fill(HIST(dire[2]) + HIST("h_mean_Q1_Mult_tof"), NTPC, mean_Q1_Ka_tof, N_FT0M); + hist.fill(HIST(dire[2]) + HIST("h_twopart_Mult_tof"), NTPC, twopart_Ka_tof, N_FT0M); + } + + testParts(Q1_Pr_tof, Q2_Pr_tof, N_Pr_tof, &mean_Q1_Pr_tof, &twopart_Pr_tof); + if (N_Pr_tpc > 1) { + hist.fill(HIST(dire[3]) + HIST("h_mean_Q1_Mult_tof"), NTPC, mean_Q1_Pr_tof, N_FT0M); + hist.fill(HIST(dire[3]) + HIST("h_twopart_Mult_tof"), NTPC, twopart_Pr_tof, N_FT0M); + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx index f9a5b74fe2e..99ed000b01a 100644 --- a/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx @@ -10,8 +10,11 @@ // or submit itself to any jurisdiction. #include +#include +#include #include #include + #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" #include "Framework/ASoAHelpers.h" @@ -22,12 +25,16 @@ #include "Common/Core/TrackSelection.h" #include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Multiplicity.h" #include "TList.h" #include "TProfile.h" #include "TProfile2D.h" +#include "TH2D.h" +#include "TH1D.h" #include "TRandom3.h" #include "TMath.h" +#include "TF1.h" namespace o2::aod { @@ -47,14 +54,19 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; + struct MeanptFluctuations_QA_QnTable { Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; Configurable cfgCutPtLower{"cfgCutPtLower", 0.2f, "Lower pT cut"}; Configurable cfgCutPtUpper{"cfgCutPtUpper", 3.0f, "Higher pT cut"}; Configurable cfgCutTpcChi2NCl{"cfgCutTpcChi2NCl", 2.5f, "Maximum TPCchi2NCl"}; - // Configurable cfgCutTrackDcaXY{"cfgCutTrackDcaXY", 0.1f, "Maximum DcaXY"}; + // Configurable cfgCutTrackDcaXY{"cfgCutTrackDcaXY", 0.2f, "Maximum DcaXY"}; Configurable cfgCutTrackDcaZ{"cfgCutTrackDcaZ", 2.0f, "Maximum DcaZ"}; + ConfigurableAxis nchAxis{"nchAxis", {5000, 0.5, 5000.5}, ""}; + + O2_DEFINE_CONFIGURABLE(cfgUse22sEventCut, bool, true, "Use 22s event cut on mult correlations") // Filter command*********** Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; @@ -69,10 +81,17 @@ struct MeanptFluctuations_QA_QnTable { HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // filtering collisions and tracks*********** - using aodCollisions = soa::Filtered>; + using aodCollisions = soa::Filtered>; // using aodCollisions = soa::Filtered>; using aodTracks = soa::Filtered>; + // Event selection cuts - Alex + TF1* fMultPVCutLow = nullptr; + TF1* fMultPVCutHigh = nullptr; + TF1* fMultCutLow = nullptr; + TF1* fMultCutHigh = nullptr; + TF1* fMultMultPVCut = nullptr; + // Equivalent of the AliRoot task UserCreateOutputObjects void init(o2::framework::InitContext&) { @@ -95,6 +114,56 @@ struct MeanptFluctuations_QA_QnTable { histos.add("hDcaXY", ";#it{dca}_{XY}", kTH1F, {{1000, -5, 5}}); histos.add("hDcaZ", ";#it{dca}_{Z}", kTH1F, {{1000, -5, 5}}); histos.add("hMeanPt", "", kTProfile, {centAxis}); + histos.add("Hist2D_globalTracks_PVTracks", "", {HistType::kTH2D, {nchAxis, nchAxis}}); + histos.add("Hist2D_cent_nch", "", {HistType::kTH2D, {nchAxis, centAxis}}); + + // Event selection - Alex + if (cfgUse22sEventCut) { + fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultPVCutLow->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); + fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultPVCutHigh->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); + + fMultCutLow = new TF1("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x)", 0, 100); + fMultCutLow->SetParameters(1893.94, -53.86, 0.502913, -0.0015122, 109.625, -1.19253); + fMultCutHigh = new TF1("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 3.*([4]+[5]*x)", 0, 100); + fMultCutHigh->SetParameters(1893.94, -53.86, 0.502913, -0.0015122, 109.625, -1.19253); + fMultMultPVCut = new TF1("fMultMultPVCut", "[0]+[1]*x+[2]*x*x", 0, 5000); + fMultMultPVCut->SetParameters(-0.1, 0.785, -4.7e-05); + } + + } //! end init function + + template + bool eventSelected(TCollision collision, const int& multTrk, const float& centrality) + { + if (collision.alias_bit(kTVXinTRD)) { + // TRD triggered + return 0; + } + float vtxz = -999; + if (collision.numContrib() > 1) { + vtxz = collision.posZ(); + float zRes = TMath::Sqrt(collision.covZZ()); + if (zRes > 0.25 && collision.numContrib() < 20) + vtxz = -999; + } + auto multNTracksPV = collision.multNTracksPV(); + + if ((vtxz > cfgCutVertex) || (vtxz < -1.0 * cfgCutVertex)) + return 0; + if (multNTracksPV < fMultPVCutLow->Eval(centrality)) + return 0; + if (multNTracksPV > fMultPVCutHigh->Eval(centrality)) + return 0; + if (multTrk < fMultCutLow->Eval(centrality)) + return 0; + if (multTrk > fMultCutHigh->Eval(centrality)) + return 0; + if (multTrk > fMultMultPVCut->Eval(multNTracksPV)) + return 0; + + return 1; } Produces mult_ptQn; @@ -102,8 +171,17 @@ struct MeanptFluctuations_QA_QnTable { // void process(aod::Collision const& coll, aod::Tracks const& inputTracks) void process(aodCollisions::iterator const& coll, aod::BCsWithTimestamps const&, aodTracks const& inputTracks) { + if (!coll.sel8()) + return; + + const auto CentralityFT0C = coll.centFT0C(); + if (cfgUse22sEventCut && !eventSelected(coll, inputTracks.size(), CentralityFT0C)) + return; + histos.fill(HIST("hZvtx_after_sel"), coll.posZ()); histos.fill(HIST("hCentrality"), coll.centFT0C()); + histos.fill(HIST("Hist2D_globalTracks_PVTracks"), coll.multNTracksPV(), inputTracks.size()); + histos.fill(HIST("Hist2D_cent_nch"), inputTracks.size(), CentralityFT0C); // variables double cent = coll.centFT0C(); @@ -150,6 +228,7 @@ struct MeanptFluctuations_analysis { Configurable cfgNSubsample{"cfgNSubsample", 10, "Number of subsamples"}; ConfigurableAxis centAxis{"centAxis", {90, 0, 90}, ""}; ConfigurableAxis multAxis{"multAxis", {5000, 0.5, 5000.5}, ""}; + ConfigurableAxis meanpTAxis{"meanpTAxis", {500, 0, 5.0}, ""}; expressions::Filter Nch_filter = aod::ptQn::n_ch > 3.0f; using FilteredMultPtQn = soa::Filtered; @@ -173,6 +252,8 @@ struct MeanptFluctuations_analysis { registry.add("Prof_var_t1", "", {HistType::kTProfile2D, {centAxis, multAxis}}); registry.add("Prof_skew_t1", "", {HistType::kTProfile2D, {centAxis, multAxis}}); registry.add("Prof_kurt_t1", "", {HistType::kTProfile2D, {centAxis, multAxis}}); + registry.add("Hist2D_Nch_centrality", "", {HistType::kTH2D, {centAxis, multAxis}}); + registry.add("Hist2D_meanpt_centrality", "", {HistType::kTH2D, {centAxis, meanpTAxis}}); // initial array Subsample.resize(cfgNSubsample); @@ -203,11 +284,13 @@ struct MeanptFluctuations_analysis { skewness_term1 = (TMath::Power(event_ptqn.q1(), 3.0f) - 3.0f * event_ptqn.q2() * event_ptqn.q1() + 2.0f * event_ptqn.q3()) / (event_ptqn.n_ch() * (event_ptqn.n_ch() - 1.0f) * (event_ptqn.n_ch() - 2.0f)); kurtosis_term1 = (TMath::Power(event_ptqn.q1(), 4.0f) - (6.0f * event_ptqn.q4()) + (8.0f * event_ptqn.q1() * event_ptqn.q3()) - (6.0f * TMath::Power(event_ptqn.q1(), 2.0f) * event_ptqn.q2()) + (3.0f * TMath::Power(event_ptqn.q2(), 2.0f))) / (event_ptqn.n_ch() * (event_ptqn.n_ch() - 1.0f) * (event_ptqn.n_ch() - 2.0f) * (event_ptqn.n_ch() - 3.0f)); - // filling profiles for central values + // filling profiles and histograms for central values registry.get(HIST("Prof_mean_t1"))->Fill(event_ptqn.centrality(), event_ptqn.n_ch(), mean_term1); registry.get(HIST("Prof_var_t1"))->Fill(event_ptqn.centrality(), event_ptqn.n_ch(), variance_term1); registry.get(HIST("Prof_skew_t1"))->Fill(event_ptqn.centrality(), event_ptqn.n_ch(), skewness_term1); registry.get(HIST("Prof_kurt_t1"))->Fill(event_ptqn.centrality(), event_ptqn.n_ch(), kurtosis_term1); + registry.fill(HIST("Hist2D_Nch_centrality"), event_ptqn.centrality(), event_ptqn.n_ch()); + registry.fill(HIST("Hist2D_meanpt_centrality"), event_ptqn.centrality(), mean_term1); // selecting subsample and filling profiles float l_Random = fRndm->Rndm(); diff --git a/PWGCF/EbyEFluctuations/Tasks/NetProtonCumulants.cxx b/PWGCF/EbyEFluctuations/Tasks/NetProtonCumulants.cxx index a9ac365cc8e..a18b0b97df9 100644 --- a/PWGCF/EbyEFluctuations/Tasks/NetProtonCumulants.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/NetProtonCumulants.cxx @@ -79,7 +79,7 @@ struct NetProtonCumulants_Table_QA { // Variable bin width axis std::vector ptBinning = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 2.0, 2.2, 2.4, 2.8, 3.2, 3.6, 4.}; AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; - std::vector centBining = {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90}; + std::vector centBining = {0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90}; AxisSpec centAxis = {centBining, "centrality (%)"}; AxisSpec netProtonAxis = {2001, -1000.5, 1000.5, "net-proton number"}; @@ -130,8 +130,16 @@ struct NetProtonCumulants_Table_QA { const float combNSigmaPr = std::sqrt(pow(track.tpcNSigmaPr(), 2.0) + pow(track.tofNSigmaPr(), 2.0)); const float combNSigmaPi = std::sqrt(pow(track.tpcNSigmaPi(), 2.0) + pow(track.tofNSigmaPi(), 2.0)); const float combNSigmaKa = std::sqrt(pow(track.tpcNSigmaKa(), 2.0) + pow(track.tofNSigmaKa(), 2.0)); - if (!(combNSigmaPr > combNSigmaPi) && !(combNSigmaPr > combNSigmaKa)) { - if (track.tpcNSigmaPr() < cfgnSigmaCut) { + + int flag2 = 0; + if (combNSigmaPr < 3.0) + flag2 += 1; + if (combNSigmaPi < 3.0) + flag2 += 1; + if (combNSigmaKa < 3.0) + flag2 += 1; + if (!(flag2 > 1) && !(combNSigmaPr > combNSigmaPi) && !(combNSigmaPr > combNSigmaKa)) { + if (combNSigmaPr < cfgnSigmaCut) { flag = 1; } } diff --git a/PWGCF/MultiparticleCorrelations/Core/MuPa-DataMembers.h b/PWGCF/MultiparticleCorrelations/Core/MuPa-DataMembers.h index 1114066d5d3..3f97f56e7c5 100644 --- a/PWGCF/MultiparticleCorrelations/Core/MuPa-DataMembers.h +++ b/PWGCF/MultiparticleCorrelations/Core/MuPa-DataMembers.h @@ -56,6 +56,7 @@ struct TaskConfiguration { TString fWhatToProcess = "Rec"; // "Rec" = process only reconstructed, "Sim" = process only simulated, "RecSim" = process both reconstructed and simulated UInt_t fRandomSeed = 0; // argument to TRandom3 constructor. By default it is 0 (i.e. seed is guaranteed to be unique in time and space), use SetRandomSeed(...) to change it Bool_t fUseFisherYates = kFALSE; // algorithm used to randomize particle indices, set via configurable + TArrayI* fRandomIndices = NULL; // array to store random indices obtained from Fisher-Yates algorithm Int_t fFixedNumberOfRandomlySelectedTracks = -1; // use a fixed number of randomly selected particles in each event. It is set and applied, if > 0. Set to <=0 to ignore. // Bool_t fRescaleWithTheoreticalInput; // if kTRUE, all measured correlators are @@ -126,7 +127,7 @@ Bool_t fCalculateCorrelations = struct Correlations_Arrays { TProfile* fCorrelationsPro[4][gMaxHarmonic][eAsFunctionOf_N] = { {{NULL}}}; //! multiparticle correlations - //! [2p=0,4p=1,6p=2,8p=3][n=1,n=2,...,n=6][0=integrated,1=vs. + //! [2p=0,4p=1,6p=2,8p=3][n=1,n=2,...,n=gMaxHarmonic][0=integrated,1=vs. //! multiplicity,2=vs. centrality,3=pT,4=eta] } c_a; @@ -151,9 +152,9 @@ Bool_t fCalculateNestedLoops = kTRUE; // calculate and store correlations with Bool_t fCalculateCustomNestedLoop = kFALSE; // validate e-b-e all correlations with custom nested loop struct NestedLoops_Arrays { - TProfile* fNestedLoopsPro[4][6][eAsFunctionOf_N] = { + TProfile* fNestedLoopsPro[4][gMaxHarmonic][eAsFunctionOf_N] = { {{NULL}}}; //! multiparticle correlations from nested loops - //! [2p=0,4p=1,6p=2,8p=3][n=1,n=2,...,n=6][0=integrated,1=vs. + //! [2p=0,4p=1,6p=2,8p=3][n=1,n=2,...,n=gMaxHarmonic][0=integrated,1=vs. //! multiplicity,2=vs. centrality,3=pT,4=eta] TArrayD* ftaNestedLoops[2] = {NULL}; //! e-b-e container for nested loops //! [0=angles;1=product of all weights] diff --git a/PWGCF/MultiparticleCorrelations/Core/MuPa-GlobalConstants.h b/PWGCF/MultiparticleCorrelations/Core/MuPa-GlobalConstants.h index 714ff2c5971..d400ce14185 100644 --- a/PWGCF/MultiparticleCorrelations/Core/MuPa-GlobalConstants.h +++ b/PWGCF/MultiparticleCorrelations/Core/MuPa-GlobalConstants.h @@ -13,7 +13,7 @@ #define PWGCF_MULTIPARTICLECORRELATIONS_CORE_MUPA_GLOBALCONSTANTS_H_ const Int_t gMaxCorrelator = 12; -const Int_t gMaxHarmonic = 6; +const Int_t gMaxHarmonic = 9; const Int_t gMaxIndex = 300; // per order, used only in Test0 #endif // PWGCF_MULTIPARTICLECORRELATIONS_CORE_MUPA_GLOBALCONSTANTS_H_ diff --git a/PWGCF/MultiparticleCorrelations/Core/MuPa-MemberFunctions.h b/PWGCF/MultiparticleCorrelations/Core/MuPa-MemberFunctions.h index eb0cbd5fca2..4840cff7bc2 100644 --- a/PWGCF/MultiparticleCorrelations/Core/MuPa-MemberFunctions.h +++ b/PWGCF/MultiparticleCorrelations/Core/MuPa-MemberFunctions.h @@ -39,7 +39,7 @@ void BookBaseList() Form("fTaskName = %s", tc.fTaskName.Data())); fBasePro->GetXaxis()->SetBinLabel(eRunNumber, - Form("tc.fRunNumber = %s", tc.fRunNumber.Data())); + Form("fRunNumber = %s", tc.fRunNumber.Data())); fBasePro->GetXaxis()->SetBinLabel(eVerbose, "fVerbose"); fBasePro->Fill(eVerbose - 0.5, (Int_t)tc.fVerbose); @@ -57,7 +57,7 @@ void BookBaseList() fBasePro->Fill(eProcessRemainingEvents - 0.5, (Int_t)tc.fProcessRemainingEvents); fBasePro->GetXaxis()->SetBinLabel(eWhatToProcess, - Form("tc.WhatToProcess = %s", tc.fWhatToProcess.Data())); + Form("WhatToProcess = %s", tc.fWhatToProcess.Data())); fBasePro->GetXaxis()->SetBinLabel(eRandomSeed, "fRandomSeed"); fBasePro->Fill(eRandomSeed - 0.5, (Int_t)tc.fRandomSeed); @@ -126,6 +126,10 @@ void DefaultConfiguration() // identical to the internal definitions in MuPa-Configurables.h, the // settings in json file are silently ignored. + // c) Scientific notation is NOT supported in json file. E.g. if you have + // "cSelectedTracks_max": "1e3", + // that setting and ALL other ones in json are silently ignored. + if (tc.fVerbose) { LOGF(info, "\033[1;32m%s\033[0m", __PRETTY_FUNCTION__); } @@ -1010,7 +1014,7 @@ void BookTest0Histograms() // a) Book the profile holding flags; // b) Book placeholder and make sure all labels are stored in the placeholder; - // c) Retreive labels from placeholder; + // c) Retrieve labels from placeholder; // d) Book what needs to be booked; // e) Few quick insanity checks on booking. @@ -1036,7 +1040,7 @@ void BookTest0Histograms() fTest0List->Add(fTest0LabelsPlaceholder); } - // c) Retreive labels from placeholder: + // c) Retrieve labels from placeholder: if (!(this->RetrieveCorrelationsLabels())) { LOGF(fatal, "in function \033[1;31m%s at line %d\033[0m", __PRETTY_FUNCTION__, __LINE__); @@ -1221,7 +1225,7 @@ void ResetEventByEventQuantities() fSelectedTracks = 0; fCentrality = 0; - // c) Q-vectors: + // b) Q-vectors: if (fCalculateQvector) { ResetQ(); // generic Q-vector for (Int_t h = 0; h < gMaxHarmonic * gMaxCorrelator + 1; h++) { @@ -1232,7 +1236,7 @@ void ResetEventByEventQuantities() } } // if(fCalculateQvector) - // d) Reset ebe containers for nested loops: + // c) Reset ebe containers for nested loops: if (fCalculateNestedLoops || fCalculateCustomNestedLoop) { if (nl_a.ftaNestedLoops[0]) { nl_a.ftaNestedLoops[0]->Reset(); @@ -1246,7 +1250,13 @@ void ResetEventByEventQuantities() } // if(fCalculateNestedLoops||fCalculateCustomNestedLoop) - // ... TBI 20220809 port the rest ... + // d) Fisher-Yates algorithm: + if (tc.fUseFisherYates) { + delete tc.fRandomIndices; + tc.fRandomIndices = NULL; + } + + // ... TBI 20240117 port the rest ... } // void ResetEventByEventQuantities() @@ -2930,7 +2940,8 @@ void StoreLabelsInPlaceholder() // a) Initialize all counters; // b) Fetch TObjArray with labels from an external file; // c) Book the placeholder fTest0LabelsPlaceholder for all labels; - // d) Finally, store the labels from external source into placeholder. + // d) Finally, store the labels from external source into placeholder; + // e) Insantity check on labels. if (tc.fVerbose) { LOGF(info, "\033[1;32m%s\033[0m", __PRETTY_FUNCTION__); @@ -2985,6 +2996,19 @@ void StoreLabelsInPlaceholder() // cout<GetEntries()<GetXaxis()->GetNbins(); b++) { + TObjArray* temp = TString(fTest0LabelsPlaceholder->GetXaxis()->GetBinLabel(b)).Tokenize(" "); + for (Int_t h = 0; h < temp->GetEntries(); h++) { + if (TMath::Abs(TString(temp->At(h)->GetName()).Atoi()) > gMaxHarmonic) { + LOGF(info, "\033[1;31m bin = %d, label = %s, gMaxHarmonic = %d\033[0m", b, fTest0LabelsPlaceholder->GetXaxis()->GetBinLabel(b), (Int_t)gMaxHarmonic); + LOGF(fatal, "in function \033[1;31m%s at line %d\033[0m", __PRETTY_FUNCTION__, __LINE__); + } // if(TString(temp->At(h)->GetName()).Atoi() > gMaxHarmonic) { + } // for(Int_t h = 0; h < temp->GetEntries(); h++) { + delete temp; // yes, otherwise it's a memory leak + } // for(Int_t b = 1; b <= fTest0LabelsPlaceholder->GetXaxis()->GetNbins(); b++) { + } // void StoreLabelsInPlaceholder() //============================================================ @@ -3426,6 +3450,35 @@ void DetermineCentrality() //============================================================ +void RandomIndices(Int_t nTracks) +{ + // Randomize indices using Fisher-Yates algorithm. + + if (tc.fVerbose) { + LOGF(info, "\033[1;32m%s\033[0m", __PRETTY_FUNCTION__); + } + + if (nTracks < 1) { + return; + } + + // Fisher-Yates algorithm: + tc.fRandomIndices = new TArrayI(nTracks); + tc.fRandomIndices->Reset(); // just in case there is some random garbage in memory at init + for (Int_t i = 0; i < nTracks; i++) { + tc.fRandomIndices->AddAt(i, i); + } + for (Int_t i = nTracks - 1; i >= 1; i--) { + Int_t j = gRandom->Integer(i + 1); + Int_t temp = tc.fRandomIndices->GetAt(j); + tc.fRandomIndices->AddAt(tc.fRandomIndices->GetAt(i), j); + tc.fRandomIndices->AddAt(temp, i); + } // end of for(Int_t i=nTracks-1;i>=1;i--) + +} // void RandomIndices(Int_t nTracks) + +//============================================================ + void CalculateEverything() { // Calculate everything for selected events and particles. @@ -3531,7 +3584,28 @@ void MainLoopOverParticles(T const& tracks) Double_t wToPowerP = 1.; // weight raised to power p fSelectedTracks = 0; // reset number of selected tracks - for (auto& track : tracks) { + // *) If random access of tracks from collection is requested, use Fisher-Yates algorithm to generate random indices: + if (tc.fUseFisherYates) { + if (tc.fRandomIndices) { + LOGF(fatal, "in function \033[1;31m%s at line %d\033[0m", __PRETTY_FUNCTION__, __LINE__); + } + this->RandomIndices(tracks.size()); + if (!tc.fRandomIndices) { + LOGF(fatal, "in function \033[1;31m%s at line %d\033[0m", __PRETTY_FUNCTION__, __LINE__); + } + } + + // *) Main loop over particles: + // for (auto& track : tracks) { // default standard way of looping of tracks + auto track = tracks.iteratorAt(0); // set the type and scope from one instance + for (int64_t i = 0; i < tracks.size(); i++) { + + // *) Access track sequentially from collection of tracks (default), or randomly using Fisher-Yates algorithm: + if (!tc.fUseFisherYates) { + track = tracks.iteratorAt(i); + } else { + track = tracks.iteratorAt((int64_t)tc.fRandomIndices->GetAt(i)); + } // *) Fill particle histograms before particle cuts: FillParticleHistograms(track, eBefore); diff --git a/PWGEM/Dilepton/Tasks/MCtemplates.cxx b/PWGEM/Dilepton/Tasks/MCtemplates.cxx index 051a8786586..4ddf086e3a7 100644 --- a/PWGEM/Dilepton/Tasks/MCtemplates.cxx +++ b/PWGEM/Dilepton/Tasks/MCtemplates.cxx @@ -62,7 +62,7 @@ DECLARE_SOA_TABLE(BarrelTrackCuts, "AOD", "BARRELTRACKCUTS", emanalysisflags::Is // No skimming: works for events and single tracks using MyEventsAOD = soa::Join; using MyEventsSelectedAOD = soa::Join; -using MyMCEventsSelectedAOD = soa::Join; +// using MyMCEventsSelectedAOD = soa::Join; using MyBarrelTracksAOD = soa::Join - void runSelection(TEvent const& event, TTracks const& tracks) + template + void runSelection(TEvent const& event, TTracks const& tracks, TEventsMC const& eventsMC, TTracksMC const& tracksMC) { VarManager::ResetValues(0, VarManager::kNMCParticleVariables); // fill event information which might be needed in histograms that combine track and event properties @@ -328,13 +328,13 @@ struct AnalysisTrackSelection { } // end loop over tracks } - void processSkimmed(MyEventsSelected::iterator const& event, MyBarrelTracks const& tracks) + void processSkimmed(MyEventsSelected::iterator const& event, MyBarrelTracks const& tracks, ReducedMCEvents const& eventsMC, ReducedMCTracks const& tracksMC) { - runSelection(event, tracks); + runSelection(event, tracks, eventsMC, tracksMC); } - void processAOD(MyEventsSelectedAOD::iterator const& event, MyBarrelTracksAOD const& tracks) + void processAOD(MyEventsSelectedAOD::iterator const& event, MyBarrelTracksAOD const& tracks, aod::McCollisions const& eventsMC, aod::McParticles const& tracksMC) { - runSelection(event, tracks); + runSelection(event, tracks, eventsMC, tracksMC); } void processDummy(MyEvents&) @@ -624,7 +624,7 @@ struct AnalysisSameEventPairing { // Reset the fValues array VarManager::ResetValues(0, VarManager::kNVars); VarManager::FillEvent(event); - // VarManager::FillEvent(event.reducedMCevent()); + VarManager::FillEvent(event.mcCollision()); runPairing(event, tracks, tracks); auto groupedMCTracks = tracksMC.sliceBy(perMcCollision, event.mcCollision().globalIndex()); diff --git a/PWGEM/PhotonMeson/Core/CutsLibrary.cxx b/PWGEM/PhotonMeson/Core/CutsLibrary.cxx index 4867fbe7102..5943cc149a7 100644 --- a/PWGEM/PhotonMeson/Core/CutsLibrary.cxx +++ b/PWGEM/PhotonMeson/Core/CutsLibrary.cxx @@ -35,24 +35,6 @@ V0PhotonCut* o2::aod::pcmcuts::GetCut(const char* cutName) cut->SetRxyRange(1, 90); return cut; } - if (!nameStr.compare("qc_lc")) { // qc for late conversion - // for track - cut->SetTrackPtRange(0.02f, 1e10f); - // cut->SetTrackEtaRange(-0.9, +0.9); - cut->SetMinNCrossedRowsTPC(20); - cut->SetMinNCrossedRowsOverFindableClustersTPC(0.8); - cut->SetChi2PerClusterTPC(0.0, 4.0); - cut->SetTPCNsigmaElRange(-3, +3); - cut->SetIsWithinBeamPipe(true); - // for v0 - cut->SetV0PtRange(0.1f, 1e10f); - cut->SetV0EtaRange(-0.9, +0.9); - cut->SetMinCosPA(0.99); - cut->SetMaxPCA(1.5); - cut->SetRxyRange(42, 90); - cut->SetAPRange(0.95, 0.01); - return cut; - } if (!nameStr.compare("qc")) { // for track cut->SetTrackPtRange(0.02f, 1e10f); diff --git a/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx b/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx index abd01b0583a..e4f7c6455d4 100644 --- a/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx +++ b/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx @@ -192,6 +192,22 @@ void o2::aod::emphotonhistograms::DefineHistograms(THashList* list, const char* list->Add(hs_dilepton_lspp_dca_same); list->Add(hs_dilepton_lsmm_dca_same); + if (TString(subGroup) == "mix") { + THnSparseF* hs_dilepton_uls_mix = reinterpret_cast(hs_dilepton_uls_same->Clone("hs_dilepton_uls_mix")); + THnSparseF* hs_dilepton_lspp_mix = reinterpret_cast(hs_dilepton_lspp_same->Clone("hs_dilepton_lspp_mix")); + THnSparseF* hs_dilepton_lsmm_mix = reinterpret_cast(hs_dilepton_lsmm_same->Clone("hs_dilepton_lsmm_mix")); + list->Add(hs_dilepton_uls_mix); + list->Add(hs_dilepton_lspp_mix); + list->Add(hs_dilepton_lsmm_mix); + + THnSparseF* hs_dilepton_uls_dca_mix = reinterpret_cast(hs_dilepton_uls_dca_same->Clone("hs_dilepton_uls_dca_mix")); + THnSparseF* hs_dilepton_lspp_dca_mix = reinterpret_cast(hs_dilepton_lspp_dca_same->Clone("hs_dilepton_lspp_dca_mix")); + THnSparseF* hs_dilepton_lsmm_dca_mix = reinterpret_cast(hs_dilepton_lsmm_dca_same->Clone("hs_dilepton_lsmm_dca_mix")); + list->Add(hs_dilepton_uls_dca_mix); + list->Add(hs_dilepton_lspp_dca_mix); + list->Add(hs_dilepton_lsmm_dca_mix); + } + if (TString(subGroup) == "mc") { // create phiv template list->Add(new TH2F("hMvsPhiV_Pi0", "m_{ee} vs. #varphi_{V};#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", 32, 0, 3.2, 100, 0.0f, 0.1f)); // ee from pi0 dalitz decay @@ -201,45 +217,37 @@ void o2::aod::emphotonhistograms::DefineHistograms(THashList* list, const char* list->Add(new TH2F("hMvsOPA_Pi0", "m_{ee} vs. opening angle;opening angle (rad.);m_{ee} (GeV/c^{2})", 100, 0, 0.1, 100, 0.0f, 0.1f)); // ee from pi0 dalitz decay list->Add(new TH2F("hMvsOPA_Eta", "m_{ee} vs. opening angle;opening angle (rad.);m_{ee} (GeV/c^{2})", 100, 0, 0.1, 100, 0.0f, 0.1f)); // ee from eta dalitz decay list->Add(new TH2F("hMvsOPA_Photon", "m_{ee} vs. opening angle;opening angle (rad.);m_{ee} (GeV/c^{2})", 100, 0, 0.1, 100, 0.0f, 0.1f)); // ee from photon conversion - - } // end of mc + } // end of mc } else if (TString(histClass).Contains("MuMu")) { const int ndim = 4; // m, pt, dca, phiv const int nbins[ndim] = {90, 20, 50, 1}; const double xmin[ndim] = {0.2, 0.0, 0.0, 0.0}; const double xmax[ndim] = {1.1, 2.0, 5.0, 3.2}; - hs_dilepton_uls_same = new THnSparseF("hs_dilepton_uls_same", "hs_dilepton_uls;m_{#mu#mu} (GeV/c^{2});p_{T,#mu#mu} (GeV/c);DCA_{xy,#mu#mu} (#sigma);#varphi_{V} (rad.);", ndim, nbins, xmin, xmax); + hs_dilepton_uls_same = new THnSparseF("hs_dilepton_uls_same", "hs_dilepton_uls;m_{#mu#mu} (GeV/c^{2});p_{T,#mu#mu} (GeV/c);DCA_{#mu#mu}^{3D} (#sigma);#varphi_{V} (rad.);", ndim, nbins, xmin, xmax); hs_dilepton_uls_same->Sumw2(); list->Add(hs_dilepton_uls_same); - hs_dilepton_lspp_same = new THnSparseF("hs_dilepton_lspp_same", "hs_dilepton_lspp;m_{#mu#mu} (GeV/c^{2});p_{T,#mu#mu} (GeV/c);DCA_{xy,#mu#mu} (#sigma);#varphi_{V} (rad.);", ndim, nbins, xmin, xmax); + hs_dilepton_lspp_same = new THnSparseF("hs_dilepton_lspp_same", "hs_dilepton_lspp;m_{#mu#mu} (GeV/c^{2});p_{T,#mu#mu} (GeV/c);DCA_{#mu#mu}^{3D} (#sigma);#varphi_{V} (rad.);", ndim, nbins, xmin, xmax); hs_dilepton_lspp_same->Sumw2(); list->Add(hs_dilepton_lspp_same); - hs_dilepton_lsmm_same = new THnSparseF("hs_dilepton_lsmm_same", "hs_dilepton_lsmm;m_{#mu#mu} (GeV/c^{2});p_{T,#mu#mu} (GeV/c);DCA_{xy,#mu#mu} (#sigma);#varphi_{V} (rad.);", ndim, nbins, xmin, xmax); + hs_dilepton_lsmm_same = new THnSparseF("hs_dilepton_lsmm_same", "hs_dilepton_lsmm;m_{#mu#mu} (GeV/c^{2});p_{T,#mu#mu} (GeV/c);DCA_{#mu#mu}^{3D} (#sigma);#varphi_{V} (rad.);", ndim, nbins, xmin, xmax); hs_dilepton_lsmm_same->Sumw2(); list->Add(hs_dilepton_lsmm_same); + + if (TString(subGroup) == "mix") { + THnSparseF* hs_dilepton_uls_mix = reinterpret_cast(hs_dilepton_uls_same->Clone("hs_dilepton_uls_mix")); + THnSparseF* hs_dilepton_lspp_mix = reinterpret_cast(hs_dilepton_lspp_same->Clone("hs_dilepton_lspp_mix")); + THnSparseF* hs_dilepton_lsmm_mix = reinterpret_cast(hs_dilepton_lsmm_same->Clone("hs_dilepton_lsmm_mix")); + list->Add(hs_dilepton_uls_mix); + list->Add(hs_dilepton_lspp_mix); + list->Add(hs_dilepton_lsmm_mix); + } } else { LOGF(info, "EE or MuMu are supported."); } - if (TString(subGroup) == "mix") { - THnSparseF* hs_dilepton_uls_mix = reinterpret_cast(hs_dilepton_uls_same->Clone("hs_dilepton_uls_mix")); - THnSparseF* hs_dilepton_lspp_mix = reinterpret_cast(hs_dilepton_lspp_same->Clone("hs_dilepton_lspp_mix")); - THnSparseF* hs_dilepton_lsmm_mix = reinterpret_cast(hs_dilepton_lsmm_same->Clone("hs_dilepton_lsmm_mix")); - list->Add(hs_dilepton_uls_mix); - list->Add(hs_dilepton_lspp_mix); - list->Add(hs_dilepton_lsmm_mix); - - THnSparseF* hs_dilepton_uls_dca_mix = reinterpret_cast(hs_dilepton_uls_dca_same->Clone("hs_dilepton_uls_dca_mix")); - THnSparseF* hs_dilepton_lspp_dca_mix = reinterpret_cast(hs_dilepton_lspp_dca_same->Clone("hs_dilepton_lspp_dca_mix")); - THnSparseF* hs_dilepton_lsmm_dca_mix = reinterpret_cast(hs_dilepton_lsmm_dca_same->Clone("hs_dilepton_lsmm_dca_mix")); - list->Add(hs_dilepton_uls_dca_mix); - list->Add(hs_dilepton_lspp_dca_mix); - list->Add(hs_dilepton_lsmm_dca_mix); - } - list->Add(new TH1F("hNpair_uls", "Number of ULS pairs per collision", 101, -0.5f, 100.5f)); list->Add(new TH1F("hNpair_lspp", "Number of LS++ pairs per collision", 101, -0.5f, 100.5f)); list->Add(new TH1F("hNpair_lsmm", "Number of LS-- pairs per collision", 101, -0.5f, 100.5f)); @@ -410,16 +418,16 @@ void o2::aod::emphotonhistograms::DefineHistograms(THashList* list, const char* list->Add(new TH1F("hZvtx_after", "vertex z; Zvtx (cm)", 100, -50, +50)); list->Add(new TH1F("hNrecPerMCCollision", "Nrec per mc collisions;N_{rec} collisions per MC collisions", 101, -0.5f, 100.5f)); - if (TString(subGroup) == "ConversionStudy") { - list->Add(new TH2F("hPhotonRxy", "conversion point in XY MC;V_{x} (cm);V_{y} (cm)", 2000, -100.0f, 100.0f, 2000, -100.0f, 100.0f)); - list->Add(new TH2F("hPhotonRZ", "conversion point in RZ MC;V_{z} (cm);R_{xy} (cm)", 5000, -250.0f, 250.0f, 1000, 0.f, 100.0f)); - list->Add(new TH2F("hPhotonPhivsRxy", "conversion point of #varphi vs. R_{xy} MC;#varphi (rad.);R_{xy} (cm);N_{e}", 360, 0.0f, TMath::TwoPi(), 200, 0, 200)); - } - if (TString(subGroup) == "Photon") { list->Add(new TH1F("hPt_Photon", "photon pT;p_{T} (GeV/c)", 2000, 0.0f, 20)); list->Add(new TH1F("hY_Photon", "photon y;rapidity y", 40, -2.0f, 2.0f)); list->Add(new TH1F("hPhi_Photon", "photon #varphi;#varphi (rad.)", 180, 0, TMath::TwoPi())); + list->Add(new TH1F("hPt_ConvertedPhoton", "converted photon pT;p_{T} (GeV/c)", 2000, 0.0f, 20)); + list->Add(new TH1F("hY_ConvertedPhoton", "converted photon y;rapidity y", 40, -2.0f, 2.0f)); + list->Add(new TH1F("hPhi_ConvertedPhoton", "converted photon #varphi;#varphi (rad.)", 180, 0, TMath::TwoPi())); + list->Add(new TH2F("hPhotonRxy", "conversion point in XY MC;V_{x} (cm);V_{y} (cm)", 2000, -100.0f, 100.0f, 2000, -100.0f, 100.0f)); + list->Add(new TH2F("hPhotonRZ", "conversion point in RZ MC;V_{z} (cm);R_{xy} (cm)", 2000, -100.0f, 100.0f, 1000, 0.f, 100.0f)); + list->Add(new TH2F("hPhotonPhivsRxy", "conversion point of #varphi vs. R_{xy} MC;#varphi (rad.);R_{xy} (cm);N_{e}", 360, 0.0f, TMath::TwoPi(), 100, 0, 100)); } if (TString(subGroup) == "Pi0Eta") { @@ -455,25 +463,25 @@ void o2::aod::emphotonhistograms::DefineHistograms(THashList* list, const char* pTgg10[i] = 0.5 * (i - 50) + 5.0; // from 5 to 10 GeV/c, evety 0.5 GeV/c } if (TString(histClass) == "tagging_pi0") { - list->Add(new TH2F("hMggPt_Same", "m_{ee#gamma} vs. p_{T,ee};m_{ee#gamma} (GeV/c^{2});p_{T,ee} (GeV/c)", nmgg04 - 1, mgg04, npTgg10 - 1, pTgg10)); - list->Add(new TH2F("hMggPt_Mixed", "m_{ee#gamma} vs. p_{T,ee};m_{ee#gamma} (GeV/c^{2});p_{T,ee} (GeV/c)", nmgg04 - 1, mgg04, npTgg10 - 1, pTgg10)); + list->Add(new TH2F("hMggPt_Same", "m_{ee#gamma} vs. p_{T,#gamma};m_{ee#gamma} (GeV/c^{2});p_{T,#gamma} (GeV/c)", nmgg04 - 1, mgg04, npTgg10 - 1, pTgg10)); + list->Add(new TH2F("hMggPt_Mixed", "m_{ee#gamma} vs. p_{T,#gamma};m_{ee#gamma} (GeV/c^{2});p_{T,#gamma} (GeV/c)", nmgg04 - 1, mgg04, npTgg10 - 1, pTgg10)); reinterpret_cast(list->FindObject("hMggPt_Same"))->Sumw2(); reinterpret_cast(list->FindObject("hMggPt_Mixed"))->Sumw2(); } if (TString(histClass) == "tagging_pi0_mc") { if (TString(subGroup) == "pcm") { - list->Add(new TH1F("hPt_v0photon_Pi0_Primary", "reconstcuted v0 photon from primary #pi^{0};p_{T,ee} (GeV/c);N_{ee}^{#pi^{0}}", npTgg10 - 1, pTgg10)); // denominator for conditional probability + list->Add(new TH1F("hPt_v0photon_Pi0_Primary", "reconstcuted v0 photon from primary #pi^{0};p_{T,#gamma} (GeV/c);N_{#gamma}^{#pi^{0}}", npTgg10 - 1, pTgg10)); // denominator for conditional probability reinterpret_cast(list->FindObject("hPt_v0photon_Pi0_Primary"))->Sumw2(); - list->Add(new TH1F("hPt_v0photon_Pi0_FromWD", "reconstcuted v0 photon from #pi^{0} from WD;p_{T,ee} (GeV/c);N_{ee}^{#pi^{0}}", npTgg10 - 1, pTgg10)); // denominator for conditional probability + list->Add(new TH1F("hPt_v0photon_Pi0_FromWD", "reconstcuted v0 photon from #pi^{0} from WD;p_{T,#gamma} (GeV/c);N_{#gamma}^{#pi^{0}}", npTgg10 - 1, pTgg10)); // denominator for conditional probability reinterpret_cast(list->FindObject("hPt_v0photon_Pi0_FromWD"))->Sumw2(); - list->Add(new TH1F("hPt_v0photon_Pi0_hs", "reconstcuted v0 photon from #pi^{0} from hadronic shower in materials;p_{T,ee} (GeV/c);N_{ee}^{#pi^{0}}", npTgg10 - 1, pTgg10)); // denominator for conditional probability + list->Add(new TH1F("hPt_v0photon_Pi0_hs", "reconstcuted v0 photon from #pi^{0} from hadronic shower in materials;p_{T,#gamma} (GeV/c);N_{#gamma}^{#pi^{0}}", npTgg10 - 1, pTgg10)); // denominator for conditional probability reinterpret_cast(list->FindObject("hPt_v0photon_Pi0_hs"))->Sumw2(); } else if (TString(subGroup) == "pair") { - list->Add(new TH2F("hMggPt_Pi0_Primary", "reconstructed m_{ee#gamma} vs. p_{T,ee} from primary #pi^{0};m_{ee#gamma} (GeV/c^{2});p_{T,ee} (GeV/c);N_{ee}^{tagged #pi^{0}}", nmgg04 - 1, mgg04, npTgg10 - 1, pTgg10)); // numerator for conditional probability + list->Add(new TH2F("hMggPt_Pi0_Primary", "reconstructed m_{ee#gamma} vs. p_{T,#gamma} from primary #pi^{0};m_{ee#gamma} (GeV/c^{2});p_{T,#gamma} (GeV/c);N_{#gamma}^{tagged #pi^{0}}", nmgg04 - 1, mgg04, npTgg10 - 1, pTgg10)); // numerator for conditional probability reinterpret_cast(list->FindObject("hMggPt_Pi0_Primary"))->Sumw2(); - list->Add(new TH2F("hMggPt_Pi0_FromWD", "reconstructed m_{ee#gamma} vs. p_{T,ee} from #pi^{0} from WD;m_{ee#gamma} (GeV/c^{2});p_{T,ee} (GeV/c);N_{ee}^{tagged #pi^{0}}", nmgg04 - 1, mgg04, npTgg10 - 1, pTgg10)); // numerator for conditional probability + list->Add(new TH2F("hMggPt_Pi0_FromWD", "reconstructed m_{ee#gamma} vs. p_{T,#gamma} from #pi^{0} from WD;m_{ee#gamma} (GeV/c^{2});p_{T,#gamma} (GeV/c);N_{#gamma}^{tagged #pi^{0}}", nmgg04 - 1, mgg04, npTgg10 - 1, pTgg10)); // numerator for conditional probability reinterpret_cast(list->FindObject("hMggPt_Pi0_FromWD"))->Sumw2(); - list->Add(new TH2F("hMggPt_Pi0_hs", "reconstructed m_{ee#gamma} vs. p_{T,ee} from #pi^{0} from hadronic shower in material;m_{ee#gamma} (GeV/c^{2});p_{T,ee} (GeV/c);N_{ee}^{tagged #pi^{0}}", nmgg04 - 1, mgg04, npTgg10 - 1, pTgg10)); // numerator for conditional probability + list->Add(new TH2F("hMggPt_Pi0_hs", "reconstructed m_{ee#gamma} vs. p_{T,#gamma} from #pi^{0} from hadronic shower in material;m_{ee#gamma} (GeV/c^{2});p_{T,#gamma} (GeV/c);N_{#gamma}^{tagged #pi^{0}}", nmgg04 - 1, mgg04, npTgg10 - 1, pTgg10)); // numerator for conditional probability reinterpret_cast(list->FindObject("hMggPt_Pi0_hs"))->Sumw2(); } } diff --git a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx index 5eecb2d8a2a..8ea0cd7ac9b 100644 --- a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx +++ b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx @@ -346,6 +346,9 @@ struct PhotonConversionBuilder { if (rxy_tmp > maxX + margin_r_tpconly) { return; } + if (rxy_tmp < abs(xyz[2]) * TMath::Tan(2 * TMath::ATan(TMath::Exp(-max_eta_v0))) - margin_z) { + return; // RZ line cut + } KFPTrack kfp_track_pos = createKFPTrackFromTrack(pos); KFPTrack kfp_track_ele = createKFPTrackFromTrack(ele); diff --git a/PWGEM/PhotonMeson/Tasks/MaterialBudgetMC.cxx b/PWGEM/PhotonMeson/Tasks/MaterialBudgetMC.cxx index 2551a4de068..3e54e537358 100644 --- a/PWGEM/PhotonMeson/Tasks/MaterialBudgetMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/MaterialBudgetMC.cxx @@ -60,6 +60,8 @@ struct MaterialBudgetMC { Configurable CentEstimator{"CentEstimator", "FT0M", "centrality estimator"}; Configurable maxY{"maxY", 0.9, "maximum rapidity for generated particles"}; + Configurable maxRgen{"maxRgen", 90.f, "maximum radius for generated particles"}; + Configurable margin_z_mc{"margin_z_mc", 7.0, "margin for z cut in cm for MC"}; Configurable fConfigTagCuts{"cfgTagCuts", "qc", "Comma separated list of V0 photon cuts for tag"}; Configurable fConfigProbeCuts{"cfgProbeCuts", "qc,wwire_ib", "Comma separated list of V0 photon cuts for probe"}; Configurable fConfigPairCuts{"cfgPairCuts", "nocut", "Comma separated list of pair cuts"}; @@ -159,8 +161,7 @@ struct MaterialBudgetMC { o2::aod::emphotonhistograms::AddHistClass(fMainList, "Generated"); THashList* list_gen = reinterpret_cast(fMainList->FindObject("Generated")); - o2::aod::emphotonhistograms::DefineHistograms(list_gen, "Generated", "Photon"); - o2::aod::emphotonhistograms::DefineHistograms(list_gen, "Generated", "ConversionStudy"); + o2::aod::emphotonhistograms::DefineHistograms(list_gen, "Generated", ""); } void DefineTagCuts() @@ -394,31 +395,7 @@ struct MaterialBudgetMC { } reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(4.0); reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hZvtx_after"))->Fill(mccollision.posZ()); - - auto mctracks_coll = mcparticles.sliceBy(perMcCollision, mccollision.globalIndex()); - for (auto& mctrack : mctracks_coll) { - if (abs(mctrack.y()) > maxY) { - continue; - } - if (abs(mctrack.pdgCode()) == 22 && IsPhysicalPrimary(mctrack.emreducedmcevent(), mctrack, mcparticles)) { - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hPt_Photon"))->Fill(mctrack.pt()); - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hY_Photon"))->Fill(mctrack.y()); - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hPhi_Photon"))->Fill(mctrack.phi()); - } - - int photonid = IsEleFromPC(mctrack, mcparticles); - if (photonid > 0) { - auto mcphoton = mcparticles.iteratorAt(photonid); - if (!IsPhysicalPrimary(mcphoton.emreducedmcevent(), mcphoton, mcparticles)) { - continue; - } - float rxy = sqrt(pow(mctrack.vx(), 2) + pow(mctrack.vy(), 2)); - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hPhotonRZ"))->Fill(mctrack.vz(), rxy); - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hPhotonRxy"))->Fill(mctrack.vx(), mctrack.vy()); - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hPhotonPhivsRxy"))->Fill(mctrack.phi(), rxy); - } - } - } + } // end of collision loop } void processDummy(MyCollisions::iterator const& collision) {} diff --git a/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx b/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx index 99858984092..acebc53ae55 100644 --- a/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx @@ -58,7 +58,9 @@ struct PCMQCMC { using MyMCV0Legs = soa::Join; Configurable fConfigPCMCuts{"cfgPCMCuts", "analysis,qc,nocut", "Comma separated list of v0 photon cuts"}; - Configurable maxY{"maxY", 0.9, "maximum rapidity for generated particles"}; + Configurable maxY{"maxY", 0.9f, "maximum rapidity for generated particles"}; + Configurable maxRgen{"maxRgen", 90.f, "maximum radius for generated particles"}; + Configurable margin_z_mc{"margin_z_mc", 7.0, "margin for z cut in cm for MC"}; std::vector fPCMCuts; @@ -271,9 +273,40 @@ struct PCMQCMC { reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hPt_Photon"))->Fill(mctrack.pt()); reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hY_Photon"))->Fill(mctrack.y()); reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hPhi_Photon"))->Fill(mctrack.phi()); + + bool is_ele_fromPC = false; + bool is_pos_fromPC = false; + auto daughtersIds = mctrack.daughtersIds(); // always size = 2. first and last index. one should run loop from the first index to the last index. + for (auto& daughterId : daughtersIds) { + if (daughterId < 0) { + continue; + } + auto daughter = mcparticles.iteratorAt(daughterId); // always electron and positron + float rxy_gen_e = sqrt(pow(daughter.vx(), 2) + pow(daughter.vy(), 2)); + if (rxy_gen_e > maxRgen || rxy_gen_e < abs(daughter.vz()) * TMath::Tan(2 * TMath::ATan(TMath::Exp(-maxY))) - margin_z_mc) { + continue; + } + + if (daughter.pdgCode() == 11) { // electron from photon conversion + is_ele_fromPC = true; + } else if (daughter.pdgCode() == -11) { // positron from photon conversion + is_pos_fromPC = true; + } + } // end of daughter loop + if (is_ele_fromPC && is_pos_fromPC) { // ele and pos from photon conversion + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hPt_ConvertedPhoton"))->Fill(mctrack.pt()); + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hY_ConvertedPhoton"))->Fill(mctrack.y()); + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hPhi_ConvertedPhoton"))->Fill(mctrack.phi()); + + auto daughter = mcparticles.iteratorAt(daughtersIds[0]); // choose ele or pos. + float rxy_gen_e = sqrt(pow(daughter.vx(), 2) + pow(daughter.vy(), 2)); + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hPhotonRZ"))->Fill(daughter.vz(), rxy_gen_e); + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hPhotonRxy"))->Fill(daughter.vx(), daughter.vy()); + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hPhotonPhivsRxy"))->Fill(daughter.phi(), rxy_gen_e); + } } - } - } + } // end of mctrack loop per collision + } // end of collision loop } void processDummy(MyCollisions const& collisions) diff --git a/PWGEM/Tasks/phosCalibration.cxx b/PWGEM/Tasks/phosCalibration.cxx index 8e21dd79561..9c63becbf3e 100644 --- a/PWGEM/Tasks/phosCalibration.cxx +++ b/PWGEM/Tasks/phosCalibration.cxx @@ -73,8 +73,9 @@ struct phosCalibration { Configurable mMaxCellTimeMain{"maxCellTimeMain", 100.e-9, "Max. cell time of main bunch selection"}; Configurable mMixedEvents{"mixedEvents", 10, "number of events to mix"}; Configurable mSkipL1phase{"skipL1phase", false, "do not correct L1 phase from CCDB"}; - Configurable mBadMapPath{"badmapPath", "alien:///alice/cern.ch/user/p/prsnko/Calib/BadMap/snapshot.root", "path to BadMap snapshot"}; - Configurable mCalibPath{"calibPath", "alien:///alice/cern.ch/user/p/prsnko/Calib/CalibParams/snapshot.root", "path to Calibration snapshot"}; + Configurable mBadMapPath{"badmapPath", "PHS/Calib/BadMap", "path to BadMap snapshot"}; + Configurable mCalibPath{"calibPath", "PHS/Calib/CalibParams", "path to Calibration snapshot"}; + Configurable mL1PhasePath{"L1phasePath", "PHS/Calib/L1phase", "path to L1phase snapshot"}; Service ccdb; @@ -90,10 +91,6 @@ struct phosCalibration { std::vector event; int mL1 = 0; - // calibration will be set on first processing - std::unique_ptr badMap; // = ccdb->get("PHS/Calib/BadMap"); - std::unique_ptr calibParams; // = ccdb->get("PHS/Calib/CalibParams"); - /// \brief Create output histograms void init(o2::framework::InitContext const&) { @@ -151,7 +148,10 @@ struct phosCalibration { // clusterize // Fill clusters histograms - if (bcs.begin() == bcs.end()) { + int64_t timestamp = 0; + if (bcs.begin() != bcs.end()) { + timestamp = bcs.begin().timestamp(); // timestamp for CCDB object retrieval + } else { return; } @@ -160,30 +160,22 @@ struct phosCalibration { clusterizer->initialize(); } - if (!badMap) { - LOG(info) << "Reading BadMap from: " << mBadMapPath.value; - TFile* fBadMap = TFile::Open(mBadMapPath.value.data()); - if (fBadMap == nullptr) { // probably, TGrid not connected yet? - TGrid::Connect("alien"); - fBadMap = TFile::Open(mBadMapPath.value.data()); - } - o2::phos::BadChannelsMap* bm1 = (o2::phos::BadChannelsMap*)fBadMap->Get("ccdb_object"); - badMap.reset(bm1); - fBadMap->Close(); - clusterizer->setBadMap(badMap.get()); - LOG(info) << "Read bad map"; + const o2::phos::BadChannelsMap* badMap = ccdb->getForTimeStamp(mBadMapPath, timestamp); + const o2::phos::CalibParams* calibParams = ccdb->getForTimeStamp(mCalibPath, timestamp); + + if (badMap) { + clusterizer->setBadMap(badMap); + } else { + LOG(fatal) << "Can not get PHOS Bad Map"; } - if (!calibParams) { - LOG(info) << "Reading Calibration from: " << mCalibPath.value; - TFile* fCalib = TFile::Open(mCalibPath.value.data()); - o2::phos::CalibParams* calib1 = (o2::phos::CalibParams*)fCalib->Get("ccdb_object"); - calibParams.reset(calib1); - fCalib->Close(); - clusterizer->setCalibration(calibParams.get()); - LOG(info) << "Read calibration"; + if (calibParams) { + clusterizer->setCalibration(calibParams); + } else { + LOG(fatal) << "Can not get PHOS calibration"; } + if (!mSkipL1phase && mL1 == 0) { // should be read, but not read yet - const std::vector* vec = ccdb->getForTimeStamp>("PHS/Calib/L1phase", bcs.begin().timestamp()); + const std::vector* vec = ccdb->getForTimeStamp>(mL1PhasePath, timestamp); if (vec) { clusterizer->setL1phase((*vec)[0]); mL1 = (*vec)[0]; diff --git a/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx b/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx index 43d8a30fbd9..cbb70ce60c8 100644 --- a/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx @@ -44,7 +44,6 @@ DECLARE_SOA_COLUMN(ImpactParameterNormalised1, impactParameterNormalised1, float DECLARE_SOA_COLUMN(PtProng2, ptProng2, float); DECLARE_SOA_COLUMN(PProng2, pProng2, float); DECLARE_SOA_COLUMN(ImpactParameterNormalised2, impactParameterNormalised2, float); -DECLARE_SOA_COLUMN(CandidateSelFlag, candidateSelFlag, int8_t); DECLARE_SOA_COLUMN(M, m, float); DECLARE_SOA_COLUMN(Pt, pt, float); DECLARE_SOA_COLUMN(P, p, float); @@ -80,7 +79,6 @@ DECLARE_SOA_COLUMN(Ct, ct, float); DECLARE_SOA_COLUMN(FlagMc, flagMc, int8_t); DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); -DECLARE_SOA_COLUMN(IsCandidateSwapped, isCandidateSwapped, int8_t); DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfCand3Prong, "_0"); // Events DECLARE_SOA_COLUMN(IsEventReject, isEventReject, int); @@ -117,7 +115,8 @@ DECLARE_SOA_TABLE(HfCandXicLites, "AOD", "HFCANDXICLITE", full::NSigTofPi2, full::NSigTofKa2, full::NSigTofPr2, - full::CandidateSelFlag, + hf_sel_candidate_xic::IsSelXicToPKPi, + hf_sel_candidate_xic::IsSelXicToPiKP, full::M, full::Pt, full::Cpa, @@ -125,8 +124,7 @@ DECLARE_SOA_TABLE(HfCandXicLites, "AOD", "HFCANDXICLITE", full::Eta, full::Phi, full::FlagMc, - full::OriginMcRec, - full::IsCandidateSwapped) + full::OriginMcRec) DECLARE_SOA_TABLE(HfCandXicFulls, "AOD", "HFCANDXICFULL", full::CollisionId, @@ -186,7 +184,8 @@ DECLARE_SOA_TABLE(HfCandXicFulls, "AOD", "HFCANDXICFULL", full::NSigTofPi2, full::NSigTofKa2, full::NSigTofPr2, - full::CandidateSelFlag, + hf_sel_candidate_xic::IsSelXicToPKPi, + hf_sel_candidate_xic::IsSelXicToPiKP, full::M, full::Pt, full::P, @@ -199,7 +198,6 @@ DECLARE_SOA_TABLE(HfCandXicFulls, "AOD", "HFCANDXICFULL", full::E, full::FlagMc, full::OriginMcRec, - full::IsCandidateSwapped, full::CandidateId); DECLARE_SOA_TABLE(HfCandXicFullEvs, "AOD", "HFCANDXICFULLEV", @@ -340,6 +338,7 @@ struct HfTreeCreatorXicToPKPi { candidate.phi(), flagMc, originMc); + } else { rowCandidateFull( candidate.collisionId(), diff --git a/PWGJE/Tasks/emcalPi0EnergyScaleCalib.cxx b/PWGJE/Tasks/emcalPi0EnergyScaleCalib.cxx index ea86ab32674..9cbbe5a8dba 100644 --- a/PWGJE/Tasks/emcalPi0EnergyScaleCalib.cxx +++ b/PWGJE/Tasks/emcalPi0EnergyScaleCalib.cxx @@ -83,11 +83,27 @@ bool IsAtBorder(int row, bool smallmodule) return (row == 0 || (smallmodule && row == 7) || (!smallmodule && row == 23)); } -int GetAcceptanceCategory(int cellid) +// Return one of nine acceptance categories and set the second and third parameter to the global row and column +int GetAcceptanceCategory(int cellid, int& globalrow, int& globalcol) { auto [supermodule, module, phiInModule, etaInModule] = gEMCalGeometry->GetCellIndex(cellid); auto [row, col] = gEMCalGeometry->GetCellPhiEtaIndexInSModule(supermodule, module, phiInModule, etaInModule); + // Calculate offset of global rows and columns + int xoffset = supermodule % 2 * 48; + int yoffset = supermodule / 2 * 24; + + if (supermodule > 11 && supermodule < 18) { + xoffset = supermodule % 2 * 64; + } + if (supermodule > 11) { + yoffset = (supermodule - 12) / 2 * 24 + (5 * 24 + 8); + } + + // Add the offset to the local column and row + globalcol = col + xoffset; + globalrow = row + yoffset; + // Add 48 columns for all odd supermodules and 16 for uneven DCal supermodules if (supermodule % 2) { col += 48; @@ -117,7 +133,7 @@ int GetAcceptanceCategory(int cellid) } else if (supermodule == 10 || supermodule == 11 || supermodule == 18 || supermodule == 19) { if (IsBehindTRD(col)) { return kOneThirdbehindTRD; - } else if (IsAtBorder(row, false)) { + } else if (IsAtBorder(row, true)) { return kOneThirdBorder; } else { return kOneThirdInside; @@ -129,11 +145,10 @@ int GetAcceptanceCategory(int cellid) } struct Photon { - Photon(float eta_tmp, float phi_tmp, float energy_tmp, int clusteridin = 0, int acceptance_categoryin = 0) + Photon(float eta_tmp, float phi_tmp, float energy_tmp, int clusteridin = 0, int cellidin = 0) { eta = eta_tmp; phi = phi_tmp; - onDCal = (phi < 6 && phi > 4); energy = energy_tmp; theta = 2 * std::atan2(std::exp(-eta), 1); px = energy * std::sin(theta) * std::cos(phi); @@ -142,8 +157,9 @@ struct Photon { pt = std::sqrt(px * px + py * py); photon.SetPxPyPzE(px, py, pz, energy); clusterid = clusteridin; + cellid = cellidin; - acceptance_category = acceptance_categoryin; + acceptance_category = GetAcceptanceCategory(cellid, row, col); } TLorentzVector photon; @@ -153,10 +169,12 @@ struct Photon { float pz; float eta; float phi; - bool onDCal; // Checks whether photon is in phi region of the DCal, otherwise: EMCal float energy; float theta; - int acceptance_category; + int row; // Global row + int col; // Global column + int acceptance_category; // One of the nine acceptance categories (EMCal, DCal or one third and behindTRD, border and inside) + int cellid; int clusterid; }; @@ -217,6 +235,8 @@ struct Pi0EnergyScaleCalibTask { // create common axes const o2Axis bcAxis{3501, -0.5, 3500.5}; const o2Axis AccCategoryAxis{10, -0.5, 9.5}; + const o2Axis RowAxis{208, -0.5, 207.5}; + const o2Axis ColAxis{96, -0.5, 95.5}; mHistManager.add("events", "events;;#it{count}", o2HistType::kTH1F, {{4, 0.5, 4.5}}); auto heventType = mHistManager.get(HIST("events")); @@ -235,6 +255,8 @@ struct Pi0EnergyScaleCalibTask { mHistManager.add(Form("%s/clusterE", ClusterDirectory), "Energy of cluster", o2HistType::kTH1F, {{400, 0, 100, "#it{E} (GeV)"}}); mHistManager.add(Form("%s/clusterTime", ClusterDirectory), "Time of cluster", o2HistType::kTH1F, {{500, -250, 250, "#it{t}_{cls} (ns)"}}); mHistManager.add(Form("%s/clusterEtaPhi", ClusterDirectory), "Eta and phi of cluster", o2HistType::kTH3F, {{200, -1, 1, "#eta"}, {200, 0, 2 * TMath::Pi(), "#phi"}, AccCategoryAxis}); + mHistManager.add(Form("%s/clusterEtaPhiVsRow", ClusterDirectory), "Eta and phi of cluster", o2HistType::kTH3F, {{200, -1, 1, "#eta"}, {200, 0, 2 * TMath::Pi(), "#phi"}, RowAxis}); + mHistManager.add(Form("%s/clusterEtaPhiVsCol", ClusterDirectory), "Eta and phi of cluster", o2HistType::kTH3F, {{200, -1, 1, "#eta"}, {200, 0, 2 * TMath::Pi(), "#phi"}, ColAxis}); mHistManager.add(Form("%s/clusterM02", ClusterDirectory), "M02 of cluster", o2HistType::kTH1F, {{400, 0, 5, "#it{M}_{02}"}}); mHistManager.add(Form("%s/clusterM20", ClusterDirectory), "M20 of cluster", o2HistType::kTH1F, {{400, 0, 2.5, "#it{M}_{20}"}}); mHistManager.add(Form("%s/clusterNLM", ClusterDirectory), "Number of local maxima of cluster", o2HistType::kTH1I, {{10, 0, 10, "#it{N}_{local maxima}"}}); @@ -244,6 +266,10 @@ struct Pi0EnergyScaleCalibTask { mHistManager.add("invMassVsPtVsAcc", "invariant mass and pT of meson candidates", o2HistType::kTH3F, {invmassBinning, pTBinning, AccCategoryAxis}); mHistManager.add("invMassVsPtVsAccBackground", "invariant mass and pT of background meson candidates", o2HistType::kTH3F, {invmassBinning, pTBinning, AccCategoryAxis}); + mHistManager.add("invMassVsPtVsRow", "invariant mass and pT of meson candidates", o2HistType::kTH3F, {invmassBinning, pTBinning, RowAxis}); + mHistManager.add("invMassVsPtVsRowBackground", "invariant mass and pT of background meson candidates", o2HistType::kTH3F, {invmassBinning, pTBinning, RowAxis}); + mHistManager.add("invMassVsPtVsCol", "invariant mass and pT of background meson candidates", o2HistType::kTH3F, {invmassBinning, pTBinning, ColAxis}); + mHistManager.add("invMassVsPtVsColBackground", "invariant mass and pT of background meson candidates", o2HistType::kTH3F, {invmassBinning, pTBinning, ColAxis}); initCategoryAxis(mHistManager.get(HIST("invMassVsPtVsAcc")).get()); initCategoryAxis(mHistManager.get(HIST("invMassVsPtVsAccBackground")).get()); initCategoryAxis(mHistManager.get(HIST("ClustersBeforeCuts/clusterEtaPhi")).get()); @@ -322,7 +348,7 @@ struct Pi0EnergyScaleCalibTask { FillClusterQAHistos(cluster, cellid); // put clusters in photon vector - mPhotons.push_back(Photon(cluster.eta(), cluster.phi(), cluster.energy(), cluster.id(), GetAcceptanceCategory(cellid))); + mPhotons.push_back(Photon(cluster.eta(), cluster.phi(), cluster.energy(), cluster.id(), cellid)); } } @@ -335,6 +361,8 @@ struct Pi0EnergyScaleCalibTask { static constexpr std::string_view clusterQAHistEnergy[2] = {"ClustersBeforeCuts/clusterE", "ClustersAfterCuts/clusterE"}; static constexpr std::string_view clusterQAHistTime[2] = {"ClustersBeforeCuts/clusterTime", "ClustersAfterCuts/clusterTime"}; static constexpr std::string_view clusterQAHistEtaPhi[2] = {"ClustersBeforeCuts/clusterEtaPhi", "ClustersAfterCuts/clusterEtaPhi"}; + static constexpr std::string_view clusterQAHistEtaPhiRow[2] = {"ClustersBeforeCuts/clusterEtaPhiVsRow", "ClustersAfterCuts/clusterEtaPhiVsRow"}; + static constexpr std::string_view clusterQAHistEtaPhiCol[2] = {"ClustersBeforeCuts/clusterEtaPhiVsCol", "ClustersAfterCuts/clusterEtaPhiVsCol"}; static constexpr std::string_view clusterQAHistM02[2] = {"ClustersBeforeCuts/clusterM02", "ClustersAfterCuts/clusterM02"}; static constexpr std::string_view clusterQAHistM20[2] = {"ClustersBeforeCuts/clusterM20", "ClustersAfterCuts/clusterM20"}; static constexpr std::string_view clusterQAHistNLM[2] = {"ClustersBeforeCuts/clusterNLM", "ClustersAfterCuts/clusterNLM"}; @@ -343,7 +371,10 @@ struct Pi0EnergyScaleCalibTask { mHistManager.fill(HIST(clusterQAHistEnergy[BeforeCuts]), cluster.energy()); mHistManager.fill(HIST(clusterQAHistTime[BeforeCuts]), cluster.time()); mHistManager.fill(HIST(clusterQAHistEtaPhi[BeforeCuts]), cluster.eta(), cluster.phi(), 0); - mHistManager.fill(HIST(clusterQAHistEtaPhi[BeforeCuts]), cluster.eta(), cluster.phi(), GetAcceptanceCategory(cellid)); + int row, col = 0; // Initialize row and column, which are set in GetAcceptanceCategory and then used to fill the eta phi map + mHistManager.fill(HIST(clusterQAHistEtaPhi[BeforeCuts]), cluster.eta(), cluster.phi(), GetAcceptanceCategory(cellid, row, col)); + mHistManager.fill(HIST(clusterQAHistEtaPhiRow[BeforeCuts]), cluster.eta(), cluster.phi(), row); + mHistManager.fill(HIST(clusterQAHistEtaPhiCol[BeforeCuts]), cluster.eta(), cluster.phi(), col); mHistManager.fill(HIST(clusterQAHistM02[BeforeCuts]), cluster.m02()); mHistManager.fill(HIST(clusterQAHistM20[BeforeCuts]), cluster.m20()); mHistManager.fill(HIST(clusterQAHistNLM[BeforeCuts]), cluster.nlm()); @@ -391,6 +422,10 @@ struct Pi0EnergyScaleCalibTask { Meson meson(mPhotons[ig1], mPhotons[ig2]); // build meson from photons if (meson.getOpeningAngle() > mMinOpenAngleCut) { mHistManager.fill(HIST("invMassVsPtVsAcc"), meson.getMass(), meson.getPt(), 0); + mHistManager.fill(HIST("invMassVsPtVsRow"), meson.getMass(), meson.getPt(), mPhotons[ig1].row); + mHistManager.fill(HIST("invMassVsPtVsRow"), meson.getMass(), meson.getPt(), mPhotons[ig2].row); + mHistManager.fill(HIST("invMassVsPtVsCol"), meson.getMass(), meson.getPt(), mPhotons[ig1].col); + mHistManager.fill(HIST("invMassVsPtVsCol"), meson.getMass(), meson.getPt(), mPhotons[ig2].col); for (int iAcceptanceCategory = 1; iAcceptanceCategory < NAcceptanceCategories; iAcceptanceCategory++) { if ((!mRequireBothPhotonsFromAcceptance && (mPhotons[ig1].acceptance_category == iAcceptanceCategory || mPhotons[ig2].acceptance_category == iAcceptanceCategory)) || (mPhotons[ig1].acceptance_category == iAcceptanceCategory && mPhotons[ig2].acceptance_category == iAcceptanceCategory)) { @@ -432,8 +467,8 @@ struct Pi0EnergyScaleCalibTask { lvRotationPhoton2.Rotate(rotationAngle, lvRotationPion); // initialize Photon objects for rotated photons - Photon rotPhoton1(lvRotationPhoton1.Eta(), lvRotationPhoton1.Phi(), lvRotationPhoton1.E(), mPhotons[ig1].clusterid, mPhotons[ig1].acceptance_category); - Photon rotPhoton2(lvRotationPhoton2.Eta(), lvRotationPhoton2.Phi(), lvRotationPhoton2.E(), mPhotons[ig2].clusterid, mPhotons[ig2].acceptance_category); + Photon rotPhoton1(lvRotationPhoton1.Eta(), lvRotationPhoton1.Phi(), lvRotationPhoton1.E(), mPhotons[ig1].clusterid, mPhotons[ig1].cellid); + Photon rotPhoton2(lvRotationPhoton2.Eta(), lvRotationPhoton2.Phi(), lvRotationPhoton2.E(), mPhotons[ig2].clusterid, mPhotons[ig2].cellid); // build meson from rotated photons Meson mesonRotated1(rotPhoton1, mPhotons[ig3]); @@ -442,6 +477,10 @@ struct Pi0EnergyScaleCalibTask { // Fill histograms if (mesonRotated1.getOpeningAngle() > mMinOpenAngleCut) { mHistManager.fill(HIST("invMassVsPtVsAccBackground"), mesonRotated1.getMass(), mesonRotated1.getPt(), 0); + mHistManager.fill(HIST("invMassVsPtVsRowBackground"), mesonRotated1.getMass(), mesonRotated1.getPt(), mPhotons[ig3].row); + mHistManager.fill(HIST("invMassVsPtVsRowBackground"), mesonRotated1.getMass(), mesonRotated1.getPt(), rotPhoton1.row); + mHistManager.fill(HIST("invMassVsPtVsColBackground"), mesonRotated1.getMass(), mesonRotated1.getPt(), mPhotons[ig3].col); + mHistManager.fill(HIST("invMassVsPtVsColBackground"), mesonRotated1.getMass(), mesonRotated1.getPt(), rotPhoton1.col); for (int iAcceptanceCategory = 1; iAcceptanceCategory < NAcceptanceCategories; iAcceptanceCategory++) { if ((!mRequireBothPhotonsFromAcceptance && (rotPhoton1.acceptance_category == iAcceptanceCategory || mPhotons[ig3].acceptance_category == iAcceptanceCategory)) || (rotPhoton1.acceptance_category == iAcceptanceCategory && mPhotons[ig3].acceptance_category == iAcceptanceCategory)) { @@ -450,11 +489,15 @@ struct Pi0EnergyScaleCalibTask { } } if (mesonRotated2.getOpeningAngle() > mMinOpenAngleCut) { - mHistManager.fill(HIST("invMassVsPtVsAccBackground"), mesonRotated1.getMass(), mesonRotated1.getPt(), 0); + mHistManager.fill(HIST("invMassVsPtVsAccBackground"), mesonRotated2.getMass(), mesonRotated2.getPt(), 0); + mHistManager.fill(HIST("invMassVsPtVsRowBackground"), mesonRotated2.getMass(), mesonRotated2.getPt(), mPhotons[ig3].row); + mHistManager.fill(HIST("invMassVsPtVsRowBackground"), mesonRotated2.getMass(), mesonRotated2.getPt(), rotPhoton2.row); + mHistManager.fill(HIST("invMassVsPtVsColBackground"), mesonRotated2.getMass(), mesonRotated2.getPt(), mPhotons[ig3].col); + mHistManager.fill(HIST("invMassVsPtVsColBackground"), mesonRotated2.getMass(), mesonRotated2.getPt(), rotPhoton2.col); for (int iAcceptanceCategory = 1; iAcceptanceCategory < NAcceptanceCategories; iAcceptanceCategory++) { if ((!mRequireBothPhotonsFromAcceptance && (rotPhoton2.acceptance_category == iAcceptanceCategory || mPhotons[ig3].acceptance_category == iAcceptanceCategory)) || (rotPhoton2.acceptance_category == iAcceptanceCategory && mPhotons[ig3].acceptance_category == iAcceptanceCategory)) { - mHistManager.fill(HIST("invMassVsPtVsAccBackground"), mesonRotated1.getMass(), mesonRotated1.getPt(), iAcceptanceCategory); + mHistManager.fill(HIST("invMassVsPtVsAccBackground"), mesonRotated2.getMass(), mesonRotated2.getPt(), iAcceptanceCategory); } } } diff --git a/PWGLF/DataModel/LFHypernucleiTables.h b/PWGLF/DataModel/LFHypernucleiTables.h index 695f913f9c1..049b93ebb79 100644 --- a/PWGLF/DataModel/LFHypernucleiTables.h +++ b/PWGLF/DataModel/LFHypernucleiTables.h @@ -40,7 +40,6 @@ DECLARE_SOA_COLUMN(QVecXFV0A, qVecXFV0A, float); // Q vector x compone DECLARE_SOA_COLUMN(QVecYFV0A, qVecYFV0A, float); // Q vector y component with FV0A estimator DECLARE_SOA_COLUMN(QVecAmpFV0A, qVecAmpFV0A, float); // Q vector amplitude with FV0A estimator - DECLARE_SOA_COLUMN(IsMatter, isMatter, bool); // bool: true for matter DECLARE_SOA_COLUMN(PtHe3, ptHe3, float); // Pt of the He daughter DECLARE_SOA_COLUMN(PhiHe3, phiHe3, float); // Phi of the He daughter diff --git a/PWGLF/DataModel/LFSlimNucleiTables.h b/PWGLF/DataModel/LFSlimNucleiTables.h index 02e8b90d303..86bdec9b4fc 100644 --- a/PWGLF/DataModel/LFSlimNucleiTables.h +++ b/PWGLF/DataModel/LFSlimNucleiTables.h @@ -16,6 +16,7 @@ #include "Framework/AnalysisDataModel.h" #include "Framework/ASoAHelpers.h" +#include "Common/DataModel/Centrality.h" #ifndef PWGLF_DATAMODEL_LFSLIMNUCLEITABLES_H_ #define PWGLF_DATAMODEL_LFSLIMNUCLEITABLES_H_ @@ -46,6 +47,64 @@ DECLARE_SOA_COLUMN(gPhi, genPhi, float); DECLARE_SOA_COLUMN(PDGcode, pdgCode, int); } // namespace NucleiTableNS +namespace NucleiFlowTableNS +{ +DECLARE_SOA_COLUMN(CentFV0A, centFV0A, float); +DECLARE_SOA_COLUMN(CentFT0M, centFT0M, float); +DECLARE_SOA_COLUMN(CentFT0A, centFT0A, float); +DECLARE_SOA_COLUMN(CentFT0C, centFT0C, float); +DECLARE_SOA_COLUMN(XQvecFV0A, xQvecFV0A, float); +DECLARE_SOA_COLUMN(YQvecFV0A, yQvecFV0A, float); +DECLARE_SOA_COLUMN(AmplQvecFV0A, amplQvecFV0A, float); +DECLARE_SOA_COLUMN(XQvecFT0M, xQvecFT0M, float); +DECLARE_SOA_COLUMN(YQvecFT0M, yQvecFT0M, float); +DECLARE_SOA_COLUMN(AmplQvecFT0M, amplQvecFT0M, float); +DECLARE_SOA_COLUMN(XQvecFT0A, xQvecFT0A, float); +DECLARE_SOA_COLUMN(YQvecFT0A, yQvecFT0A, float); +DECLARE_SOA_COLUMN(AmplQvecFT0A, amplQvecFT0A, float); +DECLARE_SOA_COLUMN(XQvecFT0C, xQvecFT0C, float); +DECLARE_SOA_COLUMN(YQvecFT0C, yQvecFT0C, float); +DECLARE_SOA_COLUMN(AmplQvecFT0C, amplQvecFT0C, float); +DECLARE_SOA_COLUMN(XQvecTPCpos, xQvecTPCpos, float); +DECLARE_SOA_COLUMN(YQvecTPCpos, yQvecTPCpos, float); +DECLARE_SOA_COLUMN(AmplQvecTPCpos, amplQvecTPCpos, float); +DECLARE_SOA_COLUMN(XQvecTPCneg, xQvecTPCneg, float); +DECLARE_SOA_COLUMN(YQvecTPCneg, yQvecTPCneg, float); +DECLARE_SOA_COLUMN(AmplQvecTPCneg, amplQvecTPCneg, float); +} // namespace NucleiFlowTableNS + +DECLARE_SOA_TABLE(NucleiFlowColls, "AOD", "NUCLEIFLOWCOLLS", + o2::soa::Index<>, + NucleiFlowTableNS::CentFV0A, + NucleiFlowTableNS::CentFT0M, + NucleiFlowTableNS::CentFT0A, + NucleiFlowTableNS::CentFT0C, + NucleiFlowTableNS::XQvecFV0A, + NucleiFlowTableNS::YQvecFV0A, + NucleiFlowTableNS::AmplQvecFV0A, + NucleiFlowTableNS::XQvecFT0M, + NucleiFlowTableNS::YQvecFT0M, + NucleiFlowTableNS::AmplQvecFT0M, + NucleiFlowTableNS::XQvecFT0A, + NucleiFlowTableNS::YQvecFT0A, + NucleiFlowTableNS::AmplQvecFT0A, + NucleiFlowTableNS::XQvecFT0C, + NucleiFlowTableNS::YQvecFT0C, + NucleiFlowTableNS::AmplQvecFT0C, + NucleiFlowTableNS::XQvecTPCpos, + NucleiFlowTableNS::YQvecTPCpos, + NucleiFlowTableNS::AmplQvecTPCpos, + NucleiFlowTableNS::XQvecTPCneg, + NucleiFlowTableNS::YQvecTPCneg, + NucleiFlowTableNS::AmplQvecTPCneg) + +using NucleiFlowColl = NucleiFlowColls::iterator; + +namespace NucleiTableNS +{ +DECLARE_SOA_INDEX_COLUMN(NucleiFlowColl, nucleiFlowColl); +} + DECLARE_SOA_TABLE(NucleiTable, "AOD", "NUCLEITABLE", NucleiTableNS::Pt, NucleiTableNS::Eta, @@ -62,7 +121,8 @@ DECLARE_SOA_TABLE(NucleiTable, "AOD", "NUCLEITABLE", NucleiTableNS::TPCfindableCls, NucleiTableNS::TPCcrossedRows, NucleiTableNS::ITSclsMap, - NucleiTableNS::TPCnCls) + NucleiTableNS::TPCnCls, + NucleiTableNS::NucleiFlowCollId) DECLARE_SOA_TABLE(NucleiTableMC, "AOD", "NUCLEITABLEMC", NucleiTableNS::Pt, diff --git a/PWGLF/TableProducer/hyperRecoTask.cxx b/PWGLF/TableProducer/hyperRecoTask.cxx index 5ffa176a0fb..e11355ca09f 100644 --- a/PWGLF/TableProducer/hyperRecoTask.cxx +++ b/PWGLF/TableProducer/hyperRecoTask.cxx @@ -563,19 +563,19 @@ struct hyperRecoTask { for (auto& hypCand : hyperCandidates) { outputDataTableWithFlow(collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), - collision.qvecFT0ARe(), collision.qvecFT0AIm(), collision.sumAmplFT0A(), - collision.qvecFT0CRe(), collision.qvecFT0CIm(), collision.sumAmplFT0C(), - collision.qvecFT0MRe(), collision.qvecFT0MIm(), collision.sumAmplFT0M(), - collision.qvecFV0ARe(), collision.qvecFV0AIm(), collision.sumAmplFV0A(), - collision.posX(), collision.posY(), collision.posZ(), - hypCand.isMatter, - hypCand.recoPtHe3(), hypCand.recoPhiHe3(), hypCand.recoEtaHe3(), - hypCand.recoPtPi(), hypCand.recoPhiPi(), hypCand.recoEtaPi(), - hypCand.decVtx[0], hypCand.decVtx[1], hypCand.decVtx[2], - hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, - hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, - hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, - hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags); + collision.qvecFT0ARe(), collision.qvecFT0AIm(), collision.sumAmplFT0A(), + collision.qvecFT0CRe(), collision.qvecFT0CIm(), collision.sumAmplFT0C(), + collision.qvecFT0MRe(), collision.qvecFT0MIm(), collision.sumAmplFT0M(), + collision.qvecFV0ARe(), collision.qvecFV0AIm(), collision.sumAmplFV0A(), + collision.posX(), collision.posY(), collision.posZ(), + hypCand.isMatter, + hypCand.recoPtHe3(), hypCand.recoPhiHe3(), hypCand.recoEtaHe3(), + hypCand.recoPtPi(), hypCand.recoPhiPi(), hypCand.recoEtaPi(), + hypCand.decVtx[0], hypCand.decVtx[1], hypCand.decVtx[2], + hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, + hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, + hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, + hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags); } } } diff --git a/PWGLF/TableProducer/lambdakzerobuilder.cxx b/PWGLF/TableProducer/lambdakzerobuilder.cxx index 0cee635b5bd..c7f79ef232e 100644 --- a/PWGLF/TableProducer/lambdakzerobuilder.cxx +++ b/PWGLF/TableProducer/lambdakzerobuilder.cxx @@ -957,6 +957,9 @@ struct lambdakzeroPreselector { // context-aware selections Configurable dPreselectOnlyBaryons{"dPreselectOnlyBaryons", false, "apply TPC dE/dx and quality only to baryon daughters"}; + // for debugging and further tests + Configurable forceITSOnlyMesons{"forceITSOnlyMesons", false, "force meson-like daughters to be ITS-only to pass Lambda/AntiLambda selections (yes/no)"}; + // for bit-packed maps std::vector selectionMask; enum v0bit { bitInteresting = 0, @@ -995,17 +998,33 @@ struct lambdakzeroPreselector { auto lNegTrack = lV0Candidate.template negTrack_as(); auto lPosTrack = lV0Candidate.template posTrack_as(); + // crossed rows conditionals + bool posRowsOK = lPosTrack.tpcNClsCrossedRows() >= dTPCNCrossedRows; + bool negRowsOK = lNegTrack.tpcNClsCrossedRows() >= dTPCNCrossedRows; + + // check track explicitly for absence of TPC + bool posITSonly = !lPosTrack.hasTPC(); + bool negITSonly = !lNegTrack.hasTPC(); + // No baryons in decay - if (((bitcheck(maskElement, bitdEdxGamma) || bitcheck(maskElement, bitdEdxK0Short)) || passdEdx) && (lPosTrack.tpcNClsCrossedRows() >= dTPCNCrossedRows && lNegTrack.tpcNClsCrossedRows() >= dTPCNCrossedRows)) + if (((bitcheck(maskElement, bitdEdxGamma) || bitcheck(maskElement, bitdEdxK0Short)) || passdEdx) && (posRowsOK && negRowsOK) && (!forceITSOnlyMesons || (posITSonly && negITSonly))) bitset(maskElement, bitTrackQuality); // With baryons in decay - if ((bitcheck(maskElement, bitdEdxLambda) || passdEdx) && (lPosTrack.tpcNClsCrossedRows() >= dTPCNCrossedRows && (lNegTrack.tpcNClsCrossedRows() >= dTPCNCrossedRows || dPreselectOnlyBaryons))) + if ((bitcheck(maskElement, bitdEdxLambda) || passdEdx) && + (posRowsOK && (negRowsOK || dPreselectOnlyBaryons)) && + (!forceITSOnlyMesons || negITSonly)) bitset(maskElement, bitTrackQuality); - if ((bitcheck(maskElement, bitdEdxAntiLambda) || passdEdx) && (lNegTrack.tpcNClsCrossedRows() >= dTPCNCrossedRows && (lPosTrack.tpcNClsCrossedRows() >= dTPCNCrossedRows || dPreselectOnlyBaryons))) + if ((bitcheck(maskElement, bitdEdxAntiLambda) || passdEdx) && + (negRowsOK && (posRowsOK || dPreselectOnlyBaryons)) && + (!forceITSOnlyMesons || posITSonly)) bitset(maskElement, bitTrackQuality); - if ((bitcheck(maskElement, bitdEdxHypertriton) || passdEdx) && (lPosTrack.tpcNClsCrossedRows() >= dTPCNCrossedRows && (lNegTrack.tpcNClsCrossedRows() >= dTPCNCrossedRows || dPreselectOnlyBaryons))) + if ((bitcheck(maskElement, bitdEdxHypertriton) || passdEdx) && + (posRowsOK && (negRowsOK || dPreselectOnlyBaryons)) && + (!forceITSOnlyMesons || negITSonly)) bitset(maskElement, bitTrackQuality); - if ((bitcheck(maskElement, bitdEdxAntiHypertriton) || passdEdx) && (lNegTrack.tpcNClsCrossedRows() >= dTPCNCrossedRows && (lPosTrack.tpcNClsCrossedRows() >= dTPCNCrossedRows || dPreselectOnlyBaryons))) + if ((bitcheck(maskElement, bitdEdxAntiHypertriton) || passdEdx) && + (negRowsOK && (posRowsOK || dPreselectOnlyBaryons)) && + (!forceITSOnlyMesons || posITSonly)) bitset(maskElement, bitTrackQuality); } //*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* diff --git a/PWGLF/TableProducer/nucleiSpectra.cxx b/PWGLF/TableProducer/nucleiSpectra.cxx index 99c8fc11a4d..13418d09879 100644 --- a/PWGLF/TableProducer/nucleiSpectra.cxx +++ b/PWGLF/TableProducer/nucleiSpectra.cxx @@ -17,6 +17,7 @@ // Data (run3): // o2-analysis-lf-nuclei-spectra, o2-analysis-timestamp // o2-analysis-pid-tof-base, o2-analysis-multiplicity-table, o2-analysis-event-selection +// (to add flow: o2-analysis-qvector-table, o2-analysis-centrality-table) #include @@ -32,6 +33,8 @@ #include "Common/DataModel/TrackSelectionTables.h" #include "Common/Core/PID/PIDTOF.h" #include "Common/TableProducer/PID/pidTOFBase.h" +#include "Common/Core/EventPlaneHelper.h" +#include "Common/DataModel/Qvectors.h" #include "DataFormatsParameters/GRPMagField.h" #include "DataFormatsParameters/GRPObject.h" @@ -72,6 +75,7 @@ struct NucleusCandidate { uint8_t TPCcrossedRows; uint8_t ITSclsMap; uint8_t TPCnCls; + int selCollIndex; }; namespace nuclei @@ -161,6 +165,7 @@ struct nucleiSpectra { Produces nucleiTable; Produces nucleiTableMC; + Produces nucleiFlowTable; Service ccdb; Configurable cfgCentralityEstimator{"cfgCentralityEstimator", "V0A", "Centrality estimator name"}; @@ -214,6 +219,9 @@ struct nucleiSpectra { using TrackCandidates = soa::Filtered>; + // Flow analysis + using CollWithQvec = soa::Filtered>::iterator; + HistogramRegistry spectra{"spectra", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; o2::pid::tof::Beta responseBeta; @@ -308,10 +316,10 @@ struct nucleiSpectra { o2::base::Propagator::Instance(true)->setMatLUT(nuclei::lut); } - template - void fillDataInfo(soa::Filtered>::iterator const& collision, TC const& tracks) + template + void fillDataInfo(Tcoll const& collision, Ttrks const& tracks) { - auto bc = collision.bc_as(); + auto bc = collision.template bc_as(); initCCDB(bc); // collision process loop @@ -422,8 +430,34 @@ struct nucleiSpectra { } } if (flag & (kProton | kDeuteron | kTriton | kHe3 | kHe4)) { + if constexpr (std::is_same::value) { + if (nuclei::candidates.empty()) { + nucleiFlowTable(collision.centFV0A(), + collision.centFT0M(), + collision.centFT0A(), + collision.centFT0C(), + collision.qvecFV0ARe(), + collision.qvecFV0AIm(), + collision.sumAmplFV0A(), + collision.qvecFT0MRe(), + collision.qvecFT0MIm(), + collision.sumAmplFT0M(), + collision.qvecFT0ARe(), + collision.qvecFT0AIm(), + collision.sumAmplFT0A(), + collision.qvecFT0CRe(), + collision.qvecFT0CIm(), + collision.sumAmplFT0C(), + collision.qvecBPosRe(), + collision.qvecBPosIm(), + collision.nTrkBPos(), + collision.qvecBNegRe(), + collision.qvecBNegIm(), + collision.nTrkBNeg()); + } + } nuclei::candidates.emplace_back(NucleusCandidate{static_cast(track.globalIndex()), (1 - 2 * iC) * trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), track.tpcInnerParam(), beta, collision.posZ(), dcaInfo[0], dcaInfo[1], track.tpcSignal(), track.itsChi2NCl(), - track.tpcChi2NCl(), flag, track.tpcNClsFindable(), static_cast(track.tpcNClsCrossedRows()), track.itsClusterMap(), static_cast(track.tpcNClsFound())}); + track.tpcChi2NCl(), flag, track.tpcNClsFindable(), static_cast(track.tpcNClsCrossedRows()), track.itsClusterMap(), static_cast(track.tpcNClsFound()), static_cast(nucleiFlowTable.lastIndex())}); } } // end loop over tracks @@ -436,11 +470,21 @@ struct nucleiSpectra { nuclei::candidates.clear(); fillDataInfo(collision, tracks); for (auto& c : nuclei::candidates) { - nucleiTable(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls); + nucleiTable(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.selCollIndex); } } PROCESS_SWITCH(nucleiSpectra, processData, "Data analysis", true); + void processDataFlow(CollWithQvec const& collision, TrackCandidates const& tracks, aod::BCsWithTimestamps const&) + { + nuclei::candidates.clear(); + fillDataInfo(collision, tracks); + for (auto& c : nuclei::candidates) { + nucleiTable(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.selCollIndex); + } + } + PROCESS_SWITCH(nucleiSpectra, processDataFlow, "Data analysis with flow", false); + Preslice tracksPerCollisions = aod::track::collisionId; void processMC(soa::Filtered> const& collisions, TrackCandidates const& tracks, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC, aod::BCsWithTimestamps const&) { diff --git a/PWGLF/Tasks/CMakeLists.txt b/PWGLF/Tasks/CMakeLists.txt index 74dafa9618b..64b8e637254 100644 --- a/PWGLF/Tasks/CMakeLists.txt +++ b/PWGLF/Tasks/CMakeLists.txt @@ -63,6 +63,11 @@ o2physics_add_dpl_workflow(hyhefour-analysis PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(antid-lambda-ebye + SOURCES antidLambdaEbye.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + # Spectra o2physics_add_dpl_workflow(mc-spectra-efficiency SOURCES mcspectraefficiency.cxx @@ -160,6 +165,11 @@ o2physics_add_dpl_workflow(vzero-cascade-absorption PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(derivedcascadeanalysis + SOURCES derivedcascadeanalysis.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + # Resonance o2physics_add_dpl_workflow(rsnanalysis SOURCES rsnanalysis.cxx diff --git a/PWGLF/Tasks/antidLambdaEbye.cxx b/PWGLF/Tasks/antidLambdaEbye.cxx new file mode 100644 index 00000000000..f5dd1f04b74 --- /dev/null +++ b/PWGLF/Tasks/antidLambdaEbye.cxx @@ -0,0 +1,333 @@ +// 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. + +#include + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" +#include "ReconstructionDataFormats/Track.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/EventSelection.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "DetectorsBase/Propagator.h" +#include "DetectorsBase/GeometryManager.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "CCDB/BasicCCDBManager.h" + +#include "Common/Core/PID/TPCPIDResponse.h" +#include "Common/DataModel/PIDResponse.h" + +#include "TDatabasePDG.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +using TracksFull = soa::Join; + +namespace +{ +const float lambdaMassPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass(); +} + +struct antidLambdaEbye { + Service ccdb; + + Configurable cfgMaterialCorrection{"cfgMaterialCorrection", static_cast(o2::base::Propagator::MatCorrType::USEMatCorrNONE), "Type of material correction"}; + + ConfigurableAxis zVtxAxis{"zVtxBins", {100, -20.f, 20.f}, "Binning for the vertex z in cm"}; + ConfigurableAxis massLambdaAxis{"massLambdaAxis", {400, lambdaMassPDG - 0.03f, lambdaMassPDG + 0.03f}, "binning for the lambda invariant-mass"}; + ConfigurableAxis centAxis{"centAxis", {106, 0, 106}, "binning for the centrality"}; + + ConfigurableAxis cosPaAxis{"cosPaAxis", {1e3, 0.95f, 1.00f}, "binning for the cosPa axis"}; + ConfigurableAxis radiusAxis{"radiusAxis", {1e3, 0.f, 100.f}, "binning for the radius axis"}; + ConfigurableAxis dcaV0daughAxis{"dcaV0daughAxis", {2e2, 0.f, 2.f}, "binning for the dca of V0 daughters"}; + ConfigurableAxis dcaDaughPvAxis{"dcaDaughPvAxis", {1e3, 0.f, 10.f}, "binning for the dca of positive daughter to PV"}; + + ConfigurableAxis tpcNsigmaAxis{"tpcNsigmaAxis", {100, -5.f, 5.f}, "tpc nsigma axis"}; + ConfigurableAxis tofNsigmaAxis{"tofNsigmaAxis", {100, -5.f, 5.f}, "tof nsigma axis"}; + + // CCDB options + Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; + Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + Configurable pidPath{"pidPath", "", "Path to the PID response object"}; + + Configurable zVtxMax{"zVtxMax", 10.0f, "maximum z position of the primary vertex"}; + Configurable etaMax{"etaMax", 0.8f, "maximum eta"}; + + Configurable antidPtMin{"antidPtMin", 0.8f, "minimum antideuteron pT (GeV/c)"}; + Configurable antidPtTof{"antidPtTof", 1.0f, "antideuteron pT to switch to TOF pid (GeV/c) "}; + Configurable antidPtMax{"antidPtMax", 1.8f, "maximum antideuteron pT (GeV/c)"}; + + Configurable lambdaPtMin{"lambdaPtMin", 0.5f, "minimum (anti)lambda pT (GeV/c)"}; + Configurable lambdaPtMax{"lambdaPtMax", 3.0f, "maximum (anti)lambda pT (GeV/c)"}; + + Configurable antidNclusItsCut{"antidNclusITScut", 5, "Minimum number of ITS clusters"}; + Configurable antidNclusTpcCut{"antidNclusTPCcut", 70, "Minimum number of TPC clusters"}; + Configurable antidNsigmaTpcCut{"antidNsigmaTpcCut", 4.f, "TPC PID cut"}; + Configurable antidNsigmaTofCut{"antidNsigmaTofCut", 4.f, "TOF PID cut"}; + Configurable antidDcaCut{"antidDcaCut", 0.1f, "DCA antid to PV"}; + + Configurable v0setting_dcav0dau{"v0setting_dcav0dau", 1, "DCA V0 Daughters"}; + Configurable v0setting_dcapostopv{"v0setting_dcapostopv", 0.1f, "DCA Pos To PV"}; + Configurable v0setting_dcanegtopv{"v0setting_dcanegtopv", 0.1f, "DCA Neg To PV"}; + Configurable v0setting_cospa{"v0setting_cospa", 0.98, "V0 CosPA"}; + Configurable v0setting_radius{"v0setting_radius", 0.5f, "v0radius"}; + Configurable lambdaMassCut{"lambdaMassCut", 0.005f, "maximum deviation from PDG mass"}; + + int mRunNumber; + float d_bz; + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + Filter preFilterV0 = (nabs(aod::v0data::dcapostopv) > v0setting_dcapostopv && + nabs(aod::v0data::dcanegtopv) > v0setting_dcanegtopv && + aod::v0data::dcaV0daughters < v0setting_dcav0dau); + + template + bool selectLambda(RecV0 const& v0) // TODO: apply ML + { + if (std::abs(v0.eta()) > etaMax || + v0.v0cosPA() < v0setting_cospa || + v0.v0radius() < v0setting_radius) { + return false; + } + auto mLambda = v0.alpha() > 0 ? v0.mLambda() : v0.mAntiLambda(); + if (std::abs(mLambda - lambdaMassPDG) > lambdaMassCut) { + return false; + } + return true; + } + + template + bool selectAntid(T const& track) + { + if (std::abs(track.eta()) > etaMax) { + return false; + } + if (track.sign() > 0.) { + return false; + } + if (track.itsNCls() < antidNclusItsCut || + track.tpcNClsFound() < antidNclusTpcCut || + track.tpcNClsCrossedRows() < 70 || + track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable() || + track.tpcChi2NCl() > 4.f || + track.itsChi2NCl() > 36.f || + !(track.trackType() & o2::aod::track::TPCrefit) || + !(track.trackType() & o2::aod::track::ITSrefit)) { + return false; + } + return true; + } + + void init(o2::framework::InitContext&) + { + ccdb->setURL(ccdburl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + + mRunNumber = 0; + d_bz = 0; + + histos.add("zVtx", ";#it{z}_{vtx} (cm);Entries", HistType::kTH1F, {zVtxAxis}); + + histos.add("nEv", ";#it{N}_{ev};Entries", {HistType::kTH1D}, {centAxis}); + + histos.add("q1antid", ";Centrality (%);#it{q}_{1}(#bar{d})", {HistType::kTH1D}, {centAxis}); + histos.add("q1sqantid", ";Centrality (%);#it{q}_{1}^{2}(#bar{d})", {HistType::kTH1D}, {centAxis}); + histos.add("q2antid", ";Centrality (%);#it{q}_{2}(#bar{d})", {HistType::kTH1D}, {centAxis}); + + histos.add("q1antiL", ";Centrality (%);#it{q}_{1}(#bar{#Lambda})", {HistType::kTH1D}, {centAxis}); + histos.add("q1sqantiL", ";Centrality (%);#it{q}_{1}^{2}(#bar{#Lambda})", {HistType::kTH1D}, {centAxis}); + histos.add("q2antiL", ";Centrality (%);#it{q}_{2}(#bar{#Lambda})", {HistType::kTH1D}, {centAxis}); + + histos.add("q1L", ";Centrality (%);#it{q}_{1}(#Lambda)", {HistType::kTH1D}, {centAxis}); + histos.add("q1sqL", ";Centrality (%);#it{q}_{1}^{2}(#Lambda)", {HistType::kTH1D}, {centAxis}); + histos.add("q2L", ";Centrality (%);#it{q}_{2}(#Lambda)", {HistType::kTH1D}, {centAxis}); + + histos.add("q11Lantid", ";Centrality (%);#it{q}_{11}(#Lambda, #bar{d})", {HistType::kTH1D}, {centAxis}); + histos.add("q11antiLantid", ";Centrality (%);#it{q}_{11}(#bar{#Lambda}, #bar{d})", {HistType::kTH1D}, {centAxis}); + + // v0 QA + histos.add("massLambda", ";#it{M}(p + #pi^{-}) (GeV/#it{c}^{2});Entries", {HistType::kTH1F, {massLambdaAxis}}); + histos.add("cosPa", ";cosPa;Entries", {HistType::kTH1F}, {cosPaAxis}); + histos.add("radius", ";radius;Entries", {HistType::kTH1F}, {radiusAxis}); + histos.add("dcaV0daugh", ";dcaV0daugh;Entries", {HistType::kTH1F}, {dcaV0daughAxis}); + histos.add("dcaPosPv", ";dcaPosPv;Entries", {HistType::kTH1F}, {dcaDaughPvAxis}); + histos.add("dcaNegPv", ";dcaNegPv;Entries", {HistType::kTH1F}, {dcaDaughPvAxis}); + + // v0 QA + histos.add("tpcNsigma", ";tpcNsigma;Entries", {HistType::kTH1F, {tpcNsigmaAxis}}); + histos.add("tofNsigma", ";tofNsigma;Entries", {HistType::kTH1F}, {tofNsigmaAxis}); + } + + void initCCDB(aod::BCsWithTimestamps::iterator const& bc) + { + if (mRunNumber == bc.runNumber()) { + return; + } + auto run3grp_timestamp = bc.timestamp(); + + o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); + o2::parameters::GRPMagField* grpmag = 0x0; + if (grpo) { + o2::base::Propagator::initFieldFromGRP(grpo); + if (d_bz_input < -990) { + // Fetch magnetic field from ccdb for current collision + d_bz = grpo->getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + } else { + d_bz = d_bz_input; + } + } else { + grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); + if (!grpmag) { + LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; + } + o2::base::Propagator::initFieldFromGRP(grpmag); + if (d_bz_input < -990) { + // Fetch magnetic field from ccdb for current collision + d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + } else { + d_bz = d_bz_input; + } + } + mRunNumber = bc.runNumber(); + } + + void process(soa::Join::iterator const& collision, TracksFull const& tracks, soa::Filtered const& V0s, aod::BCsWithTimestamps const&) + { + auto bc = collision.bc_as(); + initCCDB(bc); + + if (!collision.sel8()) + return; + + if (std::abs(collision.posZ()) > zVtxMax) + return; + + const o2::math_utils::Point3D collVtx{collision.posX(), collision.posY(), collision.posZ()}; + + histos.fill(HIST("zVtx"), collision.posZ()); + + double q1antid{0.}, q2antid{0.}; + for (const auto& track : tracks) { + if (!selectAntid(track)) { + continue; + } + + auto trackParCov = getTrackParCov(track); + gpu::gpustd::array dcaInfo; + o2::base::Propagator::Instance()->propagateToDCABxByBz(collVtx, trackParCov, 2.f, static_cast(cfgMaterialCorrection.value), &dcaInfo); + + float dcaXYZ = dcaInfo[0]; + if (std::abs(dcaXYZ) > antidDcaCut) { + continue; + } + + if (trackParCov.getPt() < antidPtMin || trackParCov.getPt() > antidPtMax) { + continue; + } + if (std::abs(track.tpcNSigmaDe()) > antidNsigmaTpcCut) { + continue; + } + if (std::abs(track.tofNSigmaDe()) > antidNsigmaTofCut && trackParCov.getPt() > antidPtTof) { + continue; + } + + histos.fill(HIST("tpcNsigma"), track.tpcNSigmaDe()); + if (trackParCov.getPt() > antidPtTof) { + histos.fill(HIST("tofNsigma"), track.tofNSigmaDe()); + } + + q1antid += 1.; // TODO: correct for efficiency + q2antid += 1.; + } + + double q1L{0.}, q2L{0.}, q1antiL{0.}, q2antiL{0.}; + std::vector trkId; + for (const auto& v0 : V0s) { + if (v0.pt() < lambdaPtMin || v0.pt() > lambdaPtMax) { + continue; + } + + if (!selectLambda(v0)) { + continue; + } + + auto pos = v0.template posTrack_as(); + auto neg = v0.template negTrack_as(); + if (std::abs(pos.eta()) > etaMax || std::abs(pos.eta()) > etaMax) { + continue; + } + + bool matter = v0.alpha() > 0; + + histos.fill(HIST("massLambda"), matter ? v0.mLambda() : v0.mAntiLambda()); + histos.fill(HIST("cosPa"), v0.v0cosPA()); + histos.fill(HIST("radius"), v0.v0radius()); + histos.fill(HIST("dcaV0daugh"), v0.dcaV0daughters()); + histos.fill(HIST("dcaPosPv"), v0.dcapostopv()); + histos.fill(HIST("dcaNegPv"), v0.dcanegtopv()); + + if (matter) { + q1L += 1.; // TODO: correct for efficiency + q2L += 1.; + } else { + q1antiL += 1.; // TODO: correct for efficiency + q2antiL += 1.; + } + + trkId.emplace_back(pos.globalIndex()); + trkId.emplace_back(neg.globalIndex()); + } + + // reject events having multiple v0s from same tracks (TODO: also across collisions?) + std::sort(trkId.begin(), trkId.end()); + if (std::adjacent_find(trkId.begin(), trkId.end()) != trkId.end()) { + return; + } + + histos.fill(HIST("nEv"), collision.centFT0C()); + + histos.fill(HIST("q1antid"), collision.centFT0C(), q1antid); + histos.fill(HIST("q1sqantid"), collision.centFT0C(), std::pow(q1antid, 2)); + histos.fill(HIST("q2antid"), collision.centFT0C(), q2antid); + + histos.fill(HIST("q1L"), collision.centFT0C(), q1L); + histos.fill(HIST("q1sqL"), collision.centFT0C(), std::pow(q1L, 2)); + histos.fill(HIST("q2L"), collision.centFT0C(), q2L); + + histos.fill(HIST("q1antiL"), collision.centFT0C(), q1antiL); + histos.fill(HIST("q1sqantiL"), collision.centFT0C(), std::pow(q1antiL, 2)); + histos.fill(HIST("q2antiL"), collision.centFT0C(), q2antiL); + + histos.fill(HIST("q11Lantid"), collision.centFT0C(), q1L * q1antid); + histos.fill(HIST("q11antiLantid"), collision.centFT0C(), q1antiL * q1antid); + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/Tasks/cascadecorrelations.cxx b/PWGLF/Tasks/cascadecorrelations.cxx index 86fa65a796c..2e01f2791c4 100644 --- a/PWGLF/Tasks/cascadecorrelations.cxx +++ b/PWGLF/Tasks/cascadecorrelations.cxx @@ -54,7 +54,7 @@ using FullTracksExtWithPID = soa::Join; // Add a column to the cascdataext table: IsSelected. -// 0 = not selected, 1 = Xi, 2 = Omega, 3 = both +// 0 = not selected, 1 = Xi, 2 = both, 3 = Omega namespace o2::aod { namespace cascadeflags @@ -75,44 +75,119 @@ struct cascadeSelector { Configurable tpcNsigmaPion{"tpcNsigmaPion", 3, "TPC NSigma pion <- lambda"}; Configurable minTPCCrossedRows{"minTPCCrossedRows", 80, "min N TPC crossed rows"}; // TODO: finetune! 80 > 159/2, so no split tracks? Configurable minITSClusters{"minITSClusters", 4, "minimum number of ITS clusters"}; - // Configurable doTPConly{"doTPConly", false, "use TPC-only tracks"}; // TODO: maybe do this for high pT only? as cascade decays after IB // Selection criteria - compatible with core wagon autodetect - copied from cascadeanalysis.cxx //*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* - Configurable v0setting_cospa{"v0setting_cospa", 0.95, "v0setting_cospa"}; + Configurable v0setting_cospa{"v0setting_cospa", 0.995, "v0setting_cospa"}; Configurable v0setting_dcav0dau{"v0setting_dcav0dau", 1.0, "v0setting_dcav0dau"}; Configurable v0setting_dcapostopv{"v0setting_dcapostopv", 0.1, "v0setting_dcapostopv"}; Configurable v0setting_dcanegtopv{"v0setting_dcanegtopv", 0.1, "v0setting_dcanegtopv"}; Configurable v0setting_radius{"v0setting_radius", 0.9, "v0setting_radius"}; Configurable cascadesetting_cospa{"cascadesetting_cospa", 0.95, "cascadesetting_cospa"}; Configurable cascadesetting_dcacascdau{"cascadesetting_dcacascdau", 1.0, "cascadesetting_dcacascdau"}; - Configurable cascadesetting_dcabachtopv{"cascadesetting_dcabachtopv", 0.1, "cascadesetting_dcabachtopv"}; - Configurable cascadesetting_cascradius{"cascadesetting_cascradius", 0.5, "cascadesetting_cascradius"}; + Configurable cascadesetting_dcabachtopv{"cascadesetting_dcabachtopv", 0.05, "cascadesetting_dcabachtopv"}; + Configurable cascadesetting_cascradius{"cascadesetting_cascradius", 0.9, "cascadesetting_cascradius"}; Configurable cascadesetting_v0masswindow{"cascadesetting_v0masswindow", 0.01, "cascadesetting_v0masswindow"}; Configurable cascadesetting_mindcav0topv{"cascadesetting_mindcav0topv", 0.01, "cascadesetting_mindcav0topv"}; //*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* + // TODO: variables as function of Omega mass, only do Xi for now + AxisSpec vertexAxis = {200, -10.0f, 10.0f, "cm"}; + AxisSpec dcaAxis = {100, 0.0f, 10.0f, "cm"}; + AxisSpec invMassAxis = {1000, 1.0f, 2.0f, "Inv. Mass (GeV/c^{2})"}; + AxisSpec ptAxis = {100, 0, 15, "#it{p}_{T}"}; + HistogramRegistry registry{ + "registry", + { + // basic selection variables + {"hV0Radius", "hV0Radius", {HistType::kTH3F, {{100, 0.0f, 100.0f, "cm"}, invMassAxis, ptAxis}}}, + {"hCascRadius", "hCascRadius", {HistType::kTH3F, {{100, 0.0f, 100.0f, "cm"}, invMassAxis, ptAxis}}}, + {"hV0CosPA", "hV0CosPA", {HistType::kTH3F, {{100, 0.95f, 1.0f}, invMassAxis, ptAxis}}}, + {"hCascCosPA", "hCascCosPA", {HistType::kTH3F, {{100, 0.95f, 1.0f}, invMassAxis, ptAxis}}}, + {"hDCAPosToPV", "hDCAPosToPV", {HistType::kTH3F, {vertexAxis, invMassAxis, ptAxis}}}, + {"hDCANegToPV", "hDCANegToPV", {HistType::kTH3F, {vertexAxis, invMassAxis, ptAxis}}}, + {"hDCABachToPV", "hDCABachToPV", {HistType::kTH3F, {vertexAxis, invMassAxis, ptAxis}}}, + {"hDCAV0ToPV", "hDCAV0ToPV", {HistType::kTH3F, {vertexAxis, invMassAxis, ptAxis}}}, + {"hDCAV0Dau", "hDCAV0Dau", {HistType::kTH3F, {dcaAxis, invMassAxis, ptAxis}}}, + {"hDCACascDau", "hDCACascDau", {HistType::kTH3F, {dcaAxis, invMassAxis, ptAxis}}}, + {"hLambdaMass", "hLambdaMass", {HistType::kTH3F, {{100, 1.0f, 1.2f, "Inv. Mass (GeV/c^{2})"}, invMassAxis, ptAxis}}}, + + // invariant mass per cut, start with Xi + {"hMassXi0", "Xi inv mass before selections", {HistType::kTH2F, {invMassAxis, ptAxis}}}, + {"hMassXi1", "Xi inv mass after TPCnCrossedRows cut", {HistType::kTH2F, {invMassAxis, ptAxis}}}, + {"hMassXi2", "Xi inv mass after ITSnClusters cut", {HistType::kTH2F, {invMassAxis, ptAxis}}}, + {"hMassXi3", "Xi inv mass after topo cuts", {HistType::kTH2F, {invMassAxis, ptAxis}}}, + {"hMassXi4", "Xi inv mass after V0 daughters PID cut", {HistType::kTH2F, {invMassAxis, ptAxis}}}, + {"hMassXi5", "Xi inv mass after bachelor PID cut", {HistType::kTH2F, {invMassAxis, ptAxis}}}, + + // ITS & TPC clusters, with Xi inv mass + {"hTPCnCrossedRowsPos", "hTPCnCrossedRowsPos", {HistType::kTH3F, {{160, -0.5, 159.5, "TPC crossed rows"}, invMassAxis, ptAxis}}}, + {"hTPCnCrossedRowsNeg", "hTPCnCrossedRowsNeg", {HistType::kTH3F, {{160, -0.5, 159.5, "TPC crossed rows"}, invMassAxis, ptAxis}}}, + {"hTPCnCrossedRowsBach", "hTPCnCrossedRowsBach", {HistType::kTH3F, {{160, -0.5, 159.5, "TPC crossed rows"}, invMassAxis, ptAxis}}}, + {"hITSnClustersPos", "hITSnClustersPos", {HistType::kTH3F, {{8, -0.5, 7.5, "number of ITS clusters"}, invMassAxis, ptAxis}}}, + {"hITSnClustersNeg", "hITSnClustersNeg", {HistType::kTH3F, {{8, -0.5, 7.5, "number of ITS clusters"}, invMassAxis, ptAxis}}}, + {"hITSnClustersBach", "hITSnClustersBach", {HistType::kTH3F, {{8, -0.5, 7.5, "number of ITS clusters"}, invMassAxis, ptAxis}}}, + }, + }; + + // Keep track of which selections the candidates pass + void init(InitContext const&) + { + auto h = registry.add("hSelectionStatus", "hSelectionStatus", HistType::kTH1I, {{10, 0, 10, "status"}}); + h->GetXaxis()->SetBinLabel(1, "All"); + h->GetXaxis()->SetBinLabel(2, "nTPC OK"); + h->GetXaxis()->SetBinLabel(3, "nITS OK"); + h->GetXaxis()->SetBinLabel(4, "Topo OK"); + h->GetXaxis()->SetBinLabel(5, "V0 PID OK"); + h->GetXaxis()->SetBinLabel(6, "Bach PID OK"); + } void process(soa::Join::iterator const& collision, aod::CascDataExt const& Cascades, FullTracksExtIUWithPID const&) { for (auto& casc : Cascades) { - // TODO: make QA histo with info on where cascades fail selections - // Let's try to do some PID & track quality cuts // these are the tracks: auto bachTrack = casc.bachelor_as(); auto posTrack = casc.posTrack_as(); auto negTrack = casc.negTrack_as(); + // topo variables before cuts: + registry.fill(HIST("hV0Radius"), casc.v0radius(), casc.mXi(), casc.pt()); + registry.fill(HIST("hCascRadius"), casc.cascradius(), casc.mXi(), casc.pt()); + registry.fill(HIST("hV0CosPA"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()), casc.mXi(), casc.pt()); + registry.fill(HIST("hCascCosPA"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()), casc.mXi(), casc.pt()); + registry.fill(HIST("hDCAPosToPV"), casc.dcapostopv(), casc.mXi(), casc.pt()); + registry.fill(HIST("hDCANegToPV"), casc.dcanegtopv(), casc.mXi(), casc.pt()); + registry.fill(HIST("hDCABachToPV"), casc.dcabachtopv(), casc.mXi(), casc.pt()); + registry.fill(HIST("hDCAV0ToPV"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ()), casc.mXi(), casc.pt()); + registry.fill(HIST("hDCAV0Dau"), casc.dcaV0daughters(), casc.mXi(), casc.pt()); + registry.fill(HIST("hDCACascDau"), casc.dcacascdaughters(), casc.mXi(), casc.pt()); + registry.fill(HIST("hLambdaMass"), casc.mLambda(), casc.mXi(), casc.pt()); + + registry.fill(HIST("hITSnClustersPos"), posTrack.itsNCls(), casc.mXi(), casc.pt()); + registry.fill(HIST("hITSnClustersNeg"), negTrack.itsNCls(), casc.mXi(), casc.pt()); + registry.fill(HIST("hITSnClustersBach"), bachTrack.itsNCls(), casc.mXi(), casc.pt()); + registry.fill(HIST("hTPCnCrossedRowsPos"), posTrack.tpcNClsCrossedRows(), casc.mXi(), casc.pt()); + registry.fill(HIST("hTPCnCrossedRowsNeg"), negTrack.tpcNClsCrossedRows(), casc.mXi(), casc.pt()); + registry.fill(HIST("hTPCnCrossedRowsBach"), bachTrack.tpcNClsCrossedRows(), casc.mXi(), casc.pt()); + + registry.fill(HIST("hSelectionStatus"), 0); // all the cascade before selections + registry.fill(HIST("hMassXi0"), casc.mXi(), casc.pt()); + // TPC N crossed rows if (posTrack.tpcNClsCrossedRows() < minTPCCrossedRows || negTrack.tpcNClsCrossedRows() < minTPCCrossedRows || bachTrack.tpcNClsCrossedRows() < minTPCCrossedRows) { cascflags(0); continue; } + registry.fill(HIST("hSelectionStatus"), 1); // passes nTPC crossed rows + registry.fill(HIST("hMassXi1"), casc.mXi(), casc.pt()); + // ITS N clusters if (posTrack.itsNCls() < minITSClusters || negTrack.itsNCls() < minITSClusters || bachTrack.itsNCls() < minITSClusters) { cascflags(0); continue; } + registry.fill(HIST("hSelectionStatus"), 2); // passes nITS clusters + registry.fill(HIST("hMassXi2"), casc.mXi(), casc.pt()); //// TOPO CUTS //// TODO: improve! double pvx = collision.posX(); @@ -128,10 +203,12 @@ struct cascadeSelector { cascflags(0); continue; } + registry.fill(HIST("hSelectionStatus"), 3); // passes topo + registry.fill(HIST("hMassXi3"), casc.mXi(), casc.pt()); // TODO: TOF (for pT > 2 GeV per track?) - //// TPC //// + //// TPC PID //// // Lambda check if (casc.sign() < 0) { // Proton check: @@ -156,17 +233,25 @@ struct cascadeSelector { continue; } } + registry.fill(HIST("hSelectionStatus"), 4); // fails at V0 daughters PID + registry.fill(HIST("hMassXi4"), casc.mXi(), casc.pt()); + // Bachelor check if (TMath::Abs(bachTrack.tpcNSigmaPi()) < tpcNsigmaBachelor) { if (TMath::Abs(bachTrack.tpcNSigmaKa()) < tpcNsigmaBachelor) { // consistent with both! - cascflags(3); + cascflags(2); + registry.fill(HIST("hSelectionStatus"), 5); // passes bach PID + registry.fill(HIST("hMassXi5"), casc.mXi(), casc.pt()); continue; } cascflags(1); + registry.fill(HIST("hSelectionStatus"), 5); // passes bach PID + registry.fill(HIST("hMassXi5"), casc.mXi(), casc.pt()); continue; } else if (TMath::Abs(bachTrack.tpcNSigmaKa()) < tpcNsigmaBachelor) { - cascflags(2); + cascflags(3); + registry.fill(HIST("hSelectionStatus"), 5); // passes bach PID continue; } // if we reach here, the bachelor was neither pion nor kaon @@ -207,7 +292,8 @@ struct cascadeCorrelations { {"hLambdaMass", "hLambdaMass", {HistType::kTH1F, {{1000, 0.0f, 10.0f, "Inv. Mass (GeV/c^{2})"}}}}, {"hSelectionFlag", "hSelectionFlag", {HistType::kTH1I, {selectionFlagAxis}}}, - {"hAutoCorrelation", "hAutoCorrelation", {HistType::kTH1I, {{4, -0.5f, 3.5f, "Types of autocorrelation"}}}}, + {"hAutoCorrelation", "hAutoCorrelation", {HistType::kTH1I, {{4, -0.5f, 3.5f, "Types of SS autocorrelation"}}}}, + {"hAutoCorrelationOS", "hAutoCorrelationOS", {HistType::kTH1I, {{2, -1.f, 1.f, "Charge of OS autocorrelated track"}}}}, {"hPhi", "hPhi", {HistType::kTH1F, {{100, 0, 2 * PI, "#varphi"}}}}, {"hEta", "hEta", {HistType::kTH1F, {{100, -2, 2, "#eta"}}}}, @@ -237,7 +323,7 @@ struct cascadeCorrelations { // Some QA on the cascades for (auto& casc : Cascades) { - if (casc.isSelected() != 2) { // not exclusively an Omega --> consistent with Xi or both + if (casc.isSelected() <= 2) { // not exclusively an Omega --> consistent with Xi or both if (casc.sign() < 0) { registry.fill(HIST("hMassXiMinus"), casc.mXi(), casc.pt()); } else { @@ -296,13 +382,39 @@ struct cascadeCorrelations { // Fill the correct histograms based on same-sign or opposite-sign if (trigger.sign() * assoc.sign() < 0) { // opposite-sign + // check for autocorrelations between mis-identified kaons (omega bach) and protons (lambda daughter) TODO: improve logic? + if (trigger.isSelected() >= 2) { + if (trigger.sign() > 0 && trigger.bachelorId() == posIdAssoc) { + // K+ from trigger Omega is the same as proton from assoc lambda + registry.fill(HIST("hAutoCorrelationOS"), 1); + continue; + } + if (trigger.sign() < 0 && trigger.bachelorId() == negIdAssoc) { + // K- from trigger Omega is the same as antiproton from assoc antilambda + registry.fill(HIST("hAutoCorrelationOS"), -1); + continue; + } + } + if (assoc.isSelected() >= 2) { + if (assoc.sign() > 0 && assoc.bachelorId() == posIdTrigg) { + // K+ from assoc Omega is the same as proton from trigger lambda + registry.fill(HIST("hAutoCorrelationOS"), 1); + continue; + } + if (assoc.sign() < 0 && assoc.bachelorId() == negIdTrigg) { + // K- from assoc Omega is the same as antiproton from trigger antilambda + registry.fill(HIST("hAutoCorrelationOS"), -1); + continue; + } + } + registry.fill(HIST("hDeltaPhiOS"), dphi); registry.fill(HIST("hXiXiOS"), dphi, deta, trigger.pt(), assoc.pt(), invMassXiTrigg, invMassXiAssoc, trigger.isSelected(), assoc.isSelected(), collision.posZ(), collision.multFT0M()); registry.fill(HIST("hXiOmOS"), dphi, deta, trigger.pt(), assoc.pt(), invMassXiTrigg, invMassOmAssoc, trigger.isSelected(), assoc.isSelected(), collision.posZ(), collision.multFT0M()); registry.fill(HIST("hOmXiOS"), dphi, deta, trigger.pt(), assoc.pt(), invMassOmTrigg, invMassXiAssoc, trigger.isSelected(), assoc.isSelected(), collision.posZ(), collision.multFT0M()); registry.fill(HIST("hOmOmOS"), dphi, deta, trigger.pt(), assoc.pt(), invMassOmTrigg, invMassOmAssoc, trigger.isSelected(), assoc.isSelected(), collision.posZ(), collision.multFT0M()); } else { // same-sign - // make sure to check for autocorrelations - only possible in same-sign correlations + // make sure to check for autocorrelations - only possible in same-sign correlations (if PID is correct) if (posIdTrigg == posIdAssoc && negIdTrigg == negIdAssoc) { // LOGF(info, "same v0 in SS correlation! %d %d", v0dataTrigg.v0Id(), v0dataAssoc.v0Id()); registry.fill(HIST("hAutoCorrelation"), 0); diff --git a/PWGLF/Tasks/derivedcascadeanalysis.cxx b/PWGLF/Tasks/derivedcascadeanalysis.cxx new file mode 100644 index 00000000000..e18b3dffcc4 --- /dev/null +++ b/PWGLF/Tasks/derivedcascadeanalysis.cxx @@ -0,0 +1,785 @@ +// 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. +// +/// \ post processing for Cascade analysis runing on derived data +/// \author Lucia Anna Tarasovicova (lucia.anna.husova@cern.ch) + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "ReconstructionDataFormats/Track.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/PIDResponse.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "Framework/ASoAHelpers.h" + +// constants +const float ctauxiPDG = 4.91; // from PDG +const float ctauomegaPDG = 2.461; // from PDG + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using std::array; + +struct derivedCascadeAnalysis { + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + Configurable zVertexCut{"zVertexCut", 10, "Cut on PV position"}; + + ConfigurableAxis axisPt{"axisPt", {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}, "pt axis for QA histograms"}; + + ConfigurableAxis vertexZ{"vertexZ", {30, -15.0f, 15.0f}, ""}; + ConfigurableAxis axisXiMass{"axisXiMass", {200, 1.222f, 1.422f}, ""}; + ConfigurableAxis axisOmegaMass{"axisOmegaMass", {200, 1.572f, 1.772f}, ""}; + + Configurable isXi{"isXi", 1, "Apply cuts for Xi identification"}; + Configurable isMC{"isMC", false, "MC data are processed"}; + Configurable doPtDepCutStudy{"doPtDepCutStudy", false, "Fill histogram with a cutting paramer"}; + + Configurable minPt{"minPt", 0.0f, "minPt"}; + Configurable masswin{"masswin", 0.05, "Mass window limit"}; + Configurable lambdaMassWin{"lambdaMassWin", 0.005, "V0 Mass window limit"}; + Configurable rapCut{"rapCut", 0.5, "Rapidity acceptance"}; + Configurable etaDauCut{"etaDauCut", 0.8, "Pseudorapidity acceptance of the cascade daughters"}; + Configurable dcaBaryonToPV{"dcaBaryonToPV", 0.05, "DCA of baryon doughter track To PV"}; + Configurable dcaMesonToPV{"dcaMesonToPV", 0.1, "DCA of meson doughter track To PV"}; + Configurable dcaBachToPV{"dcaBachToPV", 0.04, "DCA Bach To PV"}; + Configurable casCosPaPtParameter{"casCosPaPtParameter", 0.341715, "Parameter for pt dependent cos PA cut"}; + Configurable casccospa{"casccospa", 0.97, "Casc CosPA"}; + Configurable v0CosPaPtParameter{"v0CosPaPtParameter", 0.341715, "Parameter for pt dependent cos PA cut of the V0 daughter"}; + Configurable v0cospa{"v0cospa", 0.97, "V0 CosPA"}; + Configurable dcacascdau{"dcacascdau", 1.3, "DCA Casc Daughters"}; + Configurable dcav0dau{"dcav0dau", 1.5, "DCA V0 Daughters"}; + Configurable dcaV0ToPV{"dcaV0ToPV", 0.06, "DCA V0 To PV"}; + Configurable minRadius{"minRadius", 0.6f, "minRadius"}; + Configurable maxRadius{"maxRadius", 100.0f, "maxRadius"}; + Configurable minV0Radius{"minV0Radius", 1.2f, "V0 transverse decay radius, minimum"}; + Configurable maxV0Radius{"maxV0Radius", 100.0f, "V0 transverse decay radius, maximum"}; + Configurable nsigmatpcPi{"nsigmatpcPi", 5, "N sigma TPC Pion"}; + Configurable nsigmatpcPr{"nsigmatpcPr", 5, "N sigma TPC Proton"}; + Configurable nsigmatpcKa{"nsigmatpcKa", 5, "N sigma TPC Kaon"}; + Configurable bachBaryonCosPA{"bachBaryonCosPA", 0.9999, "Bachelor baryon CosPA"}; + Configurable bachBaryonDCAxyToPV{"bachBaryonDCAxyToPV", 0.05, "DCA bachelor baryon to PV"}; + Configurable mintpccrrows{"mintpccrrows", 50, "min N TPC crossed rows"}; + Configurable dooobrej{"dooobrej", 0, "OOB rejection: 0 no selection, 1 = ITS||TOF, 2 = TOF only for pT > ptthrtof"}; + Configurable ptthrtof{"ptthrtof", 2, "Pt threshold for applying only tof oob rejection"}; + Configurable proplifetime{"proplifetime", 6, "ctau/"}; + Configurable rejcomp{"rejcomp", 0.008, "Competing Cascade rejection"}; + + Configurable doPtDepCosPaCut{"doPtDepCosPaCut", false, "Enable pt dependent cos PA cut"}; + Configurable doPtDepV0CosPaCut{"doPtDepV0CosPaCut", false, "Enable pt dependent cos PA cut of the V0 daughter"}; + Configurable doDCAdauToPVCut{"doDCAdauToPVCut", true, "Enable cut DCA daughter track to PV"}; + Configurable doCascadeCosPaCut{"doCascadeCosPaCut", true, "Enable cos PA cut"}; + Configurable doV0CosPaCut{"doV0CosPaCut", true, "Enable cos PA cut for the V0 daughter"}; + Configurable doDCACascadeDauCut{"doDCACascadeDauCut", true, "Enable cut DCA betweenn daughter tracks"}; + Configurable doDCAV0DauCut{"doDCAV0DauCut", true, "Enable cut DCA betweenn V0 daughter tracks"}; + Configurable doCascadeRadiusCut{"doCascadeRadiusCut", true, "Enable cut on the cascade radius"}; + Configurable doV0RadiusCut{"doV0RadiusCut", true, "Enable cut on the V0 radius"}; + Configurable doDCAV0ToPVCut{"doDCAV0ToPVCut", true, "Enable cut DCA of V0 to PV"}; + Configurable doNTPCSigmaCut{"doNTPCSigmaCut", false, "Enable cut N sigma TPC"}; + Configurable doBachelorBaryonCut{"doBachelorBaryonCut", true, "Enable Bachelor-Baryon cut "}; + Configurable doProperLifeTimeCut{"doProperLifeTimeCut", true, "Enable proper life-time cut "}; + + Service pdgDB; + + void init(InitContext const&) + { + histos.add("hEventVertexZ", "hEventVertexZ", kTH1F, {vertexZ}); + histos.add("hEventCentrality", "hEventCentrality", kTH1F, {{101, 0, 101}}); + histos.add("hEventSelection", "hEventSelection", kTH1F, {{4, 0, 4}}); + + histos.add("hCandidate", "hCandidate", HistType::kTH1F, {{22, -0.5, 21.5}}); + + TString CutLabel[22] = {"All", "MassWin", "y", "DCACascDau", "DCAV0Dau", "rCasc", "rCascMax", "rV0", "rV0Max", "LambdaMass", "Bach-baryon", "V0CosPA", "CompDecayMass", "DCADauToPV", "EtaDau", "CascCosPA", "DCAV0ToPV", "nSigmaTPCV0Dau", "NTPCrows", "OOBRej", "nSigmaTPCbachelor", "ctau"}; + for (Int_t i = 1; i <= histos.get(HIST("hCandidate"))->GetNbinsX(); i++) { + histos.get(HIST("hCandidate"))->GetXaxis()->SetBinLabel(i, CutLabel[i - 1]); + } + + histos.add("InvMassBefSel/hNegativeCascade", "hNegativeCascade", HistType::kTH3F, {axisPt, axisXiMass, {101, 0, 101}}); + histos.add("InvMassBefSel/hPositiveCascade", "hPositiveCascade", {HistType::kTH3F, {axisPt, axisXiMass, {101, 0, 101}}}); + + if (!isXi) { + histos.get(HIST("InvMassBefSel/hNegativeCascade"))->GetYaxis()->Set(200, 1.572f, 1.772f); + histos.get(HIST("InvMassBefSel/hPositiveCascade"))->GetYaxis()->Set(200, 1.572f, 1.772f); + } + + histos.addClone("InvMassBefSel/", "InvMassAfterSel/"); + if (isMC) + histos.addClone("InvMassBefSel/", "InvMassAfterSelMCrecTruth/"); + + if (doPtDepCutStudy && !doProperLifeTimeCut) { + histos.add("PtDepCutStudy/hNegativeCascadeProperLifeTime", "hNegativeCascadeProperLifeTime", HistType::kTH3F, {axisPt, axisXiMass, {100, 0, 10}}); + histos.add("PtDepCutStudy/hPositiveCascadeProperLifeTime", "hPositiveCascadeProperLifeTime", {HistType::kTH3F, {axisPt, axisXiMass, {100, 0, 10}}}); + if (!isXi) { + histos.get(HIST("PtDepCutStudy/hNegativeCascadeProperLifeTime"))->GetYaxis()->Set(200, 1.572f, 1.772f); + histos.get(HIST("PtDepCutStudy/hPositiveCascadeProperLifeTime"))->GetYaxis()->Set(200, 1.572f, 1.772f); + } + } + if (doPtDepCutStudy && !doBachelorBaryonCut) { + histos.add("PtDepCutStudy/hNegativeBachelorBaryonDCA", "hNegativeBachelorBaryonDCA", HistType::kTH3F, {axisPt, axisXiMass, {40, 0, 1}}); + histos.add("PtDepCutStudy/hPositiveBachelorBaryonDCA", "hPositiveBachelorBaryonDCA", {HistType::kTH3F, {axisPt, axisXiMass, {40, 0, 1}}}); + if (!isXi) { + histos.get(HIST("PtDepCutStudy/hNegativeBachelorBaryonDCA"))->GetYaxis()->Set(200, 1.572f, 1.772f); + histos.get(HIST("PtDepCutStudy/hPositiveBachelorBaryonDCA"))->GetYaxis()->Set(200, 1.572f, 1.772f); + } + } + if (doPtDepCutStudy && !doDCAV0ToPVCut) { + histos.add("PtDepCutStudy/hNegativeDCAV0ToPV", "hNegativeDCAV0ToPV", HistType::kTH3F, {axisPt, axisXiMass, {40, 0, 1}}); + histos.add("PtDepCutStudy/hPositiveDCAV0ToPV", "hPositiveDCAV0ToPV", {HistType::kTH3F, {axisPt, axisXiMass, {40, 0, 1}}}); + if (!isXi) { + histos.get(HIST("PtDepCutStudy/hNegativeDCAV0ToPV"))->GetYaxis()->Set(200, 1.572f, 1.772f); + histos.get(HIST("PtDepCutStudy/hPositiveDCAV0ToPV"))->GetYaxis()->Set(200, 1.572f, 1.772f); + } + } + if (doPtDepCutStudy && !doV0RadiusCut) { + histos.add("PtDepCutStudy/hNegativeV0Radius", "hNegativeV0Radius", HistType::kTH3F, {axisPt, axisXiMass, {20, 0, 10}}); + histos.add("PtDepCutStudy/hPositiveV0Radius", "hPositiveV0Radius", {HistType::kTH3F, {axisPt, axisXiMass, {20, 0, 10}}}); + if (!isXi) { + histos.get(HIST("PtDepCutStudy/hNegativeV0Radius"))->GetYaxis()->Set(200, 1.572f, 1.772f); + histos.get(HIST("PtDepCutStudy/hPositiveV0Radius"))->GetYaxis()->Set(200, 1.572f, 1.772f); + } + } + if (doPtDepCutStudy && !doCascadeRadiusCut) { + histos.add("PtDepCutStudy/hNegativeCascadeRadius", "hNegativeCascadeRadius", HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 5}}); + histos.add("PtDepCutStudy/hPositiveCascadeRadius", "hPositiveCascadeRadius", {HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 5}}}); + if (!isXi) { + histos.get(HIST("PtDepCutStudy/hNegativeCascadeRadius"))->GetYaxis()->Set(200, 1.572f, 1.772f); + histos.get(HIST("PtDepCutStudy/hPositiveCascadeRadius"))->GetYaxis()->Set(200, 1.572f, 1.772f); + } + } + + if (doPtDepCutStudy && !doDCAV0DauCut) { + histos.add("PtDepCutStudy/hNegativeDCAV0Daughters", "hNegativeDCAV0Daughters", HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 5}}); + histos.add("PtDepCutStudy/hPositiveDCAV0Daughters", "hPositiveDCAV0Daughters", {HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 5}}}); + if (!isXi) { + histos.get(HIST("PtDepCutStudy/hNegativeDCAV0Daughters"))->GetYaxis()->Set(200, 1.572f, 1.772f); + histos.get(HIST("PtDepCutStudy/hPositiveDCAV0Daughters"))->GetYaxis()->Set(200, 1.572f, 1.772f); + } + } + + if (doPtDepCutStudy && !doDCACascadeDauCut) { + histos.add("PtDepCutStudy/hNegativeDCACascDaughters", "hNegativeDCACascDaughters", HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 5}}); + histos.add("PtDepCutStudy/hPositiveDCACascDaughters", "hPositiveDCACascDaughters", {HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 5}}}); + if (!isXi) { + histos.get(HIST("PtDepCutStudy/hPositiveDCACascDaughters"))->GetYaxis()->Set(200, 1.572f, 1.772f); + histos.get(HIST("PtDepCutStudy/hNegativeDCACascDaughters"))->GetYaxis()->Set(200, 1.572f, 1.772f); + } + } + + if (doPtDepCutStudy && !doV0CosPaCut) { + histos.add("PtDepCutStudy/hNegativeV0pa", "hNegativeV0pa", HistType::kTH3F, {axisPt, axisXiMass, {40, 0, 0.4}}); + histos.add("PtDepCutStudy/hPositiveV0pa", "hPositiveV0pa", {HistType::kTH3F, {axisPt, axisXiMass, {40, 0, 0.4}}}); + if (!isXi) { + histos.get(HIST("PtDepCutStudy/hNegativeV0pa"))->GetYaxis()->Set(200, 1.572f, 1.772f); + histos.get(HIST("PtDepCutStudy/hPositiveV0pa"))->GetYaxis()->Set(200, 1.572f, 1.772f); + } + } + if (doPtDepCutStudy && !doDCAdauToPVCut) { + histos.add("PtDepCutStudy/hNegativeDCABachelorToPV", "hNegativeDCABachelorToPV", HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 0.5}}); + histos.add("PtDepCutStudy/hNegativeDCABaryonToPV", "hNegativeDCABaryonToPV", HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 0.5}}); + histos.add("PtDepCutStudy/hNegativeDCAMesonToPV", "hNegativeDCAMesonToPV", HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 0.5}}); + histos.add("PtDepCutStudy/hPositiveDCABachelorToPV", "hPositiveDCABachelorToPV", {HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 0.5}}}); + histos.add("PtDepCutStudy/hPositiveDCABaryonToPV", "hPositiveDCABaryonToPV", HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 0.5}}); + histos.add("PtDepCutStudy/hPositiveDCAMesonToPV", "hPositiveDCAMesonToPV", HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 0.5}}); + if (!isXi) { + histos.get(HIST("PtDepCutStudy/hNegativeDCABachelorToPV"))->GetYaxis()->Set(200, 1.572f, 1.772f); + histos.get(HIST("PtDepCutStudy/hNegativeDCABaryonToPV"))->GetYaxis()->Set(200, 1.572f, 1.772f); + histos.get(HIST("PtDepCutStudy/hNegativeDCAMesonToPV"))->GetYaxis()->Set(200, 1.572f, 1.772f); + histos.get(HIST("PtDepCutStudy/hPositiveDCABachelorToPV"))->GetYaxis()->Set(200, 1.572f, 1.772f); + histos.get(HIST("PtDepCutStudy/hPositiveDCABaryonToPV"))->GetYaxis()->Set(200, 1.572f, 1.772f); + histos.get(HIST("PtDepCutStudy/hPositiveDCAMesonToPV"))->GetYaxis()->Set(200, 1.572f, 1.772f); + } + } + + if (doPtDepCutStudy && !doCascadeCosPaCut) { + histos.add("PtDepCutStudy/hNegativeCascPA", "hNegativeCascPA", HistType::kTH3F, {axisPt, axisXiMass, {40, 0, 0.4}}); + histos.add("PtDepCutStudy/hPositiveCascPA", "hPositiveCascPA", {HistType::kTH3F, {axisPt, axisXiMass, {40, 0, 0.4}}}); + if (!isXi) { + histos.get(HIST("PtDepCutStudy/hNegativeCascPA"))->GetYaxis()->Set(200, 1.572f, 1.772f); + histos.get(HIST("PtDepCutStudy/hPositiveCascPA"))->GetYaxis()->Set(200, 1.572f, 1.772f); + } + } + + if (isMC) + histos.addClone("PtDepCutStudy/", "PtDepCutStudyMCTruth/"); + } + template + bool IsCosPAAccepted(TCascade casc, float x, float y, float z) + { + + if (doPtDepV0CosPaCut) { + double ptdepCut = v0CosPaPtParameter / casc.pt(); + if (ptdepCut > 0.3 || casc.pt() < 0.5) + ptdepCut = 0.3; + if (casc.casccosPA(x, y, z) < TMath::Cos(ptdepCut)) + return false; + } else if (casc.casccosPA(x, y, z) < v0cospa) + return false; + + return true; + } + template + bool IsEventAccepted(TCollision coll) + { + histos.fill(HIST("hEventSelection"), 0.5 /* all collisions */); + if (!coll.sel8()) { + return false; + } + histos.fill(HIST("hEventSelection"), 1.5 /* collisions after sel*/); + if (TMath::Abs(coll.posZ()) > zVertexCut) { + return false; + } + histos.fill(HIST("hEventVertexZ"), coll.posZ()); + histos.fill(HIST("hEventSelection"), 2.5 /* collisions after sel pvz sel*/); + + if (coll.centFT0C() > 100) { + return false; + } + histos.fill(HIST("hEventCentrality"), coll.centFT0C()); + histos.fill(HIST("hEventSelection"), 3.5 /* collisions after sel centrality sel*/); + return true; + } + + template + bool IsCascadeCandidateAccepted(TCascade casc, int counter) + { + + if (isXi) { + if (TMath::Abs(casc.mXi() - pdgDB->Mass(3312)) > masswin) + return false; + histos.fill(HIST("hCandidate"), ++counter); + if (TMath::Abs(casc.yXi()) > rapCut) + return false; + histos.fill(HIST("hCandidate"), ++counter); + } else { + if (TMath::Abs(casc.mOmega() - pdgDB->Mass(3334)) > masswin) + return false; + histos.fill(HIST("hCandidate"), ++counter); + if (TMath::Abs(casc.yOmega()) > rapCut) + return false; + histos.fill(HIST("hCandidate"), ++counter); + } + + if (doDCACascadeDauCut) { + if (casc.dcacascdaughters() > dcacascdau) + return false; + histos.fill(HIST("hCandidate"), ++counter); + } else + ++counter; + + if (doDCAV0DauCut) { + if (casc.dcaV0daughters() > dcav0dau) + return false; + histos.fill(HIST("hCandidate"), ++counter); + } else + ++counter; + + if (doCascadeRadiusCut) { + if (casc.cascradius() < minRadius) + return false; + histos.fill(HIST("hCandidate"), ++counter); + + if (casc.cascradius() > maxRadius) + return false; + histos.fill(HIST("hCandidate"), ++counter); + } else + counter += 2; + + if (doV0RadiusCut) { + if (casc.v0radius() < minV0Radius) + return false; + histos.fill(HIST("hCandidate"), ++counter); + if (casc.v0radius() > maxV0Radius) + return false; + histos.fill(HIST("hCandidate"), ++counter); + } else + counter += 2; + + if (TMath::Abs(casc.mLambda() - pdgDB->Mass(3122)) > lambdaMassWin) + return false; + histos.fill(HIST("hCandidate"), ++counter); + + if (doBachelorBaryonCut) { + if ((casc.bachBaryonCosPA() > bachBaryonCosPA || TMath::Abs(casc.bachBaryonDCAxyToPV()) < bachBaryonDCAxyToPV)) { // Bach-baryon selection if required + return false; + } + histos.fill(HIST("hCandidate"), ++counter); + } else + ++counter; + + if (doV0CosPaCut) { + if (!IsCosPAAccepted(casc, casc.x(), casc.y(), casc.z())) + return false; + histos.fill(HIST("hCandidate"), ++counter); + } else + ++counter; + + if (isXi) { + if (TMath::Abs(casc.mOmega() - pdgDB->Mass(3334)) < rejcomp) + return false; + histos.fill(HIST("hCandidate"), ++counter); + } else { + if (TMath::Abs(casc.mXi() - pdgDB->Mass(3312)) < rejcomp) + return false; + histos.fill(HIST("hCandidate"), ++counter); + } + + if (doDCAdauToPVCut) { + if (TMath::Abs(casc.dcabachtopv()) < dcaBachToPV) + return false; + if (casc.sign() > 0 && (TMath::Abs(casc.dcanegtopv()) < dcaBaryonToPV || TMath::Abs(casc.dcapostopv()) < dcaMesonToPV)) + return false; + if (casc.sign() < 0 && (TMath::Abs(casc.dcapostopv()) < dcaBaryonToPV || TMath::Abs(casc.dcanegtopv()) < dcaMesonToPV)) + return false; + histos.fill(HIST("hCandidate"), ++counter); + } else + ++counter; + + return true; + } + + void processCascades(soa::Join::iterator const& coll, soa::Join const& Cascades, soa::Join const&) + { + + if (!IsEventAccepted(coll)) + return; + + for (auto& casc : Cascades) { + + int counter = -1; + histos.fill(HIST("hCandidate"), ++counter); + + double invmass; + if (isXi) + invmass = casc.mXi(); + else + invmass = casc.mOmega(); + // To have trace of how it was before selections + if (casc.sign() < 0) { + histos.fill(HIST("InvMassBefSel/hNegativeCascade"), casc.pt(), invmass, coll.centFT0C()); + } + if (casc.sign() > 0) { + histos.fill(HIST("InvMassBefSel/hPositiveCascade"), casc.pt(), invmass, coll.centFT0C()); + } + + if (!IsCascadeCandidateAccepted(casc, counter)) + continue; + counter += 13; + + auto negExtra = casc.negTrackExtra_as>(); + auto posExtra = casc.posTrackExtra_as>(); + auto bachExtra = casc.bachTrackExtra_as>(); + + auto poseta = RecoDecay::eta(std::array{casc.pxpos(), casc.pypos(), casc.pzpos()}); + auto negeta = RecoDecay::eta(std::array{casc.pxneg(), casc.pyneg(), casc.pzneg()}); + auto bacheta = RecoDecay::eta(std::array{casc.pxbach(), casc.pybach(), casc.pzbach()}); + if (TMath::Abs(poseta) > etaDauCut || TMath::Abs(negeta) > etaDauCut || TMath::Abs(bacheta) > etaDauCut) + continue; + histos.fill(HIST("hCandidate"), ++counter); + + if (doCascadeCosPaCut) { + if (!IsCosPAAccepted(casc, coll.posX(), coll.posY(), coll.posZ())) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else + ++counter; + + if (doDCAV0ToPVCut) { + if (TMath::Abs(casc.dcav0topv(coll.posX(), coll.posY(), coll.posZ())) < dcaV0ToPV) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else + ++counter; + + if (doNTPCSigmaCut) { + if (casc.sign() < 0) { + if (TMath::Abs(posExtra.tpcNSigmaPr()) > nsigmatpcPr || TMath::Abs(negExtra.tpcNSigmaPi()) > nsigmatpcPi) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else if (casc.sign() > 0) { + if (TMath::Abs(posExtra.tpcNSigmaPi()) > nsigmatpcPi || TMath::Abs(negExtra.tpcNSigmaPr()) > nsigmatpcPr) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } + } else + ++counter; + + if (posExtra.tpcCrossedRows() < mintpccrrows || negExtra.tpcCrossedRows() < mintpccrrows || bachExtra.tpcCrossedRows() < mintpccrrows) + continue; + histos.fill(HIST("hCandidate"), ++counter); + + bool kHasTOF = (posExtra.hasTOF() || negExtra.hasTOF() || bachExtra.hasTOF()); + bool kHasITS = (posExtra.hasITS() || negExtra.hasITS() || bachExtra.hasITS()); + if (dooobrej == 1) { + if (!kHasTOF && !kHasITS) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else if (dooobrej == 2) { + if (!kHasTOF && (casc.pt() > ptthrtof)) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else { + ++counter; + } + + float cascpos = std::hypot(casc.x() - coll.posX(), casc.y() - coll.posY(), casc.z() - coll.posZ()); + float cascptotmom = std::hypot(casc.px(), casc.py(), casc.pz()); + float ctau = -10; + + if (isXi) { + if (doNTPCSigmaCut) { + if (TMath::Abs(bachExtra.tpcNSigmaPi()) > nsigmatpcPi) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else + ++counter; + + ctau = pdgDB->Mass(3312) * cascpos / ((cascptotmom + 1e-13) * ctauxiPDG); + if (doProperLifeTimeCut) { + if (ctau > proplifetime) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else { + ++counter; + } + } else { + if (doNTPCSigmaCut) { + if (TMath::Abs(bachExtra.tpcNSigmaKa()) > nsigmatpcKa) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else + ++counter; + + ctau = pdgDB->Mass(3334) * cascpos / ((cascptotmom + 1e-13) * ctauomegaPDG); + if (doProperLifeTimeCut) { + if (ctau > proplifetime) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else + ++counter; + } + + if (casc.sign() < 0) { + histos.fill(HIST("InvMassAfterSel/hNegativeCascade"), casc.pt(), invmass, coll.centFT0C()); + if (!doBachelorBaryonCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hNegativeBachelorBaryonDCA"), casc.pt(), invmass, casc.bachBaryonDCAxyToPV()); + if (!doDCAV0ToPVCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hNegativeDCAV0ToPV"), casc.pt(), invmass, TMath::Abs(casc.dcav0topv(casc.x(), casc.y(), casc.z()))); + if (!doV0RadiusCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hNegativeV0Radius"), casc.pt(), invmass, casc.v0radius()); + if (!doCascadeRadiusCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hNegativeCascadeRadius"), casc.pt(), invmass, casc.cascradius()); + if (!doDCAV0DauCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hNegativeDCAV0Daughters"), casc.pt(), invmass, casc.dcaV0daughters()); + if (!doDCACascadeDauCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hNegativeDCACascDaughters"), casc.pt(), invmass, casc.dcacascdaughters()); + if (!doV0CosPaCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hNegativeV0pa"), casc.pt(), invmass, TMath::ACos(casc.casccosPA(casc.x(), casc.y(), casc.z()))); + if (!doCascadeCosPaCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hNegativeCascPA"), casc.pt(), invmass, TMath::ACos(casc.casccosPA(coll.posX(), coll.posY(), coll.posZ()))); + if (!doDCAdauToPVCut && doPtDepCutStudy) { + histos.fill(HIST("PtDepCutStudy/hNegativeDCABachelorToPV"), casc.pt(), invmass, casc.dcabachtopv()); + histos.fill(HIST("PtDepCutStudy/hNegativeDCAMesonToPV"), casc.pt(), invmass, casc.dcanegtopv()); + histos.fill(HIST("PtDepCutStudy/hNegativeDCABaryonToPV"), casc.pt(), invmass, casc.dcapostopv()); + } + if (!doProperLifeTimeCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hNegativeCascadeProperLifeTime"), casc.pt(), invmass, ctau); + } else { + histos.fill(HIST("InvMassAfterSel/hPositiveCascade"), casc.pt(), invmass, coll.centFT0C()); + if (!doBachelorBaryonCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hPositiveBachelorBaryonDCA"), casc.pt(), invmass, casc.bachBaryonDCAxyToPV()); + if (!doDCAV0ToPVCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hPositiveDCAV0ToPV"), casc.pt(), invmass, TMath::Abs(casc.dcav0topv(casc.x(), casc.y(), casc.z()))); + if (!doV0RadiusCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hPositiveV0Radius"), casc.pt(), invmass, casc.v0radius()); + if (!doCascadeRadiusCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hPositiveCascadeRadius"), casc.pt(), invmass, casc.cascradius()); + if (!doDCAV0DauCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hPositiveDCAV0Daughters"), casc.pt(), invmass, casc.dcaV0daughters()); + if (!doDCACascadeDauCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hPositiveDCACascDaughters"), casc.pt(), invmass, casc.dcacascdaughters()); + if (!doV0CosPaCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hPositiveV0pa"), casc.pt(), invmass, TMath::ACos(casc.casccosPA(casc.x(), casc.y(), casc.z()))); + if (!doCascadeCosPaCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hPositiveCascPA"), casc.pt(), invmass, TMath::ACos(casc.casccosPA(coll.posX(), coll.posY(), coll.posZ()))); + if (!doDCAdauToPVCut && doPtDepCutStudy) { + histos.fill(HIST("PtDepCutStudy/hPositiveDCABachelorToPV"), casc.pt(), invmass, casc.dcabachtopv()); + histos.fill(HIST("PtDepCutStudy/hPositiveDCAMesonToPV"), casc.pt(), invmass, casc.dcapostopv()); + histos.fill(HIST("PtDepCutStudy/hPositiveDCABaryonToPV"), casc.pt(), invmass, casc.dcanegtopv()); + } + if (!doProperLifeTimeCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hPositiveCascadeProperLifeTime"), casc.pt(), invmass, ctau); + } + } + } + void processCascadesMCrec(soa::Join::iterator const& coll, soa::Join const& Cascades, soa::Join const&, aod::MotherMCParts const&) + { + if (!IsEventAccepted(coll)) + return; + + for (auto& casc : Cascades) { + + int counter = -1; + histos.fill(HIST("hCandidate"), ++counter); + + // To have trace of how it was before selections + if (casc.sign() < 0) { + if (isXi) + histos.fill(HIST("InvMassBefSel/hNegativeCascade"), casc.pt(), casc.mXi(), coll.centFT0C()); + else + histos.fill(HIST("InvMassBefSel/hNegativeCascade"), casc.pt(), casc.mOmega(), coll.centFT0C()); + } + if (casc.sign() > 0) { + if (isXi) + histos.fill(HIST("InvMassBefSel/hPositiveCascade"), casc.pt(), casc.mXi(), coll.centFT0C()); + else + histos.fill(HIST("InvMassBefSel/hPositiveCascade"), casc.pt(), casc.mOmega(), coll.centFT0C()); + } + + if (!IsCascadeCandidateAccepted(casc, counter)) + continue; + counter += 13; + + auto negExtra = casc.negTrackExtra_as>(); + auto posExtra = casc.posTrackExtra_as>(); + auto bachExtra = casc.bachTrackExtra_as>(); + + auto poseta = RecoDecay::eta(std::array{casc.pxpos(), casc.pypos(), casc.pzpos()}); + auto negeta = RecoDecay::eta(std::array{casc.pxneg(), casc.pyneg(), casc.pzneg()}); + auto bacheta = RecoDecay::eta(std::array{casc.pxbach(), casc.pybach(), casc.pzbach()}); + if (TMath::Abs(poseta) > etaDauCut || TMath::Abs(negeta) > etaDauCut || TMath::Abs(bacheta) > etaDauCut) + continue; + histos.fill(HIST("hCandidate"), ++counter); + + if (doCascadeCosPaCut) { + if (!IsCosPAAccepted(casc, coll.posX(), coll.posY(), coll.posZ())) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else + ++counter; + + if (doDCAV0ToPVCut) { + if (TMath::Abs(casc.dcav0topv(coll.posX(), coll.posY(), coll.posZ())) < dcaV0ToPV) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else + ++counter; + + if (doNTPCSigmaCut) { + if (casc.sign() < 0) { + if (TMath::Abs(posExtra.tpcNSigmaPr()) > nsigmatpcPr || TMath::Abs(negExtra.tpcNSigmaPi()) > nsigmatpcPi) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else if (casc.sign() > 0) { + if (TMath::Abs(posExtra.tpcNSigmaPi()) > nsigmatpcPi || TMath::Abs(negExtra.tpcNSigmaPr()) > nsigmatpcPr) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } + } else + ++counter; + + if (posExtra.tpcCrossedRows() < mintpccrrows || negExtra.tpcCrossedRows() < mintpccrrows || bachExtra.tpcCrossedRows() < mintpccrrows) + continue; + histos.fill(HIST("hCandidate"), ++counter); + + bool kHasTOF = (posExtra.hasTOF() || negExtra.hasTOF() || bachExtra.hasTOF()); + bool kHasITS = (posExtra.hasITS() || negExtra.hasITS() || bachExtra.hasITS()); + if (dooobrej == 1) { + if (!kHasTOF && !kHasITS) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else if (dooobrej == 2) { + if (!kHasTOF && (casc.pt() > ptthrtof)) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else { + ++counter; + } + + double invmass; + float cascpos = std::hypot(casc.x() - coll.posX(), casc.y() - coll.posY(), casc.z() - coll.posZ()); + float cascptotmom = std::hypot(casc.px(), casc.py(), casc.pz()); + float ctau = -10; + + if (isXi) { + if (doNTPCSigmaCut) { + if (TMath::Abs(bachExtra.tpcNSigmaPi()) > nsigmatpcPi) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else + ++counter; + + ctau = pdgDB->Mass(3312) * cascpos / ((cascptotmom + 1e-13) * ctauxiPDG); + if (doProperLifeTimeCut) { + if (ctau > proplifetime) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else { + ++counter; + } + + invmass = casc.mXi(); + } else { + if (doNTPCSigmaCut) { + if (TMath::Abs(bachExtra.tpcNSigmaKa()) > nsigmatpcKa) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else + ++counter; + ctau = pdgDB->Mass(3334) * cascpos / ((cascptotmom + 1e-13) * ctauomegaPDG); + if (doProperLifeTimeCut) { + if (ctau > proplifetime) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else + ++counter; + invmass = casc.mOmega(); + } + + if (casc.sign() < 0) { + histos.fill(HIST("InvMassAfterSel/hNegativeCascade"), casc.pt(), invmass, coll.centFT0C()); + if (!doBachelorBaryonCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hNegativeBachelorBaryonDCA"), casc.pt(), invmass, casc.bachBaryonDCAxyToPV()); + if (!doDCAV0ToPVCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hNegativeDCAV0ToPV"), casc.pt(), invmass, TMath::Abs(casc.dcav0topv(casc.x(), casc.y(), casc.z()))); + if (!doV0RadiusCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hNegativeV0Radius"), casc.pt(), invmass, casc.v0radius()); + if (!doCascadeRadiusCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hNegativeCascadeRadius"), casc.pt(), invmass, casc.cascradius()); + if (!doDCAV0DauCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hNegativeDCAV0Daughters"), casc.pt(), invmass, casc.dcaV0daughters()); + if (!doDCACascadeDauCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hNegativeDCACascDaughters"), casc.pt(), invmass, casc.dcacascdaughters()); + if (!doV0CosPaCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hNegativeV0pa"), casc.pt(), invmass, TMath::ACos(casc.casccosPA(casc.x(), casc.y(), casc.z()))); + if (!doCascadeCosPaCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hNegativeCascPA"), casc.pt(), invmass, TMath::ACos(casc.casccosPA(coll.posX(), coll.posY(), coll.posZ()))); + if (!doDCAdauToPVCut && doPtDepCutStudy) { + histos.fill(HIST("PtDepCutStudy/hNegativeDCABachelorToPV"), casc.pt(), invmass, casc.dcabachtopv()); + histos.fill(HIST("PtDepCutStudy/hNegativeDCAMesonToPV"), casc.pt(), invmass, casc.dcanegtopv()); + histos.fill(HIST("PtDepCutStudy/hNegativeDCABaryonToPV"), casc.pt(), invmass, casc.dcapostopv()); + } + if (!doProperLifeTimeCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hNegativeCascadeProperLifeTime"), casc.pt(), invmass, ctau); + if (casc.isPhysicalPrimary()) { + if ((isXi && casc.pdgCode() == 3312) || (!isXi && casc.pdgCode() == 3334)) { + histos.fill(HIST("InvMassAfterSelMCrecTruth/hNegativeCascade"), casc.pt(), invmass, coll.centFT0C()); + if (!doBachelorBaryonCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeBachelorBaryonDCA"), casc.pt(), invmass, casc.bachBaryonDCAxyToPV()); + if (!doDCAV0ToPVCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeDCAV0ToPV"), casc.pt(), invmass, TMath::Abs(casc.dcav0topv(casc.x(), casc.y(), casc.z()))); + if (!doV0RadiusCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeV0Radius"), casc.pt(), invmass, casc.v0radius()); + if (!doCascadeRadiusCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeCascadeRadius"), casc.pt(), invmass, casc.cascradius()); + if (!doDCAV0DauCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeDCAV0Daughters"), casc.pt(), invmass, casc.dcaV0daughters()); + if (!doDCACascadeDauCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeDCACascDaughters"), casc.pt(), invmass, casc.dcacascdaughters()); + if (!doV0CosPaCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeV0pa"), casc.pt(), invmass, TMath::ACos(casc.casccosPA(casc.x(), casc.y(), casc.z()))); + if (!doCascadeCosPaCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeCascPA"), casc.pt(), invmass, TMath::ACos(casc.casccosPA(coll.posX(), coll.posY(), coll.posZ()))); + if (!doDCAdauToPVCut && doPtDepCutStudy) { + histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeDCABachelorToPV"), casc.pt(), invmass, casc.dcabachtopv()); + histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeDCAMesonToPV"), casc.pt(), invmass, casc.dcanegtopv()); + histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeDCABaryonToPV"), casc.pt(), invmass, casc.dcapostopv()); + } + if (!doProperLifeTimeCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeCascadeProperLifeTime"), casc.pt(), invmass, ctau); + } + } + } else { + histos.fill(HIST("InvMassAfterSel/hPositiveCascade"), casc.pt(), invmass, coll.centFT0C()); + if (!doBachelorBaryonCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hPositiveBachelorBaryonDCA"), casc.pt(), invmass, casc.bachBaryonDCAxyToPV()); + if (!doDCAV0ToPVCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hPositiveDCAV0ToPV"), casc.pt(), invmass, TMath::Abs(casc.dcav0topv(casc.x(), casc.y(), casc.z()))); + if (!doV0RadiusCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hPositiveV0Radius"), casc.pt(), invmass, casc.v0radius()); + if (!doCascadeRadiusCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hPositiveCascadeRadius"), casc.pt(), invmass, casc.cascradius()); + if (!doDCAV0DauCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hPositiveDCAV0Daughters"), casc.pt(), invmass, casc.dcaV0daughters()); + if (!doDCACascadeDauCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hPositiveDCACascDaughters"), casc.pt(), invmass, casc.dcacascdaughters()); + if (!doV0CosPaCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hPositiveV0pa"), casc.pt(), invmass, TMath::ACos(casc.casccosPA(casc.x(), casc.y(), casc.z()))); + if (!doCascadeCosPaCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hPositiveCascPA"), casc.pt(), invmass, TMath::ACos(casc.casccosPA(coll.posX(), coll.posY(), coll.posZ()))); + if (!doDCAdauToPVCut && doPtDepCutStudy) { + histos.fill(HIST("PtDepCutStudy/hPositiveDCABachelorToPV"), casc.pt(), invmass, casc.dcabachtopv()); + histos.fill(HIST("PtDepCutStudy/hPositiveDCAMesonToPV"), casc.pt(), invmass, casc.dcapostopv()); + histos.fill(HIST("PtDepCutStudy/hPositiveDCABaryonToPV"), casc.pt(), invmass, casc.dcanegtopv()); + } + if (!doProperLifeTimeCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudy/hPositiveCascadeProperLifeTime"), casc.pt(), invmass, ctau); + if (casc.isPhysicalPrimary()) { + if ((isXi && casc.pdgCode() == -3312) || (!isXi && casc.pdgCode() == -3334)) { + histos.fill(HIST("InvMassAfterSelMCrecTruth/hPositiveCascade"), casc.pt(), invmass, coll.centFT0C()); + if (!doBachelorBaryonCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveBachelorBaryonDCA"), casc.pt(), invmass, casc.bachBaryonDCAxyToPV()); + if (!doDCAV0ToPVCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveDCAV0ToPV"), casc.pt(), invmass, TMath::Abs(casc.dcav0topv(casc.x(), casc.y(), casc.z()))); + if (!doV0RadiusCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveV0Radius"), casc.pt(), invmass, casc.v0radius()); + if (!doCascadeRadiusCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveCascadeRadius"), casc.pt(), invmass, casc.cascradius()); + if (!doDCAV0DauCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveDCAV0Daughters"), casc.pt(), invmass, casc.dcaV0daughters()); + if (!doDCACascadeDauCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveDCACascDaughters"), casc.pt(), invmass, casc.dcacascdaughters()); + if (!doV0CosPaCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveV0pa"), casc.pt(), invmass, TMath::ACos(casc.casccosPA(casc.x(), casc.y(), casc.z()))); + if (!doCascadeCosPaCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveCascPA"), casc.pt(), invmass, TMath::ACos(casc.casccosPA(coll.posX(), coll.posY(), coll.posZ()))); + if (!doDCAdauToPVCut && doPtDepCutStudy) { + histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveDCABachelorToPV"), casc.pt(), invmass, casc.dcabachtopv()); + histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveDCAMesonToPV"), casc.pt(), invmass, casc.dcapostopv()); + histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveDCABaryonToPV"), casc.pt(), invmass, casc.dcanegtopv()); + } + if (!doProperLifeTimeCut && doPtDepCutStudy) + histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveCascadeProperLifeTime"), casc.pt(), invmass, ctau); + } + } + } + } + } + + PROCESS_SWITCH(derivedCascadeAnalysis, processCascades, "cascade analysis, run3 data ", true); + PROCESS_SWITCH(derivedCascadeAnalysis, processCascadesMCrec, "cascade analysis, run3 rec MC", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +}