Skip to content

Commit fb4e6b5

Browse files
nstrangmNicolas Strangmann
andauthored
[PWGEM/PhotonMeson] Fill collision counter histogram weighted (for JJ MCs) (#9645)
Co-authored-by: Nicolas Strangmann <nicolas.strangmann@.cern.ch>
1 parent bca3d15 commit fb4e6b5

File tree

4 files changed

+47
-50
lines changed

4 files changed

+47
-50
lines changed

PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -580,13 +580,13 @@ struct Pi0EtaToGammaGamma {
580580
continue;
581581
}
582582

583-
o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(&fRegistry, collision);
583+
o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(&fRegistry, collision, collision.weight());
584584
if (!fEMEventCut.IsSelected(collision)) {
585585
continue;
586586
}
587-
o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(&fRegistry, collision);
588-
fRegistry.fill(HIST("Event/before/hCollisionCounter"), 12.0); // accepted
589-
fRegistry.fill(HIST("Event/after/hCollisionCounter"), 12.0); // accepted
587+
o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(&fRegistry, collision, collision.weight());
588+
fRegistry.fill(HIST("Event/before/hCollisionCounter"), 12.0, collision.weight()); // accepted
589+
fRegistry.fill(HIST("Event/after/hCollisionCounter"), 12.0, collision.weight()); // accepted
590590

591591
int zbin = lower_bound(zvtx_bin_edges.begin(), zvtx_bin_edges.end(), collision.posZ()) - zvtx_bin_edges.begin() - 1;
592592
if (zbin < 0) {

PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,8 @@ struct Pi0EtaToGammaGammaMC {
394394
fEMCCut.SetM02Range(emccuts.EMC_minM02, emccuts.EMC_maxM02);
395395
fEMCCut.SetTimeRange(emccuts.EMC_minTime, emccuts.EMC_maxTime);
396396

397-
fEMCCut.SetTrackMatchingEta([a, b, c](float pT) { return a + pow(pT + b, c); });
398-
fEMCCut.SetTrackMatchingPhi([d, e, f](float pT) { return d + pow(pT + e, f); });
397+
fEMCCut.SetTrackMatchingEta([a, b, c](float pT) { return a + std::pow(pT + b, c); });
398+
fEMCCut.SetTrackMatchingPhi([d, e, f](float pT) { return d + std::pow(pT + e, f); });
399399

400400
fEMCCut.SetMinEoverP(emccuts.EMC_Eoverp);
401401
fEMCCut.SetUseExoticCut(emccuts.EMC_UseExoticCut);
@@ -443,13 +443,13 @@ struct Pi0EtaToGammaGammaMC {
443443
continue;
444444
}
445445

446-
o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(&fRegistry, collision);
446+
o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(&fRegistry, collision, collision.weight());
447447
if (!fEMEventCut.IsSelected(collision)) {
448448
continue;
449449
}
450-
o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(&fRegistry, collision);
451-
fRegistry.fill(HIST("Event/before/hCollisionCounter"), 12.0); // accepted
452-
fRegistry.fill(HIST("Event/after/hCollisionCounter"), 12.0); // accepted
450+
o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(&fRegistry, collision, collision.weight());
451+
fRegistry.fill(HIST("Event/before/hCollisionCounter"), 12.0, collision.weight()); // accepted
452+
fRegistry.fill(HIST("Event/after/hCollisionCounter"), 12.0, collision.weight()); // accepted
453453

454454
int photonid1 = -1, photonid2 = -1, pi0id = -1, etaid = -1;
455455
if constexpr (pairtype == PairType::kPCMPCM || pairtype == PairType::kPHOSPHOS || pairtype == PairType::kEMCEMC) { // same kinds pairing
@@ -507,7 +507,7 @@ struct Pi0EtaToGammaGammaMC {
507507
ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.);
508508
ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.);
509509
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
510-
if (abs(v12.Rapidity()) > maxY_rec) {
510+
if (std::abs(v12.Rapidity()) > maxY_rec) {
511511
continue;
512512
}
513513

@@ -568,7 +568,7 @@ struct Pi0EtaToGammaGammaMC {
568568
ROOT::Math::PtEtaPhiMVector v_pos(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron);
569569
ROOT::Math::PtEtaPhiMVector v_ele(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron);
570570
ROOT::Math::PtEtaPhiMVector veeg = v_gamma + v_pos + v_ele;
571-
if (abs(veeg.Rapidity()) > maxY_rec) {
571+
if (std::abs(veeg.Rapidity()) > maxY_rec) {
572572
continue;
573573
}
574574
if (pi0id > 0) {
@@ -591,7 +591,7 @@ struct Pi0EtaToGammaGammaMC {
591591
ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.);
592592
ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.);
593593
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
594-
if (abs(v12.Rapidity()) > maxY_rec) {
594+
if (std::abs(v12.Rapidity()) > maxY_rec) {
595595
continue;
596596
}
597597
// if (pi0id > 0) {

PWGEM/PhotonMeson/Tasks/emcalQC.cxx

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -166,46 +166,44 @@ struct EmcalQC {
166166
continue;
167167
}
168168

169-
fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 1);
169+
fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 1, collision.weight());
170170
if (!eventcuts.cfgRequireFT0AND || collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) {
171-
fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 2);
171+
fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 2, collision.weight());
172172
if (std::abs(collision.posZ()) < eventcuts.cfgZvtxMax) {
173-
fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 3);
173+
fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 3, collision.weight());
174174
if (!eventcuts.cfgRequireSel8 || collision.sel8()) {
175-
fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 4);
175+
fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 4, collision.weight());
176176
if (!eventcuts.cfgRequireGoodZvtxFT0vsPV || collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) {
177-
fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 5);
177+
fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 5, collision.weight());
178178
if (!eventcuts.cfgRequireNoSameBunchPileup || collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) {
179-
fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 6);
179+
fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 6, collision.weight());
180180
if (!eventcuts.cfgRequireEMCReadoutInMB || collision.alias_bit(kTVXinEMC))
181-
fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 7);
181+
fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 7, collision.weight());
182182
}
183183
}
184184
}
185185
}
186186
}
187187

