3333#include " PWGHF/Utils/utilsTrkCandHf.h"
3434#include " PWGLF/DataModel/mcCentrality.h"
3535
36+ #include " Common/CCDB/ctpRateFetcher.h"
3637#include " Common/Core/RecoDecay.h"
3738#include " Common/Core/trackUtilities.h"
3839#include " Common/DataModel/Centrality.h"
@@ -112,10 +113,12 @@ struct HfCandidateCreator2Prong {
112113 Configurable<std::string> ccdbUrl{" ccdbUrl" , " http://alice-ccdb.cern.ch" , " url of the ccdb repository" };
113114 Configurable<std::string> ccdbPathGrp{" ccdbPathGrp" , " GLO/GRP/GRP" , " Path of the grp file (Run 2)" };
114115 Configurable<std::string> ccdbPathGrpMag{" ccdbPathGrpMag" , " GLO/Config/GRPMagField" , " CCDB path of the GRPMagField object (Run 3)" };
116+ Configurable<std::string> irSource{" irSource" , " ZNC hadronic" , " Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)" };
115117
116118 HfEventSelection hfEvSel; // event selection and monitoring
117119 o2::vertexing::DCAFitterN<2 > df; // 2-prong vertex fitter
118120 Service<o2::ccdb::BasicCCDBManager> ccdb;
121+ ctpRateFetcher mRateFetcher ;
119122
120123 int runNumber{0 };
121124 double bz{0 .};
@@ -742,9 +745,10 @@ struct HfCandidateCreator2Prong {
742745 float centrality{-1 .f };
743746 const auto occupancy = o2::hf_occupancy::getOccupancyColl (collision, hfEvSel.occEstimator );
744747 const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask <true , CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
745-
748+ const auto bc = collision.template foundBC_as <aod::BCsWithTimestamps>();
749+ const auto ir = mRateFetcher .fetch (ccdb.service , bc.timestamp (), bc.runNumber (), irSource, true ); // Hz
746750 // / monitor the satisfied event selections
747- hfEvSel.fillHistograms (collision, rejectionMask, centrality, occupancy);
751+ hfEvSel.fillHistograms (collision, rejectionMask, centrality, occupancy, ir );
748752
749753 } // / end loop over collisions
750754 }
@@ -760,9 +764,10 @@ struct HfCandidateCreator2Prong {
760764 float centrality{-1 .f };
761765 const auto occupancy = o2::hf_occupancy::getOccupancyColl (collision, hfEvSel.occEstimator );
762766 const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask <true , CentralityEstimator::FT0C, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
763-
767+ const auto bc = collision.template foundBC_as <aod::BCsWithTimestamps>();
768+ const auto ir = mRateFetcher .fetch (ccdb.service , bc.timestamp (), bc.runNumber (), irSource, true ); // Hz
764769 // / monitor the satisfied event selections
765- hfEvSel.fillHistograms (collision, rejectionMask, centrality, occupancy);
770+ hfEvSel.fillHistograms (collision, rejectionMask, centrality, occupancy, ir );
766771
767772 } // / end loop over collisions
768773 }
@@ -778,9 +783,10 @@ struct HfCandidateCreator2Prong {
778783 float centrality{-1 .f };
779784 const auto occupancy = o2::hf_occupancy::getOccupancyColl (collision, hfEvSel.occEstimator );
780785 const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask <true , CentralityEstimator::FT0M, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
781-
786+ const auto bc = collision.template foundBC_as <aod::BCsWithTimestamps>();
787+ const auto ir = mRateFetcher .fetch (ccdb.service , bc.timestamp (), bc.runNumber (), irSource, true ); // Hz
782788 // / monitor the satisfied event selections
783- hfEvSel.fillHistograms (collision, rejectionMask, centrality, occupancy);
789+ hfEvSel.fillHistograms (collision, rejectionMask, centrality, occupancy, ir );
784790
785791 } // / end loop over collisions
786792 }
@@ -801,9 +807,10 @@ struct HfCandidateCreator2Prong {
801807 float centrality{-1 .f };
802808 const auto occupancy = o2::hf_occupancy::getOccupancyColl (collision, hfEvSel.occEstimator );
803809 const auto rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc <true , CentralityEstimator::None, aod::BcFullInfos>(collision, centrality, ccdb, registry, bcs);
804-
810+ const auto bc = collision.template foundBC_as <aod::BcFullInfos>();
811+ const auto ir = mRateFetcher .fetch (ccdb.service , bc.timestamp (), bc.runNumber (), irSource, true ); // Hz
805812 // / monitor the satisfied event selections
806- hfEvSel.fillHistograms (collision, rejectionMask, centrality, occupancy);
813+ hfEvSel.fillHistograms (collision, rejectionMask, centrality, occupancy, ir );
807814
808815 } // / end loop over collisions
809816 }
0 commit comments