1- // Copyright 2019-2025 CERN and copyright holders of ALICE O2.
1+ // Copyright 2019-2022 CERN and copyright holders of ALICE O2.
22// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
33// All rights not expressly granted are reserved.
44//
1616#ifndef PWGCF_FEMTODREAM_CORE_FEMTODREAMOBJECTSELECTION_H_
1717#define PWGCF_FEMTODREAM_CORE_FEMTODREAMOBJECTSELECTION_H_
1818
19+ #include " PWGCF/DataModel/FemtoDerived.h"
20+ #include " PWGCF/FemtoDream/Core/femtoDreamSelection.h"
21+
22+ #include " Framework/HistogramRegistry.h"
23+ #include " ReconstructionDataFormats/PID.h"
24+
1925#include < algorithm>
2026#include < string>
2127#include < vector>
2228
23- #include " PWGCF/FemtoDream/Core/femtoDreamSelection.h"
24- #include " ReconstructionDataFormats/PID.h"
25- #include " Framework/HistogramRegistry.h"
26- #include " PWGCF/DataModel/FemtoDerived.h"
27-
2829using namespace o2 ;
2930using namespace o2 ::framework;
3031
@@ -59,6 +60,14 @@ class FemtoDreamObjectSelection
5960 }
6061 }
6162
63+ // / assigns value from configurbale to protected class member
64+ // / \param selVals o2 configurable containing the values employed for the selection
65+ template <typename V>
66+ void assign (V& selVals)
67+ {
68+ assignedValue = static_cast <selValDataType>(selVals);
69+ }
70+
6271 // / Pass the Configurable of selection values in the analysis task to the selection class
6372 // / \tparam T Type of the configurable passed to the function
6473 // / \param selVals o2 configurable containing the values employed for the selection
@@ -69,7 +78,7 @@ class FemtoDreamObjectSelection
6978 {
7079 std::vector<selValDataType> tmpSelVals = selVals; // necessary due to some features of the Configurable
7180 std::vector<FemtoDreamSelection<selValDataType, selVariable>> tempVec;
72- for (const selValDataType selVal : tmpSelVals) {
81+ for (const selValDataType& selVal : tmpSelVals) {
7382 tempVec.push_back (FemtoDreamSelection<selValDataType, selVariable>(selVal, selVar, selType));
7483 }
7584 setSelection (tempVec);
@@ -97,7 +106,7 @@ class FemtoDreamObjectSelection
97106 }
98107
99108 // / Then, the sorted selections are added to the overall container of cuts
100- for (auto & sel : sels) {
109+ for (const auto & sel : sels) {
101110 mSelections .push_back (sel);
102111 }
103112 }
@@ -121,7 +130,7 @@ class FemtoDreamObjectSelection
121130 break ;
122131 }
123132
124- for (auto sel : mSelections ) {
133+ for (auto & sel : mSelections ) {
125134 if (sel.getSelectionVariable () == selVar) {
126135 switch (sel.getSelectionType ()) {
127136 case (femtoDreamSelection::SelectionType::kUpperLimit ):
@@ -164,7 +173,7 @@ class FemtoDreamObjectSelection
164173 std::vector<FemtoDreamSelection<selValDataType, selVariable>> getSelections (selVariable selVar)
165174 {
166175 std::vector<FemtoDreamSelection<selValDataType, selVariable>> selValVec;
167- for (auto it : mSelections ) {
176+ for (auto & it : mSelections ) {
168177 if (it.getSelectionVariable () == selVar) {
169178 selValVec.push_back (it);
170179 }
@@ -177,9 +186,11 @@ class FemtoDreamObjectSelection
177186 std::vector<selVariable> getSelectionVariables ()
178187 {
179188 std::vector<selVariable> selVarVec;
180- for (auto it : mSelections ) {
189+ for (auto & it : mSelections ) {
181190 auto selVar = it.getSelectionVariable ();
182- if (std::none_of (selVarVec.begin (), selVarVec.end (), [selVar](selVariable a) { return a == selVar; })) {
191+ if (std::none_of (selVarVec.begin (),
192+ selVarVec.end (),
193+ [selVar](selVariable a) { return a == selVar; })) {
183194 selVarVec.push_back (selVar);
184195 }
185196 }
@@ -190,6 +201,7 @@ class FemtoDreamObjectSelection
190201 HistogramRegistry* mHistogramRegistry ; // /< For Analysis QA output
191202 HistogramRegistry* mQAHistogramRegistry ; // /< For QA output
192203 std::vector<FemtoDreamSelection<selValDataType, selVariable>> mSelections ; // /< Vector containing all selections
204+ selValDataType assignedValue;
193205};
194206
195207} // namespace femtoDream
0 commit comments