Skip to content

Commit da0c389

Browse files
committed
PWGEM/Dilepton: update DileptonHadronMPC.h
1 parent b790c39 commit da0c389

File tree

2 files changed

+114
-117
lines changed

2 files changed

+114
-117
lines changed

PWGEM/Dilepton/Core/DileptonHadronMPC.h

Lines changed: 85 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ using FilteredMyMuon = FilteredMyMuons::iterator;
9393

9494
using MyEMH_electron = o2::aod::pwgem::dilepton::utils::EventMixingHandler<std::tuple<int, int, int, int>, std::pair<int, int>, o2::aod::pwgem::dilepton::utils::EMTrack>;
9595
using MyEMH_muon = o2::aod::pwgem::dilepton::utils::EventMixingHandler<std::tuple<int, int, int, int>, std::pair<int, int>, o2::aod::pwgem::dilepton::utils::EMFwdTrack>;
96-
using MyEMH_track = o2::aod::pwgem::dilepton::utils::EventMixingHandler<std::tuple<int, int, int, int>, std::pair<int, int>, o2::aod::pwgem::dilepton::utils::EMTrack>; // for charged track
96+
using MyEMH_track = o2::aod::pwgem::dilepton::utils::EventMixingHandler<std::tuple<int, int, int, int>, std::pair<int, int>, o2::aod::pwgem::dilepton::utils::EMTrackUL>; // for charged track
9797

