Skip to content

Commit cd1e380

Browse files
authored
[PWGEM/Dilepton] add fake rejection in creation of resolution map (#9568)
1 parent e6a70f7 commit cd1e380

File tree

3 files changed

+80
-11
lines changed

3 files changed

+80
-11
lines changed

PWGEM/Dilepton/Tasks/createResolutionMap.cxx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@
4141
#include "MCHTracking/TrackExtrap.h"
4242
#include "MCHTracking/TrackParam.h"
4343
#include "ReconstructionDataFormats/TrackFwd.h"
44+
#include "PWGEM/Dilepton/Utils/MCUtilities.h"
4445

4546
using namespace o2;
4647
using namespace o2::framework;
4748
using namespace o2::framework::expressions;
4849
using namespace o2::aod;
4950
using namespace o2::soa;
51+
using namespace o2::aod::pwgem::dilepton::utils::mcutil;
5052

5153
using MyCollisions = Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels>;
5254
using MyCollision = MyCollisions::iterator;
@@ -76,6 +78,10 @@ struct CreateResolutionMap {
7678
Configurable<std::string> geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"};
7779
Configurable<int> cfgEventGeneratorType{"cfgEventGeneratorType", -1, "if positive, select event generator type. i.e. gap or signal"};
7880
Configurable<int> cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"};
81+
Configurable<bool> cfg_require_true_mc_collision_association{"cfg_require_true_mc_collision_association", true, "flag to require true mc collision association"};
82+
Configurable<bool> cfg_reject_fake_match_its_tpc{"cfg_reject_fake_match_its_tpc", false, "flag to reject fake match between ITS-TPC"};
83+
// Configurable<bool> cfg_reject_fake_match_its_tpc_tof{"cfg_reject_fake_match_its_tpc_tof", false, "flag to reject fake match between ITS-TPC-TOF"};
84+
Configurable<bool> cfg_reject_fake_match_mft_mch{"cfg_reject_fake_match_mft_mch", false, "flag to reject fake match between MFT-MCH"};
7985

8086
ConfigurableAxis ConfPtGenBins{"ConfPtGenBins", {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.10, 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.80, 2.90, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50, 4.60, 4.70, 4.80, 4.90, 5.00, 5.50, 6.00, 6.50, 7.00, 7.50, 8.00, 8.50, 9.00, 9.50, 10.00, 11.00, 12.00, 13.00, 14.00, 15.00, 16.00, 17.00, 18.00, 19.00, 20.00}, "gen. pT bins for output histograms"};
8187
ConfigurableAxis ConfCentBins{"ConfCentBins", {VARIABLE_WIDTH, 0, 10, 30, 50, 110}, "centrality (%) bins for output histograms"};
@@ -327,6 +333,10 @@ struct CreateResolutionMap {
327333
return false;
328334
}
329335

336+
if (cfg_reject_fake_match_mft_mch && muon.trackType() == static_cast<uint8_t>(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) && o2::aod::pwgem::dilepton::utils::mcutil::hasFakeMatchMFTMCH(muon)) {
337+
return false;
338+
}
339+
330340
auto mctrack = muon.template mcParticle_as<aod::McParticles>();
331341
if (muon.trackType() == static_cast<uint8_t>(o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack)) {
332342
registry.fill(HIST("StandaloneMuon/hs_reso"), centrality, mctrack.pt(), mctrack.eta(), mctrack.phi(), -mctrack.pdgCode() / 13, (mctrack.pt() - pt) / mctrack.pt(), mctrack.eta() - eta, mctrack.phi() - phi);
@@ -393,7 +403,7 @@ struct CreateResolutionMap {
393403
continue;
394404
}
395405
auto mctrack = track.template mcParticle_as<aod::McParticles>();
396-
if (mctrack.mcCollisionId() != collision.mcCollisionId()) {
406+
if (cfg_require_true_mc_collision_association && mctrack.mcCollisionId() != collision.mcCollisionId()) {
397407
continue;
398408
}
399409
if (abs(mctrack.pdgCode()) != 11 || !(mctrack.isPhysicalPrimary() || mctrack.producedByGenerator())) {
@@ -403,6 +413,10 @@ struct CreateResolutionMap {
403413
continue;
404414
}
405415

416+
if (cfg_reject_fake_match_its_tpc && o2::aod::pwgem::dilepton::utils::mcutil::hasFakeMatchITSTPC(track)) {
417+
continue;
418+
}
419+
406420
registry.fill(HIST("Electron/hs_reso"), centrality, mctrack.pt(), mctrack.eta(), mctrack.phi(), -mctrack.pdgCode() / 11, (mctrack.pt() - track.pt()) / mctrack.pt(), mctrack.eta() - track.eta(), mctrack.phi() - track.phi());
407421
registry.fill(HIST("Electron/Ptgen_RelDeltaPt"), mctrack.pt(), (mctrack.pt() - track.pt()) / mctrack.pt());
408422
registry.fill(HIST("Electron/Ptgen_DeltaEta"), mctrack.pt(), mctrack.eta() - track.eta());
@@ -422,7 +436,7 @@ struct CreateResolutionMap {
422436
continue;
423437
}
424438
auto mctrack = muon.template mcParticle_as<aod::McParticles>();
425-
if (mctrack.mcCollisionId() != collision.mcCollisionId()) {
439+
if (cfg_require_true_mc_collision_association && mctrack.mcCollisionId() != collision.mcCollisionId()) {
426440
continue;
427441
}
428442
if (abs(mctrack.pdgCode()) != 13 || !(mctrack.isPhysicalPrimary() || mctrack.producedByGenerator())) {
@@ -438,7 +452,7 @@ struct CreateResolutionMap {
438452
continue;
439453
}
440454
auto mctrack = muon.template mcParticle_as<aod::McParticles>();
441-
if (mctrack.mcCollisionId() != collision.mcCollisionId()) {
455+
if (cfg_require_true_mc_collision_association && mctrack.mcCollisionId() != collision.mcCollisionId()) {
442456
continue;
443457
}
444458
if (abs(mctrack.pdgCode()) != 13 || !(mctrack.isPhysicalPrimary() || mctrack.producedByGenerator())) {

PWGEM/Dilepton/Tasks/eventQC.cxx

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,12 @@ struct eventQC {
124124

125125
struct : ConfigurableGroup {
126126
std::string prefix = "v0cut_group";
127+
Configurable<float> cfg_min_mass_photon{"cfg_min_mass_photon", 0.0, "min mass for photon rejection"};
128+
Configurable<float> cfg_max_mass_photon{"cfg_max_mass_photon", 0.1, "max mass for photon rejection"};
127129
Configurable<float> cfg_min_mass_k0s{"cfg_min_mass_k0s", 0.490, "min mass for K0S"};
128130
Configurable<float> cfg_max_mass_k0s{"cfg_max_mass_k0s", 0.505, "max mass for K0S"};
131+
Configurable<float> cfg_min_mass_lambda{"cfg_min_mass_lambda", 1.11, "min mass for Lambda rejection"};
132+
Configurable<float> cfg_max_mass_lambda{"cfg_max_mass_lambda", 1.12, "max mass for Lambda rejection"};
129133
Configurable<float> cfg_min_cospa_v0hadron{"cfg_min_cospa_v0hadron", 0.999, "min cospa for v0hadron"};
130134
Configurable<float> cfg_max_pca_v0hadron{"cfg_max_pca_v0hadron", 0.5, "max distance between 2 legs for v0hadron"};
131135
Configurable<float> cfg_min_radius_v0hadron{"cfg_min_radius_v0hadron", 1.0, "min rxy for v0hadron"};
@@ -357,8 +361,9 @@ struct eventQC {
357361
fRegistry.add("V0/K0S/pion/hTPCNsigmaPi", "TPC n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -10, +10}}, false);
358362

359363
fRegistry.add("V0/K0S/hMass", "mass vs. p_{T} of K^{0}_{S}", kTH2F, {{200, 0.4, 0.6}, {100, 0, 10}}, false);
360-
// fRegistry.add("V0/Lambda/hMass", "mass vs. p_{T} of #Lambda", kTH2F, {{100, 1.08, 1.18}, {100, 0, 10}}, false);
361-
// fRegistry.add("V0/AntiLambda/hMass", "mass vs. p_{T} of #bar{#Lambda}", kTH2F, {{100, 1.08, 1.18}, {100, 0, 10}}, false);
364+
fRegistry.add("V0/Lambda/hMass", "mass vs. p_{T} of #Lambda", kTH2F, {{100, 1.08, 1.18}, {100, 0, 10}}, false);
365+
fRegistry.add("V0/AntiLambda/hMass", "mass vs. p_{T} of #bar{#Lambda}", kTH2F, {{100, 1.08, 1.18}, {100, 0, 10}}, false);
366+
fRegistry.add("V0/GammaTMP/hMass", "mass vs. p_{T} of #gamma", kTH2F, {{100, 0.0, 0.1}, {100, 0, 10}}, false);
362367

363368
fRegistry.add("V0/Photon/hMass", "mass vs. p_{T}", kTH2F, {{100, 0, 0.1}, {100, 0, 10}}, false);
364369
fRegistry.add("V0/Photon/hChi2", "radius vs. KF chi2", kTH2F, {{100, 0, 100}, {100, 0, 100}}, false);
@@ -939,9 +944,19 @@ struct eventQC {
939944
fRegistry.fill(HIST("V0/hRadius"), v0hadron.v0radius());
940945

941946
fRegistry.fill(HIST("V0/K0S/hMass"), v0hadron.mK0Short(), v0hadron.pt());
942-
// fRegistry.fill(HIST("V0/Lambda/hMass"), v0hadron.mLambda(), v0hadron.pt());
943-
// fRegistry.fill(HIST("V0/AntiLambda/hMass"), v0hadron.mAntiLambda(), v0hadron.pt());
944947
if (v0cuts.cfg_min_mass_k0s < v0hadron.mK0Short() && v0hadron.mK0Short() < v0cuts.cfg_max_mass_k0s) { // K0S
948+
fRegistry.fill(HIST("V0/GammaTMP/hMass"), v0hadron.mGamma(), v0hadron.pt());
949+
fRegistry.fill(HIST("V0/Lambda/hMass"), v0hadron.mLambda(), v0hadron.pt());
950+
fRegistry.fill(HIST("V0/AntiLambda/hMass"), v0hadron.mAntiLambda(), v0hadron.pt());
951+
if (v0cuts.cfg_min_mass_lambda < v0hadron.mLambda() && v0hadron.mLambda() < v0cuts.cfg_max_mass_lambda) { // Lambda rejection
952+
continue;
953+
}
954+
if (v0cuts.cfg_min_mass_lambda < v0hadron.mAntiLambda() && v0hadron.mAntiLambda() < v0cuts.cfg_max_mass_lambda) { // AntiLambda rejection
955+
continue;
956+
}
957+
if (v0cuts.cfg_min_mass_photon < v0hadron.mGamma() && v0hadron.mGamma() < v0cuts.cfg_max_mass_photon) { // photon conversion rejection
958+
continue;
959+
}
945960

946961
auto pos = tracks.rawIteratorAt(v0hadron.posTrackId());
947962
auto neg = tracks.rawIteratorAt(v0hadron.negTrackId());

PWGEM/Dilepton/Utils/MCUtilities.h

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,42 @@ enum class EM_HFeeType : int {
3131
kBCe_Be_DiffB = 4, // LS
3232
};
3333

34+
//_______________________________________________________________________
35+
template <typename TTrack>
36+
int hasFakeMatchITSTPC(TTrack const& track)
37+
{
38+
// track and mctracklabel have to be joined.
39+
// bit 13 -- ITS/TPC labels are not equal
40+
41+
if ((track.mcMask() & 1 << 13)) {
42+
return true;
43+
} else {
44+
return false;
45+
}
46+
}
47+
//_______________________________________________________________________
48+
template <typename TTrack>
49+
int hasFakeMatchITSTPCTOF(TTrack const& track)
50+
{
51+
// track and mctracklabel have to be joined.
52+
return false;
53+
// if ((track.mcMask() & 1 << 13) && (track.mcMask() & 1 << 15)) {
54+
// return true;
55+
// } else {
56+
// return false;
57+
// }
58+
}
59+
//_______________________________________________________________________
60+
template <typename TTrack>
61+
int hasFakeMatchMFTMCH(TTrack const& track)
62+
{
63+
// fwdtrack and mcfwdtracklabel have to be joined.
64+
if ((track.mcMask() & 1 << 7)) {
65+
return true;
66+
} else {
67+
return false;
68+
}
69+
}
3470
//_______________________________________________________________________
3571
template <typename TMCParticle1, typename TMCParticle2>
3672
int FindCommonMotherFrom2ProngsWithoutPDG(TMCParticle1 const& p1, TMCParticle2 const& p2)
@@ -217,6 +253,7 @@ int IsFromBeauty(TMCParticle const& p, TMCParticles const& mcparticles)
217253
return -999;
218254
}
219255

256+
//_______________________________________________________________________
220257
template <typename TMCParticle, typename TMCParticles>
221258
int IsFromCharm(TMCParticle const& p, TMCParticles const& mcparticles)
222259
{
@@ -248,6 +285,7 @@ int IsFromCharm(TMCParticle const& p, TMCParticles const& mcparticles)
248285
return -999;
249286
}
250287

288+
//_______________________________________________________________________
251289
template <typename TMCParticle1, typename TMCParticle2, typename TMCParticles>
252290
int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcparticles)
253291
{
@@ -359,8 +397,8 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp
359397
return static_cast<int>(EM_HFeeType::kBCe_Be_SameB); // b->c->e and b->e, decay type = 3. this should happen only in ULS.
360398
}
361399
}
362-
} // end of motherid2
363-
} // end of motherid1
400+
} // end of motherid2
401+
} // end of motherid1
364402
} else { // LS
365403
bool is_same_mother_found = false;
366404
for (auto& mid1 : mothers_id1) {
@@ -374,7 +412,7 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp
374412
}
375413
}
376414
} // end of motherid2
377-
} // end of motherid1
415+
} // end of motherid1
378416
if (!is_same_mother_found) {
379417
mothers_id1.clear();
380418
mothers_pdg1.clear();
@@ -400,6 +438,7 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp
400438
return static_cast<int>(EM_HFeeType::kUndef);
401439
}
402440

441+
//_______________________________________________________________________
403442
template <typename T, typename U>
404443
int searchMothers(T& p, U& mcParticles, int pdg, bool equal)
405444
{ // find the first ancestor that is equal/not-equal pdg
@@ -479,6 +518,7 @@ int searchMothers(T& p, U& mcParticles, int pdg, bool equal)
479518
return -1;
480519
}
481520

521+
//_______________________________________________________________________
482522
template <typename T, typename U>
483523
int findHFOrigin(T& p, U& mcParticles, int pdg)
484524
{
@@ -490,7 +530,7 @@ int findHFOrigin(T& p, U& mcParticles, int pdg)
490530
int id = searchMothers(quark, mcParticles, pdg, false); // try to find the first ancestor that is not the hf quark anymore
491531
return id;
492532
}
493-
533+
//_______________________________________________________________________
494534
template <typename T, typename U>
495535
bool checkFromSameQuarkPair(T& p1, T& p2, U& mcParticles, int pdg)
496536
{ // check if two particles come from the same hf q-qbar pair

0 commit comments

Comments
 (0)