|
| 1 | +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. |
| 2 | +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. |
| 3 | +// All rights not expressly granted are reserved. |
| 4 | +// |
| 5 | +// This software is distributed under the terms of the GNU General Public |
| 6 | +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". |
| 7 | +// |
| 8 | +// In applying this license CERN does not waive the privileges and immunities |
| 9 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 10 | +// or submit itself to any jurisdiction. |
| 11 | + |
| 12 | +/// \file FemtoWorldPionContainer.h |
| 13 | +/// \brief Definition of the FemtoWorldPionContainer |
| 14 | +/// \author Andi Mathis, TU München, andreas.mathis@ph.tum.de |
| 15 | +/// \author Valentina Mantovani Sarti, valentina.mantovani-sarti@tum.de |
| 16 | +/// \author Zuzanna Chochulska, WUT Warsaw, zchochul@cern.ch NOWE |
| 17 | + |
| 18 | +#ifndef PWGCF_FEMTOWORLD_CORE_FEMTOWORLDPIONCONTAINER_H_ |
| 19 | +#define PWGCF_FEMTOWORLD_CORE_FEMTOWORLDPIONCONTAINER_H_ |
| 20 | + |
| 21 | +#include <vector> |
| 22 | +#include <string> |
| 23 | +#include "Framework/HistogramRegistry.h" |
| 24 | +#include "PWGCF/FemtoWorld/Core/FemtoWorldMath.h" |
| 25 | + |
| 26 | +#include "Math/Vector4D.h" |
| 27 | +#include "TMath.h" |
| 28 | +#include "TDatabasePDG.h" |
| 29 | + |
| 30 | +#include "TLorentzVector.h" |
| 31 | +#include "CommonConstants/MathConstants.h" |
| 32 | +#include "TRandom.h" |
| 33 | + |
| 34 | +using namespace o2::framework; |
| 35 | +using namespace o2::constants::math; |
| 36 | + |
| 37 | +namespace o2::analysis::femtoWorld |
| 38 | +{ |
| 39 | + |
| 40 | +namespace femtoWorldPionContainer |
| 41 | +{ |
| 42 | +/// Femtoscopic observable to be computed |
| 43 | +enum Observable { kstar ///< kstar |
| 44 | +}; |
| 45 | + |
| 46 | +/// Type of the event processind |
| 47 | +enum EventType { samePM, ///< Pair with the opposite charge from same event |
| 48 | + mixedPM, ///< Pair with the opposite charge from mixed event |
| 49 | + samePP, ///< Pair with the same, positive charge from same event |
| 50 | + mixedPP, ///< Pair with the same, positive charge from mixed event |
| 51 | + sameMM, ///< Pair with the same, negative charge from same event |
| 52 | + mixedMM, ///< Pair with the same, negative charge from mixed event |
| 53 | +}; |
| 54 | +}; // namespace femtoWorldPionContainer |
| 55 | + |
| 56 | +/// \class FemtoWorldPionContainer |
| 57 | +/// \brief Container for all histogramming related to the correlation function. The two |
| 58 | +/// particles of the pair are passed here, and the correlation function and QA histograms |
| 59 | +/// are filled according to the specified observable |
| 60 | +/// \tparam eventType Type of the event (same/mixed) |
| 61 | +/// \tparam obs Observable to be computed (k*/Q_inv/...) |
| 62 | +template <femtoWorldPionContainer::EventType eventType, femtoWorldPionContainer::Observable obs> |
| 63 | +class FemtoWorldPionContainer |
| 64 | +{ |
| 65 | + public: |
| 66 | + /// Destructor |
| 67 | + virtual ~FemtoWorldPionContainer() = default; |
| 68 | + |
| 69 | + /// Initializes histograms for the task |
| 70 | + /// \tparam T Type of the configurable for the axis configuration |
| 71 | + /// \param registry Histogram registry to be passed |
| 72 | + /// \param kstarBins k* binning for the histograms |
| 73 | + /// \param multBins multiplicity binning for the histograms |
| 74 | + /// \param kTBins kT binning for the histograms |
| 75 | + /// \param mTBins mT binning for the histograms |
| 76 | + /// \param etaBins eta binning for the histograms |
| 77 | + /// \param phiBins phi binning for the histograms |
| 78 | + /// \param mInvBins invariant mass binning for the histograms |
| 79 | + |
| 80 | + template <typename T1, typename T2> |
| 81 | + void init(HistogramRegistry* registry, T1& kstarBins, T1& multBins, T1& kTBins, T1& mTBins, T2& phiBins, T2& etaBins, T2& mInvBins) |
| 82 | + { |
| 83 | + mHistogramRegistry = registry; |
| 84 | + std::string femtoObs; |
| 85 | + if constexpr (mFemtoObs == femtoWorldPionContainer::Observable::kstar) { |
| 86 | + femtoObs = "#it{k*} (GeV/#it{c})"; |
| 87 | + } |
| 88 | + std::vector<double> tmpVecMult = multBins; |
| 89 | + framework::AxisSpec multAxis = {tmpVecMult, "Multiplicity"}; |
| 90 | + framework::AxisSpec femtoObsAxis = {kstarBins, femtoObs.c_str()}; |
| 91 | + framework::AxisSpec kTAxis = {kTBins, "#it{k}_{T} (GeV/#it{c})"}; |
| 92 | + framework::AxisSpec mTAxis = {mTBins, "#it{m}_{T} (GeV/#it{c}^{2})"}; |
| 93 | + |
| 94 | + mPhiLow = (-static_cast<int>(phiBins / 4) + 0.5) * 2. * PI / phiBins; |
| 95 | + mPhiHigh = 2 * PI + (-static_cast<int>(phiBins / 4) + 0.5) * 2. * PI / phiBins; |
| 96 | + |
| 97 | + framework::AxisSpec phiAxis = {phiBins, mPhiLow, mPhiHigh}; |
| 98 | + framework::AxisSpec etaAxis = {etaBins, -2.0, 2.0}; |
| 99 | + framework::AxisSpec mInvAxis = {mInvBins, 0.0, 10.0}; |
| 100 | + |
| 101 | + std::string folderName = static_cast<std::string>(mFolderSuffix[mEventType]); |
| 102 | + mHistogramRegistry->add((folderName + "relPairDist").c_str(), ("; " + femtoObs + "; Entries").c_str(), kTH1F, {femtoObsAxis}); |
| 103 | + mHistogramRegistry->add((folderName + "relPairkT").c_str(), "; #it{k}_{T} (GeV/#it{c}); Entries", kTH1F, {kTAxis}); |
| 104 | + mHistogramRegistry->add((folderName + "relPairkstarkT").c_str(), ("; " + femtoObs + "; #it{k}_{T} (GeV/#it{c})").c_str(), kTH2F, {femtoObsAxis, kTAxis}); |
| 105 | + mHistogramRegistry->add((folderName + "relPairkstarmT").c_str(), ("; " + femtoObs + "; #it{m}_{T} (GeV/#it{c}^{2})").c_str(), kTH2F, {femtoObsAxis, mTAxis}); |
| 106 | + mHistogramRegistry->add((folderName + "relPairkstarMult").c_str(), ("; " + femtoObs + "; Multiplicity").c_str(), kTH2F, {femtoObsAxis, multAxis}); |
| 107 | + mHistogramRegistry->add((folderName + "kstarPtPart1").c_str(), ("; " + femtoObs + "; #it{p} _{T} Particle 1 (GeV/#it{c})").c_str(), kTH2F, {femtoObsAxis, {375, 0., 7.5}}); |
| 108 | + mHistogramRegistry->add((folderName + "kstarPtPart2").c_str(), ("; " + femtoObs + "; #it{p} _{T} Particle 2 (GeV/#it{c})").c_str(), kTH2F, {femtoObsAxis, {375, 0., 7.5}}); |
| 109 | + mHistogramRegistry->add((folderName + "MultPtPart1").c_str(), "; #it{p} _{T} Particle 1 (GeV/#it{c}); Multiplicity", kTH2F, {{375, 0., 7.5}, multAxis}); |
| 110 | + mHistogramRegistry->add((folderName + "MultPtPart2").c_str(), "; #it{p} _{T} Particle 2 (GeV/#it{c}); Multiplicity", kTH2F, {{375, 0., 7.5}, multAxis}); |
| 111 | + mHistogramRegistry->add((folderName + "PtPart1PtPart2").c_str(), "; #it{p} _{T} Particle 1 (GeV/#it{c}); #it{p} _{T} Particle 2 (GeV/#it{c})", kTH2F, {{375, 0., 7.5}, {375, 0., 7.5}}); |
| 112 | + mHistogramRegistry->add((folderName + "relPairDetaDphi").c_str(), "; #Delta#varphi (rad); #Delta#eta", kTH2D, {phiAxis, etaAxis}); |
| 113 | + mHistogramRegistry->add((folderName + "relPairInvariantMass").c_str(), ";M_{K^{+}K^{-}} (GeV/#it{c}^{2});", kTH1D, {mInvAxis}); |
| 114 | + } |
| 115 | + |
| 116 | + /// Set the PDG codes of the two particles involved |
| 117 | + /// \param pdg1 PDG code of particle one |
| 118 | + /// \param pdg2 PDG code of particle two |
| 119 | + void setPDGCodes(const int pdg1, const int pdg2) |
| 120 | + { |
| 121 | + mMassOne = TDatabasePDG::Instance()->GetParticle(pdg1)->Mass(); |
| 122 | + mMassTwo = TDatabasePDG::Instance()->GetParticle(pdg2)->Mass(); |
| 123 | + } |
| 124 | + |
| 125 | + /// Pass a pair to the container and compute all the relevant observables |
| 126 | + /// \tparam T type of the femtoworldparticle |
| 127 | + /// \param part1 Particle one |
| 128 | + /// \param part2 Particle two |
| 129 | + /// \param mult Multiplicity of the event |
| 130 | + template <typename T> |
| 131 | + void setPair(T const& part1, T const& part2, const int mult) |
| 132 | + { |
| 133 | + float femtoObs; |
| 134 | + if constexpr (mFemtoObs == femtoWorldPionContainer::Observable::kstar) { |
| 135 | + femtoObs = FemtoWorldMath::getkstar(part1, mMassOne, part2, mMassTwo); |
| 136 | + } |
| 137 | + const float kT = FemtoWorldMath::getkT(part1, mMassOne, part2, mMassTwo); |
| 138 | + const float mT = FemtoWorldMath::getmT(part1, mMassOne, part2, mMassTwo); |
| 139 | + |
| 140 | + double delta_eta = part1.eta() - part2.eta(); |
| 141 | + double delta_phi = part1.phi() - part2.phi(); |
| 142 | + |
| 143 | + while (delta_phi < mPhiLow) { |
| 144 | + delta_phi += TwoPI; |
| 145 | + } |
| 146 | + while (delta_phi > mPhiHigh) { |
| 147 | + delta_phi -= TwoPI; |
| 148 | + } |
| 149 | + TLorentzVector part1Vec; |
| 150 | + part1Vec.SetPtEtaPhiM(part1.pt(), part1.eta(), part1.phi(), mMassOne); |
| 151 | + TLorentzVector part2Vec; |
| 152 | + part2Vec.SetPtEtaPhiM(part2.pt(), part2.eta(), part2.phi(), mMassTwo); |
| 153 | + |
| 154 | + TLorentzVector sumVec(part1Vec); |
| 155 | + sumVec += part2Vec; |
| 156 | + |
| 157 | + if (mHistogramRegistry) { |
| 158 | + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST("relPairDist"), femtoObs); |
| 159 | + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST("relPairkT"), kT); |
| 160 | + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST("relPairkstarkT"), femtoObs, kT); |
| 161 | + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST("relPairkstarmT"), femtoObs, mT); |
| 162 | + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST("relPairkstarMult"), femtoObs, mult); |
| 163 | + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST("kstarPtPart1"), femtoObs, part1.pt()); |
| 164 | + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST("kstarPtPart2"), femtoObs, part2.pt()); |
| 165 | + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST("MultPtPart1"), part1.pt(), mult); |
| 166 | + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST("MultPtPart2"), part2.pt(), mult); |
| 167 | + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST("PtPart1PtPart2"), part1.pt(), part2.pt()); |
| 168 | + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST("relPairDetaDphi"), delta_phi, delta_eta); |
| 169 | + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST("relPairInvariantMass"), sumVec.M()); |
| 170 | + } |
| 171 | + } |
| 172 | + |
| 173 | + protected: |
| 174 | + HistogramRegistry* mHistogramRegistry = nullptr; ///< For QA output |
| 175 | + static constexpr std::string_view mFolderSuffix[6] = {"SameEventPlusMinus/", "MixedEventPlusMinus/", "SameEventPlusPlus/", "MixedEventPlusPlus/", "SameEventMinusMinus/", "MixedEventMinusMinus/"}; ///< Folder naming for the output according to mEventType |
| 176 | + static constexpr femtoWorldPionContainer::Observable mFemtoObs = obs; ///< Femtoscopic observable to be computed (according to femtoWorldPionContainer::Observable) |
| 177 | + static constexpr int mEventType = eventType; ///< Type of the event (same/mixed, according to femtoWorldPionContainer::EventType) |
| 178 | + float mMassOne = 0.f; ///< PDG mass of particle 1 |
| 179 | + float mMassTwo = 0.f; ///< PDG mass of particle 2 |
| 180 | + double mPhiLow; |
| 181 | + double mPhiHigh; |
| 182 | +}; |
| 183 | + |
| 184 | +} // namespace o2::analysis::femtoWorld |
| 185 | + |
| 186 | +#endif // PWGCF_FEMTOWORLD_CORE_FEMTOWORLDPIONCONTAINER_H_ |
0 commit comments