Skip to content

Commit a378200

Browse files
fmazzascFrancesco Mazzaschi
andauthored
[Common] ITS PID: Use truncated mean to suppress dedx tails (AliceO2Group#9334)
Co-authored-by: Francesco Mazzaschi <[email protected]>
1 parent ba6a927 commit a378200

File tree

2 files changed

+37
-20
lines changed

2 files changed

+37
-20
lines changed

Common/DataModel/PIDResponseITS.h

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,24 @@ namespace o2::aod
3434
struct ITSResponse {
3535
static float averageClusterSize(uint32_t itsClusterSizes)
3636
{
37-
float average = 0;
37+
float sum = 0;
3838
int nclusters = 0;
39-
39+
int max = 0;
4040
for (int layer = 0; layer < 7; layer++) {
41-
if ((itsClusterSizes >> (layer * 4)) & 0xf) {
41+
int clsize = (itsClusterSizes >> (layer * 4)) & 0xf;
42+
if (clsize > 0) {
4243
nclusters++;
43-
average += (itsClusterSizes >> (layer * 4)) & 0xf;
44+
sum += clsize;
45+
if (clsize > max) {
46+
max = clsize;
47+
}
4448
}
4549
}
4650
if (nclusters == 0) {
4751
return 0;
4852
}
49-
return average / nclusters;
53+
// truncated mean
54+
return (sum - max) / (nclusters - 1);
5055
};
5156

5257
template <o2::track::PID::ID id>
@@ -67,8 +72,10 @@ struct ITSResponse {
6772
static constexpr float inverseMass = 1. / o2::track::pid_constants::sMasses[id];
6873
// static constexpr float charge = static_cast<float>(o2::track::pid_constants::sCharges[id]);
6974
const float bg = momentum * inverseMass;
70-
float relRes = mResolutionParams[0] * std::erf((bg - mResolutionParams[1]) / mResolutionParams[2]);
71-
return relRes;
75+
if (id == o2::track::PID::Helium3 || id == o2::track::PID::Alpha) {
76+
return mResolutionParamsZ2[0] * std::erf((bg - mResolutionParamsZ2[1]) / mResolutionParamsZ2[2]);
77+
}
78+
return mResolutionParams[0] * std::erf((bg - mResolutionParams[1]) / mResolutionParams[2]);
7279
}
7380

7481
template <o2::track::PID::ID id>
@@ -87,7 +94,10 @@ struct ITSResponse {
8794
return nSigmaITS<id>(track.itsClusterSizes(), track.p(), track.eta());
8895
}
8996

90-
static void setParameters(float p0, float p1, float p2, float p0_Z2, float p1_Z2, float p2_Z2, float p0_res, float p1_res, float p2_res)
97+
static void setParameters(float p0, float p1, float p2,
98+
float p0_Z2, float p1_Z2, float p2_Z2,
99+
float p0_res, float p1_res, float p2_res,
100+
float p0_res_Z2, float p1_res_Z2, float p2_res_Z2)
91101
{
92102
if (mIsInitialized) {
93103
LOG(fatal) << "ITSResponse parameters already initialized";
@@ -102,19 +112,24 @@ struct ITSResponse {
102112
mResolutionParams[0] = p0_res;
103113
mResolutionParams[1] = p1_res;
104114
mResolutionParams[2] = p2_res;
115+
mResolutionParamsZ2[0] = p0_res_Z2;
116+
mResolutionParamsZ2[1] = p1_res_Z2;
117+
mResolutionParamsZ2[2] = p2_res_Z2;
105118
}
106119

107120
private:
108121
static std::array<float, 3> mITSRespParams;
109122
static std::array<float, 3> mITSRespParamsZ2;
110123
static std::array<float, 3> mResolutionParams;
124+
static std::array<float, 3> mResolutionParamsZ2;
111125
static bool mIsInitialized;
112126
};
113127

114-
std::array<float, 3> ITSResponse::mITSRespParams = {1.1576, 1.684, 1.9453};
115-
std::array<float, 3> ITSResponse::mITSRespParamsZ2 = {2.8752, 1.1246, 5.0259};
128+
std::array<float, 3> ITSResponse::mITSRespParams = {1.18941, 1.53792, 1.69961};
129+
std::array<float, 3> ITSResponse::mITSRespParamsZ2 = {2.35117, 1.80347, 5.14355};
116130
// relative resolution is modelled with an erf function: [0]*TMath::Erf((x-[1])/[2])
117-
std::array<float, 3> ITSResponse::mResolutionParams = {0.2431, -0.3293, 1.533};
131+
std::array<float, 3> ITSResponse::mResolutionParams = {1.94669e-01, -2.08616e-01, 1.30753};
132+
std::array<float, 3> ITSResponse::mResolutionParamsZ2 = {8.74371e-02, -1.82804, 5.06449e-01};
118133
bool ITSResponse::mIsInitialized = false;
119134

120135
namespace pidits

Common/TableProducer/PID/pidITS.cxx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,16 @@ using namespace o2::track;
4343
MetadataHelper metadataInfo;
4444

4545
static constexpr int nCases = 2;
46-
static constexpr int nParameters = 9;
46+
static constexpr int nParameters = 12;
4747
static const std::vector<std::string> casesNames{"Data", "MC"};
4848
static const std::vector<std::string> parameterNames{"RespITSPar1", "RespITSPar2", "RespITSPar3",
4949
"RespITSPar1_Z2", "RespITSPar2_Z2", "RespITSPar3_Z2",
50-
"ResolutionPar1", "ResolutionPar2", "ResolutionPar3"};
51-
static constexpr float defaultParameters[nCases][nParameters]{{0.903, 2.014, 2.440,
52-
2.8752, 1.1246, 5.0259,
53-
0.2431, -0.3293, 1.533},
54-
{0.903, 2.014, 2.440,
55-
2.8752, 1.1246, 5.0259,
56-
0.2431, -0.3293, 1.533}};
50+
"ResolutionPar1", "ResolutionPar2", "ResolutionPar3",
51+
"ResolutionPar1_Z2", "ResolutionPar2_Z2", "ResolutionPar3_Z2"};
52+
53+
static constexpr float defaultParameters[nCases][nParameters] = {
54+
{1.18941, 1.53792, 1.69961, 2.35117, 1.80347, 5.14355, 1.94669e-01, -2.08616e-01, 1.30753, 8.74371e-02, -1.82804, 5.06449e-01},
55+
{1.18941, 1.53792, 1.69961, 2.35117, 1.80347, 5.14355, 1.94669e-01, -2.08616e-01, 1.30753, 8.74371e-02, -1.82804, 5.06449e-01}};
5756

5857
/// Task to produce the ITS PID information for each particle species
5958
/// The parametrization is: [p0/(bg)**p1 + p2] being bg = p/m. Different parametrizations are used for He3 and Alpha particles.
@@ -90,7 +89,10 @@ struct itsPid {
9089
itsParams->get(key, "RespITSPar3_Z2"),
9190
itsParams->get(key, "ResolutionPar1"),
9291
itsParams->get(key, "ResolutionPar2"),
93-
itsParams->get(key, "ResolutionPar3"));
92+
itsParams->get(key, "ResolutionPar3"),
93+
itsParams->get(key, "ResolutionPar1_Z2"),
94+
itsParams->get(key, "ResolutionPar2_Z2"),
95+
itsParams->get(key, "ResolutionPar3_Z2"));
9496
}
9597
}
9698

0 commit comments

Comments
 (0)