Skip to content

Commit 71d04e9

Browse files
vkucerarspijkersginnocenBiao ZhangGian Michele Innocenti
authored
PWGHF: Merge devrun5 (ALICE 3 development for J/ψ and X) (#6695)
Co-authored-by: rspijkers <rik.spijkers@gmail.com> Co-authored-by: Rik Spijkers <78484875+rspijkers@users.noreply.github.com> Co-authored-by: Gian Michele Innocenti <gminnocen@gmail.com> Co-authored-by: Biao Zhang <bizhang@alicecerno2.cern.ch> Co-authored-by: Gian Michele Innocenti <ginnocen@alicecerno2.cern.ch> Co-authored-by: zhangbiao-phy <52267892+zhangbiao-phy@users.noreply.github.com>
1 parent e7a486b commit 71d04e9

16 files changed

Lines changed: 2214 additions & 258 deletions
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
/// \file MID.h
14+
/// \author Vít Kučera
15+
/// \note Based on RICH.h
16+
/// \brief Set of tables for the ALICE3 MID information
17+
///
18+
19+
#ifndef O2_ANALYSIS_ALICE3_MID_H_
20+
#define O2_ANALYSIS_ALICE3_MID_H_
21+
22+
// O2 includes
23+
#include "Framework/AnalysisDataModel.h"
24+
25+
namespace o2::aod
26+
{
27+
namespace alice3mid
28+
{
29+
DECLARE_SOA_INDEX_COLUMN(Collision, collision); //!
30+
DECLARE_SOA_INDEX_COLUMN(Track, track); //!
31+
DECLARE_SOA_COLUMN(MIDIsMuon, midIsMuon, uint8_t); //! FIXME: To be changed to bool once bool columns are groupable.
32+
} // namespace alice3mid
33+
34+
DECLARE_SOA_TABLE(MIDs, "AOD", "MID", //!
35+
o2::soa::Index<>,
36+
alice3mid::CollisionId,
37+
alice3mid::TrackId,
38+
alice3mid::MIDIsMuon);
39+
40+
using MID = MIDs::iterator;
41+
42+
} // namespace o2::aod
43+
44+
#endif // O2_ANALYSIS_ALICE3_MID_H_

Analysis/Core/include/AnalysisCore/HFSelectorCuts.h

Lines changed: 60 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ enum Code {
2929
kDPlus = 411,
3030
kLambdaCPlus = 4122,
3131
kXiCPlus = 4232,
32-
kJpsi = 443
32+
kJpsi = 443,
33+
kX3872 = 9920443
3334
};
3435
} // namespace pdg
3536

@@ -99,7 +100,7 @@ auto pTBinsVec = std::vector<double>{pTBins, pTBins + npTBins + 1};
99100

100101
// default values for the cuts
101102
constexpr double cuts[npTBins][nCutVars] = {{1.65, 2.15, 0.5, 100.}, /* 1 < pt < 5 */
102-
{1.65, 2.15, 0.5, 100.}}; /* 5 < pt > 1000 */
103+
{1.65, 2.15, 0.5, 100.}}; /* 5 < pt < 1000 */
103104

