From 6376e5462058168d36de6715ea33c67b0752c798 Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Wed, 11 Nov 2026 23:24:40 +0100 Subject: [PATCH 1/3] [PWGCF] DptDpt - Filter and skimming framework fix linter issues --- .../Core/EventSelectionFilterAndAnalysis.cxx | 70 +-- .../Core/EventSelectionFilterAndAnalysis.h | 80 +-- .../Core/FilterAndAnalysisFramework.cxx | 71 +-- .../Core/FilterAndAnalysisFramework.h | 42 +- .../Core/PIDSelectionFilterAndAnalysis.cxx | 147 ++--- .../Core/PIDSelectionFilterAndAnalysis.h | 85 +-- .../Core/SelectionFilterAndAnalysis.cxx | 13 +- .../Core/SelectionFilterAndAnalysis.h | 25 +- .../Core/SkimmingConfigurableCuts.cxx | 301 +++++----- .../Core/SkimmingConfigurableCuts.h | 167 +++--- .../Core/TrackSelectionFilterAndAnalysis.cxx | 95 ++-- .../Core/TrackSelectionFilterAndAnalysis.h | 37 +- .../Core/TwoPartCorrLinkDef.h | 74 +-- .../TwoParticleCorrelationsFiltered.h | 26 +- .../TwoParticleCorrelationsSkimmed.h | 66 +-- .../twoParticleCorrelationsFiltering.cxx | 94 ++-- .../twoParticleCorrelationsFullSkimming.cxx | 66 ++- ...oParticleCorrelationsNotStoredSkimming.cxx | 60 +- ...woParticleCorrelationsRegisterSkimming.cxx | 24 +- .../Tasks/twoParticleCorrelations.cxx | 514 +++++++++--------- 20 files changed, 1088 insertions(+), 969 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx b/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx index 3181b07d8b5..6ddb65a42e0 100644 --- a/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx +++ b/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx @@ -9,6 +9,11 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file EventSelectionFilterAndAnalysis.cxx +/// \brief Implementation of the EventSelectionFilterAndAnalysis class for +/// filtering collisions for derived data production +/// \author victor.gonzalez.sebastian@gmail.com + #include "EventSelectionFilterAndAnalysis.h" #include "PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.h" @@ -35,7 +40,7 @@ #include using namespace o2; -using namespace o2::analysis::PWGCF; +using namespace o2::analysis::pwgcf; using namespace boost; EventSelectionConfigurable::EventSelectionConfigurable(const std::vector& bfieldsel, @@ -83,7 +88,7 @@ EventSelectionConfigurable::EventSelectionConfigurable(const std::vector 0) { @@ -158,29 +164,29 @@ EventSelectionFilterAndAnalysis::EventSelectionFilterAndAnalysis(const EventSele appendCut(evtsel.mPileUpRejection); cutString += "}"; - ConstructCutFromString(cutString); - if (mMaskLength > 64) { - LOGF(fatal, "EventSelectionFilterAndAnalysis not ready for filter mask of %d bits. Just 64 available for the time being", mMaskLength); + constructCutFromString(cutString); + if (mMaskLength > MaskMaxLength) { + LOGF(fatal, "EventSelectionFilterAndAnalysis not ready for filter mask of %d bits. Just %d available for the time being", mMaskLength, MaskMaxLength); } mCutStringSignature = cutString.ReplaceAll("-yes", "").ReplaceAll("-no", ""); - if (mode == kAnalysis) { - StoreArmedMask(); + if (mode == KAnalysis) { + storeArmedMask(); } } /// \brief Calculates the length of the mask needed to store the selection cuts -int EventSelectionFilterAndAnalysis::CalculateMaskLength() +int EventSelectionFilterAndAnalysis::calculateMaskLength() { int length = 0; auto addLength = [&length](auto& brick) { if (brick != nullptr) { - length += brick->Length(); - LOGF(info, "EventSelectionFilterAndAnalysis::CalculateMaskLength, cumulated length: %d", length); + length += brick->length(); + LOGF(info, "EventSelectionFilterAndAnalysis::calculateMaskLength, cumulated length: %d", length); } }; - for (auto brick : mBFieldSelection) { - length += brick->Length(); + for (const auto& brick : mBFieldSelection) { + length += brick->length(); } addLength(mMultiplicityClasses); addLength(mTriggerSelection); @@ -303,7 +309,7 @@ void EventSelectionFilterAndAnalysis::PileUpRejBrick::initialize() } } -void EventSelectionFilterAndAnalysis::ConstructCutFromString(const TString& cutstr) +void EventSelectionFilterAndAnalysis::constructCutFromString(const TString& cutstr) { LOGF(info, "Cut string: %s", cutstr.Data()); /* let's catch the first level */ @@ -312,8 +318,9 @@ void EventSelectionFilterAndAnalysis::ConstructCutFromString(const TString& cuts smatch m; bool res = regex_search(in, m, cutregex); - if (not res or m.empty() or (m.size() > 2)) { - LOGF(fatal, "EventSelectionFilterAndAnalysis::ConstructCutFromString", "Wrong RE: %s, try eventsel{bfield{positive-yes,negative-yes},zvtx{cwv{rg{-7.0,7.0}-yes:rg{-10.0,10.0}-no,rg{-3.0,3.0}-no}}} for instance", cutstr.Data()); + constexpr int ExpectedMaxLength = 2; + if (not res || m.empty() || (m.size() > ExpectedMaxLength)) { + LOGF(fatal, "EventSelectionFilterAndAnalysis::constructCutFromString", "Wrong RE: %s, try eventsel{bfield{positive-yes,negative-yes},zvtx{cwv{rg{-7.0,7.0}-yes:rg{-10.0,10.0}-no,rg{-3.0,3.0}-no}}} for instance", cutstr.Data()); } this->SetName("EventSelectionFilterAndAnalysisCuts"); this->SetTitle(cutstr.Data()); @@ -334,9 +341,10 @@ void EventSelectionFilterAndAnalysis::ConstructCutFromString(const TString& cuts std::string in(lev2str.Data()); smatch m; bool res = regex_search(in, m, cutregex); + constexpr int ExpectedComponents = 3; - if (not res or m.empty() or (m.size() != 3)) { - Fatal("EventSelectionFilterAndAnalysis::::ConstructCutFromString", "Wrong RE: %s, try tracksel{ttype{FB32,FB96};nclstpc{th{70}},nxr{cwv{th{70},th{80}}}} for instance", cutstr.Data()); + if (not res or m.empty() or (m.size() != ExpectedComponents)) { + Fatal("EventSelectionFilterAndAnalysis::::constructCutFromString", "Wrong RE: %s, try tracksel{ttype{FB32,FB96};nclstpc{th{70}},nxr{cwv{th{70},th{80}}}} for instance", cutstr.Data()); } LOGF(info, "Captured %s", m[1].str().c_str()); auto storeIntCut = [&m, &allowed](CutBrick*& brickvar) { @@ -358,7 +366,7 @@ void EventSelectionFilterAndAnalysis::ConstructCutFromString(const TString& cuts auto addBFieldBrick = [&brickvector](auto name, auto regex, bool arm) { std::set allowed = {"lim", "th"}; CutBrick* brick = CutBrick::constructBrick(name, regex, allowed); - brick->Arm(arm); + brick->arm(arm); brickvector.push_back(brick); }; if (TString(regex).Contains("positive")) { @@ -394,15 +402,15 @@ void EventSelectionFilterAndAnalysis::ConstructCutFromString(const TString& cuts lev2str.Remove(0, m[0].length()); } } - mMaskLength = CalculateMaskLength(); + mMaskLength = calculateMaskLength(); } /// void EventSelectionFilterAndAnalysis::ComplexBrickHelper::armedBrick(uint64_t& armedmask, uint64_t& optmask, uint64_t& forcedmask, int& bit) { auto armedBrick = [&](auto brick, bool opt = false) { - std::vector res = brick->IsArmed(); - for (auto b : res) { + std::vector res = brick->isArmed(); + for (const auto& b : res) { if (b) { SETBIT(armedmask, bit); if (opt) { @@ -418,12 +426,12 @@ void EventSelectionFilterAndAnalysis::ComplexBrickHelper::armedBrick(uint64_t& a if (mAlternateEstimatorIndex.size() > 0) { /* we have alternative estimators so our brick is of kind cwv */ if (mBrick->IsA() != CutWithVariations::Class()) { - LOGF(fatal, "EventSelectionFilterAndAnalysis::Filter() expected class with variations cut but it is not there"); + LOGF(fatal, "EventSelectionFilterAndAnalysis::filter() expected class with variations cut but it is not there"); } /* first the default */ TList& deflst = dynamic_cast*>(mBrick)->getDefaultBricks(); if (deflst.GetEntries() > 1) { - LOGF(fatal, "EventSelectionFilterAndAnalysis::Filter() expected only one default multiplicity class estimator"); + LOGF(fatal, "EventSelectionFilterAndAnalysis::filter() expected only one default multiplicity class estimator"); } armedBrick((CutBrick*)deflst.At(0), true); /* and now the variants */ @@ -438,7 +446,7 @@ void EventSelectionFilterAndAnalysis::ComplexBrickHelper::armedBrick(uint64_t& a } /// \brief Fills the filter cuts mask -void EventSelectionFilterAndAnalysis::StoreArmedMask() +void EventSelectionFilterAndAnalysis::storeArmedMask() { uint64_t armedMask = 0UL; uint64_t optMask = 0UL; @@ -449,8 +457,8 @@ void EventSelectionFilterAndAnalysis::StoreArmedMask() int bit = 0; auto armedBrick = [&](auto brick, bool opt = false) { - std::vector res = brick->IsArmed(); - for (auto b : res) { + std::vector res = brick->isArmed(); + for (const auto& b : res) { if (b) { SETBIT(armedMask, bit); if (opt) { @@ -464,7 +472,7 @@ void EventSelectionFilterAndAnalysis::StoreArmedMask() }; optMask = 0UL; - for (auto brick : mBFieldSelection) { + for (const auto& brick : mBFieldSelection) { armedBrick(brick, true); } mOptArmedMask.push_back(optMask); @@ -480,7 +488,7 @@ void EventSelectionFilterAndAnalysis::StoreArmedMask() if (mPileUpRejection != nullptr) { mPileUpRejection->armedBrick(armedMask, optMask, forcedMask, bit); } - LOGF(info, "EventSelectionFilterAndAnalysis::StoreArmedMask(), masks 0x%016lx, %s, 0x%016lx", armedMask, printOptionalMasks().Data(), forcedMask); + LOGF(info, "EventSelectionFilterAndAnalysis::storeArmedMask(), masks 0x%016lx, %s, 0x%016lx", armedMask, printOptionalMasks().Data(), forcedMask); mArmedMask = armedMask; mForcedArmedMask = forcedMask; } diff --git a/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h b/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h index 28ca101cbf4..e4fff825722 100644 --- a/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h +++ b/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h @@ -9,6 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file EventSelectionFilterAndAnalysis.h +/// \brief EventSelectionFilterAndAnalysis class for filtering collisions for derived data production +/// \author victor.gonzalez.sebastian@gmail.com + #ifndef PWGCF_TWOPARTICLECORRELATIONS_CORE_EVENTSELECTIONFILTERANDANALYSIS_H_ #define PWGCF_TWOPARTICLECORRELATIONS_CORE_EVENTSELECTIONFILTERANDANALYSIS_H_ @@ -32,7 +36,7 @@ namespace o2 { namespace analysis { -namespace PWGCF +namespace pwgcf { /* forward declaration */ class EventSelectionFilterAndAnalysis; @@ -73,14 +77,14 @@ class EventSelectionFilterAndAnalysis : public SelectionFilterAndAnalysis { public: EventSelectionFilterAndAnalysis(); - EventSelectionFilterAndAnalysis(const TString&, selmodes); - EventSelectionFilterAndAnalysis(const EventSelectionConfigurable&, selmodes); + EventSelectionFilterAndAnalysis(const TString&, Selmodes); + EventSelectionFilterAndAnalysis(const EventSelectionConfigurable&, Selmodes); template - uint64_t Filter(CollisionToFilter const& col, AssociatedTracks const& trks, int bfield); - std::vector GetMultiplicities() { return (mMultiplicityClasses != nullptr) ? mMultiplicityClasses->GetMultiplicities() : std::vector{}; } + uint64_t filter(CollisionToFilter const& col, AssociatedTracks const& trks, int bfield); + std::vector getMultiplicities() { return (mMultiplicityClasses != nullptr) ? mMultiplicityClasses->getMultiplicities() : std::vector{}; } /// \brief Gets the index of the active multiplicity value within the multiplicities array - int getMultiplicityIndex() { return (mMultiplicityClasses != nullptr) ? mMultiplicityClasses->GetArmedIndex() : -1; } + int getMultiplicityIndex() { return (mMultiplicityClasses != nullptr) ? mMultiplicityClasses->getArmedIndex() : -1; } private: struct ComplexBrickHelper { @@ -89,30 +93,30 @@ class EventSelectionFilterAndAnalysis : public SelectionFilterAndAnalysis int mDefaultEstimatorIndex = -1; std::vector mAlternateEstimatorIndex = std::vector{}; std::vector mValues = std::vector{}; - int Length() { return mBrick->Length(); } + int length() { return mBrick->length(); } virtual void initialize() = 0; - virtual bool Filter(uint64_t& mask, int& bit, CutBrick* brick, int index) = 0; - bool Filter(uint64_t& mask, int& bit); + virtual bool filter(uint64_t& mask, int& bit, CutBrick* brick, int index) = 0; + bool filter(uint64_t& mask, int& bit); void armedBrick(uint64_t&, uint64_t&, uint64_t&, int&); }; struct MultiplicityBrick : public ComplexBrickHelper { void initialize() override; - std::vector GetMultiplicities(); - int GetArmedIndex() { return mBrick->getArmedIndex(); } - bool Filter(uint64_t& mask, int& bit, CutBrick* brick, int index) override; + std::vector getMultiplicities(); + int getArmedIndex() { return mBrick->getArmedIndex(); } + bool filter(uint64_t& mask, int& bit, CutBrick* brick, int index) override; }; struct PileUpRejBrick : public ComplexBrickHelper { void initialize() override; std::vector mIndepVar = std::vector{}; - bool Filter(uint64_t& mask, int& bit, CutBrick* brick, int index) override; + bool filter(uint64_t& mask, int& bit, CutBrick* brick, int index) override; }; static bool filterBrickValue(uint64_t& mask, int& bit, CutBrick* brick, float value); - void ConstructCutFromString(const TString&); + void constructCutFromString(const TString&); template - void StoreMultiplicities(CollisionToFilter const&, AssociatedTracks const&); - int CalculateMaskLength() override; - void StoreArmedMask() override; + void storeMultiplicities(CollisionToFilter const&, AssociatedTracks const&); + int calculateMaskLength() override; + void storeArmedMask() override; std::vector*> mBFieldSelection; //! the magnetic field selection cuts MultiplicityBrick* mMultiplicityClasses; //! the multiplicity classes cuts @@ -126,7 +130,7 @@ class EventSelectionFilterAndAnalysis : public SelectionFilterAndAnalysis /// \brief Stores the different multiplicities needed for proper collision filtering /// TODO: perhaps in a next iteration check if some storage can be removed template -inline void EventSelectionFilterAndAnalysis::StoreMultiplicities(CollisionToFilter const& col, AssociatedTracks const& tracks) +inline void EventSelectionFilterAndAnalysis::storeMultiplicities(CollisionToFilter const& col, AssociatedTracks const& tracks) { /* store the collision multiplicities for the different estimators */ /* TODO: we need to adapt this to the Run 3 scenario */ @@ -141,8 +145,10 @@ inline void EventSelectionFilterAndAnalysis::StoreMultiplicities(CollisionToFilt /* number of tracks with TPCout */ /* we require tracks with pT > 0.15 and |eta| < 0.8 and additionally the TPCout flag */ /* for the time being there is not TPCout flag, we just consider hasTPC */ - for (auto track : tracks) { - if (track.pt() > 0.15 and std::abs(track.eta()) < 0.8 and track.hasTPC()) { + constexpr float StandardMinPt = 0.15; + constexpr float StandardMaxEta = 0.8; + for (const auto& track : tracks) { + if (track.pt() > StandardMinPt && std::abs(track.eta()) < StandardMaxEta && track.hasTPC()) { ntracksTPCout++; } } @@ -160,8 +166,8 @@ inline void EventSelectionFilterAndAnalysis::StoreMultiplicities(CollisionToFilt inline bool EventSelectionFilterAndAnalysis::filterBrickValue(uint64_t& mask, int& bit, CutBrick* brick, float value) { bool atleastone = false; - std::vector res = brick->Filter(value); - for (auto b : res) { + std::vector res = brick->filter(value); + for (const auto& b : res) { if (b) { atleastone = true; SETBIT(mask, bit); @@ -171,39 +177,39 @@ inline bool EventSelectionFilterAndAnalysis::filterBrickValue(uint64_t& mask, in return atleastone; }; -inline bool EventSelectionFilterAndAnalysis::ComplexBrickHelper::Filter(uint64_t& mask, int& bit) +inline bool EventSelectionFilterAndAnalysis::ComplexBrickHelper::filter(uint64_t& mask, int& bit) { bool acceptcollision = true; if (mAlternateEstimatorIndex.size() > 0) { bool atleastonealternative = false; /* if (mBrick->IsA() != CutWithVariations::Class()) { - LOGF(fatal, "EventSelectionFilterAndAnalysis::Filter() expected class with variations cut but it is not there"); + LOGF(fatal, "EventSelectionFilterAndAnalysis::filter() expected class with variations cut but it is not there"); } */ /* first the default */ TList& deflst = dynamic_cast*>(mBrick)->getDefaultBricks(); - bool acc = Filter(mask, bit, (CutBrick*)deflst.At(0), mDefaultEstimatorIndex); + bool acc = filter(mask, bit, (CutBrick*)deflst.At(0), mDefaultEstimatorIndex); atleastonealternative = atleastonealternative || acc; /* and now the variants */ TList& varlst = dynamic_cast*>(mBrick)->getVariantBricks(); for (int i = 0; i < varlst.GetEntries(); ++i) { - bool acc = Filter(mask, bit, (CutBrick*)varlst.At(i), mAlternateEstimatorIndex[i]); + bool acc = filter(mask, bit, (CutBrick*)varlst.At(i), mAlternateEstimatorIndex[i]); atleastonealternative = atleastonealternative || acc; } acceptcollision = acceptcollision && atleastonealternative; } else { /* no alternative estimators, just the default */ - bool acc = Filter(mask, bit, mBrick, mDefaultEstimatorIndex); + bool acc = filter(mask, bit, mBrick, mDefaultEstimatorIndex); acceptcollision = acceptcollision && acc; } return acceptcollision; } -inline bool EventSelectionFilterAndAnalysis::MultiplicityBrick::Filter(uint64_t& mask, int& bit, CutBrick* brick, int index) +inline bool EventSelectionFilterAndAnalysis::MultiplicityBrick::filter(uint64_t& mask, int& bit, CutBrick* brick, int index) { return filterBrickValue(mask, bit, brick, mValues[index]); } -inline bool EventSelectionFilterAndAnalysis::PileUpRejBrick::Filter(uint64_t& mask, int& bit, CutBrick* brick, int index) +inline bool EventSelectionFilterAndAnalysis::PileUpRejBrick::filter(uint64_t& mask, int& bit, CutBrick* brick, int index) { brick->setIndependentFnVar(mIndepVar[index]); return filterBrickValue(mask, bit, brick, mValues[index]); @@ -211,9 +217,9 @@ inline bool EventSelectionFilterAndAnalysis::PileUpRejBrick::Filter(uint64_t& ma /// \brief Fills the filter cuts mask template -inline uint64_t EventSelectionFilterAndAnalysis::Filter(CollisionToFilter const& col, const AssociatedTracks& trks, int bfield) +inline uint64_t EventSelectionFilterAndAnalysis::filter(CollisionToFilter const& col, const AssociatedTracks& trks, int bfield) { - StoreMultiplicities(col, trks); + storeMultiplicities(col, trks); uint64_t selectedMask = 0UL; mSelectedMask = 0UL; int bit = 0; @@ -222,14 +228,14 @@ inline uint64_t EventSelectionFilterAndAnalysis::Filter(CollisionToFilter const& bool acceptcollision = true; if (mBFieldSelection.size() > 0) { bool oneatleast = false; - for (auto brick : mBFieldSelection) { + for (const auto& brick : mBFieldSelection) { bool acc = filterBrickValue(selectedMask, bit, brick, bfield); oneatleast = oneatleast || acc; } acceptcollision = acceptcollision && oneatleast; } if (mMultiplicityClasses != nullptr) { - bool acc = mMultiplicityClasses->ComplexBrickHelper::Filter(selectedMask, bit); + bool acc = mMultiplicityClasses->ComplexBrickHelper::filter(selectedMask, bit); acceptcollision = acceptcollision && acc; } if (mZVertex != nullptr) { @@ -237,10 +243,10 @@ inline uint64_t EventSelectionFilterAndAnalysis::Filter(CollisionToFilter const& acceptcollision = acceptcollision && acc; } if (mPileUpRejection != nullptr) { - bool acc = mPileUpRejection->ComplexBrickHelper::Filter(selectedMask, bit); + bool acc = mPileUpRejection->ComplexBrickHelper::filter(selectedMask, bit); acceptcollision = acceptcollision && acc; } - LOGF(debug, "EventSelectionFilterAndAnalysis::Filter(), %s collision", acceptcollision ? "accepted" : "rejected"); + LOGF(debug, "EventSelectionFilterAndAnalysis::filter(), %s collision", acceptcollision ? "accepted" : "rejected"); if (acceptcollision) { mSelectedMask = selectedMask; } @@ -248,7 +254,7 @@ inline uint64_t EventSelectionFilterAndAnalysis::Filter(CollisionToFilter const& } /// \brief Fills the filter cuts mask -inline std::vector EventSelectionFilterAndAnalysis::MultiplicityBrick::GetMultiplicities() +inline std::vector EventSelectionFilterAndAnalysis::MultiplicityBrick::getMultiplicities() { std::vector res; @@ -267,7 +273,7 @@ inline std::vector EventSelectionFilterAndAnalysis::MultiplicityBrick::Ge return res; } -} // namespace PWGCF +} // namespace pwgcf } // namespace analysis } // namespace o2 diff --git a/PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.cxx b/PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.cxx index f51f78239a7..86c38ca64f8 100644 --- a/PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.cxx +++ b/PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.cxx @@ -9,6 +9,11 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file FilterAndAnalysisFramework.cxx +/// \brief Implementation of the FilterAndAnalysisFramework class for +/// filtering collisions for derived data production +/// \author victor.gonzalez.sebastian@gmail.com + #include "FilterAndAnalysisFramework.h" #include "PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h" @@ -34,7 +39,7 @@ #include using namespace o2; -using namespace o2::analysis::PWGCF; +using namespace o2::analysis::pwgcf; ClassImp(FilterAndAnalysisFramework); @@ -48,26 +53,26 @@ FilterAndAnalysisFramework::FilterAndAnalysisFramework() fTrackFilter(nullptr), fEventFilter(nullptr), fPIDFilter(nullptr), - _fTrackFilter(nullptr), - _fEventFilter(nullptr), - _fPIDFilter(nullptr) + tmpTrackFilter(nullptr), + tmpEventFilter(nullptr), + tmpPIDFilter(nullptr) { } /// \brief Named constructor for a concrete operating mode -void FilterAndAnalysisFramework::SetConfiguration(EventSelectionConfigurable& evtf, TrackSelectionConfigurable& trkf, PIDSelectionConfigurable& pidf, SelectionFilterAndAnalysis::selmodes mode) +void FilterAndAnalysisFramework::setConfiguration(EventSelectionConfigurable& evtf, TrackSelectionConfigurable& trkf, PIDSelectionConfigurable& pidf, SelectionFilterAndAnalysis::Selmodes mode) { - _fTrackFilter = new PWGCF::TrackSelectionFilterAndAnalysis(trkf, mode); - _fEventFilter = new PWGCF::EventSelectionFilterAndAnalysis(evtf, mode); - _fPIDFilter = new PWGCF::PIDSelectionFilterAndAnalysis(pidf, mode); + tmpTrackFilter = new pwgcf::TrackSelectionFilterAndAnalysis(trkf, mode); + tmpEventFilter = new pwgcf::EventSelectionFilterAndAnalysis(evtf, mode); + tmpPIDFilter = new pwgcf::PIDSelectionFilterAndAnalysis(pidf, mode); } -void FilterAndAnalysisFramework::RegisterConfiguration() +void FilterAndAnalysisFramework::registerConfiguration() { LOGF(info, "Registering configuration into CCDB for date %s", filterdate.data()); /* sanity checks */ - if (_fTrackFilter == nullptr || _fEventFilter == nullptr || _fPIDFilter == nullptr) { + if (tmpTrackFilter == nullptr || tmpEventFilter == nullptr || tmpPIDFilter == nullptr) { LOGF(fatal, "Configuration not stored yet, please use SetConfiguration(evtf, trkf, pidf, mode), or configuration already registered"); } if (fTrackFilter != nullptr || fEventFilter != nullptr || fPIDFilter != nullptr) { @@ -83,9 +88,9 @@ void FilterAndAnalysisFramework::RegisterConfiguration() if (ss.fail()) { LOGF(fatal, "Wrong skimming filter date format. Please use YYYYMMDD"); } - std::time_t time_stamp = mktime(&t); + std::time_t timeStamp = mktime(&t); /* and get it in ms */ - uint64_t timestamp = 1000 * time_stamp; + uint64_t timestamp = 1000 * timeStamp; /* let's prepare the sot and eot */ uint64_t sot = timestamp - (12 * 60 * 60 * 1000); /* the beginning of the day */ uint64_t eot = timestamp + (12 * 60 * 60 * 1000 - 1000); /* one second before the end of the day */ @@ -102,17 +107,17 @@ void FilterAndAnalysisFramework::RegisterConfiguration() TList* siglst = new TList(); siglst->SetOwner(); siglst->SetName("Skimming signatures"); - siglst->Add(new TObjString(_fEventFilter->getCutStringSignature().Data())); - siglst->Add(new TObjString(_fTrackFilter->getCutStringSignature().Data())); - siglst->Add(new TObjString(_fPIDFilter->getCutStringSignature().Data())); + siglst->Add(new TObjString(tmpEventFilter->getCutStringSignature().Data())); + siglst->Add(new TObjString(tmpTrackFilter->getCutStringSignature().Data())); + siglst->Add(new TObjString(tmpPIDFilter->getCutStringSignature().Data())); std::map metadata = {{"FilterDate", filterdate}}; ccdb->storeAsTFileAny(siglst, ccdbpath, metadata, sot, eot); - fEventFilter = _fEventFilter; - fTrackFilter = _fTrackFilter; - fPIDFilter = _fPIDFilter; - _fEventFilter = nullptr; - _fTrackFilter = nullptr; - _fPIDFilter = nullptr; + fEventFilter = tmpEventFilter; + fTrackFilter = tmpTrackFilter; + fPIDFilter = tmpPIDFilter; + tmpEventFilter = nullptr; + tmpTrackFilter = nullptr; + tmpPIDFilter = nullptr; }; if (signatures != nullptr) { @@ -120,7 +125,7 @@ void FilterAndAnalysisFramework::RegisterConfiguration() auto domatch = [&signatures](int index, auto filter) { return (strcmp(signatures->At(index)->GetName(), filter->getCutStringSignature().Data()) == 0); }; - if (domatch(0, _fEventFilter) && domatch(1, _fTrackFilter) && domatch(2, _fPIDFilter)) { + if (domatch(0, tmpEventFilter) && domatch(1, tmpTrackFilter) && domatch(2, tmpPIDFilter)) { /* signatures match so configuration already registered and available for skimming and/or analysis */ LOGF(info, "Filter signatures already registered in the CCDB. You can proceed with the skimming and/or analysis"); } else { @@ -144,12 +149,12 @@ void FilterAndAnalysisFramework::RegisterConfiguration() } } -void FilterAndAnalysisFramework::Init() +void FilterAndAnalysisFramework::init() { LOGF(info, "Initializing filter configuration from date %s", filterdate.data()); /* sanity checks */ - if (_fTrackFilter == nullptr || _fEventFilter == nullptr || _fPIDFilter == nullptr) { + if (tmpTrackFilter == nullptr || tmpEventFilter == nullptr || tmpPIDFilter == nullptr) { LOGF(fatal, "Configuration not stored yet, please use SetConfiguration(evtf, trkf, pidf, mode, force), or configuration already initalized"); } if (fTrackFilter != nullptr || fEventFilter != nullptr || fPIDFilter != nullptr) { @@ -165,9 +170,9 @@ void FilterAndAnalysisFramework::Init() if (ss.fail()) { LOGF(fatal, "Wrong skimming filter date format. Please use YYYYMMDD"); } - std::time_t time_stamp = mktime(&t); + std::time_t timeStamp = mktime(&t); /* and get it in ms */ - uint64_t timestamp = 1000 * time_stamp; + uint64_t timestamp = 1000 * timeStamp; /* get access to the CCDB */ o2::ccdb::BasicCCDBManager* ccdbm = &o2::ccdb::BasicCCDBManager::instance(); @@ -186,15 +191,15 @@ void FilterAndAnalysisFramework::Init() signatures->At(index)->GetName(), filter->getCutStringSignature().Data()); return (strcmp(signatures->At(index)->GetName(), filter->getCutStringSignature().Data()) == 0); }; - if (domatch(0, _fEventFilter) && domatch(1, _fTrackFilter) && domatch(2, _fPIDFilter)) { + if (domatch(0, tmpEventFilter) && domatch(1, tmpTrackFilter) && domatch(2, tmpPIDFilter)) { /* signatures match the configuration proceed with skimming and/or analysis */ LOGF(info, "Filter signatures registered in the CCDB. Proceeding with the skimming and/or analysis"); - fEventFilter = _fEventFilter; - fTrackFilter = _fTrackFilter; - fPIDFilter = _fPIDFilter; - _fEventFilter = nullptr; - _fTrackFilter = nullptr; - _fPIDFilter = nullptr; + fEventFilter = tmpEventFilter; + fTrackFilter = tmpTrackFilter; + fPIDFilter = tmpPIDFilter; + tmpEventFilter = nullptr; + tmpTrackFilter = nullptr; + tmpPIDFilter = nullptr; } else { /* signatures don't match the version on the CCDB */ LOGF(fatal, diff --git a/PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.h b/PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.h index c4a1a2f9f93..e4da0278515 100644 --- a/PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.h +++ b/PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.h @@ -9,6 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file FilterAndAnalysisFramework.h +/// \brief FilterAndAnalysisFramework class for filtering collisions for derived data production +/// \author victor.gonzalez.sebastian@gmail.com + #ifndef PWGCF_TWOPARTICLECORRELATIONS_CORE_FILTERANDANALYSISFRAMEWORK_H_ #define PWGCF_TWOPARTICLECORRELATIONS_CORE_FILTERANDANALYSISFRAMEWORK_H_ @@ -30,7 +34,7 @@ namespace o2 { namespace analysis { -namespace PWGCF +namespace pwgcf { /// \brief Base class for filter and selection once filetered @@ -43,13 +47,13 @@ class FilterAndAnalysisFramework : public TNamed FilterAndAnalysisFramework(std::string& url, std::string& path, std::string& date, bool force = false) : ccdburl(url), ccdbpath(path), filterdate(date), forceupdate(force) {} - void SetConfiguration(EventSelectionConfigurable&, TrackSelectionConfigurable&, PIDSelectionConfigurable&, SelectionFilterAndAnalysis::selmodes mode); + void setConfiguration(EventSelectionConfigurable&, TrackSelectionConfigurable&, PIDSelectionConfigurable&, SelectionFilterAndAnalysis::Selmodes mode); protected: - void RegisterConfiguration(); + void registerConfiguration(); public: - void Init(); + void init(); /// \brief get the valid (armed) mask associated to the configuration of the different objects /// \return the corresponding armed mask @@ -76,22 +80,22 @@ class FilterAndAnalysisFramework : public TNamed uint64_t getPIDForcedMask() { return fPIDFilter->getForcedMask(); } /// \brief filter the different objects template - uint64_t FilterCollision(CollisionToFilter const& col, AssociatedTracks const& trks, int bfield) + uint64_t filterCollision(CollisionToFilter const& col, AssociatedTracks const& trks, int bfield) { - return fEventFilter->Filter(col, trks, bfield); + return fEventFilter->filter(col, trks, bfield); } template - uint64_t FilterTrack(TrackToFilter const& track) + uint64_t filterTrack(TrackToFilter const& track) { - return fTrackFilter->Filter(track); + return fTrackFilter->filter(track); } template - uint64_t FilterTrackPID(TrackToFilter const& track) + uint64_t filterTrackPID(TrackToFilter const& track) { - return fPIDFilter->Filter(track); + return fPIDFilter->filter(track); } /// \brief get the event multiplicities - std::vector GetCollisionMultiplicities() { return fEventFilter->GetMultiplicities(); } + std::vector getCollisionMultiplicities() { return fEventFilter->getMultiplicities(); } /// \brief Gets the index of the active multiplicity value within the multiplicities array int getCollisionMultiplicityIndex() { return fEventFilter->getMultiplicityIndex(); } @@ -105,19 +109,19 @@ class FilterAndAnalysisFramework : public TNamed std::string ccdbpath = ""; std::string filterdate = ""; bool forceupdate = false; - PWGCF::TrackSelectionFilterAndAnalysis* fTrackFilter = nullptr; /// the track filter - PWGCF::EventSelectionFilterAndAnalysis* fEventFilter = nullptr; /// the event filter - PWGCF::PIDSelectionFilterAndAnalysis* fPIDFilter = nullptr; /// the PID filter - PWGCF::TrackSelectionFilterAndAnalysis* _fTrackFilter = nullptr; /// the track filter temporal storage until initialized - PWGCF::EventSelectionFilterAndAnalysis* _fEventFilter = nullptr; /// the event filter temporal storage until initialized - PWGCF::PIDSelectionFilterAndAnalysis* _fPIDFilter = nullptr; /// the PID filter temporal storage until initialized + pwgcf::TrackSelectionFilterAndAnalysis* fTrackFilter = nullptr; /// the track filter + pwgcf::EventSelectionFilterAndAnalysis* fEventFilter = nullptr; /// the event filter + pwgcf::PIDSelectionFilterAndAnalysis* fPIDFilter = nullptr; /// the PID filter + pwgcf::TrackSelectionFilterAndAnalysis* tmpTrackFilter = nullptr; /// the track filter temporal storage until initialized + pwgcf::EventSelectionFilterAndAnalysis* tmpEventFilter = nullptr; /// the event filter temporal storage until initialized + pwgcf::PIDSelectionFilterAndAnalysis* tmpPIDFilter = nullptr; /// the PID filter temporal storage until initialized ClassDefNV(FilterAndAnalysisFramework, 1) }; -extern void registerConfiguration(o2::analysis::PWGCF::FilterAndAnalysisFramework*); +extern void registerConfiguration(o2::analysis::pwgcf::FilterAndAnalysisFramework*); -} // namespace PWGCF +} // namespace pwgcf } // namespace analysis } // namespace o2 diff --git a/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.cxx b/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.cxx index 3e1c7419742..0c77478de13 100644 --- a/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.cxx +++ b/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.cxx @@ -9,6 +9,11 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file PIDSelectionFilterAndAnalysis.cxx +/// \brief Implementation of the PIDSelectionFilterAndAnalysis class for +/// PID filtering tracks for derived data production +/// \author victor.gonzalez.sebastian@gmail.com + #include "PIDSelectionFilterAndAnalysis.h" #include "PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.h" @@ -32,7 +37,7 @@ #include using namespace o2; -using namespace o2::analysis::PWGCF; +using namespace o2::analysis::pwgcf; using namespace boost; #ifdef INCORPORATEBAYESIANPID @@ -43,21 +48,21 @@ PIDSelectionConfigurable::PIDSelectionConfigurable(std::vector pidt PIDSelectionConfigurable::PIDSelectionConfigurable(std::vector pidtpcel, std::vector pidtpcmu, std::vector pidtpcpi, std::vector pidtpcka, std::vector pidtpcpr, std::vector pidtofel, std::vector pidtofmu, std::vector pidtofpi, std::vector pidtofka, std::vector pidtofpr) #endif - : mPidTpcSel_el{}, - mPidTpcSel_mu{}, - mPidTpcSel_pi{}, - mPidTpcSel_ka{}, - mPidTpcSel_pr{}, - mPidTofSel_el{}, - mPidTofSel_mu{}, - mPidTofSel_pi{}, - mPidTofSel_ka{}, - mPidTofSel_pr{}, - mPidBaySel_el{}, - mPidBaySel_mu{}, - mPidBaySel_pi{}, - mPidBaySel_ka{}, - mPidBaySel_pr{} + : mPidTpcSelEl{}, + mPidTpcSelMu{}, + mPidTpcSelPi{}, + mPidTpcSelKa{}, + mPidTpcSelPr{}, + mPidTofSelEl{}, + mPidTofSelMu{}, + mPidTofSelPi{}, + mPidTofSelKa{}, + mPidTofSelPr{}, + mPidBaySelEl{}, + mPidBaySelMu{}, + mPidBaySelPi{}, + mPidBaySelKa{}, + mPidBaySelPr{} { auto storeCutString = [](auto& selvector, const std::string& selname) { if (selvector.size() != 0) { @@ -89,22 +94,22 @@ PIDSelectionConfigurable::PIDSelectionConfigurable(std::vector pidt } return TString(""); }; - mPidTpcSel_el = storeCutString(pidtpcel, "tpcel"); - mPidTpcSel_mu = storeCutString(pidtpcmu, "tpcmu"); - mPidTpcSel_pi = storeCutString(pidtpcpi, "tpcpi"); - mPidTpcSel_ka = storeCutString(pidtpcka, "tpcka"); - mPidTpcSel_pr = storeCutString(pidtpcpr, "tpcpr"); - mPidTofSel_el = storeCutString(pidtofel, "tofel"); - mPidTofSel_mu = storeCutString(pidtofmu, "tofmu"); - mPidTofSel_pi = storeCutString(pidtofpi, "tofpi"); - mPidTofSel_ka = storeCutString(pidtofka, "tofka"); - mPidTofSel_pr = storeCutString(pidtofpr, "tofpr"); + mPidTpcSelEl = storeCutString(pidtpcel, "tpcel"); + mPidTpcSelMu = storeCutString(pidtpcmu, "tpcmu"); + mPidTpcSelPi = storeCutString(pidtpcpi, "tpcpi"); + mPidTpcSelKa = storeCutString(pidtpcka, "tpcka"); + mPidTpcSelPr = storeCutString(pidtpcpr, "tpcpr"); + mPidTofSelEl = storeCutString(pidtofel, "tofel"); + mPidTofSelMu = storeCutString(pidtofmu, "tofmu"); + mPidTofSelPi = storeCutString(pidtofpi, "tofpi"); + mPidTofSelKa = storeCutString(pidtofka, "tofka"); + mPidTofSelPr = storeCutString(pidtofpr, "tofpr"); #ifdef INCORPORATEBAYESIANPID - mPidBaySel_el = storeCutString(pidbayel, "bayel"); - mPidBaySel_mu = storeCutString(pidbaymu, "baymu"); - mPidBaySel_pi = storeCutString(pidbaypi, "baypi"); - mPidBaySel_ka = storeCutString(pidbayka, "bayka"); - mPidBaySel_pr = storeCutString(pidbaypr, "baypr"); + mPidBaySelEl = storeCutString(pidbayel, "bayel"); + mPidBaySelMu = storeCutString(pidbaymu, "baymu"); + mPidBaySelPi = storeCutString(pidbaypi, "baypi"); + mPidBaySelKa = storeCutString(pidbayka, "bayka"); + mPidBaySelPr = storeCutString(pidbaypr, "baypr"); #endif } @@ -126,7 +131,7 @@ PIDSelectionFilterAndAnalysis::PIDSelectionFilterAndAnalysis() } /// \brief Constructor from regular expression -PIDSelectionFilterAndAnalysis::PIDSelectionFilterAndAnalysis(const TString& cutstr, selmodes mode) +PIDSelectionFilterAndAnalysis::PIDSelectionFilterAndAnalysis(const TString& cutstr, Selmodes mode) : SelectionFilterAndAnalysis("", mode), mPTOF(0.8f), mRequireTOF(false), @@ -135,11 +140,11 @@ PIDSelectionFilterAndAnalysis::PIDSelectionFilterAndAnalysis(const TString& cuts mCloseNsigmasTOF(kNoOfSpecies, nullptr), mBayesProbability(kNoOfSpecies, nullptr) { - ConstructCutFromString(cutstr); + constructCutFromString(cutstr); } /// \brief Constructor from the PID selection configurable -PIDSelectionFilterAndAnalysis::PIDSelectionFilterAndAnalysis(const PIDSelectionConfigurable& pidsel, selmodes mode) +PIDSelectionFilterAndAnalysis::PIDSelectionFilterAndAnalysis(const PIDSelectionConfigurable& pidsel, Selmodes mode) : SelectionFilterAndAnalysis("", mode), mPTOF(0.8f), mRequireTOF(false), @@ -150,6 +155,7 @@ PIDSelectionFilterAndAnalysis::PIDSelectionFilterAndAnalysis(const PIDSelectionC { TString cutString = "pidsel{"; bool first = true; + constexpr int MaxLength = 64; auto appendCut = [&cutString, &first](const std::string& str) { if (str.size() > 0) { @@ -163,34 +169,34 @@ PIDSelectionFilterAndAnalysis::PIDSelectionFilterAndAnalysis(const PIDSelectionC }; cutString += "tpcsel{"; first = true; - appendCut(pidsel.mPidTpcSel_el); - appendCut(pidsel.mPidTpcSel_mu); - appendCut(pidsel.mPidTpcSel_pi); - appendCut(pidsel.mPidTpcSel_ka); - appendCut(pidsel.mPidTpcSel_pr); + appendCut(pidsel.mPidTpcSelEl); + appendCut(pidsel.mPidTpcSelMu); + appendCut(pidsel.mPidTpcSelPi); + appendCut(pidsel.mPidTpcSelKa); + appendCut(pidsel.mPidTpcSelPr); cutString += "},tofsel{"; first = true; - appendCut(pidsel.mPidTofSel_el); - appendCut(pidsel.mPidTofSel_mu); - appendCut(pidsel.mPidTofSel_pi); - appendCut(pidsel.mPidTofSel_ka); - appendCut(pidsel.mPidTofSel_pr); + appendCut(pidsel.mPidTofSelEl); + appendCut(pidsel.mPidTofSelMu); + appendCut(pidsel.mPidTofSelPi); + appendCut(pidsel.mPidTofSelKa); + appendCut(pidsel.mPidTofSelPr); cutString += "},baysel{"; first = true; - appendCut(pidsel.mPidBaySel_el); - appendCut(pidsel.mPidBaySel_mu); - appendCut(pidsel.mPidBaySel_pi); - appendCut(pidsel.mPidBaySel_ka); - appendCut(pidsel.mPidBaySel_pr); + appendCut(pidsel.mPidBaySelEl); + appendCut(pidsel.mPidBaySelMu); + appendCut(pidsel.mPidBaySelPi); + appendCut(pidsel.mPidBaySelKa); + appendCut(pidsel.mPidBaySelPr); cutString += "}}"; - ConstructCutFromString(cutString); - if (mMaskLength > 64) { - LOGF(fatal, "EventSelectionFilterAndAnalysis not ready for filter mask of %d bits. Just 64 available for the time being", mMaskLength); + constructCutFromString(cutString); + if (mMaskLength > MaxLength) { + LOGF(fatal, "EventSelectionFilterAndAnalysis not ready for filter mask of %d bits. Just %d available for the time being", mMaskLength, MaxLength); } mCutStringSignature = cutString.ReplaceAll("-yes", "").ReplaceAll("-no", ""); - if (mode == kAnalysis) { - StoreArmedMask(); + if (mode == KAnalysis) { + storeArmedMask(); } } @@ -198,25 +204,25 @@ PIDSelectionFilterAndAnalysis::PIDSelectionFilterAndAnalysis(const PIDSelectionC /// Releases the taken memory PIDSelectionFilterAndAnalysis::~PIDSelectionFilterAndAnalysis() { - for (auto brick : mCloseNsigmasTPC) { + for (const auto& brick : mCloseNsigmasTPC) { delete brick; } - for (auto brick : mCloseNsigmasTOF) { + for (const auto& brick : mCloseNsigmasTOF) { delete brick; } - for (auto brick : mBayesProbability) { + for (const auto& brick : mBayesProbability) { delete brick; } } /// \brief Calculates the length of the mask needed to store the selection cuts -int PIDSelectionFilterAndAnalysis::CalculateMaskLength() +int PIDSelectionFilterAndAnalysis::calculateMaskLength() { int length = 0; auto addLength = [&](const auto& bricklst) { - for (auto brick : bricklst) { + for (const auto& brick : bricklst) { if (brick != nullptr) { - length += brick->Length(); + length += brick->length(); } } }; @@ -226,7 +232,7 @@ int PIDSelectionFilterAndAnalysis::CalculateMaskLength() return length; } -void PIDSelectionFilterAndAnalysis::ConstructCutFromString(const TString& cutstr) +void PIDSelectionFilterAndAnalysis::constructCutFromString(const TString& cutstr) { LOGF(info, "Cut string: %s", cutstr.Data()); /* let's catch the first level */ @@ -235,7 +241,8 @@ void PIDSelectionFilterAndAnalysis::ConstructCutFromString(const TString& cutstr smatch m; bool res = regex_search(in, m, cutregex); - if (not res or m.empty() or (m.size() > 2)) { + constexpr int MaxComponents = 2; + if (not res or m.empty() or (m.size() > MaxComponents)) { Fatal("PIDSelectionFilterAndAnalysis::::ConstructCutFromString", "Wrong RE: %s, try pidsel{tpcsel{tpcpi{cwv{rg{-3.0,3.0}:rg{-2.0,2.0},rg{-3.0,5.0}}}}} for instance", cutstr.Data()); } this->SetName("EventSelectionFilterAndAnalysisCuts"); @@ -256,8 +263,8 @@ void PIDSelectionFilterAndAnalysis::ConstructCutFromString(const TString& cutstr std::string in(lev2str.Data()); smatch m; bool res = regex_search(in, m, cutregex); - - if (not res or m.empty() or (m.size() != 3)) { + constexpr int ExpectedComponents = 3; + if (not res or m.empty() or (m.size() != ExpectedComponents)) { LOGF(fatal, "PIDSelectionFilterAndAnalysis::::ConstructCutFromString. Wrong RE: %s, try pidsel{tpcsel{tpcpi{cwv{rg{-3.0,3.0}:rg{-2.0,2.0},rg{-3.0,5.0}}}}} for instance", cutstr.Data()); } LOGF(info, "Captured %s", m[1].str().c_str()); @@ -281,7 +288,7 @@ void PIDSelectionFilterAndAnalysis::ConstructCutFromString(const TString& cutstr } std::string in3l(lev3str.Data()); bool res3l = regex_search(in3l, m3l, cutregex3l); - if (not res3l or m3l.empty() or (m3l.size() != 3)) { + if (not res3l or m3l.empty() or (m3l.size() != ExpectedComponents)) { LOGF(fatal, "PIDSelectionFilterAndAnalysis::::ConstructCutFromString. Wrong RE for detector %s: %s, try tpcpi{cwv{rg{-3.0,3.0}:rg{-2.0,2.0},rg{-3.0,5.0}}} for instance", detector.c_str(), cut.c_str()); } LOGF(info, "Captured %s", m3l[1].str().c_str()); @@ -317,10 +324,10 @@ void PIDSelectionFilterAndAnalysis::ConstructCutFromString(const TString& cutstr lev2str.Remove(0, m[0].length()); } } - mMaskLength = CalculateMaskLength(); + mMaskLength = calculateMaskLength(); } -void PIDSelectionFilterAndAnalysis::StoreArmedMask() +void PIDSelectionFilterAndAnalysis::storeArmedMask() { uint64_t armedMask = 0UL; uint64_t optMask = 0UL; @@ -332,8 +339,8 @@ void PIDSelectionFilterAndAnalysis::StoreArmedMask() auto armedList = [&](const auto& bricklst) { auto armedBrick = [&](auto brick, bool opt = false) { if (brick != nullptr) { - std::vector res = brick->IsArmed(); - for (auto b : res) { + std::vector res = brick->isArmed(); + for (const auto& b : res) { if (b) { SETBIT(armedMask, bit); if (opt) { @@ -346,7 +353,7 @@ void PIDSelectionFilterAndAnalysis::StoreArmedMask() } } }; - for (auto brick : bricklst) { + for (const auto& brick : bricklst) { armedBrick(brick, false); } }; diff --git a/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.h b/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.h index 7cf25ff5d6a..553d2af995f 100644 --- a/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.h +++ b/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.h @@ -9,6 +9,11 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file PIDSelectionFilterAndAnalysis.h +/// \brief PIDSelectionFilterAndAnalysis class for PID filtering tracks +/// for derived data production +/// \author victor.gonzalez.sebastian@gmail.com + #ifndef PWGCF_TWOPARTICLECORRELATIONS_CORE_PIDSELECTIONFILTERANDANALYSIS_H_ #define PWGCF_TWOPARTICLECORRELATIONS_CORE_PIDSELECTIONFILTERANDANALYSIS_H_ @@ -30,7 +35,7 @@ namespace o2 { namespace analysis { -namespace PWGCF +namespace pwgcf { /* forward declaration */ class PIDSelectionFilterAndAnalysis; @@ -45,7 +50,7 @@ class PIDSelectionConfigurable PIDSelectionConfigurable(std::string pidtpcel = "", std::string pidtpcmu = "", std::string pidtpcpi = "", std::string pidtpcka = "", std::string pidtpcpr = "", std::string pidtofel = "", std::string pidtofmu = "", std::string pidtofpi = "", std::string pidtofka = "", std::string pidtofpr = "", std::string pidbayel = "", std::string pidbaymu = "", std::string pidbaypi = "", std::string pidbayka = "", std::string pidbaypr = "") - : mPidTpcSel_el{pidtpcel}, mPidTpcSel_mu{pidtpcmu}, mPidTpcSel_pi{pidtpcpi}, mPidTpcSel_ka{pidtpcka}, mPidTpcSel_pr{pidtpcpr}, mPidTofSel_el{pidtofel}, mPidTofSel_mu{pidtofmu}, mPidTofSel_pi{pidtofpi}, mPidTofSel_ka{pidtofka}, mPidTofSel_pr{pidtofpr}, mPidBaySel_el{pidbayel}, mPidBaySel_mu{pidbaymu}, mPidBaySel_pi{pidbaypi}, mPidBaySel_ka{pidbayka}, mPidBaySel_pr{pidbaypr} + : mPidTpcSelEl{pidtpcel}, mPidTpcSelMu{pidtpcmu}, mPidTpcSelPi{pidtpcpi}, mPidTpcSelKa{pidtpcka}, mPidTpcSelPr{pidtpcpr}, mPidTofSelEl{pidtofel}, mPidTofSelMu{pidtofmu}, mPidTofSelPi{pidtofpi}, mPidTofSelKa{pidtofka}, mPidTofSelPr{pidtofpr}, mPidBaySelEl{pidbayel}, mPidBaySelMu{pidbaymu}, mPidBaySelPi{pidbaypi}, mPidBaySelKa{pidbayka}, mPidBaySelPr{pidbaypr} { } PIDSelectionConfigurable(std::vector pidtpcel, std::vector pidtpcmu, std::vector pidtpcpi, std::vector pidtpcka, std::vector pidtpcpr, @@ -54,16 +59,16 @@ class PIDSelectionConfigurable #else PIDSelectionConfigurable(std::string pidtpcel = "", std::string pidtpcmu = "", std::string pidtpcpi = "", std::string pidtpcka = "", std::string pidtpcpr = "", std::string pidtofel = "", std::string pidtofmu = "", std::string pidtofpi = "", std::string pidtofka = "", std::string pidtofpr = "") - : mPidTpcSel_el{std::move(pidtpcel)}, - mPidTpcSel_mu{std::move(pidtpcmu)}, - mPidTpcSel_pi{std::move(pidtpcpi)}, - mPidTpcSel_ka{std::move(pidtpcka)}, - mPidTpcSel_pr{std::move(pidtpcpr)}, - mPidTofSel_el{std::move(pidtofel)}, - mPidTofSel_mu{std::move(pidtofmu)}, - mPidTofSel_pi{std::move(pidtofpi)}, - mPidTofSel_ka{std::move(pidtofka)}, - mPidTofSel_pr{std::move(pidtofpr)} + : mPidTpcSelEl{std::move(pidtpcel)}, + mPidTpcSelMu{std::move(pidtpcmu)}, + mPidTpcSelPi{std::move(pidtpcpi)}, + mPidTpcSelKa{std::move(pidtpcka)}, + mPidTpcSelPr{std::move(pidtpcpr)}, + mPidTofSelEl{std::move(pidtofel)}, + mPidTofSelMu{std::move(pidtofmu)}, + mPidTofSelPi{std::move(pidtofpi)}, + mPidTofSelKa{std::move(pidtofka)}, + mPidTofSelPr{std::move(pidtofpr)} { } PIDSelectionConfigurable(std::vector pidtpcel, std::vector pidtpcmu, std::vector pidtpcpi, std::vector pidtpcka, std::vector pidtpcpr, @@ -71,21 +76,21 @@ class PIDSelectionConfigurable #endif private: - std::string mPidTpcSel_el = ""; - std::string mPidTpcSel_mu = ""; - std::string mPidTpcSel_pi = ""; - std::string mPidTpcSel_ka = ""; - std::string mPidTpcSel_pr = ""; - std::string mPidTofSel_el = ""; - std::string mPidTofSel_mu = ""; - std::string mPidTofSel_pi = ""; - std::string mPidTofSel_ka = ""; - std::string mPidTofSel_pr = ""; - std::string mPidBaySel_el = ""; - std::string mPidBaySel_mu = ""; - std::string mPidBaySel_pi = ""; - std::string mPidBaySel_ka = ""; - std::string mPidBaySel_pr = ""; + std::string mPidTpcSelEl = ""; + std::string mPidTpcSelMu = ""; + std::string mPidTpcSelPi = ""; + std::string mPidTpcSelKa = ""; + std::string mPidTpcSelPr = ""; + std::string mPidTofSelEl = ""; + std::string mPidTofSelMu = ""; + std::string mPidTofSelPi = ""; + std::string mPidTofSelKa = ""; + std::string mPidTofSelPr = ""; + std::string mPidBaySelEl = ""; + std::string mPidBaySelMu = ""; + std::string mPidBaySelPi = ""; + std::string mPidBaySelKa = ""; + std::string mPidBaySelPr = ""; private: ClassDefNV(PIDSelectionConfigurable, 1); @@ -96,16 +101,16 @@ class PIDSelectionFilterAndAnalysis : public SelectionFilterAndAnalysis { public: PIDSelectionFilterAndAnalysis(); - PIDSelectionFilterAndAnalysis(const TString&, selmodes); - PIDSelectionFilterAndAnalysis(const PIDSelectionConfigurable& pidsel, selmodes mode); + PIDSelectionFilterAndAnalysis(const TString&, Selmodes); + PIDSelectionFilterAndAnalysis(const PIDSelectionConfigurable& pidsel, Selmodes mode); ~PIDSelectionFilterAndAnalysis() override; - void SetPTOF(float ptof) { mPTOF = ptof; } - void SetRequireTOF(bool requiretof = false) { mRequireTOF = requiretof; } - void SetEllipticTPCTOF(bool elliptic = false) { mEllipticTPCTOF = elliptic; } + void setPTOF(float ptof) { mPTOF = ptof; } + void setRequireTOF(bool requiretof = false) { mRequireTOF = requiretof; } + void setEllipticTPCTOF(bool elliptic = false) { mEllipticTPCTOF = elliptic; } template - uint64_t Filter(TrackToFilter const& track); + uint64_t filter(TrackToFilter const& track); enum PIDSpecies { kElectron = 0, ///< electron @@ -132,9 +137,9 @@ class PIDSelectionFilterAndAnalysis : public SelectionFilterAndAnalysis static const std::vector mSpeciesNames; private: - void ConstructCutFromString(const TString&); - int CalculateMaskLength() override; - void StoreArmedMask() override; + void constructCutFromString(const TString&); + int calculateMaskLength() override; + void storeArmedMask() override; float mPTOF = 0.8f; ///< the p threshold for cheking TOF information bool mRequireTOF = false; ///< is TOF required @@ -150,7 +155,7 @@ class PIDSelectionFilterAndAnalysis : public SelectionFilterAndAnalysis /// \brief Fills the filter cuts mask template -inline uint64_t PIDSelectionFilterAndAnalysis::Filter(TrackToFilter const& track) +inline uint64_t PIDSelectionFilterAndAnalysis::filter(TrackToFilter const& track) { uint64_t selectedMask = 0UL; mSelectedMask = 0UL; @@ -158,8 +163,8 @@ inline uint64_t PIDSelectionFilterAndAnalysis::Filter(TrackToFilter const& track auto filterBrickValue = [&](auto brick, auto value) { if (brick != nullptr) { - std::vector res = brick->Filter(value); - for (auto b : res) { + std::vector res = brick->filter(value); + for (const auto& b : res) { if (b) { SETBIT(selectedMask, bit); } @@ -189,7 +194,7 @@ inline uint64_t PIDSelectionFilterAndAnalysis::Filter(TrackToFilter const& track return mSelectedMask; } -} // namespace PWGCF +} // namespace pwgcf } // namespace analysis } // namespace o2 diff --git a/PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.cxx b/PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.cxx index 2af7b649e7b..fb5ec83a366 100644 --- a/PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.cxx +++ b/PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.cxx @@ -9,6 +9,11 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file SelectionFilterAndAnalysis.cxx +/// \brief Implementation of the SelectionFilterAndAnalysis class for filter and selection +/// once filtered +/// \author victor.gonzalez.sebastian@gmail.com + #include "SelectionFilterAndAnalysis.h" #include @@ -18,14 +23,14 @@ #include using namespace o2; -using namespace o2::analysis::PWGCF; +using namespace o2::analysis::pwgcf; ClassImp(SelectionFilterAndAnalysis); /// \brief Default constructor SelectionFilterAndAnalysis::SelectionFilterAndAnalysis() : TNamed(), - mMode(kFilter), + mMode(KFilter), mCutStringSignature(), mMaskLength(0), mSelectedMask(0UL), @@ -36,7 +41,7 @@ SelectionFilterAndAnalysis::SelectionFilterAndAnalysis() } /// \brief Named constructor for a concrete operating mode -SelectionFilterAndAnalysis::SelectionFilterAndAnalysis(const TString& name, selmodes mode) +SelectionFilterAndAnalysis::SelectionFilterAndAnalysis(const TString& name, Selmodes mode) : TNamed(name, name), mMode(mode), mCutStringSignature(), @@ -52,7 +57,7 @@ TString SelectionFilterAndAnalysis::printOptionalMasks() const { TString str = "("; bool first = true; - for (auto option : mOptArmedMask) { + for (const auto& option : mOptArmedMask) { if (not first) { str += ", "; } diff --git a/PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.h b/PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.h index fad166337af..f623c3cfd62 100644 --- a/PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.h +++ b/PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.h @@ -9,6 +9,11 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file SelectionFilterAndAnalysis.h +/// \brief SelectionFilterAndAnalysis class for filter and selection +/// once filtered +/// \author victor.gonzalez.sebastian@gmail.com + #ifndef PWGCF_TWOPARTICLECORRELATIONS_CORE_SELECTIONFILTERANDANALYSIS_H_ #define PWGCF_TWOPARTICLECORRELATIONS_CORE_SELECTIONFILTERANDANALYSIS_H_ @@ -24,22 +29,22 @@ namespace o2 { namespace analysis { -namespace PWGCF +namespace pwgcf { /// \brief Base class for filter and selection once filetered class SelectionFilterAndAnalysis : public TNamed { public: - /// \enum selmodes + /// \enum Selmodes /// \brief the modes in which the selection can operate - enum selmodes { - kFilter = 0, ///< filter mode to produce skimmed data - kAnalysis ///< analysis mode over already skimmed data + enum Selmodes { + KFilter = 0, ///< filter mode to produce skimmed data + KAnalysis ///< analysis mode over already skimmed data }; SelectionFilterAndAnalysis(); - SelectionFilterAndAnalysis(const TString& name, selmodes mode); + SelectionFilterAndAnalysis(const TString& name, Selmodes mode); /// \brief get the valid (armed) mask associated to the configuration /// \return the armed mask @@ -59,11 +64,11 @@ class SelectionFilterAndAnalysis : public TNamed const TString& getCutStringSignature() { return mCutStringSignature; } private: - virtual int CalculateMaskLength() = 0; - virtual void StoreArmedMask() = 0; + virtual int calculateMaskLength() = 0; + virtual void storeArmedMask() = 0; protected: - selmodes mMode = kFilter; /// the operating mode of the selection instance + Selmodes mMode = KFilter; /// the operating mode of the selection instance TString mCutStringSignature; /// the signature of the cut string, i.e. without the alternative selection tags int mMaskLength = 0; /// the length of the mask needed to filter the selection cuts uint64_t mSelectedMask = 0UL; /// the selection mask for the current passed collision @@ -75,7 +80,7 @@ class SelectionFilterAndAnalysis : public TNamed ClassDefNV(SelectionFilterAndAnalysis, 1) }; -} // namespace PWGCF +} // namespace pwgcf } // namespace analysis } // namespace o2 diff --git a/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx b/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx index 56563c682ef..48434797ce2 100644 --- a/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx +++ b/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx @@ -9,6 +9,11 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file SkimmingConfigurableCuts.cxx +/// \brief Implementation of the set of Brick classes which configures the +/// derived data filtering framework +/// \author victor.gonzalez.sebastian@gmail.com + #include "PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.h" #include @@ -30,7 +35,7 @@ #include using namespace o2; -using namespace o2::analysis::PWGCF; +using namespace o2::analysis::pwgcf; /// \brief These are the implemented basic bricks /// If more are implemented the list must be expanded and the @@ -46,7 +51,7 @@ CutBrick* CutBrick::constructBrick(const char* n CutBrick* thebrick = nullptr; bool found = false; - for (auto& bname : allowed) { + for (const auto& bname : allowed) { if (TString(regex).BeginsWith(bname)) { found = true; break; @@ -130,7 +135,7 @@ CutBrickLimit::CutBrickLimit(const TString& cutstr) : CutBrick(), mLimit(TValueToFilter(0)) { - ConstructCutFromString(cutstr); + constructCutFromString(cutstr); } /// \brief Construct the cut from a cut string @@ -140,7 +145,7 @@ CutBrickLimit::CutBrickLimit(const TString& cutstr) /// If the cut string is correctly parsed the cut is correctly built /// if not a fatal exception is raised template -void CutBrickLimit::ConstructCutFromString(const TString& cutstr) +void CutBrickLimit::constructCutFromString(const TString& cutstr) { LOGF(info, "Cut string: %s", cutstr.Data()); @@ -149,8 +154,9 @@ void CutBrickLimit::ConstructCutFromString(const TString& cutstr std::smatch m; std::regex_search(in, m, cutregex); - if (m.empty() or (m.size() < 3)) { - LOGF(fatal, "CutBrickLimit::ConstructCutFromString", "Wrong RE: %s, use pT{lim{2.0}} for instance", cutstr.Data()); + constexpr int MinExpectedComponents = 3; + if (m.empty() or (m.size() < MinExpectedComponents)) { + LOGF(fatal, "CutBrickLimit::constructCutFromString", "Wrong RE: %s, use pT{lim{2.0}} for instance", cutstr.Data()); } else { this->SetName(m[1].str().c_str()); this->SetTitle(cutstr.Data()); @@ -161,7 +167,7 @@ void CutBrickLimit::ConstructCutFromString(const TString& cutstr /// \brief Returns wether the cut brick is incorporated in the selection chain /// \return true if the cut brick is incorporated template -std::vector CutBrickLimit::IsArmed() +std::vector CutBrickLimit::isArmed() { std::vector res; if (this->mMode == this->kSELECTED) { @@ -173,8 +179,8 @@ std::vector CutBrickLimit::IsArmed() } templateClassImp(CutBrickLimit); -template class o2::analysis::PWGCF::CutBrickLimit; -template class o2::analysis::PWGCF::CutBrickLimit; +template class o2::analysis::pwgcf::CutBrickLimit; +template class o2::analysis::pwgcf::CutBrickLimit; /////////////////////////////////////////////////////////////////////////////////////// /// Default constructor @@ -203,7 +209,7 @@ CutBrickFnLimit::CutBrickFnLimit(const TString& cutstr) : CutBrickLimit(), mFunction{} { - ConstructCutFromString(cutstr); + constructCutFromString(cutstr); } /// \brief Construct the cut from a cut string @@ -213,7 +219,7 @@ CutBrickFnLimit::CutBrickFnLimit(const TString& cutstr) /// If the cut string is correctly parsed the cut is correctly built /// if not a fatal exception is raised template -void CutBrickFnLimit::ConstructCutFromString(const TString& cutstr) +void CutBrickFnLimit::constructCutFromString(const TString& cutstr) { LOGF(info, "Cut string: %s", cutstr.Data()); @@ -222,21 +228,22 @@ void CutBrickFnLimit::ConstructCutFromString(const TString& cuts std::smatch m; std::regex_search(in, m, cutregex); - if (m.empty() or (m.size() < 4)) { - LOGF(fatal, "CutBrickFnLimit::ConstructCutFromString", "Wrong RE: %s, use pT{fnlim{myfn=2.0*sin(x)/x}} for instance", cutstr.Data()); + constexpr int MinExpectedComponents = 4; + if (m.empty() or (m.size() < MinExpectedComponents)) { + LOGF(fatal, "CutBrickFnLimit::constructCutFromString", "Wrong RE: %s, use pT{fnlim{myfn=2.0*sin(x)/x}} for instance", cutstr.Data()); } else { this->SetName(m[2].str().c_str()); this->SetTitle(cutstr.Data()); mFunction = TF1(m[1].str().c_str(), m[3].str().c_str(), 0, 1, TF1::EAddToList::kNo); if (not mFunction.IsValid()) { - LOGF(fatal, "CutBrickFnLimit::ConstructCutFromString", "Wrong function expression: %s, use pT{fnlim{myfn=2.0*sin(x)/x}} for instance", cutstr.Data()); + LOGF(fatal, "CutBrickFnLimit::constructCutFromString", "Wrong function expression: %s, use pT{fnlim{myfn=2.0*sin(x)/x}} for instance", cutstr.Data()); } } } templateClassImp(CutBrickFnLimit); -template class o2::analysis::PWGCF::CutBrickFnLimit; -template class o2::analysis::PWGCF::CutBrickFnLimit; +template class o2::analysis::pwgcf::CutBrickFnLimit; +template class o2::analysis::pwgcf::CutBrickFnLimit; /////////////////////////////////////////////////////////////////////////////////////// /// Default constructor @@ -264,7 +271,7 @@ CutBrickThreshold::CutBrickThreshold(const TString& cutstr) : CutBrick(), mThreshold(0) { - ConstructCutFromString(cutstr); + constructCutFromString(cutstr); } /// \brief Construct the cut from a cut string @@ -274,7 +281,7 @@ CutBrickThreshold::CutBrickThreshold(const TString& cutstr) /// If the cut string is correctly parsed the cut is correctly built /// if not a fatal exception is raised template -void CutBrickThreshold::ConstructCutFromString(const TString& cutstr) +void CutBrickThreshold::constructCutFromString(const TString& cutstr) { LOGF(info, "Cut string: %s", cutstr.Data()); @@ -283,8 +290,9 @@ void CutBrickThreshold::ConstructCutFromString(const TString& cu std::smatch m; std::regex_search(in, m, cutregex); - if (m.empty() or (m.size() < 3)) { - LOGF(fatal, "CutBrickThreshold::ConstructCutFromString", "Wrong RE: %s, use pT{th{0.2}} for instance", cutstr.Data()); + constexpr int MinExpectedComponents = 3; + if (m.empty() or (m.size() < MinExpectedComponents)) { + LOGF(fatal, "CutBrickThreshold::constructCutFromString", "Wrong RE: %s, use pT{th{0.2}} for instance", cutstr.Data()); } else { this->SetName(m[1].str().c_str()); this->SetTitle(cutstr.Data()); @@ -295,7 +303,7 @@ void CutBrickThreshold::ConstructCutFromString(const TString& cu /// \brief Returns wether the cut brick is incorporated in the selection chain /// \return true if the cut brick is incorporated template -std::vector CutBrickThreshold::IsArmed() +std::vector CutBrickThreshold::isArmed() { std::vector res; if (this->mMode == this->kSELECTED) { @@ -307,8 +315,8 @@ std::vector CutBrickThreshold::IsArmed() } templateClassImp(CutBrickThreshold); -template class o2::analysis::PWGCF::CutBrickThreshold; -template class o2::analysis::PWGCF::CutBrickThreshold; +template class o2::analysis::pwgcf::CutBrickThreshold; +template class o2::analysis::pwgcf::CutBrickThreshold; /////////////////////////////////////////////////////////////////////////////////////// /// Default constructor @@ -337,7 +345,7 @@ CutBrickFnThreshold::CutBrickFnThreshold(const TString& cutstr) : CutBrickThreshold(), mFunction{} { - ConstructCutFromString(cutstr); + constructCutFromString(cutstr); } /// \brief Construct the cut from a cut string @@ -347,7 +355,7 @@ CutBrickFnThreshold::CutBrickFnThreshold(const TString& cutstr) /// If the cut string is correctly parsed the cut is correctly built /// if not a fatal exception is raised template -void CutBrickFnThreshold::ConstructCutFromString(const TString& cutstr) +void CutBrickFnThreshold::constructCutFromString(const TString& cutstr) { LOGF(info, "Cut string: %s", cutstr.Data()); @@ -356,21 +364,22 @@ void CutBrickFnThreshold::ConstructCutFromString(const TString& std::smatch m; std::regex_search(in, m, cutregex); - if (m.empty() or (m.size() < 4)) { - LOGF(fatal, "CutBrickFnThreshold::ConstructCutFromString", "Wrong RE: %s, use pT{fnth{myfn=2.0*sin(x)/x}} for instance", cutstr.Data()); + constexpr int MinExpectedComponents = 4; + if (m.empty() or (m.size() < MinExpectedComponents)) { + LOGF(fatal, "CutBrickFnThreshold::constructCutFromString", "Wrong RE: %s, use pT{fnth{myfn=2.0*sin(x)/x}} for instance", cutstr.Data()); } else { this->SetName(m[2].str().c_str()); this->SetTitle(cutstr.Data()); mFunction = TF1(m[1].str().c_str(), m[3].str().c_str(), 0, 1, TF1::EAddToList::kNo); if (not mFunction.IsValid()) { - LOGF(fatal, "CutBrickFnThreshold::ConstructCutFromString", "Wrong function expression: %s, use pT{fnth{myfn=2.0*sin(x)/x}} for instance", cutstr.Data()); + LOGF(fatal, "CutBrickFnThreshold::constructCutFromString", "Wrong function expression: %s, use pT{fnth{myfn=2.0*sin(x)/x}} for instance", cutstr.Data()); } } } templateClassImp(CutBrickFnThreshold); -template class o2::analysis::PWGCF::CutBrickFnThreshold; -template class o2::analysis::PWGCF::CutBrickFnThreshold; +template class o2::analysis::pwgcf::CutBrickFnThreshold; +template class o2::analysis::pwgcf::CutBrickFnThreshold; /////////////////////////////////////////////////////////////////////////////////////// /// Default constructor @@ -402,7 +411,7 @@ CutBrickRange::CutBrickRange(const TString& cutstr) mLow(0), mUp(0) { - ConstructCutFromString(cutstr); + constructCutFromString(cutstr); } /// \brief Construct the cut from a cut string @@ -412,7 +421,7 @@ CutBrickRange::CutBrickRange(const TString& cutstr) /// If the cut string is correctly parsed the cut is correctly built /// if not a fatal exception is raised template -void CutBrickRange::ConstructCutFromString(const TString& cutstr) +void CutBrickRange::constructCutFromString(const TString& cutstr) { LOGF(info, "Cut string: %s", cutstr.Data()); @@ -421,8 +430,9 @@ void CutBrickRange::ConstructCutFromString(const TString& cutstr std::smatch m; std::regex_search(in, m, cutregex); - if (m.empty() or (m.size() < 4)) { - LOGF(fatal, "CutBrickRange::ConstructCutFromString", "Wrong RE: %s, use pT{rg{0.2,2.0}} for instance", cutstr.Data()); + constexpr int MinExpectedComponents = 4; + if (m.empty() or (m.size() < MinExpectedComponents)) { + LOGF(fatal, "CutBrickRange::constructCutFromString", "Wrong RE: %s, use pT{rg{0.2,2.0}} for instance", cutstr.Data()); } else { this->SetName(m[1].str().c_str()); this->SetTitle(cutstr.Data()); @@ -434,7 +444,7 @@ void CutBrickRange::ConstructCutFromString(const TString& cutstr /// \brief Returns wether the cut brick is incorporated in the selection chain /// \return true if the cut brick is incorporated template -std::vector CutBrickRange::IsArmed() +std::vector CutBrickRange::isArmed() { std::vector res; if (this->mMode == this->kSELECTED) { @@ -446,8 +456,8 @@ std::vector CutBrickRange::IsArmed() } templateClassImp(CutBrickRange); -template class o2::analysis::PWGCF::CutBrickRange; -template class o2::analysis::PWGCF::CutBrickRange; +template class o2::analysis::pwgcf::CutBrickRange; +template class o2::analysis::pwgcf::CutBrickRange; /////////////////////////////////////////////////////////////////////////////////////// /// Default constructor @@ -480,7 +490,7 @@ CutBrickFnRange::CutBrickFnRange(const TString& cutstr) mLowFunction{}, mUpFunction{} { - ConstructCutFromString(cutstr); + constructCutFromString(cutstr); } /// \brief Construct the cut from a cut string @@ -490,7 +500,7 @@ CutBrickFnRange::CutBrickFnRange(const TString& cutstr) /// If the cut string is correctly parsed the cut is correctly built /// if not a fatal exception is raised template -void CutBrickFnRange::ConstructCutFromString(const TString& cutstr) +void CutBrickFnRange::constructCutFromString(const TString& cutstr) { LOGF(info, "Cut string: %s", cutstr.Data()); @@ -499,22 +509,23 @@ void CutBrickFnRange::ConstructCutFromString(const TString& cuts std::smatch m; std::regex_search(in, m, cutregex); - if (m.empty() or (m.size() < 5)) { - LOGF(fatal, "CutBrickFnRange::ConstructCutFromString", "Wrong RE: %s, use pT{fnrg{myfn=2.0*sin(x)/x}} for instance", cutstr.Data()); + constexpr int MinExpectedComponents = 5; + if (m.empty() or (m.size() < MinExpectedComponents)) { + LOGF(fatal, "CutBrickFnRange::constructCutFromString", "Wrong RE: %s, use pT{fnrg{myfn=2.0*sin(x)/x}} for instance", cutstr.Data()); } else { this->SetName(m[2].str().c_str()); this->SetTitle(cutstr.Data()); mLowFunction = TF1(TString::Format("%s_low", m[1].str().c_str()), m[3].str().c_str(), 0, 1, TF1::EAddToList::kNo); mUpFunction = TF1(TString::Format("%s_up", m[1].str().c_str()), m[4].str().c_str(), 0, 1, TF1::EAddToList::kNo); if (not mLowFunction.IsValid() or not mUpFunction.IsValid()) { - LOGF(fatal, "CutBrickFnRange::ConstructCutFromString", "Wrong function expression: %s, use pT{fnrg{myfn=2.0*sin(x)/x}} for instance", cutstr.Data()); + LOGF(fatal, "CutBrickFnRange::constructCutFromString", "Wrong function expression: %s, use pT{fnrg{myfn=2.0*sin(x)/x}} for instance", cutstr.Data()); } } } templateClassImp(CutBrickFnRange); -template class o2::analysis::PWGCF::CutBrickFnRange; -template class o2::analysis::PWGCF::CutBrickFnRange; +template class o2::analysis::pwgcf::CutBrickFnRange; +template class o2::analysis::pwgcf::CutBrickFnRange; /////////////////////////////////////////////////////////////////////////////////////// /// Default constructor @@ -546,7 +557,7 @@ CutBrickExtToRange::CutBrickExtToRange(const TString& cutstr) mLow(0), mUp(0) { - ConstructCutFromString(cutstr); + constructCutFromString(cutstr); } /// \brief Construct the cut from a cut string @@ -556,7 +567,7 @@ CutBrickExtToRange::CutBrickExtToRange(const TString& cutstr) /// If the cut string is correctly parsed the cut is correctly built /// if not a fatal exception is raised template -void CutBrickExtToRange::ConstructCutFromString(const TString& cutstr) +void CutBrickExtToRange::constructCutFromString(const TString& cutstr) { LOGF(info, "Cut string: %s", cutstr.Data()); @@ -565,8 +576,9 @@ void CutBrickExtToRange::ConstructCutFromString(const TString& c std::smatch m; std::regex_search(in, m, cutregex); - if (m.empty() or (m.size() < 4)) { - LOGF(fatal, "CutBrickExtToRange::ConstructCutFromString", "Wrong RE: %s, use minv{xrg{0.02,0.04}} for instance", cutstr.Data()); + constexpr int MinExpectedComponents = 4; + if (m.empty() or (m.size() < MinExpectedComponents)) { + LOGF(fatal, "CutBrickExtToRange::constructCutFromString", "Wrong RE: %s, use minv{xrg{0.02,0.04}} for instance", cutstr.Data()); } else { this->SetName(m[1].str().c_str()); this->SetTitle(cutstr.Data()); @@ -578,7 +590,7 @@ void CutBrickExtToRange::ConstructCutFromString(const TString& c /// \brief Returns wether the cut brick is incorporated in the selection chain /// \return true if the cut brick is incorporated template -std::vector CutBrickExtToRange::IsArmed() +std::vector CutBrickExtToRange::isArmed() { std::vector res; if (this->mMode == this->kSELECTED) { @@ -590,8 +602,8 @@ std::vector CutBrickExtToRange::IsArmed() } templateClassImp(CutBrickExtToRange); -template class o2::analysis::PWGCF::CutBrickExtToRange; -template class o2::analysis::PWGCF::CutBrickExtToRange; +template class o2::analysis::pwgcf::CutBrickExtToRange; +template class o2::analysis::pwgcf::CutBrickExtToRange; /////////////////////////////////////////////////////////////////////////////////////// /// Default constructor @@ -623,7 +635,7 @@ CutBrickFnExtToRange::CutBrickFnExtToRange(const TString& cutstr mLowFunction{}, mUpFunction{} { - ConstructCutFromString(cutstr); + constructCutFromString(cutstr); } /// \brief Construct the cut from a cut string @@ -633,7 +645,7 @@ CutBrickFnExtToRange::CutBrickFnExtToRange(const TString& cutstr /// If the cut string is correctly parsed the cut is correctly built /// if not a fatal exception is raised template -void CutBrickFnExtToRange::ConstructCutFromString(const TString& cutstr) +void CutBrickFnExtToRange::constructCutFromString(const TString& cutstr) { LOGF(info, "Cut string: %s", cutstr.Data()); @@ -642,22 +654,23 @@ void CutBrickFnExtToRange::ConstructCutFromString(const TString& std::smatch m; std::regex_search(in, m, cutregex); - if (m.empty() or (m.size() < 5)) { - LOGF(fatal, "CutBrickFnExtToRange::ConstructCutFromString", "Wrong RE: %s, use pT{fnxrg{myfn=2.0*sin(x)/x}} for instance", cutstr.Data()); + constexpr int MinExpectedComponents = 5; + if (m.empty() or (m.size() < MinExpectedComponents)) { + LOGF(fatal, "CutBrickFnExtToRange::constructCutFromString", "Wrong RE: %s, use pT{fnxrg{myfn=2.0*sin(x)/x}} for instance", cutstr.Data()); } else { this->SetName(m[2].str().c_str()); this->SetTitle(cutstr.Data()); mLowFunction = TF1(TString::Format("%s_low", m[1].str().c_str()), m[3].str().c_str(), 0, 1, TF1::EAddToList::kNo); mUpFunction = TF1(TString::Format("%s_up", m[1].str().c_str()), m[4].str().c_str(), 0, 1, TF1::EAddToList::kNo); if (not mLowFunction.IsValid() or not mUpFunction.IsValid()) { - LOGF(fatal, "CutBrickFnExtToRange::ConstructCutFromString", "Wrong function expression: %s, use pT{fnxrg{myfn=2.0*sin(x)/x}} for instance", cutstr.Data()); + LOGF(fatal, "CutBrickFnExtToRange::constructCutFromString", "Wrong function expression: %s, use pT{fnxrg{myfn=2.0*sin(x)/x}} for instance", cutstr.Data()); } } } templateClassImp(CutBrickFnExtToRange); -template class o2::analysis::PWGCF::CutBrickFnExtToRange; -template class o2::analysis::PWGCF::CutBrickFnExtToRange; +template class o2::analysis::pwgcf::CutBrickFnExtToRange; +template class o2::analysis::pwgcf::CutBrickFnExtToRange; /////////////////////////////////////////////////////////////////////////////////////// /// Default constructor @@ -677,7 +690,7 @@ CutBrickSelectorMultipleRanges::CutBrickSelectorMultipleRanges(c TString title = name; title += "{"; bool first = true; - for (auto edge : edges) { + for (const auto& edge : edges) { mEdges.push_back(edge); if (first) { title += TString::Format("%.2f", float(edge)); @@ -698,7 +711,7 @@ template CutBrickSelectorMultipleRanges::CutBrickSelectorMultipleRanges(const TString& cutstr) : CutBrick() { - ConstructCutFromString(cutstr); + constructCutFromString(cutstr); } /// \brief Construct the cut from a cut string @@ -708,7 +721,7 @@ CutBrickSelectorMultipleRanges::CutBrickSelectorMultipleRanges(c /// If the cut string is correctly parsed the cut is correctly built /// if not a fatal exception is raised template -void CutBrickSelectorMultipleRanges::ConstructCutFromString(const TString& cutstr) +void CutBrickSelectorMultipleRanges::constructCutFromString(const TString& cutstr) { LOGF(info, "Cut string: %s", cutstr.Data()); @@ -717,8 +730,9 @@ void CutBrickSelectorMultipleRanges::ConstructCutFromString(cons std::smatch m; bool res = std::regex_search(in, m, cutregex); - if (not res or m.empty() or (m.size() < 5)) { - LOGF(fatal, "CutBrickSelectorMultipleRanges::ConstructCutFromString", "Wrong RE: %s, use centmult{mrg{V0M,0,5,10,20,30,40,50,60,70,80}} for instance", cutstr.Data()); + constexpr int MinExpectedComponents = 5; + if (not res or m.empty() or (m.size() < MinExpectedComponents)) { + LOGF(fatal, "CutBrickSelectorMultipleRanges::constructCutFromString", "Wrong RE: %s, use centmult{mrg{V0M,0,5,10,20,30,40,50,60,70,80}} for instance", cutstr.Data()); } else { this->SetName(m[2].str().c_str()); this->SetTitle(cutstr.Data()); @@ -737,10 +751,10 @@ void CutBrickSelectorMultipleRanges::ConstructCutFromString(cons /// \brief Returns wether the cut brick is incorporated in the selection chain /// \return true if the cut brick is incorporated template -std::vector CutBrickSelectorMultipleRanges::IsArmed() +std::vector CutBrickSelectorMultipleRanges::isArmed() { std::vector res; - res.reserve(Length()); + res.reserve(length()); if (this->mMode == this->kSELECTED) { for (unsigned int i = 0; i < mActive.size(); ++i) { res.push_back(true); @@ -753,11 +767,11 @@ std::vector CutBrickSelectorMultipleRanges::IsArmed() return res; } -/// \brief Filter the passed value to update the brick status accordingly +/// \brief filter the passed value to update the brick status accordingly /// \param value The value to filter /// \return true if the value passed the cut false otherwise template -std::vector CutBrickSelectorMultipleRanges::Filter(const TValueToFilter& value) +std::vector CutBrickSelectorMultipleRanges::filter(const TValueToFilter& value) { if ((mEdges.front() <= value) and (value < mEdges.back())) { this->mState = this->kACTIVE; @@ -784,8 +798,8 @@ std::vector CutBrickSelectorMultipleRanges::Filter(const T } templateClassImp(CutBrickSelectorMultipleRanges); -template class o2::analysis::PWGCF::CutBrickSelectorMultipleRanges; -template class o2::analysis::PWGCF::CutBrickSelectorMultipleRanges; +template class o2::analysis::pwgcf::CutBrickSelectorMultipleRanges; +template class o2::analysis::pwgcf::CutBrickSelectorMultipleRanges; /////////////////////////////////////////////////////////////////////////////////////// /// Default constructor @@ -820,7 +834,7 @@ CutWithVariations::CutWithVariations(const TString& cutstr) mDefaultBricks{}, mVariationBricks{} { - ConstructCutFromString(cutstr); + constructCutFromString(cutstr); } /// \brief Construct the cut from a cut string @@ -831,7 +845,7 @@ CutWithVariations::CutWithVariations(const TString& cutstr) /// If the cut string is correctly parsed the cut is correctly built /// if not a fatal exception is raised template -void CutWithVariations::ConstructCutFromString(const TString& cutstr) +void CutWithVariations::constructCutFromString(const TString& cutstr) { /* let's catch the first level */ LOGF(info, "Cut with variations: cut string: %s", cutstr.Data()); @@ -841,16 +855,18 @@ void CutWithVariations::ConstructCutFromString(const TString& cu std::smatch m; bool res = std::regex_search(in, m, cutregex); - if (not res or m.empty() or (m.size() < 3)) { - LOGF(fatal, "CutWithVariations::ConstructCutFromString", "Wrong RE: %s, use pT{cwv{rg{0.2,10.0}}} for instance", cutstr.Data()); + constexpr int MinExpectedComponents = 3; + if (not res or m.empty() or (m.size() < MinExpectedComponents)) { + LOGF(fatal, "CutWithVariations::constructCutFromString", "Wrong RE: %s, use pT{cwv{rg{0.2,10.0}}} for instance", cutstr.Data()); } this->SetName(m[1].str().c_str()); this->SetTitle(cutstr.Data()); /* let's split default and variations */ TObjArray* lev1toks = TString(m[2]).Tokenize(":"); - if (lev1toks->GetEntries() > 2) { - LOGF(fatal, "CutWithVariations::ConstructCutFromString", "Wrong RE: %s, use pT{cwv{rg{0.2,10.0}}} for instance", cutstr.Data()); + constexpr int MaxExpectedComponents = 2; + if (lev1toks->GetEntries() > MaxExpectedComponents) { + LOGF(fatal, "CutWithVariations::constructCutFromString", "Wrong RE: %s, use pT{cwv{rg{0.2,10.0}}} for instance", cutstr.Data()); } bool atleastonearmed = false; auto addCuts = [&](TList& cutlist, std::string cuttxt, bool reqflag) { @@ -859,8 +875,9 @@ void CutWithVariations::ConstructCutFromString(const TString& cu std::set allowed = {"lim", "th", "rg", "xrg", "mrg", "fnlim", "fnth", "fnrg", "fnxrg"}; std::regex cutregex("(\\w+\\{[\\w.,=\\-\\+\\*\\/]+}(?:-(?:no|yes))*)"); bool res = regex_search(cuttxt, m, cutregex); - if (not res or m.empty() or m.size() != 2) { - LOGF(fatal, "CutWithVariations::ConstructCutFromString", "Cut with variations malformed RE %s", cuttxt.c_str()); + constexpr int ExpectedComponents = 2; + if (not res or m.empty() or m.size() != ExpectedComponents) { + LOGF(fatal, "CutWithVariations::constructCutFromString", "Cut with variations malformed RE %s", cuttxt.c_str()); } TString brickre = m[1].str().c_str(); bool isarmed = brickre.EndsWith("-yes"); @@ -869,10 +886,10 @@ void CutWithVariations::ConstructCutFromString(const TString& cu } else if (brickre.EndsWith("-no")) { brickre.Remove(brickre.Index("-no"), strlen("-no")); } else if (reqflag) { - LOGF(fatal, "CutWithVariations::ConstructCutFromString", "Wrong RE: %s, alternatives not correctly flagged", cuttxt.c_str()); + LOGF(fatal, "CutWithVariations::constructCutFromString", "Wrong RE: %s, alternatives not correctly flagged", cuttxt.c_str()); } CutBrick* brick = CutBrick::constructBrick(this->GetName(), brickre, allowed); - brick->Arm(isarmed); + brick->arm(isarmed); atleastonearmed = atleastonearmed || isarmed; cutlist.Add(brick); cuttxt = m.suffix(); @@ -884,7 +901,7 @@ void CutWithVariations::ConstructCutFromString(const TString& cu addCuts(mDefaultBricks, lev1toks->At(0)->GetName(), true); if (mDefaultBricks.GetEntries() > 1) { /* TODO: several default options for track type and for track pid selection */ - LOGF(fatal, "CutWithVariations::ConstructCutFromString", "Wrong RE: %s, several defaults only for trktype or trkpid pending of implementation", cutstr.Data()); + LOGF(fatal, "CutWithVariations::constructCutFromString", "Wrong RE: %s, several defaults only for trktype or trkpid pending of implementation", cutstr.Data()); } } /* let's now handle the variations if any */ @@ -892,7 +909,7 @@ void CutWithVariations::ConstructCutFromString(const TString& cu LOGF(info, "Cut with variations, extracting variations: cut string: %s", lev1toks->At(1)->GetName()); addCuts(mVariationBricks, lev1toks->At(1)->GetName(), true); } - this->Arm(atleastonearmed); + this->arm(atleastonearmed); delete lev1toks; } @@ -906,7 +923,7 @@ void CutWithVariations::ConstructCutFromString(const TString& cu /// If any of the above conditions fails the brick is not /// added and false is returned template -bool CutWithVariations::AddDefaultBrick(CutBrick* brick) +bool CutWithVariations::addDefaultBrick(CutBrick* brick) { if (mAllowSeveralDefaults) { if (mDefaultBricks.FindObject(brick->GetName())) { @@ -930,7 +947,7 @@ bool CutWithVariations::AddDefaultBrick(CutBrick /// \returns true if the brick was successfully added /// It is required that the brick name were unique in the list of variation values brick template -bool CutWithVariations::AddVariationBrick(CutBrick* brick) +bool CutWithVariations::addVariationBrick(CutBrick* brick) { if (mVariationBricks.FindObject(brick->GetName())) { return false; @@ -943,36 +960,36 @@ bool CutWithVariations::AddVariationBrick(CutBrick -std::vector CutWithVariations::IsArmed() +std::vector CutWithVariations::isArmed() { std::vector res; - res.reserve(Length()); + res.reserve(length()); if (this->mMode == this->kSELECTED) { int nArmedDefaults = 0; int nArmedVariants = 0; for (int i = 0; i < mDefaultBricks.GetEntries(); ++i) { - std::vector tmp = ((CutBrick*)mDefaultBricks.At(i))->IsArmed(); + std::vector tmp = ((CutBrick*)mDefaultBricks.At(i))->isArmed(); res.insert(res.end(), tmp.begin(), tmp.end()); - for (bool iarmed : tmp) { + for (const bool& iarmed : tmp) { if (iarmed) { nArmedDefaults++; } } } for (int i = 0; i < mVariationBricks.GetEntries(); ++i) { - std::vector tmp = ((CutBrick*)mVariationBricks.At(i))->IsArmed(); + std::vector tmp = ((CutBrick*)mVariationBricks.At(i))->isArmed(); res.insert(res.end(), tmp.begin(), tmp.end()); - for (bool iarmed : tmp) { + for (const bool& iarmed : tmp) { if (iarmed) { nArmedVariants++; } } } if (nArmedDefaults > 1 or nArmedVariants > 1 or (nArmedDefaults + nArmedVariants) > 1) { - LOGF(fatal, "CutWithVariations::IsArmed(%s), More than one alternative selected. Default armed %d, variants armed %d", this->GetName(), nArmedDefaults, nArmedVariants); + LOGF(fatal, "CutWithVariations::isArmed(%s), More than one alternative selected. Default armed %d, variants armed %d", this->GetName(), nArmedDefaults, nArmedVariants); } } else { - for (int i = 0; i < Length(); ++i) { + for (int i = 0; i < length(); ++i) { res.push_back(false); } } @@ -986,16 +1003,16 @@ std::vector CutWithVariations::IsArmed() /// \returns true if the value activated any of the bricks template -std::vector CutWithVariations::Filter(const TValueToFilter& value) +std::vector CutWithVariations::filter(const TValueToFilter& value) { std::vector res; - res.reserve(Length()); + res.reserve(length()); for (int i = 0; i < mDefaultBricks.GetEntries(); ++i) { - std::vector tmp = ((CutBrick*)mDefaultBricks.At(i))->Filter(value); + std::vector tmp = ((CutBrick*)mDefaultBricks.At(i))->filter(value); res.insert(res.end(), tmp.begin(), tmp.end()); } for (int i = 0; i < mVariationBricks.GetEntries(); ++i) { - std::vector tmp = ((CutBrick*)mVariationBricks.At(i))->Filter(value); + std::vector tmp = ((CutBrick*)mVariationBricks.At(i))->filter(value); res.insert(res.end(), tmp.begin(), tmp.end()); } return res; @@ -1005,15 +1022,15 @@ std::vector CutWithVariations::Filter(const TValueToFilter /// The length is in brick units. The actual length is implementation dependent /// \returns Cut length in units of bricks template -int CutWithVariations::Length() +int CutWithVariations::length() { /* TODO: should a single default cut without variations return zero length? */ int length = 0; for (int i = 0; i < mDefaultBricks.GetEntries(); ++i) { - length += ((CutBrick*)mDefaultBricks.At(i))->Length(); + length += ((CutBrick*)mDefaultBricks.At(i))->length(); } for (int i = 0; i < mVariationBricks.GetEntries(); ++i) { - length += ((CutBrick*)mVariationBricks.At(i))->Length(); + length += ((CutBrick*)mVariationBricks.At(i))->length(); } return length; } @@ -1029,8 +1046,8 @@ int CutWithVariations::getArmedIndex() bool found = false; for (int i = 0; not found and i < brklst.GetEntries(); ++i) { index++; - std::vector tmp = ((CutBrick*)brklst.At(i))->IsArmed(); - for (bool iarmed : tmp) { + std::vector tmp = ((CutBrick*)brklst.At(i))->isArmed(); + for (const bool& iarmed : tmp) { if (iarmed) { found = true; break; @@ -1050,8 +1067,8 @@ int CutWithVariations::getArmedIndex() } templateClassImp(o2::analysis::CutWithVariations); -template class o2::analysis::PWGCF::CutWithVariations; -template class o2::analysis::PWGCF::CutWithVariations; +template class o2::analysis::pwgcf::CutWithVariations; +template class o2::analysis::pwgcf::CutWithVariations; /// Default constructor SpecialCutBrick::SpecialCutBrick() @@ -1101,35 +1118,35 @@ TrackSelectionBrick::TrackSelectionBrick(const TString& regex) : SpecialCutBrick } else { LOGF(fatal, "TrackSelectionBrick::TrackSelectionBrick", "Wrong RE: %s, trying to construct an unknown track type selector", regex.Data()); } - this->Arm(armed); + this->arm(armed); } // Default TPC only track selection according to LHC2010 void TrackSelectionBrick::constructFB1LHC2010() { - SetTrackType(o2::aod::track::Run2Track); - SetRequireGoldenChi2(true); - SetMinNClustersTPC(50); - SetMaxChi2PerClusterTPC(4.f); - SetMaxDcaXY(2.4f); - SetMaxDcaZ(3.2f); + setTrackType(o2::aod::track::Run2Track); + setRequireGoldenChi2(true); + setMinNClustersTPC(50); + setMaxChi2PerClusterTPC(4.f); + setMaxDcaXY(2.4f); + setMaxDcaZ(3.2f); /* TODO: 2D DCA cut */ } // Default track selection requiring one hit in the SPD DCAxy according to LHC2010 void TrackSelectionBrick::constructFB32LHC2010() { - SetTrackType(o2::aod::track::Run2Track); - SetRequireITSRefit(true); - SetRequireTPCRefit(true); - SetRequireGoldenChi2(true); - SetMinNCrossedRowsTPC(70); - SetMinNCrossedRowsOverFindableClustersTPC(0.8f); - SetMaxChi2PerClusterTPC(4.f); - SetRequireHitsInITSLayers(1, {0, 1}); // one hit in any SPD layer - SetMaxChi2PerClusterITS(36.f); - SetMaxDcaXYPtDep([](float pt) { return 0.0182f + 0.0350f / pow(pt, 1.01f); }); - SetMaxDcaZ(2.f); + setTrackType(o2::aod::track::Run2Track); + setRequireITSRefit(true); + setRequireTPCRefit(true); + setRequireGoldenChi2(true); + setMinNCrossedRowsTPC(70); + setMinNCrossedRowsOverFindableClustersTPC(0.8f); + setMaxChi2PerClusterTPC(4.f); + setRequireHitsInITSLayers(1, {0, 1}); // one hit in any SPD layer + setMaxChi2PerClusterITS(36.f); + setMaxDcaXYPtDep([](float pt) { return 0.0182f + 0.0350f / std::pow(pt, 1.01f); }); + setMaxDcaZ(2.f); } // Default track selection requiring no hit in the SPD and one in the innermost DCAxy according to LHC2010 @@ -1137,9 +1154,9 @@ void TrackSelectionBrick::constructFB32LHC2010() void TrackSelectionBrick::constructFB64LHC2010() { constructFB32LHC2010(); - ResetITSRequirements(); - SetRequireNoHitsInITSLayers({0, 1}); // no hit in SPD layers - SetRequireHitsInITSLayers(1, {2}); // one hit in first SDD layer + resetITSRequirements(); + setRequireNoHitsInITSLayers({0, 1}); // no hit in SPD layers + setRequireHitsInITSLayers(1, {2}); // one hit in first SDD layer } // Default TPC only track selection according to LHC2011 @@ -1152,17 +1169,17 @@ void TrackSelectionBrick::constructFB1LHC2011() // Default track selection requiring one hit in the SPD DCAxy according to LHC2011 void TrackSelectionBrick::constructFB32LHC2011() { - SetTrackType(o2::aod::track::Run2Track); - SetRequireITSRefit(true); - SetRequireTPCRefit(true); - SetRequireGoldenChi2(true); - SetMinNCrossedRowsTPC(70); - SetMinNCrossedRowsOverFindableClustersTPC(0.8f); - SetMaxChi2PerClusterTPC(4.f); - SetRequireHitsInITSLayers(1, {0, 1}); // one hit in any SPD layer - SetMaxChi2PerClusterITS(36.f); - SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / pow(pt, 1.1f); }); - SetMaxDcaZ(2.f); + setTrackType(o2::aod::track::Run2Track); + setRequireITSRefit(true); + setRequireTPCRefit(true); + setRequireGoldenChi2(true); + setMinNCrossedRowsTPC(70); + setMinNCrossedRowsOverFindableClustersTPC(0.8f); + setMaxChi2PerClusterTPC(4.f); + setRequireHitsInITSLayers(1, {0, 1}); // one hit in any SPD layer + setMaxChi2PerClusterITS(36.f); + setMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / std::pow(pt, 1.1f); }); + setMaxDcaZ(2.f); } // Default track selection requiring no hit in the SPD and one in the innermost DCAxy according to LHC2011 @@ -1170,16 +1187,16 @@ void TrackSelectionBrick::constructFB32LHC2011() void TrackSelectionBrick::constructFB64LHC2011() { constructFB32LHC2011(); - ResetITSRequirements(); - SetRequireNoHitsInITSLayers({0, 1}); // no hit in SPD layers - SetRequireHitsInITSLayers(1, {2}); // one hit in first SDD layer + resetITSRequirements(); + setRequireNoHitsInITSLayers({0, 1}); // no hit in SPD layers + setRequireHitsInITSLayers(1, {2}); // one hit in first SDD layer } -bool TrackSelectionBrick::FulfillsITSHitRequirements(uint8_t itsClusterMap) +bool TrackSelectionBrick::fulfillsITSHitRequirements(uint8_t itsClusterMap) { - constexpr uint8_t bit = 1; - for (auto& itsRequirement : mRequiredITSHits) { - auto hits = std::count_if(itsRequirement.second.begin(), itsRequirement.second.end(), [&](auto&& requiredLayer) { return itsClusterMap & (bit << requiredLayer); }); + constexpr uint8_t One = 1; + for (const auto& itsRequirement : mRequiredITSHits) { + auto hits = std::count_if(itsRequirement.second.begin(), itsRequirement.second.end(), [&](auto&& requiredLayer) { return itsClusterMap & (One << requiredLayer); }); if ((itsRequirement.first == -1) && (hits > 0)) { return false; // no hits were required in specified layers } else if (hits < itsRequirement.first) { @@ -1204,7 +1221,7 @@ const std::array(TrackSelectionBrick::TrackCuts::k /// \brief Returns wether the cut brick is incorporated in the selection chain /// \return true if the cut brick is incorporated -std::vector TrackSelectionBrick::IsArmed() +std::vector TrackSelectionBrick::isArmed() { std::vector res; if (this->mMode == this->kSELECTED) { diff --git a/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.h b/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.h index aa79964d65a..01bdb0701cb 100644 --- a/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.h +++ b/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.h @@ -9,6 +9,11 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file SkimmingConfigurableCuts.h +/// \brief Set of Brick classes which configures the derived data +/// filtering framework +/// \author victor.gonzalez.sebastian@gmail.com + #ifndef PWGCF_TWOPARTICLECORRELATIONS_CORE_SKIMMINGCONFIGURABLECUTS_H_ #define PWGCF_TWOPARTICLECORRELATIONS_CORE_SKIMMINGCONFIGURABLECUTS_H_ @@ -35,7 +40,7 @@ namespace o2 { namespace analysis { -namespace PWGCF +namespace pwgcf { /// \class CutBrick /// \brief Virtual class which implements the base component of the selection cuts @@ -53,19 +58,19 @@ class CutBrick : public TNamed public: /// Returns whether the cut brick is active allowing the selection /// \return true if the brick is active - bool IsActive() { return mState == kACTIVE; } + bool isActive() { return mState == kACTIVE; } /// Pure virual function /// Returns whether the cut brick is incorporated in the selection chain - virtual std::vector IsArmed() = 0; + virtual std::vector isArmed() = 0; /// Pure virtual function. Filters the passed value /// The brick or brick components will change to active if the passed value /// fits within the brick or brick components scope /// \returns a vector of booleans with true on the component for which the value activated the component brick - virtual std::vector Filter(const TValueToFilter&) = 0; + virtual std::vector filter(const TValueToFilter&) = 0; /// Pure virtual function. Return the length needed to code the brick status /// The length is in brick units. The actual length is implementation dependent /// \returns Brick length in units of bricks - virtual int Length() = 0; + virtual int length() = 0; /// Virtual function. Return the index of the armed brick within this brick /// \returns The index of the armed brick within this brick. Default -1 virtual int getArmedIndex() { return -1; } @@ -74,7 +79,7 @@ class CutBrick : public TNamed static const char* mgImplementedbricks[]; /// Set the status of the cut significative (or not) for the selection chain - void Arm(bool doit = true) { doit ? mMode = kSELECTED : mMode = kUNSELECTED; } + void arm(bool doit = true) { doit ? mMode = kSELECTED : mMode = kUNSELECTED; } /// Setting the value of independent variable for cuts with function levels /// The default behavior is to raise a fatal exception virtual void setIndependentFnVar(float) @@ -116,12 +121,12 @@ class CutBrickLimit : public CutBrick CutBrickLimit(const CutBrickLimit&) = delete; CutBrickLimit& operator=(const CutBrickLimit&) = delete; - std::vector IsArmed() override; - std::vector Filter(const TValueToFilter&) override; - int Length() override { return 1; } + std::vector isArmed() override; + std::vector filter(const TValueToFilter&) override; + int length() override { return 1; } private: - void ConstructCutFromString(const TString&); + void constructCutFromString(const TString&); protected: TValueToFilter mLimit; ///< the limiting upper value @@ -129,11 +134,11 @@ class CutBrickLimit : public CutBrick ClassDef(CutBrickLimit, 1); }; -/// \brief Filter the passed value to update the brick status accordingly +/// \brief filter the passed value to update the brick status accordingly /// \param value The value to filter /// \return true if the value passed the cut false otherwise template -inline std::vector CutBrickLimit::Filter(const TValueToFilter& value) +inline std::vector CutBrickLimit::filter(const TValueToFilter& value) { std::vector res; if (value < mLimit) { @@ -167,7 +172,7 @@ class CutBrickFnLimit : public CutBrickLimit } private: - void ConstructCutFromString(const TString&); + void constructCutFromString(const TString&); TF1 mFunction; ///< the function for evaluating the limit value ClassDef(CutBrickFnLimit, 1); @@ -187,12 +192,12 @@ class CutBrickThreshold : public CutBrick CutBrickThreshold(const CutBrickThreshold&) = delete; CutBrickThreshold& operator=(const CutBrickThreshold&) = delete; - std::vector IsArmed() override; - std::vector Filter(const TValueToFilter&) override; - int Length() override { return 1; } + std::vector isArmed() override; + std::vector filter(const TValueToFilter&) override; + int length() override { return 1; } private: - void ConstructCutFromString(const TString&); + void constructCutFromString(const TString&); protected: TValueToFilter mThreshold; ///< the threshold value @@ -200,11 +205,11 @@ class CutBrickThreshold : public CutBrick ClassDef(CutBrickThreshold, 1); }; -/// \brief Filter the passed value to update the brick status accordingly +/// \brief filter the passed value to update the brick status accordingly /// \param value The value to filter /// \return true if the value passed the cut false otherwise template -inline std::vector CutBrickThreshold::Filter(const TValueToFilter& value) +inline std::vector CutBrickThreshold::filter(const TValueToFilter& value) { std::vector res; if (mThreshold < value) { @@ -238,7 +243,7 @@ class CutBrickFnThreshold : public CutBrickThreshold } private: - void ConstructCutFromString(const TString&); + void constructCutFromString(const TString&); TF1 mFunction; ///< the function for evaluate the threshold value ClassDef(CutBrickFnThreshold, 1); @@ -258,12 +263,12 @@ class CutBrickRange : public CutBrick CutBrickRange(const CutBrickRange&) = delete; CutBrickRange& operator=(const CutBrickRange&) = delete; - std::vector IsArmed() override; - std::vector Filter(const TValueToFilter&) override; - int Length() override { return 1; } + std::vector isArmed() override; + std::vector filter(const TValueToFilter&) override; + int length() override { return 1; } private: - void ConstructCutFromString(const TString&); + void constructCutFromString(const TString&); protected: TValueToFilter mLow; ///< the lower value of the range @@ -272,11 +277,11 @@ class CutBrickRange : public CutBrick ClassDef(CutBrickRange, 1); }; -/// \brief Filter the passed value to update the brick status accordingly +/// \brief filter the passed value to update the brick status accordingly /// \param value The value to filter /// \return true if the value passed the cut false otherwise template -std::vector CutBrickRange::Filter(const TValueToFilter& value) +std::vector CutBrickRange::filter(const TValueToFilter& value) { std::vector res; if ((mLow < value) and (value < mUp)) { @@ -311,7 +316,7 @@ class CutBrickFnRange : public CutBrickRange } private: - void ConstructCutFromString(const TString&); + void constructCutFromString(const TString&); TF1 mLowFunction; ///< the function for evaluating the low limit value TF1 mUpFunction; ///< the function for evaluating the upper limit value @@ -332,12 +337,12 @@ class CutBrickExtToRange : public CutBrick CutBrickExtToRange(const CutBrickExtToRange&) = delete; CutBrickExtToRange& operator=(const CutBrickExtToRange&) = delete; - std::vector IsArmed() override; - std::vector Filter(const TValueToFilter&) override; - int Length() override { return 1; } + std::vector isArmed() override; + std::vector filter(const TValueToFilter&) override; + int length() override { return 1; } private: - void ConstructCutFromString(const TString&); + void constructCutFromString(const TString&); protected: TValueToFilter mLow; ///< the lower value of the range @@ -346,11 +351,11 @@ class CutBrickExtToRange : public CutBrick ClassDef(CutBrickExtToRange, 1); }; -/// \brief Filter the passed value to update the brick status accordingly +/// \brief filter the passed value to update the brick status accordingly /// \param value The value to filter /// \return true if the value passed the cut false otherwise template -std::vector CutBrickExtToRange::Filter(const TValueToFilter& value) +std::vector CutBrickExtToRange::filter(const TValueToFilter& value) { std::vector res; if ((value < mLow) or (mUp < value)) { @@ -385,7 +390,7 @@ class CutBrickFnExtToRange : public CutBrickExtToRange } private: - void ConstructCutFromString(const TString&); + void constructCutFromString(const TString&); TF1 mLowFunction; ///< the function for evaluating the low limit value TF1 mUpFunction; ///< the function for evaluating the upper limit value @@ -408,15 +413,15 @@ class CutBrickSelectorMultipleRanges : public CutBrick CutBrickSelectorMultipleRanges(const CutBrickSelectorMultipleRanges&) = delete; CutBrickSelectorMultipleRanges& operator=(const CutBrickSelectorMultipleRanges&) = delete; - std::vector IsArmed() override; - std::vector Filter(const TValueToFilter&) override; + std::vector isArmed() override; + std::vector filter(const TValueToFilter&) override; /// Return the length needed to code the brick status /// The length is in brick units. The actual length is implementation dependent /// \returns Brick length in units of bricks - int Length() override { return mActive.size(); } + int length() override { return mActive.size(); } private: - void ConstructCutFromString(const TString&); + void constructCutFromString(const TString&); std::vector mEdges; ///< the value of the ranges edges (len = nranges + 1) std::vector mActive; ///< if the associated range is active with the passed value to filter (len = nranges) @@ -438,17 +443,17 @@ class CutWithVariations : public CutBrick CutWithVariations(const CutWithVariations&) = delete; CutWithVariations& operator=(const CutWithVariations&) = delete; - bool AddDefaultBrick(CutBrick* brick); - bool AddVariationBrick(CutBrick* brick); + bool addDefaultBrick(CutBrick* brick); + bool addVariationBrick(CutBrick* brick); TList& getDefaultBricks() { return mDefaultBricks; } TList& getVariantBricks() { return mVariationBricks; } - std::vector IsArmed() override; - std::vector Filter(const TValueToFilter&) override; - int Length() override; + std::vector isArmed() override; + std::vector filter(const TValueToFilter&) override; + int length() override; int getArmedIndex() override; private: - void ConstructCutFromString(const TString&); + void constructCutFromString(const TString&); bool mAllowSeveralDefaults; ///< true if allows to store several cut default values TList mDefaultBricks; ///< the list with the cut default values bricks @@ -474,18 +479,18 @@ class SpecialCutBrick : public TNamed public: /// Returns whether the cut brick is active allowing the selection /// \return true if the brick is active - bool IsActive() { return mState == kACTIVE; } + bool isActive() { return mState == kACTIVE; } /// Pure virtual function /// Returns whether the cut brick is incorporated in the selection chain - virtual std::vector IsArmed() = 0; + virtual std::vector isArmed() = 0; /// Pure virtual function. Return the length needed to code the brick status /// The length is in brick units. The actual length is implementation dependent /// \returns Brick length in units of bricks - virtual int Length() = 0; + virtual int length() = 0; protected: /// Set the status of the cut significative (or not) for the selection chain - void Arm(bool doit = true) { doit ? mMode = kSELECTED : mMode = kUNSELECTED; } + void arm(bool doit = true) { doit ? mMode = kSELECTED : mMode = kUNSELECTED; } protected: /// \enum BrickStatus @@ -533,9 +538,9 @@ class TrackSelectionBrick : public SpecialCutBrick static const std::array(TrackSelectionBrick::TrackCuts::kNCuts)> mCutNames; - std::vector IsArmed() override; + std::vector isArmed() override; template - bool Filter(TrackToFilter const& track) + bool filter(TrackToFilter const& track) { if ((track.trackType() == mTrackType) && (not mCheckNClustersTPC or (track.tpcNClsFound() >= mMinNClustersTPC)) && @@ -547,7 +552,7 @@ class TrackSelectionBrick : public SpecialCutBrick ((mRequireITSRefit) ? (track.flags() & o2::aod::track::ITSrefit) : true) && ((mRequireTPCRefit) ? (track.flags() & o2::aod::track::TPCrefit) : true) && ((mRequireGoldenChi2) ? (track.flags() & o2::aod::track::GoldenChi2) : true) && - FulfillsITSHitRequirements(track.itsClusterMap()) && + fulfillsITSHitRequirements(track.itsClusterMap()) && (mCheckMaxDcaXY && (std::abs(track.dcaXY()) <= ((mMaxDcaXYPtDep) ? mMaxDcaXYPtDep(track.pt()) : mMaxDcaXY))) && (mCheckMaxDcaZ && (std::abs(track.dcaZ()) <= mMaxDcaZ))) { this->mState = this->kACTIVE; @@ -558,34 +563,34 @@ class TrackSelectionBrick : public SpecialCutBrick } } - int Length() override { return 1; } - - void SetTrackType(o2::aod::track::TrackTypeEnum trackType) { mTrackType = trackType; } - void SetRequireITSRefit(bool requireITSRefit = true) { mRequireITSRefit = requireITSRefit; } - void SetRequireTPCRefit(bool requireTPCRefit = true) { mRequireTPCRefit = requireTPCRefit; } - void SetRequireGoldenChi2(bool requireGoldenChi2 = true) { mRequireGoldenChi2 = requireGoldenChi2; } - void SetMinNClustersTPC(int minNClustersTPC) { mMinNClustersTPC = minNClustersTPC; } - void SetMinNCrossedRowsTPC(int minNCrossedRowsTPC) { mMinNCrossedRowsTPC = minNCrossedRowsTPC; } - void SetMinNCrossedRowsOverFindableClustersTPC(float minNCrossedRowsOverFindableClustersTPC) { mMinNCrossedRowsOverFindableClustersTPC = minNCrossedRowsOverFindableClustersTPC; } - void SetMinNClustersITS(int minNClustersITS) { mMinNClustersITS = minNClustersITS; } - void SetMaxChi2PerClusterTPC(float maxChi2PerClusterTPC) { mMaxChi2PerClusterTPC = maxChi2PerClusterTPC; } - void SetMaxChi2PerClusterITS(float maxChi2PerClusterITS) { mMaxChi2PerClusterITS = maxChi2PerClusterITS; } - void SetMaxDcaXY(float maxDcaXY) { mMaxDcaXY = maxDcaXY; } - void SetMaxDcaZ(float maxDcaZ) { mMaxDcaZ = maxDcaZ; } - - void SetMaxDcaXYPtDep(std::function ptDepCut) { mMaxDcaXYPtDep = std::move(ptDepCut); } - void SetRequireHitsInITSLayers(int8_t minNRequiredHits, const std::set& requiredLayers) { mRequiredITSHits.push_back(std::make_pair(minNRequiredHits, requiredLayers)); } - void SetRequireNoHitsInITSLayers(const std::set& excludedLayers) { mRequiredITSHits.push_back(std::make_pair(-1, excludedLayers)); } - void ResetITSRequirements() { mRequiredITSHits.clear(); } - - void DisableNClustersTPCCheck(bool disable = true) { mCheckNClustersTPC = not disable; } - void DisableNCrossedRowsTPCCheck(bool disable = true) { mCheckNCrossedRowsTPC = not disable; } - void DisableNClustersITSCheck(bool disable = true) { mCheckNClustersITS = not disable; } - void DisableMaxChi2PerClusterTPCCheck(bool disable = true) { mCheckMaxChi2PerClusterTPC = not disable; } - void DisableMaxChi2PerClusterITSCheck(bool disable = true) { mCheckMaxChi2PerClusterITS = not disable; } - void DisableMinNCrossedRowsOverFindableClustersTPCCheck(bool disable = true) { mCheckMinNCrossedRowsOverFindableClustersTPC = not disable; } - void DisableMaxDcaXYCheck(bool disable = true) { mCheckMaxDcaXY = not disable; } - void DisableMaxDcaZCheck(bool disable = true) { mCheckMaxDcaZ = not disable; } + int length() override { return 1; } + + void setTrackType(o2::aod::track::TrackTypeEnum trackType) { mTrackType = trackType; } + void setRequireITSRefit(bool requireITSRefit = true) { mRequireITSRefit = requireITSRefit; } + void setRequireTPCRefit(bool requireTPCRefit = true) { mRequireTPCRefit = requireTPCRefit; } + void setRequireGoldenChi2(bool requireGoldenChi2 = true) { mRequireGoldenChi2 = requireGoldenChi2; } + void setMinNClustersTPC(int minNClustersTPC) { mMinNClustersTPC = minNClustersTPC; } + void setMinNCrossedRowsTPC(int minNCrossedRowsTPC) { mMinNCrossedRowsTPC = minNCrossedRowsTPC; } + void setMinNCrossedRowsOverFindableClustersTPC(float minNCrossedRowsOverFindableClustersTPC) { mMinNCrossedRowsOverFindableClustersTPC = minNCrossedRowsOverFindableClustersTPC; } + void setMinNClustersITS(int minNClustersITS) { mMinNClustersITS = minNClustersITS; } + void setMaxChi2PerClusterTPC(float maxChi2PerClusterTPC) { mMaxChi2PerClusterTPC = maxChi2PerClusterTPC; } + void setMaxChi2PerClusterITS(float maxChi2PerClusterITS) { mMaxChi2PerClusterITS = maxChi2PerClusterITS; } + void setMaxDcaXY(float maxDcaXY) { mMaxDcaXY = maxDcaXY; } + void setMaxDcaZ(float maxDcaZ) { mMaxDcaZ = maxDcaZ; } + + void setMaxDcaXYPtDep(std::function ptDepCut) { mMaxDcaXYPtDep = std::move(ptDepCut); } + void setRequireHitsInITSLayers(int8_t minNRequiredHits, const std::set& requiredLayers) { mRequiredITSHits.push_back(std::make_pair(minNRequiredHits, requiredLayers)); } + void setRequireNoHitsInITSLayers(const std::set& excludedLayers) { mRequiredITSHits.push_back(std::make_pair(-1, excludedLayers)); } + void resetITSRequirements() { mRequiredITSHits.clear(); } + + void disableNClustersTPCCheck(bool disable = true) { mCheckNClustersTPC = not disable; } + void disableNCrossedRowsTPCCheck(bool disable = true) { mCheckNCrossedRowsTPC = not disable; } + void disableNClustersITSCheck(bool disable = true) { mCheckNClustersITS = not disable; } + void disableMaxChi2PerClusterTPCCheck(bool disable = true) { mCheckMaxChi2PerClusterTPC = not disable; } + void disableMaxChi2PerClusterITSCheck(bool disable = true) { mCheckMaxChi2PerClusterITS = not disable; } + void disableMinNCrossedRowsOverFindableClustersTPCCheck(bool disable = true) { mCheckMinNCrossedRowsOverFindableClustersTPC = not disable; } + void disableMaxDcaXYCheck(bool disable = true) { mCheckMaxDcaXY = not disable; } + void disableMaxDcaZCheck(bool disable = true) { mCheckMaxDcaZ = not disable; } private: void constructFB1LHC2010(); @@ -595,7 +600,7 @@ class TrackSelectionBrick : public SpecialCutBrick void constructFB64LHC2010(); void constructFB64LHC2011(); - bool FulfillsITSHitRequirements(uint8_t itsClusterMap); + bool fulfillsITSHitRequirements(uint8_t itsClusterMap); o2::aod::track::TrackTypeEnum mTrackType{o2::aod::track::TrackTypeEnum::Track}; @@ -630,7 +635,7 @@ class TrackSelectionBrick : public SpecialCutBrick ClassDefOverride(TrackSelectionBrick, 1); }; -} // namespace PWGCF +} // namespace pwgcf } // namespace analysis } // namespace o2 diff --git a/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx b/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx index 65b9149c6ca..ab9ff8af7fb 100644 --- a/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx +++ b/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx @@ -9,6 +9,11 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file TrackSelectionFilterAndAnalysis.cxx +/// \brief Implementation of the TracksSelectionFilterAndAnalysis class +/// for track filter and selection once filtered +/// \author victor.gonzalez.sebastian@gmail.com + #include "TrackSelectionFilterAndAnalysis.h" #include "PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.h" @@ -32,7 +37,7 @@ #include using namespace o2; -using namespace o2::analysis::PWGCF; +using namespace o2::analysis::pwgcf; using namespace boost; /// \brief Constructor adapted to hyperloop @@ -93,7 +98,7 @@ TrackSelectionConfigurable::TrackSelectionConfigurable(const std::vector::constructBrick("pT", "rg{0.1,50}", std::set{"rg"}); mEtaRange = CutBrick::constructBrick("eta", "rg{-1.0,1.0}", std::set{"rg"}); - ConstructCutFromString(cutstr); + constructCutFromString(cutstr); } /// \brief Constructor from the track selection configurable -TrackSelectionFilterAndAnalysis::TrackSelectionFilterAndAnalysis(const TrackSelectionConfigurable& trcksel, selmodes mode) +TrackSelectionFilterAndAnalysis::TrackSelectionFilterAndAnalysis(const TrackSelectionConfigurable& trcksel, Selmodes mode) : SelectionFilterAndAnalysis("", mode), mNClustersTPC(nullptr), mNCrossedRowsTPC(nullptr), @@ -173,6 +178,7 @@ TrackSelectionFilterAndAnalysis::TrackSelectionFilterAndAnalysis(const TrackSele mPtRange(nullptr), mEtaRange(nullptr) { + constexpr int MaxMaskLength = 64; /* we own the track sign and types cuts objects */ mTrackSign.SetOwner(true); mTrackTypes.SetOwner(true); @@ -213,79 +219,79 @@ TrackSelectionFilterAndAnalysis::TrackSelectionFilterAndAnalysis(const TrackSele appendCut(trcksel.mEtaRange); } cutString += "}"; - ConstructCutFromString(cutString); - if (mMaskLength > 64) { - LOGF(fatal, "TrackSelectionFilterAndAnalysis not ready for filter mask of %d bits. Just 64 available for the time being", mMaskLength); + constructCutFromString(cutString); + if (mMaskLength > MaxMaskLength) { + LOGF(fatal, "TrackSelectionFilterAndAnalysis not ready for filter mask of %d bits. Just %d available for the time being", mMaskLength, MaxMaskLength); } mCutStringSignature = cutString.ReplaceAll("-yes", "").ReplaceAll("-no", ""); - if (mode == kAnalysis) { + if (mode == KAnalysis) { /* TODO: check cuts consistency. In principle it should be there except for the ttype valid combinations */ - StoreArmedMask(); + storeArmedMask(); } } /// \brief Calculates the length of the mask needed to store the selection cuts -int TrackSelectionFilterAndAnalysis::CalculateMaskLength() +int TrackSelectionFilterAndAnalysis::calculateMaskLength() { int length = 0; for (int i = 0; i < mTrackSign.GetEntries(); ++i) { - length += ((CutBrick*)mTrackSign.At(i))->Length(); + length += ((CutBrick*)mTrackSign.At(i))->length(); } for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - length += ((SpecialCutBrick*)mTrackTypes.At(i))->Length(); + length += ((SpecialCutBrick*)mTrackTypes.At(i))->length(); } if (mNClustersTPC != nullptr) { - length += mNClustersTPC->Length(); + length += mNClustersTPC->length(); } if (mNCrossedRowsTPC != nullptr) { - length += mNCrossedRowsTPC->Length(); + length += mNCrossedRowsTPC->length(); } if (mNClustersITS != nullptr) { - length += mNClustersITS->Length(); + length += mNClustersITS->length(); } if (mMaxChi2PerClusterTPC != nullptr) { - length += mMaxChi2PerClusterTPC->Length(); + length += mMaxChi2PerClusterTPC->length(); } if (mMaxChi2PerClusterITS != nullptr) { - length += mMaxChi2PerClusterITS->Length(); + length += mMaxChi2PerClusterITS->length(); } if (mMinNCrossedRowsOverFindableClustersTPC != nullptr) { - length += mMinNCrossedRowsOverFindableClustersTPC->Length(); + length += mMinNCrossedRowsOverFindableClustersTPC->length(); } if (mMaxDcaXY != nullptr) { - length += mMaxDcaXY->Length(); + length += mMaxDcaXY->length(); } if (mMaxDcaZ != nullptr) { - length += mMaxDcaZ->Length(); + length += mMaxDcaZ->length(); } if (mPtRange != nullptr) { - length += mPtRange->Length(); + length += mPtRange->length(); } if (mEtaRange != nullptr) { - length += mEtaRange->Length(); + length += mEtaRange->length(); } return length; } -void TrackSelectionFilterAndAnalysis::SetPtRange(const TString& regex) +void TrackSelectionFilterAndAnalysis::setPtRange(const TString& regex) { if (mPtRange != nullptr) { delete mPtRange; } mPtRange = CutBrick::constructBrick("pT", regex.Data(), std::set{"rg", "th", "lim", "xrg"}); - mMaskLength = CalculateMaskLength(); + mMaskLength = calculateMaskLength(); } -void TrackSelectionFilterAndAnalysis::SetEtaRange(const TString& regex) +void TrackSelectionFilterAndAnalysis::setEtaRange(const TString& regex) { if (mEtaRange != nullptr) { delete mEtaRange; } mEtaRange = CutBrick::constructBrick("eta", regex.Data(), std::set{"rg", "th", "lim", "xrg"}); - mMaskLength = CalculateMaskLength(); + mMaskLength = calculateMaskLength(); } -void TrackSelectionFilterAndAnalysis::ConstructCutFromString(const TString& cutstr) +void TrackSelectionFilterAndAnalysis::constructCutFromString(const TString& cutstr) { LOGF(info, "Cut string: %s", cutstr.Data()); /* let's catch the first level */ @@ -294,7 +300,8 @@ void TrackSelectionFilterAndAnalysis::ConstructCutFromString(const TString& cuts smatch m; bool res = regex_search(in, m, cutregex); - if (not res or m.empty() or (m.size() > 3)) { + constexpr int MaxExpectedComponents = 3; + if (not res or m.empty() or (m.size() > MaxExpectedComponents)) { LOGF(fatal, "TrackSelectionFilterAndAnalysis::::ConstructCutFromString", "Wrong RE: %s, try tracksel{ttype{FB32,FB96};ncls{th{70}},nxr{cwv{th{70},th{80}}}} for instance", cutstr.Data()); } SetName("TrackSelectionFilterAndAnalysisCuts"); @@ -305,7 +312,7 @@ void TrackSelectionFilterAndAnalysis::ConstructCutFromString(const TString& cuts auto addChargeBrick = [this](auto name, auto regex) { std::set allowed = {"lim", "th"}; CutBrick* brick = CutBrick::constructBrick(name, regex, allowed); - brick->Arm(true); + brick->arm(true); mTrackSign.Add(brick); }; addChargeBrick("chp", "th{0}"); @@ -338,8 +345,8 @@ void TrackSelectionFilterAndAnalysis::ConstructCutFromString(const TString& cuts std::string in(lev2str.Data()); smatch m; bool res = regex_search(in, m, cutregex); - - if (not res or m.empty() or (m.size() != 3)) { + constexpr int ExpectedComponents = 3; + if (not res or m.empty() or (m.size() != ExpectedComponents)) { Fatal("TrackSelectionFilterAndAnalysis::::ConstructCutFromString", "Wrong RE: %s, try tracksel{ttype{FB32,FB96};nclstpc{th{70}},nxr{cwv{th{70},th{80}}}} for instance", cutstr.Data()); } LOGF(info, "Captured %s", m[1].str().c_str()); @@ -358,42 +365,42 @@ void TrackSelectionFilterAndAnalysis::ConstructCutFromString(const TString& cuts if (m[1].str() == "nclstpc") { storeIntCut(mNClustersTPC); for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - ((TrackSelectionBrick*)mTrackTypes.At(i))->DisableNClustersTPCCheck(); + ((TrackSelectionBrick*)mTrackTypes.At(i))->disableNClustersTPCCheck(); } } else if (m[1].str() == "nclsits") { storeIntCut(mNClustersITS); for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - ((TrackSelectionBrick*)mTrackTypes.At(i))->DisableNClustersITSCheck(); + ((TrackSelectionBrick*)mTrackTypes.At(i))->disableNClustersITSCheck(); } } else if (m[1].str() == "nxrtpc") { storeIntCut(mNCrossedRowsTPC); for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - ((TrackSelectionBrick*)mTrackTypes.At(i))->DisableNCrossedRowsTPCCheck(); + ((TrackSelectionBrick*)mTrackTypes.At(i))->disableNCrossedRowsTPCCheck(); } } else if (m[1].str() == "chi2clustpc") { storeFloatCut(mMaxChi2PerClusterTPC); for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - ((TrackSelectionBrick*)mTrackTypes.At(i))->DisableMaxChi2PerClusterTPCCheck(); + ((TrackSelectionBrick*)mTrackTypes.At(i))->disableMaxChi2PerClusterTPCCheck(); } } else if (m[1].str() == "chi2clusits") { storeFloatCut(mMaxChi2PerClusterITS); for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - ((TrackSelectionBrick*)mTrackTypes.At(i))->DisableMaxChi2PerClusterITSCheck(); + ((TrackSelectionBrick*)mTrackTypes.At(i))->disableMaxChi2PerClusterITSCheck(); } } else if (m[1].str() == "xrofctpc") { storeFloatCut(mMinNCrossedRowsOverFindableClustersTPC); for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - ((TrackSelectionBrick*)mTrackTypes.At(i))->DisableMinNCrossedRowsOverFindableClustersTPCCheck(); + ((TrackSelectionBrick*)mTrackTypes.At(i))->disableMinNCrossedRowsOverFindableClustersTPCCheck(); } } else if (m[1].str() == "dcaxy") { storeFloatCut(mMaxDcaXY); for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - ((TrackSelectionBrick*)mTrackTypes.At(i))->DisableMaxDcaXYCheck(); + ((TrackSelectionBrick*)mTrackTypes.At(i))->disableMaxDcaXYCheck(); } } else if (m[1].str() == "dcaz") { storeFloatCut(mMaxDcaZ); for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - ((TrackSelectionBrick*)mTrackTypes.At(i))->DisableMaxDcaZCheck(); + ((TrackSelectionBrick*)mTrackTypes.At(i))->disableMaxDcaZCheck(); } } else if (m[1].str() == "pT") { storeFloatCut(mPtRange); @@ -406,11 +413,11 @@ void TrackSelectionFilterAndAnalysis::ConstructCutFromString(const TString& cuts lev2str.Remove(0, m[0].length()); } } - mMaskLength = CalculateMaskLength(); + mMaskLength = calculateMaskLength(); } /// \brief Fills the filter cuts mask -void TrackSelectionFilterAndAnalysis::StoreArmedMask() +void TrackSelectionFilterAndAnalysis::storeArmedMask() { uint64_t armedMask = 0UL; uint64_t optMask = 0UL; @@ -421,8 +428,8 @@ void TrackSelectionFilterAndAnalysis::StoreArmedMask() int bit = 0; auto armedBrick = [&](auto brick, bool opt = false) { - std::vector res = brick->IsArmed(); - for (auto b : res) { + std::vector res = brick->isArmed(); + for (const auto& b : res) { if (b) { SETBIT(armedMask, bit); if (opt) { diff --git a/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.h b/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.h index f1ebbfe9084..cf9360149f3 100644 --- a/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.h +++ b/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.h @@ -9,6 +9,11 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file TrackSelectionFilterAndAnalysis.h +/// \brief TrackSelectionFilterAndAnalysis class for track filter and selection +/// once filtered +/// \author victor.gonzalez.sebastian@gmail.com + #ifndef PWGCF_TWOPARTICLECORRELATIONS_CORE_TRACKSELECTIONFILTERANDANALYSIS_H_ #define PWGCF_TWOPARTICLECORRELATIONS_CORE_TRACKSELECTIONFILTERANDANALYSIS_H_ @@ -30,7 +35,7 @@ namespace o2 { namespace analysis { -namespace PWGCF +namespace pwgcf { /* forward de declaration */ class TrackSelectionFilterAndAnalysis; @@ -99,19 +104,19 @@ class TrackSelectionFilterAndAnalysis : public SelectionFilterAndAnalysis { public: TrackSelectionFilterAndAnalysis(); - TrackSelectionFilterAndAnalysis(const TString&, selmodes); - TrackSelectionFilterAndAnalysis(const TrackSelectionConfigurable&, selmodes); + TrackSelectionFilterAndAnalysis(const TString&, Selmodes); + TrackSelectionFilterAndAnalysis(const TrackSelectionConfigurable&, Selmodes); - void SetPtRange(const TString&); - void SetEtaRange(const TString&); + void setPtRange(const TString&); + void setEtaRange(const TString&); template - uint64_t Filter(TrackToFilter const& track); + uint64_t filter(TrackToFilter const& track); private: - void ConstructCutFromString(const TString&); - int CalculateMaskLength(); - void StoreArmedMask(); + void constructCutFromString(const TString&); + int calculateMaskLength(); + void storeArmedMask(); TList mTrackSign; /// the track charge sign list TList mTrackTypes; /// the track types to select list @@ -131,21 +136,21 @@ class TrackSelectionFilterAndAnalysis : public SelectionFilterAndAnalysis /// \brief Fills the filter cuts mask template -uint64_t TrackSelectionFilterAndAnalysis::Filter(TrackToFilter const& track) +uint64_t TrackSelectionFilterAndAnalysis::filter(TrackToFilter const& track) { uint64_t selectedMask = 0UL; int bit = 0; auto filterTrackType = [&](TrackSelectionBrick* ttype, auto trk) { - if (ttype->Filter(trk)) { + if (ttype->filter(trk)) { SETBIT(selectedMask, bit); } bit++; }; auto filterBrickValue = [&](auto brick, auto value) { - std::vector res = brick->Filter(value); - for (auto b : res) { + std::vector res = brick->filter(value); + for (const auto& b : res) { if (b) { SETBIT(selectedMask, bit); } @@ -154,8 +159,8 @@ uint64_t TrackSelectionFilterAndAnalysis::Filter(TrackToFilter const& track) }; auto filterBrickValueNoMask = [](auto brick, auto value) { - std::vector res = brick->Filter(value); - for (auto b : res) { + std::vector res = brick->filter(value); + for (const auto& b : res) { if (b) { return true; } @@ -206,7 +211,7 @@ uint64_t TrackSelectionFilterAndAnalysis::Filter(TrackToFilter const& track) return mSelectedMask = selectedMask; } -} // namespace PWGCF +} // namespace pwgcf } // namespace analysis } // namespace o2 diff --git a/PWGCF/TwoParticleCorrelations/Core/TwoPartCorrLinkDef.h b/PWGCF/TwoParticleCorrelations/Core/TwoPartCorrLinkDef.h index 3b3bddb5118..9bd449fbda8 100644 --- a/PWGCF/TwoParticleCorrelations/Core/TwoPartCorrLinkDef.h +++ b/PWGCF/TwoParticleCorrelations/Core/TwoPartCorrLinkDef.h @@ -9,45 +9,49 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file TwoPartCorrLinkDef.h +/// \brief Tow particle correlations core library external interface definition +/// \author victor.gonzalez.sebastian@gmail.com + // NOLINT(build/header_guard) #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; -#pragma link C++ class o2::analysis::PWGCF::CutBrick < float> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrick < int> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrickLimit < float> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrickLimit < int> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrickFnLimit < float> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrickFnLimit < int> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrickThreshold < float> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrickThreshold < int> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrickFnThreshold < float> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrickFnThreshold < int> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrickExtToRange < float> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrickExtToRange < int> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrickFnExtToRange < float> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrickFnExtToRange < int> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrickRange < float> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrickRange < int> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrickFnRange < float> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrickFnRange < int> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrickSelectorMultipleRanges < float> + ; -#pragma link C++ class o2::analysis::PWGCF::CutBrickSelectorMultipleRanges < int> + ; -#pragma link C++ class o2::analysis::PWGCF::CutWithVariations < float> + ; -#pragma link C++ class o2::analysis::PWGCF::CutWithVariations < int> + ; -#pragma link C++ class o2::analysis::PWGCF::SpecialCutBrick + ; -#pragma link C++ class o2::analysis::PWGCF::TrackSelectionBrick + ; -#pragma link C++ class o2::analysis::PWGCF::SelectionFilterAndAnalysis + ; -#pragma link C++ class o2::analysis::PWGCF::TrackSelectionConfigurable + ; -#pragma link C++ class o2::analysis::PWGCF::TrackSelectionFilterAndAnalysis + ; -#pragma link C++ class o2::analysis::PWGCF::PIDSelectionConfigurable + ; -#pragma link C++ class o2::analysis::PWGCF::PIDSelectionFilterAndAnalysis + ; -#pragma link C++ class o2::analysis::PWGCF::EventSelectionConfigurable + ; -#pragma link C++ class o2::analysis::PWGCF::EventSelectionFilterAndAnalysis::ComplexBrickHelper + ; -#pragma link C++ class o2::analysis::PWGCF::EventSelectionFilterAndAnalysis::MultiplicityBrick + ; -#pragma link C++ class o2::analysis::PWGCF::EventSelectionFilterAndAnalysis::PileUpRejBrick + ; -#pragma link C++ class o2::analysis::PWGCF::EventSelectionFilterAndAnalysis + ; -#pragma link C++ class o2::analysis::PWGCF::FilterAndAnalysisFramework + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrick < float> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrick < int> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrickLimit < float> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrickLimit < int> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrickFnLimit < float> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrickFnLimit < int> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrickThreshold < float> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrickThreshold < int> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrickFnThreshold < float> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrickFnThreshold < int> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrickExtToRange < float> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrickExtToRange < int> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrickFnExtToRange < float> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrickFnExtToRange < int> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrickRange < float> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrickRange < int> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrickFnRange < float> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrickFnRange < int> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrickSelectorMultipleRanges < float> + ; +#pragma link C++ class o2::analysis::pwgcf::CutBrickSelectorMultipleRanges < int> + ; +#pragma link C++ class o2::analysis::pwgcf::CutWithVariations < float> + ; +#pragma link C++ class o2::analysis::pwgcf::CutWithVariations < int> + ; +#pragma link C++ class o2::analysis::pwgcf::SpecialCutBrick + ; +#pragma link C++ class o2::analysis::pwgcf::TrackSelectionBrick + ; +#pragma link C++ class o2::analysis::pwgcf::SelectionFilterAndAnalysis + ; +#pragma link C++ class o2::analysis::pwgcf::TrackSelectionConfigurable + ; +#pragma link C++ class o2::analysis::pwgcf::TrackSelectionFilterAndAnalysis + ; +#pragma link C++ class o2::analysis::pwgcf::PIDSelectionConfigurable + ; +#pragma link C++ class o2::analysis::pwgcf::PIDSelectionFilterAndAnalysis + ; +#pragma link C++ class o2::analysis::pwgcf::EventSelectionConfigurable + ; +#pragma link C++ class o2::analysis::pwgcf::EventSelectionFilterAndAnalysis::ComplexBrickHelper + ; +#pragma link C++ class o2::analysis::pwgcf::EventSelectionFilterAndAnalysis::MultiplicityBrick + ; +#pragma link C++ class o2::analysis::pwgcf::EventSelectionFilterAndAnalysis::PileUpRejBrick + ; +#pragma link C++ class o2::analysis::pwgcf::EventSelectionFilterAndAnalysis + ; +#pragma link C++ class o2::analysis::pwgcf::FilterAndAnalysisFramework + ; #pragma link C++ class DihadronContainer + ; diff --git a/PWGCF/TwoParticleCorrelations/DataModel/TwoParticleCorrelationsFiltered.h b/PWGCF/TwoParticleCorrelations/DataModel/TwoParticleCorrelationsFiltered.h index c2376828a55..01067b08b79 100644 --- a/PWGCF/TwoParticleCorrelations/DataModel/TwoParticleCorrelationsFiltered.h +++ b/PWGCF/TwoParticleCorrelations/DataModel/TwoParticleCorrelationsFiltered.h @@ -9,6 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file TwoParticleCorrelationsFiltered.h +/// \brief The filtered datamodel +/// \author victor.gonzalez.sebastian@gmail.com + #ifndef PWGCF_TWOPARTICLECORRELATIONS_DATAMODEL_TWOPARTICLECORRELATIONSFILTERED_H_ #define PWGCF_TWOPARTICLECORRELATIONS_DATAMODEL_TWOPARTICLECORRELATIONSFILTERED_H_ @@ -24,27 +28,27 @@ namespace aod /* we have to change from int to bool when bool columns work properly */ namespace twopfilter { -DECLARE_SOA_COLUMN(TwoPCollisionAccepted, accepted, uint8_t); //! If the collision/event has been accepted or not -DECLARE_SOA_COLUMN(TwoPCollisionCentMult, centmult, float); //! The centrality/multiplicity pecentile -DECLARE_SOA_COLUMN(TwoPMCCollisionCentMult, mccentmult, float); //! The centrality/multiplicity pecentile +DECLARE_SOA_COLUMN(Accepted, accepted, uint8_t); //! If the collision/event has been accepted or not +DECLARE_SOA_COLUMN(CentMult, centMult, float); //! The centrality/multiplicity pecentile +DECLARE_SOA_COLUMN(McCentMult, mcCentMult, float); //! The centrality/multiplicity pecentile } // namespace twopfilter DECLARE_SOA_TABLE(TwoPAcceptedCollisions, "AOD", "TWOPACCCOLL", //! Accepted reconstructed collisions/events filtered table - twopfilter::TwoPCollisionCentMult, - twopfilter::TwoPCollisionAccepted); + twopfilter::CentMult, + twopfilter::Accepted); using TowPAcceptedCollision = TwoPAcceptedCollisions::iterator; DECLARE_SOA_TABLE(TwoPAcceptedGenCollisions, "AOD", "TWOPACCGENCOLL", //! Accepted generated collisions/events filtered table - twopfilter::TwoPMCCollisionCentMult, - twopfilter::TwoPCollisionAccepted); + twopfilter::McCentMult, + twopfilter::Accepted); using TwoPAcceptedGenCollision = TwoPAcceptedGenCollisions::iterator; namespace twopfilter { -DECLARE_SOA_COLUMN(TwoPTrackAcceptedAs, acceptedas, uint8_t); //! Track accepted as type 0..255, even positive, odd negative, < 0 not accepted -DECLARE_SOA_COLUMN(TwoPParticleAcceptedAs, mcacceptedas, uint8_t); //! Particle accepted as type 0..255, even positive, odd negative, < 0 not accepted +DECLARE_SOA_COLUMN(AcceptedAs, acceptedAs, uint8_t); //! Track accepted as type 0..255, even positive, odd negative, < 0 not accepted +DECLARE_SOA_COLUMN(McAcceptedAs, mcAcceptedAs, uint8_t); //! Particle accepted as type 0..255, even positive, odd negative, < 0 not accepted } // namespace twopfilter DECLARE_SOA_TABLE(TwoPFilteredTracks, "AOD", "FILTEREDTRKS", //! The reconstructed tracks filtered table - twopfilter::TwoPTrackAcceptedAs); + twopfilter::AcceptedAs); DECLARE_SOA_TABLE(TwoPFilteredParticles, "AOD", "FILTEREDGENTRKS", //! The generated particles filtered table - twopfilter::TwoPParticleAcceptedAs); + twopfilter::McAcceptedAs); } // namespace aod } // namespace o2 diff --git a/PWGCF/TwoParticleCorrelations/DataModel/TwoParticleCorrelationsSkimmed.h b/PWGCF/TwoParticleCorrelations/DataModel/TwoParticleCorrelationsSkimmed.h index 3dc26215d89..58eb82c0994 100644 --- a/PWGCF/TwoParticleCorrelations/DataModel/TwoParticleCorrelationsSkimmed.h +++ b/PWGCF/TwoParticleCorrelations/DataModel/TwoParticleCorrelationsSkimmed.h @@ -9,6 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file TwoParticleCorrelationsSkimmed.h +/// \brief The skimmed datamodel +/// \author victor.gonzalez.sebastian@gmail.com + #ifndef PWGCF_TWOPARTICLECORRELATIONS_DATAMODEL_TWOPARTICLECORRELATIONSSKIMMED_H_ #define PWGCF_TWOPARTICLECORRELATIONS_DATAMODEL_TWOPARTICLECORRELATIONSSKIMMED_H_ @@ -25,82 +29,82 @@ namespace aod /* we have to change from int to bool when bool columns work properly */ namespace cfskim { -DECLARE_SOA_COLUMN(CFCollisionCentMult, centmult, std::vector); //! The centrality/multiplicity pecentile -DECLARE_SOA_COLUMN(CFCollisionFlags, selflags, uint64_t); //! The skimming flags for collision selection -DECLARE_SOA_COLUMN(CFMCCollisionFlags, mcselflags, uint64_t); //! The skimming flags for generated collision selection +DECLARE_SOA_COLUMN(CentMult, centMult, std::vector); //! The centrality/multiplicity pecentile +DECLARE_SOA_COLUMN(SelFlags, selFlags, uint64_t); //! The skimming flags for collision selection +DECLARE_SOA_COLUMN(McSelFlags, mcSelFlags, uint64_t); //! The skimming flags for generated collision selection } // namespace cfskim DECLARE_SOA_TABLE(CFCollisions, "AOD", "CFCOLLISION", //! Accepted reconstructed collisions/events filtered table o2::soa::Index<>, collision::PosZ, bc::RunNumber, timestamp::Timestamp, - cfskim::CFCollisionFlags, - cfskim::CFCollisionCentMult); + cfskim::SelFlags, + cfskim::CentMult); using CFCollision = CFCollisions::iterator; DECLARE_SOA_TABLE(CFCollMasks, "AOD", "CFCOLLMASK", //! collision/event minimal filtered table - cfskim::CFCollisionFlags, - cfskim::CFCollisionCentMult); + cfskim::SelFlags, + cfskim::CentMult); using CFCollMask = CFCollMasks::iterator; DECLARE_SOA_TABLE(CFMCCollisions, "AOD", "CFMCCOLLISION", //! Accepted generated collisions/events filtered table o2::soa::Index<>, mccollision::PosZ, - cfskim::CFMCCollisionFlags, - cfskim::CFCollisionCentMult); //! TODO: To check if to have this columng does make sense for generated collisions + cfskim::McSelFlags, + cfskim::CentMult); //! TODO: To check if to have this columng does make sense for generated collisions using CFMCCollision = CFMCCollisions::iterator; DECLARE_SOA_TABLE(CFMCCollMasks, "AOD", "CFMCCOLLMASK", //! Generated collision/event minimal filtered table - cfskim::CFMCCollisionFlags, - cfskim::CFCollisionCentMult); //! TODO: To check if to have this columng does make sense for generated collisions + cfskim::McSelFlags, + cfskim::CentMult); //! TODO: To check if to have this columng does make sense for generated collisions using CFMCCollMask = CFMCCollMasks::iterator; namespace cfskim { -DECLARE_SOA_INDEX_COLUMN(CFCollision, cfcollision); //! Reconstructed collision/event -DECLARE_SOA_INDEX_COLUMN(CFMCCollision, cfmccollision); //! Generated collision/event -DECLARE_SOA_COLUMN(CFTrackFlags, trackflags, uint64_t); //! The skimming flags for track selection, B0 track/particle positive charge, B1 track/particle negative charge -DECLARE_SOA_COLUMN(CFMCTrackFlags, mctrackflags, uint64_t); //! The skimming flags for particle selection, B0 track/particle positive charge, B1 track/particle negative charge -DECLARE_SOA_COLUMN(CFPidFlags, pidflags, uint64_t); //! The PID skimming flags for track selection -DECLARE_SOA_COLUMN(Pt, pt, float); //! The track transverse momentum -DECLARE_SOA_COLUMN(Eta, eta, float); //! The track pseudorapidity -DECLARE_SOA_COLUMN(Phi, phi, float); //! The track azimuthal angle -DECLARE_SOA_DYNAMIC_COLUMN(Sign, sign, //! Charge: positive: 1, negative: -1 +DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! Reconstructed collision/event +DECLARE_SOA_INDEX_COLUMN(McCollision, mcCollision); //! Generated collision/event +DECLARE_SOA_COLUMN(TrackFlags, trackFlags, uint64_t); //! The skimming flags for track selection, B0 track/particle positive charge, B1 track/particle negative charge +DECLARE_SOA_COLUMN(McTrackFlags, mcTrackFlags, uint64_t); //! The skimming flags for particle selection, B0 track/particle positive charge, B1 track/particle negative charge +DECLARE_SOA_COLUMN(PidFlags, pidFlags, uint64_t); //! The PID skimming flags for track selection +DECLARE_SOA_COLUMN(Pt, pt, float); //! The track transverse momentum +DECLARE_SOA_COLUMN(Eta, eta, float); //! The track pseudorapidity +DECLARE_SOA_COLUMN(Phi, phi, float); //! The track azimuthal angle +DECLARE_SOA_DYNAMIC_COLUMN(Sign, sign, //! Charge: positive: 1, negative: -1 [](uint64_t mask) -> int8_t { return ((mask & 0x1L) == 0x1L) ? 1 : ((mask & 0x2L) == 0x2L) ? -1 : 0; }); } // namespace cfskim DECLARE_SOA_TABLE(CFTracks, "AOD", "CFTRACK", //! The reconstructed tracks filtered table o2::soa::Index<>, - cfskim::CFCollisionId, - cfskim::CFTrackFlags, + cfskim::CollisionId, + cfskim::TrackFlags, cfskim::Pt, cfskim::Eta, cfskim::Phi, - cfskim::Sign); + cfskim::Sign); using CFTrack = CFTracks::iterator; DECLARE_SOA_TABLE(CFTrackMasks, "AOD", "CFTRACKMASK", //! The reconstructed tracks filtered table - cfskim::CFTrackFlags); + cfskim::TrackFlags); using CFTrackMask = CFTrackMasks::iterator; DECLARE_SOA_TABLE(CFTrackPIDs, "AOD", "CFTRACKPID", //! The reconstructed tracks PID filtered table - cfskim::CFPidFlags); + cfskim::PidFlags); using CFTrackPID = CFTrackPIDs::iterator; DECLARE_SOA_TABLE(CFMCParticles, "AOD", "CFMCPARICLE", //! The generated particles filtered table o2::soa::Index<>, - cfskim::CFMCCollisionId, - cfskim::CFMCTrackFlags, + cfskim::McCollisionId, + cfskim::McTrackFlags, cfskim::Pt, cfskim::Eta, cfskim::Phi); using CFMCParticle = CFMCParticles::iterator; DECLARE_SOA_TABLE(CFMCPartMask, "AOD", "CFMCPARTMASK", //! The generated particles filtered table - cfskim::CFMCTrackFlags); + cfskim::McTrackFlags); using CFMCParticle = CFMCParticles::iterator; namespace cfskim { -DECLARE_SOA_INDEX_COLUMN(CFMCParticle, mcparticle); +DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle); } DECLARE_SOA_TABLE(CFMCCollisionLbls, "AOD", "CFMCCOLLISONLBL", - cfskim::CFMCCollisionId, + cfskim::McCollisionId, mccollisionlabel::McMask); DECLARE_SOA_TABLE(CFMCTrackLabels, "AOD", "CFMCTRACKLABEL", - cfskim::CFMCParticleId, + cfskim::McParticleId, mctracklabel::McMask); } // namespace aod } // namespace o2 diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsFiltering.cxx b/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsFiltering.cxx index 1733559dd0b..2ba80db1377 100644 --- a/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsFiltering.cxx +++ b/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsFiltering.cxx @@ -9,6 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file twoParticleCorrelationsFiltering.cxx +/// \brief Filters collisions and tracks +/// \author victor.gonzalez.sebastian@gmail.com + #include "PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h" #include "PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.h" #include "PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.h" @@ -41,23 +45,23 @@ namespace o2::analysis::twopfilter #define TWOPFILTERLOGTRACKS debug uint64_t collisionmask = 0UL; -std::vector collisionmask_opt; -uint64_t collisionmask_forced = 0UL; +std::vector collisionmaskOptional; +uint64_t collisionmaskForced = 0UL; uint64_t trackmask = 0UL; -std::vector trackmask_opt; -uint64_t trackmask_forced = 0UL; +std::vector trackmaskOptional; +uint64_t trackmaskForced = 0UL; uint64_t pidmask = 0UL; -std::vector pidmask_opt; -uint64_t pidmask_forced = 0UL; +std::vector pidmaskOptional; +uint64_t pidmaskForced = 0UL; -PWGCF::FilterAndAnalysisFramework* fFilterFramework = nullptr; +pwgcf::FilterAndAnalysisFramework* fFilterFramework = nullptr; int fMultiplicityIndex = -1; //! the index to the multiplicity values array } // namespace o2::analysis::twopfilter using namespace o2::aod::cfskim; -struct TwoParticleCorrelationsFilter { +struct TwoParticleCorrelationsFiltering { Produces acceptedcollisions; Produces accepteddtracks; Produces acceptedgencollisions; @@ -72,40 +76,40 @@ struct TwoParticleCorrelationsFilter { { using namespace twopfilter; - LOGF(info, "TwoParticleCorrelationsFilter::init()"); + LOGF(info, "TwoParticleCorrelationsFiltering::init()"); /* collision filtering configuration */ - PWGCF::EventSelectionConfigurable eventsel(eventfilter.bfield, eventfilter.centmultsel, {}, eventfilter.zvtxsel, eventfilter.pileuprej); + pwgcf::EventSelectionConfigurable eventsel(eventfilter.bfield, eventfilter.centmultsel, {}, eventfilter.zvtxsel, eventfilter.pileuprej); /* track filtering configuration */ - PWGCF::TrackSelectionConfigurable trksel(trackfilter.ttype, trackfilter.nclstpc, trackfilter.nxrtpc, trackfilter.nclsits, trackfilter.chi2clustpc, + pwgcf::TrackSelectionConfigurable trksel(trackfilter.ttype, trackfilter.nclstpc, trackfilter.nxrtpc, trackfilter.nclsits, trackfilter.chi2clustpc, trackfilter.chi2clusits, trackfilter.xrofctpc, trackfilter.dcaxy, trackfilter.dcaz, trackfilter.ptrange, trackfilter.etarange); #ifdef INCORPORATEBAYESIANPID - PWGCF::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, + pwgcf::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, pidfilter.pidtoffilter.tpcel, pidfilter.pidtoffilter.tpcmu, pidfilter.pidtoffilter.tpcpi, pidfilter.pidtoffilter.tpcka, pidfilter.pidtoffilter.tpcpr, pidfilter.pidbayesfilter.bayel, pidfilter.pidbayesfilter.baymu, pidfilter.pidbayesfilter.baypi, pidfilter.pidbayesfilter.bayka, pidfilter.pidbayesfilter.baypr); #else - PWGCF::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, + pwgcf::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, pidfilter.pidtoffilter.tpcel, pidfilter.pidtoffilter.tpcmu, pidfilter.pidtoffilter.tpcpi, pidfilter.pidtoffilter.tpcka, pidfilter.pidtoffilter.tpcpr); #endif - fFilterFramework = new PWGCF::FilterAndAnalysisFramework(filterccdb.ccdburl.value, filterccdb.ccdbpath.value, filterccdb.filterdate.value); - fFilterFramework->SetConfiguration(eventsel, trksel, pidsel, PWGCF::SelectionFilterAndAnalysis::kAnalysis); - fFilterFramework->Init(); + fFilterFramework = new pwgcf::FilterAndAnalysisFramework(filterccdb.ccdburl.value, filterccdb.ccdbpath.value, filterccdb.filterdate.value); + fFilterFramework->setConfiguration(eventsel, trksel, pidsel, pwgcf::SelectionFilterAndAnalysis::KAnalysis); + fFilterFramework->init(); nReportedTracks = 0; collisionmask = fFilterFramework->getCollisionMask(); - collisionmask_opt = fFilterFramework->getCollisionOptMask(); - collisionmask_forced = fFilterFramework->getCollisionForcedMask(); + collisionmaskOptional = fFilterFramework->getCollisionOptMask(); + collisionmaskForced = fFilterFramework->getCollisionForcedMask(); fMultiplicityIndex = fFilterFramework->getCollisionMultiplicityIndex(); trackmask = fFilterFramework->getTrackMask(); - trackmask_opt = fFilterFramework->getTrackOptMask(); - trackmask_forced = fFilterFramework->getTrackForcedMask(); + trackmaskOptional = fFilterFramework->getTrackOptMask(); + trackmaskForced = fFilterFramework->getTrackForcedMask(); pidmask = fFilterFramework->getPIDMask(); - pidmask_opt = fFilterFramework->getPIDOptMask(); - pidmask_forced = fFilterFramework->getPIDForcedMask(); - LOGF(info, "TwoParticleCorrelationsFilter::init(), collision selection masks 0x%016lx, %s, and 0x%016lx and multiplicity index %d", collisionmask, fFilterFramework->printCollisionOptionalMasks().Data(), collisionmask_forced, fMultiplicityIndex); - LOGF(info, "TwoParticleCorrelationsFilter::init(), track selection masks 0x%016lx, %s, and 0x%016lx ", trackmask, fFilterFramework->printTrackOptionalMasks().Data(), trackmask_forced); - LOGF(info, "TwoParticleCorrelationsFilter::init(), PID selection masks 0x%016lx, %s, and 0x%016lx ", pidmask, fFilterFramework->printPIDOptionalMasks().Data(), pidmask_forced); + pidmaskOptional = fFilterFramework->getPIDOptMask(); + pidmaskForced = fFilterFramework->getPIDForcedMask(); + LOGF(info, "TwoParticleCorrelationsFiltering::init(), collision selection masks 0x%016lx, %s, and 0x%016lx and multiplicity index %d", collisionmask, fFilterFramework->printCollisionOptionalMasks().Data(), collisionmaskForced, fMultiplicityIndex); + LOGF(info, "TwoParticleCorrelationsFiltering::init(), track selection masks 0x%016lx, %s, and 0x%016lx ", trackmask, fFilterFramework->printTrackOptionalMasks().Data(), trackmaskForced); + LOGF(info, "TwoParticleCorrelationsFiltering::init(), PID selection masks 0x%016lx, %s, and 0x%016lx ", pidmask, fFilterFramework->printPIDOptionalMasks().Data(), pidmaskForced); if (collisionmask == static_cast(0) || trackmask == static_cast(0)) { - LOGF(fatal, "TwoParticleCorrelationsFilter::init() null masks, selecting everything!!!"); + LOGF(fatal, "TwoParticleCorrelationsFiltering::init() null masks, selecting everything!!!"); } /* TODO: check the cuts signatures against the CCDB contents */ LOGF(info, "Collision skimming signature: %s", fFilterFramework->getEventFilterCutStringSignature().Data()); @@ -117,69 +121,69 @@ struct TwoParticleCorrelationsFilter { soa::Join const& tracks) { using namespace twopfilter; - LOGF(TWOPFILTERLOGCOLLISIONS, "Received collision with mask 0x%016lx and %ld tracks", collision.selflags(), tracks.size()); + LOGF(TWOPFILTERLOGCOLLISIONS, "Received collision with mask 0x%016lx and %ld tracks", collision.selFlags(), tracks.size()); auto passOptions = [](const auto& options, auto mask) { bool all = true; - for (auto option : options) { + for (const auto& option : options) { all = all && ((option & mask) != 0UL); } return all; }; - if ((collision.selflags() & collisionmask_forced) == collisionmask_forced && passOptions(collisionmask_opt, collision.selflags())) { - LOGF(TWOPFILTERLOGCOLLISIONS, ">> Accepted collision with mask 0x%016lx and %ld unfiltered tracks", collision.selflags(), tracks.size()); - acceptedcollisions(collision.centmult()[fMultiplicityIndex], uint8_t(true)); + if ((collision.selFlags() & collisionmaskForced) == collisionmaskForced && passOptions(collisionmaskOptional, collision.selFlags())) { + LOGF(TWOPFILTERLOGCOLLISIONS, ">> Accepted collision with mask 0x%016lx and %ld unfiltered tracks", collision.selFlags(), tracks.size()); + acceptedcollisions(collision.centMult()[fMultiplicityIndex], uint8_t(true)); int nAcceptedTracks = 0; for (const auto& track : tracks) { - if ((track.trackflags() & trackmask_forced) == trackmask_forced && passOptions(trackmask_opt, track.trackflags())) { + if ((track.trackFlags() & trackmaskForced) == trackmaskForced && passOptions(trackmaskOptional, track.trackFlags())) { accepteddtracks(0); // TODO: the kind of accepted track nAcceptedTracks++; } else { accepteddtracks(-1); } } - LOGF(TWOPFILTERLOGCOLLISIONS, ">> Accepted collision with mask 0x%016lx and %d accepted tracks", collision.selflags(), nAcceptedTracks); + LOGF(TWOPFILTERLOGCOLLISIONS, ">> Accepted collision with mask 0x%016lx and %d accepted tracks", collision.selFlags(), nAcceptedTracks); } else { - acceptedcollisions(collision.centmult()[fMultiplicityIndex], uint8_t(false)); + acceptedcollisions(collision.centMult()[fMultiplicityIndex], uint8_t(false)); } } - PROCESS_SWITCH(TwoParticleCorrelationsFilter, processRun2, "Process Run 2, i.e. over NOT stored derived data, two particle correlations filtering", true); + PROCESS_SWITCH(TwoParticleCorrelationsFiltering, processRun2, "Process Run 2, i.e. over NOT stored derived data, two particle correlations filtering", true); void processRun3(aod::CFCollision const& collision, aod::CFTracks const& tracks) { using namespace twopfilter; - LOGF(TWOPFILTERLOGCOLLISIONS, "Received collision with mask 0x%016lx and %ld tracks", collision.selflags(), tracks.size()); + LOGF(TWOPFILTERLOGCOLLISIONS, "Received collision with mask 0x%016lx and %ld tracks", collision.selFlags(), tracks.size()); auto passOptions = [](const auto& options, auto mask) { bool all = true; - for (auto option : options) { + for (const auto& option : options) { all = all && ((option & mask) != 0UL); } return all; }; - if ((collision.selflags() & collisionmask_forced) == collisionmask_forced && passOptions(collisionmask_opt, collision.selflags())) { - LOGF(TWOPFILTERLOGCOLLISIONS, ">> Accepted collision with mask 0x%016lx and %ld unfiltered tracks", collision.selflags(), tracks.size()); - acceptedcollisions(collision.centmult()[fMultiplicityIndex], uint8_t(true)); + if ((collision.selFlags() & collisionmaskForced) == collisionmaskForced && passOptions(collisionmaskOptional, collision.selFlags())) { + LOGF(TWOPFILTERLOGCOLLISIONS, ">> Accepted collision with mask 0x%016lx and %ld unfiltered tracks", collision.selFlags(), tracks.size()); + acceptedcollisions(collision.centMult()[fMultiplicityIndex], uint8_t(true)); int nAcceptedTracks = 0; for (const auto& track : tracks) { - if ((track.trackflags() & trackmask_forced) == trackmask_forced && passOptions(trackmask_opt, track.trackflags())) { + if ((track.trackFlags() & trackmaskForced) == trackmaskForced && passOptions(trackmaskOptional, track.trackFlags())) { accepteddtracks(0); // TODO: the kind of accepted track nAcceptedTracks++; } else { accepteddtracks(-1); } } - LOGF(TWOPFILTERLOGCOLLISIONS, ">> Accepted collision with mask 0x%016lx and %d accepted tracks", collision.selflags(), nAcceptedTracks); + LOGF(TWOPFILTERLOGCOLLISIONS, ">> Accepted collision with mask 0x%016lx and %d accepted tracks", collision.selFlags(), nAcceptedTracks); } else { - acceptedcollisions(collision.centmult()[fMultiplicityIndex], uint8_t(false)); + acceptedcollisions(collision.centMult()[fMultiplicityIndex], uint8_t(false)); } } - PROCESS_SWITCH(TwoParticleCorrelationsFilter, processRun3, "Process Run 3, i.e. over stored derived data, two particle correlations filtering", false); + PROCESS_SWITCH(TwoParticleCorrelationsFiltering, processRun3, "Process Run 3, i.e. over stored derived data, two particle correlations filtering", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; return workflow; } diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsFullSkimming.cxx b/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsFullSkimming.cxx index 8f2bb9d9650..e8c0749896a 100644 --- a/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsFullSkimming.cxx +++ b/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsFullSkimming.cxx @@ -9,6 +9,11 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file twoParticleCorrelationsFullSkimming.cxx +/// \brief Filters collisions and tracks according to the +/// skimming configuration producing derived data to be stored +/// \author victor.gonzalez.sebastian@gmail.com + #include "PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h" #include "PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.h" #include "PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.h" @@ -53,15 +58,15 @@ namespace o2::analysis::cfskim #define LOGTRACKCOLLISIONS debug #define LOGTRACKTRACKS debug #ifdef INCORPORATEBAYESIANPID -using pidTables = soa::Join; #else -using pidTables = soa::Join; #endif -PWGCF::FilterAndAnalysisFramework* fFilterFramework = nullptr; +pwgcf::FilterAndAnalysisFramework* fFilterFramework = nullptr; } // namespace o2::analysis::cfskim using namespace cfskim; @@ -110,7 +115,7 @@ void reportEventCuts(const std::shared_ptr& h, uint32_t eventcuts) h->SetEntries(entries + 1); } -struct TwoParticleCorrelationsSkimming { +struct TwoParticleCorrelationsFullSkimming { /* skimmed data tables */ Produces skimmedcollision; Produces skimmedtrack; @@ -149,22 +154,22 @@ struct TwoParticleCorrelationsSkimming { LOGF(info, "DptDptSkimTask::init()"); /* collision filtering configuration */ - PWGCF::EventSelectionConfigurable eventsel(eventfilter.bfield, eventfilter.centmultsel, {}, eventfilter.zvtxsel, eventfilter.pileuprej); + pwgcf::EventSelectionConfigurable eventsel(eventfilter.bfield, eventfilter.centmultsel, {}, eventfilter.zvtxsel, eventfilter.pileuprej); /* track filtering configuration */ - PWGCF::TrackSelectionConfigurable trksel(trackfilter.ttype, trackfilter.nclstpc, trackfilter.nxrtpc, trackfilter.nclsits, trackfilter.chi2clustpc, + pwgcf::TrackSelectionConfigurable trksel(trackfilter.ttype, trackfilter.nclstpc, trackfilter.nxrtpc, trackfilter.nclsits, trackfilter.chi2clustpc, trackfilter.chi2clusits, trackfilter.xrofctpc, trackfilter.dcaxy, trackfilter.dcaz, trackfilter.ptrange, trackfilter.etarange); #ifdef INCORPORATEBAYESIANPID - PWGCF::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, + pwgcf::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, pidfilter.pidtoffilter.tpcel, pidfilter.pidtoffilter.tpcmu, pidfilter.pidtoffilter.tpcpi, pidfilter.pidtoffilter.tpcka, pidfilter.pidtoffilter.tpcpr, pidfilter.pidbayesfilter.bayel, pidfilter.pidbayesfilter.baymu, pidfilter.pidbayesfilter.baypi, pidfilter.pidbayesfilter.bayka, pidfilter.pidbayesfilter.baypr); #else - PWGCF::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, + pwgcf::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, pidfilter.pidtoffilter.tpcel, pidfilter.pidtoffilter.tpcmu, pidfilter.pidtoffilter.tpcpi, pidfilter.pidtoffilter.tpcka, pidfilter.pidtoffilter.tpcpr); #endif - fFilterFramework = new PWGCF::FilterAndAnalysisFramework(filterccdb.ccdburl.value, filterccdb.ccdbpath.value, filterccdb.filterdate.value); - fFilterFramework->SetConfiguration(eventsel, trksel, pidsel, PWGCF::SelectionFilterAndAnalysis::kFilter); - fFilterFramework->Init(); + fFilterFramework = new pwgcf::FilterAndAnalysisFramework(filterccdb.ccdburl.value, filterccdb.ccdbpath.value, filterccdb.filterdate.value); + fFilterFramework->setConfiguration(eventsel, trksel, pidsel, pwgcf::SelectionFilterAndAnalysis::KFilter); + fFilterFramework->init(); nReportedTracks = 0; /* TODO: upload the cuts signatures to the CCDB */ @@ -212,8 +217,9 @@ struct TwoParticleCorrelationsSkimming { accepted = false; } /* vertex */ + constexpr float LimitCovZZ = 0.25; if (!TESTBIT(eventcuts, kNonZeroNContribs) || - (((collision.flags() & Run2VertexerZ) == Run2VertexerZ) && collision.covZZ() < 0.25)) { + (((collision.flags() & Run2VertexerZ) == Run2VertexerZ) && collision.covZZ() < LimitCovZZ)) { accepted = false; } reportEventCuts(historeg.get(HIST("EventCuts")), eventcuts); @@ -225,14 +231,14 @@ struct TwoParticleCorrelationsSkimming { runNumber = bcinfo.runNumber(); } if (accepted) { - return fFilterFramework->FilterCollision(collision, tracks, bfield); + return fFilterFramework->filterCollision(collision, tracks, bfield); } else { return 0UL; } } void processRun2(soa::Join::iterator const& collision, - soa::Join const&, soa::Join const& tracks) + soa::Join const&, soa::Join const& tracks) { /* for the time being this will apply only to Run 1+2 converted data */ LOGF(LOGTRACKCOLLISIONS, "Got a new collision with zvtx %.2f and V0M %.2f, CL0 %.2f, CL1 %.2f", collision.posZ(), collision.centRun2V0M(), collision.centRun2CL0(), collision.centRun2CL1()); @@ -242,19 +248,21 @@ struct TwoParticleCorrelationsSkimming { LOGF(LOGTRACKCOLLISIONS, "Got mask 0x%16lx", colmask); if (colmask != 0UL) { - skimmedcollision(collision.posZ(), bc.runNumber(), bc.timestamp(), colmask, fFilterFramework->GetCollisionMultiplicities()); + skimmedcollision(collision.posZ(), bc.runNumber(), bc.timestamp(), colmask, fFilterFramework->getCollisionMultiplicities()); int nFilteredTracks = 0; int nCollisionReportedTracks = 0; + constexpr int MaxReportedTracks = 1000; + constexpr int MaxReportedTracksPerCollision = 20; for (auto const& track : tracks) { - auto trkmask = fFilterFramework->FilterTrack(track); - auto pidmask = fFilterFramework->FilterTrackPID(track); + auto trkmask = fFilterFramework->filterTrack(track); + auto pidmask = fFilterFramework->filterTrackPID(track); if (trkmask != 0UL) { skimmedtrack(skimmedcollision.lastIndex(), trkmask, track.pt(), track.eta(), track.phi()); skimmtrackpid(pidmask); nFilteredTracks++; } - if (trkmask != 0UL && nReportedTracks < 1000) { - if (nCollisionReportedTracks < 20) { + if (trkmask != 0UL && nReportedTracks < MaxReportedTracks) { + if (nCollisionReportedTracks < MaxReportedTracksPerCollision) { LOGF(LOGTRACKTRACKS, " Got track mask 0x%016lx and PID mask 0x%016lx", trkmask, pidmask); LOGF(LOGTRACKTRACKS, " TPC clusters %d, Chi2 per TPC cluster %f, pT %f, eta %f, track type %d", track.tpcNClsFound(), track.tpcChi2NCl(), track.pt(), track.eta(), track.trackType()); @@ -266,10 +274,10 @@ struct TwoParticleCorrelationsSkimming { LOGF(LOGTRACKCOLLISIONS, ">> Filtered %d tracks", nFilteredTracks); } } - PROCESS_SWITCH(TwoParticleCorrelationsSkimming, processRun2, "Process on Run 1 or Run 2 data, i.e. do not store derived data ", true); + PROCESS_SWITCH(TwoParticleCorrelationsFullSkimming, processRun2, "Process on Run 1 or Run 2 data, i.e. do not store derived data ", true); void processRun3(soa::Join::iterator const& collision, - soa::Join const&, soa::Join const& tracks) + soa::Join const&, soa::Join const& tracks) { /* for the time being this will apply only to Run 1+2 converted data */ LOGF(LOGTRACKCOLLISIONS, "Got a new collision with zvtx %.2f and V0M %.2f, CL0 %.2f, CL1 %.2f", collision.posZ(), collision.centRun2V0M(), collision.centRun2CL0(), collision.centRun2CL1()); @@ -279,19 +287,21 @@ struct TwoParticleCorrelationsSkimming { LOGF(LOGTRACKCOLLISIONS, "Got mask 0x%16lx", colmask); if (colmask != 0UL) { - skimmedcollision(collision.posZ(), bc.runNumber(), bc.timestamp(), colmask, fFilterFramework->GetCollisionMultiplicities()); + skimmedcollision(collision.posZ(), bc.runNumber(), bc.timestamp(), colmask, fFilterFramework->getCollisionMultiplicities()); int nFilteredTracks = 0; int nCollisionReportedTracks = 0; + constexpr int MaxReportedTracks = 1000; + constexpr int MaxReportedTracksPerCollision = 20; for (auto const& track : tracks) { - auto trkmask = fFilterFramework->FilterTrack(track); - auto pidmask = fFilterFramework->FilterTrackPID(track); + auto trkmask = fFilterFramework->filterTrack(track); + auto pidmask = fFilterFramework->filterTrackPID(track); if (trkmask != 0UL) { skimmedtrack(skimmedcollision.lastIndex(), trkmask, track.pt(), track.eta(), track.phi()); skimmtrackpid(pidmask); nFilteredTracks++; } - if (trkmask != 0UL && nReportedTracks < 1000) { - if (nCollisionReportedTracks < 20) { + if (trkmask != 0UL && nReportedTracks < MaxReportedTracks) { + if (nCollisionReportedTracks < MaxReportedTracksPerCollision) { LOGF(LOGTRACKTRACKS, " Got track mask 0x%016lx and PID mask 0x%016lx", trkmask, pidmask); LOGF(LOGTRACKTRACKS, " TPC clusters %d, Chi2 per TPC cluster %f, pT %f, eta %f, track type %d", track.tpcNClsFound(), track.tpcChi2NCl(), track.pt(), track.eta(), track.trackType()); @@ -303,12 +313,12 @@ struct TwoParticleCorrelationsSkimming { LOGF(LOGTRACKCOLLISIONS, ">> Filtered %d tracks", nFilteredTracks); } } - PROCESS_SWITCH(TwoParticleCorrelationsSkimming, processRun3, "Process on Run 3, i.e. store derived data", false); + PROCESS_SWITCH(TwoParticleCorrelationsFullSkimming, processRun3, "Process on Run 3, i.e. store derived data", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; return workflow; } diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsNotStoredSkimming.cxx b/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsNotStoredSkimming.cxx index 797103d4451..1d0f1438fc4 100644 --- a/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsNotStoredSkimming.cxx +++ b/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsNotStoredSkimming.cxx @@ -9,6 +9,11 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file twoParticleCorrelationsNotStoredSkimming.cxx +/// \brief Filters collisions and tracks according to the +/// skimming configuration but without storing the derived data +/// \author victor.gonzalez.sebastian@gmail.com + #include "PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h" #include "PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.h" #include "PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.h" @@ -53,15 +58,15 @@ namespace o2::analysis::cfskim #define LOGTRACKCOLLISIONS debug #define LOGTRACKTRACKS debug #ifdef INCORPORATEBAYESIANPID -using pidTables = soa::Join; #else -using pidTables = soa::Join; #endif -PWGCF::FilterAndAnalysisFramework* fFilterFramework = nullptr; +pwgcf::FilterAndAnalysisFramework* fFilterFramework = nullptr; } // namespace o2::analysis::cfskim using namespace cfskim; @@ -110,7 +115,7 @@ void reportEventCuts(const std::shared_ptr& h, uint32_t eventcuts) h->SetEntries(entries + 1); } -struct TwoParticleCorrelationsCollisionSkimming { +struct TwoParticleCorrelationsNotStoredSkimming { /* skimmed data tables */ Produces collisionmask; Produces gencollisionmask; @@ -146,22 +151,22 @@ struct TwoParticleCorrelationsCollisionSkimming { LOGF(info, "DptDptSkimTask::init()"); /* collision filtering configuration */ - PWGCF::EventSelectionConfigurable eventsel(eventfilter.bfield, eventfilter.centmultsel, {}, eventfilter.zvtxsel, eventfilter.pileuprej); + pwgcf::EventSelectionConfigurable eventsel(eventfilter.bfield, eventfilter.centmultsel, {}, eventfilter.zvtxsel, eventfilter.pileuprej); /* track filtering configuration */ - PWGCF::TrackSelectionConfigurable trksel(trackfilter.ttype, trackfilter.nclstpc, trackfilter.nxrtpc, trackfilter.nclsits, trackfilter.chi2clustpc, + pwgcf::TrackSelectionConfigurable trksel(trackfilter.ttype, trackfilter.nclstpc, trackfilter.nxrtpc, trackfilter.nclsits, trackfilter.chi2clustpc, trackfilter.chi2clusits, trackfilter.xrofctpc, trackfilter.dcaxy, trackfilter.dcaz, trackfilter.ptrange, trackfilter.etarange); #ifdef INCORPORATEBAYESIANPID - PWGCF::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, + pwgcf::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, pidfilter.pidtoffilter.tpcel, pidfilter.pidtoffilter.tpcmu, pidfilter.pidtoffilter.tpcpi, pidfilter.pidtoffilter.tpcka, pidfilter.pidtoffilter.tpcpr, pidfilter.pidbayesfilter.bayel, pidfilter.pidbayesfilter.baymu, pidfilter.pidbayesfilter.baypi, pidfilter.pidbayesfilter.bayka, pidfilter.pidbayesfilter.baypr); #else - PWGCF::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, + pwgcf::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, pidfilter.pidtoffilter.tpcel, pidfilter.pidtoffilter.tpcmu, pidfilter.pidtoffilter.tpcpi, pidfilter.pidtoffilter.tpcka, pidfilter.pidtoffilter.tpcpr); #endif - fFilterFramework = new PWGCF::FilterAndAnalysisFramework(filterccdb.ccdburl.value, filterccdb.ccdbpath.value, filterccdb.filterdate.value); - fFilterFramework->SetConfiguration(eventsel, trksel, pidsel, PWGCF::SelectionFilterAndAnalysis::kFilter); - fFilterFramework->Init(); + fFilterFramework = new pwgcf::FilterAndAnalysisFramework(filterccdb.ccdburl.value, filterccdb.ccdbpath.value, filterccdb.filterdate.value); + fFilterFramework->setConfiguration(eventsel, trksel, pidsel, pwgcf::SelectionFilterAndAnalysis::KFilter); + fFilterFramework->init(); nReportedTracks = 0; /* TODO: upload the cuts signatures to the CCDB */ @@ -209,8 +214,9 @@ struct TwoParticleCorrelationsCollisionSkimming { accepted = false; } /* vertex */ + constexpr float LimitCovZZ = 0.25; if (!TESTBIT(eventcuts, kNonZeroNContribs) || - (((collision.flags() & Run2VertexerZ) == Run2VertexerZ) && collision.covZZ() < 0.25)) { + (((collision.flags() & Run2VertexerZ) == Run2VertexerZ) && collision.covZZ() < LimitCovZZ)) { accepted = false; } reportEventCuts(historeg.get(HIST("EventCuts")), eventcuts); @@ -222,14 +228,14 @@ struct TwoParticleCorrelationsCollisionSkimming { runNumber = bcinfo.runNumber(); } if (accepted) { - return fFilterFramework->FilterCollision(collision, tracks, bfield); + return fFilterFramework->filterCollision(collision, tracks, bfield); } else { return 0UL; } } void processRun2(soa::Join::iterator const& collision, - soa::Join const&, soa::Join const& tracks) + soa::Join const&, soa::Join const& tracks) { /* for the time being this will apply only to Run 1+2 converted data */ LOGF(LOGTRACKCOLLISIONS, "Got a new collision with zvtx %.2f and V0M %.2f, CL0 %.2f, CL1 %.2f", collision.posZ(), collision.centRun2V0M(), collision.centRun2CL0(), collision.centRun2CL1()); @@ -238,9 +244,9 @@ struct TwoParticleCorrelationsCollisionSkimming { auto colmask = filterRun2Collision(collision, tracks, bc); LOGF(LOGTRACKCOLLISIONS, "Got mask 0x%16lx", colmask); - collisionmask(colmask, fFilterFramework->GetCollisionMultiplicities()); + collisionmask(colmask, fFilterFramework->getCollisionMultiplicities()); } - PROCESS_SWITCH(TwoParticleCorrelationsCollisionSkimming, processRun2, "Process on Run 1 or Run 2 data, i.e. do not store derived data ", true); + PROCESS_SWITCH(TwoParticleCorrelationsNotStoredSkimming, processRun2, "Process on Run 1 or Run 2 data, i.e. do not store derived data ", true); }; struct TwoParticleCorrelationsTrackSkimming { @@ -258,22 +264,22 @@ struct TwoParticleCorrelationsTrackSkimming { LOGF(info, "DptDptSkimTask::init()"); /* collision filtering configuration */ - PWGCF::EventSelectionConfigurable eventsel(eventfilter.bfield, eventfilter.centmultsel, {}, eventfilter.zvtxsel, eventfilter.pileuprej); + pwgcf::EventSelectionConfigurable eventsel(eventfilter.bfield, eventfilter.centmultsel, {}, eventfilter.zvtxsel, eventfilter.pileuprej); /* track filtering configuration */ - PWGCF::TrackSelectionConfigurable trksel(trackfilter.ttype, trackfilter.nclstpc, trackfilter.nxrtpc, trackfilter.nclsits, trackfilter.chi2clustpc, + pwgcf::TrackSelectionConfigurable trksel(trackfilter.ttype, trackfilter.nclstpc, trackfilter.nxrtpc, trackfilter.nclsits, trackfilter.chi2clustpc, trackfilter.chi2clusits, trackfilter.xrofctpc, trackfilter.dcaxy, trackfilter.dcaz, trackfilter.ptrange, trackfilter.etarange); #ifdef INCORPORATEBAYESIANPID - PWGCF::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, + pwgcf::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, pidfilter.pidtoffilter.tpcel, pidfilter.pidtoffilter.tpcmu, pidfilter.pidtoffilter.tpcpi, pidfilter.pidtoffilter.tpcka, pidfilter.pidtoffilter.tpcpr, pidfilter.pidbayesfilter.bayel, pidfilter.pidbayesfilter.baymu, pidfilter.pidbayesfilter.baypi, pidfilter.pidbayesfilter.bayka, pidfilter.pidbayesfilter.baypr); #else - PWGCF::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, + pwgcf::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, pidfilter.pidtoffilter.tpcel, pidfilter.pidtoffilter.tpcmu, pidfilter.pidtoffilter.tpcpi, pidfilter.pidtoffilter.tpcka, pidfilter.pidtoffilter.tpcpr); #endif - fFilterFramework = new PWGCF::FilterAndAnalysisFramework(filterccdb.ccdburl.value, filterccdb.ccdbpath.value, filterccdb.filterdate.value); - fFilterFramework->SetConfiguration(eventsel, trksel, pidsel, PWGCF::SelectionFilterAndAnalysis::kFilter); - fFilterFramework->Init(); + fFilterFramework = new pwgcf::FilterAndAnalysisFramework(filterccdb.ccdburl.value, filterccdb.ccdbpath.value, filterccdb.filterdate.value); + fFilterFramework->setConfiguration(eventsel, trksel, pidsel, pwgcf::SelectionFilterAndAnalysis::KFilter); + fFilterFramework->init(); /* TODO: upload the cuts signatures to the CCDB */ LOGF(info, "Collision skimming signature: %s", fFilterFramework->getEventFilterCutStringSignature().Data()); @@ -281,7 +287,7 @@ struct TwoParticleCorrelationsTrackSkimming { LOGF(info, "PID skimming signature: %s", fFilterFramework->getPIDFilterCutStringSignature().Data()); } - void processRun2(soa::Join const& tracks, soa::Join const&) + void processRun2(soa::Join const& tracks, soa::Join const&) { trackmask.reserve(tracks.size()); skimmtrackpid.reserve(tracks.size()); @@ -293,8 +299,8 @@ struct TwoParticleCorrelationsTrackSkimming { trackmask(0UL); skimmtrackpid(0UL); } else { - auto trkmask = fFilterFramework->FilterTrack(track); - auto pidmask = fFilterFramework->FilterTrackPID(track); + auto trkmask = fFilterFramework->filterTrack(track); + auto pidmask = fFilterFramework->filterTrackPID(track); trackmask(trkmask); skimmtrackpid(pidmask); if (trkmask != 0UL) { @@ -310,7 +316,7 @@ struct TwoParticleCorrelationsTrackSkimming { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow{ - adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc)}; return workflow; } diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsRegisterSkimming.cxx b/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsRegisterSkimming.cxx index 7c2932512cb..f74b9b9b1e8 100644 --- a/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsRegisterSkimming.cxx +++ b/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsRegisterSkimming.cxx @@ -9,6 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file twoParticleCorrelationsRegisterSkimming.cxx +/// \brief Registers the skimming configuration +/// \author victor.gonzalez.sebastian@gmail.com + #include "PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h" #include "PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.h" #include "PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.h" @@ -26,14 +30,14 @@ using namespace o2::soa; using namespace o2::framework::expressions; using namespace o2::analysis; -void o2::analysis::PWGCF::registerConfiguration(PWGCF::FilterAndAnalysisFramework* fFilterFramework) +void o2::analysis::pwgcf::registerConfiguration(pwgcf::FilterAndAnalysisFramework* fFilterFramework) { - fFilterFramework->RegisterConfiguration(); + fFilterFramework->registerConfiguration(); } struct TwoParticleCorrelationsRegisterSkimming { bool registered = false; - PWGCF::FilterAndAnalysisFramework* fFilterFramework = nullptr; + pwgcf::FilterAndAnalysisFramework* fFilterFramework = nullptr; #include "PWGCF/TwoParticleCorrelations/TableProducer/Productions/skimmingconf_20221115.h" // NOLINT @@ -43,21 +47,21 @@ struct TwoParticleCorrelationsRegisterSkimming { LOGF(info, "TwoParticleCorrelationsRegisterSkimming::init()"); /* collision filtering configuration */ - PWGCF::EventSelectionConfigurable eventsel(eventfilter.bfield, eventfilter.centmultsel, {}, eventfilter.zvtxsel, eventfilter.pileuprej); + pwgcf::EventSelectionConfigurable eventsel(eventfilter.bfield, eventfilter.centmultsel, {}, eventfilter.zvtxsel, eventfilter.pileuprej); /* track filtering configuration */ - PWGCF::TrackSelectionConfigurable trksel(trackfilter.ttype, trackfilter.nclstpc, trackfilter.nxrtpc, trackfilter.nclsits, trackfilter.chi2clustpc, + pwgcf::TrackSelectionConfigurable trksel(trackfilter.ttype, trackfilter.nclstpc, trackfilter.nxrtpc, trackfilter.nclsits, trackfilter.chi2clustpc, trackfilter.chi2clusits, trackfilter.xrofctpc, trackfilter.dcaxy, trackfilter.dcaz, trackfilter.ptrange, trackfilter.etarange); #ifdef INCORPORATEBAYESIANPID - PWGCF::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, + pwgcf::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, pidfilter.pidtoffilter.tpcel, pidfilter.pidtoffilter.tpcmu, pidfilter.pidtoffilter.tpcpi, pidfilter.pidtoffilter.tpcka, pidfilter.pidtoffilter.tpcpr, pidfilter.pidbayesfilter.bayel, pidfilter.pidbayesfilter.baymu, pidfilter.pidbayesfilter.baypi, pidfilter.pidbayesfilter.bayka, pidfilter.pidbayesfilter.baypr); #else - PWGCF::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, + pwgcf::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, pidfilter.pidtoffilter.tpcel, pidfilter.pidtoffilter.tpcmu, pidfilter.pidtoffilter.tpcpi, pidfilter.pidtoffilter.tpcka, pidfilter.pidtoffilter.tpcpr); #endif - fFilterFramework = new PWGCF::FilterAndAnalysisFramework(filterccdb.ccdburl.value, filterccdb.ccdbpath.value, filterccdb.filterdate.value); - fFilterFramework->SetConfiguration(eventsel, trksel, pidsel, PWGCF::SelectionFilterAndAnalysis::kFilter); + fFilterFramework = new pwgcf::FilterAndAnalysisFramework(filterccdb.ccdburl.value, filterccdb.ccdbpath.value, filterccdb.filterdate.value); + fFilterFramework->setConfiguration(eventsel, trksel, pidsel, pwgcf::SelectionFilterAndAnalysis::KFilter); registered = false; } @@ -65,7 +69,7 @@ struct TwoParticleCorrelationsRegisterSkimming { { if (!registered) { LOGF(info, "Registering filter configuration"); - PWGCF::registerConfiguration(fFilterFramework); + pwgcf::registerConfiguration(fFilterFramework); registered = true; } } diff --git a/PWGCF/TwoParticleCorrelations/Tasks/twoParticleCorrelations.cxx b/PWGCF/TwoParticleCorrelations/Tasks/twoParticleCorrelations.cxx index 0e8c2bdb003..92e94576e9d 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/twoParticleCorrelations.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/twoParticleCorrelations.cxx @@ -9,6 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file twoParticleCorrelations.cxx +/// \brief Two particle correlations analysis task +/// \author victor.gonzalez.sebastian@gmail.com + #include "PWGCF/Core/AnalysisConfigurableCuts.h" #include "PWGCF/Core/PairCuts.h" #include "PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h" @@ -64,25 +68,25 @@ namespace o2::analysis::twopcorrelations #define TWOPCORRLOGTRACKS debug uint64_t collisionmask = 0UL; -std::vector collisionmask_opt; -uint64_t collisionmask_forced = 0UL; +std::vector collisionmaskOptional; +uint64_t collisionmaskForced = 0UL; uint64_t trackmask = 0UL; -std::vector trackmask_opt; -uint64_t trackmask_forced = 0UL; +std::vector trackmaskOptional; +uint64_t trackmaskForced = 0UL; uint64_t pidmask = 0UL; -std::vector pidmask_opt; -uint64_t pidmask_forced = 0UL; +std::vector pidmaskOptional; +uint64_t pidmaskForced = 0UL; -/// \struct trackid +/// \struct TrackId /// \brief Stores the track species id, its potential correction, its potential pT average, and its global index to the track table -struct trackid { +struct TrackId { int id; ///< the species internal id float corr; ///< correction to apply float ptavg; ///< species pT average in eta phi uint64_t index; ///< the index to the table row }; -PWGCF::FilterAndAnalysisFramework* fFilterFramework = nullptr; +pwgcf::FilterAndAnalysisFramework* fFilterFramework = nullptr; int fMultiplicityIndex = -1; //! the index to the multiplicity values array @@ -113,7 +117,7 @@ float deltaphiup = constants::math::TwoPI - deltaphibinwidth / 2.0; bool processpairs = false; int bankinitialcapacity = 10000; int bankcapacitystep = 2000; -std::vector tracksids; // the tracks id storage +std::vector tracksids; // the tracks id storage PairCuts fPairCuts; // pair suppression engine bool fUseConversionCuts = false; // suppress resonances and conversions @@ -123,7 +127,7 @@ bool fUseTwoTrackCut = false; // suppress too close tracks using namespace o2::aod::cfskim; using namespace o2::analysis::twopcorrelations; -struct twoParticleCorrelations { +struct TwoParticleCorrelations { /* the data collecting engine */ struct DataCollectingEngine { @@ -131,31 +135,31 @@ struct twoParticleCorrelations { // The TwoParticleCorrelationsAnalysisTask output objects //============================================================================================ /* histograms */ - TH1F* fhVertexZA; //! fhN1_vsPt; //! fhN1_vsEtaPhi; //! fhSum1Pt_vsEtaPhi; //! fhN1_vsZEtaPhiPt; //! fhSum1Pt_vsZEtaPhiPt; //! fhNuaNue_vsZEtaPhiPt; //! fhPtAvg_vsEtaPhi; //!> fhN2_vsPtPt; //!> fhN2_vsDEtaDPhi; //!> fhSum2PtPt_vsDEtaDPhi; //!> fhSum2DptDpt_vsDEtaDPhi; //!) ({p_T}_2 - <{p_T}_2>) \f$ distribution vs \f$\Delta\eta,\;\Delta\phi\f$ - std::vector> fhSupN1N1_vsDEtaDPhi; //!> fhSupPt1Pt1_vsDEtaDPhi; //! fhN1VsPt; //! fhN1VsEtaPhi; //! fhSum1PtVsEtaPhi; //! fhN1VsZEtaPhiPt; //! fhSum1PtVsZEtaPhiPt; //! fhNuaNueVsZEtaPhiPt; //! fhPtAvgVsEtaPhi; //!> fhN2VsPtPt; //!> fhN2VsDEtaDPhi; //!> fhSum2PtPtVsDEtaDPhi; //!> fhSum2DptDptVsDEtaDPhi; //!) ({p_T}_2 - <{p_T}_2>) \f$ distribution vs \f$\Delta\eta,\;\Delta\phi\f$ + std::vector> fhSupN1N1VsDEtaDPhi; //!> fhSupPt1Pt1VsDEtaDPhi; //! fhN1_vsC; //! fhSum1Pt_vsC; //! fhN1nw_vsC; //! fhSum1Ptnw_vsC; //!> fhN2_vsC; //!> fhSum2PtPt_vsC; //!> fhSum2DptDpt_vsC; //!) ({p_T}_2 - <{p_T}_2>) \f$ distribution vs event centrality/multiplicity - std::vector> fhN2nw_vsC; //!> fhSum2PtPtnw_vsC; //!> fhSum2DptDptnw_vsC; //!) ({p_T}_2 - <{p_T}_2>) \f$ distribution vs \f$\Delta\eta,\;\Delta\phi\f$ distribution vs event centrality/multiplicity + std::vector fhN1VsC; //! fhSum1PtVsC; //! fhN1nwVsC; //! fhSum1PtnwVsC; //!> fhN2VsC; //!> fhSum2PtPtVsC; //!> fhSum2DptDptVsC; //!) ({p_T}_2 - <{p_T}_2>) \f$ distribution vs event centrality/multiplicity + std::vector> fhN2nwVsC; //!> fhSum2PtPtnwVsC; //!> fhSum2DptDptnwVsC; //!) ({p_T}_2 - <{p_T}_2>) \f$ distribution vs \f$\Delta\eta,\;\Delta\phi\f$ distribution vs event centrality/multiplicity std::vector tname; ///< the external track names for histogram creation bool ccdbstored = false; @@ -168,7 +172,7 @@ struct twoParticleCorrelations { /// \brief Returns the potentially phi origin shifted phi /// \param phi the track azimuthal angle /// \return the track phi origin shifted azimuthal angle - float GetShiftedPhi(float phi) + float getShiftedPhi(float phi) { using namespace twopcorrelations; if (!(phi < phiup)) { @@ -191,13 +195,13 @@ struct twoParticleCorrelations { /// the track has been accepted and it is within that ranges /// IF THAT IS NOT THE CASE THE ROUTINE WILL PRODUCE NONSENSE RESULTS template - int GetEtaPhiIndex(TrackObject const& t) + int getEtaPhiIndex(TrackObject const& t) { using namespace twopcorrelations; int etaix = static_cast((t.eta() - etalow) / etabinwidth); /* consider a potential phi origin shift */ - float phi = GetShiftedPhi(t.phi()); + float phi = getShiftedPhi(t.phi()); int phiix = static_cast((phi - philow) / phibinwidth); return etaix * phibins + phiix; } @@ -212,56 +216,56 @@ struct twoParticleCorrelations { /// the tracks have been accepted and they are within that ranges /// IF THAT IS NOT THE CASE THE ROUTINE WILL PRODUCE NONSENSE RESULTS template - int GetDEtaDPhiGlobalIndex(TrackObject const& t1, TrackObject const& t2) + int getDEtaDPhiGlobalIndex(TrackObject const& t1, TrackObject const& t2) { using namespace twopcorrelations; /* rule: ix are always zero based while bins are always one based */ - int etaix_1 = static_cast((t1.eta() - etalow) / etabinwidth); + int etaix1 = static_cast((t1.eta() - etalow) / etabinwidth); /* consider a potential phi origin shift */ - float phi = GetShiftedPhi(t1.phi()); - int phiix_1 = static_cast((phi - philow) / phibinwidth); - int etaix_2 = static_cast((t2.eta() - etalow) / etabinwidth); + float phi = getShiftedPhi(t1.phi()); + int phiix1 = static_cast((phi - philow) / phibinwidth); + int etaix2 = static_cast((t2.eta() - etalow) / etabinwidth); /* consider a potential phi origin shift */ - phi = GetShiftedPhi(t2.phi()); - int phiix_2 = static_cast((phi - philow) / phibinwidth); + phi = getShiftedPhi(t2.phi()); + int phiix2 = static_cast((phi - philow) / phibinwidth); - int deltaeta_ix = etaix_1 - etaix_2 + etabins - 1; - int deltaphi_ix = phiix_1 - phiix_2; - if (deltaphi_ix < 0) { - deltaphi_ix += phibins; + int deltaetaix = etaix1 - etaix2 + etabins - 1; + int deltaphiix = phiix1 - phiix2; + if (deltaphiix < 0) { + deltaphiix += phibins; } - return fhN2_vsDEtaDPhi[0][0]->GetBin(deltaeta_ix + 1, deltaphi_ix + 1); + return fhN2VsDEtaDPhi[0][0]->GetBin(deltaetaix + 1, deltaphiix + 1); } void storeTrackCorrections(const std::vector& corrs) { LOGF(info, "Stored NUA&NUE corrections for %d track species", corrs.size()); - fhNuaNue_vsZEtaPhiPt = corrs; + fhNuaNueVsZEtaPhiPt = corrs; ccdbstored = true; } void storePtAverages(const std::vector& ptavgs) { LOGF(info, "Stored pT average for %d track species", ptavgs.size()); - fhPtAvg_vsEtaPhi = ptavgs; + fhPtAvgVsEtaPhi = ptavgs; ccdbstored = true; } template - void getTrackPtAvgAndCorrections(TrackListObject& tracks, std::vector& tracksids, float zvtx) + void getTrackPtAvgAndCorrections(TrackListObject& tracks, std::vector& tracksids, float zvtx) { for (auto& tid : tracksids) { auto const& track = tracks.iteratorAt(tid.index); if (!(tid.id < 0)) { - if (fhNuaNue_vsZEtaPhiPt[tid.id] != nullptr) { - tid.corr = fhNuaNue_vsZEtaPhiPt[tid.id]->GetBinContent(zvtx, GetEtaPhiIndex(track) + 0.5, track.pt()); + if (fhNuaNueVsZEtaPhiPt[tid.id] != nullptr) { + tid.corr = fhNuaNueVsZEtaPhiPt[tid.id]->GetBinContent(zvtx, getEtaPhiIndex(track) + 0.5, track.pt()); } else { tid.corr = 1; } - if (fhPtAvg_vsEtaPhi[tid.id] != nullptr) { - tid.ptavg = fhPtAvg_vsEtaPhi[tid.id]->GetBinContent(fhPtAvg_vsEtaPhi[tid.id]->FindBin(track.eta(), track.phi())); + if (fhPtAvgVsEtaPhi[tid.id] != nullptr) { + tid.ptavg = fhPtAvgVsEtaPhi[tid.id]->GetBinContent(fhPtAvgVsEtaPhi[tid.id]->FindBin(track.eta(), track.phi())); } else { tid.ptavg = 0; } @@ -274,14 +278,14 @@ struct twoParticleCorrelations { /// \param tracksids id, index to the track table, correction, and average pT the passed track table /// \param zvtx the z vertex coordinate for singles analysis on zvtx bins template - void processSingles(TrackListObject& passedtracks, std::vector& tracksids, float zvtx) + void processSingles(TrackListObject& passedtracks, std::vector& tracksids, float zvtx) { - for (auto& tid : tracksids) { + for (const auto& tid : tracksids) { auto const& track = passedtracks.iteratorAt(tid.index); if (!(tid.id < 0)) { - fhN1_vsPt[tid.id]->Fill(track.pt(), tid.corr); - fhN1_vsZEtaPhiPt[tid.id]->Fill(zvtx, GetEtaPhiIndex(track) + 0.5, track.pt(), tid.corr); - fhSum1Pt_vsZEtaPhiPt[tid.id]->Fill(zvtx, GetEtaPhiIndex(track) + 0.5, track.pt(), track.pt() * tid.corr); + fhN1VsPt[tid.id]->Fill(track.pt(), tid.corr); + fhN1VsZEtaPhiPt[tid.id]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), tid.corr); + fhSum1PtVsZEtaPhiPt[tid.id]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), track.pt() * tid.corr); } } } @@ -291,7 +295,7 @@ struct twoParticleCorrelations { /// \param tracksids id, index to the track table, correction, and average pT the passed track table /// \param cmul centrality - multiplicity for the collision being analyzed template - void processTracks(TrackListObject& passedtracks, std::vector& tracksids, float cmul) + void processTracks(TrackListObject& passedtracks, std::vector& tracksids, float cmul) { LOGF(TWOPCORRLOGCOLLISIONS, "Processing %d tracks in a collision with cent/mult %f ", passedtracks.size(), cmul); @@ -301,7 +305,7 @@ struct twoParticleCorrelations { std::vector n1nw(tname.size(), 0.0); ///< not weighted number of tracks for current collision std::vector sum1Ptnw(tname.size(), 0.0); ///< accumulated sum of not weighted track \f$p_T\f$ for current collision - for (auto& tid : tracksids) { + for (const auto& tid : tracksids) { auto const& track = passedtracks.iteratorAt(tid.index); if (!(tid.id < 0)) { n1[tid.id] += tid.corr; @@ -309,15 +313,15 @@ struct twoParticleCorrelations { n1nw[tid.id] += 1; sum1Ptnw[tid.id] += track.pt(); - fhN1_vsEtaPhi[tid.id]->Fill(track.eta(), GetShiftedPhi(track.phi()), tid.corr); - fhSum1Pt_vsEtaPhi[tid.id]->Fill(track.eta(), GetShiftedPhi(track.phi()), track.pt() * tid.corr); + fhN1VsEtaPhi[tid.id]->Fill(track.eta(), getShiftedPhi(track.phi()), tid.corr); + fhSum1PtVsEtaPhi[tid.id]->Fill(track.eta(), getShiftedPhi(track.phi()), track.pt() * tid.corr); } } for (uint i = 0; i < n1.size(); ++i) { - fhN1_vsC[i]->Fill(cmul, n1[i]); - fhSum1Pt_vsC[i]->Fill(cmul, sum1Pt[i]); - fhN1nw_vsC[i]->Fill(cmul, n1nw[i]); - fhSum1Ptnw_vsC[i]->Fill(cmul, sum1Ptnw[i]); + fhN1VsC[i]->Fill(cmul, n1[i]); + fhSum1PtVsC[i]->Fill(cmul, sum1Pt[i]); + fhN1nwVsC[i]->Fill(cmul, n1nw[i]); + fhSum1PtnwVsC[i]->Fill(cmul, sum1Ptnw[i]); } } @@ -328,7 +332,7 @@ struct twoParticleCorrelations { /// \param cmul centrality - multiplicity for the collision being analyzed /// Be aware that at least in half of the cases traks1 and trks2 will have the same content template - void processTrackPairs(TrackListObject& tracks, std::vector& tracksids, float cmul, int bfield) + void processTrackPairs(TrackListObject& tracks, std::vector& tracksids, float cmul, int bfield) { using namespace twopcorrelations; @@ -341,10 +345,10 @@ struct twoParticleCorrelations { std::vector> sum2PtPtnw(tname.size(), std::vector(tname.size(), 0.0)); ///< accumulated sum of not weighted paisr \f${p_T}_1 {p_T}_2\f$ for current collision std::vector> sum2DptDptnw(tname.size(), std::vector(tname.size(), 0.0)); ///< accumulated sum of not weighted pairs \f$\Delta p_T \Delta p_T\f$ for current collision - for (auto& tid1 : tracksids) { + for (const auto& tid1 : tracksids) { auto const& track1 = tracks.iteratorAt(tid1.index); if (!(tid1.id < 0)) { - for (auto& tid2 : tracksids) { + for (const auto& tid2 : tracksids) { auto const& track2 = tracks.iteratorAt(tid2.index); if (!(tid2.id < 0)) { if (tid1.index == tid2.index) { @@ -352,11 +356,11 @@ struct twoParticleCorrelations { continue; } /* get the global bin for filling the differential histograms */ - int globalbin = GetDEtaDPhiGlobalIndex(track1, track2); + int globalbin = getDEtaDPhiGlobalIndex(track1, track2); if ((fUseConversionCuts && fPairCuts.conversionCuts(track1, track2)) || (fUseTwoTrackCut && fPairCuts.twoTrackCut(track1, track2, bfield))) { /* suppress the pair */ - fhSupN1N1_vsDEtaDPhi[tid1.id][tid2.id]->AddBinContent(globalbin, tid1.corr * tid2.corr); - fhSupPt1Pt1_vsDEtaDPhi[tid1.id][tid2.id]->AddBinContent(globalbin, track1.pt() * track2.pt() * tid1.corr * tid2.corr); + fhSupN1N1VsDEtaDPhi[tid1.id][tid2.id]->AddBinContent(globalbin, tid1.corr * tid2.corr); + fhSupPt1Pt1VsDEtaDPhi[tid1.id][tid2.id]->AddBinContent(globalbin, track1.pt() * track2.pt() * tid1.corr * tid2.corr); n2sup[tid1.id][tid2.id] += tid1.corr * tid2.corr; } else { /* count the pair */ @@ -367,10 +371,10 @@ struct twoParticleCorrelations { sum2PtPtnw[tid1.id][tid2.id] += track1.pt() * track2.pt(); sum2DptDptnw[tid1.id][tid2.id] += (track1.pt() - tid1.ptavg) * (track2.pt() - tid2.ptavg); - fhN2_vsDEtaDPhi[tid1.id][tid2.id]->AddBinContent(globalbin, tid1.corr * tid2.corr); - fhSum2DptDpt_vsDEtaDPhi[tid1.id][tid2.id]->AddBinContent(globalbin, (tid1.corr * track1.pt() - tid1.ptavg) * (tid2.corr * track2.pt() - tid2.ptavg)); - fhSum2PtPt_vsDEtaDPhi[tid1.id][tid2.id]->AddBinContent(globalbin, track1.pt() * track2.pt() * tid1.corr * tid2.corr); - fhN2_vsPtPt[tid1.id][tid2.id]->Fill(track1.pt(), track2.pt(), tid1.corr * tid2.corr); + fhN2VsDEtaDPhi[tid1.id][tid2.id]->AddBinContent(globalbin, tid1.corr * tid2.corr); + fhSum2DptDptVsDEtaDPhi[tid1.id][tid2.id]->AddBinContent(globalbin, (tid1.corr * track1.pt() - tid1.ptavg) * (tid2.corr * track2.pt() - tid2.ptavg)); + fhSum2PtPtVsDEtaDPhi[tid1.id][tid2.id]->AddBinContent(globalbin, track1.pt() * track2.pt() * tid1.corr * tid2.corr); + fhN2VsPtPt[tid1.id][tid2.id]->Fill(track1.pt(), track2.pt(), tid1.corr * tid2.corr); } } } @@ -378,18 +382,18 @@ struct twoParticleCorrelations { } for (uint i = 0; i < tname.size(); ++i) { for (uint j = 0; j < tname.size(); ++j) { - fhN2_vsC[i][j]->Fill(cmul, n2[i][j]); - fhSum2PtPt_vsC[i][j]->Fill(cmul, sum2PtPt[i][j]); - fhSum2DptDpt_vsC[i][j]->Fill(cmul, sum2DptDpt[i][j]); - fhN2nw_vsC[i][j]->Fill(cmul, n2nw[i][j]); - fhSum2PtPtnw_vsC[i][j]->Fill(cmul, sum2PtPtnw[i][j]); - fhSum2DptDptnw_vsC[i][j]->Fill(cmul, sum2DptDptnw[i][j]); + fhN2VsC[i][j]->Fill(cmul, n2[i][j]); + fhSum2PtPtVsC[i][j]->Fill(cmul, sum2PtPt[i][j]); + fhSum2DptDptVsC[i][j]->Fill(cmul, sum2DptDpt[i][j]); + fhN2nwVsC[i][j]->Fill(cmul, n2nw[i][j]); + fhSum2PtPtnwVsC[i][j]->Fill(cmul, sum2PtPtnw[i][j]); + fhSum2DptDptnwVsC[i][j]->Fill(cmul, sum2DptDptnw[i][j]); /* let's also update the number of entries in the differential histograms */ - fhN2_vsDEtaDPhi[i][j]->SetEntries(fhN2_vsDEtaDPhi[i][j]->GetEntries() + n2[i][j]); - fhSum2DptDpt_vsDEtaDPhi[i][j]->SetEntries(fhSum2DptDpt_vsDEtaDPhi[i][j]->GetEntries() + n2[i][j]); - fhSum2PtPt_vsDEtaDPhi[i][j]->SetEntries(fhSum2PtPt_vsDEtaDPhi[i][j]->GetEntries() + n2[i][j]); - fhSupN1N1_vsDEtaDPhi[i][j]->SetEntries(fhSupN1N1_vsDEtaDPhi[i][j]->GetEntries() + n2sup[i][j]); - fhSupPt1Pt1_vsDEtaDPhi[i][j]->SetEntries(fhSupPt1Pt1_vsDEtaDPhi[i][j]->GetEntries() + n2sup[i][j]); + fhN2VsDEtaDPhi[i][j]->SetEntries(fhN2VsDEtaDPhi[i][j]->GetEntries() + n2[i][j]); + fhSum2DptDptVsDEtaDPhi[i][j]->SetEntries(fhSum2DptDptVsDEtaDPhi[i][j]->GetEntries() + n2[i][j]); + fhSum2PtPtVsDEtaDPhi[i][j]->SetEntries(fhSum2PtPtVsDEtaDPhi[i][j]->GetEntries() + n2[i][j]); + fhSupN1N1VsDEtaDPhi[i][j]->SetEntries(fhSupN1N1VsDEtaDPhi[i][j]->GetEntries() + n2sup[i][j]); + fhSupPt1Pt1VsDEtaDPhi[i][j]->SetEntries(fhSupPt1Pt1VsDEtaDPhi[i][j]->GetEntries() + n2sup[i][j]); } } } @@ -432,45 +436,45 @@ struct twoParticleCorrelations { /* reserve the histograms place holders */ for (uint i = 0; i < tname.size(); ++i) { if (!processpairs) { - fhN1_vsPt.reserve(tname.size()); - fhN1_vsZEtaPhiPt.reserve(tname.size()); - fhSum1Pt_vsZEtaPhiPt.reserve(tname.size()); - fhNuaNue_vsZEtaPhiPt.reserve(tname.size()); - fhPtAvg_vsEtaPhi.reserve(tname.size()); + fhN1VsPt.reserve(tname.size()); + fhN1VsZEtaPhiPt.reserve(tname.size()); + fhSum1PtVsZEtaPhiPt.reserve(tname.size()); + fhNuaNueVsZEtaPhiPt.reserve(tname.size()); + fhPtAvgVsEtaPhi.reserve(tname.size()); } else { - fhN1_vsEtaPhi.reserve(tname.size()); - fhSum1Pt_vsEtaPhi.reserve(tname.size()); - fhN1_vsC.reserve(tname.size()); - fhSum1Pt_vsC.reserve(tname.size()); - fhN1nw_vsC.reserve(tname.size()); - fhSum1Ptnw_vsC.reserve(tname.size()); - fhNuaNue_vsZEtaPhiPt.reserve(tname.size()); - fhPtAvg_vsEtaPhi.reserve(tname.size()); - fhN2_vsDEtaDPhi.reserve(tname.size()); - fhSum2PtPt_vsDEtaDPhi.reserve(tname.size()); - fhSum2DptDpt_vsDEtaDPhi.reserve(tname.size()); - fhSupN1N1_vsDEtaDPhi.reserve(tname.size()); - fhSupPt1Pt1_vsDEtaDPhi.reserve(tname.size()); - fhN2_vsPtPt.reserve(tname.size()); - fhN2_vsC.reserve(tname.size()); - fhSum2PtPt_vsC.reserve(tname.size()); - fhSum2DptDpt_vsC.reserve(tname.size()); - fhN2nw_vsC.reserve(tname.size()); - fhSum2PtPtnw_vsC.reserve(tname.size()); - fhSum2DptDptnw_vsC.reserve(tname.size()); + fhN1VsEtaPhi.reserve(tname.size()); + fhSum1PtVsEtaPhi.reserve(tname.size()); + fhN1VsC.reserve(tname.size()); + fhSum1PtVsC.reserve(tname.size()); + fhN1nwVsC.reserve(tname.size()); + fhSum1PtnwVsC.reserve(tname.size()); + fhNuaNueVsZEtaPhiPt.reserve(tname.size()); + fhPtAvgVsEtaPhi.reserve(tname.size()); + fhN2VsDEtaDPhi.reserve(tname.size()); + fhSum2PtPtVsDEtaDPhi.reserve(tname.size()); + fhSum2DptDptVsDEtaDPhi.reserve(tname.size()); + fhSupN1N1VsDEtaDPhi.reserve(tname.size()); + fhSupPt1Pt1VsDEtaDPhi.reserve(tname.size()); + fhN2VsPtPt.reserve(tname.size()); + fhN2VsC.reserve(tname.size()); + fhSum2PtPtVsC.reserve(tname.size()); + fhSum2DptDptVsC.reserve(tname.size()); + fhN2nwVsC.reserve(tname.size()); + fhSum2PtPtnwVsC.reserve(tname.size()); + fhSum2DptDptnwVsC.reserve(tname.size()); for (uint j = 0; j < tname.size(); ++j) { - fhN2_vsDEtaDPhi.push_back({tname.size(), nullptr}); - fhSum2PtPt_vsDEtaDPhi.push_back({tname.size(), nullptr}); - fhSum2DptDpt_vsDEtaDPhi.push_back({tname.size(), nullptr}); - fhSupN1N1_vsDEtaDPhi.push_back({tname.size(), nullptr}); - fhSupPt1Pt1_vsDEtaDPhi.push_back({tname.size(), nullptr}); - fhN2_vsPtPt.push_back({tname.size(), nullptr}); - fhN2_vsC.push_back({tname.size(), nullptr}); - fhSum2PtPt_vsC.push_back({tname.size(), nullptr}); - fhSum2DptDpt_vsC.push_back({tname.size(), nullptr}); - fhN2nw_vsC.push_back({tname.size(), nullptr}); - fhSum2PtPtnw_vsC.push_back({tname.size(), nullptr}); - fhSum2DptDptnw_vsC.push_back({tname.size(), nullptr}); + fhN2VsDEtaDPhi.push_back({tname.size(), nullptr}); + fhSum2PtPtVsDEtaDPhi.push_back({tname.size(), nullptr}); + fhSum2DptDptVsDEtaDPhi.push_back({tname.size(), nullptr}); + fhSupN1N1VsDEtaDPhi.push_back({tname.size(), nullptr}); + fhSupPt1Pt1VsDEtaDPhi.push_back({tname.size(), nullptr}); + fhN2VsPtPt.push_back({tname.size(), nullptr}); + fhN2VsC.push_back({tname.size(), nullptr}); + fhSum2PtPtVsC.push_back({tname.size(), nullptr}); + fhSum2DptDptVsC.push_back({tname.size(), nullptr}); + fhN2nwVsC.push_back({tname.size(), nullptr}); + fhSum2PtPtnwVsC.push_back({tname.size(), nullptr}); + fhSum2DptDptnwVsC.push_back({tname.size(), nullptr}); } } } @@ -480,63 +484,63 @@ struct twoParticleCorrelations { fOutputList->Add(fhVertexZA); for (uint i = 0; i < tname.size(); ++i) { /* histograms for each track, one and two */ - fhN1_vsPt[i] = new TH1F(TString::Format("n1_%s_vsPt", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT;p_{t,%s} (GeV/c);#LT n_{1} #GT", tname[i].c_str()).Data(), - ptbins, ptlow, ptup); + fhN1VsPt[i] = new TH1F(TString::Format("n1_%sVsPt", tname[i].c_str()).Data(), + TString::Format("#LT n_{1} #GT;p_{t,%s} (GeV/c);#LT n_{1} #GT", tname[i].c_str()).Data(), + ptbins, ptlow, ptup); /* we don't want the Sumw2 structure being created here */ bool defSumw2 = TH1::GetDefaultSumw2(); TH1::SetDefaultSumw2(false); - fhN1_vsZEtaPhiPt[i] = new TH3F(TString::Format("n1_%s_vsZ_vsEtaPhi_vsPt", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)", tname[i].c_str(), tname[i].c_str(), tname[i].c_str()).Data(), - zvtxbins, zvtxlow, zvtxup, etabins * phibins, 0.0, static_cast(etabins * phibins), ptbins, ptlow, ptup); - fhSum1Pt_vsZEtaPhiPt[i] = new TH3F(TString::Format("sumPt1_%s_vsZ_vsEtaPhi_vsPt", tname[i].c_str()).Data(), - TString::Format("#LT #Sigma p_{t,%s}#GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)", tname[i].c_str(), tname[i].c_str(), tname[i].c_str(), tname[i].c_str()).Data(), - zvtxbins, zvtxlow, zvtxup, etabins * phibins, 0.0, static_cast(etabins * phibins), ptbins, ptlow, ptup); + fhN1VsZEtaPhiPt[i] = new TH3F(TString::Format("n1_%sVsZVsEtaPhiVsPt", tname[i].c_str()).Data(), + TString::Format("#LT n_{1} #GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)", tname[i].c_str(), tname[i].c_str(), tname[i].c_str()).Data(), + zvtxbins, zvtxlow, zvtxup, etabins * phibins, 0.0, static_cast(etabins * phibins), ptbins, ptlow, ptup); + fhSum1PtVsZEtaPhiPt[i] = new TH3F(TString::Format("sumPt1_%sVsZVsEtaPhiVsPt", tname[i].c_str()).Data(), + TString::Format("#LT #Sigma p_{t,%s}#GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)", tname[i].c_str(), tname[i].c_str(), tname[i].c_str(), tname[i].c_str()).Data(), + zvtxbins, zvtxlow, zvtxup, etabins * phibins, 0.0, static_cast(etabins * phibins), ptbins, ptlow, ptup); /* we return it back to previuos state */ TH1::SetDefaultSumw2(defSumw2); /* the statistical uncertainties will be estimated by the subsamples method so let's get rid of the error tracking */ - fhN1_vsZEtaPhiPt[i]->SetBit(TH1::kIsNotW); - fhN1_vsZEtaPhiPt[i]->Sumw2(false); - fhSum1Pt_vsZEtaPhiPt[i]->SetBit(TH1::kIsNotW); - fhSum1Pt_vsZEtaPhiPt[i]->Sumw2(false); - fhNuaNue_vsZEtaPhiPt[i] = nullptr; - fhPtAvg_vsEtaPhi[i] = nullptr; - - fOutputList->Add(fhN1_vsPt[i]); - fOutputList->Add(fhN1_vsZEtaPhiPt[i]); - fOutputList->Add(fhSum1Pt_vsZEtaPhiPt[i]); + fhN1VsZEtaPhiPt[i]->SetBit(TH1::kIsNotW); + fhN1VsZEtaPhiPt[i]->Sumw2(false); + fhSum1PtVsZEtaPhiPt[i]->SetBit(TH1::kIsNotW); + fhSum1PtVsZEtaPhiPt[i]->Sumw2(false); + fhNuaNueVsZEtaPhiPt[i] = nullptr; + fhPtAvgVsEtaPhi[i] = nullptr; + + fOutputList->Add(fhN1VsPt[i]); + fOutputList->Add(fhN1VsZEtaPhiPt[i]); + fOutputList->Add(fhSum1PtVsZEtaPhiPt[i]); } } else { for (uint i = 0; i < tname.size(); ++i) { /* histograms for each track species */ - fhN1_vsEtaPhi[i] = new TH2F(TString::Format("n1_%s_vsEtaPhi", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT;#eta_{%s};#varphi_{%s} (radian);#LT n_{1} #GT", tname[i].c_str(), tname[i].c_str()).Data(), - etabins, etalow, etaup, phibins, philow, phiup); - fhSum1Pt_vsEtaPhi[i] = new TH2F(TString::Format("sumPt_%s_vsEtaPhi", tname[i].c_str()).Data(), - TString::Format("#LT #Sigma p_{t,%s} #GT;#eta_{%s};#varphi_{%s} (radian);#LT #Sigma p_{t,%s} #GT (GeV/c)", - tname[i].c_str(), tname[i].c_str(), tname[i].c_str(), tname[i].c_str()) - .Data(), - etabins, etalow, etaup, phibins, philow, phiup); - fhN1_vsC[i] = new TProfile(TString::Format("n1_%s_vsM", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT (weighted);Centrality/Multiplicity (%%);#LT n_{1} #GT").Data(), - 100, 0.0, 100.0); - fhSum1Pt_vsC[i] = new TProfile(TString::Format("sumPt_%s_vsM", tname[i].c_str()), - TString::Format("#LT #Sigma p_{t,%s} #GT (weighted);Centrality/Multiplicity (%%);#LT #Sigma p_{t,%s} #GT (GeV/c)", tname[i].c_str(), tname[i].c_str()).Data(), - 100, 0.0, 100.0); - fhN1nw_vsC[i] = new TProfile(TString::Format("n1Nw_%s_vsM", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT;Centrality/Multiplicity (%%);#LT n_{1} #GT").Data(), - 100, 0.0, 100.0); - fhSum1Ptnw_vsC[i] = new TProfile(TString::Format("sumPtNw_%s_vsM", tname[i].c_str()).Data(), - TString::Format("#LT #Sigma p_{t,%s} #GT;Centrality/Multiplicity (%%);#LT #Sigma p_{t,%s} #GT (GeV/c)", tname[i].c_str(), tname[i].c_str()).Data(), 100, 0.0, 100.0); - fhNuaNue_vsZEtaPhiPt[i] = nullptr; - fhPtAvg_vsEtaPhi[i] = nullptr; - fOutputList->Add(fhN1_vsEtaPhi[i]); - fOutputList->Add(fhSum1Pt_vsEtaPhi[i]); - fOutputList->Add(fhN1_vsC[i]); - fOutputList->Add(fhSum1Pt_vsC[i]); - fOutputList->Add(fhN1nw_vsC[i]); - fOutputList->Add(fhSum1Ptnw_vsC[i]); + fhN1VsEtaPhi[i] = new TH2F(TString::Format("n1_%sVsEtaPhi", tname[i].c_str()).Data(), + TString::Format("#LT n_{1} #GT;#eta_{%s};#varphi_{%s} (radian);#LT n_{1} #GT", tname[i].c_str(), tname[i].c_str()).Data(), + etabins, etalow, etaup, phibins, philow, phiup); + fhSum1PtVsEtaPhi[i] = new TH2F(TString::Format("sumPt_%sVsEtaPhi", tname[i].c_str()).Data(), + TString::Format("#LT #Sigma p_{t,%s} #GT;#eta_{%s};#varphi_{%s} (radian);#LT #Sigma p_{t,%s} #GT (GeV/c)", + tname[i].c_str(), tname[i].c_str(), tname[i].c_str(), tname[i].c_str()) + .Data(), + etabins, etalow, etaup, phibins, philow, phiup); + fhN1VsC[i] = new TProfile(TString::Format("n1_%sVsM", tname[i].c_str()).Data(), + TString::Format("#LT n_{1} #GT (weighted);Centrality/Multiplicity (%%);#LT n_{1} #GT").Data(), + 100, 0.0, 100.0); + fhSum1PtVsC[i] = new TProfile(TString::Format("sumPt_%sVsM", tname[i].c_str()), + TString::Format("#LT #Sigma p_{t,%s} #GT (weighted);Centrality/Multiplicity (%%);#LT #Sigma p_{t,%s} #GT (GeV/c)", tname[i].c_str(), tname[i].c_str()).Data(), + 100, 0.0, 100.0); + fhN1nwVsC[i] = new TProfile(TString::Format("n1Nw_%sVsM", tname[i].c_str()).Data(), + TString::Format("#LT n_{1} #GT;Centrality/Multiplicity (%%);#LT n_{1} #GT").Data(), + 100, 0.0, 100.0); + fhSum1PtnwVsC[i] = new TProfile(TString::Format("sumPtNw_%sVsM", tname[i].c_str()).Data(), + TString::Format("#LT #Sigma p_{t,%s} #GT;Centrality/Multiplicity (%%);#LT #Sigma p_{t,%s} #GT (GeV/c)", tname[i].c_str(), tname[i].c_str()).Data(), 100, 0.0, 100.0); + fhNuaNueVsZEtaPhiPt[i] = nullptr; + fhPtAvgVsEtaPhi[i] = nullptr; + fOutputList->Add(fhN1VsEtaPhi[i]); + fOutputList->Add(fhSum1PtVsEtaPhi[i]); + fOutputList->Add(fhN1VsC[i]); + fOutputList->Add(fhSum1PtVsC[i]); + fOutputList->Add(fhN1nwVsC[i]); + fOutputList->Add(fhSum1PtnwVsC[i]); for (uint j = 0; j < tname.size(); ++j) { /* histograms for each track pair combination */ /* we don't want the Sumw2 structure being created here */ @@ -544,53 +548,53 @@ struct twoParticleCorrelations { TH1::SetDefaultSumw2(false); char pname[256]; snprintf(pname, tname[i].length() + tname[j].length() + 1, "%s%s", tname[i].c_str(), tname[j].c_str()); - fhN2_vsDEtaDPhi[i][j] = new TH2F(TString::Format("n2_12_vsDEtaDPhi_%s", pname), TString::Format("#LT n_{2} #GT (%s);#Delta#eta;#Delta#varphi;#LT n_{2} #GT", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhSum2PtPt_vsDEtaDPhi[i][j] = new TH2F(TString::Format("sumPtPt_12_vsDEtaDPhi_%s", pname), TString::Format("#LT #Sigma p_{t,1}p_{t,2} #GT (%s);#Delta#eta;#Delta#varphi;#LT #Sigma p_{t,1}p_{t,2} #GT (GeV^{2})", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhSum2DptDpt_vsDEtaDPhi[i][j] = new TH2F(TString::Format("sumDptDpt_12_vsDEtaDPhi_%s", pname), TString::Format("#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (%s);#Delta#eta;#Delta#varphi;#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (GeV^{2})", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhSupN1N1_vsDEtaDPhi[i][j] = new TH2F(TString::Format("suppn1n1_12_vsDEtaDPhi_%s", pname), TString::Format("Suppressed #LT n_{1} #GT#LT n_{1} #GT (%s);#Delta#eta;#Delta#varphi;#LT n_{1} #GT#LT n_{1} #GT", pname), + fhN2VsDEtaDPhi[i][j] = new TH2F(TString::Format("n2_12VsDEtaDPhi_%s", pname), TString::Format("#LT n_{2} #GT (%s);#Delta#eta;#Delta#varphi;#LT n_{2} #GT", pname), + deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); + fhSum2PtPtVsDEtaDPhi[i][j] = new TH2F(TString::Format("sumPtPt_12VsDEtaDPhi_%s", pname), TString::Format("#LT #Sigma p_{t,1}p_{t,2} #GT (%s);#Delta#eta;#Delta#varphi;#LT #Sigma p_{t,1}p_{t,2} #GT (GeV^{2})", pname), deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhSupPt1Pt1_vsDEtaDPhi[i][j] = new TH2F(TString::Format("suppPtPt_12_vsDEtaDPhi_%s", pname), TString::Format("Suppressed #LT p_{t,1} #GT#LT p_{t,2} #GT (%s);#Delta#eta;#Delta#varphi;#LT p_{t,1} #GT#LT p_{t,2} #GT (GeV^{2})", pname), + fhSum2DptDptVsDEtaDPhi[i][j] = new TH2F(TString::Format("sumDptDpt_12VsDEtaDPhi_%s", pname), TString::Format("#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (%s);#Delta#eta;#Delta#varphi;#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (GeV^{2})", pname), deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); + fhSupN1N1VsDEtaDPhi[i][j] = new TH2F(TString::Format("suppn1n1_12VsDEtaDPhi_%s", pname), TString::Format("Suppressed #LT n_{1} #GT#LT n_{1} #GT (%s);#Delta#eta;#Delta#varphi;#LT n_{1} #GT#LT n_{1} #GT", pname), + deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); + fhSupPt1Pt1VsDEtaDPhi[i][j] = new TH2F(TString::Format("suppPtPt_12VsDEtaDPhi_%s", pname), TString::Format("Suppressed #LT p_{t,1} #GT#LT p_{t,2} #GT (%s);#Delta#eta;#Delta#varphi;#LT p_{t,1} #GT#LT p_{t,2} #GT (GeV^{2})", pname), + deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); /* we return it back to previuos state */ TH1::SetDefaultSumw2(defSumw2); - fhN2_vsPtPt[i][j] = new TH2F(TString::Format("n2_12_vsPtVsPt_%s", pname), TString::Format("#LT n_{2} #GT (%s);p_{t,1} (GeV/c);p_{t,2} (GeV/c);#LT n_{2} #GT", pname), - ptbins, ptlow, ptup, ptbins, ptlow, ptup); + fhN2VsPtPt[i][j] = new TH2F(TString::Format("n2_12VsPtVsPt_%s", pname), TString::Format("#LT n_{2} #GT (%s);p_{t,1} (GeV/c);p_{t,2} (GeV/c);#LT n_{2} #GT", pname), + ptbins, ptlow, ptup, ptbins, ptlow, ptup); - fhN2_vsC[i][j] = new TProfile(TString::Format("n2_12_vsM_%s", pname), TString::Format("#LT n_{2} #GT (%s) (weighted);Centrality/Multiplicity (%%);#LT n_{2} #GT", pname), 100, 0.0, 100.0); - fhSum2PtPt_vsC[i][j] = new TProfile(TString::Format("sumPtPt_12_vsM_%s", pname), TString::Format("#LT #Sigma p_{t,1}p_{t,2} #GT (%s) (weighted);Centrality/Multiplicity (%%);#LT #Sigma p_{t,1}p_{t,2} #GT (GeV^{2})", pname), 100, 0.0, 100.0); - fhSum2DptDpt_vsC[i][j] = new TProfile(TString::Format("sumDptDpt_12_vsM_%s", pname), TString::Format("#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (%s) (weighted);Centrality/Multiplicity (%%);#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (GeV^{2})", pname), 100, 0.0, 100.0); - fhN2nw_vsC[i][j] = new TProfile(TString::Format("n2Nw_12_vsM_%s", pname), TString::Format("#LT n_{2} #GT (%s);Centrality/Multiplicity (%%);#LT n_{2} #GT", pname), 100, 0.0, 100.0); - fhSum2PtPtnw_vsC[i][j] = new TProfile(TString::Format("sumPtPtNw_12_vsM_%s", pname), TString::Format("#LT #Sigma p_{t,1}p_{t,2} #GT (%s);Centrality/Multiplicity (%%);#LT #Sigma p_{t,1}p_{t,2} #GT (GeV^{2})", pname), 100, 0.0, 100.0); - fhSum2DptDptnw_vsC[i][j] = new TProfile(TString::Format("sumDptDptNw_12_vsM_%s", pname), TString::Format("#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (%s);Centrality/Multiplicity (%%);#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (GeV^{2})", pname), 100, 0.0, 100.0); + fhN2VsC[i][j] = new TProfile(TString::Format("n2_12VsM_%s", pname), TString::Format("#LT n_{2} #GT (%s) (weighted);Centrality/Multiplicity (%%);#LT n_{2} #GT", pname), 100, 0.0, 100.0); + fhSum2PtPtVsC[i][j] = new TProfile(TString::Format("sumPtPt_12VsM_%s", pname), TString::Format("#LT #Sigma p_{t,1}p_{t,2} #GT (%s) (weighted);Centrality/Multiplicity (%%);#LT #Sigma p_{t,1}p_{t,2} #GT (GeV^{2})", pname), 100, 0.0, 100.0); + fhSum2DptDptVsC[i][j] = new TProfile(TString::Format("sumDptDpt_12VsM_%s", pname), TString::Format("#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (%s) (weighted);Centrality/Multiplicity (%%);#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (GeV^{2})", pname), 100, 0.0, 100.0); + fhN2nwVsC[i][j] = new TProfile(TString::Format("n2Nw_12VsM_%s", pname), TString::Format("#LT n_{2} #GT (%s);Centrality/Multiplicity (%%);#LT n_{2} #GT", pname), 100, 0.0, 100.0); + fhSum2PtPtnwVsC[i][j] = new TProfile(TString::Format("sumPtPtNw_12VsM_%s", pname), TString::Format("#LT #Sigma p_{t,1}p_{t,2} #GT (%s);Centrality/Multiplicity (%%);#LT #Sigma p_{t,1}p_{t,2} #GT (GeV^{2})", pname), 100, 0.0, 100.0); + fhSum2DptDptnwVsC[i][j] = new TProfile(TString::Format("sumDptDptNw_12VsM_%s", pname), TString::Format("#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (%s);Centrality/Multiplicity (%%);#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (GeV^{2})", pname), 100, 0.0, 100.0); /* the statistical uncertainties will be estimated by the subsamples method so let's get rid of the error tracking */ - fhN2_vsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhN2_vsDEtaDPhi[i][j]->Sumw2(false); - fhSum2PtPt_vsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhSum2PtPt_vsDEtaDPhi[i][j]->Sumw2(false); - fhSum2DptDpt_vsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhSum2DptDpt_vsDEtaDPhi[i][j]->Sumw2(false); - fhSupN1N1_vsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhSupN1N1_vsDEtaDPhi[i][j]->Sumw2(false); - fhSupPt1Pt1_vsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhSupPt1Pt1_vsDEtaDPhi[i][j]->Sumw2(false); - - fOutputList->Add(fhN2_vsDEtaDPhi[i][j]); - fOutputList->Add(fhSum2PtPt_vsDEtaDPhi[i][j]); - fOutputList->Add(fhSum2DptDpt_vsDEtaDPhi[i][j]); - fOutputList->Add(fhSupN1N1_vsDEtaDPhi[i][j]); - fOutputList->Add(fhSupPt1Pt1_vsDEtaDPhi[i][j]); - fOutputList->Add(fhN2_vsPtPt[i][j]); - fOutputList->Add(fhN2_vsC[i][j]); - fOutputList->Add(fhSum2PtPt_vsC[i][j]); - fOutputList->Add(fhSum2DptDpt_vsC[i][j]); - fOutputList->Add(fhN2nw_vsC[i][j]); - fOutputList->Add(fhSum2PtPtnw_vsC[i][j]); - fOutputList->Add(fhSum2DptDptnw_vsC[i][j]); + fhN2VsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); + fhN2VsDEtaDPhi[i][j]->Sumw2(false); + fhSum2PtPtVsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); + fhSum2PtPtVsDEtaDPhi[i][j]->Sumw2(false); + fhSum2DptDptVsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); + fhSum2DptDptVsDEtaDPhi[i][j]->Sumw2(false); + fhSupN1N1VsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); + fhSupN1N1VsDEtaDPhi[i][j]->Sumw2(false); + fhSupPt1Pt1VsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); + fhSupPt1Pt1VsDEtaDPhi[i][j]->Sumw2(false); + + fOutputList->Add(fhN2VsDEtaDPhi[i][j]); + fOutputList->Add(fhSum2PtPtVsDEtaDPhi[i][j]); + fOutputList->Add(fhSum2DptDptVsDEtaDPhi[i][j]); + fOutputList->Add(fhSupN1N1VsDEtaDPhi[i][j]); + fOutputList->Add(fhSupPt1Pt1VsDEtaDPhi[i][j]); + fOutputList->Add(fhN2VsPtPt[i][j]); + fOutputList->Add(fhN2VsC[i][j]); + fOutputList->Add(fhSum2PtPtVsC[i][j]); + fOutputList->Add(fhSum2DptDptVsC[i][j]); + fOutputList->Add(fhN2nwVsC[i][j]); + fOutputList->Add(fhSum2PtPtnwVsC[i][j]); + fOutputList->Add(fhSum2DptDptnwVsC[i][j]); } } } @@ -617,22 +621,22 @@ struct twoParticleCorrelations { bool loadfromccdb = false; /* pair conversion suppression defaults */ - static constexpr float cfgPairCutDefaults[1][5] = {{-1, -1, -1, -1, -1}}; - Configurable> cfgPairCut{"paircut", {cfgPairCutDefaults[0], 5, {"Photon", "K0", "Lambda", "Phi", "Rho"}}, "Conversion suppressions"}; + static constexpr float CfgPairCutDefaults[1][5] = {{-1, -1, -1, -1, -1}}; + Configurable> cfgPairCut{"cfgPairCut", {CfgPairCutDefaults[0], 5, {"Photon", "K0", "Lambda", "Phi", "Rho"}}, "Conversion suppressions"}; /* two tracks cut */ - Configurable cfgTwoTrackCut{"twotrackcut", -1, "Two-tracks cut: -1 = off; >0 otherwise distance value (suggested: 0.02"}; - Configurable cfgTwoTrackCutMinRadius{"twotrackcutminradius", 0.8f, "Two-tracks cut: radius in m from which two-tracks cut is applied"}; + Configurable cfgTwoTrackCut{"cfgTwoTrackCut", -1, "Two-tracks cut: -1 = off; >0 otherwise distance value (suggested: 0.02"}; + Configurable cfgTwoTrackCutMinRadius{"cfgTwoTrackCutMinRadius", 0.8f, "Two-tracks cut: radius in m from which two-tracks cut is applied"}; - Configurable cfgProcessPairs{"processpairs", false, "Process pairs: false = no, just singles, true = yes, process pairs"}; - Configurable cfgCentSpec{"centralities", "00-05,05-10,10-20,20-30,30-40,40-50,50-60,60-70,70-80", "Centrality/multiplicity ranges in min-max separated by commas"}; + Configurable cfgProcessPairs{"cfgProcessPairs", false, "Process pairs: false = no, just singles, true = yes, process pairs"}; + Configurable cfgCentSpec{"cfgCentSpec", "00-05,05-10,10-20,20-30,30-40,40-50,50-60,60-70,70-80", "Centrality/multiplicity ranges in min-max separated by commas"}; - Configurable cfgBinning{"binning", + Configurable cfgBinning{"cfgBinning", {28, -7.0, 7.0, 18, 0.2, 2.0, 16, -0.8, 0.8, 72, 0.5}, "triplets - nbins, min, max - for z_vtx, pT, eta and phi, binning plus bin fraction of phi origin shift"}; struct : ConfigurableGroup { - Configurable cfgCCDBUrl{"input_ccdburl", "http://ccdb-test.cern.ch:8080", "The CCDB url for the input file"}; - Configurable cfgCCDBPathName{"input_ccdbpath", "", "The CCDB path for the input file. Default \"\", i.e. don't load from CCDB"}; - Configurable cfgCCDBDate{"input_ccdbdate", "20220307", "The CCDB date for the input file"}; + Configurable cfgCCDBUrl{"cfgCCDBUrl", "http://ccdb-test.cern.ch:8080", "The CCDB url for the input file"}; + Configurable cfgCCDBPathName{"cfgCCDBPathName", "", "The CCDB path for the input file. Default \"\", i.e. don't load from CCDB"}; + Configurable cfgCCDBDate{"cfgCCDBDate", "20220307", "The CCDB date for the input file"}; } cfginputfile; OutputObj fOutput{"DptDptCorrelationsData", OutputObjHandlingPolicy::AnalysisObject, OutputObjSourceType::OutputObjSource}; @@ -640,7 +644,7 @@ struct twoParticleCorrelations { void init(InitContext const&) { using namespace twopcorrelations; - LOGF(info, "twoParticleCorrelations::init()"); + LOGF(info, "TwoParticleCorrelations::init()"); /* update with the configurable values */ ptbins = cfgBinning->mPTbins; @@ -748,35 +752,35 @@ struct twoParticleCorrelations { /* let's initialize the skimming input machinery */ /* collision filtering configuration */ - PWGCF::EventSelectionConfigurable eventsel(eventfilter.bfield, eventfilter.centmultsel, {}, eventfilter.zvtxsel, eventfilter.pileuprej); + pwgcf::EventSelectionConfigurable eventsel(eventfilter.bfield, eventfilter.centmultsel, {}, eventfilter.zvtxsel, eventfilter.pileuprej); /* track filtering configuration */ - PWGCF::TrackSelectionConfigurable trksel(trackfilter.ttype, trackfilter.nclstpc, trackfilter.nxrtpc, trackfilter.nclsits, trackfilter.chi2clustpc, + pwgcf::TrackSelectionConfigurable trksel(trackfilter.ttype, trackfilter.nclstpc, trackfilter.nxrtpc, trackfilter.nclsits, trackfilter.chi2clustpc, trackfilter.chi2clusits, trackfilter.xrofctpc, trackfilter.dcaxy, trackfilter.dcaz, trackfilter.ptrange, trackfilter.etarange); #ifdef INCORPORATEBAYESIANPID - PWGCF::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, + pwgcf::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, pidfilter.pidtoffilter.tpcel, pidfilter.pidtoffilter.tpcmu, pidfilter.pidtoffilter.tpcpi, pidfilter.pidtoffilter.tpcka, pidfilter.pidtoffilter.tpcpr, pidfilter.pidbayesfilter.bayel, pidfilter.pidbayesfilter.baymu, pidfilter.pidbayesfilter.baypi, pidfilter.pidbayesfilter.bayka, pidfilter.pidbayesfilter.baypr); #else - PWGCF::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, + pwgcf::PIDSelectionConfigurable pidsel(pidfilter.pidtpcfilter.tpcel, pidfilter.pidtpcfilter.tpcmu, pidfilter.pidtpcfilter.tpcpi, pidfilter.pidtpcfilter.tpcka, pidfilter.pidtpcfilter.tpcpr, pidfilter.pidtoffilter.tpcel, pidfilter.pidtoffilter.tpcmu, pidfilter.pidtoffilter.tpcpi, pidfilter.pidtoffilter.tpcka, pidfilter.pidtoffilter.tpcpr); #endif - fFilterFramework = new PWGCF::FilterAndAnalysisFramework(filterccdb.ccdburl.value, filterccdb.ccdbpath.value, filterccdb.filterdate.value); - fFilterFramework->SetConfiguration(eventsel, trksel, pidsel, PWGCF::SelectionFilterAndAnalysis::kAnalysis); - fFilterFramework->Init(); + fFilterFramework = new pwgcf::FilterAndAnalysisFramework(filterccdb.ccdburl.value, filterccdb.ccdbpath.value, filterccdb.filterdate.value); + fFilterFramework->setConfiguration(eventsel, trksel, pidsel, pwgcf::SelectionFilterAndAnalysis::KAnalysis); + fFilterFramework->init(); collisionmask = fFilterFramework->getCollisionMask(); - collisionmask_opt = fFilterFramework->getCollisionOptMask(); - collisionmask_forced = fFilterFramework->getCollisionForcedMask(); + collisionmaskOptional = fFilterFramework->getCollisionOptMask(); + collisionmaskForced = fFilterFramework->getCollisionForcedMask(); fMultiplicityIndex = fFilterFramework->getCollisionMultiplicityIndex(); trackmask = fFilterFramework->getTrackMask(); - trackmask_opt = fFilterFramework->getTrackOptMask(); - trackmask_forced = fFilterFramework->getTrackForcedMask(); + trackmaskOptional = fFilterFramework->getTrackOptMask(); + trackmaskForced = fFilterFramework->getTrackForcedMask(); pidmask = fFilterFramework->getPIDMask(); - pidmask_opt = fFilterFramework->getPIDOptMask(); - pidmask_forced = fFilterFramework->getPIDForcedMask(); - LOGF(info, "twoParticleCorrelationsFilter::init(), collision selection masks 0x%016lx, %s, and 0x%016lx and multiplicity index %d", collisionmask, fFilterFramework->printCollisionOptionalMasks().Data(), collisionmask_forced, fMultiplicityIndex); - LOGF(info, "twoParticleCorrelationsFilter::init(), track selection masks 0x%016lx, %s, and 0x%016lx ", trackmask, fFilterFramework->printTrackOptionalMasks().Data(), trackmask_forced); - LOGF(info, "twoParticleCorrelationsFilter::init(), PID selection masks 0x%016lx, %s, and 0x%016lx ", pidmask, fFilterFramework->printPIDOptionalMasks().Data(), pidmask_forced); + pidmaskOptional = fFilterFramework->getPIDOptMask(); + pidmaskForced = fFilterFramework->getPIDForcedMask(); + LOGF(info, "twoParticleCorrelationsFilter::init(), collision selection masks 0x%016lx, %s, and 0x%016lx and multiplicity index %d", collisionmask, fFilterFramework->printCollisionOptionalMasks().Data(), collisionmaskForced, fMultiplicityIndex); + LOGF(info, "twoParticleCorrelationsFilter::init(), track selection masks 0x%016lx, %s, and 0x%016lx ", trackmask, fFilterFramework->printTrackOptionalMasks().Data(), trackmaskForced); + LOGF(info, "twoParticleCorrelationsFilter::init(), PID selection masks 0x%016lx, %s, and 0x%016lx ", pidmask, fFilterFramework->printPIDOptionalMasks().Data(), pidmaskForced); if (collisionmask == static_cast(0) || trackmask == static_cast(0)) { LOGF(fatal, "twoParticleCorrelationsFilter::init() null masks, selecting everything!!!"); } @@ -790,7 +794,7 @@ struct twoParticleCorrelations { int getDCEindex(const FilteredCollision& collision) { int ixDCE = -1; - float cm = collision.centmult()[fMultiplicityIndex]; + float cm = collision.centMult()[fMultiplicityIndex]; for (int i = 0; i < ncmranges; ++i) { if (cm < fCentMultMax[i]) { ixDCE = i; @@ -836,17 +840,17 @@ struct twoParticleCorrelations { void processTheTask(CollisionObject const& collision, TracksObject& tracks) { using namespace twopcorrelations; - LOGF(TWOPCORRLOGCOLLISIONS, "Received collision with mask 0x%016lx and %ld tracks", collision.selflags(), tracks.size()); + LOGF(TWOPCORRLOGCOLLISIONS, "Received collision with mask 0x%016lx and %ld tracks", collision.selFlags(), tracks.size()); auto passOptions = [](const auto& options, auto mask) { bool all = true; - for (auto option : options) { + for (const auto& option : options) { all = all && ((option & mask) != 0UL); } return all; }; - if ((collision.selflags() & collisionmask_forced) == collisionmask_forced && passOptions(collisionmask_opt, collision.selflags())) { - LOGF(TWOPCORRLOGCOLLISIONS, ">> Accepted collision with mask 0x%016lx and %ld unfiltered tracks", collision.selflags(), tracks.size()); + if ((collision.selFlags() & collisionmaskForced) == collisionmaskForced && passOptions(collisionmaskOptional, collision.selFlags())) { + LOGF(TWOPCORRLOGCOLLISIONS, ">> Accepted collision with mask 0x%016lx and %ld unfiltered tracks", collision.selFlags(), tracks.size()); int nAcceptedTracks = 0; int nRejectedTracks = 0; tracksids.clear(); @@ -856,12 +860,12 @@ struct twoParticleCorrelations { } for (const auto& track : tracks) { int trackid = -1; - if ((track.trackflags() & trackmask_forced) == trackmask_forced && passOptions(trackmask_opt, track.trackflags())) { - if ((track.trackflags() & 0x1L) == 0x1L) { + if ((track.trackFlags() & trackmaskForced) == trackmaskForced && passOptions(trackmaskOptional, track.trackFlags())) { + if ((track.trackFlags() & 0x1L) == 0x1L) { /* positive track */ trackid = 0; nAcceptedTracks++; - } else if ((track.trackflags() & 0x2L) == 0x2L) { + } else if ((track.trackFlags() & 0x2L) == 0x2L) { /* negative track */ trackid = 1; nAcceptedTracks++; @@ -886,9 +890,9 @@ struct twoParticleCorrelations { } } /* magnetic field equal to zero for the time being */ - dataCE[ixDCE]->processCollision(tracks, collision.posZ(), collision.centmult()[fMultiplicityIndex], 0); + dataCE[ixDCE]->processCollision(tracks, collision.posZ(), collision.centMult()[fMultiplicityIndex], 0); } - LOGF(TWOPCORRLOGCOLLISIONS, ">> Accepted collision with mask 0x%016lx, %d accepted tracks and %d rejected tracks", collision.selflags(), nAcceptedTracks, nRejectedTracks); + LOGF(TWOPCORRLOGCOLLISIONS, ">> Accepted collision with mask 0x%016lx, %d accepted tracks and %d rejected tracks", collision.selFlags(), nAcceptedTracks, nRejectedTracks); } else { } } @@ -896,22 +900,22 @@ struct twoParticleCorrelations { Filter tracksfilter = (aod::track::eta < cfgBinning->mEtamax) && (aod::track::eta > cfgBinning->mEtamin) && (aod::track::pt < cfgBinning->mPTmax) && (aod::track::pt > cfgBinning->mPTmin); void processRun2(soa::Join::iterator const& collision, - soa::Filtered>& tracks) + soa::Filtered> const& tracks) { processTheTask(collision, tracks); } - PROCESS_SWITCH(twoParticleCorrelations, processRun2, "Process Run 2, i.e. over NOT stored derived data, two particle correlations", true); + PROCESS_SWITCH(TwoParticleCorrelations, processRun2, "Process Run 2, i.e. over NOT stored derived data, two particle correlations", true); - void processRun3(aod::CFCollision const& collision, soa::Filtered& tracks) + void processRun3(aod::CFCollision const& collision, soa::Filtered const& tracks) { processTheTask(collision, tracks); } - PROCESS_SWITCH(twoParticleCorrelations, processRun3, "Process Run 3, i.e. over stored derived data, two particle correlations", false); + PROCESS_SWITCH(TwoParticleCorrelations, processRun3, "Process Run 3, i.e. over stored derived data, two particle correlations", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; return workflow; } From 0abad0cd7c30d19f2828eb343e311db3f689f663 Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Thu, 12 Nov 2026 09:23:31 +0100 Subject: [PATCH 2/3] [PWGCF] DptDpt - Filter and skimming framework fix MegaLinter issues --- .../Core/EventSelectionFilterAndAnalysis.cxx | 70 +++++------ .../Core/EventSelectionFilterAndAnalysis.h | 41 +++--- .../Core/FilterAndAnalysisFramework.cxx | 20 +-- .../Core/FilterAndAnalysisFramework.h | 22 ++-- .../Core/PIDSelectionFilterAndAnalysis.cxx | 71 ++++------- .../Core/PIDSelectionFilterAndAnalysis.h | 57 ++++----- .../Core/SelectionFilterAndAnalysis.cxx | 23 +--- .../Core/SelectionFilterAndAnalysis.h | 28 ++--- .../Core/SkimmingConfigurableCuts.cxx | 117 ++++++++---------- .../Core/SkimmingConfigurableCuts.h | 26 ++-- .../Core/TrackSelectionFilterAndAnalysis.cxx | 117 ++++++++---------- .../Core/TrackSelectionFilterAndAnalysis.h | 41 +++--- .../TwoParticleCorrelationsFiltered.h | 7 +- .../TwoParticleCorrelationsSkimmed.h | 7 +- .../twoParticleCorrelationsFiltering.cxx | 10 +- .../twoParticleCorrelationsFullSkimming.cxx | 7 +- ...oParticleCorrelationsNotStoredSkimming.cxx | 7 +- .../Tasks/twoParticleCorrelations.cxx | 29 +++-- 18 files changed, 280 insertions(+), 420 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx b/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx index 6ddb65a42e0..9bb076a676f 100644 --- a/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx +++ b/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx @@ -48,39 +48,33 @@ EventSelectionConfigurable::EventSelectionConfigurable(const std::vector trigsel, std::vector zvtxsel, std::vector pileuprej) - : mBFiledSel(""), - mMultSel(""), - mTriggerSel(""), - mZVertexSel(""), - mPileUpRejection("") + { auto storeCutString = [](auto& selvector, const std::string& selname) { if (selvector.size() != 0) { if (selvector.size() == 1) { if (selvector[0].size() != 0) { return TString::Format("%s{%s}", selname.c_str(), selvector[0].c_str()); - } else { - return TString(""); } - } else { - TString scut = selname + "{cwv{"; - bool def = true; - bool firstvar = true; - for (const auto& cut : selvector) { - if (def) { - scut += cut + ':'; - def = false; - } else { - if (not firstvar) { - scut += ','; - } - scut += cut; - firstvar = false; + return TString(""); + } + TString scut = selname + "{cwv{"; + bool def = true; + bool firstvar = true; + for (const auto& cut : selvector) { + if (def) { + scut += cut + ':'; + def = false; + } else { + if (not firstvar) { + scut += ','; } + scut += cut; + firstvar = false; } - scut += "}}"; - return scut; } + scut += "}}"; + return scut; } return TString(""); }; @@ -113,9 +107,7 @@ const char* multiplicityCorrelators[nNoOfPileUpCorrelators] = {"V0M_TPCOUT", "V0 /// \brief Default constructor EventSelectionFilterAndAnalysis::EventSelectionFilterAndAnalysis() - : SelectionFilterAndAnalysis(), - mBFieldSelection{}, - mMultiplicityClasses(nullptr), + : mMultiplicityClasses(nullptr), mTriggerSelection(nullptr), mZVertex(nullptr), mPileUpRejection(nullptr) @@ -125,7 +117,7 @@ EventSelectionFilterAndAnalysis::EventSelectionFilterAndAnalysis() /// \brief Constructor from regular expression EventSelectionFilterAndAnalysis::EventSelectionFilterAndAnalysis(const TString& cutstr, Selmodes mode) : SelectionFilterAndAnalysis("", mode), - mBFieldSelection{}, + mMultiplicityClasses(nullptr), mTriggerSelection(nullptr), mZVertex(nullptr), @@ -137,7 +129,7 @@ EventSelectionFilterAndAnalysis::EventSelectionFilterAndAnalysis(const TString& /// \brief Constructor from the event selection configurable EventSelectionFilterAndAnalysis::EventSelectionFilterAndAnalysis(const EventSelectionConfigurable& evtsel, Selmodes mode) : SelectionFilterAndAnalysis("", mode), - mBFieldSelection{}, + mMultiplicityClasses(nullptr), mTriggerSelection(nullptr), mZVertex(nullptr), @@ -148,7 +140,7 @@ EventSelectionFilterAndAnalysis::EventSelectionFilterAndAnalysis(const EventSele constexpr int MaskMaxLength = 64; auto appendCut = [&cutString, &first](const std::string& str) { - if (str.size() > 0) { + if (!str.empty()) { if (first) { cutString += str; first = false; @@ -246,7 +238,7 @@ void EventSelectionFilterAndAnalysis::MultiplicityBrick::initialize() } } } - if (mAlternateEstimatorIndex.size() != (uint)(varlst.GetEntries())) { + if (mAlternateEstimatorIndex.size() != static_cast(varlst.GetEntries())) { LOGF(fatal, "EventSelectionFilterAndAnalysis::InitializeMultiplicityFilter() variant multiplicity class estimators not all implemented"); } } @@ -303,7 +295,7 @@ void EventSelectionFilterAndAnalysis::PileUpRejBrick::initialize() } } } - if (mAlternateEstimatorIndex.size() != (uint)(varlst.GetEntries())) { + if (mAlternateEstimatorIndex.size() != static_cast(varlst.GetEntries())) { LOGF(fatal, "EventSelectionFilterAndAnalysis::InitializeMultiplicityFilter() variant pile-up correlator estimators not all implemented"); } } @@ -348,15 +340,13 @@ void EventSelectionFilterAndAnalysis::constructCutFromString(const TString& cuts } LOGF(info, "Captured %s", m[1].str().c_str()); auto storeIntCut = [&m, &allowed](CutBrick*& brickvar) { - if (brickvar != nullptr) { - delete brickvar; - } + delete brickvar; + brickvar = CutBrick::constructBrick(m[1].str().c_str(), m[2].str().c_str(), allowed); }; auto storeFloatCut = [&m, &allowed](CutBrick*& brickvar) { - if (brickvar != nullptr) { - delete brickvar; - } + delete brickvar; + brickvar = CutBrick::constructBrick(m[1].str().c_str(), m[2].str().c_str(), allowed); }; /* b-field requires speciat treatment */ @@ -423,7 +413,7 @@ void EventSelectionFilterAndAnalysis::ComplexBrickHelper::armedBrick(uint64_t& a } }; - if (mAlternateEstimatorIndex.size() > 0) { + if (!mAlternateEstimatorIndex.empty()) { /* we have alternative estimators so our brick is of kind cwv */ if (mBrick->IsA() != CutWithVariations::Class()) { LOGF(fatal, "EventSelectionFilterAndAnalysis::filter() expected class with variations cut but it is not there"); @@ -433,11 +423,11 @@ void EventSelectionFilterAndAnalysis::ComplexBrickHelper::armedBrick(uint64_t& a if (deflst.GetEntries() > 1) { LOGF(fatal, "EventSelectionFilterAndAnalysis::filter() expected only one default multiplicity class estimator"); } - armedBrick((CutBrick*)deflst.At(0), true); + armedBrick(dynamic_cast*>(deflst.At(0)), true); /* and now the variants */ TList& varlst = dynamic_cast*>(mBrick)->getVariantBricks(); for (int i = 0; i < varlst.GetEntries(); ++i) { - armedBrick((CutBrick*)varlst.At(i), true); + armedBrick(dynamic_cast*>(varlst.At(i)), true); } } else { /* no alternative estimators, just the default */ diff --git a/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h b/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h index e4fff825722..c1e9a574d7a 100644 --- a/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h +++ b/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h @@ -32,11 +32,7 @@ #include #include -namespace o2 -{ -namespace analysis -{ -namespace pwgcf +namespace o2::analysis::pwgcf { /* forward declaration */ class EventSelectionFilterAndAnalysis; @@ -62,13 +58,12 @@ class EventSelectionConfigurable std::vector pileuprej); private: - std::string mBFiledSel = ""; //! the magnetic field selection cuts - std::string mMultSel = ""; //! the multiplicity selection cuts - std::string mTriggerSel = ""; //! the trigger selection cuts - std::string mZVertexSel = ""; //! the z vertex selection cuts - std::string mPileUpRejection = ""; //! the pile-up rejection criteria + std::string mBFiledSel; //! the magnetic field selection cuts + std::string mMultSel; //! the multiplicity selection cuts + std::string mTriggerSel; //! the trigger selection cuts + std::string mZVertexSel; //! the z vertex selection cuts + std::string mPileUpRejection; //! the pile-up rejection criteria - private: ClassDefNV(EventSelectionConfigurable, 1); }; @@ -91,8 +86,8 @@ class EventSelectionFilterAndAnalysis : public SelectionFilterAndAnalysis virtual ~ComplexBrickHelper() = default; CutBrick* mBrick = nullptr; int mDefaultEstimatorIndex = -1; - std::vector mAlternateEstimatorIndex = std::vector{}; - std::vector mValues = std::vector{}; + std::vector mAlternateEstimatorIndex; + std::vector mValues; int length() { return mBrick->length(); } virtual void initialize() = 0; virtual bool filter(uint64_t& mask, int& bit, CutBrick* brick, int index) = 0; @@ -107,7 +102,7 @@ class EventSelectionFilterAndAnalysis : public SelectionFilterAndAnalysis }; struct PileUpRejBrick : public ComplexBrickHelper { void initialize() override; - std::vector mIndepVar = std::vector{}; + std::vector mIndepVar; bool filter(uint64_t& mask, int& bit, CutBrick* brick, int index) override; }; @@ -115,8 +110,8 @@ class EventSelectionFilterAndAnalysis : public SelectionFilterAndAnalysis void constructCutFromString(const TString&); template void storeMultiplicities(CollisionToFilter const&, AssociatedTracks const&); - int calculateMaskLength() override; - void storeArmedMask() override; + int calculateMaskLength() final; + void storeArmedMask() final; std::vector*> mBFieldSelection; //! the magnetic field selection cuts MultiplicityBrick* mMultiplicityClasses; //! the multiplicity classes cuts @@ -180,19 +175,19 @@ inline bool EventSelectionFilterAndAnalysis::filterBrickValue(uint64_t& mask, in inline bool EventSelectionFilterAndAnalysis::ComplexBrickHelper::filter(uint64_t& mask, int& bit) { bool acceptcollision = true; - if (mAlternateEstimatorIndex.size() > 0) { + if (!mAlternateEstimatorIndex.empty()) { bool atleastonealternative = false; /* if (mBrick->IsA() != CutWithVariations::Class()) { LOGF(fatal, "EventSelectionFilterAndAnalysis::filter() expected class with variations cut but it is not there"); } */ /* first the default */ TList& deflst = dynamic_cast*>(mBrick)->getDefaultBricks(); - bool acc = filter(mask, bit, (CutBrick*)deflst.At(0), mDefaultEstimatorIndex); + bool acc = filter(mask, bit, dynamic_cast*>(deflst.At(0)), mDefaultEstimatorIndex); atleastonealternative = atleastonealternative || acc; /* and now the variants */ TList& varlst = dynamic_cast*>(mBrick)->getVariantBricks(); for (int i = 0; i < varlst.GetEntries(); ++i) { - bool acc = filter(mask, bit, (CutBrick*)varlst.At(i), mAlternateEstimatorIndex[i]); + bool acc = filter(mask, bit, dynamic_cast*>(varlst.At(i)), mAlternateEstimatorIndex[i]); atleastonealternative = atleastonealternative || acc; } acceptcollision = acceptcollision && atleastonealternative; @@ -226,7 +221,7 @@ inline uint64_t EventSelectionFilterAndAnalysis::filter(CollisionToFilter const& /* we require the collision be accepted by the whole set of filters */ bool acceptcollision = true; - if (mBFieldSelection.size() > 0) { + if (!mBFieldSelection.empty()) { bool oneatleast = false; for (const auto& brick : mBFieldSelection) { bool acc = filterBrickValue(selectedMask, bit, brick, bfield); @@ -258,7 +253,7 @@ inline std::vector EventSelectionFilterAndAnalysis::MultiplicityBrick::ge { std::vector res; - if (mAlternateEstimatorIndex.size() > 0) { + if (!mAlternateEstimatorIndex.empty()) { /* first the default */ res.push_back(mValues[mDefaultEstimatorIndex]); /* and now the variants */ @@ -273,8 +268,6 @@ inline std::vector EventSelectionFilterAndAnalysis::MultiplicityBrick::ge return res; } -} // namespace pwgcf -} // namespace analysis -} // namespace o2 +} // namespace o2::analysis::pwgcf #endif // PWGCF_TWOPARTICLECORRELATIONS_CORE_EVENTSELECTIONFILTERANDANALYSIS_H_ diff --git a/PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.cxx b/PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.cxx index 86c38ca64f8..3e66bf58e89 100644 --- a/PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.cxx +++ b/PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.cxx @@ -26,7 +26,6 @@ #include #include -#include #include #include @@ -45,19 +44,8 @@ ClassImp(FilterAndAnalysisFramework); /// \brief Default constructor FilterAndAnalysisFramework::FilterAndAnalysisFramework() - : TNamed(), - ccdburl(""), - ccdbpath(""), - filterdate(""), - forceupdate(false), - fTrackFilter(nullptr), - fEventFilter(nullptr), - fPIDFilter(nullptr), - tmpTrackFilter(nullptr), - tmpEventFilter(nullptr), - tmpPIDFilter(nullptr) -{ -} + + = default; /// \brief Named constructor for a concrete operating mode void FilterAndAnalysisFramework::setConfiguration(EventSelectionConfigurable& evtf, TrackSelectionConfigurable& trkf, PIDSelectionConfigurable& pidf, SelectionFilterAndAnalysis::Selmodes mode) @@ -96,7 +84,7 @@ void FilterAndAnalysisFramework::registerConfiguration() uint64_t eot = timestamp + (12 * 60 * 60 * 1000 - 1000); /* one second before the end of the day */ /* get access to the CCDB */ - o2::ccdb::CcdbApi* ccdb = new o2::ccdb::CcdbApi(); + auto* ccdb = new o2::ccdb::CcdbApi(); ccdb->init(ccdburl); o2::ccdb::BasicCCDBManager* ccdbm = &o2::ccdb::BasicCCDBManager::instance(); ccdbm->setFatalWhenNull(false); /* we need to check the availability of objects */ @@ -104,7 +92,7 @@ void FilterAndAnalysisFramework::registerConfiguration() signatures = ccdbm->getForTimeStamp(ccdbpath, timestamp); auto storesignatures = [&]() { - TList* siglst = new TList(); + auto* siglst = new TList(); siglst->SetOwner(); siglst->SetName("Skimming signatures"); siglst->Add(new TObjString(tmpEventFilter->getCutStringSignature().Data())); diff --git a/PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.h b/PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.h index e4da0278515..7cd7ef5b52f 100644 --- a/PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.h +++ b/PWGCF/TwoParticleCorrelations/Core/FilterAndAnalysisFramework.h @@ -30,11 +30,7 @@ #include #include -namespace o2 -{ -namespace analysis -{ -namespace pwgcf +namespace o2::analysis::pwgcf { /// \brief Base class for filter and selection once filetered @@ -68,9 +64,9 @@ class FilterAndAnalysisFramework : public TNamed std::vector& getTrackOptMask() { return fTrackFilter->getOptMask(); } std::vector& getPIDOptMask() { return fPIDFilter->getOptMask(); } /// \brief provides the optional part mask of the different objects in a printable shape - TString printCollisionOptionalMasks() const { return fEventFilter->printOptionalMasks(); } - TString printTrackOptionalMasks() const { return fTrackFilter->printOptionalMasks(); } - TString printPIDOptionalMasks() const { return fPIDFilter->printOptionalMasks(); } + [[nodiscard]] TString printCollisionOptionalMasks() const { return fEventFilter->printOptionalMasks(); } + [[nodiscard]] TString printTrackOptionalMasks() const { return fTrackFilter->printOptionalMasks(); } + [[nodiscard]] TString printPIDOptionalMasks() const { return fPIDFilter->printOptionalMasks(); } /// \brief get the valid (armed) mandatory part mask associated to the configuration of the different objects /// \return the corresponding armed forced mask /// A clear example of the mandatory part mask is the mask of the zvertex and their @@ -105,9 +101,9 @@ class FilterAndAnalysisFramework : public TNamed const TString& getPIDFilterCutStringSignature() { return fPIDFilter->getCutStringSignature(); } private: - std::string ccdburl = ""; - std::string ccdbpath = ""; - std::string filterdate = ""; + std::string ccdburl; + std::string ccdbpath; + std::string filterdate; bool forceupdate = false; pwgcf::TrackSelectionFilterAndAnalysis* fTrackFilter = nullptr; /// the track filter pwgcf::EventSelectionFilterAndAnalysis* fEventFilter = nullptr; /// the event filter @@ -121,8 +117,6 @@ class FilterAndAnalysisFramework : public TNamed extern void registerConfiguration(o2::analysis::pwgcf::FilterAndAnalysisFramework*); -} // namespace pwgcf -} // namespace analysis -} // namespace o2 +} // namespace o2::analysis::pwgcf #endif // PWGCF_TWOPARTICLECORRELATIONS_CORE_FILTERANDANALYSISFRAMEWORK_H_ diff --git a/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.cxx b/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.cxx index 0c77478de13..a4429f482c9 100644 --- a/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.cxx +++ b/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.cxx @@ -48,49 +48,33 @@ PIDSelectionConfigurable::PIDSelectionConfigurable(std::vector pidt PIDSelectionConfigurable::PIDSelectionConfigurable(std::vector pidtpcel, std::vector pidtpcmu, std::vector pidtpcpi, std::vector pidtpcka, std::vector pidtpcpr, std::vector pidtofel, std::vector pidtofmu, std::vector pidtofpi, std::vector pidtofka, std::vector pidtofpr) #endif - : mPidTpcSelEl{}, - mPidTpcSelMu{}, - mPidTpcSelPi{}, - mPidTpcSelKa{}, - mPidTpcSelPr{}, - mPidTofSelEl{}, - mPidTofSelMu{}, - mPidTofSelPi{}, - mPidTofSelKa{}, - mPidTofSelPr{}, - mPidBaySelEl{}, - mPidBaySelMu{}, - mPidBaySelPi{}, - mPidBaySelKa{}, - mPidBaySelPr{} + { auto storeCutString = [](auto& selvector, const std::string& selname) { if (selvector.size() != 0) { if (selvector.size() == 1) { if (selvector[0].size() != 0) { return TString::Format("%s{%s}", selname.c_str(), selvector[0].c_str()); - } else { - return TString(""); } - } else { - TString scut = selname + "{cwv{"; - bool def = true; - bool firstvar = true; - for (const auto& cut : selvector) { - if (def) { - scut += cut + ':'; - def = false; - } else { - if (not firstvar) { - scut += ','; - } - scut += cut; - firstvar = false; + return TString(""); + } + TString scut = selname + "{cwv{"; + bool def = true; + bool firstvar = true; + for (const auto& cut : selvector) { + if (def) { + scut += cut + ':'; + def = false; + } else { + if (not firstvar) { + scut += ','; } + scut += cut; + firstvar = false; } - scut += "}}"; - return scut; } + scut += "}}"; + return scut; } return TString(""); }; @@ -120,11 +104,7 @@ const std::vector PIDSelectionFilterAndAnalysis::mSpeciesNames = {" /// \brief Default constructor PIDSelectionFilterAndAnalysis::PIDSelectionFilterAndAnalysis() - : SelectionFilterAndAnalysis(), - mPTOF(0.8f), - mRequireTOF(false), - mEllipticTPCTOF(false), - mCloseNsigmasTPC(kNoOfSpecies, nullptr), + : mCloseNsigmasTPC(kNoOfSpecies, nullptr), mCloseNsigmasTOF(kNoOfSpecies, nullptr), mBayesProbability(kNoOfSpecies, nullptr) { @@ -133,9 +113,7 @@ PIDSelectionFilterAndAnalysis::PIDSelectionFilterAndAnalysis() /// \brief Constructor from regular expression PIDSelectionFilterAndAnalysis::PIDSelectionFilterAndAnalysis(const TString& cutstr, Selmodes mode) : SelectionFilterAndAnalysis("", mode), - mPTOF(0.8f), - mRequireTOF(false), - mEllipticTPCTOF(false), + mCloseNsigmasTPC(kNoOfSpecies, nullptr), mCloseNsigmasTOF(kNoOfSpecies, nullptr), mBayesProbability(kNoOfSpecies, nullptr) @@ -146,9 +124,7 @@ PIDSelectionFilterAndAnalysis::PIDSelectionFilterAndAnalysis(const TString& cuts /// \brief Constructor from the PID selection configurable PIDSelectionFilterAndAnalysis::PIDSelectionFilterAndAnalysis(const PIDSelectionConfigurable& pidsel, Selmodes mode) : SelectionFilterAndAnalysis("", mode), - mPTOF(0.8f), - mRequireTOF(false), - mEllipticTPCTOF(false), + mCloseNsigmasTPC(kNoOfSpecies, nullptr), mCloseNsigmasTOF(kNoOfSpecies, nullptr), mBayesProbability(kNoOfSpecies, nullptr) @@ -158,7 +134,7 @@ PIDSelectionFilterAndAnalysis::PIDSelectionFilterAndAnalysis(const PIDSelectionC constexpr int MaxLength = 64; auto appendCut = [&cutString, &first](const std::string& str) { - if (str.size() > 0) { + if (!str.empty()) { if (first) { cutString += str; first = false; @@ -275,9 +251,8 @@ void PIDSelectionFilterAndAnalysis::constructCutFromString(const TString& cutstr regex cutregex3l("^(\\w+)\\{((?:[^{}]++|\\{(?2)\\})*)\\}"); smatch m3l; auto storeCut = [&m3l, &allowed](CutBrick*& brickvar) { - if (brickvar != nullptr) { - delete brickvar; - } + delete brickvar; + brickvar = CutBrick::constructBrick(m3l[1].str().c_str(), m3l[2].str().c_str(), allowed); }; lev3str.Remove(TString::kLeading, ' '); diff --git a/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.h b/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.h index 553d2af995f..6c9dc884e73 100644 --- a/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.h +++ b/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.h @@ -31,11 +31,7 @@ #undef INCORPORATEBAYESIANPID -namespace o2 -{ -namespace analysis -{ -namespace pwgcf +namespace o2::analysis::pwgcf { /* forward declaration */ class PIDSelectionFilterAndAnalysis; @@ -76,23 +72,22 @@ class PIDSelectionConfigurable #endif private: - std::string mPidTpcSelEl = ""; - std::string mPidTpcSelMu = ""; - std::string mPidTpcSelPi = ""; - std::string mPidTpcSelKa = ""; - std::string mPidTpcSelPr = ""; - std::string mPidTofSelEl = ""; - std::string mPidTofSelMu = ""; - std::string mPidTofSelPi = ""; - std::string mPidTofSelKa = ""; - std::string mPidTofSelPr = ""; - std::string mPidBaySelEl = ""; - std::string mPidBaySelMu = ""; - std::string mPidBaySelPi = ""; - std::string mPidBaySelKa = ""; - std::string mPidBaySelPr = ""; + std::string mPidTpcSelEl; + std::string mPidTpcSelMu; + std::string mPidTpcSelPi; + std::string mPidTpcSelKa; + std::string mPidTpcSelPr; + std::string mPidTofSelEl; + std::string mPidTofSelMu; + std::string mPidTofSelPi; + std::string mPidTofSelKa; + std::string mPidTofSelPr; + std::string mPidBaySelEl; + std::string mPidBaySelMu; + std::string mPidBaySelPi; + std::string mPidBaySelKa; + std::string mPidBaySelPr; - private: ClassDefNV(PIDSelectionConfigurable, 1); }; @@ -113,12 +108,12 @@ class PIDSelectionFilterAndAnalysis : public SelectionFilterAndAnalysis uint64_t filter(TrackToFilter const& track); enum PIDSpecies { - kElectron = 0, ///< electron - kMuon, ///< muon - kPion, ///< pion - kKaon, ///< kaon - kProton, ///< proton - kNoOfSpecies, ///< the number of considered species + kElectron = 0, ///< electron + kMuon = 1, ///< muon + kPion = 2, ///< pion + kKaon = 3, ///< kaon + kProton = 4, ///< proton + kNoOfSpecies = 5, ///< the number of considered species kWrongSpecies = -1 }; @@ -138,8 +133,8 @@ class PIDSelectionFilterAndAnalysis : public SelectionFilterAndAnalysis private: void constructCutFromString(const TString&); - int calculateMaskLength() override; - void storeArmedMask() override; + int calculateMaskLength() final; + void storeArmedMask() final; float mPTOF = 0.8f; ///< the p threshold for cheking TOF information bool mRequireTOF = false; ///< is TOF required @@ -194,8 +189,6 @@ inline uint64_t PIDSelectionFilterAndAnalysis::filter(TrackToFilter const& track return mSelectedMask; } -} // namespace pwgcf -} // namespace analysis -} // namespace o2 +} // namespace o2::analysis::pwgcf #endif // PWGCF_TWOPARTICLECORRELATIONS_CORE_PIDSELECTIONFILTERANDANALYSIS_H_ diff --git a/PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.cxx b/PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.cxx index fb5ec83a366..a6543751da2 100644 --- a/PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.cxx +++ b/PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.cxx @@ -29,27 +29,14 @@ ClassImp(SelectionFilterAndAnalysis); /// \brief Default constructor SelectionFilterAndAnalysis::SelectionFilterAndAnalysis() - : TNamed(), - mMode(KFilter), - mCutStringSignature(), - mMaskLength(0), - mSelectedMask(0UL), - mArmedMask(0UL), - mOptArmedMask{}, - mForcedArmedMask(0UL) -{ -} + + = default; /// \brief Named constructor for a concrete operating mode SelectionFilterAndAnalysis::SelectionFilterAndAnalysis(const TString& name, Selmodes mode) : TNamed(name, name), - mMode(mode), - mCutStringSignature(), - mMaskLength(0), - mSelectedMask(0UL), - mArmedMask(0UL), - mOptArmedMask{}, - mForcedArmedMask(0UL) + mMode(mode) + { } @@ -62,7 +49,7 @@ TString SelectionFilterAndAnalysis::printOptionalMasks() const str += ", "; } first = false; - str += TString::Format("0x%016lx", u_long(option)); + str += TString::Format("0x%016lx", static_cast(option)); } str += ")"; return str; diff --git a/PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.h b/PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.h index f623c3cfd62..a2e43d3d19a 100644 --- a/PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.h +++ b/PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.h @@ -25,11 +25,7 @@ #include #include -namespace o2 -{ -namespace analysis -{ -namespace pwgcf +namespace o2::analysis::pwgcf { /// \brief Base class for filter and selection once filetered @@ -54,7 +50,7 @@ class SelectionFilterAndAnalysis : public TNamed /// A clear example of the optional part mask is the mask of the multiplicity classes /// where only one of the available in the whole mask will be flagged std::vector& getOptMask() { return mOptArmedMask; } - TString printOptionalMasks() const; + [[nodiscard]] TString printOptionalMasks() const; /// \brief get the valid (armed) mandatory part mask associated to the configuration /// \return the armed optional mask /// A clear example of the mandatory part mask is the mask of the zvertex and their @@ -68,20 +64,18 @@ class SelectionFilterAndAnalysis : public TNamed virtual void storeArmedMask() = 0; protected: - Selmodes mMode = KFilter; /// the operating mode of the selection instance - TString mCutStringSignature; /// the signature of the cut string, i.e. without the alternative selection tags - int mMaskLength = 0; /// the length of the mask needed to filter the selection cuts - uint64_t mSelectedMask = 0UL; /// the selection mask for the current passed collision - uint64_t mArmedMask = 0UL; /// the complete armed mask identifying the applicable selection cuts - std::vector mOptArmedMask = {}; /// the list of armed masks for options of the applicable selection cuts - /// all of them have to have at least one option active - uint64_t mForcedArmedMask = 0UL; /// the mandatory armed mask of the applicable selection cuts + Selmodes mMode = KFilter; /// the operating mode of the selection instance + TString mCutStringSignature; /// the signature of the cut string, i.e. without the alternative selection tags + int mMaskLength = 0; /// the length of the mask needed to filter the selection cuts + uint64_t mSelectedMask = 0UL; /// the selection mask for the current passed collision + uint64_t mArmedMask = 0UL; /// the complete armed mask identifying the applicable selection cuts + std::vector mOptArmedMask; /// the list of armed masks for options of the applicable selection cuts + /// all of them have to have at least one option active + uint64_t mForcedArmedMask = 0UL; /// the mandatory armed mask of the applicable selection cuts ClassDefNV(SelectionFilterAndAnalysis, 1) }; -} // namespace pwgcf -} // namespace analysis -} // namespace o2 +} // namespace o2::analysis::pwgcf #endif // PWGCF_TWOPARTICLECORRELATIONS_CORE_SELECTIONFILTERANDANALYSIS_H_ diff --git a/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx b/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx index 48434797ce2..34b45ddaa24 100644 --- a/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx +++ b/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx @@ -19,6 +19,8 @@ #include #include +#include +#include #include #include @@ -186,8 +188,8 @@ template class o2::analysis::pwgcf::CutBrickLimit; /// Default constructor template CutBrickFnLimit::CutBrickFnLimit() - : CutBrickLimit(), - mFunction{} + : CutBrickLimit() + { } @@ -206,8 +208,8 @@ CutBrickFnLimit::CutBrickFnLimit(const char* name, const TF1& fn /// \param cutstr The cuts string template CutBrickFnLimit::CutBrickFnLimit(const TString& cutstr) - : CutBrickLimit(), - mFunction{} + : CutBrickLimit() + { constructCutFromString(cutstr); } @@ -322,8 +324,8 @@ template class o2::analysis::pwgcf::CutBrickThreshold; /// Default constructor template CutBrickFnThreshold::CutBrickFnThreshold() - : CutBrickThreshold(), - mFunction{} + : CutBrickThreshold() + { } @@ -342,8 +344,8 @@ CutBrickFnThreshold::CutBrickFnThreshold(const char* name, const /// \param cutstr The cuts string template CutBrickFnThreshold::CutBrickFnThreshold(const TString& cutstr) - : CutBrickThreshold(), - mFunction{} + : CutBrickThreshold() + { constructCutFromString(cutstr); } @@ -463,9 +465,8 @@ template class o2::analysis::pwgcf::CutBrickRange; /// Default constructor template CutBrickFnRange::CutBrickFnRange() - : CutBrickRange(), - mLowFunction{}, - mUpFunction{} + : CutBrickRange() + { } @@ -486,9 +487,8 @@ CutBrickFnRange::CutBrickFnRange(const char* name, const TF1& lo /// \param cutstr The cuts string template CutBrickFnRange::CutBrickFnRange(const TString& cutstr) - : CutBrickRange(), - mLowFunction{}, - mUpFunction{} + : CutBrickRange() + { constructCutFromString(cutstr); } @@ -609,9 +609,8 @@ template class o2::analysis::pwgcf::CutBrickExtToRange; /// Default constructor template CutBrickFnExtToRange::CutBrickFnExtToRange() - : CutBrickExtToRange(), - mLowFunction{}, - mUpFunction{} + : CutBrickExtToRange() + { } @@ -631,9 +630,8 @@ CutBrickFnExtToRange::CutBrickFnExtToRange(const char*, const TF /// \param cutstr The cuts string template CutBrickFnExtToRange::CutBrickFnExtToRange(const TString& cutstr) - : CutBrickExtToRange(), - mLowFunction{}, - mUpFunction{} + : CutBrickExtToRange() + { constructCutFromString(cutstr); } @@ -781,9 +779,8 @@ std::vector CutBrickSelectorMultipleRanges::filter(const T mActive[i] = true; last = i; break; - } else { - mActive[i] = false; } + mActive[i] = false; } for (unsigned int i = last + 1; i < mActive.size(); ++i) { mActive[i] = false; @@ -806,9 +803,8 @@ template class o2::analysis::pwgcf::CutBrickSelectorMultipleRanges; template CutWithVariations::CutWithVariations() : CutBrick(), - mAllowSeveralDefaults(false), - mDefaultBricks{}, - mVariationBricks{} + mAllowSeveralDefaults(false) + { } @@ -819,9 +815,8 @@ CutWithVariations::CutWithVariations() template CutWithVariations::CutWithVariations(const char* name, const char* cutstr, bool severaldefaults) : CutBrick(name, cutstr), - mAllowSeveralDefaults(severaldefaults), - mDefaultBricks{}, - mVariationBricks{} + mAllowSeveralDefaults(severaldefaults) + { } @@ -830,9 +825,8 @@ CutWithVariations::CutWithVariations(const char* name, const cha template CutWithVariations::CutWithVariations(const TString& cutstr) : CutBrick(), - mAllowSeveralDefaults(false), - mDefaultBricks{}, - mVariationBricks{} + mAllowSeveralDefaults(false) + { constructCutFromString(cutstr); } @@ -871,7 +865,7 @@ void CutWithVariations::constructCutFromString(const TString& cu bool atleastonearmed = false; auto addCuts = [&](TList& cutlist, std::string cuttxt, bool reqflag) { std::smatch m; - while (cuttxt.length() > 0) { + while (!cuttxt.empty()) { std::set allowed = {"lim", "th", "rg", "xrg", "mrg", "fnlim", "fnth", "fnrg", "fnxrg"}; std::regex cutregex("(\\w+\\{[\\w.,=\\-\\+\\*\\/]+}(?:-(?:no|yes))*)"); bool res = regex_search(cuttxt, m, cutregex); @@ -928,18 +922,15 @@ bool CutWithVariations::addDefaultBrick(CutBrick if (mAllowSeveralDefaults) { if (mDefaultBricks.FindObject(brick->GetName())) { return false; - } else { - mDefaultBricks.Add(brick); - return true; - } - } else { - if (mDefaultBricks.GetEntries() > 0) { - return false; - } else { - mDefaultBricks.Add(brick); - return true; } + mDefaultBricks.Add(brick); + return true; + } + if (mDefaultBricks.GetEntries() > 0) { + return false; } + mDefaultBricks.Add(brick); + return true; } /// \brief Stores the brick with the variation to the default value for the cut @@ -951,10 +942,9 @@ bool CutWithVariations::addVariationBrick(CutBrickGetName())) { return false; - } else { - mVariationBricks.Add(brick); - return true; } + mVariationBricks.Add(brick); + return true; } /// \brief Returns wether the cut brick is incorporated in the selection chain @@ -968,18 +958,18 @@ std::vector CutWithVariations::isArmed() int nArmedDefaults = 0; int nArmedVariants = 0; for (int i = 0; i < mDefaultBricks.GetEntries(); ++i) { - std::vector tmp = ((CutBrick*)mDefaultBricks.At(i))->isArmed(); + std::vector tmp = static_cast*>(mDefaultBricks.At(i))->isArmed(); res.insert(res.end(), tmp.begin(), tmp.end()); - for (const bool& iarmed : tmp) { + for (const auto& iarmed : tmp) { if (iarmed) { nArmedDefaults++; } } } for (int i = 0; i < mVariationBricks.GetEntries(); ++i) { - std::vector tmp = ((CutBrick*)mVariationBricks.At(i))->isArmed(); + std::vector tmp = static_cast*>(mVariationBricks.At(i))->isArmed(); res.insert(res.end(), tmp.begin(), tmp.end()); - for (const bool& iarmed : tmp) { + for (const auto& iarmed : tmp) { if (iarmed) { nArmedVariants++; } @@ -1008,11 +998,11 @@ std::vector CutWithVariations::filter(const TValueToFilter std::vector res; res.reserve(length()); for (int i = 0; i < mDefaultBricks.GetEntries(); ++i) { - std::vector tmp = ((CutBrick*)mDefaultBricks.At(i))->filter(value); + std::vector tmp = static_cast*>(mDefaultBricks.At(i))->filter(value); res.insert(res.end(), tmp.begin(), tmp.end()); } for (int i = 0; i < mVariationBricks.GetEntries(); ++i) { - std::vector tmp = ((CutBrick*)mVariationBricks.At(i))->filter(value); + std::vector tmp = static_cast*>(mVariationBricks.At(i))->filter(value); res.insert(res.end(), tmp.begin(), tmp.end()); } return res; @@ -1027,10 +1017,10 @@ int CutWithVariations::length() /* TODO: should a single default cut without variations return zero length? */ int length = 0; for (int i = 0; i < mDefaultBricks.GetEntries(); ++i) { - length += ((CutBrick*)mDefaultBricks.At(i))->length(); + length += static_cast*>(mDefaultBricks.At(i))->length(); } for (int i = 0; i < mVariationBricks.GetEntries(); ++i) { - length += ((CutBrick*)mVariationBricks.At(i))->length(); + length += static_cast*>(mVariationBricks.At(i))->length(); } return length; } @@ -1046,8 +1036,8 @@ int CutWithVariations::getArmedIndex() bool found = false; for (int i = 0; not found and i < brklst.GetEntries(); ++i) { index++; - std::vector tmp = ((CutBrick*)brklst.At(i))->isArmed(); - for (const bool& iarmed : tmp) { + std::vector tmp = static_cast*>(brklst.At(i))->isArmed(); + for (const auto& iarmed : tmp) { if (iarmed) { found = true; break; @@ -1072,25 +1062,21 @@ template class o2::analysis::pwgcf::CutWithVariations; /// Default constructor SpecialCutBrick::SpecialCutBrick() - : TNamed(), - mState(kPASSIVE), - mMode(kUNSELECTED) -{ -} + + = default; /// Named constructor /// \param name The name of the brick SpecialCutBrick::SpecialCutBrick(const char* name, const char* title) - : TNamed(name, title), - mState(kPASSIVE), - mMode(kUNSELECTED) + : TNamed(name, title) + { } ClassImp(SpecialCutBrick); /// \brief Constructor from regular expression -TrackSelectionBrick::TrackSelectionBrick(const TString& regex) : SpecialCutBrick() +TrackSelectionBrick::TrackSelectionBrick(const TString& regex) { bool armed = false; TString name = regex; @@ -1199,7 +1185,8 @@ bool TrackSelectionBrick::fulfillsITSHitRequirements(uint8_t itsClusterMap) auto hits = std::count_if(itsRequirement.second.begin(), itsRequirement.second.end(), [&](auto&& requiredLayer) { return itsClusterMap & (One << requiredLayer); }); if ((itsRequirement.first == -1) && (hits > 0)) { return false; // no hits were required in specified layers - } else if (hits < itsRequirement.first) { + } + if (hits < itsRequirement.first) { return false; // not enough hits found in specified layers } } diff --git a/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.h b/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.h index 01bdb0701cb..163b293436a 100644 --- a/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.h +++ b/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.h @@ -36,11 +36,7 @@ #include #include -namespace o2 -{ -namespace analysis -{ -namespace pwgcf +namespace o2::analysis::pwgcf { /// \class CutBrick /// \brief Virtual class which implements the base component of the selection cuts @@ -55,7 +51,6 @@ class CutBrick : public TNamed ~CutBrick() override = default; CutBrick& operator=(const CutBrick&) = delete; - public: /// Returns whether the cut brick is active allowing the selection /// \return true if the brick is active bool isActive() { return mState == kACTIVE; } @@ -476,7 +471,6 @@ class SpecialCutBrick : public TNamed ~SpecialCutBrick() override = default; SpecialCutBrick& operator=(const SpecialCutBrick&) = delete; - public: /// Returns whether the cut brick is active allowing the selection /// \return true if the brick is active bool isActive() { return mState == kACTIVE; } @@ -492,7 +486,6 @@ class SpecialCutBrick : public TNamed /// Set the status of the cut significative (or not) for the selection chain void arm(bool doit = true) { doit ? mMode = kSELECTED : mMode = kUNSELECTED; } - protected: /// \enum BrickStatus /// \brief The status of the brick enum BrickStatus { @@ -557,10 +550,9 @@ class TrackSelectionBrick : public SpecialCutBrick (mCheckMaxDcaZ && (std::abs(track.dcaZ()) <= mMaxDcaZ))) { this->mState = this->kACTIVE; return true; - } else { - this->mState = this->kPASSIVE; - return false; } + this->mState = this->kPASSIVE; + return false; } int length() override { return 1; } @@ -612,9 +604,9 @@ class TrackSelectionBrick : public SpecialCutBrick float mMaxChi2PerClusterITS{1e10f}; // max its fit chi2 per ITS cluster float mMinNCrossedRowsOverFindableClustersTPC{0.f}; // min ratio crossed rows / findable clusters - float mMaxDcaXY{1e10f}; // max dca in xy plane - float mMaxDcaZ{1e10f}; // max dca in z direction - std::function mMaxDcaXYPtDep{}; // max dca in xy plane as function of pT + float mMaxDcaXY{1e10f}; // max dca in xy plane + float mMaxDcaZ{1e10f}; // max dca in z direction + std::function mMaxDcaXYPtDep; // max dca in xy plane as function of pT bool mRequireITSRefit{false}; // require refit in ITS bool mRequireTPCRefit{false}; // require refit in TPC @@ -630,13 +622,11 @@ class TrackSelectionBrick : public SpecialCutBrick bool mCheckMaxDcaZ{true}; // check max dca in z direction // vector of ITS requirements (minNRequiredHits in specific requiredLayers) - std::vector>> mRequiredITSHits{}; + std::vector>> mRequiredITSHits; ClassDefOverride(TrackSelectionBrick, 1); }; -} // namespace pwgcf -} // namespace analysis -} // namespace o2 +} // namespace o2::analysis::pwgcf #endif // PWGCF_TWOPARTICLECORRELATIONS_CORE_SKIMMINGCONFIGURABLECUTS_H_ diff --git a/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx b/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx index ab9ff8af7fb..05c2e905d66 100644 --- a/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx +++ b/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx @@ -52,45 +52,33 @@ TrackSelectionConfigurable::TrackSelectionConfigurable(const std::vector dcaz, std::vector ptrange, std::vector etarange) - : mTrackTypes{}, - mNClustersTPC{}, - mNCrossedRowsTPC{}, - mNClustersITS{}, - mMaxChi2PerClusterTPC{}, - mMaxChi2PerClusterITS{}, - mMinNCrossedRowsOverFindableClustersTPC{}, - mMaxDcaXY{}, - mMaxDcaZ{}, - mPtRange{}, - mEtaRange{} + { auto storeCutString = [](auto& selvector, const std::string& selname) { if (selvector.size() != 0) { if (selvector.size() == 1) { if (selvector[0].size() != 0) { return TString::Format("%s{%s}", selname.c_str(), selvector[0].c_str()); - } else { - return TString(""); } - } else { - TString scut = selname + "{cwv{"; - bool def = true; - bool firstvar = true; - for (const auto& cut : selvector) { - if (def) { - scut += cut + ':'; - def = false; - } else { - if (not firstvar) { - scut += ','; - } - scut += cut; - firstvar = false; + return TString(""); + } + TString scut = selname + "{cwv{"; + bool def = true; + bool firstvar = true; + for (const auto& cut : selvector) { + if (def) { + scut += cut + ':'; + def = false; + } else { + if (not firstvar) { + scut += ','; } + scut += cut; + firstvar = false; } - scut += "}}"; - return scut; } + scut += "}}"; + return scut; } return TString(""); }; @@ -124,8 +112,7 @@ ClassImp(TrackSelectionFilterAndAnalysis); /// \brief Default constructor TrackSelectionFilterAndAnalysis::TrackSelectionFilterAndAnalysis() - : SelectionFilterAndAnalysis(), - mNClustersTPC(nullptr), + : mNClustersTPC(nullptr), mNCrossedRowsTPC(nullptr), mNClustersITS(nullptr), mMaxChi2PerClusterTPC(nullptr), @@ -184,21 +171,21 @@ TrackSelectionFilterAndAnalysis::TrackSelectionFilterAndAnalysis(const TrackSele mTrackTypes.SetOwner(true); TString cutString = "tracksel{" + trcksel.mTrackTypes; - if (trcksel.mNClustersTPC.size() > 0 or - trcksel.mNCrossedRowsTPC.size() > 0 or - trcksel.mNClustersITS.size() > 0 or - trcksel.mMaxChi2PerClusterTPC.size() > 0 or - trcksel.mMaxChi2PerClusterITS.size() > 0 or - trcksel.mMinNCrossedRowsOverFindableClustersTPC.size() > 0 or - trcksel.mMaxDcaXY.size() > 0 or - trcksel.mMaxDcaZ.size() > 0 or - trcksel.mPtRange.size() > 0 or - trcksel.mEtaRange.size() > 0) { + if (!trcksel.mNClustersTPC.empty() or + !trcksel.mNCrossedRowsTPC.empty() or + !trcksel.mNClustersITS.empty() or + !trcksel.mMaxChi2PerClusterTPC.empty() or + !trcksel.mMaxChi2PerClusterITS.empty() or + !trcksel.mMinNCrossedRowsOverFindableClustersTPC.empty() or + !trcksel.mMaxDcaXY.empty() or + !trcksel.mMaxDcaZ.empty() or + !trcksel.mPtRange.empty() or + !trcksel.mEtaRange.empty()) { cutString += ";"; bool first = true; auto appendCut = [&cutString, &first](const std::string& str) { - if (str.size() > 0) { + if (!str.empty()) { if (first) { cutString += str; first = false; @@ -235,10 +222,10 @@ int TrackSelectionFilterAndAnalysis::calculateMaskLength() { int length = 0; for (int i = 0; i < mTrackSign.GetEntries(); ++i) { - length += ((CutBrick*)mTrackSign.At(i))->length(); + length += (dynamic_cast*>(mTrackSign.At(i)))->length(); } for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - length += ((SpecialCutBrick*)mTrackTypes.At(i))->length(); + length += (dynamic_cast(mTrackTypes.At(i)))->length(); } if (mNClustersTPC != nullptr) { length += mNClustersTPC->length(); @@ -275,18 +262,18 @@ int TrackSelectionFilterAndAnalysis::calculateMaskLength() void TrackSelectionFilterAndAnalysis::setPtRange(const TString& regex) { - if (mPtRange != nullptr) { - delete mPtRange; - } + + delete mPtRange; + mPtRange = CutBrick::constructBrick("pT", regex.Data(), std::set{"rg", "th", "lim", "xrg"}); mMaskLength = calculateMaskLength(); } void TrackSelectionFilterAndAnalysis::setEtaRange(const TString& regex) { - if (mEtaRange != nullptr) { - delete mEtaRange; - } + + delete mEtaRange; + mEtaRange = CutBrick::constructBrick("eta", regex.Data(), std::set{"rg", "th", "lim", "xrg"}); mMaskLength = calculateMaskLength(); } @@ -351,56 +338,54 @@ void TrackSelectionFilterAndAnalysis::constructCutFromString(const TString& cuts } LOGF(info, "Captured %s", m[1].str().c_str()); auto storeIntCut = [&m, &allowed](CutBrick*& brickvar) { - if (brickvar != nullptr) { - delete brickvar; - } + delete brickvar; + brickvar = CutBrick::constructBrick(m[1].str().c_str(), m[2].str().c_str(), allowed); }; auto storeFloatCut = [&m, &allowed](CutBrick*& brickvar) { - if (brickvar != nullptr) { - delete brickvar; - } + delete brickvar; + brickvar = CutBrick::constructBrick(m[1].str().c_str(), m[2].str().c_str(), allowed); }; if (m[1].str() == "nclstpc") { storeIntCut(mNClustersTPC); for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - ((TrackSelectionBrick*)mTrackTypes.At(i))->disableNClustersTPCCheck(); + (dynamic_cast(mTrackTypes.At(i)))->disableNClustersTPCCheck(); } } else if (m[1].str() == "nclsits") { storeIntCut(mNClustersITS); for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - ((TrackSelectionBrick*)mTrackTypes.At(i))->disableNClustersITSCheck(); + (dynamic_cast(mTrackTypes.At(i)))->disableNClustersITSCheck(); } } else if (m[1].str() == "nxrtpc") { storeIntCut(mNCrossedRowsTPC); for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - ((TrackSelectionBrick*)mTrackTypes.At(i))->disableNCrossedRowsTPCCheck(); + (dynamic_cast(mTrackTypes.At(i)))->disableNCrossedRowsTPCCheck(); } } else if (m[1].str() == "chi2clustpc") { storeFloatCut(mMaxChi2PerClusterTPC); for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - ((TrackSelectionBrick*)mTrackTypes.At(i))->disableMaxChi2PerClusterTPCCheck(); + (dynamic_cast(mTrackTypes.At(i)))->disableMaxChi2PerClusterTPCCheck(); } } else if (m[1].str() == "chi2clusits") { storeFloatCut(mMaxChi2PerClusterITS); for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - ((TrackSelectionBrick*)mTrackTypes.At(i))->disableMaxChi2PerClusterITSCheck(); + (dynamic_cast(mTrackTypes.At(i)))->disableMaxChi2PerClusterITSCheck(); } } else if (m[1].str() == "xrofctpc") { storeFloatCut(mMinNCrossedRowsOverFindableClustersTPC); for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - ((TrackSelectionBrick*)mTrackTypes.At(i))->disableMinNCrossedRowsOverFindableClustersTPCCheck(); + (dynamic_cast(mTrackTypes.At(i)))->disableMinNCrossedRowsOverFindableClustersTPCCheck(); } } else if (m[1].str() == "dcaxy") { storeFloatCut(mMaxDcaXY); for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - ((TrackSelectionBrick*)mTrackTypes.At(i))->disableMaxDcaXYCheck(); + (dynamic_cast(mTrackTypes.At(i)))->disableMaxDcaXYCheck(); } } else if (m[1].str() == "dcaz") { storeFloatCut(mMaxDcaZ); for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - ((TrackSelectionBrick*)mTrackTypes.At(i))->disableMaxDcaZCheck(); + (dynamic_cast(mTrackTypes.At(i)))->disableMaxDcaZCheck(); } } else if (m[1].str() == "pT") { storeFloatCut(mPtRange); @@ -444,12 +429,12 @@ void TrackSelectionFilterAndAnalysis::storeArmedMask() optMask = 0UL; for (int i = 0; i < mTrackSign.GetEntries(); ++i) { - armedBrick((CutBrick*)mTrackSign.At(i), true); + armedBrick(dynamic_cast*>(mTrackSign.At(i)), true); } mOptArmedMask.push_back(optMask); optMask = 0UL; for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - armedBrick((TrackSelectionBrick*)mTrackTypes.At(i), true); + armedBrick(dynamic_cast(mTrackTypes.At(i)), true); } mOptArmedMask.push_back(optMask); optMask = 0UL; diff --git a/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.h b/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.h index cf9360149f3..b2e01a40f95 100644 --- a/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.h +++ b/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.h @@ -31,11 +31,7 @@ #include #include -namespace o2 -{ -namespace analysis -{ -namespace pwgcf +namespace o2::analysis::pwgcf { /* forward de declaration */ class TrackSelectionFilterAndAnalysis; @@ -83,19 +79,18 @@ class TrackSelectionConfigurable std::vector etarange); private: - std::string mTrackTypes = ""; /// the track types to select list - std::string mNClustersTPC = ""; //! the number of TPC clusters cuts - std::string mNCrossedRowsTPC = ""; //! the number of TPC crossed rows cuts - std::string mNClustersITS = ""; //! the number of ITS clusters cuts - std::string mMaxChi2PerClusterTPC = ""; //! the max Chi2 per TPC cluster cuts - std::string mMaxChi2PerClusterITS = ""; //! the max Chi2 per ITS cluster cuts - std::string mMinNCrossedRowsOverFindableClustersTPC = ""; //! the min ration crossed TPC rows over findable TPC clusters cuts - std::string mMaxDcaXY = ""; //! the DCAxy cuts - std::string mMaxDcaZ = ""; //! the DCAz cuts - std::string mPtRange = ""; //! the pT range cuts - std::string mEtaRange = ""; //! the eta range cuts + std::string mTrackTypes; /// the track types to select list + std::string mNClustersTPC; //! the number of TPC clusters cuts + std::string mNCrossedRowsTPC; //! the number of TPC crossed rows cuts + std::string mNClustersITS; //! the number of ITS clusters cuts + std::string mMaxChi2PerClusterTPC; //! the max Chi2 per TPC cluster cuts + std::string mMaxChi2PerClusterITS; //! the max Chi2 per ITS cluster cuts + std::string mMinNCrossedRowsOverFindableClustersTPC; //! the min ration crossed TPC rows over findable TPC clusters cuts + std::string mMaxDcaXY; //! the DCAxy cuts + std::string mMaxDcaZ; //! the DCAz cuts + std::string mPtRange; //! the pT range cuts + std::string mEtaRange; //! the eta range cuts - private: ClassDefNV(TrackSelectionConfigurable, 1); }; @@ -115,8 +110,8 @@ class TrackSelectionFilterAndAnalysis : public SelectionFilterAndAnalysis private: void constructCutFromString(const TString&); - int calculateMaskLength(); - void storeArmedMask(); + int calculateMaskLength() final; + void storeArmedMask() final; TList mTrackSign; /// the track charge sign list TList mTrackTypes; /// the track types to select list @@ -169,10 +164,10 @@ uint64_t TrackSelectionFilterAndAnalysis::filter(TrackToFilter const& track) }; for (int i = 0; i < mTrackSign.GetEntries(); ++i) { - filterBrickValue((CutBrick*)mTrackSign.At(i), track.sign()); + filterBrickValue(dynamic_cast*>(mTrackSign.At(i)), track.sign()); } for (int i = 0; i < mTrackTypes.GetEntries(); ++i) { - filterTrackType((TrackSelectionBrick*)mTrackTypes.At(i), track); + filterTrackType(dynamic_cast(mTrackTypes.At(i)), track); } if (mNClustersTPC != nullptr) { filterBrickValue(mNClustersTPC, track.tpcNClsFound()); @@ -211,8 +206,6 @@ uint64_t TrackSelectionFilterAndAnalysis::filter(TrackToFilter const& track) return mSelectedMask = selectedMask; } -} // namespace pwgcf -} // namespace analysis -} // namespace o2 +} // namespace o2::analysis::pwgcf #endif // PWGCF_TWOPARTICLECORRELATIONS_CORE_TRACKSELECTIONFILTERANDANALYSIS_H_ diff --git a/PWGCF/TwoParticleCorrelations/DataModel/TwoParticleCorrelationsFiltered.h b/PWGCF/TwoParticleCorrelations/DataModel/TwoParticleCorrelationsFiltered.h index 01067b08b79..4bfc456ddf6 100644 --- a/PWGCF/TwoParticleCorrelations/DataModel/TwoParticleCorrelationsFiltered.h +++ b/PWGCF/TwoParticleCorrelations/DataModel/TwoParticleCorrelationsFiltered.h @@ -21,9 +21,7 @@ #include -namespace o2 -{ -namespace aod +namespace o2::aod { /* we have to change from int to bool when bool columns work properly */ namespace twopfilter @@ -49,7 +47,6 @@ DECLARE_SOA_TABLE(TwoPFilteredTracks, "AOD", "FILTEREDTRKS", //! The reconstruct twopfilter::AcceptedAs); DECLARE_SOA_TABLE(TwoPFilteredParticles, "AOD", "FILTEREDGENTRKS", //! The generated particles filtered table twopfilter::McAcceptedAs); -} // namespace aod -} // namespace o2 +} // namespace o2::aod #endif // PWGCF_TWOPARTICLECORRELATIONS_DATAMODEL_TWOPARTICLECORRELATIONSFILTERED_H_ diff --git a/PWGCF/TwoParticleCorrelations/DataModel/TwoParticleCorrelationsSkimmed.h b/PWGCF/TwoParticleCorrelations/DataModel/TwoParticleCorrelationsSkimmed.h index 58eb82c0994..cdc24593fa5 100644 --- a/PWGCF/TwoParticleCorrelations/DataModel/TwoParticleCorrelationsSkimmed.h +++ b/PWGCF/TwoParticleCorrelations/DataModel/TwoParticleCorrelationsSkimmed.h @@ -22,9 +22,7 @@ #include #include -namespace o2 -{ -namespace aod +namespace o2::aod { /* we have to change from int to bool when bool columns work properly */ namespace cfskim @@ -106,7 +104,6 @@ DECLARE_SOA_TABLE(CFMCCollisionLbls, "AOD", "CFMCCOLLISONLBL", DECLARE_SOA_TABLE(CFMCTrackLabels, "AOD", "CFMCTRACKLABEL", cfskim::McParticleId, mctracklabel::McMask); -} // namespace aod -} // namespace o2 +} // namespace o2::aod #endif // PWGCF_TWOPARTICLECORRELATIONS_DATAMODEL_TWOPARTICLECORRELATIONSSKIMMED_H_ diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsFiltering.cxx b/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsFiltering.cxx index 2ba80db1377..c56b697fd40 100644 --- a/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsFiltering.cxx +++ b/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsFiltering.cxx @@ -69,7 +69,7 @@ struct TwoParticleCorrelationsFiltering { #include "PWGCF/TwoParticleCorrelations/TableProducer/Productions/skimmingconf_20221115.h" // NOLINT - int nReportedTracks; + int nReportedTracks{}; // HistogramRegistry historeg; void init(InitContext const&) @@ -132,7 +132,7 @@ struct TwoParticleCorrelationsFiltering { if ((collision.selFlags() & collisionmaskForced) == collisionmaskForced && passOptions(collisionmaskOptional, collision.selFlags())) { LOGF(TWOPFILTERLOGCOLLISIONS, ">> Accepted collision with mask 0x%016lx and %ld unfiltered tracks", collision.selFlags(), tracks.size()); - acceptedcollisions(collision.centMult()[fMultiplicityIndex], uint8_t(true)); + acceptedcollisions(collision.centMult()[fMultiplicityIndex], static_cast(true)); int nAcceptedTracks = 0; for (const auto& track : tracks) { if ((track.trackFlags() & trackmaskForced) == trackmaskForced && passOptions(trackmaskOptional, track.trackFlags())) { @@ -144,7 +144,7 @@ struct TwoParticleCorrelationsFiltering { } LOGF(TWOPFILTERLOGCOLLISIONS, ">> Accepted collision with mask 0x%016lx and %d accepted tracks", collision.selFlags(), nAcceptedTracks); } else { - acceptedcollisions(collision.centMult()[fMultiplicityIndex], uint8_t(false)); + acceptedcollisions(collision.centMult()[fMultiplicityIndex], static_cast(false)); } } PROCESS_SWITCH(TwoParticleCorrelationsFiltering, processRun2, "Process Run 2, i.e. over NOT stored derived data, two particle correlations filtering", true); @@ -163,7 +163,7 @@ struct TwoParticleCorrelationsFiltering { if ((collision.selFlags() & collisionmaskForced) == collisionmaskForced && passOptions(collisionmaskOptional, collision.selFlags())) { LOGF(TWOPFILTERLOGCOLLISIONS, ">> Accepted collision with mask 0x%016lx and %ld unfiltered tracks", collision.selFlags(), tracks.size()); - acceptedcollisions(collision.centMult()[fMultiplicityIndex], uint8_t(true)); + acceptedcollisions(collision.centMult()[fMultiplicityIndex], static_cast(true)); int nAcceptedTracks = 0; for (const auto& track : tracks) { if ((track.trackFlags() & trackmaskForced) == trackmaskForced && passOptions(trackmaskOptional, track.trackFlags())) { @@ -175,7 +175,7 @@ struct TwoParticleCorrelationsFiltering { } LOGF(TWOPFILTERLOGCOLLISIONS, ">> Accepted collision with mask 0x%016lx and %d accepted tracks", collision.selFlags(), nAcceptedTracks); } else { - acceptedcollisions(collision.centMult()[fMultiplicityIndex], uint8_t(false)); + acceptedcollisions(collision.centMult()[fMultiplicityIndex], static_cast(false)); } } PROCESS_SWITCH(TwoParticleCorrelationsFiltering, processRun3, "Process Run 3, i.e. over stored derived data, two particle correlations filtering", false); diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsFullSkimming.cxx b/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsFullSkimming.cxx index e8c0749896a..03c6d95a2ed 100644 --- a/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsFullSkimming.cxx +++ b/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsFullSkimming.cxx @@ -123,11 +123,11 @@ struct TwoParticleCorrelationsFullSkimming { Produces skimmedgencollision; Produces skimmedparticles; - Service ccdb; + Service ccdb{}; #include "PWGCF/TwoParticleCorrelations/TableProducer/Productions/skimmingconf_20221115.h" // NOLINT - int nReportedTracks; + int nReportedTracks{}; int runNumber = 0; int bfield = 0; HistogramRegistry historeg; @@ -232,9 +232,8 @@ struct TwoParticleCorrelationsFullSkimming { } if (accepted) { return fFilterFramework->filterCollision(collision, tracks, bfield); - } else { - return 0UL; } + return 0UL; } void processRun2(soa::Join::iterator const& collision, diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsNotStoredSkimming.cxx b/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsNotStoredSkimming.cxx index 1d0f1438fc4..e14850421a0 100644 --- a/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsNotStoredSkimming.cxx +++ b/PWGCF/TwoParticleCorrelations/TableProducer/twoParticleCorrelationsNotStoredSkimming.cxx @@ -120,11 +120,11 @@ struct TwoParticleCorrelationsNotStoredSkimming { Produces collisionmask; Produces gencollisionmask; - Service ccdb; + Service ccdb{}; #include "PWGCF/TwoParticleCorrelations/TableProducer/Productions/skimmingconf_20221115.h" // NOLINT - int nReportedTracks; + int nReportedTracks{}; int runNumber = 0; int bfield = 0; HistogramRegistry historeg; @@ -229,9 +229,8 @@ struct TwoParticleCorrelationsNotStoredSkimming { } if (accepted) { return fFilterFramework->filterCollision(collision, tracks, bfield); - } else { - return 0UL; } + return 0UL; } void processRun2(soa::Join::iterator const& collision, diff --git a/PWGCF/TwoParticleCorrelations/Tasks/twoParticleCorrelations.cxx b/PWGCF/TwoParticleCorrelations/Tasks/twoParticleCorrelations.cxx index 92e94576e9d..7033dc3ff87 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/twoParticleCorrelations.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/twoParticleCorrelations.cxx @@ -135,7 +135,7 @@ struct TwoParticleCorrelations { // The TwoParticleCorrelationsAnalysisTask output objects //============================================================================================ /* histograms */ - TH1F* fhVertexZA; //! fhN1VsPt; //! fhN1VsEtaPhi; //! fhSum1PtVsEtaPhi; //!(ccdbstored); } /// \brief Returns the potentially phi origin shifted phi @@ -177,9 +177,8 @@ struct TwoParticleCorrelations { using namespace twopcorrelations; if (!(phi < phiup)) { return phi - constants::math::TwoPI; - } else { - return phi; } + return phi; } /// \brief Returns the zero based bin index of the eta phi passed track @@ -431,7 +430,7 @@ struct TwoParticleCorrelations { /* load the species names */ for (const auto& id : idnames) { LOGF(info, "Adding particle species %s", id.c_str()); - tname.push_back(std::string(id.c_str())); + tname.push_back(std::string(id)); } /* reserve the histograms place holders */ for (uint i = 0; i < tname.size(); ++i) { @@ -605,7 +604,7 @@ struct TwoParticleCorrelations { /* the skimming configuration */ #include "PWGCF/TwoParticleCorrelations/TableProducer/Productions/skimmingconf_20221115.h" // NOLINT - Service ccdb; + Service ccdb{}; /* the data memebers for this task */ /* the centrality / multiplicity limits for collecting data in this task instance */ @@ -631,7 +630,7 @@ struct TwoParticleCorrelations { Configurable cfgCentSpec{"cfgCentSpec", "00-05,05-10,10-20,20-30,30-40,40-50,50-60,60-70,70-80", "Centrality/multiplicity ranges in min-max separated by commas"}; Configurable cfgBinning{"cfgBinning", - {28, -7.0, 7.0, 18, 0.2, 2.0, 16, -0.8, 0.8, 72, 0.5}, + {.mZVtxbins = 28, .mZVtxmin = -7.0, .mZVtxmax = 7.0, .mPTbins = 18, .mPTmin = 0.2, .mPTmax = 2.0, .mEtabins = 16, .mEtamin = -0.8, .mEtamax = 0.8, .mPhibins = 72, .mPhibinshift = 0.5}, "triplets - nbins, min, max - for z_vtx, pT, eta and phi, binning plus bin fraction of phi origin shift"}; struct : ConfigurableGroup { Configurable cfgCCDBUrl{"cfgCCDBUrl", "http://ccdb-test.cern.ch:8080", "The CCDB url for the input file"}; @@ -661,7 +660,7 @@ struct TwoParticleCorrelations { phiup = constants::math::TwoPI; phibinshift = cfgBinning->mPhibinshift; processpairs = cfgProcessPairs.value; - loadfromccdb = cfginputfile.cfgCCDBPathName->length() > 0; + loadfromccdb = !cfginputfile.cfgCCDBPathName->empty(); /* update the potential binning change */ etabinwidth = (etaup - etalow) / static_cast(etabins); phibinwidth = (phiup - philow) / static_cast(phibins); @@ -676,7 +675,7 @@ struct TwoParticleCorrelations { deltaphiup = constants::math::TwoPI - deltaphibinwidth / 2.0; /* create the output directory which will own the task output */ - TList* fGlobalOutputList = new TList(); + auto* fGlobalOutputList = new TList(); fGlobalOutputList->SetOwner(true); fOutput.setObject(fGlobalOutputList); @@ -717,7 +716,7 @@ struct TwoParticleCorrelations { dataCE[i] = new DataCollectingEngine(); /* create the output list for the current centrality range */ - TList* fOutputList = new TList(); + auto* fOutputList = new TList(); fOutputList->SetName(TString::Format("DptDptCorrelationsData-%s", tokens->At(i)->GetName())); fOutputList->SetOwner(true); /* init the data collection instance */ @@ -812,7 +811,7 @@ struct TwoParticleCorrelations { cfgtm.tm_hour = 12; uint64_t timestamp = std::mktime(&cfgtm) * 1000; - TList* lst = ccdb->getForTimeStamp(ccdbpath, timestamp); + auto* lst = ccdb->getForTimeStamp(ccdbpath, timestamp); if (lst != nullptr) { LOGF(info, "Correctly loaded CCDB input object"); } else { @@ -883,10 +882,10 @@ struct TwoParticleCorrelations { int ixDCE = getDCEindex(collision); if (!(ixDCE < 0)) { if (ccdblst != nullptr && !dataCE[ixDCE]->isCCDBstored()) { - dataCE[ixDCE]->storeTrackCorrections(std::vector{static_cast(ccdblst->FindObject(TString::Format("correction_%02d-%02d_p1", static_cast(fCentMultMin[ixDCE]), static_cast(fCentMultMax[ixDCE])).Data())), - static_cast(ccdblst->FindObject(TString::Format("correction_%02d-%02d_m1", static_cast(fCentMultMin[ixDCE]), static_cast(fCentMultMax[ixDCE])).Data()))}); - dataCE[ixDCE]->storePtAverages(std::vector{static_cast(ccdblst->FindObject(TString::Format("ptavgetaphi_%02d-%02d_p", static_cast(fCentMultMin[ixDCE]), static_cast(fCentMultMax[ixDCE])).Data())), - static_cast(ccdblst->FindObject(TString::Format("ptavgetaphi_%02d-%02d_m", static_cast(fCentMultMin[ixDCE]), static_cast(fCentMultMax[ixDCE])).Data()))}); + dataCE[ixDCE]->storeTrackCorrections(std::vector{dynamic_cast(ccdblst->FindObject(TString::Format("correction_%02d-%02d_p1", static_cast(fCentMultMin[ixDCE]), static_cast(fCentMultMax[ixDCE])).Data())), + dynamic_cast(ccdblst->FindObject(TString::Format("correction_%02d-%02d_m1", static_cast(fCentMultMin[ixDCE]), static_cast(fCentMultMax[ixDCE])).Data()))}); + dataCE[ixDCE]->storePtAverages(std::vector{dynamic_cast(ccdblst->FindObject(TString::Format("ptavgetaphi_%02d-%02d_p", static_cast(fCentMultMin[ixDCE]), static_cast(fCentMultMax[ixDCE])).Data())), + dynamic_cast(ccdblst->FindObject(TString::Format("ptavgetaphi_%02d-%02d_m", static_cast(fCentMultMin[ixDCE]), static_cast(fCentMultMax[ixDCE])).Data()))}); } } /* magnetic field equal to zero for the time being */ From 7c9e4acf2b12492e97c6fd475cddf59998a6883c Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Thu, 12 Nov 2026 17:33:44 +0100 Subject: [PATCH 3/3] [PWGCF] DptDpt - Filter and skimming framework fix MegaLinter issues --- .../Core/EventSelectionFilterAndAnalysis.cxx | 7 +++--- .../Core/EventSelectionFilterAndAnalysis.h | 12 +++++----- .../Core/PIDSelectionFilterAndAnalysis.cxx | 7 +++--- .../Core/PIDSelectionFilterAndAnalysis.h | 10 ++++----- .../Core/SkimmingConfigurableCuts.cxx | 13 ++++++----- .../Core/TrackSelectionFilterAndAnalysis.cxx | 7 +++--- .../Core/TrackSelectionFilterAndAnalysis.h | 22 +++++++++---------- 7 files changed, 38 insertions(+), 40 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx b/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx index 9bb076a676f..00fd21dcba7 100644 --- a/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx +++ b/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx @@ -329,10 +329,9 @@ void EventSelectionFilterAndAnalysis::constructCutFromString(const TString& cuts if (lev2str.Length() == 0) { break; } - regex cutregex("^(\\w+)\\{((?:[^{}]++|\\{(?2)\\})*)\\}"); - std::string in(lev2str.Data()); - smatch m; - bool res = regex_search(in, m, cutregex); + cutregex = regex("^(\\w+)\\{((?:[^{}]++|\\{(?2)\\})*)\\}"); + in = (lev2str.Data()); + res = regex_search(in, m, cutregex); constexpr int ExpectedComponents = 3; if (not res or m.empty() or (m.size() != ExpectedComponents)) { diff --git a/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h b/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h index c1e9a574d7a..f06dc3f5189 100644 --- a/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h +++ b/PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h @@ -43,11 +43,11 @@ class EventSelectionConfigurable friend class EventSelectionFilterAndAnalysis; public: - EventSelectionConfigurable(std::string bfieldsel = "", - std::string multsel = "", - std::string trigsel = "", - std::string zvtxsel = "", - std::string pileuprej = "") + explicit EventSelectionConfigurable(std::string bfieldsel = "", + std::string multsel = "", + std::string trigsel = "", + std::string zvtxsel = "", + std::string pileuprej = "") : mBFiledSel(std::move(bfieldsel)), mMultSel{std::move(multsel)}, mTriggerSel{std::move(trigsel)}, mZVertexSel{std::move(zvtxsel)}, mPileUpRejection{std::move(pileuprej)} { } @@ -187,7 +187,7 @@ inline bool EventSelectionFilterAndAnalysis::ComplexBrickHelper::filter(uint64_t /* and now the variants */ TList& varlst = dynamic_cast*>(mBrick)->getVariantBricks(); for (int i = 0; i < varlst.GetEntries(); ++i) { - bool acc = filter(mask, bit, dynamic_cast*>(varlst.At(i)), mAlternateEstimatorIndex[i]); + acc = filter(mask, bit, dynamic_cast*>(varlst.At(i)), mAlternateEstimatorIndex[i]); atleastonealternative = atleastonealternative || acc; } acceptcollision = acceptcollision && atleastonealternative; diff --git a/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.cxx b/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.cxx index a4429f482c9..4b7bc2955b1 100644 --- a/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.cxx +++ b/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.cxx @@ -235,10 +235,9 @@ void PIDSelectionFilterAndAnalysis::constructCutFromString(const TString& cutstr if (lev2str.Length() == 0) { break; } - regex cutregex("^(\\w+)\\{((?:[^{}]++|\\{(?2)\\})*)\\}"); - std::string in(lev2str.Data()); - smatch m; - bool res = regex_search(in, m, cutregex); + cutregex = regex("^(\\w+)\\{((?:[^{}]++|\\{(?2)\\})*)\\}"); + in = std::string(lev2str.Data()); + res = regex_search(in, m, cutregex); constexpr int ExpectedComponents = 3; if (not res or m.empty() or (m.size() != ExpectedComponents)) { LOGF(fatal, "PIDSelectionFilterAndAnalysis::::ConstructCutFromString. Wrong RE: %s, try pidsel{tpcsel{tpcpi{cwv{rg{-3.0,3.0}:rg{-2.0,2.0},rg{-3.0,5.0}}}}} for instance", cutstr.Data()); diff --git a/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.h b/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.h index 6c9dc884e73..99716c53e86 100644 --- a/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.h +++ b/PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.h @@ -43,9 +43,9 @@ class PIDSelectionConfigurable public: #ifdef INCORPORATEBAYESIANPID - PIDSelectionConfigurable(std::string pidtpcel = "", std::string pidtpcmu = "", std::string pidtpcpi = "", std::string pidtpcka = "", std::string pidtpcpr = "", - std::string pidtofel = "", std::string pidtofmu = "", std::string pidtofpi = "", std::string pidtofka = "", std::string pidtofpr = "", - std::string pidbayel = "", std::string pidbaymu = "", std::string pidbaypi = "", std::string pidbayka = "", std::string pidbaypr = "") + explicit PIDSelectionConfigurable(std::string pidtpcel = "", std::string pidtpcmu = "", std::string pidtpcpi = "", std::string pidtpcka = "", std::string pidtpcpr = "", + std::string pidtofel = "", std::string pidtofmu = "", std::string pidtofpi = "", std::string pidtofka = "", std::string pidtofpr = "", + std::string pidbayel = "", std::string pidbaymu = "", std::string pidbaypi = "", std::string pidbayka = "", std::string pidbaypr = "") : mPidTpcSelEl{pidtpcel}, mPidTpcSelMu{pidtpcmu}, mPidTpcSelPi{pidtpcpi}, mPidTpcSelKa{pidtpcka}, mPidTpcSelPr{pidtpcpr}, mPidTofSelEl{pidtofel}, mPidTofSelMu{pidtofmu}, mPidTofSelPi{pidtofpi}, mPidTofSelKa{pidtofka}, mPidTofSelPr{pidtofpr}, mPidBaySelEl{pidbayel}, mPidBaySelMu{pidbaymu}, mPidBaySelPi{pidbaypi}, mPidBaySelKa{pidbayka}, mPidBaySelPr{pidbaypr} { } @@ -53,8 +53,8 @@ class PIDSelectionConfigurable std::vector pidtofel, std::vector pidtofmu, std::vector pidtofpi, std::vector pidtofka, std::vector pidtofpr, std::vector pidbayel, std::vector pidbaymu, std::vector pidbaypi, std::vector pidbayka, std::vector pidbaypr); #else - PIDSelectionConfigurable(std::string pidtpcel = "", std::string pidtpcmu = "", std::string pidtpcpi = "", std::string pidtpcka = "", std::string pidtpcpr = "", - std::string pidtofel = "", std::string pidtofmu = "", std::string pidtofpi = "", std::string pidtofka = "", std::string pidtofpr = "") + explicit PIDSelectionConfigurable(std::string pidtpcel = "", std::string pidtpcmu = "", std::string pidtpcpi = "", std::string pidtpcka = "", std::string pidtpcpr = "", + std::string pidtofel = "", std::string pidtofmu = "", std::string pidtofpi = "", std::string pidtofka = "", std::string pidtofpr = "") : mPidTpcSelEl{std::move(pidtpcel)}, mPidTpcSelMu{std::move(pidtpcmu)}, mPidTpcSelPi{std::move(pidtpcpi)}, diff --git a/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx b/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx index 34b45ddaa24..06d54ae361e 100644 --- a/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx +++ b/PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx @@ -125,7 +125,7 @@ CutBrickLimit::CutBrickLimit() /// \param value The limit value template CutBrickLimit::CutBrickLimit(const char* name, const TValueToFilter& value) - : CutBrick(name, TString::Format("%s{lim{%f}}", name, float(value))), + : CutBrick(name, TString::Format("%s{lim{%f}}", name, static_cast(value))), mLimit(value) { } @@ -261,7 +261,7 @@ CutBrickThreshold::CutBrickThreshold() /// \param value The threshold value template CutBrickThreshold::CutBrickThreshold(const char* name, const TValueToFilter& value) - : CutBrick(name, TString::Format("%s{th{%f}}", name, float(value))), + : CutBrick(name, TString::Format("%s{th{%f}}", name, static_cast(value))), mThreshold(value) { } @@ -399,7 +399,7 @@ CutBrickRange::CutBrickRange() /// \param high The high value for the cut range template CutBrickRange::CutBrickRange(const char* name, const TValueToFilter& low, const TValueToFilter& high) - : CutBrick(name, TString::Format("%s{rg{%f,%f}}", name, float(low), float(high))), + : CutBrick(name, TString::Format("%s{rg{%f,%f}}", name, static_cast(low), static_cast(high))), mLow(low), mUp(high) { @@ -543,7 +543,7 @@ CutBrickExtToRange::CutBrickExtToRange() /// \param high The high value for the cut excluded range template CutBrickExtToRange::CutBrickExtToRange(const char* name, const TValueToFilter& low, const TValueToFilter& high) - : CutBrick(name, TString::Format("%s{xrg{%f,%f}}", name, float(low), float(high))), + : CutBrick(name, TString::Format("%s{xrg{%f,%f}}", name, static_cast(low), static_cast(high))), mLow(low), mUp(high) { @@ -691,9 +691,10 @@ CutBrickSelectorMultipleRanges::CutBrickSelectorMultipleRanges(c for (const auto& edge : edges) { mEdges.push_back(edge); if (first) { - title += TString::Format("%.2f", float(edge)); + title += TString::Format("%.2f", static_cast(edge)); + first = false; } else { - title += TString::Format(",%.2f", float(edge)); + title += TString::Format(",%.2f", static_cast(edge)); } } title += "}"; diff --git a/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx b/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx index 05c2e905d66..3db6bcd85a0 100644 --- a/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx +++ b/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx @@ -328,10 +328,9 @@ void TrackSelectionFilterAndAnalysis::constructCutFromString(const TString& cuts if (lev2str.Length() == 0) { break; } - regex cutregex("^(\\w+)\\{((?:[^{}]++|\\{(?2)\\})*)\\}"); - std::string in(lev2str.Data()); - smatch m; - bool res = regex_search(in, m, cutregex); + cutregex = regex("^(\\w+)\\{((?:[^{}]++|\\{(?2)\\})*)\\}"); + in = std::string(lev2str.Data()); + res = regex_search(in, m, cutregex); constexpr int ExpectedComponents = 3; if (not res or m.empty() or (m.size() != ExpectedComponents)) { Fatal("TrackSelectionFilterAndAnalysis::::ConstructCutFromString", "Wrong RE: %s, try tracksel{ttype{FB32,FB96};nclstpc{th{70}},nxr{cwv{th{70},th{80}}}} for instance", cutstr.Data()); diff --git a/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.h b/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.h index b2e01a40f95..668dd673642 100644 --- a/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.h +++ b/PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.h @@ -42,17 +42,17 @@ class TrackSelectionConfigurable friend class TrackSelectionFilterAndAnalysis; public: - TrackSelectionConfigurable(std::string ttype = "", - std::string nclstpc = "", - std::string nxrtpc = "", - std::string nclsits = "", - std::string chi2clustpc = "", - std::string chi2clusits = "", - std::string xrofctpc = "", - std::string dcaxy = "", - std::string dcaz = "", - std::string ptrange = "", - std::string etarange = "") + explicit TrackSelectionConfigurable(std::string ttype = "", + std::string nclstpc = "", + std::string nxrtpc = "", + std::string nclsits = "", + std::string chi2clustpc = "", + std::string chi2clusits = "", + std::string xrofctpc = "", + std::string dcaxy = "", + std::string dcaz = "", + std::string ptrange = "", + std::string etarange = "") : mTrackTypes{std::move(ttype)}, mNClustersTPC{std::move(nclstpc)}, mNCrossedRowsTPC{std::move(nxrtpc)},