12#include "KFParticleFinder.h"
24template<EV0Type V0Type>
33template<EV0Type V0Type>
36 const auto& cuts =
fCuts.kfpFinderCuts;
37 pFinder->SetChiPrimaryCut2D(cuts.maxChi2NdfPrim);
38 pFinder->SetLdLCut2D(cuts.minDecayLDL);
39 pFinder->SetLCut(cuts.minDecayLength);
40 pFinder->SetChi2Cut2D(cuts.maxChi2NdfGeo);
45template<EV0Type V0Type>
54template<EV0Type V0Type>
59 if (pr.
beta < cut.beta[0] || pr.
beta > cut.beta[1])
return false;
64 const auto& cuts = fCuts.particleCuts;
65 if (!SelectDaughter(property.daughterA, cuts.daughterA))
return false;
66 if (!SelectDaughter(property.daughterB, cuts.daughterB))
return false;
67 if (property.dcaRelToPrimVertex > cuts.maxDcaRelToPrimVertex)
return false;
68 if (property.dcaBetweenDaughters > cuts.maxDcaBetweenDaughters)
return false;
69 if (property.decayLength < cuts.decayLength[0] || property.decayLength > cuts.decayLength[1])
return false;
70 if (property.daughterVtxZ < cuts.daughterVtxZ[0] || property.daughterVtxZ > cuts.daughterVtxZ[1])
return false;
71 if (property.openingAngle < cuts.minOpeningAngle)
return false;
72 if (property.chi2NdfTopo < cuts.chi2NdfTopo[0] || property.chi2NdfTopo > cuts.chi2NdfTopo[1])
return false;
73 if (property.chi2NdfGeo < cuts.chi2NdfGeo[0] || property.chi2NdfGeo > cuts.chi2NdfGeo[1])
return false;
80template<EV0Type V0Type>
93 if (std::isnan(property.
beta) || property.
beta <= 0 || property.
beta >= 1)
return false;
96 const auto& cuts =
fCuts.trackCuts;
100 auto Check = [&property, &cuts](
ETrackPid trackPid) constexpr->bool
102 const auto& pidCuts = cuts.pidCuts[
static_cast<size_t>(trackPid)];
103 if (property.
beta < pidCuts.beta[0] || property.
beta > pidCuts.beta[1])
return false;
107 if (!Check(property.pid))
return false;
114template<EV0Type V0Type>
124template<EV0Type V0Type>
128 std::stringstream msg;
131 std::string sDaughterA{};
132 std::string sDaughterB{};
141 auto PrintTrackPidCuts = [&](
int iPid) {
142 const auto& cuts =
fCuts.trackCuts.pidCuts[iPid];
144 msg <<
"\n\t\tbeta: " << setw(12) << cuts.beta[0] <<
" -- " << setw(12) << cuts.beta[1];
147 msg <<
"======= V0-finder selector for " << sV0 <<
" -> " << sDaughterA <<
" + " << sDaughterB;
149 msg <<
"\nTRACK PRE-SELECTION CUTS:";
151 PrintTrackPidCuts(iPid);
154 const auto& kfpFinderCuts =
fCuts.kfpFinderCuts;
155 msg <<
"\nKFP-FINDER INTRINSIC CUTS:";
156 msg <<
"\n\tmin. decay length [cm]: " << setw(12) << kfpFinderCuts.minDecayLength;
157 msg <<
"\n\tmin. l / dl: " << setw(12) << kfpFinderCuts.minDecayLDL;
158 msg <<
"\n\tmax chi2/NDF primary: " << setw(12) << kfpFinderCuts.maxChi2NdfPrim;
159 msg <<
"\n\tmax chi2/NDF geo: " << setw(12) << kfpFinderCuts.maxChi2NdfGeo;
161 auto PrintDaughterCuts = [&](
const DaughterCuts& cuts) {
162 msg <<
"\n\t\tDCA rel. to origin: [cm]" << setw(12) << cuts.dcaRelToOrigin[0] <<
" -- " << setw(12)
163 << cuts.dcaRelToOrigin[1];
164 msg <<
"\n\t\tbeta: " << setw(12) << cuts.beta[0] <<
" -- " << setw(12) << cuts.beta[1];
167 const auto& prtCuts = fCuts.particleCuts;
168 msg <<
"\nV0 SELECTION CUTS:";
169 msg <<
"\n\t" << sDaughterA <<
':';
170 PrintDaughterCuts(prtCuts.daughterA);
171 msg <<
"\n\t" << sDaughterB <<
':';
172 PrintDaughterCuts(prtCuts.daughterB);
173 msg <<
"\n\tmax DCA rel. to primary vertex [cm]: " << prtCuts.maxDcaRelToPrimVertex;
174 msg <<
"\n\tmax DCA between daughters [cm]: " << prtCuts.maxDcaBetweenDaughters;
175 msg <<
"\n\tdecay length [cm]: " << prtCuts.decayLength[0] <<
" -- " << prtCuts.decayLength[1];
176 msg <<
"\n\tdaughter z-vertex [cm]: " << prtCuts.daughterVtxZ[0] <<
" -- " << prtCuts.daughterVtxZ[1];
177 msg <<
"\n\tmin opening angle [radians]: " << prtCuts.minOpeningAngle;
178 msg <<
"\n\tchi2/NDF topology: " << prtCuts.chi2NdfTopo[0] <<
" -- " << prtCuts.chi2NdfTopo[1];
179 msg <<
"\n\tchi2/NDF geo: " << prtCuts.chi2NdfGeo[0] <<
" -- " << prtCuts.chi2NdfGeo[1];
186template<EV0Type V0Type>
190 std::set<ETrackPid> knownPids;
191 for (
const auto& entry : trackPidCuts) {
192 knownPids.insert(entry.pid);
196 std::stringstream msg;
197 msg <<
"V0FinderCutter::CutValues::Init(): the node \"trackCuts/pidCuts\" must contain exactly the same amount ";
199 <<
"of elements, as the ETrackPid enumerator. Each element must have a unique pid value. The pid values, which ";
200 msg <<
"were read from the parameter file, are: ";
201 for (
const auto& p : knownPids) {
204 throw std::runtime_error(msg.str());
207 std::sort(trackPidCuts.begin(), trackPidCuts.end(), [](
const auto& lhs,
const auto& rhs) {
208 return static_cast<size_t>(lhs.pid) < static_cast<size_t>(rhs.pid);
A selector class for V0-candidates in mCBM.
V0FinderCutter()=default
Default constructor.
A collection of cuts for V0 production analysis in mCBM.
void ReadCutsFromYaml(const std::string &filename)
Reads parameters from the YAML config.
CutValues fCuts
Cut values of the analysis.
void ApplyCutsToKFParticleFinder(KFParticleFinder *pFinder) const
Applies cuts to the KFParticleFinder instance.
bool SelectParticle(const ParticleProperty &particleProperty) const
Selects a particle within the cuts (after the KFParticleFinder stage)
bool SelectTrack(const TrackProperty &trackProperty) const
Selects a track (to pass it to the KFParticleFinder stage)
std::string ToString() const
String representation of the class.
void SetCuts(const CutValues &cuts)
Sets the cuts.
std::string ToString(ETrackPid trackPid)
String representation of ETrackPid.
ETrackPid
An enumeration for PID of global tracks.
T ReadFromFile(fs::path path)
void Init()
A method, which initializes the instance of the CutValues.
TrackCuts trackCuts
Cuts on tracks at pre-selection stage.
double beta
Speed of particle [c].
double dcaRelToOrigin
Distance of closest approach relative to origin [cm].
Properties of a track to perform track pre-selection.
ETrackPid pid
Identity of the particle.
double dcaRelToOrigin
Distanse of closest approach relative to origin [cm].
double beta
Speed of particle [c].