Skip to content

Commit 1b1d65c

Browse files
committed
updated QA for Z->ee & non-linear centrality bin selections
1 parent b5377ee commit 1b1d65c

File tree

1 file changed

+119
-59
lines changed

1 file changed

+119
-59
lines changed

PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx

Lines changed: 119 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
21
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
32
// All rights not expressly granted are reserved.
43
//
@@ -113,9 +112,10 @@ struct HfTaskElectronWeakBoson {
113112
Configurable<bool> isTHnElectron{"isTHnElectron", true, "Enables THn for electrons"};
114113
Configurable<float> ptTHnThresh{"ptTHnThresh", 5.0, "Threshold for THn make"};
115114

116-
// Skimmed dataset processing configurations
115+
// Skimmed (trigger) dataset processing configurations
117116
Configurable<bool> cfgSkimmedProcessing{"cfgSkimmedProcessing", true, "Enables processing of skimmed datasets"};
118117
Configurable<std::string> cfgTriggerName{"cfgTriggerName", "fGammaHighPtEMCAL", "Trigger of interest (comma separated for multiple)"};
118+
Configurable<bool> applySel8{"applySel8", true, "Apply sel8 filter or not"};
119119

120120
// CCDB service configurations
121121
Configurable<std::string> cfgCCDBPath{"cfgCCDBPath", "Users/m/mpuccio/EventFiltering/OTS/", "Path to CCDB for trigger data"};
@@ -130,19 +130,20 @@ struct HfTaskElectronWeakBoson {
130130
Configurable<bool> enableCentralityAnalysis{"enableCentralityAnalysis", true, "Enable centrality-dependent analysis"};
131131
Configurable<float> centralityMin{"centralityMin", -1, "minimum cut on centrality selection"};
132132
Configurable<float> centralityMax{"centralityMax", 101, "maximum cut on centrality selection"};
133+
Configurable<std::vector<double>> centralityBins{"centalityBins", {0, 20, 60, 100}, "centrality bins"};
133134

135+
// QA for Z->ee
136+
Configurable<bool> enableZeeRecoQA{"enableZeeRecoQA", false, "Enable QA for Z->ee reconstruction"};
134137
// CCDB service object
135138
Service<o2::ccdb::BasicCCDBManager> ccdb;
136139

137140
struct HfElectronCandidate {
138-
float pt, eta, phi, energy;
139-
int charge;
140-
HfElectronCandidate(float ptr, float e, float ph, float en, int ch)
141-
: pt(ptr), eta(e), phi(ph), energy(en), charge(ch) {}
142-
143-
int sign() const { return charge; }
141+
float pt, eta, phi, eop, energyIso, momIso, ntrackIso;
142+
HfElectronCandidate(float ptr, float e, float ph, float ep, float eiso, float piso, int ntrkiso)
143+
: pt(ptr), eta(e), phi(ph), eop(ep), energyIso(eiso), momIso(piso), ntrackIso(ntrkiso) {}
144144
};
145145
std::vector<HfElectronCandidate> selectedElectronsIso;
146+
std::vector<HfElectronCandidate> selectedPositronsIso;
146147
std::vector<HfElectronCandidate> selectedElectronsAss;
147148

148149
struct HfZeeCandidate {
@@ -161,8 +162,7 @@ struct HfTaskElectronWeakBoson {
161162
// pp
162163
// using TrackEle = o2::soa::Filtered<o2::soa::Join<o2::aod::Tracks, o2::aod::FullTracks, o2::aod::TracksDCA, o2::aod::TrackSelection, o2::aod::pidTPCEl, o2::aod::pidTOFEl>>;
163164

164-
// Filter
165-
Filter eventFilter = (o2::aod::evsel::sel8 == true);
165+
Filter eventFilter = (applySel8 ? (o2::aod::evsel::sel8 == true) : (o2::aod::evsel::sel8 == o2::aod::evsel::sel8));
166166
Filter posZFilter = (nabs(o2::aod::collision::posZ) < vtxZ);
167167

168168
Filter etafilter = (aod::track::eta < etaTrMax) && (aod::track::eta > etaTrMin);
@@ -209,6 +209,9 @@ struct HfTaskElectronWeakBoson {
209209
const AxisSpec axisCounter{1, 0, 1, "events"};
210210
const AxisSpec axisEta{20, -1.0, 1.0, "#eta"};
211211
const AxisSpec axisPt{nBinsPt, 0, binPtmax, "p_{T}"};
212+
const AxisSpec axisPtZee{60, 20, 80, "p_{T}"};
213+
const AxisSpec axisPtZele{60, 20, 80, "p_{T,ele} (GeV/c)"};
214+
const AxisSpec axisPtZpos{60, 20, 80, "p_{T,pos} (GeV/c)"};
212215
const AxisSpec axisNsigma{100, -5, 5, "N#sigma"};
213216
const AxisSpec axisDedx{150, 0, 150, "dEdx"};
214217
const AxisSpec axisE{nBinsE, 0, binEmax, "Energy"};
@@ -218,20 +221,30 @@ struct HfTaskElectronWeakBoson {
218221
const AxisSpec axisdR{20, 0.0, 0.2, "dR"};
219222
const AxisSpec axisNcell{50, 0.0, 50.0, "Ncell"};
220223
const AxisSpec axisPhi{350, 0, 7, "Phi"};
221-
const AxisSpec axisEop{200, 0, 2, "Eop"};
224+
const AxisSpec axisEop{200, 0, 2, "E/p"};
225+
const AxisSpec axisEopZele{200, 0, 2, "E/p electon"};
226+
const AxisSpec axisEopZpos{200, 0, 2, "E/p positron"};
222227
const AxisSpec axisChi2{250, 0.0, 25.0, "#chi^{2}"};
223228
const AxisSpec axisCluster{100, 0.0, 200.0, "counts"};
224229
const AxisSpec axisITSNCls{10, 0.0, 10, "counts"};
225230
const AxisSpec axisEMCtime{100, -50.0, 50, "EMC time"};
226-
const AxisSpec axisIsoEnergy{100, 0, 1.0, "Isolation energy(GeV/C)"};
227-
const AxisSpec axisIsoTrack{15, -0.5, 14.5, "Isolation Track"};
228-
const AxisSpec axisInvMassZ{150, 0, 150, "M_{ee} (GeV/c^{2})"};
231+
const AxisSpec axisIsoEnergy{100, 0, 1.0, "E_{iso}"};
232+
const AxisSpec axisIsoEnergyZele{100, 0, 1.0, "E_{iso,ele}"};
233+
const AxisSpec axisIsoEnergyZpos{100, 0, 1.0, "E_{iso,pos}"};
234+
const AxisSpec axisIsoMomentum{100, 0, 10.0, "Isolation momentum(GeV/C)"};
235+
const AxisSpec axisIsoMomentumZele{100, 0, 10.0, "p_{iso,ele}"};
236+
const AxisSpec axisIsoMomentumZpos{100, 0, 10.0, "p_{iso,pos}"};
237+
const AxisSpec axisIsoTrack{25, -0.5, 24.5, "Isolation Track"};
238+
const AxisSpec axisIsoTrackZele{25, -0.5, 24.5, "N_{isotrk,ele}"};
239+
const AxisSpec axisIsoTrackZpos{25, -0.5, 24.5, "N_{isotrk,pos}"};
240+
const AxisSpec axisInvMassZgamma{150, 0, 150, "M_{ee} (GeV/c^{2})"};
241+
const AxisSpec axisInvMassZ{130, 20, 150, "M_{ee} (GeV/c^{2})"};
229242
const AxisSpec axisTrigger{3, -0.5, 2.5, "Trigger status of zorro"};
230243
const AxisSpec axisDPhiZh{64, -o2::constants::math::PIHalf, 3 * o2::constants::math::PIHalf, "#Delta#phi(Z-h)"};
231244
const AxisSpec axisPtHadron{50, 0, 50, "p_{T,hadron} (GeV/c)"};
232245
const AxisSpec axisPtZ{150, 0, 150, "p_{T,Z} (GeV/c)"};
233246
const AxisSpec axisSign{2, -2, 2, "charge sign"};
234-
const AxisSpec axisCentrality{10, 0, 100, "Centrality (%)"};
247+
const AxisSpec axisCentrality{centralityBins};
235248
const AxisSpec axisPtRatio{200, 0, 2.0, "pt ratio for h and Z"};
236249

237250
// create registrygrams
@@ -259,14 +272,14 @@ struct HfTaskElectronWeakBoson {
259272
registry.add("hEopNsigTPC", "Eop vs. Nsigma", kTH2F, {{axisNsigma}, {axisEop}});
260273
registry.add("hEMCtime", "EMC timing", kTH1F, {axisEMCtime});
261274
registry.add("hIsolationEnergy", "Isolation Energy", kTH2F, {{axisE}, {axisIsoEnergy}});
262-
registry.add("hIsolationTrack", "Isolation Track", kTH2F, {{axisE}, {axisIsoTrack}});
263-
registry.add("hInvMassZee", "invariant mass for Z ULS pair", HistType::kTHnSparseF, {axisSign, axisPt, axisInvMassZ});
264-
registry.add("hKfInvMassZee", "invariant mass for Z ULS pair KFp", HistType::kTHnSparseF, {axisSign, axisPt, axisInvMassZ});
275+
registry.add("hInvMassZee", "invariant mass for Z ULS pair", HistType::kTHnSparseF, {axisCentrality, axisSign, axisPt, axisInvMassZgamma});
276+
registry.add("hKfInvMassZee", "invariant mass for Z ULS pair KFp", HistType::kTHnSparseF, {axisCentrality, axisSign, axisPt, axisInvMassZgamma});
277+
registry.add("hInvMassZeeQA", "QA for invariant mass for Z", HistType::kTHnSparseF, {axisInvMassZ, axisPtZele, axisPtZpos, axisEopZele, axisEopZpos, axisIsoEnergyZele, axisIsoEnergyZpos, axisIsoMomentumZele, axisIsoMomentumZpos, axisIsoTrackZele, axisIsoTrackZpos});
265278
registry.add("hTHnElectrons", "electron info", HistType::kTHnSparseF, {axisPt, axisNsigma, axisM02, axisEop, axisIsoEnergy, axisIsoTrack, axisEta, axisDedx});
266279
registry.add("hTHnTrMatch", "Track EMC Match", HistType::kTHnSparseF, {axisPt, axisdPhi, axisdEta});
267280

268281
// Z-hadron correlation histograms
269-
registry.add("hZHadronDphi", "Z-hadron #Delta#phi correlation", HistType::kTHnSparseF, {axisSign, axisPtZ, axisDPhiZh, axisPtRatio, axisPtHadron});
282+
registry.add("hZHadronDphi", "Z-hadron #Delta#phi correlation", HistType::kTHnSparseF, {axisCentrality, axisSign, axisPtZ, axisDPhiZh, axisPtRatio, axisPtHadron});
270283
registry.add("hZptSpectrum", "Z boson p_{T} spectrum", kTH2F, {{axisSign}, {axisPtZ}});
271284

272285
// hisotgram for EMCal trigger
@@ -306,12 +319,15 @@ struct HfTaskElectronWeakBoson {
306319

307320
return (isoEnergy);
308321
}
309-
int getIsolatedTrack(double etaEle,
310-
double phiEle,
311-
float ptEle,
312-
TrackEle const& tracks)
322+
std::pair<int, double> getIsolatedTrack(double etaEle,
323+
double phiEle,
324+
float pEle,
325+
TrackEle const& tracks)
313326
{
314327
int trackCount = 0;
328+
double isoMomentum = 10;
329+
double pSum = 0.0;
330+
// LOG(info) << "track p = " << pEle;
315331

316332
for (const auto& track : tracks) {
317333

@@ -323,16 +339,22 @@ struct HfTaskElectronWeakBoson {
323339

324340
if (deltaR < rIsolation) {
325341
trackCount++;
342+
pSum += track.p();
326343
}
327344
}
328345

329-
registry.fill(HIST("hIsolationTrack"), ptEle, trackCount);
346+
// LOG(info) << "momSun = " << pSum;
347+
if (pSum > 0) {
348+
isoMomentum = pSum / pEle - 1.0;
349+
}
330350

331-
return (trackCount);
351+
// LOG(info) << "isop = " << isoMomentum;
352+
return std::make_pair(trackCount - 1, isoMomentum);
332353
}
333354

334355
void recoMassZee(KFParticle kfpIsoEle,
335356
int charge,
357+
float centrality,
336358
TrackEle const& tracks)
337359
{
338360
// LOG(info) << "Invarimass cal by KF particle ";
@@ -362,7 +384,7 @@ struct HfTaskElectronWeakBoson {
362384
auto child2 = RecoDecayPtEtaPhi::pVector(kfpAssEle.GetPt() * correctionPtElectron, kfpAssEle.GetEta(), kfpAssEle.GetPhi());
363385
double invMassEE = RecoDecay::m(std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron});
364386

365-
registry.fill(HIST("hInvMassZee"), track.sign() * charge, kfpIsoEle.GetPt(), invMassEE);
387+
registry.fill(HIST("hInvMassZee"), centrality, track.sign() * charge, kfpIsoEle.GetPt(), invMassEE);
366388

367389
// reco by KFparticle
368390
const KFParticle* electronPairs[2] = {&kfpIsoEle, &kfpAssEle};
@@ -382,7 +404,7 @@ struct HfTaskElectronWeakBoson {
382404
}
383405
float massZee, massZeeErr;
384406
zeeKF.GetMass(massZee, massZeeErr);
385-
registry.fill(HIST("hKfInvMassZee"), track.sign() * charge, kfpIsoEle.GetPt(), massZee);
407+
registry.fill(HIST("hKfInvMassZee"), centrality, track.sign() * charge, kfpIsoEle.GetPt(), massZee);
386408
// LOG(info) << "Invarimass cal by KF particle mass = " << massZee;
387409
// LOG(info) << "Invarimass cal by RecoDecay = " << invMassEE;
388410
reconstructedZ.emplace_back(
@@ -448,6 +470,7 @@ struct HfTaskElectronWeakBoson {
448470
}
449471
// initialze for inclusive-electron
450472
selectedElectronsIso.clear();
473+
selectedPositronsIso.clear();
451474
selectedElectronsAss.clear();
452475
reconstructedZ.clear();
453476

@@ -460,8 +483,9 @@ struct HfTaskElectronWeakBoson {
460483
registry.fill(HIST("hZvtx"), collision.posZ());
461484

462485
// Calculate centrality
486+
float centrality = 1.0;
463487
if (enableCentralityAnalysis) {
464-
float centrality = o2::hf_centrality::getCentralityColl(collision, centralityEstimator);
488+
centrality = o2::hf_centrality::getCentralityColl(collision, centralityEstimator);
465489
// LOG(info) << centrality;
466490
if (centrality < centralityMin || centrality > centralityMax) {
467491
return;
@@ -502,38 +526,46 @@ struct HfTaskElectronWeakBoson {
502526
registry.fill(HIST("hPt"), track.pt());
503527
registry.fill(HIST("hTPCNsigma"), track.p(), track.tpcNSigmaEl());
504528

505-
float energyTrk = 0.0;
529+
float eop = 0.0;
530+
float isoEnergy = 1.0;
531+
// track isolation
532+
auto [trackCount, isoMomentum] = getIsolatedTrack(track.eta(), track.phi(), track.p(), tracks);
533+
// LOG(info) << "isoMomentum = " << isoMomentum;
506534

507535
if (track.pt() > ptAssMin) {
508536
selectedElectronsAss.emplace_back(
509537
track.pt(),
510538
track.eta(),
511539
track.phi(),
512-
energyTrk,
513-
track.sign());
540+
eop,
541+
isoEnergy,
542+
isoMomentum,
543+
trackCount);
514544
}
515545

516546
if (track.pt() < ptMin) {
517547
continue;
518548
}
519-
// track - match
520549

521-
// continue;
522-
if (track.phi() < phiEmcMin || track.phi() > phiEmcMax)
523-
continue;
524-
if (std::abs(track.eta()) > etaEmcMax)
525-
continue;
550+
// LOG(info) << "tr phi, eta = " << track.phi() << " ; " << track.eta();
551+
// EMC acc
552+
bool isEMCacceptance = true;
553+
if (track.phi() < phiEmcMin || track.phi() > phiEmcMax) {
554+
isEMCacceptance = false;
555+
}
556+
if (std::abs(track.eta()) > etaEmcMax) {
557+
isEMCacceptance = false;
558+
}
559+
// LOG(info) << "EMC acc = " << isEMCacceptance;
526560
auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, track.globalIndex());
527561

528-
// LOGF(info, "Number of matched track: %d", tracksofcluster.size());
529-
530562
double rMin = 999.9;
531563
double dPhiMin = 999.9;
532564
double dEtaMin = 999.9;
533565
bool isIsolated = false;
534566
bool isIsolatedTr = false;
535567

536-
if (tracksofcluster.size()) {
568+
if (tracksofcluster.size() && isEMCacceptance) {
537569
int nMatch = 0;
538570
for (const auto& match : tracksofcluster) {
539571
if (match.emcalcluster_as<SelectedClusters>().time() < timeEmcMin || match.emcalcluster_as<SelectedClusters>().time() > timeEmcMax)
@@ -557,6 +589,7 @@ struct HfTaskElectronWeakBoson {
557589
registry.fill(HIST("hMatchEta"), etaEmc, match.track_as<TrackEle>().trackEtaEmcal());
558590

559591
double r = RecoDecay::sqrtSumOfSquares(dPhi, dEta);
592+
// LOG(info) << "r match = " << r;
560593
if (r < rMin) {
561594
rMin = r;
562595
dPhiMin = dPhi;
@@ -574,11 +607,10 @@ struct HfTaskElectronWeakBoson {
574607

575608
const auto& cluster = match.emcalcluster_as<SelectedClusters>();
576609

577-
double eop = energyEmc / match.track_as<TrackEle>().p();
610+
eop = energyEmc / match.track_as<TrackEle>().p();
611+
// LOG(info) << "eop = " << eop;
578612

579-
double isoEnergy = getIsolatedCluster(cluster, emcClusters);
580-
581-
int trackCount = getIsolatedTrack(track.eta(), track.phi(), track.pt(), tracks) - 1;
613+
isoEnergy = getIsolatedCluster(cluster, emcClusters);
582614

583615
if (match.track_as<TrackEle>().pt() > ptTHnThresh && isTHnElectron) {
584616
registry.fill(HIST("hTHnElectrons"), match.track_as<TrackEle>().pt(), match.track_as<TrackEle>().tpcNSigmaEl(), m02Emc, eop, isoEnergy, trackCount, track.eta(), track.tpcSignal());
@@ -606,29 +638,44 @@ struct HfTaskElectronWeakBoson {
606638
}
607639
KFPTrack kfpTrackIsoEle = createKFPTrackFromTrack(match.track_as<TrackEle>());
608640
KFParticle kfpIsoEle(kfpTrackIsoEle, pdgIso);
609-
recoMassZee(kfpIsoEle, match.track_as<TrackEle>().sign(), tracks);
610-
611-
selectedElectronsIso.emplace_back(
612-
match.track_as<TrackEle>().pt(),
613-
match.track_as<TrackEle>().eta(),
614-
match.track_as<TrackEle>().phi(),
615-
energyEmc,
616-
match.track_as<TrackEle>().sign());
617-
}
618-
}
641+
recoMassZee(kfpIsoEle, match.track_as<TrackEle>().sign(), centrality, tracks);
642+
643+
} // end of pt cut for e from Z
644+
} // end if isolation cut
619645
if (isIsolatedTr) {
620646
registry.fill(HIST("hEopIsolationTr"), match.track_as<TrackEle>().pt(), eop);
621647
}
622-
}
623-
}
648+
} // end of PID cut
649+
} // end of nmatch == 0
624650
nMatch++;
625-
}
626-
}
651+
} // end of cluster match
652+
} // end of cluster
627653

628654
if (rMin < rMatchMax) {
629655
// LOG(info) << "R mim = " << rMin;
630656
registry.fill(HIST("hTrMatch_mim"), dPhiMin, dEtaMin);
631657
}
658+
if (enableZeeRecoQA && track.pt() > ptZeeMin) {
659+
if (track.sign() < 0) {
660+
selectedElectronsIso.emplace_back(
661+
track.pt(),
662+
track.eta(),
663+
track.phi(),
664+
eop,
665+
isoEnergy,
666+
isoMomentum,
667+
trackCount);
668+
} else {
669+
selectedPositronsIso.emplace_back(
670+
track.pt(),
671+
track.eta(),
672+
track.phi(),
673+
eop,
674+
isoEnergy,
675+
isoMomentum,
676+
trackCount);
677+
}
678+
}
632679

633680
} // end of track loop
634681
// Z-hadron
@@ -649,10 +696,23 @@ struct HfTaskElectronWeakBoson {
649696
// calculate Z-h correlation
650697
double deltaPhi = RecoDecay::constrainAngle(trackAss.phi - zBoson.phi, -o2::constants::math::PIHalf);
651698
double ptRatio = trackAss.pt / zBoson.pt;
652-
registry.fill(HIST("hZHadronDphi"), zBoson.charge, zBoson.pt, deltaPhi, ptRatio, trackAss.pt);
699+
registry.fill(HIST("hZHadronDphi"), centrality, zBoson.charge, zBoson.pt, deltaPhi, ptRatio, trackAss.pt);
653700
}
654701
}
655702
} // end of Z-hadron correlation
703+
// Z->ee QA
704+
if (enableZeeRecoQA) {
705+
if (selectedElectronsIso.size() > 0 && selectedPositronsIso.size() > 0) {
706+
for (const auto& trackEle : selectedElectronsIso) {
707+
for (const auto& trackPos : selectedPositronsIso) {
708+
auto child1 = RecoDecayPtEtaPhi::pVector(trackEle.pt, trackEle.eta, trackEle.phi);
709+
auto child2 = RecoDecayPtEtaPhi::pVector(trackPos.pt, trackPos.eta, trackPos.phi);
710+
double invMass = RecoDecay::m(std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron});
711+
registry.fill(HIST("hInvMassZeeQA"), invMass, trackEle.pt, trackPos.pt, trackEle.eop, trackPos.eop, trackEle.energyIso, trackPos.energyIso, trackEle.momIso, trackPos.momIso, trackEle.ntrackIso, trackPos.ntrackIso);
712+
}
713+
}
714+
}
715+
} // end of Z->ee QA
656716
}
657717
};
658718

0 commit comments

Comments
 (0)