Skip to content

Commit 418088c

Browse files
zchochulZuzanna ChochulskaZuzanna Chochulska
authored
[PWGCF] FemtoUniverse -- Fixing major O2 linter errors for FemtoUniverse directory (#9046)
Co-authored-by: Zuzanna Chochulska <zuza@node2080.grid4cern.if.pw.edu.pl> Co-authored-by: Zuzanna Chochulska <01150674@pw.edu.pl>
1 parent f2d9f6e commit 418088c

File tree

46 files changed

+2288
-2364
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2288
-2364
lines changed

PWGCF/FemtoUniverse/Core/FemtoUniverse3DContainer.h

Lines changed: 49 additions & 49 deletions
Large diffs are not rendered by default.

PWGCF/FemtoUniverse/Core/FemtoUniverseAngularContainer.h

Lines changed: 44 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <string>
2626

2727
#include "Framework/HistogramRegistry.h"
28+
#include "Common/Core/RecoDecay.h"
2829
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h"
2930

3031
#include "Math/Vector4D.h"
@@ -33,10 +34,10 @@
3334

3435
using namespace o2::framework;
3536

36-
namespace o2::analysis::femtoUniverse
37+
namespace o2::analysis::femto_universe
3738
{
3839

39-
namespace femtoUniverseAngularContainer
40+
namespace femto_universe_angular_container
4041
{
4142
/// Femtoscopic observable to be computed
4243
enum Observable { kstar ///< kstar
@@ -46,15 +47,15 @@ enum Observable { kstar ///< kstar
4647
enum EventType { same, ///< Pair from same event
4748
mixed ///< Pair from mixed event
4849
};
49-
}; // namespace femtoUniverseAngularContainer
50+
}; // namespace femto_universe_angular_container
5051

5152
/// \class FemtoUniverseAngularContainer
5253
/// \brief Container for all histogramming related to the correlation function. The two
5354
/// particles of the pair are passed here, and the correlation function and QA histograms
5455
/// are filled according to the specified observable
5556
/// \tparam eventType Type of the event (same/mixed)
5657
/// \tparam obs Observable to be computed (k*/Q_inv/...)
57-
template <femtoUniverseAngularContainer::EventType eventType, femtoUniverseAngularContainer::Observable obs>
58+
template <femto_universe_angular_container::EventType eventType, femto_universe_angular_container::Observable obs>
5859
class FemtoUniverseAngularContainer
5960
{
6061
public:
@@ -71,7 +72,7 @@ class FemtoUniverseAngularContainer
7172
/// \param kTAxis axis object for the kT axis
7273
/// \param mTAxis axis object for the mT axis
7374
template <typename T>
74-
void init_base(std::string folderName, std::string /*femtoObs*/, T /*femtoObsAxis*/, T /*multAxis*/, T /*kTAxis*/, T /*mTAxis*/, T /*multAxis3D*/, T /*mTAxis3D*/, T etaAxis, T phiAxis, bool use3dplots)
75+
void initBase(std::string folderName, std::string /*femtoObs*/, T /*femtoObsAxis*/, T /*multAxis*/, T /*kTAxis*/, T /*mTAxis*/, T /*multAxis3D*/, T /*mTAxis3D*/, T etaAxis, T phiAxis, bool use3dplots)
7576
{
7677
mHistogramRegistry->add((folderName + "/DeltaEtaDeltaPhi").c_str(), "; #Delta#varphi (rad); #Delta#eta", kTH2F, {phiAxis, etaAxis});
7778
if (use3dplots) {
@@ -85,13 +86,13 @@ class FemtoUniverseAngularContainer
8586
/// \param folderName Name of the directory in the output file (no suffix for reconstructed data/ Monte Carlo; "_MC" for Monte Carlo Truth)
8687
/// \param femtoObsAxis axis object for the femto observable axis
8788
template <typename T>
88-
void init_MC(std::string /*folderName*/, std::string /*femtoObs*/, T /*femtoObsAxis*/, T /*multAxis*/, T /*mTAxis*/)
89+
void initMC(std::string /*folderName*/, std::string /*femtoObs*/, T /*femtoObsAxis*/, T /*multAxis*/, T /*mTAxis*/)
8990
{
9091
}
9192

9293
/// Templated function to initialize the histograms for the task
93-
/// Always calls init_base to initialize the histograms for data/ Monte Carlo reconstructed
94-
/// In case of Monte Carlo, calls init_base again for Monte Carlo truth and the specialized function init_MC for additional histogramms
94+
/// Always calls initBase to initialize the histograms for data/ Monte Carlo reconstructed
95+
/// In case of Monte Carlo, calls initBase again for Monte Carlo truth and the specialized function initMC for additional histogramms
9596
/// \tparam T type of the configurable for the axis configuration
9697
/// \param registry Histogram registry to be passed
9798
/// \param kstarBins k* binning for the histograms
@@ -106,7 +107,7 @@ class FemtoUniverseAngularContainer
106107
{
107108
mHistogramRegistry = registry;
108109
std::string femtoObs;
109-
if constexpr (mFemtoObs == femtoUniverseAngularContainer::Observable::kstar) {
110+
if constexpr (FemtoObs == femto_universe_angular_container::Observable::kstar) {
110111
femtoObs = "#it{k*} (GeV/#it{c})";
111112
}
112113

@@ -120,18 +121,18 @@ class FemtoUniverseAngularContainer
120121
framework::AxisSpec mTAxis3D = {mTBins3D, "#it{m}_{T} (GeV/#it{c})"};
121122

122123
// angular correlations
123-
mPhiLow = (-static_cast<int>(phiBins / 4) + 0.5) * 2. * o2::constants::math::PI / phiBins;
124-
mPhiHigh = 2 * o2::constants::math::PI + (-static_cast<int>(phiBins / 4) + 0.5) * 2. * o2::constants::math::PI / phiBins;
124+
mPhiLow = (-static_cast<int>(phiBins / 4) + 0.5) * o2::constants::math::TwoPI / phiBins;
125+
mPhiHigh = o2::constants::math::TwoPI + (-static_cast<int>(phiBins / 4) + 0.5) * o2::constants::math::TwoPI / phiBins;
125126
framework::AxisSpec phiAxis = {phiBins, mPhiLow, mPhiHigh};
126127
framework::AxisSpec etaAxis = {etaBins, -2.0, 2.0};
127128

128-
std::string folderName = static_cast<std::string>(mFolderSuffix[mEventType]) + static_cast<std::string>(o2::aod::femtouniverseMCparticle::MCTypeName[o2::aod::femtouniverseMCparticle::MCType::kRecon]);
129+
std::string folderName = static_cast<std::string>(FolderSuffix[EventType]) + static_cast<std::string>(o2::aod::femtouniverse_mc_particle::MCTypeName[o2::aod::femtouniverse_mc_particle::MCType::kRecon]);
129130

130-
init_base(folderName, femtoObs, femtoObsAxis, multAxis, kTAxis, mTAxis, multAxis3D, mTAxis3D, etaAxis, phiAxis, use3dplots);
131+
initBase(folderName, femtoObs, femtoObsAxis, multAxis, kTAxis, mTAxis, multAxis3D, mTAxis3D, etaAxis, phiAxis, use3dplots);
131132
if (isMC) {
132-
folderName = static_cast<std::string>(mFolderSuffix[mEventType]) + static_cast<std::string>(o2::aod::femtouniverseMCparticle::MCTypeName[o2::aod::femtouniverseMCparticle::MCType::kTruth]);
133-
init_base(folderName, femtoObs, femtoObsAxis, multAxis, kTAxis, mTAxis, multAxis3D, mTAxis3D, etaAxis, phiAxis, use3dplots);
134-
init_MC(folderName, femtoObs, femtoObsAxis, multAxis, mTAxis);
133+
folderName = static_cast<std::string>(FolderSuffix[EventType]) + static_cast<std::string>(o2::aod::femtouniverse_mc_particle::MCTypeName[o2::aod::femtouniverse_mc_particle::MCType::kTruth]);
134+
initBase(folderName, femtoObs, femtoObsAxis, multAxis, kTAxis, mTAxis, multAxis3D, mTAxis3D, etaAxis, phiAxis, use3dplots);
135+
initMC(folderName, femtoObs, femtoObsAxis, multAxis, mTAxis);
135136
}
136137
}
137138

@@ -152,20 +153,15 @@ class FemtoUniverseAngularContainer
152153
/// \param part1 Particle one
153154
/// \param part2 Particle two
154155
/// \param mult Multiplicity of the event
155-
template <o2::aod::femtouniverseMCparticle::MCType mc, typename T>
156-
void setPair_base(const float /*femtoObs*/, const float /*mT*/, T const& part1, T const& part2, const int /*mult*/, bool use3dplots, float weight = 1.0f)
156+
template <o2::aod::femtouniverse_mc_particle::MCType mc, typename T>
157+
void setPairBase(const float /*femtoObs*/, const float /*mT*/, T const& part1, T const& part2, const int /*mult*/, bool use3dplots, float weight = 1.0f)
157158
{
158-
delta_eta = part1.eta() - part2.eta();
159-
delta_phi = part1.phi() - part2.phi();
159+
deltaEta = part1.eta() - part2.eta();
160160

161-
while (delta_phi < mPhiLow) {
162-
delta_phi += o2::constants::math::TwoPI;
163-
}
164-
while (delta_phi > mPhiHigh) {
165-
delta_phi -= o2::constants::math::TwoPI;
166-
}
161+
deltaPhi = part1.phi() - part2.phi();
162+
deltaPhi = RecoDecay::constrainAngle(deltaPhi, 0);
167163

168-
mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtouniverseMCparticle::MCTypeName[mc]) + HIST("/DeltaEtaDeltaPhi"), delta_phi, delta_eta, weight);
164+
mHistogramRegistry->fill(HIST(FolderSuffix[EventType]) + HIST(o2::aod::femtouniverse_mc_particle::MCTypeName[mc]) + HIST("/DeltaEtaDeltaPhi"), deltaPhi, deltaEta, weight);
169165
if (use3dplots) {
170166
// use 3d plots
171167
}
@@ -175,20 +171,20 @@ class FemtoUniverseAngularContainer
175171
/// Fills MC truth specific histogramms:
176172
/// - kstar distribution plots with RECONSTRUCTED information but ONLY for non-fake candidates; needed for purity calculations of tracks
177173
/// - kstar resolution matrix
178-
/// Note: Standard histogramms with MC truth information are filled with the setPair_base function
174+
/// Note: Standard histogramms with MC truth information are filled with the setPairBase function
179175
/// \param part1 Particle one
180176
/// \param part2 Particle two
181177
/// \param mult Multiplicity of the event
182-
void setPair_MC(const float /*femtoObsMC*/, const float /*femtoObs*/, const float /*mT*/, const int /*mult*/)
178+
void setPairMC(const float /*femtoObsMC*/, const float /*femtoObs*/, const float /*mT*/, const int /*mult*/)
183179
{
184180
if (mHistogramRegistry) {
185181
// Fill the kstar distributions with the reconstructed information but only for particles with the right PDG code
186182
}
187183
}
188184

189185
/// Templated function to handle data/ Monte Carlo reconstructed and Monte Carlo truth
190-
/// Always calls setPair_base to compute the observables with reconstructed data
191-
/// In case of Monte Carlo, calls setPair_base with MC info and specialized function setPair_MC for additional histogramms
186+
/// Always calls setPairBase to compute the observables with reconstructed data
187+
/// In case of Monte Carlo, calls setPairBase with MC info and specialized function setPairMC for additional histogramms
192188
/// \tparam T type of the femtouniverseparticle
193189
/// \param part1 Particle one
194190
/// \param part2 Particle two
@@ -198,25 +194,25 @@ class FemtoUniverseAngularContainer
198194
{
199195
float femtoObs, femtoObsMC;
200196
// Calculate femto observable and the mT with reconstructed information
201-
if constexpr (mFemtoObs == femtoUniverseAngularContainer::Observable::kstar) {
197+
if constexpr (FemtoObs == femto_universe_angular_container::Observable::kstar) {
202198
femtoObs = FemtoUniverseMath::getkstar(part1, mMassOne, part2, mMassTwo);
203199
}
204200
const float mT = FemtoUniverseMath::getmT(part1, mMassOne, part2, mMassTwo);
205201

206202
if (mHistogramRegistry) {
207-
setPair_base<o2::aod::femtouniverseMCparticle::MCType::kRecon>(femtoObs, mT, part1, part2, mult, use3dplots);
203+
setPairBase<o2::aod::femtouniverse_mc_particle::MCType::kRecon>(femtoObs, mT, part1, part2, mult, use3dplots);
208204

209205
if constexpr (isMC) {
210206
if (part1.has_fdMCParticle() && part2.has_fdMCParticle()) {
211207
// calculate the femto observable and the mT with MC truth information
212-
if constexpr (mFemtoObs == femtoUniverseAngularContainer::Observable::kstar) {
208+
if constexpr (FemtoObs == femto_universe_angular_container::Observable::kstar) {
213209
femtoObsMC = FemtoUniverseMath::getkstar(part1.fdMCParticle(), mMassOne, part2.fdMCParticle(), mMassTwo);
214210
}
215211
const float mTMC = FemtoUniverseMath::getmT(part1.fdMCParticle(), mMassOne, part2.fdMCParticle(), mMassTwo);
216212

217-
if (abs(part1.fdMCParticle().pdgMCTruth()) == abs(mPDGOne) && abs(part2.fdMCParticle().pdgMCTruth()) == abs(mPDGTwo)) { // Note: all pair-histogramms are filled with MC truth information ONLY in case of non-fake candidates
218-
setPair_base<o2::aod::femtouniverseMCparticle::MCType::kTruth>(femtoObsMC, mTMC, part1.fdMCParticle(), part2.fdMCParticle(), mult, use3dplots, weight);
219-
setPair_MC(femtoObsMC, femtoObs, mT, mult);
213+
if (std::abs(part1.fdMCParticle().pdgMCTruth()) == std::abs(mPDGOne) && std::abs(part2.fdMCParticle().pdgMCTruth()) == std::abs(mPDGTwo)) { // Note: all pair-histogramms are filled with MC truth information ONLY in case of non-fake candidates
214+
setPairBase<o2::aod::femtouniverse_mc_particle::MCType::kTruth>(femtoObsMC, mTMC, part1.fdMCParticle(), part2.fdMCParticle(), mult, use3dplots, weight);
215+
setPairMC(femtoObsMC, femtoObs, mT, mult);
220216
} else {
221217
}
222218

@@ -227,20 +223,20 @@ class FemtoUniverseAngularContainer
227223
}
228224

229225
protected:
230-
HistogramRegistry* mHistogramRegistry = nullptr; ///< For QA output
231-
static constexpr std::string_view mFolderSuffix[2] = {"SameEvent", "MixedEvent"}; ///< Folder naming for the output according to mEventType
232-
static constexpr femtoUniverseAngularContainer::Observable mFemtoObs = obs; ///< Femtoscopic observable to be computed (according to femtoUniverseAngularContainer::Observable)
233-
static constexpr int mEventType = eventType; ///< Type of the event (same/mixed, according to femtoUniverseAngularContainer::EventType)
234-
float mMassOne = 0.f; ///< PDG mass of particle 1
235-
float mMassTwo = 0.f; ///< PDG mass of particle 2
236-
int mPDGOne = 0; ///< PDG code of particle 1
237-
int mPDGTwo = 0; ///< PDG code of particle 2
226+
HistogramRegistry* mHistogramRegistry = nullptr; ///< For QA output
227+
static constexpr std::string_view FolderSuffix[2] = {"SameEvent", "MixedEvent"}; ///< Folder naming for the output according to EventType
228+
static constexpr femto_universe_angular_container::Observable FemtoObs = obs; ///< Femtoscopic observable to be computed (according to femto_universe_angular_container::Observable)
229+
static constexpr int EventType = eventType; ///< Type of the event (same/mixed, according to femto_universe_angular_container::EventType)
230+
float mMassOne = 0.f; ///< PDG mass of particle 1
231+
float mMassTwo = 0.f; ///< PDG mass of particle 2
232+
int mPDGOne = 0; ///< PDG code of particle 1
233+
int mPDGTwo = 0; ///< PDG code of particle 2
238234
double mPhiLow;
239235
double mPhiHigh;
240-
double delta_eta;
241-
double delta_phi;
236+
double deltaEta;
237+
double deltaPhi;
242238
};
243239

244-
} // namespace o2::analysis::femtoUniverse
240+
} // namespace o2::analysis::femto_universe
245241

246242
#endif // PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEANGULARCONTAINER_H_

0 commit comments

Comments
 (0)