Skip to content

Commit f4239ec

Browse files
authored
Add MID and RICH in TrackSelectorPID (#6333)
* Fix format and TPC in selector * Add MID table and functions in track selector * Add RICH in TrackSelectorPID * Add debugging messages * Define a single table for ALICE 3 PID track indices * Mute debugging messages * Accept only both accepted tracks for MID * Apply clang-format
1 parent 21d0728 commit f4239ec

File tree

4 files changed

+309
-99
lines changed

4 files changed

+309
-99
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
///
12+
/// \file MID.h
13+
/// \author Vít Kučera
14+
/// \note Based on RICH.h
15+
/// \brief Set of tables for the ALICE3 MID information
16+
///
17+
18+
#ifndef O2_ANALYSIS_ALICE3_MID_H_
19+
#define O2_ANALYSIS_ALICE3_MID_H_
20+
21+
// O2 includes
22+
#include "Framework/AnalysisDataModel.h"
23+
24+
namespace o2::aod
25+
{
26+
namespace alice3mid
27+
{
28+
DECLARE_SOA_INDEX_COLUMN(Collision, collision); //!
29+
DECLARE_SOA_INDEX_COLUMN(Track, track); //!
30+
DECLARE_SOA_COLUMN(MIDIsMuon, midIsMuon, uint8_t); //! FIXME: To be changed to bool once bool columns are groupable.
31+
} // namespace alice3mid
32+
33+
DECLARE_SOA_TABLE(MIDs, "AOD", "MID", //!
34+
o2::soa::Index<>,
35+
alice3mid::CollisionId,
36+
alice3mid::TrackId,
37+
alice3mid::MIDIsMuon);
38+
39+
using MID = MIDs::iterator;
40+
41+
} // namespace o2::aod
42+
43+
#endif // O2_ANALYSIS_ALICE3_MID_H_

Analysis/Core/include/AnalysisCore/TrackSelectorPID.h

Lines changed: 152 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,151 @@ class TrackSelectorPID
251251
}
252252
}
253253

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

295445
#endif // O2_ANALYSIS_TRACKSELECTORPID_H_

Analysis/Tasks/PWGHF/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,3 @@ o2_add_dpl_workflow(hf-task-lc-tok0sp
132132
SOURCES taskLcK0sP.cxx
133133
PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing O2::AnalysisTasksUtils
134134
COMPONENT_NAME Analysis)
135-

0 commit comments

Comments
 (0)