188-
o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(&fRegistry, collision);
188+
o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(&fRegistry, collision, collision.weight());
189189
if (!fEMEventCut.IsSelected(collision)) {
190190
continue;
191191
}
192192
if (!(eventcuts.cfgOccupancyMin <= collision.trackOccupancyInTimeRange() && collision.trackOccupancyInTimeRange() < eventcuts.cfgOccupancyMax)) {
193193
continue;
194194
}
195195

196-
o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(&fRegistry, collision);
197-
fRegistry.fill(HIST("Event/before/hCollisionCounter"), 12.0); // accepted
198-
fRegistry.fill(HIST("Event/after/hCollisionCounter"), 12.0); // accepted
196+
o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(&fRegistry, collision, collision.weight());
197+
fRegistry.fill(HIST("Event/before/hCollisionCounter"), 12.0, collision.weight()); // accepted
198+
fRegistry.fill(HIST("Event/after/hCollisionCounter"), 12.0, collision.weight()); // accepted
199199

200200
auto clustersPerColl = clusters.sliceBy(perCollision, collision.collisionId());
201201
fRegistry.fill(HIST("Cluster/before/hNgamma"), clustersPerColl.size(), collision.weight());
202-
int ngBefore = 0;
203202
int ngAfter = 0;
204203
for (const auto& cluster : clustersPerColl) {
205204
// Fill the cluster properties before applying any cuts
206205
if (!fEMCCut.IsSelectedEMCal(EMCPhotonCut::EMCPhotonCuts::kDefinition, cluster))
207206
continue;
208-
ngBefore++;
209207
o2::aod::pwgem::photonmeson::utils::clusterhistogram::fillClusterHistograms<0>(&fRegistry, cluster, cfgDo2DQA, collision.weight());
210208

211209
// Apply cuts one by one and fill in hClusterQualityCuts histogram
@@ -233,7 +231,6 @@ struct EmcalQC {
233231
ngAfter++;
234232
}
235233
}
236-
fRegistry.fill(HIST("Cluster/before/hNgamma"), ngBefore, collision.weight());
237234
fRegistry.fill(HIST("Cluster/after/hNgamma"), ngAfter, collision.weight());
238235
} // end of collision loop
239236
} // end of process

