@@ -73,6 +73,10 @@ using MyMuonAssocsSelected = soa::Join<aod::ReducedMuonsAssoc, aod::MuonTrackCut
7373constexpr static uint32_t gkEventFillMap = VarManager::ObjTypes::ReducedEvent | VarManager::ObjTypes::ReducedEventExtended;
7474constexpr static uint32_t gkMuonFillMap = VarManager::ObjTypes::ReducedMuon | VarManager::ObjTypes::ReducedMuonExtra;
7575
76+ // Declare helper function
77+ double getRapidity (const double pT, const double eta);
78+ double getWeight (const double pT, const std::vector<double >& pT_bins, const std::vector<double >& efficiency, const double eta_min, const double eta_max);
79+
7680struct DqJPsiMuonCorrelations {
7781
7882 // Configurables for the dilepton signal region
@@ -96,7 +100,8 @@ struct DqJPsiMuonCorrelations {
96100 ConfigurableAxis axisDeltaEta{" axisDeltaEta" , {10 , -2 .0f , 2 .0f }, " #Delta#eta" };
97101
98102 // Configurable for acceptance efficiency correction
99- Configurable<std::vector<double >> fConfigBinEff {" cfgBinEff" , std::vector<double >{1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f }, " acceptance efficiency correction factors for each pT bin" };
103+ Configurable<std::vector<double >> fConfigBinEffJPsi {" cfgBinEffJPsi" , std::vector<double >{1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f }, " acceptance efficiency correction factors for each pT bin" };
104+ Configurable<std::vector<double >> fConfigBinEffMuon {" cfgBinEffMuon" , std::vector<double >{1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f , 1 .0f }, " acceptance efficiency correction factors for each pT bin" };
100105
101106 // Connect to ccdb
102107 Service<ccdb::BasicCCDBManager> ccdb;
@@ -124,9 +129,9 @@ struct DqJPsiMuonCorrelations {
124129 ccdb->setCreatedNotAfter (nolaterthan.value );
125130
126131 // Assert correct size of the efficiency correction vector
127- if (axisPt.value .size ()-2 != fConfigBinEff .value .size ()) {
128- LOGF (fatal, " Configurables axisPt: %zu must have one more value than fConfigBinEff : %zu (excluding 'VARIABLE_WIDTH' entry)" ,
129- axisPt.value .size ()-1 , fConfigBinEff .value .size ());
132+ if (axisPt.value .size ()-2 != fConfigBinEffJPsi . value . size () || axisPt. value . size ()- 2 != fConfigBinEffMuon .value .size ()) {
133+ LOGF (fatal, " Configurables axisPt: %zu must have one more value than fConfigBinEffJPsi: %zu and fConfigBinEffMuon : %zu (excluding 'VARIABLE_WIDTH' entry)" ,
134+ axisPt.value .size ()-1 , fConfigBinEffJPsi . value . size (), fConfigBinEffMuon .value .size ());
130135 }
131136
132137 // Set up varmanager variable names
@@ -171,8 +176,10 @@ struct DqJPsiMuonCorrelations {
171176 }
172177
173178 // Fill invariant mass vs pT histogram for the dileptons and for trigger counting
174- registry.fill (HIST (" h2dDimuonPtInvVsInvMass" ), dilepton.mass (), dilepton.pt ());
175- registry.fill (HIST (" h2dTriggersPtInvVsInvMassRegion" ), dilepton.mass (), dilepton.pt ());
179+ double w_dilepton = getWeight (dilepton.pt (), axisPt.value , fConfigBinEffJPsi .value , fConfigDileptonEtaMin , fConfigDileptonEtaMax );
180+
181+ registry.fill (HIST (" h2dDimuonPtInvVsInvMass" ), dilepton.mass (), dilepton.pt (), w_dilepton);
182+ registry.fill (HIST (" h2dTriggersPtInvVsInvMassRegion" ), dilepton.mass (), dilepton.pt (), w_dilepton);
176183
177184 for (auto & assoc : assocs) {
178185 // Check selection bit
@@ -194,6 +201,7 @@ struct DqJPsiMuonCorrelations {
194201 continue ;
195202 }
196203
204+ // Compute deltaEta and deltaPhi between the dilepton and the associated muon
197205 float deltaEta = track.eta () - dilepton.eta ();
198206 float deltaPhi = track.phi () - dilepton.phi ();
199207 if (deltaPhi < -constants::math::PI /2 .0f ) {
@@ -202,14 +210,15 @@ struct DqJPsiMuonCorrelations {
202210 deltaPhi -= 2 .0f * constants::math::PI ;
203211 }
204212
205- // TODO: Implement weights for efficiency and acceptance correction
213+ // Fill signal and background histograms based on the dilepton mass
214+ double w_muon = getWeight (track.pt (), axisPt.value , fConfigBinEffMuon .value , fConfigMuonEtaMin , fConfigMuonEtaMax );
206215
207216 if (dilepton.mass () > fConfigDileptonLowMass && dilepton.mass () < fConfigDileptonHighMass ) {
208- registry.fill (HIST (" h2dDimuonMuonDeltaEtaVsMuonPtSignal" ), deltaEta, track.pt ());
209- registry.fill (HIST (" h2dDimuonMuonDeltaPhiVsMuonPtSignal" ), deltaPhi, track.pt ());
217+ registry.fill (HIST (" h2dDimuonMuonDeltaEtaVsMuonPtSignal" ), deltaEta, track.pt (), w_dilepton * w_muon );
218+ registry.fill (HIST (" h2dDimuonMuonDeltaPhiVsMuonPtSignal" ), deltaPhi, track.pt (), w_dilepton * w_muon );
210219 } else if (dilepton.mass () > fConfigBackgroundLowMass && dilepton.mass () < fConfigBackgroundHighMass ) {
211- registry.fill (HIST (" h2dDimuonMuonDeltaEtaVsMuonPtBackground" ), deltaEta, track.pt ());
212- registry.fill (HIST (" h2dDimuonMuonDeltaPhiVsMuonPtBackground" ), deltaPhi, track.pt ());
220+ registry.fill (HIST (" h2dDimuonMuonDeltaEtaVsMuonPtBackground" ), deltaEta, track.pt (), w_dilepton * w_muon );
221+ registry.fill (HIST (" h2dDimuonMuonDeltaPhiVsMuonPtBackground" ), deltaPhi, track.pt (), w_dilepton * w_muon );
213222 }
214223 }
215224 }
@@ -233,3 +242,20 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
233242 return WorkflowSpec{
234243 adaptAnalysisTask<DqJPsiMuonCorrelations>(cfgc)};
235244}
245+
246+ double getRapidity (const double pT, const double eta) {
247+ double mJPsi = 3.096916 ; // J/Psi mass in GeV/c^2
248+ return log ((sqrt (pow (mJPsi , 2 ) + (pow (pT, 2 ) * pow (cosh (eta), 2 ))) + pT * sinh (eta)) / (sqrt (pow (mJPsi , 2 ) + pow (pT, 2 ))));
249+ }
250+
251+ double getWeight (const double pT, const std::vector<double >& pT_bins, const std::vector<double >& efficiency, const double eta_min, const double eta_max) {
252+
253+ int eff_bin = -1 ;
254+ for (size_t b = 0 ; b < pT_bins.size () - 1 ; ++b) {
255+ if (pT >= pT_bins[b] && pT < pT_bins[b + 1 ]) {
256+ eff_bin = b;
257+ break ;
258+ }
259+ }
260+ return 1.0 / (efficiency[eff_bin] * (getRapidity (pT, eta_max) - getRapidity (pT, eta_min)));
261+ }
0 commit comments