99// granted to it by virtue of its status as an Intergovernmental Organization
1010// or submit itself to any jurisdiction.
1111// /
12+ // / \file rsnOutput.h
13+ // / \brief Resonance output class.
1214// / \author Veronika Barbasova ([email protected] )13- // / \since April 3, 2024
1415
1516#ifndef PWGLF_UTILS_RSNOUTPUT_H_
1617#define PWGLF_UTILS_RSNOUTPUT_H_
2223#include " Framework/HistogramRegistry.h"
2324#include " Framework/Logger.h"
2425
25- using namespace o2 ::framework;
26-
2726namespace o2 ::analysis
2827{
2928namespace rsn
@@ -91,12 +90,12 @@ enum class SystematicsAxisType {
9190 ncl,
9291 unknown
9392};
94- namespace PairAxis
93+ namespace pair_axis
9594{
9695std::vector<std::string> names{" im" , " pt" , " mu" , " ce" , " ns1" , " ns2" , " eta" , " y" , " vz" , " mum" , " cem" , " vzm" };
9796}
9897
99- namespace SystematicsAxis
98+ namespace systematic_axis
10099{
101100std::vector<std::string> names{" ncl" };
102101}
@@ -106,23 +105,23 @@ class Output
106105 public:
107106 virtual ~Output () = default ;
108107
109- virtual void init (std::vector<std::string> const & sparseAxes, std::vector<AxisSpec> const & allAxes, std::vector<std::string> const & sysAxes, std::vector<AxisSpec> const & allAxes_sys, bool /* produceTrue*/ = false , MixingType /* eventMixing*/ = MixingType::none, bool /* produceLikesign*/ = false , HistogramRegistry* registry = nullptr )
108+ virtual void init (std::vector<std::string> const & sparseAxes, std::vector<o2::framework:: AxisSpec> const & allAxes, std::vector<std::string> const & sysAxes, std::vector<o2::framework:: AxisSpec> const & allAxes_sys, bool /* produceTrue*/ = false , MixingType /* eventMixing*/ = MixingType::none, bool /* produceLikesign*/ = false , o2::framework:: HistogramRegistry* registry = nullptr )
110109 {
111110 mHistogramRegistry = registry;
112111 if (mHistogramRegistry == nullptr )
113- mHistogramRegistry = new HistogramRegistry (" registry" );
112+ mHistogramRegistry = new o2::framework:: HistogramRegistry (" registry" );
114113
115114 // check if all axes are added in correct order
116115 for (int i = 0 ; i < static_cast <int >(PairAxisType::unknown); i++) {
117116 auto aname = *std::move (allAxes[i].name );
118117 LOGF (debug, " Check axis '%s' %d" , aname.c_str (), i);
119- if (aname.compare (PairAxis ::names[static_cast <int >(i)])) {
120- LOGF (fatal, " rsn::Output::Error: Order in allAxes is not correct !!! Expected axis '%s' and has '%s'." , aname.c_str (), PairAxis ::names[static_cast <int >(i)]);
118+ if (aname.compare (pair_axis ::names[static_cast <int >(i)])) {
119+ LOGF (fatal, " rsn::Output::Error: Order in allAxes is not correct !!! Expected axis '%s' and has '%s'." , aname.c_str (), pair_axis ::names[static_cast <int >(i)]);
121120 }
122121 }
123122
124123 PairAxisType currentType;
125- for (auto & c : sparseAxes) {
124+ for (const auto & c : sparseAxes) {
126125 currentType = type (c);
127126 if (currentType >= PairAxisType::unknown) {
128127 LOGF (warning, " Found unknown axis (rsn::PairAxisType = %d)!!! Skipping ..." , static_cast <int >(currentType));
@@ -138,42 +137,42 @@ class Output
138137 mFillPoint = new double [mCurrentAxisTypes .size ()];
139138
140139 LOGF (info, " Number of axis added: %d" , mCurrentAxes .size ());
141- mPairHisto = new HistogramConfigSpec (HistType::kTHnSparseF , mCurrentAxes );
140+ mPairHisto = new o2::framework:: HistogramConfigSpec (o2::framework:: HistType::kTHnSparseF , mCurrentAxes );
142141
143142 // check if all systematic axes are added in correct order
144143 for (int i = 0 ; i < static_cast <int >(SystematicsAxisType::unknown); i++) {
145144 auto aname = *std::move (allAxes_sys[i].name );
146145 LOGF (debug, " Check axis '%s' %d" , aname.c_str (), i);
147- if (aname.compare (SystematicsAxis ::names[static_cast <int >(i)])) {
148- LOGF (fatal, " rsn::Output::Error: Order in allAxes_sys is not correct !!! Expected axis '%s' and has '%s'." , aname.c_str (), SystematicsAxis ::names[static_cast <int >(i)]);
146+ if (aname.compare (systematic_axis ::names[static_cast <int >(i)])) {
147+ LOGF (fatal, " rsn::Output::Error: Order in allAxes_sys is not correct !!! Expected axis '%s' and has '%s'." , aname.c_str (), systematic_axis ::names[static_cast <int >(i)]);
149148 }
150149 }
151150
152- SystematicsAxisType currentType_sys ;
153- for (auto & c : sysAxes) {
154- currentType_sys = type_sys (c);
155- if (currentType_sys >= SystematicsAxisType::unknown) {
156- LOGF (warning, " Found unknown axis (rsn::SystematicsAxisType = %d)!!! Skipping ..." , static_cast <int >(currentType_sys ));
151+ SystematicsAxisType currentTypeSys ;
152+ for (const auto & c : sysAxes) {
153+ currentTypeSys = typeSys (c);
154+ if (currentTypeSys >= SystematicsAxisType::unknown) {
155+ LOGF (warning, " Found unknown axis (rsn::SystematicsAxisType = %d)!!! Skipping ..." , static_cast <int >(currentTypeSys ));
157156 continue ;
158157 }
159158 LOGF (info, " Adding axis '%s' to systematic histogram" , c.c_str ());
160- mCurrentAxesSys .push_back (allAxes_sys[static_cast <int >(currentType_sys )]);
161- mCurrentAxisTypesSys .push_back (currentType_sys );
159+ mCurrentAxesSys .push_back (allAxes_sys[static_cast <int >(currentTypeSys )]);
160+ mCurrentAxisTypesSys .push_back (currentTypeSys );
162161 }
163162
164163 if (mFillPointSys != nullptr )
165164 delete mFillPointSys ;
166165 mFillPointSys = new double [mCurrentAxisTypesSys .size ()];
167166
168167 LOGF (info, " Number of systematic axis added: %d" , mCurrentAxesSys .size ());
169- mPairHistoSys = new HistogramConfigSpec (HistType::kTHnSparseF , mCurrentAxesSys );
168+ mPairHistoSys = new o2::framework:: HistogramConfigSpec (o2::framework:: HistType::kTHnSparseF , mCurrentAxesSys );
170169 }
171170
172171 template <typename T>
173172 void fillSparse (const T& h, double * point)
174173 {
175174 int i = 0 ;
176- for (auto & at : mCurrentAxisTypes ) {
175+ for (const auto & at : mCurrentAxisTypes ) {
177176 mFillPoint [i++] = point[static_cast <int >(at)];
178177 }
179178 mHistogramRegistry ->get <THnSparse>(h)->Fill (mFillPoint );
@@ -183,7 +182,7 @@ class Output
183182 void fillSparseSys (const T& h, double * point)
184183 {
185184 int i = 0 ;
186- for (auto & at : mCurrentAxisTypesSys ) {
185+ for (const auto & at : mCurrentAxisTypesSys ) {
187186 mFillPointSys [i++] = point[static_cast <int >(at)];
188187 }
189188 mHistogramRegistry ->get <THnSparse>(h)->Fill (mFillPointSys );
@@ -217,47 +216,47 @@ class Output
217216
218217 PairAxisType type (std::string name)
219218 {
220- auto it = std::find (PairAxis ::names.begin (), PairAxis ::names.end (), name);
221- if (it == PairAxis ::names.end ()) {
219+ auto it = std::find (pair_axis ::names.begin (), pair_axis ::names.end (), name);
220+ if (it == pair_axis ::names.end ()) {
222221 return PairAxisType::unknown;
223222 }
224- return static_cast <PairAxisType>(std::distance (PairAxis ::names.begin (), it));
223+ return static_cast <PairAxisType>(std::distance (pair_axis ::names.begin (), it));
225224 }
226225
227- SystematicsAxisType type_sys (std::string name)
226+ SystematicsAxisType typeSys (std::string name)
228227 {
229- auto it = std::find (SystematicsAxis ::names.begin (), SystematicsAxis ::names.end (), name);
230- if (it == SystematicsAxis ::names.end ()) {
228+ auto it = std::find (systematic_axis ::names.begin (), systematic_axis ::names.end (), name);
229+ if (it == systematic_axis ::names.end ()) {
231230 return SystematicsAxisType::unknown;
232231 }
233- return static_cast <SystematicsAxisType>(std::distance (SystematicsAxis ::names.begin (), it));
232+ return static_cast <SystematicsAxisType>(std::distance (systematic_axis ::names.begin (), it));
234233 }
235234
236235 std::string name (PairAxisType type)
237236 {
238- return PairAxis ::names[(static_cast <int >(type))];
237+ return pair_axis ::names[(static_cast <int >(type))];
239238 }
240239
241- std::string name_sys (SystematicsAxisType type)
240+ std::string nameSys (SystematicsAxisType type)
242241 {
243- return SystematicsAxis ::names[(static_cast <int >(type))];
242+ return systematic_axis ::names[(static_cast <int >(type))];
244243 }
245244
246- AxisSpec axis (std::vector<AxisSpec> const & allAxes, PairAxisType type)
245+ o2::framework:: AxisSpec axis (std::vector<o2::framework:: AxisSpec> const & allAxes, PairAxisType type)
247246 {
248- const AxisSpec unknownAxis = {1 , 0 ., 1 ., " unknown axis" , " unknown" };
247+ const o2::framework:: AxisSpec unknownAxis = {1 , 0 ., 1 ., " unknown axis" , " unknown" };
249248 if (type == PairAxisType::unknown)
250249 return unknownAxis;
251250 return allAxes[static_cast <int >(type)];
252251 }
253252
254253 protected:
255- HistogramRegistry* mHistogramRegistry = nullptr ;
256- HistogramConfigSpec* mPairHisto = nullptr ;
257- HistogramConfigSpec* mPairHistoSys = nullptr ;
258- std::vector<AxisSpec> mCurrentAxes ;
254+ o2::framework:: HistogramRegistry* mHistogramRegistry = nullptr ;
255+ o2::framework:: HistogramConfigSpec* mPairHisto = nullptr ;
256+ o2::framework:: HistogramConfigSpec* mPairHistoSys = nullptr ;
257+ std::vector<o2::framework:: AxisSpec> mCurrentAxes ;
259258 std::vector<PairAxisType> mCurrentAxisTypes ;
260- std::vector<AxisSpec> mCurrentAxesSys ;
259+ std::vector<o2::framework:: AxisSpec> mCurrentAxesSys ;
261260 std::vector<SystematicsAxisType> mCurrentAxisTypesSys ;
262261 double * mFillPoint = nullptr ;
263262 double * mFillPointSys = nullptr ;
@@ -266,7 +265,7 @@ class Output
266265class OutputSparse : public Output
267266{
268267 public:
269- virtual void init (std::vector<std::string> const & sparseAxes, std::vector<AxisSpec> const & allAxes, std::vector<std::string> const & sysAxes, std::vector<AxisSpec> const & allAxes_sys, bool produceTrue = false , MixingType eventMixing = MixingType::none, bool produceLikesign = false , HistogramRegistry* registry = nullptr )
268+ virtual void init (std::vector<std::string> const & sparseAxes, std::vector<o2::framework:: AxisSpec> const & allAxes, std::vector<std::string> const & sysAxes, std::vector<o2::framework:: AxisSpec> const & allAxes_sys, bool produceTrue = false , MixingType eventMixing = MixingType::none, bool produceLikesign = false , o2::framework:: HistogramRegistry* registry = nullptr )
270269 {
271270 Output::init (sparseAxes, allAxes, sysAxes, allAxes_sys, produceTrue, eventMixing, produceLikesign, registry);
272271
0 commit comments