Skip to content

Commit 80eda41

Browse files
committed
clang-tidy fixes for includes + fixes to hSelectionV0s filling
1 parent 4332fab commit 80eda41

File tree

3 files changed

+51
-22
lines changed

3 files changed

+51
-22
lines changed

PWGLF/DataModel/lambdaJetPolarizationIons.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
#include <Framework/ASoA.h>
2424
#include <cmath>
25-
#include <cstdint>
2625

2726
namespace o2::aod
2827
{

PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,16 @@
2828

2929
// Standard Library
3030
#include <cmath>
31-
#include <cstdint>
31+
#include <cstddef>
3232
#include <map>
33+
#include <stdexcept>
3334
#include <string>
3435
#include <vector>
3536

3637
// PWGLF
3738
#include "PWGLF/DataModel/lambdaJetPolarizationIons.h"
39+
#include "RCTSelectionFlags.h"
40+
#include "EventSelectionParams.h"
3841
#include "PWGLF/DataModel/LFStrangenessPIDTables.h"
3942
// #include "Common/DataModel/PIDResponseTOF.h" // Maybe switch this around with LFStrangenessPIDTables?
4043
#include "PWGLF/DataModel/LFStrangenessTables.h" // For V0TOFPIDs and NSigmas getters. Better for considering the daughters as coming from V0s instead of from PV:
@@ -57,36 +60,42 @@
5760

5861
// Common Core
5962
#include "Common/Core/RecoDecay.h"
60-
#include "Common/Core/TrackSelection.h"
6163

6264
// Framework
65+
#include <CommonConstants/MathConstants.h>
66+
#include <CommonConstants/PhysicsConstants.h>
6367
#include <Framework/ASoA.h>
6468
#include <Framework/AnalysisDataModel.h>
69+
#include <Framework/AnalysisHelpers.h>
6570
#include <Framework/AnalysisTask.h>
71+
#include <Framework/HistogramRegistry.h>
72+
#include <Framework/Configurable.h>
73+
#include <Framework/HistogramSpec.h>
74+
#include <Framework/InitContext.h>
75+
#include <Framework/DataTypes.h>
6676
#include <Framework/Logger.h>
77+
#include <Framework/OutputObjHeader.h>
6778
#include <Framework/runDataProcessing.h>
6879

6980
// O2 subsystems
7081
#include <CCDB/BasicCCDBManager.h>
7182
#include <CCDB/CcdbApi.h>
7283
#include "Common/CCDB/ctpRateFetcher.h"
7384
#include <DataFormatsParameters/GRPMagField.h>
74-
#include <ReconstructionDataFormats/Track.h>
7585

7686
// External libraries
7787
#include <fastjet/AreaDefinition.hh>
7888
#include <fastjet/ClusterSequence.hh>
7989
#include <fastjet/ClusterSequenceArea.hh>
8090
#include <fastjet/GhostedAreaSpec.hh>
91+
#include <fastjet/JetDefinition.hh>
8192
#include <fastjet/PseudoJet.hh>
82-
#include <fastjet/Selector.hh>
83-
#include <fastjet/tools/JetMedianBackgroundEstimator.hh>
84-
#include <fastjet/tools/Subtractor.hh>
93+
#include <sys/types.h>
8594

8695
// ROOT math
87-
#include "Math/GenVector/Boost.h"
88-
#include "Math/Vector3D.h"
89-
#include "Math/Vector4D.h"
96+
#include <TF1.h>
97+
#include <TH1.h>
98+
#include <TH2.h>
9099

91100
using namespace o2;
92101
using namespace o2::framework;
@@ -970,9 +979,24 @@ struct lambdajetpolarizationions {
970979
HistogramRegistry* histos = nullptr; // Had to pass the histos group to this struct, as it was not visible to the members of this struct
971980

972981
void resetForNewV0() { binValue = -1; }
982+
// Advance to targetBinX, filling all intermediate bins.
983+
// Use this for DISABLED cuts within a single hypothesis
984+
// (shows pass-through count as a flat line, making it visually
985+
// clear that the stage was not active).
986+
// (Replaces N dummy fill() calls)
987+
void fillUpTo(int targetBinX) {
988+
while (binValue < targetBinX)
989+
histos->fill(HIST("GeneralQA/hSelectionV0s"), ++binValue);
990+
}
991+
992+
void advanceTo(int targetBinX) { binValue = targetBinX - 1; } // next fill() lands at targetBin. Needed to deal with early exits at isLambda vs isAntiLambda checks
973993
void fill() { histos->fill(HIST("GeneralQA/hSelectionV0s"), ++binValue); } // Hardcoded hSelectionV0s histogram, as it will not change. Increments before filling, by default
974994
};
975-
V0SelectionFlowCounter V0SelCounter{0, &histos};
995+
V0SelectionFlowCounter V0SelCounter{-1, &histos}; // Could initialize with any index (resetForNewV0 is always called for a new V0 anyways)
996+
// Calculating some bins, for convenience:
997+
int nGenericCuts = 31; // x=0 to x=30
998+
int nHypoCuts = 9; // per hypothesis (x=31..39 for Lambda)
999+
int lambdaHypoEnd = nGenericCuts + nHypoCuts - 1; // x=39
9761000

9771001
// Minimal helper to fill hSelectionJetTracks, mirroring V0SelectionFlowCounter.
9781002
// Reset once per track candidate, fill once per passed cut stage.
@@ -982,7 +1006,7 @@ struct lambdajetpolarizationions {
9821006
void resetForNewTrack() { binValue = -1; }
9831007
void fill() { histos->fill(HIST("GeneralQA/hSelectionJetTracks"), ++binValue); }
9841008
};
985-
JetTrackSelectionFlowCounter JetTrackSelCounter{0, &histos};
1009+
JetTrackSelectionFlowCounter JetTrackSelCounter{-1, &histos};
9861010

9871011
// Short inlined helper to simplify QA
9881012
inline void fillEventSelectionQA(int bin, float centrality)
@@ -1418,11 +1442,8 @@ struct lambdajetpolarizationions {
14181442
// correct for the V0 mother's travel time and considers all tracks as if they came from the PV!
14191443
// if (protonHasTOF && std::fabs(protonTrack.tofNSigmaPr()) > v0Selections.tofPidNsigmaCutLaPr) return false;
14201444
// To properly use the LFStrangenessPIDTables version, you need to call o2-analysis-lf-strangenesstofpid too.
1421-
} else { // Should fill counters an equal number of times to advance indices (TODO: implement better solution, such as just advancing the index)
1422-
V0SelCounter.fill();
1423-
V0SelCounter.fill();
1424-
V0SelCounter.fill();
1425-
V0SelCounter.fill();
1445+
} else { // Should fill counters an equal number of times to advance indices
1446+
V0SelCounter.fillUpTo(V0SelCounter.binValue + 4); // Fills the 4 times "V0SelCounter.fill()" would be called
14261447
}
14271448

14281449
// proper lifetime
@@ -1766,8 +1787,11 @@ struct lambdajetpolarizationions {
17661787
bool isAntiLambda = false;
17671788
if (analyseLambda)
17681789
isLambda = passesLambdaLambdaBarHypothesis(v0, collision, true);
1769-
if (analyseAntiLambda)
1790+
if (analyseAntiLambda) {
1791+
if (analyseLambda) // We only need to advance when the Lambda hypothesis had an early exit on the counters
1792+
V0SelCounter.advanceTo(lambdaHypoEnd + 1); // sync to bin 41 (x=40 means bin 41, the first #bar{#Lambda} bin)
17701793
isAntiLambda = passesLambdaLambdaBarHypothesis(v0, collision, false);
1794+
}
17711795

17721796
if (!isLambda && !isAntiLambda)
17731797
continue; // Candidate is not considered to be a Lambda-like

PWGLF/Tasks/Strangeness/lambdaJetPolarizationIonsDerived.cxx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,33 @@
3030
// cicero.domenico.muncinelli@cern.ch
3131
//
3232

33+
#include <CommonConstants/PhysicsConstants.h>
34+
#include <CommonConstants/MathConstants.h>
3335
#include <Framework/ASoA.h>
34-
#include <Framework/ASoAHelpers.h>
3536
#include <Framework/AnalysisDataModel.h>
3637
#include <Framework/AnalysisTask.h>
37-
#include <Framework/Logger.h>
38+
#include <Framework/HistogramRegistry.h>
39+
#include <Framework/Configurable.h>
40+
#include <Framework/HistogramSpec.h>
41+
#include <Framework/InitContext.h>
42+
#include <Framework/OutputObjHeader.h>
3843
#include <Framework/runDataProcessing.h>
3944

4045
// Custom data model:
4146
#include "PWGLF/DataModel/lambdaJetPolarizationIons.h"
4247

4348
#include <cmath>
44-
#include <map>
49+
#include <optional>
4550
#include <string>
4651
#include <vector>
4752

4853
// #include <TLorentzVector.h>
4954
// #include <TVector3.h>
5055
// New recommended format:
51-
#include <Math/Vector3D.h>
56+
#include <Math/Vector3D.h> // clang-tidy usually confuses this! Careful!
5257
#include <Math/Vector4D.h>
5358
#include <Math/VectorUtil.h>
59+
#include <TProfile.h>
5460
#include <TRandom3.h> // For perpendicular jet direction QAs
5561

5662
using namespace o2;

0 commit comments

Comments
 (0)