@@ -61,6 +61,17 @@ namespace o2
6161 return static_cast <uint8_t >(std::clamp (roundValue, 0 , 255 ));
6262 }
6363
64+ // / It compresses a value to a uint16_t with a given precision
65+ // /\param origValue is the original values
66+ // /\param precision is the desired precision
67+ // /\return The value compressed to a uint16_t
68+ template <typename T>
69+ uint16_t getCompressedUint16 (T origValue, double precision)
70+ {
71+ int roundValue = static_cast <int >(std::round (origValue / precision));
72+ return static_cast <uint16_t >(std::clamp (roundValue, 0 , 65535 ));
73+ }
74+
6475 // / It uses a sinh-based scaling function, which provides a compromise between fixed-step and relative quantization.
6576 // This approach reflects typical resolution formulas and is well-suited for detector calibration data.
6677 // /\param origValue is the original value
@@ -108,7 +119,7 @@ namespace o2
108119 template <typename T>
109120 int8_t getCompressedCosPa (T cosPa)
110121 {
111- return getCompressedUint8 (cosPa - 0.25 , 0.001 ); // in the range from 0.75 to 1
122+ return getCompressedUint8 (cosPa - 0.75 , 0.001 ); // in the range from 0.75 to 1
112123 }
113124
114125 // / It compresses the chi2
@@ -131,6 +142,24 @@ namespace o2
131142 return compressedNumSigma;
132143 }
133144
145+ // / It compresses the bdt score (1./65535 precision)
146+ // /\param bdtScore is the bdt score
147+ // /\return The bdt score compressed to a uint16_t with 1./65535 precision
148+ template <typename T>
149+ uint16_t getCompressedBdtScoreBkg (T bdtScore)
150+ {
151+ return getCompressedUint16 (bdtScore, 1 ./65535 );
152+ }
153+
154+ // / It compresses the bdt score (1./255 precision)
155+ // /\param bdtScore is the bdt score
156+ // /\return The bdt score compressed to a uint8_t with 1./255 precision
157+ template <typename T>
158+ uint8_t getCompressedBdtScoreSgn (T bdtScore)
159+ {
160+ return getCompressedUint8 (bdtScore, 1 ./255 );
161+ }
162+
134163 // / It compresses the number of sigma (0.1 sigma precision)
135164 // /\param occupancy is the occupancy value
136165 // /\return The number of sigma compressed to a int8_t with 0.1 precision
@@ -174,11 +203,11 @@ namespace o2
174203 0 ,
175204 1.0 ,
176205 2.0 ,
206+ 3.0 ,
177207 4.0 ,
178208 6.0 ,
179209 8.0 ,
180210 12.0 ,
181- 16.0 ,
182211 24.0 ,
183212 50.0 ,
184213 1000.0 };
@@ -187,12 +216,12 @@ namespace o2
187216 // default values for the cuts
188217 constexpr float CutsCand[NBinsPtCand][NCutVarsCand] = {{0.400 , 0 ., 10 ., 10 ., 0.97 , 0.97 , 0 , 2 , 0.01 , 0.01 }, /* 0 < pT < 1 */
189218 {0.400 , 0 ., 10 ., 10 ., 0.97 , 0.97 , 0 , 2 , 0.01 , 0.01 }, /* 1 < pT < 2 */
190- {0.400 , 0 ., 10 ., 10 ., 0.95 , 0.95 , 0 , 2 , 0.01 , 0.01 }, /* 2 < pT < 4 */
219+ {0.400 , 0 ., 10 ., 10 ., 0.95 , 0.95 , 0 , 2 , 0.01 , 0.01 }, /* 2 < pT < 3 */
220+ {0.400 , 0 ., 10 ., 10 ., 0.95 , 0.95 , 0 , 2 , 0.01 , 0.01 }, /* 3 < pT < 4 */
191221 {0.400 , 0 ., 10 ., 10 ., 0.95 , 0.95 , 0 , 2 , 0.01 , 0.01 }, /* 4 < pT < 6 */
192222 {0.400 , 0 ., 10 ., 10 ., 0.95 , 0.95 , 0 , 2 , 0.01 , 0.01 }, /* 6 < pT < 8 */
193223 {0.400 , 0 ., 10 ., 10 ., 0.95 , 0.95 , 0 , 2 , 0.01 , 0.01 }, /* 8 < pT < 12 */
194- {0.400 , 0 ., 10 ., 10 ., 0.95 , 0.95 , 0 , 2 , 0.01 , 0.01 }, /* 12 < pT < 16 */
195- {0.400 , 0 ., 10 ., 10 ., 0.95 , 0.95 , 0 , 2 , 0.01 , 0.01 }, /* 16 < pT < 24 */
224+ {0.400 , 0 ., 10 ., 10 ., 0.95 , 0.95 , 0 , 2 , 0.01 , 0.01 }, /* 12 < pT < 24 */
196225 {0.400 , 0 ., 10 ., 10 ., 0.95 , 0.95 , 0 , 2 , 0.01 , 0.01 }, /* 24 < pT < 50 */
197226 {0.400 , 0 ., 10 ., 10 ., 0.95 , 0.95 , 0 , 2 , 0.01 , 0.01 }}; /* 50 < pT < 1000 */
198227
@@ -211,6 +240,51 @@ namespace o2
211240
212241 // column labels
213242 static const std::vector<std::string> labelsCutVarCand = {" delta inv. mass" , " max d0d0" , " max pointing angle" , " max pointing angle XY" , " min cos pointing angle" , " min cos pointing angle xy" , " min norm decay length" , " min norm decay length XY" , " min decay length" , " min decay length XY" };
243+
244+ static constexpr int NBinsPtMl = 10 ;
245+ // default values for the pT bin edges (can be used to configure histogram axis)
246+ // offset by 1 from the bin numbers in cuts array
247+ constexpr double BinsPtMl[NBinsPtMl + 1 ] = {
248+ 0 ,
249+ 1.0 ,
250+ 2.0 ,
251+ 3.0 ,
252+ 4.0 ,
253+ 6.0 ,
254+ 8.0 ,
255+ 12.0 ,
256+ 24.0 ,
257+ 50.0 ,
258+ 1000.0 };
259+ auto vecBinsPtMl = std::vector<double >{BinsPtMl, BinsPtMl + NBinsPtMl + 1 };
260+
261+ // default values for the cuts
262+ constexpr double CutsMl[NBinsPtMl][3 ] = {{1 ., 0 ., 0 .}, /* 0 < pT < 1 */
263+ {1 ., 0 ., 0 .}, /* 1 < pT < 2 */
264+ {1 ., 0 ., 0 .}, /* 2 < pT < 3 */
265+ {1 ., 0 ., 0 .}, /* 3 < pT < 4 */
266+ {1 ., 0 ., 0 .}, /* 4 < pT < 6 */
267+ {1 ., 0 ., 0 .}, /* 6 < pT < 8 */
268+ {1 ., 0 ., 0 .}, /* 8 < pT < 12 */
269+ {1 ., 0 ., 0 .}, /* 12 < pT < 24 */
270+ {1 ., 0 ., 0 .}, /* 24 < pT < 50 */
271+ {1 ., 0 ., 0 .}}; /* 50 < pT < 1000 */
272+
273+ // row labels
274+ static const std::vector<std::string> labelsPtMl = {
275+ " pT bin 0" ,
276+ " pT bin 1" ,
277+ " pT bin 2" ,
278+ " pT bin 3" ,
279+ " pT bin 4" ,
280+ " pT bin 5" ,
281+ " pT bin 6" ,
282+ " pT bin 7" ,
283+ " pT bin 8" ,
284+ " pT bin 9" };
285+
286+ // column labels
287+ static const std::vector<std::string> labelsCutMl = {" max BDT score bkg" , " min BDT score prompt" , " min BDT score nonprompt" };
214288 } // namespace hf_calib
215289
216290 namespace aod
@@ -330,6 +404,12 @@ namespace o2
330404 DECLARE_SOA_COLUMN (PointingAngle, pointingAngle, uint8_t ); // ! compressed pointing angle
331405 DECLARE_SOA_COLUMN (PointingAngleXY, pointingAngleXY, uint8_t ); // ! compressed pointing angle XY
332406 DECLARE_SOA_COLUMN (DecVtxChi2, decVtxChi2, uint8_t ); // ! compressed decay vertex chi2
407+ DECLARE_SOA_COLUMN (BdtScoreBkgD0, bdtScoreBkgD0, uint16_t ); // ! compressed BDT score (bkg, D0 mass hypo)
408+ DECLARE_SOA_COLUMN (BdtScorePromptD0, bdtScorePromptD0, uint8_t ); // ! compressed BDT score (prompt, D0 mass hypo)
409+ DECLARE_SOA_COLUMN (BdtScoreNonpromptD0, bdtScoreNonpromptD0, uint8_t ); // ! compressed BDT score (non-prompt, D0 mass hypo)
410+ DECLARE_SOA_COLUMN (BdtScoreBkgD0bar, bdtScoreBkgD0bar, uint16_t ); // ! compressed BDT score (bkg, D0bar mass hypo)
411+ DECLARE_SOA_COLUMN (BdtScorePromptD0bar, bdtScorePromptD0bar, uint8_t ); // ! compressed BDT score (prompt, D0bar mass hypo)
412+ DECLARE_SOA_COLUMN (BdtScoreNonpromptD0bar, bdtScoreNonpromptD0bar, uint8_t ); // ! compressed BDT score (non-prompt, D0bar mass hypo)
333413 } // namespace hf_calib
334414
335415 DECLARE_SOA_TABLE (D0CalibCand, " AOD" , " D0CALIBCANDS" ,
@@ -351,7 +431,13 @@ namespace o2
351431 hf_calib::CosPaXY,
352432 hf_calib::PointingAngle,
353433 hf_calib::PointingAngleXY,
354- hf_calib::DecVtxChi2);
434+ hf_calib::DecVtxChi2,
435+ hf_calib::BdtScoreBkgD0,
436+ hf_calib::BdtScorePromptD0,
437+ hf_calib::BdtScoreNonpromptD0,
438+ hf_calib::BdtScoreBkgD0bar,
439+ hf_calib::BdtScorePromptD0bar,
440+ hf_calib::BdtScoreNonpromptD0bar);
355441 } // namespace aod
356442} // namespace o2
357443#endif // D0CALIBTABLES_H_
0 commit comments