From a80fdd6c4669caea890e668ab362e46877330801 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Mon, 4 Aug 2025 09:45:12 +0000 Subject: [PATCH] Please consider the following formatting changes --- .../Core/FemtoUniverseDetaDphiStar.h | 488 +++++++++--------- 1 file changed, 245 insertions(+), 243 deletions(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h index 0365e6995b0..47cbc24a3e5 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h @@ -447,280 +447,282 @@ class FemtoUniverseDetaDphiStar LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } return false; - } else { - LOG(fatal) << "FemtoUniversePairCleaner: Combination of objects not defined - quitting!"; - return false; - } - } - - /// Check if pair is close or not - template - bool isClosePairFrac(Part const& part1, Part const& part2, float lmagfield, uint8_t ChosenEventType, bool IsDphiAvgOrDist, float DistMax, float FracMax) - { - magfield = lmagfield; - - if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kTrack) { - /// Track-Track combination - // check if provided particles are in agreement with the class instantiation - if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack) { - LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kTrack,kTrack candidates."; - return false; } - auto deta = part1.eta() - part2.eta(); - auto dphiAvg = averagePhiStar(part1, part2, 0); - auto distfrac = averagePhiStarFrac(part1, part2, DistMax); - if (ChosenEventType == femto_universe_container::EventType::same) { - histdetadpisame[0][0]->Fill(deta, dphiAvg); - } else if (ChosenEventType == femto_universe_container::EventType::mixed) { - histdetadpimixed[0][0]->Fill(deta, dphiAvg); - } else { - LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + else + { + LOG(fatal) << "FemtoUniversePairCleaner: Combination of objects not defined - quitting!"; + return false; } + } - if (IsDphiAvgOrDist) { - if (std::pow(dphiAvg, 2) / std::pow(cutDeltaPhiStarMax, 2) + std::pow(deta, 2) / std::pow(cutDeltaEtaMax, 2) < 1.) { - return true; + /// Check if pair is close or not + template + bool isClosePairFrac(Part const& part1, Part const& part2, float lmagfield, uint8_t ChosenEventType, bool IsDphiAvgOrDist, float DistMax, float FracMax) + { + magfield = lmagfield; + + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kTrack) { + /// Track-Track combination + // check if provided particles are in agreement with the class instantiation + if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack) { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kTrack,kTrack candidates."; + return false; + } + auto deta = part1.eta() - part2.eta(); + auto dphiAvg = averagePhiStar(part1, part2, 0); + auto distfrac = averagePhiStarFrac(part1, part2, DistMax); + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[0][0]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[0][0]->Fill(deta, dphiAvg); } else { - if (ChosenEventType == femto_universe_container::EventType::same) { - histdetadpisame[0][1]->Fill(deta, dphiAvg); - } else if (ChosenEventType == femto_universe_container::EventType::mixed) { - histdetadpimixed[0][1]->Fill(deta, dphiAvg); + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } + + if (IsDphiAvgOrDist) { + if (std::pow(dphiAvg, 2) / std::pow(cutDeltaPhiStarMax, 2) + std::pow(deta, 2) / std::pow(cutDeltaEtaMax, 2) < 1.) { + return true; } else { - LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[0][1]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[0][1]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } + return false; } - return false; - } - } else { - if (distfrac > FracMax) { - return true; } else { - if (ChosenEventType == femto_universe_container::EventType::same) { - histdetadpisame[0][1]->Fill(deta, dphiAvg); - } else if (ChosenEventType == femto_universe_container::EventType::mixed) { - histdetadpimixed[0][1]->Fill(deta, dphiAvg); + if (distfrac > FracMax) { + return true; } else { - LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[0][1]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[0][1]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } + return false; } - return false; } - } - - } else { - LOG(fatal) << "FemtoUniversePairCleaner: Combination of objects not defined - quitting!"; - return false; - } - } - /// Check if pair is close or not - template - void ClosePairqLCMS(Part const& part1, Part const& part2, float lmagfield, uint8_t ChosenEventType, double qlcms) // add typename Parts and variable parts for adding MClabels - { - magfield = lmagfield; - if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kTrack) { - auto deta = part1.eta() - part2.eta(); - auto dphiAvg = averagePhiStar(part1, part2, 0); - - if (ChosenEventType == femto_universe_container::EventType::same) { - histdetadpiqlcmssame->Fill(qlcms, deta, dphiAvg); - } else if (ChosenEventType == femto_universe_container::EventType::mixed) { - histdetadpiqlcmsmixed->Fill(qlcms, deta, dphiAvg); } else { - LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + LOG(fatal) << "FemtoUniversePairCleaner: Combination of objects not defined - quitting!"; + return false; } } - } - private: - HistogramRegistry* mHistogramRegistry = nullptr; ///< For main output - HistogramRegistry* mHistogramRegistryQA = nullptr; ///< For QA output - static constexpr std::string_view DirNames[6] = {"kTrack_kTrack/", "kTrack_kV0/", "kV0_kV0/", "kTrack_kPhi/", "kTrack_kD0/", "kCascade_kCascade/"}; - - static constexpr std::string_view HistNamesSame[2][8] = {{"detadphidetadphi0BeforeSame_0", "detadphidetadphi0BeforeSame_1", "detadphidetadphi0BeforeSame_2", - "detadphidetadphi0BeforeSame_3", "detadphidetadphi0BeforeSame_4", "detadphidetadphi0BeforeSame_5", - "detadphidetadphi0BeforeSame_6", "detadphidetadphi0BeforeSameqLCMS"}, - {"detadphidetadphi0AfterSame_0", "detadphidetadphi0AfterSame_1", "detadphidetadphi0AfterSame_2", - "detadphidetadphi0AfterSame_3", "detadphidetadphi0AfterSame_4", "detadphidetadphi0AfterSame_5", - "detadphidetadphi0AfterSame_6", "detadphidetadphi0AfterSameqLCMS"}}; - static constexpr std::string_view HistNamesMixed[2][8] = {{"detadphidetadphi0BeforeMixed_0", "detadphidetadphi0BeforeMixed_1", "detadphidetadphi0BeforeMixed_2", - "detadphidetadphi0BeforeMixed_3", "detadphidetadphi0BeforeMixed_4", "detadphidetadphi0BeforeMixed_5", - "detadphidetadphi0BeforeMixed_6", "detadphidetadphi0BeforeMixedqLCMS"}, - {"detadphidetadphi0AfterMixed_0", "detadphidetadphi0AfterMixed_1", "detadphidetadphi0AfterMixed_2", - "detadphidetadphi0AfterMixed_3", "detadphidetadphi0AfterMixed_4", "detadphidetadphi0AfterMixed_5", - "detadphidetadphi0AfterMixed_6", "detadphidetadphi0AfterMixedqLCMS"}}; - - static constexpr std::string_view HistNamesRadii[7][9] = {{"detadphidetadphi0Before_0_0", "detadphidetadphi0Before_0_1", "detadphidetadphi0Before_0_2", - "detadphidetadphi0Before_0_3", "detadphidetadphi0Before_0_4", "detadphidetadphi0Before_0_5", - "detadphidetadphi0Before_0_6", "detadphidetadphi0Before_0_7", "detadphidetadphi0Before_0_8"}, - {"detadphidetadphi0Before_1_0", "detadphidetadphi0Before_1_1", "detadphidetadphi0Before_1_2", - "detadphidetadphi0Before_1_3", "detadphidetadphi0Before_1_4", "detadphidetadphi0Before_1_5", - "detadphidetadphi0Before_1_6", "detadphidetadphi0Before_1_7", "detadphidetadphi0Before_1_8"}, - {"detadphidetadphi0Before_2_0", "detadphidetadphi0Before_2_1", "detadphidetadphi0Before_2_2", - "detadphidetadphi0Before_2_3", "detadphidetadphi0Before_2_4", "detadphidetadphi0Before_2_5", - "detadphidetadphi0Before_2_6", "detadphidetadphi0Before_2_7", "detadphidetadphi0Before_2_8"}, - {"detadphidetadphi0Before_3_0", "detadphidetadphi0Before_3_1", "detadphidetadphi0Before_3_2", - "detadphidetadphi0Before_3_3", "detadphidetadphi0Before_3_4", "detadphidetadphi0Before_3_5", - "detadphidetadphi0Before_3_6", "detadphidetadphi0Before_3_7", "detadphidetadphi0Before_3_8"}, - {"detadphidetadphi0Before_4_0", "detadphidetadphi0Before_4_1", "detadphidetadphi0Before_4_2", - "detadphidetadphi0Before_4_3", "detadphidetadphi0Before_4_4", "detadphidetadphi0Before_4_5", - "detadphidetadphi0Before_4_6", "detadphidetadphi0Before_4_7", "detadphidetadphi0Before_4_8"}, - {"detadphidetadphi0Before_5_0", "detadphidetadphi0Before_5_1", "detadphidetadphi0Before_5_2", - "detadphidetadphi0Before_5_3", "detadphidetadphi0Before_5_4", "detadphidetadphi0Before_5_5", - "detadphidetadphi0Before_5_6", "detadphidetadphi0Before_5_7", "detadphidetadphi0Before_5_8"}, - {"detadphidetadphi0Before_6_0", "detadphidetadphi0Before_6_1", "detadphidetadphi0Before_6_2", - "detadphidetadphi0Before_6_3", "detadphidetadphi0Before_6_4", "detadphidetadphi0Before_6_5", - "detadphidetadphi0Before_6_6", "detadphidetadphi0Before_6_7", "detadphidetadphi0Before_6_8"}}; - - static constexpr o2::aod::femtouniverseparticle::ParticleType kPartOneType = partOne; ///< Type of particle 1 - static constexpr o2::aod::femtouniverseparticle::ParticleType kPartTwoType = partTwo; ///< Type of particle 2 - - static constexpr float TmpRadiiTPC[9] = {85., 105., 125., 145., 165., 185., 205., 225., 245.}; - - static constexpr uint32_t kSignMinusMask = 1; - static constexpr uint32_t kSignPlusMask = 1 << 1; - static constexpr uint32_t kValue0 = 0; - - float chosenRadii; - float cutDeltaPhiStarMax; - float cutDeltaPhiStarMin; - float cutDeltaEtaMax; - float cutDeltaEtaMin; - float magfield; - bool plotForEveryRadii = false; - float cutPhiInvMassLow; - float cutPhiInvMassHigh; - bool isSameSignCPR = false; - - std::array, 2>, 7> histdetadpisame{}; - std::array, 2>, 7> histdetadpimixed{}; - std::array, 9>, 7> histdetadpiRadii{}; - - std::shared_ptr histdetadpiqlcmssame{}; - std::shared_ptr histdetadpiqlcmsmixed{}; - - /// Calculate phi at all required radii stored in TmpRadiiTPC - /// Magnetic field to be provided in Tesla - template - void phiAtRadiiTPC(const T& part, std::vector& tmpVec) - { + /// Check if pair is close or not + template + void ClosePairqLCMS(Part const& part1, Part const& part2, float lmagfield, uint8_t ChosenEventType, double qlcms) // add typename Parts and variable parts for adding MClabels + { + magfield = lmagfield; + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kTrack) { + auto deta = part1.eta() - part2.eta(); + auto dphiAvg = averagePhiStar(part1, part2, 0); - float phi0 = part.phi(); - // Start: Get the charge from cutcontainer using masks - float charge = 0.; - if ((part.cut() & kSignMinusMask) == kValue0 && (part.cut() & kSignPlusMask) == kValue0) { - charge = 0; - } else if ((part.cut() & kSignPlusMask) == kSignPlusMask) { - charge = 1; - } else if ((part.cut() & kSignMinusMask) == kSignMinusMask) { - charge = -1; - } else { - LOG(fatal) << "FemtoUniverseDetaDphiStar: Charge bits are set wrong!"; - } - // End: Get the charge from cutcontainer using masks - float pt = part.pt(); - for (size_t i = 0; i < 9; i++) { - double arg = 0.3 * charge * magfield * TmpRadiiTPC[i] * 0.01 / (2. * pt); - if (std::abs(arg) < 1.0) { - tmpVec.push_back(phi0 + std::asin(arg)); - } else { - tmpVec.push_back(999.0); + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpiqlcmssame->Fill(qlcms, deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpiqlcmsmixed->Fill(qlcms, deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } } } - } - /// Calculate average phi - template - float averagePhiStar(const T1& part1, const T2& part2, int iHist) - { - std::vector tmpVec1; - std::vector tmpVec2; - phiAtRadiiTPC(part1, tmpVec1); - phiAtRadiiTPC(part2, tmpVec2); - int num = tmpVec1.size(); - float dPhiAvg = 0; - float dphi = 0; - int entries = 0; - for (int i = 0; i < num; i++) { - if (tmpVec1.at(i) != 999 && tmpVec2.at(i) != 999) { - dphi = tmpVec1.at(i) - tmpVec2.at(i); - entries++; + private: + HistogramRegistry* mHistogramRegistry = nullptr; ///< For main output + HistogramRegistry* mHistogramRegistryQA = nullptr; ///< For QA output + static constexpr std::string_view DirNames[6] = {"kTrack_kTrack/", "kTrack_kV0/", "kV0_kV0/", "kTrack_kPhi/", "kTrack_kD0/", "kCascade_kCascade/"}; + + static constexpr std::string_view HistNamesSame[2][8] = {{"detadphidetadphi0BeforeSame_0", "detadphidetadphi0BeforeSame_1", "detadphidetadphi0BeforeSame_2", + "detadphidetadphi0BeforeSame_3", "detadphidetadphi0BeforeSame_4", "detadphidetadphi0BeforeSame_5", + "detadphidetadphi0BeforeSame_6", "detadphidetadphi0BeforeSameqLCMS"}, + {"detadphidetadphi0AfterSame_0", "detadphidetadphi0AfterSame_1", "detadphidetadphi0AfterSame_2", + "detadphidetadphi0AfterSame_3", "detadphidetadphi0AfterSame_4", "detadphidetadphi0AfterSame_5", + "detadphidetadphi0AfterSame_6", "detadphidetadphi0AfterSameqLCMS"}}; + static constexpr std::string_view HistNamesMixed[2][8] = {{"detadphidetadphi0BeforeMixed_0", "detadphidetadphi0BeforeMixed_1", "detadphidetadphi0BeforeMixed_2", + "detadphidetadphi0BeforeMixed_3", "detadphidetadphi0BeforeMixed_4", "detadphidetadphi0BeforeMixed_5", + "detadphidetadphi0BeforeMixed_6", "detadphidetadphi0BeforeMixedqLCMS"}, + {"detadphidetadphi0AfterMixed_0", "detadphidetadphi0AfterMixed_1", "detadphidetadphi0AfterMixed_2", + "detadphidetadphi0AfterMixed_3", "detadphidetadphi0AfterMixed_4", "detadphidetadphi0AfterMixed_5", + "detadphidetadphi0AfterMixed_6", "detadphidetadphi0AfterMixedqLCMS"}}; + + static constexpr std::string_view HistNamesRadii[7][9] = {{"detadphidetadphi0Before_0_0", "detadphidetadphi0Before_0_1", "detadphidetadphi0Before_0_2", + "detadphidetadphi0Before_0_3", "detadphidetadphi0Before_0_4", "detadphidetadphi0Before_0_5", + "detadphidetadphi0Before_0_6", "detadphidetadphi0Before_0_7", "detadphidetadphi0Before_0_8"}, + {"detadphidetadphi0Before_1_0", "detadphidetadphi0Before_1_1", "detadphidetadphi0Before_1_2", + "detadphidetadphi0Before_1_3", "detadphidetadphi0Before_1_4", "detadphidetadphi0Before_1_5", + "detadphidetadphi0Before_1_6", "detadphidetadphi0Before_1_7", "detadphidetadphi0Before_1_8"}, + {"detadphidetadphi0Before_2_0", "detadphidetadphi0Before_2_1", "detadphidetadphi0Before_2_2", + "detadphidetadphi0Before_2_3", "detadphidetadphi0Before_2_4", "detadphidetadphi0Before_2_5", + "detadphidetadphi0Before_2_6", "detadphidetadphi0Before_2_7", "detadphidetadphi0Before_2_8"}, + {"detadphidetadphi0Before_3_0", "detadphidetadphi0Before_3_1", "detadphidetadphi0Before_3_2", + "detadphidetadphi0Before_3_3", "detadphidetadphi0Before_3_4", "detadphidetadphi0Before_3_5", + "detadphidetadphi0Before_3_6", "detadphidetadphi0Before_3_7", "detadphidetadphi0Before_3_8"}, + {"detadphidetadphi0Before_4_0", "detadphidetadphi0Before_4_1", "detadphidetadphi0Before_4_2", + "detadphidetadphi0Before_4_3", "detadphidetadphi0Before_4_4", "detadphidetadphi0Before_4_5", + "detadphidetadphi0Before_4_6", "detadphidetadphi0Before_4_7", "detadphidetadphi0Before_4_8"}, + {"detadphidetadphi0Before_5_0", "detadphidetadphi0Before_5_1", "detadphidetadphi0Before_5_2", + "detadphidetadphi0Before_5_3", "detadphidetadphi0Before_5_4", "detadphidetadphi0Before_5_5", + "detadphidetadphi0Before_5_6", "detadphidetadphi0Before_5_7", "detadphidetadphi0Before_5_8"}, + {"detadphidetadphi0Before_6_0", "detadphidetadphi0Before_6_1", "detadphidetadphi0Before_6_2", + "detadphidetadphi0Before_6_3", "detadphidetadphi0Before_6_4", "detadphidetadphi0Before_6_5", + "detadphidetadphi0Before_6_6", "detadphidetadphi0Before_6_7", "detadphidetadphi0Before_6_8"}}; + + static constexpr o2::aod::femtouniverseparticle::ParticleType kPartOneType = partOne; ///< Type of particle 1 + static constexpr o2::aod::femtouniverseparticle::ParticleType kPartTwoType = partTwo; ///< Type of particle 2 + + static constexpr float TmpRadiiTPC[9] = {85., 105., 125., 145., 165., 185., 205., 225., 245.}; + + static constexpr uint32_t kSignMinusMask = 1; + static constexpr uint32_t kSignPlusMask = 1 << 1; + static constexpr uint32_t kValue0 = 0; + + float chosenRadii; + float cutDeltaPhiStarMax; + float cutDeltaPhiStarMin; + float cutDeltaEtaMax; + float cutDeltaEtaMin; + float magfield; + bool plotForEveryRadii = false; + float cutPhiInvMassLow; + float cutPhiInvMassHigh; + bool isSameSignCPR = false; + + std::array, 2>, 7> histdetadpisame{}; + std::array, 2>, 7> histdetadpimixed{}; + std::array, 9>, 7> histdetadpiRadii{}; + + std::shared_ptr histdetadpiqlcmssame{}; + std::shared_ptr histdetadpiqlcmsmixed{}; + + /// Calculate phi at all required radii stored in TmpRadiiTPC + /// Magnetic field to be provided in Tesla + template + void phiAtRadiiTPC(const T& part, std::vector& tmpVec) + { + + float phi0 = part.phi(); + // Start: Get the charge from cutcontainer using masks + float charge = 0.; + if ((part.cut() & kSignMinusMask) == kValue0 && (part.cut() & kSignPlusMask) == kValue0) { + charge = 0; + } else if ((part.cut() & kSignPlusMask) == kSignPlusMask) { + charge = 1; + } else if ((part.cut() & kSignMinusMask) == kSignMinusMask) { + charge = -1; } else { - dphi = 0; + LOG(fatal) << "FemtoUniverseDetaDphiStar: Charge bits are set wrong!"; } - dphi = TVector2::Phi_mpi_pi(dphi); - dPhiAvg += dphi; - if (plotForEveryRadii) { - histdetadpiRadii[iHist][i]->Fill(part1.eta() - part2.eta(), dphi); + // End: Get the charge from cutcontainer using masks + float pt = part.pt(); + for (size_t i = 0; i < 9; i++) { + double arg = 0.3 * charge * magfield * TmpRadiiTPC[i] * 0.01 / (2. * pt); + if (std::abs(arg) < 1.0) { + tmpVec.push_back(phi0 + std::asin(arg)); + } else { + tmpVec.push_back(999.0); + } } } - return dPhiAvg / static_cast(entries); - } - /// Calculate average phi - template - float averagePhiStarFrac(const T1& part1, const T2& part2, float maxdist) - { - std::vector tmpVec1; - std::vector tmpVec2; - phiAtRadiiTPC(part1, tmpVec1); - phiAtRadiiTPC(part2, tmpVec2); - int num = tmpVec1.size(); - float dphi = 0; - int entries = 0; - double distance = 0; - int badpoints = 0; - - for (int i = 0; i < num; i++) { - if (tmpVec1.at(i) != 999 && tmpVec2.at(i) != 999) { - dphi = tmpVec1.at(i) - tmpVec2.at(i); - entries++; - } else { - dphi = 0; - } - dphi = TVector2::Phi_mpi_pi(dphi); - distance = 2 * TMath::Sin(TMath::Abs(dphi) * 0.5) * TmpRadiiTPC[i]; - if (distance < maxdist) { - badpoints++; + /// Calculate average phi + template + float averagePhiStar(const T1& part1, const T2& part2, int iHist) + { + std::vector tmpVec1; + std::vector tmpVec2; + phiAtRadiiTPC(part1, tmpVec1); + phiAtRadiiTPC(part2, tmpVec2); + int num = tmpVec1.size(); + float dPhiAvg = 0; + float dphi = 0; + int entries = 0; + for (int i = 0; i < num; i++) { + if (tmpVec1.at(i) != 999 && tmpVec2.at(i) != 999) { + dphi = tmpVec1.at(i) - tmpVec2.at(i); + entries++; + } else { + dphi = 0; + } + dphi = TVector2::Phi_mpi_pi(dphi); + dPhiAvg += dphi; + if (plotForEveryRadii) { + histdetadpiRadii[iHist][i]->Fill(part1.eta() - part2.eta(), dphi); + } } + return dPhiAvg / static_cast(entries); } - return badpoints / entries; - } - // Get particle charge from mask - template - float getCharge(const T1& part) - { - float charge = 0; - if ((part.cut() & kSignMinusMask) == kValue0 && (part.cut() & kSignPlusMask) == kValue0) { - charge = 0; - } else if ((part.cut() & kSignPlusMask) == kSignPlusMask) { - charge = 1; - } else if ((part.cut() & kSignMinusMask) == kSignMinusMask) { - charge = -1; - } else { - LOG(fatal) << "FemtoUniverseDetaDphiStar: Charge bits are set wrong!"; + /// Calculate average phi + template + float averagePhiStarFrac(const T1& part1, const T2& part2, float maxdist) + { + std::vector tmpVec1; + std::vector tmpVec2; + phiAtRadiiTPC(part1, tmpVec1); + phiAtRadiiTPC(part2, tmpVec2); + int num = tmpVec1.size(); + float dphi = 0; + int entries = 0; + double distance = 0; + int badpoints = 0; + + for (int i = 0; i < num; i++) { + if (tmpVec1.at(i) != 999 && tmpVec2.at(i) != 999) { + dphi = tmpVec1.at(i) - tmpVec2.at(i); + entries++; + } else { + dphi = 0; + } + dphi = TVector2::Phi_mpi_pi(dphi); + distance = 2 * TMath::Sin(TMath::Abs(dphi) * 0.5) * TmpRadiiTPC[i]; + if (distance < maxdist) { + badpoints++; + } + } + return badpoints / entries; } - return charge; - } - - // Calculate phi* as in https://github.com/alisw/AliPhysics/blob/master/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoPairCutRadialDistance.cxx - template - double calculateDphiStar(const T1& part1, const T2& part2) - { - float charge1 = getCharge(part1); - float charge2 = getCharge(part2); - double deltaphiconstFD = 0.3 / 2; - // double deltaphiconstAF = 0.15; - double afsi0b = deltaphiconstFD * magfield * charge1 * chosenRadii / part1.pt(); - double afsi1b = deltaphiconstFD * magfield * charge2 * chosenRadii / part2.pt(); - double dphis = 0.0; + // Get particle charge from mask + template + float getCharge(const T1& part) + { + float charge = 0; + if ((part.cut() & kSignMinusMask) == kValue0 && (part.cut() & kSignPlusMask) == kValue0) { + charge = 0; + } else if ((part.cut() & kSignPlusMask) == kSignPlusMask) { + charge = 1; + } else if ((part.cut() & kSignMinusMask) == kSignMinusMask) { + charge = -1; + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: Charge bits are set wrong!"; + } + return charge; + } - if (std::abs(afsi0b) < 1.0 && std::abs(afsi0b) < 1.0) { - dphis = part2.phi() - part1.phi() + std::asin(afsi1b) - std::asin(afsi0b); + // Calculate phi* as in https://github.com/alisw/AliPhysics/blob/master/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoPairCutRadialDistance.cxx + template + double calculateDphiStar(const T1& part1, const T2& part2) + { + float charge1 = getCharge(part1); + float charge2 = getCharge(part2); + + double deltaphiconstFD = 0.3 / 2; + // double deltaphiconstAF = 0.15; + double afsi0b = deltaphiconstFD * magfield * charge1 * chosenRadii / part1.pt(); + double afsi1b = deltaphiconstFD * magfield * charge2 * chosenRadii / part2.pt(); + double dphis = 0.0; + + if (std::abs(afsi0b) < 1.0 && std::abs(afsi0b) < 1.0) { + dphis = part2.phi() - part1.phi() + std::asin(afsi1b) - std::asin(afsi0b); + } + return dphis; } - return dphis; - } -}; + }; } /* namespace femto_universe */ } /* namespace o2::analysis */