Skip to content

Commit de67792

Browse files
committed
Restore resonance soft links and initializer tutorial
1 parent 81c280e commit de67792

5 files changed

Lines changed: 372 additions & 110 deletions

File tree

PWGLF/DataModel/LFResonanceTables.h

Lines changed: 51 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace resocollision
4646
{
4747
enum {
4848
kECbegin = 0,
49-
kINEL = 1,
49+
kINEL,
5050
kINEL10,
5151
kINELg0,
5252
kINELg010,
@@ -64,15 +64,15 @@ enum {
6464
kAllCutsINELg010,
6565
kECend,
6666
};
67-
DECLARE_SOA_COLUMN(CollisionId, collisionId, int); //! Original collision row ID stored as a scalar for standalone derived data
68-
DECLARE_SOA_COLUMN(Cent, cent, float); //! Centrality (Multiplicity) percentile (Default: FT0M)
69-
DECLARE_SOA_COLUMN(Spherocity, spherocity, float); //! Spherocity of the event
70-
DECLARE_SOA_COLUMN(EvtPl, evtPl, float); //! Second harmonic event plane
71-
DECLARE_SOA_COLUMN(EvtPlResAB, evtPlResAB, float); //! Second harmonic event plane resolution of A-B sub events
72-
DECLARE_SOA_COLUMN(EvtPlResAC, evtPlResAC, float); //! Second harmonic event plane resolution of A-C sub events
73-
DECLARE_SOA_COLUMN(EvtPlResBC, evtPlResBC, float); //! Second harmonic event plane resolution of B-C sub events
74-
DECLARE_SOA_COLUMN(BMagField, bMagField, float); //! Magnetic field
75-
DECLARE_SOA_COLUMN(IsRecINELgt0, isRecINELgt0, bool); //! Is reconstructed INEL>0 event
67+
DECLARE_SOA_INDEX_COLUMN_FULL(Collision, collision, int, Collisions, "_Col"); //!
68+
DECLARE_SOA_COLUMN(Cent, cent, float); //! Centrality (Multiplicity) percentile (Default: FT0M)
69+
DECLARE_SOA_COLUMN(Spherocity, spherocity, float); //! Spherocity of the event
70+
DECLARE_SOA_COLUMN(EvtPl, evtPl, float); //! Second harmonic event plane
71+
DECLARE_SOA_COLUMN(EvtPlResAB, evtPlResAB, float); //! Second harmonic event plane resolution of A-B sub events
72+
DECLARE_SOA_COLUMN(EvtPlResAC, evtPlResAC, float); //! Second harmonic event plane resolution of A-C sub events
73+
DECLARE_SOA_COLUMN(EvtPlResBC, evtPlResBC, float); //! Second harmonic event plane resolution of B-C sub events
74+
DECLARE_SOA_COLUMN(BMagField, bMagField, float); //! Magnetic field
75+
DECLARE_SOA_COLUMN(IsRecINELgt0, isRecINELgt0, bool); //! Is reconstructed INEL>0 event
7676
// MC
7777
DECLARE_SOA_COLUMN(IsVtxIn10, isVtxIn10, bool); //! Vtx10
7878
DECLARE_SOA_COLUMN(IsINELgt0, isINELgt0, bool); //! INEL>0
@@ -164,6 +164,9 @@ struct ResoTrackFlags {
164164
return (flags & mask) == mask;
165165
}
166166
};
167+
// These macros build framework expression nodes and cannot be replaced by
168+
// ordinary constexpr functions without changing their public DSL API.
169+
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
167170
#define requireTrackFlag(mask) ((o2::aod::resodaughter::trackFlags & o2::aod::resodaughter::mask) == o2::aod::resodaughter::mask)
168171

169172
#define requirePassedITSRefit() requireTrackFlag(ResoTrackFlags::kPassedITSRefit)
@@ -177,19 +180,23 @@ struct ResoTrackFlags {
177180

178181
#define DECLARE_DYN_TRKSEL_COLUMN(_Name_, _Getter_, _Mask_) \
179182
DECLARE_SOA_DYNAMIC_COLUMN(_Name_, _Getter_, [](ResoTrackFlags::flagtype flags) -> bool { return ResoTrackFlags::checkFlag(flags, _Mask_); });
183+
// NOLINTEND(cppcoreguidelines-macro-usage)
180184

181185
DECLARE_SOA_INDEX_COLUMN(ResoCollision, resoCollision);
182186
DECLARE_SOA_INDEX_COLUMN(ResoCollisionDF, resoCollisionDF);
183-
DECLARE_SOA_COLUMN(TrackId, trackId, int); //! Original track row ID stored as a scalar for autocorrelation rejection
184-
DECLARE_SOA_COLUMN(V0Id, v0Id, int); //! Original V0 row ID stored as a scalar
185-
DECLARE_SOA_COLUMN(CascadeId, cascadeId, int); //! Original cascade row ID stored as a scalar
186-
DECLARE_SOA_COLUMN(Pt, pt, float); //! p_t (GeV/c)
187-
DECLARE_SOA_COLUMN(Px, px, float); //! p_x (GeV/c)
188-
DECLARE_SOA_COLUMN(Py, py, float); //! p_y (GeV/c)
189-
DECLARE_SOA_COLUMN(Pz, pz, float); //! p_z (GeV/c)
190-
DECLARE_SOA_COLUMN(PartType, partType, uint8_t); //! Type of the particle, according to resodaughter::ParticleType
191-
DECLARE_SOA_COLUMN(TempFitVar, tempFitVar, float); //! Observable for the template fitting (Track: DCA_xy, V0: CPA)
192-
DECLARE_SOA_COLUMN(Indices, indices, int[2]); //! Field for the track indices to remove auto-correlations
187+
DECLARE_SOA_INDEX_COLUMN_FULL(Track, track, int, Tracks, "_Trk"); //! Soft link to the original track
188+
DECLARE_SOA_INDEX_COLUMN_FULL(V0, v0, int, V0s, "_V0"); //! Soft link to the original V0
189+
DECLARE_SOA_INDEX_COLUMN_FULL(Cascade, cascade, int, Cascades, "_Cas"); //! Soft link to the original cascade
190+
DECLARE_SOA_COLUMN(Pt, pt, float); //! p_t (GeV/c)
191+
DECLARE_SOA_COLUMN(Px, px, float); //! p_x (GeV/c)
192+
DECLARE_SOA_COLUMN(Py, py, float); //! p_y (GeV/c)
193+
DECLARE_SOA_COLUMN(Pz, pz, float); //! p_z (GeV/c)
194+
DECLARE_SOA_COLUMN(PartType, partType, uint8_t); //! Type of the particle, according to resodaughter::ParticleType
195+
DECLARE_SOA_COLUMN(TempFitVar, tempFitVar, float); //! Observable for the template fitting (Track: DCA_xy, V0: CPA)
196+
// Fixed-size C arrays are part of the existing persistent AOD schema.
197+
// NOLINTNEXTLINE(modernize-avoid-c-arrays)
198+
DECLARE_SOA_COLUMN(Indices, indices, int[2]); //! Field for the track indices to remove auto-correlations
199+
// NOLINTNEXTLINE(modernize-avoid-c-arrays)
193200
DECLARE_SOA_COLUMN(CascadeIndices, cascadeIndices, int[3]); //! Field for the track indices to remove auto-correlations (ordered: positive, negative, bachelor)
194201
DECLARE_SOA_COLUMN(TpcNClsCrossedRows, tpcNClsCrossedRows, uint8_t); //! Number of TPC crossed rows
195202
DECLARE_SOA_COLUMN(TpcNClsFound, tpcNClsFound, uint8_t); //! Number of TPC clusters found
@@ -251,9 +258,10 @@ DECLARE_SOA_COLUMN(DaughterPDG1, daughterPDG1, int); //! PDG code of the first D
251258
DECLARE_SOA_COLUMN(DaughterPDG2, daughterPDG2, int); //! PDG code of the second Daughter particle
252259
DECLARE_SOA_COLUMN(DaughterID1, daughterID1, int); //! Id of the first Daughter particle
253260
DECLARE_SOA_COLUMN(DaughterID2, daughterID2, int); //! Id of the second Daughter particle
254-
DECLARE_SOA_COLUMN(SiblingIds, siblingIds, int[2]); //! Index of the particles with the same mother
255-
DECLARE_SOA_COLUMN(BachTrkID, bachTrkID, int); //! Id of the bach track from cascade
256-
DECLARE_SOA_COLUMN(V0ID, v0ID, int); //! Id of the V0 from cascade
261+
// NOLINTNEXTLINE(modernize-avoid-c-arrays) -- persistent fixed-size AOD column
262+
DECLARE_SOA_COLUMN(SiblingIds, siblingIds, int[2]); //! Index of the particles with the same mother
263+
DECLARE_SOA_COLUMN(BachTrkID, bachTrkID, int); //! Id of the bach track from cascade
264+
DECLARE_SOA_COLUMN(V0ID, v0ID, int); //! Id of the V0 from cascade
257265
// Dynamic columns
258266
// DCA_xy x10,000
259267
DECLARE_SOA_DYNAMIC_COLUMN(DcaXY, dcaXY,
@@ -377,29 +385,34 @@ struct PidNSigma {
377385
static uint8_t encodeNSigma(float nSigma)
378386
{
379387
const float x = std::abs(nSigma);
380-
if (x <= MinNSigma)
388+
if (x <= MinNSigma) {
381389
return 0; // Return 0 when absolute nSigma is smaller than 1.5
390+
}
382391
float t = (x - MinNSigma) / NSigmaStep;
383392
int encoded = static_cast<int>(std::ceil(t)); // (1.5,1.7]->1, ..., (3.3,3.5]->10
384-
if (encoded < 1)
393+
if (encoded < 1) {
385394
encoded = 1;
386-
if (encoded > MaxNSigmaCode)
395+
}
396+
if (encoded > MaxNSigmaCode) {
387397
encoded = MaxNSigmaCode;
398+
}
388399
return static_cast<uint8_t>(encoded);
389400
}
390401

391402
/// @brief Decode 0~10 value to original 1.5~3.5 sigma range
392403
static float decodeNSigma(uint8_t encoded)
393404
{
394-
if (encoded == 0)
405+
if (encoded == 0) {
395406
return MinNSigma;
396-
if (encoded > MaxNSigmaCode)
407+
}
408+
if (encoded > MaxNSigmaCode) {
397409
encoded = MaxNSigmaCode;
410+
}
398411
return MinNSigma + static_cast<float>(encoded) * NSigmaStep;
399412
}
400413

401414
/// @brief Check if TOF info is available
402-
bool hasTOF() const
415+
[[nodiscard]] bool hasTOF() const
403416
{
404417
return (flag & 0x0F) != 0x0F; // Check if lower 4 bits are not all 1
405418
}
@@ -443,8 +456,8 @@ struct ResoMicroTrackSelFlag {
443456

444457
/// @brief Default constructor
445458
ResoMicroTrackSelFlag()
459+
: flag(0x00)
446460
{
447-
flag = 0x00;
448461
}
449462

450463
/// @brief Constructor: Convert DCAxy/DCAz and save (default 1~15 values)
@@ -459,13 +472,16 @@ struct ResoMicroTrackSelFlag {
459472
static uint8_t encodeDCA(float DCA)
460473
{
461474
float x = std::fabs(DCA);
462-
if (x < DCAEncodingStep)
475+
if (x < DCAEncodingStep) {
463476
return 0;
477+
}
464478
int encoded = static_cast<int>(std::ceil((x - DCAEncodingStep) / DCAEncodingStep)); // (0.1, 0.2] -> 1, ..., (1.4, 1.5] -> 14
465-
if (encoded < 1)
479+
if (encoded < 1) {
466480
encoded = 1;
467-
if (encoded > MaxRegularDCAFlag)
481+
}
482+
if (encoded > MaxRegularDCAFlag) {
468483
encoded = OverflowDCAFlag;
484+
}
469485
return static_cast<uint8_t>(encoded);
470486
}
471487

@@ -476,13 +492,13 @@ struct ResoMicroTrackSelFlag {
476492
}
477493

478494
/// @brief Get DCAxy value
479-
uint8_t getDCAxyFlag() const
495+
[[nodiscard]] uint8_t getDCAxyFlag() const
480496
{
481497
return (flag >> 4) & 0x0F; // Extract upper 4 bits
482498
}
483499

484500
/// @brief Get DCAz value
485-
uint8_t getDCAzFlag() const
501+
[[nodiscard]] uint8_t getDCAzFlag() const
486502
{
487503
return flag & 0x0F; // Extract lower 4 bits
488504
}

PWGLF/TableProducer/Resonances/resonanceInitializer.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ struct ResonanceInitializer {
818818
v0.v0radius(), v0.x(), v0.y(), v0.z(),
819819
v0.alpha(), v0.qtarm());
820820
if (!cfgBypassTrackIndexFill) {
821-
resoV0V0s(v0.globalIndex());
821+
resoV0V0s(v0.v0Id());
822822
}
823823
if constexpr (isMC) {
824824
fillMCV0(v0);
@@ -881,7 +881,7 @@ struct ResonanceInitializer {
881881
casc.mXi(),
882882
casc.v0radius(), casc.cascradius(), casc.x(), casc.y(), casc.z());
883883
if (!cfgBypassTrackIndexFill) {
884-
resoCascadeCascades(casc.globalIndex());
884+
resoCascadeCascades(casc.cascadeId());
885885
}
886886
if constexpr (isMC) {
887887
fillMCCascade(casc);

0 commit comments

Comments
 (0)