4141
4242#include < TF1.h>
4343#include < TH1.h>
44+ #include < TH2.h>
4445#include < TH3.h>
4546#include < TNamed.h>
4647#include < TObjArray.h>
@@ -118,6 +119,8 @@ struct FlowFlucGfwPp {
118119
119120 static constexpr int EllipticQVectorHarmonic = 2 ;
120121 static constexpr int TriangularQVectorHarmonic = 3 ;
122+ static constexpr int PtEfficiencyHistogramDimension = 1 ;
123+ static constexpr int PtEtaEfficiencyHistogramDimension = 2 ;
121124
122125 O2_DEFINE_CONFIGURABLE (cfgNbootstrap, int , 10 , " Number of subsamples" )
123126 O2_DEFINE_CONFIGURABLE (cfgIsMC, bool , false , " Is MC event" )
@@ -240,7 +243,7 @@ struct FlowFlucGfwPp {
240243 Service<ccdb::BasicCCDBManager> ccdb;
241244
242245 struct Config {
243- TH1D * mEfficiency = nullptr ;
246+ TH1 * mEfficiency = nullptr ;
244247 GFWWeights* mAcceptance ;
245248 bool correctionsLoaded = false ;
246249 } cfg;
@@ -539,7 +542,9 @@ struct FlowFlucGfwPp {
539542 registry.add (" eventQA/before/centGlobal_centT0C" , " " , {HistType::kTH2D , {centAxis, centAxis}});
540543 registry.add (" eventQA/before/centNTPV_centT0C" , " " , {HistType::kTH2D , {centAxis, centAxis}});
541544 if (cfgIsMC || doprocessMC) {
545+ registry.add (" MCReco/trackQA/pt_eta" , " matched reconstructed primary particles;#it{p}_{T};#eta" , {HistType::kTH2D , {ptAxis, etaAxis}});
542546 registry.add (" MCGen/trackQA/phi_eta_vtxZ" , " " , {HistType::kTH3D , {phiAxis, etaAxis, vtxAxis}});
547+ registry.add (" MCGen/trackQA/pt_eta" , " generated primary particles;#it{p}_{T};#eta" , {HistType::kTH2D , {ptAxis, etaAxis}});
543548 registry.add (" MCGen/trackQA/nch_pt" , " #it{p}_{T} vs multiplicity; N_{ch}; #it{p}_{T}" , {HistType::kTH2D , {nchAxis, ptAxis}});
544549 registry.add (" MCGen/trackQA/pt_ref" , " " , {HistType::kTH1D , {{100 , o2::analysis::gfwflowflucpp::ptreflow, o2::analysis::gfwflowflucpp::ptrefup}}});
545550 registry.add (" MCGen/trackQA/pt_poi" , " " , {HistType::kTH1D , {{100 , o2::analysis::gfwflowflucpp::ptpoilow, o2::analysis::gfwflowflucpp::ptpoiup}}});
@@ -677,11 +682,14 @@ struct FlowFlucGfwPp {
677682 cfg.mAcceptance = ccdb->getForTimeStamp <GFWWeights>(cfgAcceptance.value + runstr, timestamp);
678683 }
679684 if (!cfgEfficiency.value .empty ()) {
680- cfg.mEfficiency = ccdb->getForTimeStamp <TH1D >(cfgEfficiency, timestamp);
685+ cfg.mEfficiency = ccdb->getForTimeStamp <TH1 >(cfgEfficiency, timestamp);
681686 if (cfg.mEfficiency == nullptr ) {
682687 LOGF (fatal, " Could not load efficiency histogram from %s" , cfgEfficiency.value .c_str ());
683688 }
684- LOGF (info, " Loaded efficiency histogram from %s (%p)" , cfgEfficiency.value .c_str (), (void *)cfg.mEfficiency );
689+ if (cfg.mEfficiency ->GetDimension () != PtEfficiencyHistogramDimension && cfg.mEfficiency ->GetDimension () != PtEtaEfficiencyHistogramDimension) {
690+ LOGF (fatal, " Efficiency object from %s has unsupported dimension %d. Expected pT or pT-eta." , cfgEfficiency.value .c_str (), cfg.mEfficiency ->GetDimension ());
691+ }
692+ LOGF (info, " Loaded %dD efficiency histogram from %s (%p)" , cfg.mEfficiency ->GetDimension (), cfgEfficiency.value .c_str (), (void *)cfg.mEfficiency );
685693 }
686694 cfg.correctionsLoaded = true ;
687695 }
@@ -699,9 +707,19 @@ struct FlowFlucGfwPp {
699707 double getEfficiency (TTrack track)
700708 {
701709 double eff = 1 .;
702- if (cfg.mEfficiency )
703- eff = cfg.mEfficiency ->GetBinContent (cfg.mEfficiency ->FindBin (track.pt ()));
704- if (eff == 0 )
710+ if (cfg.mEfficiency ) {
711+ if (cfg.mEfficiency ->GetDimension () == PtEtaEfficiencyHistogramDimension) {
712+ auto * efficiencyPtEta = dynamic_cast <TH2 *>(cfg.mEfficiency );
713+ if (efficiencyPtEta == nullptr ) {
714+ LOGF (fatal, " Loaded pT-eta efficiency object is not a TH2" );
715+ return -1 .;
716+ }
717+ eff = efficiencyPtEta->GetBinContent (efficiencyPtEta->FindBin (track.pt (), track.eta ()));
718+ } else {
719+ eff = cfg.mEfficiency ->GetBinContent (cfg.mEfficiency ->FindBin (track.pt ()));
720+ }
721+ }
722+ if (!std::isfinite (eff) || eff <= 0 )
705723 return -1 .;
706724 else
707725 return 1 . / eff;
@@ -1265,6 +1283,7 @@ struct FlowFlucGfwPp {
12651283
12661284 if (cfgFillQA) {
12671285 fillTrackQA<kReco , kAfter >(track, vtxz);
1286+ registry.fill (HIST (" MCReco/trackQA/pt_eta" ), track.pt (), track.eta ());
12681287 registry.fill (HIST (" trackQA/after/nch_pt" ), multiplicity, track.pt ());
12691288 if (cfgRunByRun) {
12701289 th1sList[run][hPhi]->Fill (track.phi ());
@@ -1275,11 +1294,16 @@ struct FlowFlucGfwPp {
12751294 } else if constexpr (framework::has_type_v<aod::mcparticle::McCollisionId, typename TTrack::all_columns>) {
12761295 if (!track.isPhysicalPrimary () || !isStable (track.pdgCode ()))
12771296 return ;
1297+ if (std::abs (track.eta ()) > cfgEta)
1298+ return ;
1299+ if (track.pt () < cfgPtmin || track.pt () > cfgPtmax)
1300+ return ;
12781301
12791302 fillGFW<kGen >(track, vtxz);
12801303 fillAcceptedTracks (track, acceptedTracks);
12811304 if (cfgFillQA && cfgIsMC) {
12821305 fillTrackQA<kGen , kAfter >(track, vtxz);
1306+ registry.fill (HIST (" MCGen/trackQA/pt_eta" ), track.pt (), track.eta ());
12831307 registry.fill (HIST (" MCGen/trackQA/nch_pt" ), multiplicity, track.pt ());
12841308 }
12851309 } else {
0 commit comments