9898
template <o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType pairtype, typename TEMH, typename... Types>
9999
struct DileptonHadronMPC {
@@ -110,7 +110,7 @@ struct DileptonHadronMPC {
110110
o2::framework::Configurable<int> cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"};
111111
o2::framework::Configurable<int> cfgOccupancyEstimator{"cfgOccupancyEstimator", 0, "FT0C:0, Track:1"};
112112
o2::framework::Configurable<bool> cfgDoMix{"cfgDoMix", true, "flag for event mixing between 2 leptons (i.e. R factor)"};
113-
o2::framework::Configurable<int> ndepth_lepton{"ndepth_lepton", 100, "depth for event mixing between lepton-lepton"};
113+
o2::framework::Configurable<int> ndepth_lepton{"ndepth_lepton", 1, "depth for event mixing between lepton-lepton"};
114114
o2::framework::Configurable<int> ndepth_hadron{"ndepth_hadron", 10, "depth for event mixing between hadron-hadron"};
115115
o2::framework::Configurable<uint64_t> ndiff_bc_mix{"ndiff_bc_mix", 594, "difference in global BC required in mixed events"};
116116
o2::framework::ConfigurableAxis ConfVtxBins{"ConfVtxBins", {o2::framework::VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"};
@@ -121,14 +121,15 @@ struct DileptonHadronMPC {
121121
// Configurable<int> cfgNtracksPV08Max{"cfgNtracksPV08Max", static_cast<int>(1e+9), "max. multNTracksPV"};
122122
o2::framework::Configurable<bool> cfgApplyWeightTTCA{"cfgApplyWeightTTCA", false, "flag to apply weighting by 1/N"};
123123
o2::framework::Configurable<uint> cfgDCAType{"cfgDCAType", 0, "type of DCA for output. 0:3D, 1:XY, 2:Z, else:3D"};
124+
o2::framework::Configurable<bool> cfgDoLS{"cfgDoLS", false, "flag to analyze LS"}; // ULS is always analyzed.
124125

125126
o2::framework::ConfigurableAxis ConfMllBins{"ConfMllBins", {o2::framework::VARIABLE_WIDTH, 0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.05, 3.10, 3.15, 3.20, 3.25, 3.30, 3.35, 3.40, 3.45, 3.50, 3.55, 3.60, 3.65, 3.70, 3.75, 3.80, 3.85, 3.90, 3.95, 4.00}, "mll bins for output histograms"};
126127
o2::framework::ConfigurableAxis ConfPtllBins{"ConfPtllBins", {o2::framework::VARIABLE_WIDTH, 0.00, 0.15, 0.50, 1.00, 1.50, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pTll bins for output histograms"};
127128
o2::framework::ConfigurableAxis ConfDCAllBins{"ConfDCAllBins", {o2::framework::VARIABLE_WIDTH, 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, "DCAll bins for output histograms"};
128129

129130
o2::framework::ConfigurableAxis ConfPtHadronBins{"ConfPtHadronBins", {50, 0, 5}, "pT,h bins for output histograms"};
130131
o2::framework::ConfigurableAxis ConfYllBins{"ConfYllBins", {1, -1.f, 1.f}, "yll bins for output histograms"}; // pair rapidity
131-
o2::framework::ConfigurableAxis ConfDEtaBins{"ConfDEtaBins", {120, -6, 6}, "deta bins for output histograms"};
132+
o2::framework::ConfigurableAxis ConfDEtaBins{"ConfDEtaBins", {200, -10, 10}, "deta bins for output histograms"};
132133
o2::framework::Configurable<int> cfgNbinsDPhi{"cfgNbinsDPhi", 36, "nbins in dphi for output histograms"};
133134
o2::framework::Configurable<int> cfgNbinsCosNDPhi{"cfgNbinsCosNDPhi", 200, "nbins in cos(n(dphi)) for output histograms"};
134135
o2::framework::Configurable<int> cfgNmod{"cfgNmod", 2, "n-th harmonics"};
@@ -317,7 +318,6 @@ struct DileptonHadronMPC {
317318
Zorro zorro;
318319

319320
o2::framework::HistogramRegistry fRegistry{"output", {}, o2::framework::OutputObjHandlingPolicy::AnalysisObject, false, false};
320-
static constexpr std::string_view event_cut_types[2] = {"before/", "after/"};
321321
static constexpr std::string_view event_pair_types[2] = {"same/", "mix/"};
322322

323323
std::vector<float> cent_bin_edges;
@@ -857,9 +857,6 @@ struct DileptonHadronMPC {
857857
return false;
858858
}
859859
}
860-
// if (t1.trackId() == t3.trackId() || t2.trackId() == t3.trackId()) {
861-
// return false;
862-
// }
863860
} else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) {
864861
if (!cut.template IsSelectedTrack<false>(t1) || !cut.template IsSelectedTrack<false>(t2)) {
865862
return false;
@@ -953,41 +950,6 @@ struct DileptonHadronMPC {
953950
if (!fEMTrackCut.IsSelected(t1) || !fEMTrackCut.IsSelected(t2)) { // for charged track
954951
return false;
955952
}
956-
957-
// Leptons should not be in reference track sample.
958-
if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) {
959-
if (trackcuts.cfg_reftrack_type == static_cast<int>(o2::aod::pwgem::dilepton::utils::emtrackutil::RefTrackType::kCB)) {
960-
// for (const auto& pos : posLeptons) { // leptons per collision
961-
// if (dielectroncuts.cfg_pid_scheme == static_cast<int>(DielectronCut::PIDSchemes::kPIDML)) {
962-
// if (!cut.template IsSelectedTrack<false>(pos)) {
963-
// continue;
964-
// }
965-
// } else { // cut based
966-
// if (!cut.template IsSelectedTrack<false>(pos)) {
967-
// continue;
968-
// }
969-
// }
970-
// // if (t1.trackId() == pos.trackId() || t2.trackId() == pos.trackId()) {
971-
// // return false;
972-
// // }
973-
// } // end of pos lepton loop
974-
975-
// for (const auto& neg : negLeptons) { // leptons per collision
976-
// if (dielectroncuts.cfg_pid_scheme == static_cast<int>(DielectronCut::PIDSchemes::kPIDML)) {
977-
// if (!cut.template IsSelectedTrack<false>(neg)) {
978-
// continue;
979-
// }
980-
// } else { // cut based
981-
// if (!cut.template IsSelectedTrack<false>(neg)) {
982-
// continue;
983-
// }
984-
// }
985-
// // if (t1.trackId() == neg.trackId() || t2.trackId() == neg.trackId()) {
986-
// // return false;
987-
// // }
988-
// } // end of neg lepton lopp
989-
}
990-
} // end of if kDielectron
991953
} // end of if same event
992954

993955
float weight = 1.f;
@@ -1115,24 +1077,28 @@ struct DileptonHadronMPC {
11151077
}
11161078
}
11171079
}
1118-
for (const auto& [pos1, pos2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++
1119-
bool is_pair_ok = fillDilepton<0>(collision, pos1, pos2, cut);
1120-
if (is_pair_ok) {
1121-
nlspp++;
1122-
for (const auto& refTrack : refTracks_per_coll) {
1123-
fillDileptonHadron<0>(pos1, pos2, cut, refTrack);
1080+
1081+
if (cfgDoLS) {
1082+
for (const auto& [pos1, pos2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++
1083+
bool is_pair_ok = fillDilepton<0>(collision, pos1, pos2, cut);
1084+
if (is_pair_ok) {
1085+
nlspp++;
1086+
for (const auto& refTrack : refTracks_per_coll) {
1087+
fillDileptonHadron<0>(pos1, pos2, cut, refTrack);
1088+
}
11241089
}
11251090
}
1126-
}
1127-
for (const auto& [neg1, neg2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS--
1128-
bool is_pair_ok = fillDilepton<0>(collision, neg1, neg2, cut);
1129-
if (is_pair_ok) {
1130-
nlsmm++;
1131-
for (const auto& refTrack : refTracks_per_coll) {
1132-
fillDileptonHadron<0>(neg1, neg2, cut, refTrack);
1091+
for (const auto& [neg1, neg2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS--
1092+
bool is_pair_ok = fillDilepton<0>(collision, neg1, neg2, cut);
1093+
if (is_pair_ok) {
1094+
nlsmm++;
1095+
for (const auto& refTrack : refTracks_per_coll) {
1096+
fillDileptonHadron<0>(neg1, neg2, cut, refTrack);
1097+
}
11331098
}
11341099
}
11351100
}
1101+
11361102
used_trackIds_per_col.clear();
11371103
used_trackIds_per_col.shrink_to_fit();
11381104

@@ -1150,14 +1116,13 @@ struct DileptonHadronMPC {
11501116

11511117
// store ref tracks for mixed event in case of kAzimuthalCorrelation
11521118
if (cfgDoMix && cfgAnalysisType == static_cast<int>(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kAzimuthalCorrelation)) {
1153-
emh_ref->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(track.pt(), track.eta(), track.phi(), 0.139));
1119+
emh_ref->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrackUL(track.pt(), track.eta(), track.phi()));
11541120
} // store ref tracks
11551121
}
11561122
}
11571123
// LOGF(info, "collision.globalIndex() = %d, collision.centFT0M() = %f, refTracks_per_coll.size() = %d", collision.globalIndex(), collision.centFT0M(), refTracks_per_coll.size());
11581124

11591125
for (const auto& [ref1, ref2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(refTracks_per_coll, refTracks_per_coll))) {
1160-
// TODO: remove lepton candidates from reference track sample in case of kCB.
11611126
fillHadronHadron<0>(ref1, ref2, posTracks_per_coll, negTracks_per_coll, cut);
11621127
}
11631128
}
@@ -1245,15 +1210,17 @@ struct DileptonHadronMPC {
12451210
}
12461211
}
12471212

1248-
for (const auto& pos1 : selected_posTracks_in_this_event) { // LS++ mix
1249-
for (const auto& pos2 : posTracks_from_event_pool) {
1250-
fillDilepton<1>(collision, pos1, pos2, cut);
1213+
if (cfgDoLS) {
1214+
for (const auto& pos1 : selected_posTracks_in_this_event) { // LS++ mix
1215+
for (const auto& pos2 : posTracks_from_event_pool) {
1216+
fillDilepton<1>(collision, pos1, pos2, cut);
1217+
}
12511218
}
1252-
}
12531219

1254-
for (const auto& neg1 : selected_negTracks_in_this_event) { // LS-- mix
1255-
for (const auto& neg2 : negTracks_from_event_pool) {
1256-
fillDilepton<1>(collision, neg1, neg2, cut);
1220+
for (const auto& neg1 : selected_negTracks_in_this_event) { // LS-- mix
1221+
for (const auto& neg2 : negTracks_from_event_pool) {
1222+
fillDilepton<1>(collision, neg1, neg2, cut);
1223+
}
12571224
}
12581225
}
12591226
} // end of loop over mixed event pool for lepton-lepton
@@ -1288,60 +1255,62 @@ struct DileptonHadronMPC {
12881255
}
12891256
}
12901257

1291-
// for LS++ and hadron mix
1292-
for (size_t i1 = 0; i1 < selected_posTracks_in_this_event.size(); i1++) {
1293-
auto pos1 = selected_posTracks_in_this_event[i1];
1294-
for (size_t i2 = i1 + 1; i2 < selected_posTracks_in_this_event.size(); i2++) {
1295-
auto pos2 = selected_posTracks_in_this_event[i2];
1296-
1297-
for (const auto& mix_dfId_collisionId : collisionIds_in_mixing_pool_hadron) {
1298-
int mix_dfId = mix_dfId_collisionId.first;
1299-
int mix_collisionId = mix_dfId_collisionId.second;
1300-
if (collision.globalIndex() == mix_collisionId && ndf == mix_dfId) { // this never happens. only protection.
1301-
continue;
1302-
}
1303-
1304-
auto globalBC_mix = map_mixed_eventId_to_globalBC[mix_dfId_collisionId];
1305-
uint64_t diffBC = std::max(collision.globalBC(), globalBC_mix) - std::min(collision.globalBC(), globalBC_mix);
1306-
fRegistry.fill(HIST("DileptonHadron/mix/hDiffBC"), diffBC);
1307-
if (diffBC < ndiff_bc_mix) {
1308-
continue;
1309-
}
1310-
1311-
auto refTracks_from_event_pool = emh_ref->GetTracksPerCollision(mix_dfId_collisionId);
1312-
for (const auto& ref : refTracks_from_event_pool) {
1313-
fillDileptonHadron<1>(pos1, pos2, cut, ref);
1314-
}
1315-
1316-
} // end of loop over mixed event pool for dilepton-hadron
1258+
if (cfgDoLS) {
1259+
// for LS++ and hadron mix
1260+
for (size_t i1 = 0; i1 < selected_posTracks_in_this_event.size(); i1++) {
1261+
auto pos1 = selected_posTracks_in_this_event[i1];
1262+
for (size_t i2 = i1 + 1; i2 < selected_posTracks_in_this_event.size(); i2++) {
1263+
auto pos2 = selected_posTracks_in_this_event[i2];
1264+
1265+
for (const auto& mix_dfId_collisionId : collisionIds_in_mixing_pool_hadron) {
1266+
int mix_dfId = mix_dfId_collisionId.first;
1267+
int mix_collisionId = mix_dfId_collisionId.second;
1268+
if (collision.globalIndex() == mix_collisionId && ndf == mix_dfId) { // this never happens. only protection.
1269+
continue;
1270+
}
1271+
1272+
auto globalBC_mix = map_mixed_eventId_to_globalBC[mix_dfId_collisionId];
1273+
uint64_t diffBC = std::max(collision.globalBC(), globalBC_mix) - std::min(collision.globalBC(), globalBC_mix);
1274+
fRegistry.fill(HIST("DileptonHadron/mix/hDiffBC"), diffBC);
1275+
if (diffBC < ndiff_bc_mix) {
1276+
continue;
1277+
}
1278+
1279+
auto refTracks_from_event_pool = emh_ref->GetTracksPerCollision(mix_dfId_collisionId);
1280+
for (const auto& ref : refTracks_from_event_pool) {
1281+
fillDileptonHadron<1>(pos1, pos2, cut, ref);
1282+
}
1283+
1284+
} // end of loop over mixed event pool for dilepton-hadron
1285+
}
13171286
}
1318-
}
1319-
1320-
// for LS-- and hadron mix
1321-
for (size_t i1 = 0; i1 < selected_negTracks_in_this_event.size(); i1++) {
1322-
auto neg1 = selected_negTracks_in_this_event[i1];
1323-
for (size_t i2 = i1 + 1; i2 < selected_negTracks_in_this_event.size(); i2++) {
1324-
auto neg2 = selected_negTracks_in_this_event[i2];
1325-
1326-
for (const auto& mix_dfId_collisionId : collisionIds_in_mixing_pool_hadron) {
1327-
int mix_dfId = mix_dfId_collisionId.first;
1328-
int mix_collisionId = mix_dfId_collisionId.second;
1329-
if (collision.globalIndex() == mix_collisionId && ndf == mix_dfId) { // this never happens. only protection.
1330-
continue;
1331-
}
1332-
auto globalBC_mix = map_mixed_eventId_to_globalBC[mix_dfId_collisionId];
1333-
uint64_t diffBC = std::max(collision.globalBC(), globalBC_mix) - std::min(collision.globalBC(), globalBC_mix);
1334-
fRegistry.fill(HIST("DileptonHadron/mix/hDiffBC"), diffBC);
1335-
if (diffBC < ndiff_bc_mix) {
1336-
continue;
1337-
}
13381287

1339-
auto refTracks_from_event_pool = emh_ref->GetTracksPerCollision(mix_dfId_collisionId);
1340-
for (const auto& ref : refTracks_from_event_pool) {
1341-
fillDileptonHadron<1>(neg1, neg2, cut, ref);
1342-
}
1343-
1344-
} // end of loop over mixed event pool for dilepton-hadron
1288+
// for LS-- and hadron mix
1289+
for (size_t i1 = 0; i1 < selected_negTracks_in_this_event.size(); i1++) {
1290+
auto neg1 = selected_negTracks_in_this_event[i1];
1291+
for (size_t i2 = i1 + 1; i2 < selected_negTracks_in_this_event.size(); i2++) {
1292+
auto neg2 = selected_negTracks_in_this_event[i2];
1293+
1294+
for (const auto& mix_dfId_collisionId : collisionIds_in_mixing_pool_hadron) {
1295+
int mix_dfId = mix_dfId_collisionId.first;
1296+
int mix_collisionId = mix_dfId_collisionId.second;
1297+
if (collision.globalIndex() == mix_collisionId && ndf == mix_dfId) { // this never happens. only protection.
1298+
continue;
1299+
}
1300+
auto globalBC_mix = map_mixed_eventId_to_globalBC[mix_dfId_collisionId];
1301+
uint64_t diffBC = std::max(collision.globalBC(), globalBC_mix) - std::min(collision.globalBC(), globalBC_mix);
1302+
fRegistry.fill(HIST("DileptonHadron/mix/hDiffBC"), diffBC);
1303+
if (diffBC < ndiff_bc_mix) {
1304+
continue;
1305+
}
1306+
1307+
auto refTracks_from_event_pool = emh_ref->GetTracksPerCollision(mix_dfId_collisionId);
1308+
for (const auto& ref : refTracks_from_event_pool) {
1309+
fillDileptonHadron<1>(neg1, neg2, cut, ref);
1310+
}
1311+
1312+
} // end of loop over mixed event pool for dilepton-hadron
1313+
}
13451314
}
13461315
}
13471316

PWGEM/Dilepton/Utils/EMTrack.h

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ class EMTrack
5757
float px() const { return 1.f / std::fabs(fSigned1Pt) * std::cos(fPhi); }
5858
float py() const { return 1.f / std::fabs(fSigned1Pt) * std::sin(fPhi); }
5959
float pz() const { return 1.f / std::fabs(fSigned1Pt) * std::sinh(fEta); }
60-
// float e() const { return std::hypot(fPt * std::cosh(fEta), fMass); } // e2 = p2 + m2
6160
float signed1Pt() const { return fSigned1Pt; }
6261

6362
protected:
@@ -240,5 +239,34 @@ class EMPair : public EMTrack
240239
float fVz;
241240
};
242241

242+
class EMTrackUL // ultra-light track. Use this when you don't care charge or DCA. e.g. dilepton-hadron correlation.
243+
{
244+
public:
245+
EMTrackUL(float pt, float eta, float phi)
246+
{
247+
fPt = pt;
248+
fEta = eta;
249+
fPhi = phi;
250+
}
251+
252+
~EMTrackUL() {}
253+
254+
float pt() const { return fPt; }
255+
float eta() const { return fEta; }
256+
float phi() const { return fPhi; }
257+
258+
float p() const { return fPt * std::cosh(fEta); }
259+
float px() const { return fPt * std::cos(fPhi); }
260+
float py() const { return fPt * std::sin(fPhi); }
261+
float pz() const { return fPt * std::sinh(fEta); }
262+
float e(const float mass) const { return std::hypot(fPt * std::cosh(fEta), mass); } // e2 = p2 + m2
263+
float rapidity(const float mass) const { return std::log((std::sqrt(std::pow(mass, 2) + std::pow(fPt * std::cosh(fEta), 2)) + fPt * std::sinh(fEta)) / std::sqrt(std::pow(mass, 2) + std::pow(fPt, 2))); }
264+
265+
protected:
266+
float fPt;
267+
float fEta;
268+
float fPhi;
269+
};
270+
243271
} // namespace o2::aod::pwgem::dilepton::utils
244272
#endif // PWGEM_DILEPTON_UTILS_EMTRACK_H_

0 commit comments

Comments
 (0)