3131#include < Framework/AnalysisHelpers.h>
3232#include < Framework/AnalysisTask.h>
3333#include < Framework/Configurable.h>
34+ #include < Framework/HistogramRegistry.h>
35+ #include < Framework/HistogramSpec.h>
3436#include < Framework/InitContext.h>
3537#include < Framework/Logger.h>
3638#include < Framework/StaticFor.h>
@@ -68,9 +70,12 @@ struct TreeCreatorPidTpcQa {
6870 Configurable<bool > requireIts{" requireIts" , true , " Skip tracks without ITS" };
6971 Configurable<int16_t > cutMinTPCNcls{" cutMinTPCNcls" , 0 , " Minimum number or TPC Clusters for tracks" };
7072 Configurable<float > cutRapidity{" cutRapidity" , 999 .f , " Rapidity cut" };
71- Configurable<float > nClNorm{" nClNorm" , 152 ., " Number of cluster normalization. Run 2: 159, Run 3 152" };
73+ Configurable<float > nClNorm{" nClNorm" , 152 .f , " Number of cluster normalization. Run 2: 159, Run 3 152" };
7274 // Configurable for the path of CCDB General Run Parameters LHC Interface information
7375 Configurable<std::string> ccdbPathGrpLhcIf{" ccdbPathGrpLhcIf" , " GLO/Config/GRPLHCIF" , " Path on the CCDB for the GRPLHCIF object" };
76+ // Configurables for output tables reservation size
77+ Configurable<float > reserveRatio{" reserveRatio" , 1 .f , " Ratio of how many rows expected in the output table to the input Tracks table size" };
78+ Configurable<bool > saveReserveQaHisto{" saveReserveQaHisto" , true , " Flag to save the DF-wise ratio of output table size to that of input table" };
7479
7580#define DECLARE_PARTICLE_WISE_CONFIGURABLES (ParticleNameShort, ParticleNameLong ) \
7681 Configurable<float > cutTpcInnerParameterMin##ParticleNameLong{" cutTpcInnerParameterMin" #ParticleNameLong, 0 .f , " Lower-value cut on tpcInnerParam for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \
@@ -95,6 +100,8 @@ struct TreeCreatorPidTpcQa {
95100 DO_FOR_ALL_PARTICLES (PACK_CONFIGURABLES_TO_ARRAY )};
96101#undef PACK_CONFIGURABLES_TO_ARRAY
97102
103+ HistogramRegistry registry{" registry" , {}};
104+
98105 Service<o2::ccdb::BasicCCDBManager> ccdb{};
99106
100107 ctpRateFetcher mRateFetcher {};
@@ -105,6 +112,7 @@ struct TreeCreatorPidTpcQa {
105112 Preslice<TrackCandidates> perCollisionTracks = aod::track::collisionId;
106113
107114 int mEnabledParticles {0 };
115+ int mProcessedParticles {0 };
108116
109117 template <o2::track::PID ::ID Id>
110118 bool initPerParticle ()
@@ -148,13 +156,19 @@ struct TreeCreatorPidTpcQa {
148156 ccdb->setURL (" http://alice-ccdb.cern.ch" );
149157 ccdb->setCaching (true );
150158 ccdb->setFatalWhenNull (false );
159+
160+ if (saveReserveQaHisto) {
161+ registry.add (" hOutputRatio" , " Table out/in ratio;Table out/in ratio;Entries" , {HistType::kTH1F , {{100 , 0 , reserveRatio}}});
162+ }
151163 }
152164
153165 template <o2::track::PID ::ID Id, bool IsFullTable, bool IsTofTable, typename TrackType>
154166 void processSingleParticle (CollisionsExtra const & collisions,
155167 TrackType const & tracks)
156168 {
157- rowPidTpcQa.reserve (tracks.size () * mEnabledParticles );
169+ if (mProcessedParticles == 0 ) {
170+ rowPidTpcQa.reserve (tracks.size () * reserveRatio);
171+ }
158172
159173 std::string irSource{};
160174 float sqrtSNN{}; // placeholder to satisfy evaluateIrSourceAndSqrtSnn's signature
@@ -220,6 +234,13 @@ struct TreeCreatorPidTpcQa {
220234 rowPidTpcQa (Id, ft0Occ, hadronicRate, multTPC, nClNormalized, nclPID, phi, tgl, tpcInnerParam, rapidity, momentum, signed1Pt, nSigmaTpc, dedxExpected, dedxDiff, expSigma, nSigmaTof);
221235 } // tracksFromCollision
222236 } // collisions
237+ ++mProcessedParticles ;
238+ if (mProcessedParticles == mEnabledParticles ) {
239+ mProcessedParticles = 0 ;
240+ if (saveReserveQaHisto) {
241+ registry.fill (HIST (" hOutputRatio" ), static_cast <double >((rowPidTpcQa.lastIndex () + 1 )) / tracks.size ());
242+ }
243+ }
223244 }
224245
225246 // QA of nsigma only tables
0 commit comments