Project
Loading...
Searching...
No Matches
SVertexHypothesis.h
Go to the documentation of this file.
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
15
16#ifndef ALICEO2_SVERTEX_HYPOTHESIS_H
17#define ALICEO2_SVERTEX_HYPOTHESIS_H
18
20#include <cmath>
21#include <array>
22
23namespace o2
24{
25namespace vertexing
26{
27
29{
30
31 public:
33 enum PIDParams { SigmaM, // sigma of mass res at 0 pt
34 NSigmaM, // number of sigmas of mass res
35 MarginM, // additive safety margin in mass cut
36 NSigmaTightM, // number of sigmas of mass res when doing tight cut around mass (V0s used in cascades)
37 MarginTightM, // additive safety margin in mass cut when doing tight cut around mass (V0s used in cascades)
38 CPt, // pT dependence of mass resolution parameterized as mSigma*(1+mC1*pt);
41 CPt3 }; // pT dependence of mass resolution of Cascade parameterized as CPt+CPt1*pt +CPt2*TMath::Exp(-CPt3*pt);
42
43 static constexpr int NPIDParams = 9;
44
45 void set(PID v0, PID ppos, PID pneg, float sig, float nSig, float margin, float nSigTight, float marginTight, float cpt, float cpt1, float cpt2, float cpt3, float bz = 0.f, float maxSigma = 0.01);
46 void set(PID v0, PID ppos, PID pneg, const float pars[NPIDParams], float bz = 0.f, float maxSigma = 0.01);
47
48 float getMassV0Hyp() const { return PID::getMass(mPIDV0); }
49 float getMassPosProng() const { return PID::getMass(mPIDPosProng); }
50 float getMassNegProng() const { return PID::getMass(mPIDNegProng); }
51
52 float calcMass2(float p2Pos, float p2Neg, float p2V0) const
53 {
54 // calculate v0 mass from squared momentum of its prongs and total momentum
55 float ePos = std::sqrt(p2Pos + getMass2PosProng()), eNeg = std::sqrt(p2Neg + getMass2NegProng()), eV0 = ePos + eNeg;
56 return eV0 * eV0 - p2V0;
57 }
58
59 float calcMass(float p2Pos, float p2Neg, float p2V0) const { return std::sqrt(calcMass2(p2Pos, p2Neg, p2V0)); }
60
61 bool check(float p2Pos, float p2Neg, float p2V0, float ptV0) const
62 { // check if given mass and pt is matching to hypothesis
63 return check(calcMass(p2Pos, p2Neg, p2V0), ptV0);
64 }
65 bool check(float mass, float pt) const
66 { // check if given mass and pt is matching to hypothesis
67 return std::abs(mass - getMassV0Hyp()) < getMargin(pt);
68 }
69
70 bool checkTight(float p2Pos, float p2Neg, float p2V0, float ptV0) const
71 { // check if given mass and pt is matching to hypothesis
72 return checkTight(calcMass(p2Pos, p2Neg, p2V0), ptV0);
73 }
74 bool checkTight(float mass, float pt) const
75 { // check if given mass and pt is matching to hypothesis
76 return std::abs(mass - getMassV0Hyp()) < getMarginTight(pt);
77 }
78
79 float getSigmaV0Cascade(float pt) const { return mPars[CPt] + mPars[CPt1] * pt + mPars[CPt2] * std::exp(-mPars[CPt3] * pt); }
80 float getSigma(float pt) const { return mPars[SigmaM] * (1.f + mPars[CPt] * pt); }
81 float getMargin(float pt, bool tight = false) const
82 {
83 int idxNsigma = NSigmaM;
84 int idxMargin = MarginM;
85 if (tight) { // move to indices for tight variables in case asked to do so (tighter peak cuts for decay chains)
86 idxNsigma = NSigmaTightM;
87 idxMargin = MarginTightM;
88 }
89 if (mPIDV0 == PID::XiMinus || mPIDV0 == PID::OmegaMinus) { // case for cascades, antiparticles included
90 float sigmaV0Cascade = getSigmaV0Cascade(pt);
91 if (sigmaV0Cascade > maxSigma) { // insuring that at low pt one gets reasonable width as the parametrisation function may explode to unphysical values
92 return mPars[idxNsigma] * maxSigma + mPars[idxMargin];
93 } else {
94 return mPars[idxNsigma] * sigmaV0Cascade + mPars[idxMargin];
95 }
96 } else if (mPIDV0 == PID::K0 || mPIDV0 == PID::Lambda) { // case for V0s, AntiLambda is included in PID::Lambda
97 return mPars[idxNsigma] * getSigmaV0Cascade(pt) + mPars[idxMargin];
98 } else {
99 return mPars[idxNsigma] * getSigma(pt) + mPars[idxMargin]; // case for HyperTriton and Hyperhydrog4
100 }
101 }
102 float getMarginTight(float pt) const { return getMargin(pt, true); }
103
104 private:
105 float getMass2PosProng() const { return PID::getMass2(mPIDPosProng); }
106 float getMass2NegProng() const { return PID::getMass2(mPIDNegProng); }
107
108 PID mPIDV0{PID::K0};
109 PID mPIDPosProng{PID::Pion};
110 PID mPIDNegProng{PID::Pion};
111
112 public: // to be deleted
113 std::array<float, NPIDParams> mPars{};
114 float maxSigma;
115
117};
118
120{
121
122 public:
124 enum PIDParams { SigmaM, // sigma of mass res at 0 pt
125 NSigmaM, // number of sigmas of mass res
126 MarginM, // additive safety margin in mass cut
127 CPt }; // pT dependence of mass resolution parameterized as mSigma*(1+mC1*pt);
128
129 static constexpr int NPIDParams = 4;
130
131 void set(PID v0, PID ppos, PID pneg, PID pbach, float sig, float nSig, float margin, float cpt, float bz = 0.f);
132 void set(PID v0, PID ppos, PID pneg, PID pbach, const float pars[NPIDParams], float bz = 0.f);
133
134 PID getPIDHyp() const { return mPIDV0; }
135 float getMassV0Hyp() const { return PID::getMass(mPIDV0); }
136 float getMassPosProng() const { return PID::getMass(mPIDPosProng); }
137 float getMassNegProng() const { return PID::getMass(mPIDNegProng); }
138 float getMassBachProng() const { return PID::getMass(mPIDBachProng); }
139 float getChargePosProng() const { return PID::getCharge(mPIDPosProng); }
140 float getChargeNegProng() const { return PID::getCharge(mPIDNegProng); }
141 float getChargeBachProng() const { return PID::getCharge(mPIDBachProng); }
142
143 float calcMass2(float p2Pos, float p2Neg, float p2Bach, float p2Tot) const
144 {
145 // calculate v0 mass from squared momentum of its prongs and total momentum
146 float ePos = std::sqrt(p2Pos + getMass2PosProng()), eNeg = std::sqrt(p2Neg + getMass2NegProng()), eBach = std::sqrt(p2Bach + getMass2BachProng()), eVtx = ePos + eNeg + eBach;
147 return eVtx * eVtx - p2Tot;
148 }
149
150 float calcMass(float p2Pos, float p2Neg, float p2Bach, float p2Tot) const { return std::sqrt(calcMass2(p2Pos, p2Neg, p2Bach, p2Tot)); }
151
152 bool check(float p2Pos, float p2Neg, float p2Bach, float p2Tot, float ptV0) const
153 { // check if given mass and pt is matching to hypothesis
154 return check(calcMass(p2Pos, p2Neg, p2Bach, p2Tot), ptV0);
155 }
156
157 bool check(float mass, float pt) const
158 { // check if given mass and pt is matching to hypothesis
159 return std::abs(mass - getMassV0Hyp()) < getMargin(pt);
160 }
161
162 float getSigma(float pt) const { return mPars[SigmaM] * (1.f + mPars[CPt] * pt); }
163 float getMargin(float pt) const { return mPars[NSigmaM] * getSigma(pt) + mPars[MarginM]; }
164
165 private:
166 float getMass2PosProng() const { return PID::getMass2(mPIDPosProng); }
167 float getMass2NegProng() const { return PID::getMass2(mPIDNegProng); }
168 float getMass2BachProng() const { return PID::getMass2(mPIDBachProng); }
169
170 PID mPIDV0{PID::HyperTriton};
171 PID mPIDPosProng{PID::Proton};
172 PID mPIDNegProng{PID::Pion};
173 PID mPIDBachProng{PID::Deuteron};
174
175 public: // to be deleted
176 std::array<float, NPIDParams> mPars{};
177
179};
180
181} // namespace vertexing
182} // namespace o2
183
184#endif
particle ids, masses, names class definition
static constexpr ID HyperTriton
Definition PID.h:113
static constexpr ID Lambda
Definition PID.h:112
static constexpr ID Pion
Definition PID.h:96
static constexpr ID Deuteron
Definition PID.h:99
static constexpr ID K0
Definition PID.h:111
static constexpr ID OmegaMinus
Definition PID.h:116
static constexpr ID Proton
Definition PID.h:98
static constexpr ID XiMinus
Definition PID.h:115
float calcMass(float p2Pos, float p2Neg, float p2Bach, float p2Tot) const
std::array< float, NPIDParams > mPars
void set(PID v0, PID ppos, PID pneg, PID pbach, float sig, float nSig, float margin, float cpt, float bz=0.f)
bool check(float p2Pos, float p2Neg, float p2Bach, float p2Tot, float ptV0) const
bool check(float mass, float pt) const
ClassDefNV(SVertex3Hypothesis, 1)
float calcMass2(float p2Pos, float p2Neg, float p2Bach, float p2Tot) const
bool check(float p2Pos, float p2Neg, float p2V0, float ptV0) const
void set(PID v0, PID ppos, PID pneg, float sig, float nSig, float margin, float nSigTight, float marginTight, float cpt, float cpt1, float cpt2, float cpt3, float bz=0.f, float maxSigma=0.01)
float calcMass(float p2Pos, float p2Neg, float p2V0) const
std::array< float, NPIDParams > mPars
bool checkTight(float p2Pos, float p2Neg, float p2V0, float ptV0) const
bool checkTight(float mass, float pt) const
ClassDefNV(SVertexHypothesis, 2)
bool check(float mass, float pt) const
float getSigmaV0Cascade(float pt) const
float getMargin(float pt, bool tight=false) const
float calcMass2(float p2Pos, float p2Neg, float p2V0) const
GLfloat v0
Definition glcorearb.h:811
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...