Skip to content

Commit e82cafc

Browse files
committed
[PWGJE] introducing TESTBIT and .empty()
1 parent d671b28 commit e82cafc

1 file changed

Lines changed: 23 additions & 23 deletions

File tree

PWGJE/Tasks/gammaJetTreeProducer.cxx

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ struct GammaJetTreeProducer {
309309
trackSourceIndex.push_back(originalIndex);
310310
}
311311
}
312-
if (trackEta.size() > 0) {
312+
if (!trackEta.empty()) {
313313
delete trackTree;
314314
trackTree = new TKDTree<int, float>(trackEta.size(), 2, 1);
315315
trackTree->SetData(0, trackEta.data());
@@ -358,7 +358,7 @@ struct GammaJetTreeProducer {
358358
mcParticleSourceIndex.push_back(originalIndex);
359359
}
360360
}
361-
if (mcParticleEta.size() > 0) {
361+
if (!mcParticleEta.empty()) {
362362
delete mcParticleTree;
363363
mcParticleTree = new TKDTree<int, float>(mcParticleEta.size(), 2, 1);
364364
mcParticleTree->SetData(0, mcParticleEta.data());
@@ -924,7 +924,7 @@ struct GammaJetTreeProducer {
924924
/// \brief Gets the origin bitmap for a cluster
925925
/// \param cluster The cluster to check
926926
/// \param mcParticles The MC particles collection
927-
/// \return A a pari containing the bitmap of the origin of the particle, as well as the MC index of the associated MC gen particle
927+
/// \return A pair containing the bitmap of the origin of the particle, as well as the MC index of the associated MC gen particle
928928
template <typename T, typename U>
929929
std::pair<uint16_t, int> getClusterOrigin(const T& cluster, U const& mcParticles)
930930
{
@@ -1244,43 +1244,43 @@ struct GammaJetTreeProducer {
12441244
auto [origin, mcIndex] = getClusterOrigin(mcCluster, mcParticles);
12451245
float leadingEnergyFraction = mcCluster.amplitudeA()[0] / mcCluster.energy();
12461246
// Fill MC origin QA histograms
1247-
if ((origin & (1 << static_cast<uint16_t>(gjanalysis::ClusterOrigin::kPhoton))) != 0) {
1247+
if (TESTBIT(origin, static_cast<uint16_t>(gjanalysis::ClusterOrigin::kPhoton))) {
12481248
mHistograms.fill(HIST("clusterMC_E_Photon"), mcCluster.energy());
12491249
mHistograms.fill(HIST("clusterMC_m02_Photon"), mcCluster.m02());
12501250
}
1251-
if ((origin & (1 << static_cast<uint16_t>(gjanalysis::ClusterOrigin::kPromptPhoton))) != 0) {
1251+
if (TESTBIT(origin, static_cast<uint16_t>(gjanalysis::ClusterOrigin::kPromptPhoton))) {
12521252
mHistograms.fill(HIST("clusterMC_E_PromptPhoton"), mcCluster.energy());
12531253
mHistograms.fill(HIST("clusterMC_m02_PromptPhoton"), mcCluster.m02());
12541254
}
1255-
if ((origin & (1 << static_cast<uint16_t>(gjanalysis::ClusterOrigin::kDirectPromptPhoton))) != 0) {
1255+
if (TESTBIT(origin, static_cast<uint16_t>(gjanalysis::ClusterOrigin::kDirectPromptPhoton))) {
12561256
mHistograms.fill(HIST("clusterMC_E_DirectPromptPhoton"), mcCluster.energy());
12571257
mHistograms.fill(HIST("clusterMC_m02_DirectPromptPhoton"), mcCluster.m02());
12581258
}
1259-
if ((origin & (1 << static_cast<uint16_t>(gjanalysis::ClusterOrigin::kFragmentationPhoton))) != 0) {
1259+
if (TESTBIT(origin, static_cast<uint16_t>(gjanalysis::ClusterOrigin::kFragmentationPhoton))) {
12601260
mHistograms.fill(HIST("clusterMC_E_FragmentationPhoton"), mcCluster.energy());
12611261
mHistograms.fill(HIST("clusterMC_m02_FragmentationPhoton"), mcCluster.m02());
12621262
}
1263-
if ((origin & (1 << static_cast<uint16_t>(gjanalysis::ClusterOrigin::kDecayPhoton))) != 0) {
1263+
if (TESTBIT(origin, static_cast<uint16_t>(gjanalysis::ClusterOrigin::kDecayPhoton))) {
12641264
mHistograms.fill(HIST("clusterMC_E_DecayPhoton"), mcCluster.energy());
12651265
mHistograms.fill(HIST("clusterMC_m02_DecayPhoton"), mcCluster.m02());
12661266
}
1267-
if ((origin & (1 << static_cast<uint16_t>(gjanalysis::ClusterOrigin::kDecayPhotonPi0))) != 0) {
1267+
if (TESTBIT(origin, static_cast<uint16_t>(gjanalysis::ClusterOrigin::kDecayPhotonPi0))) {
12681268
mHistograms.fill(HIST("clusterMC_E_DecayPhotonPi0"), mcCluster.energy());
12691269
mHistograms.fill(HIST("clusterMC_m02_DecayPhotonPi0"), mcCluster.m02());
12701270
}
1271-
if ((origin & (1 << static_cast<uint16_t>(gjanalysis::ClusterOrigin::kDecayPhotonEta))) != 0) {
1271+
if (TESTBIT(origin, static_cast<uint16_t>(gjanalysis::ClusterOrigin::kDecayPhotonEta))) {
12721272
mHistograms.fill(HIST("clusterMC_E_DecayPhotonEta"), mcCluster.energy());
12731273
mHistograms.fill(HIST("clusterMC_m02_DecayPhotonEta"), mcCluster.m02());
12741274
}
1275-
if ((origin & (1 << static_cast<uint16_t>(gjanalysis::ClusterOrigin::kMergedPi0))) != 0) {
1275+
if (TESTBIT(origin, static_cast<uint16_t>(gjanalysis::ClusterOrigin::kMergedPi0))) {
12761276
mHistograms.fill(HIST("clusterMC_E_MergedPi0"), mcCluster.energy());
12771277
mHistograms.fill(HIST("clusterMC_m02_MergedPi0"), mcCluster.m02());
12781278
}
1279-
if ((origin & (1 << static_cast<uint16_t>(gjanalysis::ClusterOrigin::kMergedEta))) != 0) {
1279+
if (TESTBIT(origin, static_cast<uint16_t>(gjanalysis::ClusterOrigin::kMergedEta))) {
12801280
mHistograms.fill(HIST("clusterMC_E_MergedEta"), mcCluster.energy());
12811281
mHistograms.fill(HIST("clusterMC_m02_MergedEta"), mcCluster.m02());
12821282
}
1283-
if ((origin & (1 << static_cast<uint16_t>(gjanalysis::ClusterOrigin::kConvertedPhoton))) != 0) {
1283+
if (TESTBIT(origin, static_cast<uint16_t>(gjanalysis::ClusterOrigin::kConvertedPhoton))) {
12841284
mHistograms.fill(HIST("clusterMC_E_ConvertedPhoton"), mcCluster.energy());
12851285
mHistograms.fill(HIST("clusterMC_m02_ConvertedPhoton"), mcCluster.m02());
12861286
}
@@ -1357,7 +1357,7 @@ struct GammaJetTreeProducer {
13571357
fastjet::ClusterSequenceArea clusterSeq(jetReclusterer.findJets(jetConstituents, jetReclustered));
13581358
jetReclustered = sorted_by_pt(jetReclustered);
13591359

1360-
if (jetReclustered.size() == 0) {
1360+
if (jetReclustered.empty()) {
13611361
return;
13621362
}
13631363

@@ -1412,7 +1412,7 @@ struct GammaJetTreeProducer {
14121412
fastjet::ClusterSequenceArea clusterSeq(jetReclusterer.findJets(jetConstituents, jetReclustered));
14131413
jetReclustered = sorted_by_pt(jetReclustered);
14141414

1415-
if (jetReclustered.size() == 0) {
1415+
if (jetReclustered.empty()) {
14161416
return;
14171417
}
14181418

@@ -1525,28 +1525,28 @@ struct GammaJetTreeProducer {
15251525
mHistograms.fill(HIST("mcGenTrigger_Eta"), particle.eta());
15261526
mHistograms.fill(HIST("mcGenTrigger_Phi"), particle.phi());
15271527
mHistograms.fill(HIST("mcGenTrigger_Pt"), particle.pt());
1528-
if ((origin & (1 << static_cast<uint16_t>(gjanalysis::ParticleOrigin::kPromptPhoton))) != 0) {
1528+
if (TESTBIT(origin, static_cast<uint16_t>(gjanalysis::ParticleOrigin::kPromptPhoton))) {
15291529
mHistograms.fill(HIST("mcGenTrigger_E_PromptPhoton"), particle.energy());
15301530
}
1531-
if ((origin & (1 << static_cast<uint16_t>(gjanalysis::ParticleOrigin::kDirectPromptPhoton))) != 0) {
1531+
if (TESTBIT(origin, static_cast<uint16_t>(gjanalysis::ParticleOrigin::kDirectPromptPhoton))) {
15321532
mHistograms.fill(HIST("mcGenTrigger_E_DirectPromptPhoton"), particle.energy());
15331533
}
1534-
if ((origin & (1 << static_cast<uint16_t>(gjanalysis::ParticleOrigin::kFragmentationPhoton))) != 0) {
1534+
if (TESTBIT(origin, static_cast<uint16_t>(gjanalysis::ParticleOrigin::kFragmentationPhoton))) {
15351535
mHistograms.fill(HIST("mcGenTrigger_E_FragmentationPhoton"), particle.energy());
15361536
}
1537-
if ((origin & (1 << static_cast<uint16_t>(gjanalysis::ParticleOrigin::kDecayPhoton))) != 0) {
1537+
if (TESTBIT(origin, static_cast<uint16_t>(gjanalysis::ParticleOrigin::kDecayPhoton))) {
15381538
mHistograms.fill(HIST("mcGenTrigger_E_DecayPhoton"), particle.energy());
15391539
}
1540-
if ((origin & (1 << static_cast<uint16_t>(gjanalysis::ParticleOrigin::kDecayPhotonPi0))) != 0) {
1540+
if (TESTBIT(origin, static_cast<uint16_t>(gjanalysis::ParticleOrigin::kDecayPhotonPi0))) {
15411541
mHistograms.fill(HIST("mcGenTrigger_E_DecayPhotonPi0"), particle.energy());
15421542
}
1543-
if ((origin & (1 << static_cast<uint16_t>(gjanalysis::ParticleOrigin::kDecayPhotonEta))) != 0) {
1543+
if (TESTBIT(origin, static_cast<uint16_t>(gjanalysis::ParticleOrigin::kDecayPhotonEta))) {
15441544
mHistograms.fill(HIST("mcGenTrigger_E_DecayPhotonEta"), particle.energy());
15451545
}
1546-
if ((origin & (1 << static_cast<uint16_t>(gjanalysis::ParticleOrigin::kDecayPhotonOther))) != 0) {
1546+
if (TESTBIT(origin, static_cast<uint16_t>(gjanalysis::ParticleOrigin::kDecayPhotonOther))) {
15471547
mHistograms.fill(HIST("mcGenTrigger_E_DecayPhotonOther"), particle.energy());
15481548
}
1549-
if ((origin & (1 << static_cast<uint16_t>(gjanalysis::ParticleOrigin::kPi0))) != 0) {
1549+
if (TESTBIT(origin, static_cast<uint16_t>(gjanalysis::ParticleOrigin::kPi0))) {
15501550
mHistograms.fill(HIST("mcGenTrigger_E_Pi0"), particle.energy());
15511551
}
15521552
}

0 commit comments

Comments
 (0)