-
Notifications
You must be signed in to change notification settings - Fork 667
Expand file tree
/
Copy pathEMCPhotonCut.h
More file actions
154 lines (131 loc) · 5.36 KB
/
Copy pathEMCPhotonCut.h
File metadata and controls
154 lines (131 loc) · 5.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \file EMCPhotonCut.h
/// \brief Header of class for emcal photon selection.
/// \author M. Hemmer, marvin.hemmer@cern.ch; N. Strangmann, nicolas.strangmann@cern.ch
#ifndef PWGEM_PHOTONMESON_CORE_EMCPHOTONCUT_H_
#define PWGEM_PHOTONMESON_CORE_EMCPHOTONCUT_H_
#include <TNamed.h>
#include <Rtypes.h>
#include <cmath>
#include <functional>
#include <string>
class EMCPhotonCut : public TNamed
{
public:
EMCPhotonCut() = default;
EMCPhotonCut(const char* name, const char* title) : TNamed(name, title) {}
enum class EMCPhotonCuts : int {
// cluster cut
kDefinition = 0,
kEnergy,
kNCell,
kM02,
kTiming,
kTM,
kExotic,
kNCuts
};
static const char* mCutNames[static_cast<int>(EMCPhotonCuts::kNCuts)];
// Temporary function to check if cluster passes selection criteria. To be replaced by framework filters.
template <typename T, typename Cluster>
bool IsSelected(Cluster const& cluster) const
{
if (!IsSelectedEMCal(EMCPhotonCuts::kDefinition, cluster)) {
return false;
}
if (!IsSelectedEMCal(EMCPhotonCuts::kEnergy, cluster)) {
return false;
}
if (!IsSelectedEMCal(EMCPhotonCuts::kNCell, cluster)) {
return false;
}
if (!IsSelectedEMCal(EMCPhotonCuts::kM02, cluster)) {
return false;
}
if (!IsSelectedEMCal(EMCPhotonCuts::kTiming, cluster)) {
return false;
}
if (mUseTM && (!IsSelectedEMCal(EMCPhotonCuts::kTM, cluster))) {
return false;
}
if (!IsSelectedEMCal(EMCPhotonCuts::kExotic, cluster)) {
return false;
}
return true;
}
// Returns true if a cluster survives the cuts!
template <typename Cluster>
bool IsSelectedEMCal(const EMCPhotonCuts& cut, Cluster const& cluster) const
{
switch (cut) {
case EMCPhotonCuts::kDefinition:
return cluster.definition() == mDefinition;
case EMCPhotonCuts::kEnergy:
return cluster.e() > mMinE;
case EMCPhotonCuts::kNCell:
return cluster.nCells() >= mMinNCell;
case EMCPhotonCuts::kM02:
return (cluster.nCells() == 1 || (mMinM02 <= cluster.m02() && cluster.m02() <= mMaxM02));
case EMCPhotonCuts::kTiming:
return mMinTime <= cluster.time() && cluster.time() <= mMaxTime;
case EMCPhotonCuts::kTM: {
auto dEtas = cluster.deltaEta(); // std:vector<float>
auto dPhis = cluster.deltaPhi(); // std:vector<float>
auto trackspt = cluster.trackpt(); // std:vector<float>
auto tracksp = cluster.trackp(); // std:vector<float>
int ntrack = tracksp.size();
for (int itr = 0; itr < ntrack; itr++) {
float dEta = std::fabs(dEtas[itr]);
float dPhi = std::fabs(dPhis[itr]);
bool result = (dEta > mTrackMatchingEta(trackspt[itr])) || (dPhi > mTrackMatchingPhi(trackspt[itr])) || (cluster.e() / tracksp[itr] >= mMinEoverP);
if (!result) {
return false;
}
}
return true; // when we don't have any tracks the cluster should always survive the TM cut!
}
case EMCPhotonCuts::kExotic:
return mUseExoticCut ? !cluster.isExotic() : true;
default:
return false;
}
}
// Setters
void SetClusterizer(std::string clusterDefinitionString = "kV3Default");
void SetMinE(float min = 0.7f);
void SetMinNCell(int min = 1);
void SetM02Range(float min = 0.1f, float max = 0.7f);
void SetTimeRange(float min = -20.f, float max = 25.f);
void SetTrackMatchingEta(std::function<float(float)> funcTM);
void SetTrackMatchingPhi(std::function<float(float)> funcTM);
void SetMinEoverP(float min = 0.7f);
void SetUseExoticCut(bool flag = true);
void SetUseTM(bool flag = true);
/// @brief Print the cluster selection
void print() const;
private:
// EMCal cluster cuts
int mDefinition{10}; ///< clusterizer definition
float mMinE{0.7f}; ///< minimum energy
int mMinNCell{1}; ///< minimum number of cells per cluster
float mMinM02{0.1f}; ///< minimum M02 for a cluster
float mMaxM02{0.7f}; ///< maximum M02 for a cluster
float mMinTime{-20.f}; ///< minimum cluster timing
float mMaxTime{25.f}; ///< maximum cluster timing
float mMinEoverP{1.75f}; ///< minimum cluster energy over track momentum ratio needed for the pair to be considered matched
bool mUseExoticCut{true}; ///< flag to decide if the exotic cluster cut is to be checked or not
bool mUseTM{true}; ///< flag to decide if track matching cut is to be checek or not
std::function<float(float)> mTrackMatchingEta{}; ///< function to get check if a pre matched track and cluster pair is considered an actual match for eta
std::function<float(float)> mTrackMatchingPhi{}; ///< function to get check if a pre matched track and cluster pair is considered an actual match for phi
ClassDef(EMCPhotonCut, 1);
};
#endif // PWGEM_PHOTONMESON_CORE_EMCPHOTONCUT_H_