104105
// row labels
105106
static const std::vector<std::string> pTBinLabels{};
@@ -383,7 +384,7 @@ static const std::vector<std::string> cutVarLabels = {"m", "pT p", "pT K", "pT P
383384
namespace hf_cuts_jpsi_toee
384385
{
385386
static constexpr int npTBins = 9;
386-
static constexpr int nCutVars = 4;
387+
static constexpr int nCutVars = 5;
387388
// default values for the pT bin edges (can be used to configure histogram axis)
388389
// offset by 1 from the bin numbers in cuts array
389390
constexpr double pTBins[npTBins + 1] = {
@@ -401,15 +402,15 @@ constexpr double pTBins[npTBins + 1] = {
401402
auto pTBins_v = std::vector<double>{pTBins, pTBins + npTBins + 1};
402403

403404
// default values for the cuts
404-
constexpr double cuts[npTBins][nCutVars] = {{0.5, 0.2, 0.4, 1}, /* 0 < pT < 0.5 */
405-
{0.5, 0.2, 0.4, 1}, /* 0.5 < pT < 1 */
406-
{0.5, 0.2, 0.4, 1}, /* 1 < pT < 2 */
407-
{0.5, 0.2, 0.4, 1}, /* 2 < pT < 3 */
408-
{0.5, 0.2, 0.4, 1}, /* 3 < pT < 4 */
409-
{0.5, 0.2, 0.4, 1}, /* 4 < pT < 5 */
410-
{0.5, 0.2, 0.4, 1}, /* 5 < pT < 7 */
411-
{0.5, 0.2, 0.4, 1}, /* 7 < pT < 10 */
412-
{0.5, 0.2, 0.4, 1}}; /* 10 < pT < 15 */
405+
constexpr double cuts[npTBins][nCutVars] = {{0.5, 0.2, 0.4, 1, 1.}, /* 0 < pT < 0.5 */
406+
{0.5, 0.2, 0.4, 1, 1.}, /* 0.5 < pT < 1 */
407+
{0.5, 0.2, 0.4, 1, 1.}, /* 1 < pT < 2 */
408+
{0.5, 0.2, 0.4, 1, 1.}, /* 2 < pT < 3 */
409+
{0.5, 0.2, 0.4, 1, 1.}, /* 3 < pT < 4 */
410+
{0.5, 0.2, 0.4, 1, 1.}, /* 4 < pT < 5 */
411+
{0.5, 0.2, 0.4, 1, 1.}, /* 5 < pT < 7 */
412+
{0.5, 0.2, 0.4, 1, 1.}, /* 7 < pT < 10 */
413+
{0.5, 0.2, 0.4, 1, 1.}}; /* 10 < pT < 15 */
413414

414415
// row labels
415416
static const std::vector<std::string> pTBinLabels = {
@@ -424,8 +425,54 @@ static const std::vector<std::string> pTBinLabels = {
424425
"pT bin 8"};
425426

426427
// column labels
427-
static const std::vector<std::string> cutVarLabels = {"m", "DCA_xy", "DCA_z", "pT El"};
428+
static const std::vector<std::string> cutVarLabels = {"m", "DCA_xy", "DCA_z", "pT El", "chi2PCA"};
428429
} // namespace hf_cuts_jpsi_toee
430+
431+
namespace hf_cuts_x_tojpsipipi
432+
{
433+
static constexpr int npTBins = 9;
434+
static constexpr int nCutVars = 7;
435+
// default values for the pT bin edges (can be used to configure histogram axis)
436+
// offset by 1 from the bin numbers in cuts array
437+
constexpr double pTBins[npTBins + 1] = {
438+
0,
439+
0.5,
440+
1.0,
441+
2.0,
442+
3.0,
443+
4.0,
444+
5.0,
445+
7.0,
446+
10.0,
447+
15.0,
448+
};
449+
auto pTBins_v = std::vector<double>{pTBins, pTBins + npTBins + 1};
450+
451+
// default values for the cuts
452+
// m CPA d0Jpsi d0Pi pTJpsi pTPi chi2PCA
453+
constexpr double cuts[npTBins][nCutVars] = {{0.5, 0.80, 0.001, 0.001, 3.0, 0.15, 1.}, /* 0<pt<0.5 */
454+
{0.5, 0.80, 0.001, 0.001, 3.0, 0.15, 1.}, /* 0.5<pt<1 */
455+
{0.5, 0.80, 0.001, 0.001, 3.0, 0.15, 1.}, /* 1<pt<2 */
456+
{0.5, 0.80, 0.001, 0.001, 3.0, 0.15, 1.}, /* 2<pt<3 */
457+
{0.5, 0.80, 0.001, 0.001, 3.0, 0.15, 1.}, /* 3<pt<4 */
458+
{0.5, 0.80, 0.001, 0.001, 3.0, 0.15, 1.}, /* 4<pt<5 */
459+
{0.5, 0.80, 0.001, 0.001, 3.0, 0.15, 1.}, /* 5<pt<7 */
460+
{0.5, 0.80, 0.001, 0.001, 3.0, 0.15, 1.}, /* 7<pt<10 */
461+
{0.5, 0.80, 0.001, 0.001, 3.0, 0.15, 1.}}; /* 10<pt<15 */
462+
// row labels
463+
static const std::vector<std::string> pTBinLabels = {
464+
"pT bin 0",
465+
"pT bin 1",
466+
"pT bin 2",
467+
"pT bin 3",
468+
"pT bin 4",
469+
"pT bin 5",
470+
"pT bin 6",
471+
"pT bin 7",
472+
"pT bin 8"};
473+
// column labels
474+
static const std::vector<std::string> cutVarLabels = {"m", "CPA", "d0 Jpsi", "d0 Pi", "pT Jpsi", "pT Pi", "chi2PCA"};
475+
} // namespace hf_cuts_x_tojpsipipi
429476
} // namespace o2::analysis
430477

431478
#endif // HF_SELECTOR_CUTS_H_

Analysis/Core/include/AnalysisCore/TrackSelectorPID.h

Lines changed: 214 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,159 @@ class TrackSelectorPID
252252
}
253253
}
254254

255-
/// Returns status of combined PID selection for a given track.
255+
// RICH
256+
257+
/// Set pT range where RICH PID is applicable.
258+
void setRangePtRICH(float ptMin, float ptMax)
259+
{
260+
mPtRICHMin = ptMin;
261+
mPtRICHMax = ptMax;
262+
}
263+
264+
/// Set RICH nσ range in which a track should be accepted.
265+
void setRangeNSigmaRICH(float nsMin, float nsMax)
266+
{
267+
mNSigmaRICHMin = nsMin;
268+
mNSigmaRICHMax = nsMax;
269+
}
270+
271+
/// Set RICH nσ range in which a track should be conditionally accepted if combined with TOF.
272+
void setRangeNSigmaRICHCondTOF(float nsMin, float nsMax)
273+
{
274+
mNSigmaRICHMinCondTOF = nsMin;
275+
mNSigmaRICHMaxCondTOF = nsMax;
276+
}
277+
278+
/// Checks if track is OK for RICH PID.
279+
/// \param track track
280+
/// \return true if track is OK for RICH PID
281+
template <typename T>
282+
bool isValidTrackPIDRICH(const T& track)
283+
{
284+
if (track.richId() < 0) {
285+
return false;
286+
}
287+
auto pt = track.pt();
288+
return mPtRICHMin <= pt && pt <= mPtRICHMax;
289+
}
290+
291+
/// Checks if track is compatible with given particle species hypothesis within given RICH nσ range.
292+
/// \param track track
293+
/// \param conditionalTOF variable to store the result of selection with looser cuts for conditional accepting of track if combined with TOF
294+
/// \return true if track satisfies RICH PID hypothesis for given RICH nσ range
295+
template <typename T>
296+
bool isSelectedTrackPIDRICH(const T& track, bool& conditionalTOF)
297+
{
298+
// Accept if selection is disabled via large values.
299+
if (mNSigmaRICHMin < -999. && mNSigmaRICHMax > 999.) {
300+
return true;
301+
}
302+
303+
// Get nσ for a given particle hypothesis.
304+
double nSigma = 100.;
305+
switch (mPdg) {
306+
case kElectron: {
307+
nSigma = track.rich().richNsigmaEl();
308+
break;
309+
}
310+
case kMuonMinus: {
311+
nSigma = track.rich().richNsigmaMu();
312+
break;
313+
}
314+
case kPiPlus: {
315+
nSigma = track.rich().richNsigmaPi();
316+
break;
317+
}
318+
case kKPlus: {
319+
nSigma = track.rich().richNsigmaKa();
320+
break;
321+
}
322+
case kProton: {
323+
nSigma = track.rich().richNsigmaPr();
324+
break;
325+
}
326+
default: {
327+
LOGF(error, "ERROR: RICH PID not implemented for PDG %d", mPdg);
328+
assert(false);
329+
}
330+
}
331+
332+
if (mNSigmaRICHMinCondTOF < -999. && mNSigmaRICHMaxCondTOF > 999.) {
333+
conditionalTOF = true;
334+
} else {
335+
conditionalTOF = mNSigmaRICHMinCondTOF <= nSigma && nSigma <= mNSigmaRICHMaxCondTOF;
336+
}
337+
return mNSigmaRICHMin <= nSigma && nSigma <= mNSigmaRICHMax;
338+
}
339+
340+
/// Returns status of RICH PID selection for a given track.
341+
/// \param track track
342+
/// \return RICH selection status (see TrackSelectorPID::Status)
343+
template <typename T>
344+
int getStatusTrackPIDRICH(const T& track)
345+
{
346+
if (isValidTrackPIDRICH(track)) {
347+
bool condTOF = false;
348+
if (isSelectedTrackPIDRICH(track, condTOF)) {
349+
return Status::PIDAccepted; // accepted
350+
} else if (condTOF) {
351+
return Status::PIDConditional; // potential to be accepted if combined with TOF
352+
} else {
353+
return Status::PIDRejected; // rejected
354+
}
355+
} else {
356+
return Status::PIDNotApplicable; // PID not applicable
357+
}
358+
}
359+
360+
// MID
361+
362+
/// Checks if track is OK for MID PID.
363+
/// \param track track
364+
/// \return true if track is OK for MID PID
365+
template <typename T>
366+
bool isValidTrackPIDMID(const T& track)
367+
{
368+
return track.midId() > -1;
369+
}
370+
371+
/// Checks if track is compatible with muon hypothesis in the MID detector.
372+
/// \param track track
373+
/// \return true if track has been identified as muon by the MID detector
374+
template <typename T>
375+
bool isSelectedTrackPIDMID(const T& track)
376+
{
377+
if (mPdg != kMuonMinus) {
378+
return false;
379+
}
380+
return track.mid().midIsMuon() == 1; // FIXME: change to return track.midIsMuon() once the column is bool.
381+
}
382+
383+
/// Returns status of MID PID selection for a given track.
384+
/// \param track track
385+
/// \return MID selection status (see TrackSelectorPID::Status)
386+
template <typename T>
387+
int getStatusTrackPIDMID(const T& track)
388+
{
389+
if (mPdg != kMuonMinus) {
390+
return Status::PIDRejected;
391+
}
392+
if (isValidTrackPIDMID(track)) {
393+
if (isSelectedTrackPIDMID(track)) {
394+
return Status::PIDAccepted; // accepted
395+
} else {
396+
return Status::PIDRejected; // rejected
397+
}
398+
} else {
399+
return Status::PIDNotApplicable; // PID not applicable
400+
}
401+
}
402+
403+
// Combined selection (TPC + TOF)
404+
405+
/// Returns status of combined PID (TPC + TOF) selection for a given track.
256406
/// \param track track
257-
/// \return combined-selection status (see TrackSelectorPID::Status)
407+
/// \return status of combined PID (TPC + TOF) (see TrackSelectorPID::Status)
258408
template <typename T>
259409
int getStatusTrackPIDAll(const T& track)
260410
{
@@ -273,6 +423,60 @@ class TrackSelectorPID
273423
return Status::PIDNotApplicable; // (NotApplicable for one detector) and (NotApplicable or Conditional for the other)
274424
}
275425

426+
/// Checks whether a track is identified as electron and rejected as pion by TOF or RICH.
427+
/// \param track track
428+
/// \param useTOF switch to use TOF
429+
/// \param useRICH switch to use RICH
430+
/// \return true if track is selected by TOF or RICH
431+
/// \note Ported from https://github.com/feisenhu/ALICE3-LoI-LMee/blob/main/efficiency/macros/anaEEstudy.cxx
432+
template <typename T>
433+
bool isElectronAndNotPion(const T& track, bool useTOF = true, bool useRICH = true)
434+
{
435+
bool isSelTOF = false;
436+
bool isSelRICH = false;
437+
bool hasRICH = track.richId() > -1;
438+
bool hasTOF = isValidTrackPIDTOF(track);
439+
auto nSigmaTOFEl = track.tofNSigmaEl();
440+
auto nSigmaTOFPi = track.tofNSigmaPi();
441+
auto nSigmaRICHEl = hasRICH ? track.rich().richNsigmaEl() : -1000.;
442+
auto nSigmaRICHPi = hasRICH ? track.rich().richNsigmaPi() : -1000.;
443+
auto p = track.p();
444+
445+
// TOF
446+
if (useTOF && hasTOF && (p < 0.6)) {
447+
if (p > 0.4 && hasRICH) {
448+
if ((std::abs(nSigmaTOFEl) < mNSigmaTOFMax) && (std::abs(nSigmaRICHEl) < mNSigmaRICHMax)) {
449+
isSelTOF = true; // is selected as electron by TOF and RICH
450+
}
451+
} else if (p <= 0.4) {
452+
if (std::abs(nSigmaTOFEl) < mNSigmaTOFMax) {
453+
isSelTOF = true; // is selected as electron by TOF
454+
}
455+
} else {
456+
isSelTOF = false; // This is rejecting all the heavier particles which do not have a RICH signal in the p area of 0.4-0.6 GeV/c
457+
}
458+
if (std::abs(nSigmaTOFPi) < mNSigmaTOFMax) {
459+
isSelTOF = false; // is selected as pion by TOF
460+
}
461+
} else {
462+
isSelTOF = false;
463+
}
464+
465+
// RICH
466+
if (useRICH && hasRICH) {
467+
if (std::abs(nSigmaRICHEl) < mNSigmaRICHMax) {
468+
isSelRICH = true; // is selected as electron by RICH
469+
}
470+
if ((std::abs(nSigmaRICHPi) < mNSigmaRICHMax) && (p > 1.0) && (p < 2.0)) {
471+
isSelRICH = false; // is selected as pion by RICH
472+
}
473+
} else {
474+
isSelRICH = false;
475+
}
476+
477+
return isSelRICH || isSelTOF;
478+
}
479+
276480
private:
277481
uint mPdg = kPiPlus; ///< PDG code of the expected particle
278482

@@ -291,6 +495,14 @@ class TrackSelectorPID
291495
float mNSigmaTOFMax = 3.; ///< maximum number of TOF σ
292496
float mNSigmaTOFMinCondTPC = -1000.; ///< minimum number of TOF σ if combined with TPC
293497
float mNSigmaTOFMaxCondTPC = 1000.; ///< maximum number of TOF σ if combined with TPC
498+
499+
// RICH
500+
float mPtRICHMin = 0.; ///< minimum pT for RICH PID [GeV/c]
501+
float mPtRICHMax = 100.; ///< maximum pT for RICH PID [GeV/c]
502+
float mNSigmaRICHMin = -3.; ///< minimum number of RICH σ
503+
float mNSigmaRICHMax = 3.; ///< maximum number of RICH σ
504+
float mNSigmaRICHMinCondTOF = -1000.; ///< minimum number of RICH σ if combined with TOF
505+
float mNSigmaRICHMaxCondTOF = 1000.; ///< maximum number of RICH σ if combined with TOF
294506
};
295507

296508
#endif // O2_ANALYSIS_TRACKSELECTORPID_H_

0 commit comments

Comments
 (0)