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:
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
91100using namespace o2 ;
92101using 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
0 commit comments