Skip to content

Commit 454b053

Browse files
authored
Refactor V0 builder, add link table (#499)
1 parent 5bd01db commit 454b053

2 files changed

Lines changed: 120 additions & 127 deletions

File tree

Common/DataModel/StrangenessTables.h

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ namespace o2::aod
1919
{
2020
namespace v0data
2121
{
22-
//Needed to have shorter table that does not rely on existing one (filtering!)
22+
// Needed to have shorter table that does not rely on existing one (filtering!)
2323
DECLARE_SOA_INDEX_COLUMN_FULL(PosTrack, posTrack, int, Tracks, "_Pos"); //!
2424
DECLARE_SOA_INDEX_COLUMN_FULL(NegTrack, negTrack, int, Tracks, "_Neg"); //!
2525
DECLARE_SOA_INDEX_COLUMN(Collision, collision); //!
2626
DECLARE_SOA_INDEX_COLUMN(V0, v0); //!
2727

28-
//General V0 properties: position, momentum
28+
// General V0 properties: position, momentum
2929
DECLARE_SOA_COLUMN(PosX, posX, float); //! positive track X at min
3030
DECLARE_SOA_COLUMN(NegX, negX, float); //! negative track X at min
3131
DECLARE_SOA_COLUMN(PxPos, pxpos, float); //! positive track px at min
@@ -38,47 +38,47 @@ DECLARE_SOA_COLUMN(X, x, float); //! decay position X
3838
DECLARE_SOA_COLUMN(Y, y, float); //! decay position Y
3939
DECLARE_SOA_COLUMN(Z, z, float); //! decay position Z
4040

41-
//Saved from finding: DCAs
41+
// Saved from finding: DCAs
4242
DECLARE_SOA_COLUMN(DCAV0Daughters, dcaV0daughters, float); //! DCA between V0 daughters
4343
DECLARE_SOA_COLUMN(DCAPosToPV, dcapostopv, float); //! DCA positive prong to PV
4444
DECLARE_SOA_COLUMN(DCANegToPV, dcanegtopv, float); //! DCA negative prong to PV
4545

46-
//Derived expressions
47-
//Momenta
46+
// Derived expressions
47+
// Momenta
4848
DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //! V0 pT
4949
[](float pxpos, float pypos, float pxneg, float pyneg) -> float { return RecoDecay::sqrtSumOfSquares(pxpos + pxneg, pypos + pyneg); });
5050

51-
//Length quantities
51+
// Length quantities
5252
DECLARE_SOA_DYNAMIC_COLUMN(V0Radius, v0radius, //! V0 decay radius (2D, centered at zero)
5353
[](float x, float y) -> float { return RecoDecay::sqrtSumOfSquares(x, y); });
5454

55-
//Distance Over To Mom
55+
// Distance Over To Mom
5656
DECLARE_SOA_DYNAMIC_COLUMN(DistOverTotMom, distovertotmom, //! PV to V0decay distance over total momentum
5757
[](float X, float Y, float Z, float Px, float Py, float Pz, float pvX, float pvY, float pvZ) {
5858
float P = RecoDecay::sqrtSumOfSquares(Px, Py, Pz);
5959
return std::sqrt(std::pow(X - pvX, 2) + std::pow(Y - pvY, 2) + std::pow(Z - pvZ, 2)) / (P + 1E-10);
6060
});
6161

62-
//CosPA
62+
// CosPA
6363
DECLARE_SOA_DYNAMIC_COLUMN(V0CosPA, v0cosPA, //! V0 CosPA
6464
[](float X, float Y, float Z, float Px, float Py, float Pz, float pvX, float pvY, float pvZ) -> float { return RecoDecay::CPA(array{pvX, pvY, pvZ}, array{X, Y, Z}, array{Px, Py, Pz}); });
6565
DECLARE_SOA_DYNAMIC_COLUMN(DCAV0ToPV, dcav0topv, //! DCA of V0 to PV
6666
[](float X, float Y, float Z, float Px, float Py, float Pz, float pvX, float pvY, float pvZ) -> float { return std::sqrt((std::pow((pvY - Y) * Pz - (pvZ - Z) * Py, 2) + std::pow((pvX - X) * Pz - (pvZ - Z) * Px, 2) + std::pow((pvX - X) * Py - (pvY - Y) * Px, 2)) / (Px * Px + Py * Py + Pz * Pz)); });
6767

68-
//Armenteros-Podolanski variables
68+
// Armenteros-Podolanski variables
6969
DECLARE_SOA_DYNAMIC_COLUMN(Alpha, alpha, //! Armenteros Alpha
7070
[](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) {
7171
float momTot = RecoDecay::P(pxpos + pxneg, pypos + pyneg, pzpos + pzneg);
7272
float lQlNeg = RecoDecay::dotProd(array{pxneg, pyneg, pzneg}, array{pxpos + pxneg, pypos + pyneg, pzpos + pzneg}) / momTot;
7373
float lQlPos = RecoDecay::dotProd(array{pxpos, pypos, pzpos}, array{pxpos + pxneg, pypos + pyneg, pzpos + pzneg}) / momTot;
74-
return (lQlPos - lQlNeg) / (lQlPos + lQlNeg); //alphav0
74+
return (lQlPos - lQlNeg) / (lQlPos + lQlNeg); // alphav0
7575
});
7676

7777
DECLARE_SOA_DYNAMIC_COLUMN(QtArm, qtarm, //! Armenteros Qt
7878
[](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) {
7979
float momTot = RecoDecay::P2(pxpos + pxneg, pypos + pyneg, pzpos + pzneg);
8080
float dp = RecoDecay::dotProd(array{pxneg, pyneg, pzneg}, array{pxpos + pxneg, pypos + pyneg, pzpos + pzneg});
81-
return std::sqrt(RecoDecay::P2(pxneg, pyneg, pzneg) - dp * dp / momTot); //qtarm
81+
return std::sqrt(RecoDecay::P2(pxneg, pyneg, pzneg) - dp * dp / momTot); // qtarm
8282
});
8383

8484
// Psi pair angle: angle between the plane defined by the electron and positron momenta and the xy plane
@@ -93,7 +93,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(PsiPair, psipair, //! psi pair angle
9393
return std::asin(clipToPM1(argsin));
9494
});
9595

96-
//Calculated on the fly with mass assumption + dynamic tables
96+
// Calculated on the fly with mass assumption + dynamic tables
9797
DECLARE_SOA_DYNAMIC_COLUMN(MLambda, mLambda, //! mass under lambda hypothesis
9898
[](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { return RecoDecay::M(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, array{RecoDecay::getMassPDG(kProton), RecoDecay::getMassPDG(kPiPlus)}); });
9999
DECLARE_SOA_DYNAMIC_COLUMN(MAntiLambda, mAntiLambda, //! mass under antilambda hypothesis
@@ -141,7 +141,7 @@ DECLARE_SOA_TABLE_FULL(StoredV0Datas, "V0Datas", "AOD", "V0DATA", //!
141141
v0data::PxNeg, v0data::PyNeg, v0data::PzNeg,
142142
v0data::DCAV0Daughters, v0data::DCAPosToPV, v0data::DCANegToPV,
143143

144-
//Dynamic columns
144+
// Dynamic columns
145145
v0data::Pt<v0data::PxPos, v0data::PyPos, v0data::PxNeg, v0data::PyNeg>,
146146
v0data::V0Radius<v0data::X, v0data::Y>,
147147
v0data::DistOverTotMom<v0data::X, v0data::Y, v0data::Z, v0data::Px, v0data::Py, v0data::Pz>,
@@ -151,13 +151,13 @@ DECLARE_SOA_TABLE_FULL(StoredV0Datas, "V0Datas", "AOD", "V0DATA", //!
151151
v0data::QtArm<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
152152
v0data::PsiPair<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
153153

154-
//Invariant masses
154+
// Invariant masses
155155
v0data::MLambda<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
156156
v0data::MAntiLambda<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
157157
v0data::MK0Short<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
158158
v0data::MGamma<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
159159

160-
//Longitudinal
160+
// Longitudinal
161161
v0data::YK0Short<v0data::Px, v0data::Py, v0data::Pz>,
162162
v0data::YLambda<v0data::Px, v0data::Py, v0data::Pz>,
163163
v0data::Eta<v0data::Px, v0data::Py, v0data::Pz>,
@@ -174,13 +174,24 @@ DECLARE_SOA_EXTENDED_TABLE_USER(V0Datas, StoredV0Datas, "V0DATAEXT", //!
174174
v0data::Px, v0data::Py, v0data::Pz); // the table name has here to be the one with EXT which is not nice and under study
175175

176176
using V0Data = V0Datas::iterator;
177+
namespace v0data
178+
{
179+
DECLARE_SOA_INDEX_COLUMN(V0Data, v0Data); //! Index to V0Data entry
180+
}
181+
182+
DECLARE_SOA_TABLE(V0DataLink, "AOD", "V0DATALINK", //! Joinable table with V0s which links to V0Data which is not produced for all entries
183+
v0data::V0DataId);
184+
185+
using V0sLinked = soa::Join<V0s, V0DataLink>;
186+
using V0Linked = V0sLinked::iterator;
187+
177188
namespace cascdata
178189
{
179-
//Necessary for full filtering functionality
190+
// Necessary for full filtering functionality
180191
DECLARE_SOA_INDEX_COLUMN(V0, v0); //!
181192
DECLARE_SOA_INDEX_COLUMN_FULL(Bachelor, bachelor, int, Tracks, ""); //!
182193
DECLARE_SOA_INDEX_COLUMN(Collision, collision); //!
183-
//General cascade properties: position, momentum
194+
// General cascade properties: position, momentum
184195
DECLARE_SOA_COLUMN(Sign, sign, int); //!
185196
DECLARE_SOA_COLUMN(PxPos, pxpos, float); //!
186197
DECLARE_SOA_COLUMN(PyPos, pypos, float); //!
@@ -198,25 +209,25 @@ DECLARE_SOA_COLUMN(Xlambda, xlambda, float); //!
198209
DECLARE_SOA_COLUMN(Ylambda, ylambda, float); //!
199210
DECLARE_SOA_COLUMN(Zlambda, zlambda, float); //!
200211

201-
//Saved from finding: DCAs
212+
// Saved from finding: DCAs
202213
DECLARE_SOA_COLUMN(DCAV0Daughters, dcaV0daughters, float); //!
203214
DECLARE_SOA_COLUMN(DCACascDaughters, dcacascdaughters, float); //!
204215
DECLARE_SOA_COLUMN(DCAPosToPV, dcapostopv, float); //!
205216
DECLARE_SOA_COLUMN(DCANegToPV, dcanegtopv, float); //!
206217
DECLARE_SOA_COLUMN(DCABachToPV, dcabachtopv, float); //!
207218

208-
//Derived expressions
209-
//Momenta
219+
// Derived expressions
220+
// Momenta
210221
DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //!
211222
[](float Px, float Py) -> float { return RecoDecay::sqrtSumOfSquares(Px, Py); });
212223

213-
//Length quantities
224+
// Length quantities
214225
DECLARE_SOA_DYNAMIC_COLUMN(V0Radius, v0radius, //!
215226
[](float xlambda, float ylambda) -> float { return RecoDecay::sqrtSumOfSquares(xlambda, ylambda); });
216227
DECLARE_SOA_DYNAMIC_COLUMN(CascRadius, cascradius, //!
217228
[](float x, float y) -> float { return RecoDecay::sqrtSumOfSquares(x, y); });
218229

219-
//CosPAs
230+
// CosPAs
220231
DECLARE_SOA_DYNAMIC_COLUMN(V0CosPA, v0cosPA, //!
221232
[](float Xlambda, float Ylambda, float Zlambda, float PxLambda, float PyLambda, float PzLambda, float pvX, float pvY, float pvZ) -> float { return RecoDecay::CPA(array{pvX, pvY, pvZ}, array{Xlambda, Ylambda, Zlambda}, array{PxLambda, PyLambda, PzLambda}); });
222233
DECLARE_SOA_DYNAMIC_COLUMN(CascCosPA, casccosPA, //!
@@ -226,10 +237,10 @@ DECLARE_SOA_DYNAMIC_COLUMN(DCAV0ToPV, dcav0topv, //!
226237
DECLARE_SOA_DYNAMIC_COLUMN(DCACascToPV, dcacasctopv, //!
227238
[](float X, float Y, float Z, float Px, float Py, float Pz, float pvX, float pvY, float pvZ) -> float { return std::sqrt((std::pow((pvY - Y) * Pz - (pvZ - Z) * Py, 2) + std::pow((pvX - X) * Pz - (pvZ - Z) * Px, 2) + std::pow((pvX - X) * Py - (pvY - Y) * Px, 2)) / (Px * Px + Py * Py + Pz * Pz)); });
228239

229-
//Calculated on the fly with mass assumption + dynamic tables
240+
// Calculated on the fly with mass assumption + dynamic tables
230241
DECLARE_SOA_DYNAMIC_COLUMN(MLambda, mLambda, //!
231242
[](int charge, float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { return RecoDecay::M(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, charge < 0 ? array{RecoDecay::getMassPDG(kProton), RecoDecay::getMassPDG(kPiPlus)} : array{RecoDecay::getMassPDG(kPiPlus), RecoDecay::getMassPDG(kProton)}); });
232-
//Calculated on the fly with mass assumption + dynamic tables
243+
// Calculated on the fly with mass assumption + dynamic tables
233244

234245
DECLARE_SOA_DYNAMIC_COLUMN(MXi, mXi, //!
235246
[](float pxbach, float pybach, float pzbach, float PxLambda, float PyLambda, float PzLambda) -> float { return RecoDecay::M(array{array{pxbach, pybach, pzbach}, array{PxLambda, PyLambda, PzLambda}}, array{RecoDecay::getMassPDG(kPiPlus), RecoDecay::getMassPDG(kLambda0)}); });
@@ -272,7 +283,7 @@ DECLARE_SOA_TABLE(CascData, "AOD", "CASCDATA", //!
272283
cascdata::DCAV0Daughters, cascdata::DCACascDaughters,
273284
cascdata::DCAPosToPV, cascdata::DCANegToPV, cascdata::DCABachToPV,
274285

275-
//Dynamic columns
286+
// Dynamic columns
276287
cascdata::Pt<cascdataext::Px, cascdataext::Py>,
277288
cascdata::V0Radius<cascdata::Xlambda, cascdata::Ylambda>,
278289
cascdata::CascRadius<cascdata::X, cascdata::Y>,
@@ -281,11 +292,11 @@ DECLARE_SOA_TABLE(CascData, "AOD", "CASCDATA", //!
281292
cascdata::DCAV0ToPV<cascdata::Xlambda, cascdata::Ylambda, cascdata::Zlambda, cascdataext::PxLambda, cascdataext::PyLambda, cascdataext::PzLambda>,
282293
cascdata::DCACascToPV<cascdata::X, cascdata::Y, cascdata::Z, cascdataext::Px, cascdataext::Py, cascdataext::Pz>,
283294

284-
//Invariant masses
295+
// Invariant masses
285296
cascdata::MLambda<cascdata::Sign, cascdata::PxPos, cascdata::PyPos, cascdata::PzPos, cascdata::PxNeg, cascdata::PyNeg, cascdata::PzNeg>,
286297
cascdata::MXi<cascdata::PxBach, cascdata::PyBach, cascdata::PzBach, cascdataext::PxLambda, cascdataext::PyLambda, cascdataext::PzLambda>,
287298
cascdata::MOmega<cascdata::PxBach, cascdata::PyBach, cascdata::PzBach, cascdataext::PxLambda, cascdataext::PyLambda, cascdataext::PzLambda>,
288-
//Longitudinal
299+
// Longitudinal
289300
cascdata::YXi<cascdataext::Px, cascdataext::Py, cascdataext::Pz>,
290301
cascdata::YOmega<cascdataext::Px, cascdataext::Py, cascdataext::Pz>,
291302
cascdata::Eta<cascdataext::Px, cascdataext::Py, cascdataext::Pz>);
@@ -301,9 +312,9 @@ using CascDataFull = CascDataExt;
301312

302313
namespace v0ind
303314
{
304-
DECLARE_SOA_INDEX_COLUMN(V0, v0); //the biggest object
305-
DECLARE_SOA_INDEX_COLUMN(V0Data, v0data); //the skimmed object
306-
DECLARE_SOA_INDEX_COLUMN(Cascade, cascade); //the part that will use the previous ones
315+
DECLARE_SOA_INDEX_COLUMN(V0, v0); // the biggest object
316+
DECLARE_SOA_INDEX_COLUMN(V0Data, v0data); // the skimmed object
317+
DECLARE_SOA_INDEX_COLUMN(Cascade, cascade); // the part that will use the previous ones
307318
} // namespace v0ind
308319
DECLARE_SOA_INDEX_TABLE_EXCLUSIVE_USER(MatchedV0Cascades, V0s, "MATCHEDV0CASC", v0ind::V0DataId, v0ind::V0Id, v0ind::CascadeId);
309320

0 commit comments

Comments
 (0)