PWGEM/PhotonMeson/Utils/EventHistograms.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,51 +49,51 @@ void addEventHistograms(HistogramRegistry* fRegistry)
4949
}
5050

5151
template <const int ev_id, typename TCollision>
52-
void fillEventInfo(HistogramRegistry* fRegistry, TCollision const& collision)
52+
void fillEventInfo(HistogramRegistry* fRegistry, TCollision const& collision, float weight = 1.)
5353
{
5454
static constexpr std::string_view event_types[2] = {"before/", "after/"};
55-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 1.0);
55+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 1.0, weight);
5656
if (collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) {
57-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 2.0);
57+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 2.0, weight);
5858
}
5959
if (collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) {
60-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 3.0);
60+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 3.0, weight);
6161
}
6262
if (collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) {
63-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 4.0);
63+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 4.0, weight);
6464
}
6565
if (collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) {
66-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 5.0);
66+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 5.0, weight);
6767
}
6868
if (collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) {
69-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 6.0);
69+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 6.0, weight);
7070
}
7171
if (collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) {
72-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 7.0);
72+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 7.0, weight);
7373
}
7474
if (collision.sel8()) {
75-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 8.0);
75+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 8.0, weight);
7676
}
77-
if (abs(collision.posZ()) < 10.0) {
78-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 9.0);
77+
if (std::abs(collision.posZ()) < 10.0) {
78+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 9.0, weight);
7979
}
80-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hZvtx"), collision.posZ());
80+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hZvtx"), collision.posZ(), weight);
8181
if (collision.alias_bit(kTVXinEMC)) {
82-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 10.0);
82+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 10.0, weight);
8383
}
8484
if (collision.alias_bit(kEMC7) || collision.alias_bit(kDMC7)) {
85-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 11.0);
85+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 11.0, weight);
8686
}
8787

88-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultNTracksPV"), collision.multNTracksPV());
89-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultNTracksPVeta1"), collision.multNTracksPVeta1());
90-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0"), collision.multFT0A(), collision.multFT0C());
91-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0A"), collision.centFT0A());
92-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0C"), collision.centFT0C());
93-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0M"), collision.centFT0M());
94-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0CvsMultNTracksPV"), collision.centFT0C(), collision.multNTracksPV());
95-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0CvsMultNTracksPV"), collision.multFT0C(), collision.multNTracksPV());
96-
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0CvsOccupancy"), collision.multFT0C(), collision.trackOccupancyInTimeRange());
88+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultNTracksPV"), collision.multNTracksPV(), weight);
89+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultNTracksPVeta1"), collision.multNTracksPVeta1(), weight);
90+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0"), collision.multFT0A(), collision.multFT0C(), weight);
91+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0A"), collision.centFT0A(), weight);
92+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0C"), collision.centFT0C(), weight);
93+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0M"), collision.centFT0M(), weight);
94+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0CvsMultNTracksPV"), collision.centFT0C(), collision.multNTracksPV(), weight);
95+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0CvsMultNTracksPV"), collision.multFT0C(), collision.multNTracksPV(), weight);
96+
fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0CvsOccupancy"), collision.multFT0C(), collision.trackOccupancyInTimeRange(), weight);
9797
}
9898

9999
} // namespace o2::aod::pwgem::photonmeson::utils::eventhistogram

0 commit comments

Comments
 (0)