Skip to content

Commit 0b9db5c

Browse files
authored
Add non Hfe Invariant mass on table
1 parent 7645784 commit 0b9db5c

File tree

1 file changed

+31
-28
lines changed

1 file changed

+31
-28
lines changed

PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ using namespace o2::framework;
5353
using namespace o2::framework::expressions;
5454
using namespace o2::soa;
5555

56-
const int kEta = 221;
56+
const int kEtaLocal = 221;
5757

5858
struct HfElectronSelectionWithTpcEmcal {
5959

@@ -71,7 +71,7 @@ struct HfElectronSelectionWithTpcEmcal {
7171
KFParticle kfNonHfe;
7272
Configurable<bool> fillEmcClusterInfo{"fillEmcClusterInfo", true, "Fill histograms with EMCal cluster info before and after track match"};
7373
Configurable<bool> fillTrackInfo{"fillTrackInfo", true, "Fill histograms with Track Information info before track match"};
74-
74+
Configurable<int> emcalRegion{"emcalAcceptance", 0, "Select EMCal region for filling histograms"};
7575
// Event Selection
7676
Configurable<float> zPvPosMax{"zPvPosMax", 10., "Maximum z of the primary vertex (cm)"};
7777
Configurable<bool> isRun3{"isRun3", true, "Data is from Run3 or Run2"};
@@ -138,7 +138,7 @@ struct HfElectronSelectionWithTpcEmcal {
138138
PresliceUnsorted<o2::aod::EMCALMatchedTracks> perClusterMatchedTracks = o2::aod::emcalmatchedtrack::trackId;
139139

140140
// configurable axis
141-
141+
Configurable<bool> skipNoEmcClusters{"skipNoEmcClusters", false, "Skip events with no EMCal clusters"};
142142
ConfigurableAxis binsPosZ{"binsPosZ", {100, -10., 10.}, "primary vertex z coordinate"};
143143
ConfigurableAxis binsEta{"binsEta", {100, -2.0, 2.}, "#it{#eta}"};
144144
ConfigurableAxis binsPhi{"binsPhi", {32, 0.0, o2::constants::math::TwoPI}, "#it{#varphi}"};
@@ -163,7 +163,7 @@ struct HfElectronSelectionWithTpcEmcal {
163163

164164
void init(o2::framework::InitContext&)
165165
{
166-
AxisSpec axisPosZ = {binsPosZ, "Pos Z"};
166+
AxisSpec const axisPosZ = {binsPosZ, "Pos Z"};
167167
AxisSpec axisMass = {binsMass, "Mass (GeV/#it{c}^{2}); entries"};
168168
AxisSpec axisPt = {binsPt, "#it{p_{T}}(GeV/#it{c})"};
169169
AxisSpec axisEta = {binsEta, "#it{#eta}"};
@@ -181,6 +181,7 @@ struct HfElectronSelectionWithTpcEmcal {
181181
AxisSpec axisDeltaPhi = {binsDeltaPhi, "#Delta #varphi = #varphi_{trk}- #varphi_{cluster}"};
182182

183183
registry.add("hZvertex", "z vertex", {HistType::kTH1D, {axisPosZ}});
184+
registry.add("hNeventsAfterPassEmcal", "No of events pass the Emcal", {HistType::kTH1D, {{3, 1, 4}}});
184185
registry.add("hNevents", "No of events", {HistType::kTH1D, {{3, 1, 4}}});
185186
registry.add("hLikeMass", "Like mass", {HistType::kTH1D, {{axisMass}}});
186187
registry.add("hUnLikeMass", "unLike mass", {HistType::kTH1D, {{axisMass}}});
@@ -315,16 +316,16 @@ struct HfElectronSelectionWithTpcEmcal {
315316
pdgE2 = kPositron;
316317
}
317318

318-
KFPTrack kfpTrack = createKFPTrackFromTrack(electron);
319-
KFPTrack kfpAssociatedTrack = createKFPTrackFromTrack(pTrack);
320-
KFParticle kfTrack(kfpTrack, pdgE1);
321-
KFParticle kfAssociatedTrack(kfpAssociatedTrack, pdgE2);
319+
KFPTrack const kfpTrack = createKFPTrackFromTrack(electron);
320+
KFPTrack const kfpAssociatedTrack = createKFPTrackFromTrack(pTrack);
321+
KFParticle const kfTrack(kfpTrack, pdgE1);
322+
KFParticle const kfAssociatedTrack(kfpAssociatedTrack, pdgE2);
322323
const KFParticle* electronPairs[2] = {&kfTrack, &kfAssociatedTrack};
323324
kfNonHfe.SetConstructMethod(2);
324325
kfNonHfe.Construct(electronPairs, 2);
325326

326-
int ndf = kfNonHfe.GetNDF();
327-
double chi2recg = kfNonHfe.GetChi2() / ndf;
327+
int const ndf = kfNonHfe.GetNDF();
328+
double const chi2recg = kfNonHfe.GetChi2() / ndf;
328329
if (ndf < 1.0) {
329330
continue;
330331
}
@@ -370,23 +371,24 @@ struct HfElectronSelectionWithTpcEmcal {
370371
}
371372
}
372373
// Pass multiplicities and other required parameters for this electron
373-
hfElectronSelection(electron.collisionId(), electron.globalIndex(), electron.eta(), electron.phi(), electron.pt(), electron.tpcNSigmaEl(), electron.tofNSigmaEl(), nElPairsLS, nElPairsUS, isEMcal);
374+
hfElectronSelection(electron.collisionId(), electron.globalIndex(), electron.eta(), electron.phi(), electron.pt(), electron.tpcNSigmaEl(), electron.tofNSigmaEl(), invMassElectron, nElPairsLS, nElPairsUS, isEMcal);
374375
}
375376
// Electron Identification
376-
template <bool isMc, typename TracksType, typename EmcClusterType, typename MatchType, typename CollisionType, typename ParticleType>
377+
template <bool IsMc, typename TracksType, typename EmcClusterType, typename MatchType, typename CollisionType, typename ParticleType>
377378
void fillElectronTrack(CollisionType const& collision, TracksType const& tracks, EmcClusterType const& emcClusters, MatchType const& matchedTracks, ParticleType const& /*particlemc*/)
378379
{
379-
if (!(isRun3 ? collision.sel8() : (collision.sel7() && collision.alias_bit(kINT7))))
380+
if (!(isRun3 ? collision.sel8() : (collision.sel7() && collision.alias_bit(kINT7)))) {
380381
return;
381-
382-
registry.fill(HIST("hNevents"), 1);
382+
}
383+
int region = emcalRegion;
384+
registry.fill(HIST("hNevents"), region);
383385

384386
// skip events with no clusters
385-
if (emcClusters.size() == 0) {
387+
if (emcClusters.size() == 0 && skipNoEmcClusters) {
386388
return;
387389
}
388390
registry.fill(HIST("hZvertex"), collision.posZ());
389-
391+
registry.fill(HIST("hNeventsAfterPassEmcal"), region);
390392
/////////////////////////////////
391393
// EMCal cluster info before match ///
392394
///////////////////////////////
@@ -421,10 +423,12 @@ struct HfElectronSelectionWithTpcEmcal {
421423
if (!selTracks(track)) {
422424
continue;
423425
}
424-
if ((phiTrack > phiTrackEMCalMin && phiTrack < phiTrackEMCalMax) && (etaTrack > etaTrackMin && etaTrack < etaTrackMax))
426+
if ((phiTrack > phiTrackEMCalMin && phiTrack < phiTrackEMCalMax) && (etaTrack > etaTrackMin && etaTrack < etaTrackMax)) {
425427
passEMCal = EMCalAcceptance; // EMcal acceptance passed
426-
if ((phiTrack > phiTrackDCalMin && phiTrack < phiTrackDCalMax) && ((etaTrack > etaTrackDCalPositiveMin && etaTrack < etaTrackDCalPositiveMax) || (etaTrack > etaTrackDCalNegativeMin && etaTrack < etaTrackDCalNegativeMax)))
428+
}
429+
if ((phiTrack > phiTrackDCalMin && phiTrack < phiTrackDCalMax) && ((etaTrack > etaTrackDCalPositiveMin && etaTrack < etaTrackDCalPositiveMax) || (etaTrack > etaTrackDCalNegativeMin && etaTrack < etaTrackDCalNegativeMax))) {
427430
passEMCal = DCalAcceptance; // Dcal acceptance passed
431+
}
428432

429433
if (fillTrackInfo) {
430434
registry.fill(HIST("hTrackEtaPhi"), etaTrack, phiTrack, passEMCal); // track etaphi infor after filter bit
@@ -449,7 +453,7 @@ struct HfElectronSelectionWithTpcEmcal {
449453
float deltaPhiMatch = -999.;
450454
float deltaEtaMatch = -999.;
451455
float eop = -999;
452-
bool isEMcal = false;
456+
bool const isEMcal = false;
453457

454458
float trackRapidity = track.rapidity(MassElectron);
455459

@@ -539,7 +543,7 @@ struct HfElectronSelectionWithTpcEmcal {
539543
{
540544
fillElectronTrack<false>(collision, tracks, emcClusters, matchedTracks, 0);
541545
}
542-
PROCESS_SWITCH(HfElectronSelectionWithTpcEmcal, processData, "process Data info only", true);
546+
PROCESS_SWITCH(HfElectronSelectionWithTpcEmcal, processData, "process Data info only", false);
543547
/// Electron selection - for MC reco-level analysis
544548
void processMcRec(McTableCollision const& mcCollision,
545549
McTableTracks const& mcTracks,
@@ -549,7 +553,7 @@ struct HfElectronSelectionWithTpcEmcal {
549553
{
550554
fillElectronTrack<true>(mcCollision, mcTracks, mcEmcClusters, matchedTracks, mcParticles);
551555
}
552-
PROCESS_SWITCH(HfElectronSelectionWithTpcEmcal, processMcRec, "Process MC Reco mode", false);
556+
PROCESS_SWITCH(HfElectronSelectionWithTpcEmcal, processMcRec, "Process MC Reco mode", true);
553557

554558
void processMcGen(McGenTableCollision const& mcCollision, aod::McParticles const& mcParticles)
555559
{
@@ -570,15 +574,14 @@ struct HfElectronSelectionWithTpcEmcal {
570574
if (particleMc.has_mothers()) {
571575
auto const& mother = particleMc.mothers_first_as<aod::McParticles>();
572576

573-
if (std::abs(mother.pdgCode()) == kEta || std::abs(mother.pdgCode()) == kPi0 || std::abs(mother.pdgCode()) == kGamma) {
574-
577+
if (std::abs(mother.pdgCode()) == kEtaLocal || std::abs(mother.pdgCode()) == kPi0 || std::abs(mother.pdgCode()) == kGamma) {
575578
registry.fill(HIST("hMcgenAllNonHfeElectron"), particleMc.pt());
576579

577580
auto const& gmother = mother.mothers_first_as<aod::McParticles>();
578581
// cases to consider: eta->e, eta->pi0->e, eta->gamma->e, eta->pi0->gamma->e, pi0->e, pi0->gamma->e
579582

580583
//================= eta->e ======================================
581-
if (std::abs(mother.pdgCode()) == kEta) {
584+
if (std::abs(mother.pdgCode()) == kEtaLocal) {
582585

583586
if (mother.isPhysicalPrimary()) {
584587
if ((std::abs(gmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gmother.pdgCode()) < pdgCodeCharmMax) ||
@@ -599,7 +602,7 @@ struct HfElectronSelectionWithTpcEmcal {
599602
}
600603
isEmbPi0 = true; // pi0 -> e
601604
}
602-
if (std::abs(gmother.pdgCode()) == kEta) {
605+
if (std::abs(gmother.pdgCode()) == kEtaLocal) {
603606
if (gmother.isPhysicalPrimary() || gmother.has_mothers()) {
604607
auto const& ggmother = gmother.mothers_first_as<aod::McParticles>();
605608
if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) ||
@@ -614,7 +617,7 @@ struct HfElectronSelectionWithTpcEmcal {
614617
/// ==================================== eta->gamma->e and eta->pi0->gamma->e============
615618
if (std::abs(mother.pdgCode()) == kGamma) {
616619

617-
if (std::abs(gmother.pdgCode()) == kEta) {
620+
if (std::abs(gmother.pdgCode()) == kEtaLocal) {
618621
if (gmother.isPhysicalPrimary() || gmother.has_mothers()) {
619622
auto const& ggmother = gmother.mothers_first_as<aod::McParticles>();
620623
if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) ||
@@ -635,7 +638,7 @@ struct HfElectronSelectionWithTpcEmcal {
635638
}
636639
if (gmother.has_mothers()) {
637640
auto const& ggmother = gmother.mothers_first_as<aod::McParticles>();
638-
if (std::abs(ggmother.pdgCode()) == kEta) {
641+
if (std::abs(ggmother.pdgCode()) == kEtaLocal) {
639642
if (ggmother.isPhysicalPrimary() || ggmother.has_mothers()) {
640643
auto const& gggmother = ggmother.mothers_first_as<aod::McParticles>();
641644
if ((std::abs(gggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gggmother.pdgCode()) < pdgCodeCharmMax) ||

0 commit comments

Comments
 (0)