@@ -95,6 +95,7 @@ struct DiHadronCor {
9595 O2_DEFINE_CONFIGURABLE (cfgCutOccupancyHigh, int , 2000 , " High cut on TPC occupancy" )
9696 O2_DEFINE_CONFIGURABLE (cfgCutOccupancyLow, int , 0 , " Low cut on TPC occupancy" )
9797 O2_DEFINE_CONFIGURABLE (cfgEfficiency, std::string, " " , " CCDB path to efficiency object" )
98+ O2_DEFINE_CONFIGURABLE (cfgCentralityWeight, std::string, " " , " CCDB path to centrality weight object" )
9899 O2_DEFINE_CONFIGURABLE (cfgLocalEfficiency, bool , false , " Use local efficiency object" )
99100 O2_DEFINE_CONFIGURABLE (cfgVerbosity, bool , false , " Verbose output" )
100101 O2_DEFINE_CONFIGURABLE (cfgUseEventWeights, bool , false , " Use event weights for mixed event" )
@@ -156,6 +157,7 @@ struct DiHadronCor {
156157
157158 // Corrections
158159 TH3D* mEfficiency = nullptr ;
160+ TH1D* mCentralityWeight = nullptr ;
159161 bool correctionsLoaded = false ;
160162
161163 // Define the outputs
@@ -381,7 +383,7 @@ struct DiHadronCor {
381383 return true ;
382384 }
383385
384- void loadEfficiency (uint64_t timestamp)
386+ void loadCorrection (uint64_t timestamp)
385387 {
386388 if (correctionsLoaded) {
387389 return ;
@@ -398,6 +400,13 @@ struct DiHadronCor {
398400 }
399401 LOGF (info, " Loaded efficiency histogram from %s (%p)" , cfgEfficiency.value .c_str (), (void *)mEfficiency );
400402 }
403+ if (cfgCentralityWeight.value .empty () == false ) {
404+ mCentralityWeight = ccdb->getForTimeStamp <TH1D>(cfgCentralityWeight, timestamp);
405+ if (mCentralityWeight == nullptr ) {
406+ LOGF (fatal, " Could not load efficiency histogram for trigger particles from %s" , cfgCentralityWeight.value .c_str ());
407+ }
408+ LOGF (info, " Loaded efficiency histogram from %s (%p)" , cfgCentralityWeight.value .c_str (), (void *)mCentralityWeight );
409+ }
401410 correctionsLoaded = true ;
402411 }
403412
@@ -418,6 +427,19 @@ struct DiHadronCor {
418427 return true ;
419428 }
420429
430+ bool getCentralityWeight (float & weightCent, const float centrality)
431+ {
432+ float weight = 1 .;
433+ if (mCentralityWeight )
434+ weight = mCentralityWeight ->GetBinContent (mCentralityWeight ->FindBin (centrality));
435+ else
436+ weight = 1.0 ;
437+ if (weight == 0 )
438+ return false ;
439+ weightCent = weight;
440+ return true ;
441+ }
442+
421443 // fill multiple histograms
422444 template <typename TCollision, typename TTracks>
423445 void fillYield (TCollision collision, TTracks tracks) // function to fill the yield and etaphi histograms.
@@ -713,12 +735,15 @@ struct DiHadronCor {
713735 return ;
714736 }
715737
716- loadEfficiency (bc.timestamp ());
738+ loadCorrection (bc.timestamp ());
717739 registry.fill (HIST (" eventcount" ), SameEvent); // because its same event i put it in the 1 bin
718740 fillYield (collision, tracks);
741+ float weightCent = 1 .0f ;
742+ if (!cfgCentTableUnavailable)
743+ getCentralityWeight (weightCent, cent);
719744
720745 same->fillEvent (tracks.size (), CorrelationContainer::kCFStepReconstructed );
721- fillCorrelations<CorrelationContainer::kCFStepReconstructed >(tracks, tracks, collision.posZ (), SameEvent, getMagneticField (bc.timestamp ()), cent, 1 . 0f );
746+ fillCorrelations<CorrelationContainer::kCFStepReconstructed >(tracks, tracks, collision.posZ (), SameEvent, getMagneticField (bc.timestamp ()), cent, weightCent );
722747 }
723748 PROCESS_SWITCH (DiHadronCor, processSame, " Process same event" , true );
724749
@@ -768,13 +793,16 @@ struct DiHadronCor {
768793
769794 registry.fill (HIST (" eventcount" ), MixedEvent); // fill the mixed event in the 3 bin
770795 auto bc = collision1.bc_as <aod::BCsWithTimestamps>();
771- loadEfficiency (bc.timestamp ());
796+ loadCorrection (bc.timestamp ());
772797 float eventWeight = 1 .0f ;
773798 if (cfgUseEventWeights) {
774799 eventWeight = 1 .0f / it.currentWindowNeighbours ();
775800 }
801+ float weightCent = 1 .0f ;
802+ if (!cfgCentTableUnavailable)
803+ getCentralityWeight (weightCent, cent1);
776804
777- fillCorrelations<CorrelationContainer::kCFStepReconstructed >(tracks1, tracks2, collision1.posZ (), MixedEvent, getMagneticField (bc.timestamp ()), cent1, eventWeight);
805+ fillCorrelations<CorrelationContainer::kCFStepReconstructed >(tracks1, tracks2, collision1.posZ (), MixedEvent, getMagneticField (bc.timestamp ()), cent1, eventWeight * weightCent );
778806 }
779807 }
780808
0 commit comments