Skip to content

Commit 311e431

Browse files
authored
PWGEM/PhotonMeson: implement pair cut class (#2747)
1 parent c56eece commit 311e431

13 files changed

Lines changed: 748 additions & 402 deletions

PWGEM/PhotonMeson/Core/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ o2physics_add_library(PWGEMPhotonMesonCore
1313
SOURCES V0PhotonCut.cxx
1414
PHOSPhotonCut.cxx
1515
EMCPhotonCut.cxx
16+
PairCut.cxx
1617
CutsLibrary.cxx
1718
HistogramsLibrary.cxx
1819
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore)
@@ -21,6 +22,7 @@ o2physics_target_root_dictionary(PWGEMPhotonMesonCore
2122
HEADERS V0PhotonCut.h
2223
PHOSPhotonCut.h
2324
EMCPhotonCut.h
25+
PairCut.h
2426
CutsLibrary.h
2527
HistogramsLibrary.h
2628
LINKDEF PWGEMPhotonMesonCoreLinkDef.h)

PWGEM/PhotonMeson/Core/CutsLibrary.cxx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,3 +305,22 @@ EMCPhotonCut* o2::aod::emccuts::GetCut(const char* cutName)
305305
LOGF(info, Form("Did not find cut %s", cutName));
306306
return nullptr;
307307
}
308+
309+
PairCut* o2::aod::paircuts::GetCut(const char* cutName)
310+
{
311+
PairCut* cut = new PairCut(cutName, cutName);
312+
std::string nameStr = cutName;
313+
314+
if (!nameStr.compare("nocut")) {
315+
cut->SetAsymRange(-1e+10f, +1e+10f);
316+
return cut;
317+
}
318+
if (!nameStr.compare("asym08")) {
319+
cut->SetAsymRange(0, 0.8);
320+
return cut;
321+
}
322+
323+
delete cut;
324+
LOGF(info, Form("Did not find cut %s", cutName));
325+
return nullptr;
326+
}

PWGEM/PhotonMeson/Core/CutsLibrary.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h"
2020
#include "PWGEM/PhotonMeson/Core/PHOSPhotonCut.h"
2121
#include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h"
22+
#include "PWGEM/PhotonMeson/Core/PairCut.h"
2223

2324
namespace o2::aod
2425
{
@@ -37,5 +38,10 @@ namespace emccuts
3738
EMCPhotonCut* GetCut(const char* cutName);
3839
} // namespace emccuts
3940

41+
namespace paircuts
42+
{
43+
PairCut* GetCut(const char* cutName);
44+
} // namespace paircuts
45+
4046
} // namespace o2::aod
4147
#endif // PWGEM_PHOTONMESON_CORE_CUTSLIBRARY_H_

PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,13 @@ void o2::aod::emphotonhistograms::DefineHistograms(THashList* list, const char*
218218
for (int i = 50; i < npTgg10; i++)
219219
pTgg10[i] = 0.5 * (i - 50) + 5.0; // from 5 to 10 GeV/c, evety 0.5 GeV/c
220220

221-
if (TString(histClass) == "tagged_photon") {
221+
if (TString(histClass) == "tagging_pi0") {
222222
list->Add(new TH2F("hMggPt_Same", "m_{ee#gamma} vs. p_{T,ee};m_{ee#gamma} (GeV/c^{2});p_{T,ee} (GeV/c)", nmgg04 - 1, mgg04, npTgg10 - 1, pTgg10));
223223
list->Add(new TH2F("hMggPt_Mixed", "m_{ee#gamma} vs. p_{T,ee};m_{ee#gamma} (GeV/c^{2});p_{T,ee} (GeV/c)", nmgg04 - 1, mgg04, npTgg10 - 1, pTgg10));
224224
reinterpret_cast<TH2F*>(list->FindObject("hMggPt_Same"))->Sumw2();
225225
reinterpret_cast<TH2F*>(list->FindObject("hMggPt_Mixed"))->Sumw2();
226226
}
227-
if (TString(histClass) == "tagged_photon_mc") {
227+
if (TString(histClass) == "tagging_pi0_mc") {
228228
list->Add(new TH1F("hPt_v0photon_Pi0", "reconstructed v0 photon from pi0;p_{T,ee} (GeV/c);N_{ee}^{#pi^{0}}", npTgg10 - 1, pTgg10)); // denominator for conditional probability
229229
list->Add(new TH2F("hMggPt_Pi0", "reconstructed m_{ee#gamma} vs. p_{T,ee} from pi0;m_{ee#gamma} (GeV/c^{2});p_{T,ee} (GeV/c);N_{ee}^{tagged #pi^{0}}", nmgg04 - 1, mgg04, npTgg10 - 1, pTgg10)); // numerator for conditional probability
230230
reinterpret_cast<TH1F*>(list->FindObject("hPt_v0photon_Pi0"))->Sumw2();

PWGEM/PhotonMeson/Core/PWGEMPhotonMesonCoreLinkDef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
#pragma link C++ class V0PhotonCut + ;
2020
#pragma link C++ class PHOSPhotonCut + ;
2121
#pragma link C++ class EMCPhotonCut + ;
22+
#pragma link C++ class PairCut + ;
2223

2324
#endif // PWGEM_PHOTONMESON_CORE_PWGEMPHOTONMESONCORELINKDEF_H_

PWGEM/PhotonMeson/Core/PairCut.cxx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
//
13+
// Class for track selection
14+
//
15+
16+
#include "Framework/Logger.h"
17+
#include "PWGEM/PhotonMeson/Core/PairCut.h"
18+
19+
ClassImp(PairCut);
20+
21+
const char* PairCut::mCutNames[static_cast<int>(PairCut::PairCuts::kNCuts)] = {"Asym"};
22+
23+
void PairCut::SetAsymRange(float min, float max)
24+
{
25+
mMinAsym = min;
26+
mMaxAsym = max;
27+
LOG(info) << "Pair Cut, set energy asymmetry range: " << mMinAsym << " - " << mMaxAsym;
28+
}
29+
30+
void PairCut::print() const
31+
{
32+
LOG(info) << "Pair Cut:";
33+
for (int i = 0; i < static_cast<int>(PairCuts::kNCuts); i++) {
34+
switch (static_cast<PairCuts>(i)) {
35+
case PairCuts::kAsym:
36+
LOG(info) << mCutNames[i] << " in [" << mMinAsym << ", " << mMaxAsym << "]";
37+
break;
38+
default:
39+
LOG(fatal) << "Cut unknown!";
40+
}
41+
}
42+
}

PWGEM/PhotonMeson/Core/PairCut.h

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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+
//
13+
// Class for 2-photon pair selection
14+
//
15+
16+
#ifndef PWGEM_PHOTONMESON_CORE_PAIRCUT_H_
17+
#define PWGEM_PHOTONMESON_CORE_PAIRCUT_H_
18+
19+
#include <set>
20+
#include <vector>
21+
#include <utility>
22+
#include <string>
23+
#include "Framework/Logger.h"
24+
#include "Framework/DataTypes.h"
25+
#include "Rtypes.h"
26+
#include "TNamed.h"
27+
#include "TMath.h"
28+
29+
class PairCut : public TNamed
30+
{
31+
public:
32+
PairCut() = default;
33+
PairCut(const char* name, const char* title) : TNamed(name, title) {}
34+
35+
enum class PairCuts : int {
36+
// v0 cut
37+
kAsym = 0,
38+
kNCuts
39+
};
40+
41+
static const char* mCutNames[static_cast<int>(PairCuts::kNCuts)];
42+
43+
template <typename G1, typename G2>
44+
bool IsSelected(G1 const& g1, G2 const& g2) const
45+
{
46+
if (!IsSelectedPair(g1, g2, PairCuts::kAsym)) {
47+
return false;
48+
}
49+
50+
return true;
51+
}
52+
53+
// template <typename U1, typename U2, typename G1, typename G2>
54+
template <typename G1, typename G2>
55+
bool IsSelectedPair(G1 const& g1, G2 const& g2, const PairCuts& cut) const
56+
{
57+
switch (cut) {
58+
case PairCuts::kAsym: {
59+
float asym = abs(g1.e() - g2.e()) / (g1.e() + g2.e());
60+
// float asym = abs(g1.p() - g2.p()) / (g1.p() + g2.p());
61+
return mMinAsym < asym && asym < mMaxAsym;
62+
}
63+
default:
64+
return false;
65+
}
66+
}
67+
68+
// Setters
69+
void SetAsymRange(float min = -1e+10f, float max = 1e10f);
70+
71+
/// @brief Print the pair selection
72+
void print() const;
73+
74+
private:
75+
float mMinAsym{-1e+10}, mMaxAsym{1e+10};
76+
77+
ClassDef(PairCut, 1);
78+
};
79+
80+
#endif // PWGEM_PHOTONMESON_CORE_PAIRCUT_H_

PWGEM/PhotonMeson/DataModel/gammaTables.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ DECLARE_SOA_COLUMN(PCA, pca, float); //!
189189
DECLARE_SOA_DYNAMIC_COLUMN(Px, px, [](float pxpos, float pxneg) -> float { return pxpos + pxneg; });
190190
DECLARE_SOA_DYNAMIC_COLUMN(Py, py, [](float pypos, float pyneg) -> float { return pypos + pyneg; });
191191
DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, [](float pzpos, float pzneg) -> float { return pzpos + pzneg; });
192+
DECLARE_SOA_DYNAMIC_COLUMN(E, e, [](float pxpos, float pxneg, float pypos, float pyneg, float pzpos, float pzneg, float m = 0) -> float { return RecoDecay::sqrtSumOfSquares(pxpos + pxneg, pypos + pyneg, pzpos + pzneg, m); }); //! energy of v0 photn, mass to be given as argument when getter is called!
192193
DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float pxpos, float pypos, float pxneg, float pyneg) -> float { return RecoDecay::sqrtSumOfSquares(pxpos + pxneg, pypos + pyneg); });
193194
DECLARE_SOA_DYNAMIC_COLUMN(Eta, eta, [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { return RecoDecay::eta(array{pxpos + pxneg, pypos + pyneg, pzpos + pzneg}); });
194195
DECLARE_SOA_DYNAMIC_COLUMN(Phi, phi, [](float pxpos, float pypos, float pxneg, float pyneg) -> float { return RecoDecay::phi(pxpos + pxneg, pypos + pyneg); });
@@ -209,6 +210,7 @@ DECLARE_SOA_TABLE(V0Photons, "AOD", "V0PHOTON", //!
209210
v0photon::Px<v0photon::PxPosAtSV, v0photon::PxNegAtSV>,
210211
v0photon::Py<v0photon::PyPosAtSV, v0photon::PyNegAtSV>,
211212
v0photon::Pz<v0photon::PzPosAtSV, v0photon::PzNegAtSV>,
213+
v0photon::E<v0photon::PxPosAtSV, v0photon::PxNegAtSV, v0photon::PyPosAtSV, v0photon::PyNegAtSV, v0photon::PzPosAtSV, v0photon::PzNegAtSV>,
212214
v0photon::Pt<v0photon::PxPosAtSV, v0photon::PyPosAtSV, v0photon::PxNegAtSV, v0photon::PyNegAtSV>,
213215
v0photon::Eta<v0photon::PxPosAtSV, v0photon::PyPosAtSV, v0photon::PzPosAtSV, v0photon::PxNegAtSV, v0photon::PyNegAtSV, v0photon::PzNegAtSV>,
214216
v0photon::Phi<v0photon::PxPosAtSV, v0photon::PyPosAtSV, v0photon::PxNegAtSV, v0photon::PyNegAtSV>,

0 commit comments

Comments
 (0)