Skip to content

Commit 2818161

Browse files
committed
format_linter_etc
1 parent d59a7ea commit 2818161

2 files changed

Lines changed: 43 additions & 21 deletions

File tree

PWGJE/Tasks/photonChargedTriggerCorrelation.cxx

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#include <CCDB/BasicCCDBManager.h>
3232
#include <CommonConstants/MathConstants.h>
33+
#include <CommonConstants/PhysicsConstants.h>
3334
#include <Framework/ASoAHelpers.h>
3435
#include <Framework/AnalysisDataModel.h>
3536
#include <Framework/AnalysisHelpers.h>
@@ -52,13 +53,18 @@
5253
#include <algorithm>
5354
#include <chrono>
5455
#include <cmath>
56+
#include <concepts>
5557
#include <cstddef>
5658
#include <cstdint>
5759
#include <deque>
5860
#include <format>
5961
#include <functional>
62+
#include <memory>
6063
#include <random>
64+
#include <stdexcept>
6165
#include <string>
66+
#include <utility>
67+
#include <type_traits>
6268
#include <vector>
6369

6470
const double absEtaMaxDefault = 0.8;
@@ -238,7 +244,7 @@ struct PhotonChargedTriggerCorrelation {
238244
return n; // overflow
239245
}
240246

241-
MixingTriggerMemory(std::vector<double> const binEdgesZPvIn, std::vector<double> const binEdgesMultIn, size_t const nTriggerPerBinLimitIn)
247+
MixingTriggerMemory(std::vector<double> const& binEdgesZPvIn, std::vector<double> const& binEdgesMultIn, size_t const nTriggerPerBinLimitIn)
242248
: binEdgesZPv(binEdgesZPvIn),
243249
nBinsZPv(binEdgesZPvIn.size() - 1),
244250
binEdgesMult(binEdgesMultIn),
@@ -398,7 +404,7 @@ struct PhotonChargedTriggerCorrelation {
398404
histos.add("reco/corr/h3_ptPhiEta_trig", "h3_ptPhiEta_trig", kTHnSparseD, {axisPtAssoc, axisPhi, axisEta}, true);
399405

400406
auto const add_corrHists =
401-
[&](std::string const name_id) {
407+
[&](std::string const& name_id) {
402408
histos.add(std::format("reco/corr/h4_ptTrigPtAssocPhiEta_assoc_{}", name_id).data(), std::format("h4_ptTrigPtAssocPhiEta_assoc_{}", name_id).data(),
403409
kTHnSparseD, {axisPtTrig, axisPtAssoc, axisPhi, axisEta}, true);
404410
histos.add(std::format("reco/corr/h6_corr_{}", name_id).data(), std::format("h6_corr_{}", name_id).data(),
@@ -460,7 +466,7 @@ struct PhotonChargedTriggerCorrelation {
460466

461467
// extra reco correlations with MC info
462468
auto const addMcRecoCorrHists =
463-
[&](std::string const correlationType, std::string const assocName) {
469+
[&](std::string const& correlationType, std::string const& assocName) {
464470
histos.add(std::format("mc/corr/h6_corr_{}_{}", correlationType, assocName).data(), std::format("h6_corr_{}_{}", correlationType, assocName).data(),
465471
kTHnSparseD, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc, axisZPvBinning, axisMultBinning}, true);
466472
histos.add(std::format("mc/corr/h6_mix_{}_{}", correlationType, assocName).data(), std::format("h6_mix_{}_{}", correlationType, assocName).data(),
@@ -485,16 +491,16 @@ struct PhotonChargedTriggerCorrelation {
485491

486492
// mc correction
487493
auto const addCorrectionHistsResolved =
488-
[&](std::string const nameId) {
494+
[&](std::string const& nameId) {
489495
histos.add(std::format("mc/correction/resol/h4_ptTrigPtAssocPhiEta_{}", nameId).data(), std::format("h4_ptTrigPtAssocPhiEta_{}", nameId).data(),
490496
kTHnSparseD, {axisPtTrig, axisPtAssoc, axisPhi, axisEta}, true);
491497
histos.add(std::format("mc/correction/resol/h4_ptTrigPtAssocZPvMult_{}", nameId).data(), std::format("h4_ptTrigPtAssocZPvMult_{}", nameId).data(),
492498
kTHnSparseD, {axisPtTrig, axisPtAssoc, axisZPv, axisMult}, true);
493499
};
494500
auto const addCorrectionHistsResolvedBasicTypes =
495-
[&](std::string const nameReco, std::string const nameTrue) {
496-
std::vector<std::string> recoTypes = {"reco", "recoAssocEv", "recoPure"};
497-
std::vector<std::string> trueTypes = {"true", "trueAssocEv", "trueAssocEvRecoPtTrig"};
501+
[&](std::string const& nameReco, std::string const& nameTrue) {
502+
std::vector<std::string> const recoTypes = {"reco", "recoAssocEv", "recoPure"};
503+
std::vector<std::string> const trueTypes = {"true", "trueAssocEv", "trueAssocEvRecoPtTrig"};
498504
for (std::string const& recoType : recoTypes) {
499505
addCorrectionHistsResolved(std::format("{}_{}", recoType, nameReco));
500506
}
@@ -504,17 +510,17 @@ struct PhotonChargedTriggerCorrelation {
504510
};
505511

506512
auto const addCorrectionHistPt =
507-
[&](std::string const nameId) {
513+
[&](std::string const& nameId) {
508514
histos.add(std::format("mc/correction/h2_ptTrigPtAssoc_{}", nameId).data(), std::format("h2_ptTrigPtAssoc_{}", nameId).data(),
509515
kTHnSparseD, {axisPtTrig, axisPtAssoc}, true);
510516
};
511517
auto const addCorrectionHistPtCategories =
512-
[&](std::string const nameId) {
518+
[&](std::string const& nameId) {
513519
histos.add(std::format("mc/correction/h3_ptTrigPtAssocCategory_{}", nameId).data(), std::format("h3_ptTrigPtAssocCategory_{}", nameId).data(),
514520
kTHnSparseD, {axisPtTrig, axisPtAssoc, axisCategories}, true);
515521
};
516522
auto const addCorrectionHistsV0 =
517-
[&](std::string const nameReco, std::string const nameTrue) {
523+
[&](std::string const& nameReco, std::string const& nameTrue) {
518524
addCorrectionHistPt(std::format("true_{}", nameTrue).data());
519525
addCorrectionHistPt(std::format("trueAssocEv_{}", nameTrue).data());
520526
addCorrectionHistPt(std::format("trueAssocEvRecoPtTrig_{}", nameTrue).data());
@@ -601,9 +607,12 @@ struct PhotonChargedTriggerCorrelation {
601607
constexpr int NDaughtersToGG = 2;
602608
if (daughters.size() != NDaughtersToGG)
603609
return false;
604-
for (auto const& daughter : daughters) {
605-
if (daughter.pdgCode() != PDG_t::kGamma)
610+
auto daughter = daughters.begin();
611+
auto daughterEnd = daughters.end();
612+
while (daughter != daughterEnd) {
613+
if ((*daughter).pdgCode() != PDG_t::kGamma)
606614
return false;
615+
daughter++;
607616
}
608617
return true;
609618
}
@@ -614,30 +623,37 @@ struct PhotonChargedTriggerCorrelation {
614623
if (!mcParticle.has_mothers())
615624
return false;
616625
auto const mothers = mcParticle.template mothers_as<aod::JetParticles>();
617-
for (auto const& mother : mothers) {
626+
auto mother = mothers.begin();
627+
auto motherEnd = mothers.end();
628+
while (mother != motherEnd) {
618629

619630
// LOGF(info, "searchPdgCode: %i, current[ pdgCode: %i, status: %i, primary: %i ], mother[ pdgCode: %i, status: %i, primary: %i ]",
620631
// pdgCode,
621632
// mcParticle.pdgCode(), mcParticle.getGenStatusCode(), mcParticle.isPhysicalPrimary(),
622-
// mother.pdgCode(), mother.getGenStatusCode(), mother.isPhysicalPrimary());
633+
// (*mother).pdgCode(), (*mother).getGenStatusCode(), (*mother).isPhysicalPrimary());
623634

624-
if (mother.pdgCode() == pdgCode || (checkAntiParticle && mother.pdgCode() == -pdgCode))
635+
if ((*mother).pdgCode() == pdgCode || (checkAntiParticle && (*mother).pdgCode() == -pdgCode))
625636
return true;
626-
if (checkForMother(mother, pdgCode, checkAntiParticle))
637+
if (checkForMother(*mother, pdgCode, checkAntiParticle))
627638
return true;
639+
mother++;
628640
}
629641
return false;
630642
}
631643

632644
// checks if daughters are in acceptance
633645
template <typename T_mcParticle>
634-
bool checkDaughtersInAcceptance(T_mcParticle const mcParticle, std::pair<double, double> const etaRange, std::pair<double, double> const phiRange = {0, constants::math::TwoPI}) {
646+
bool checkDaughtersInAcceptance(T_mcParticle const mcParticle, std::pair<double, double> const etaRange, std::pair<double, double> const phiRange = {0, constants::math::TwoPI})
647+
{
635648
auto const& daughterPhotons = mcParticle.template daughters_as<aod::JetParticles>();
636-
for (auto const& daughterPhoton : daughterPhotons) {
637-
if (daughterPhoton.eta() < etaRange.first || daughterPhoton.eta() > etaRange.second)
649+
auto daughterPhoton = daughterPhotons.begin();
650+
auto daughterPhotonEnd = daughterPhotons.end();
651+
while (daughterPhoton != daughterPhotonEnd) {
652+
if ((*daughterPhoton).eta() < etaRange.first || (*daughterPhoton).eta() > etaRange.second)
638653
return false;
639-
if (daughterPhoton.phi() < phiRange.first || daughterPhoton.phi() > phiRange.second)
654+
if ((*daughterPhoton).phi() < phiRange.first || (*daughterPhoton).phi() > phiRange.second)
640655
return false;
656+
daughterPhoton++;
641657
}
642658
return true;
643659
}
@@ -1777,7 +1793,7 @@ struct PhotonChargedTriggerCorrelation {
17771793

17781794
auto const funcCorrelation = [this](auto const& collision, auto const& trigger, auto const& associated) {
17791795
// exclude self correlation
1780-
if (trigger.jetTrackId() == associated.posJetTrack1Id() || trigger.jetTrackId() == associated.negJetTrack1Id(),
1796+
if (trigger.jetTrackId() == associated.posJetTrack1Id() || trigger.jetTrackId() == associated.negJetTrack1Id() ||
17811797
trigger.jetTrackId() == associated.posJetTrack2Id() || trigger.jetTrackId() == associated.negJetTrack2Id())
17821798
return;
17831799

PWGJE/Tasks/photonChargedTriggerProducer.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,26 @@
2626
#include "Common/DataModel/PIDResponseTOF.h"
2727
#include "Common/DataModel/PIDResponseTPC.h"
2828

29+
#include <CommonConstants/MathConstants.h>
2930
#include <Framework/ASoAHelpers.h>
3031
#include <Framework/AnalysisDataModel.h>
3132
#include <Framework/AnalysisHelpers.h>
3233
#include <Framework/AnalysisTask.h>
3334
#include <Framework/Configurable.h>
35+
#include <Framework/HistogramRegistry.h>
36+
#include <Framework/HistogramSpec.h>
3437
#include <Framework/InitContext.h>
3538
#include <Framework/O2DatabasePDGPlugin.h>
39+
#include <Framework/OutputObjHeader.h>
3640
#include <Framework/runDataProcessing.h>
3741

3842
#include <Math/Vector4D.h> // IWYU pragma: keep (do not replace with Math/Vector4Dfwd.h)
3943
#include <Math/Vector4Dfwd.h>
4044

4145
#include <cmath>
46+
#include <concepts>
4247
#include <string>
48+
#include <type_traits>
4349
#include <vector>
4450

4551
using namespace o2;

0 commit comments

Comments
 (0)