Skip to content

Commit 56a24f1

Browse files
authored
[PWGEM/Dilepton] update RCT selection (#10848)
1 parent 88b6163 commit 56a24f1

File tree

7 files changed

+177
-57
lines changed

7 files changed

+177
-57
lines changed

PWGEM/Dilepton/Core/Dilepton.h

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "DataFormatsParameters/GRPMagField.h"
4646
#include "CCDB/BasicCCDBManager.h"
4747
#include "Tools/ML/MlResponse.h"
48+
#include "Common/CCDB/RCTSelectionFlags.h"
4849

4950
#include "PWGEM/Dilepton/DataModel/dileptonTables.h"
5051
#include "PWGEM/Dilepton/Core/DielectronCut.h"
@@ -152,6 +153,11 @@ struct Dilepton {
152153
Configurable<bool> cfgRequireGoodITSLayer3{"cfgRequireGoodITSLayer3", false, "number of inactive chips on ITS layer 3 are below threshold "};
153154
Configurable<bool> cfgRequireGoodITSLayer0123{"cfgRequireGoodITSLayer0123", false, "number of inactive chips on ITS layers 0-3 are below threshold "};
154155
Configurable<bool> cfgRequireGoodITSLayersAll{"cfgRequireGoodITSLayersAll", false, "number of inactive chips on all ITS layers are below threshold "};
156+
// for RCT
157+
Configurable<bool> cfgRequireGoodRCT{"cfgRequireGoodRCT", false, "require good detector flag in run condtion table"};
158+
Configurable<std::string> cfgRCTLabel{"cfgRCTLabel", "CBT_hadronPID", "select 1 [CBT, CBT_hadron, CBT_muon_glo] see O2Physics/Common/CCDB/RCTSelectionFlags.h"};
159+
Configurable<bool> cfgCheckZDC{"cfgCheckZDC", false, "set ZDC flag for PbPb"};
160+
Configurable<bool> cfgTreatLimitedAcceptanceAsBad{"cfgTreatLimitedAcceptanceAsBad", false, "reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance"};
155161
} eventcuts;
156162

157163
DielectronCut fDielectronCut;
@@ -276,6 +282,7 @@ struct Dilepton {
276282
Configurable<bool> enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"};
277283
} dimuoncuts;
278284

285+
o2::aod::rctsel::RCTFlagsChecker rctChecker;
279286
o2::ccdb::CcdbApi ccdbApi;
280287
Service<o2::ccdb::BasicCCDBManager> ccdb;
281288
int mRunNumber;
@@ -313,6 +320,7 @@ struct Dilepton {
313320
ccdb->setCaching(true);
314321
ccdb->setLocalObjectValidityChecking();
315322
ccdb->setFatalWhenNull(false);
323+
rctChecker.init(eventcuts.cfgRCTLabel.value, eventcuts.cfgCheckZDC.value, eventcuts.cfgTreatLimitedAcceptanceAsBad.value);
316324

317325
if (ConfVtxBins.value[0] == VARIABLE_WIDTH) {
318326
zvtx_bin_edges = std::vector<float>(ConfVtxBins.value.begin(), ConfVtxBins.value.end());
@@ -407,11 +415,13 @@ struct Dilepton {
407415
fRegistry.add("Event/hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true);
408416
}
409417
if (doprocessBC) {
410-
auto hTVXCounter = fRegistry.add<TH1>("BC/hTVXCounter", "TVX counter", kTH1D, {{4, -0.5f, 3.5f}});
418+
auto hTVXCounter = fRegistry.add<TH1>("BC/hTVXCounter", "TVX counter", kTH1D, {{6, -0.5f, 5.5f}});
411419
hTVXCounter->GetXaxis()->SetBinLabel(1, "TVX");
412420
hTVXCounter->GetXaxis()->SetBinLabel(2, "TVX && NoTFB");
413421
hTVXCounter->GetXaxis()->SetBinLabel(3, "TVX && NoITSROFB");
414-
hTVXCounter->GetXaxis()->SetBinLabel(4, "TVX && NoTFB && NoITSROFB");
422+
hTVXCounter->GetXaxis()->SetBinLabel(4, "TVX && GoodRCT");
423+
hTVXCounter->GetXaxis()->SetBinLabel(5, "TVX && NoTFB && NoITSROFB");
424+
hTVXCounter->GetXaxis()->SetBinLabel(6, "TVX && NoTFB && NoITSROFB && GoodRCT");
415425
}
416426
}
417427

@@ -1180,6 +1190,9 @@ struct Dilepton {
11801190
if (!fEMEventCut.IsSelected(collision)) {
11811191
continue;
11821192
}
1193+
if (eventcuts.cfgRequireGoodRCT && !rctChecker.checkTable(collision)) {
1194+
continue;
1195+
}
11831196

11841197
if (nmod > 0 && !isGoodQvector(qvectors)) {
11851198
continue;
@@ -1410,6 +1423,9 @@ struct Dilepton {
14101423
if (!fEMEventCut.IsSelected(collision)) {
14111424
continue;
14121425
}
1426+
if (eventcuts.cfgRequireGoodRCT && !rctChecker.checkTable(collision)) {
1427+
continue;
1428+
}
14131429

14141430
if (nmod > 0 && !isGoodQvector(qvectors)) {
14151431
continue;
@@ -1580,6 +1596,9 @@ struct Dilepton {
15801596
if (!fEMEventCut.IsSelected(collision)) {
15811597
continue;
15821598
}
1599+
if (eventcuts.cfgRequireGoodRCT && !rctChecker.checkTable(collision)) {
1600+
continue;
1601+
}
15831602
fRegistry.fill(HIST("Event/norm/hCollisionCounter"), o2::aod::pwgem::dilepton::utils::eventhistogram::nbin_ev); // accepted
15841603
} // end of collision loop
15851604
}
@@ -1588,17 +1607,24 @@ struct Dilepton {
15881607
void processBC(aod::EMBCs const& bcs)
15891608
{
15901609
for (const auto& bc : bcs) {
1591-
if (bc.isTriggerTVX()) {
1610+
if (bc.selection_bit(o2::aod::evsel::kIsTriggerTVX)) {
15921611
fRegistry.fill(HIST("BC/hTVXCounter"), 0.f);
1593-
if (bc.isNoTimeFrameBorder()) {
1612+
1613+
if (bc.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) {
15941614
fRegistry.fill(HIST("BC/hTVXCounter"), 1.f);
15951615
}
1596-
if (bc.isNoITSROFrameBorder()) {
1616+
if (bc.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) {
15971617
fRegistry.fill(HIST("BC/hTVXCounter"), 2.f);
15981618
}
1599-
if (bc.isNoTimeFrameBorder() && bc.isNoITSROFrameBorder()) {
1619+
if (rctChecker(bc)) {
16001620
fRegistry.fill(HIST("BC/hTVXCounter"), 3.f);
16011621
}
1622+
if (bc.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) && bc.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) {
1623+
fRegistry.fill(HIST("BC/hTVXCounter"), 4.f);
1624+
}
1625+
if (bc.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) && bc.selection_bit(o2::aod::evsel::kNoITSROFrameBorder) && rctChecker(bc)) {
1626+
fRegistry.fill(HIST("BC/hTVXCounter"), 5.f);
1627+
}
16021628
}
16031629
}
16041630
}

PWGEM/Dilepton/Core/DileptonMC.h

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "DataFormatsParameters/GRPMagField.h"
3838
#include "CCDB/BasicCCDBManager.h"
3939
#include "Tools/ML/MlResponse.h"
40+
#include "Common/CCDB/RCTSelectionFlags.h"
4041

4142
#include "Common/Core/RecoDecay.h"
4243
#include "Common/Core/trackUtilities.h"
@@ -144,6 +145,11 @@ struct DileptonMC {
144145
Configurable<bool> cfgRequireGoodITSLayer3{"cfgRequireGoodITSLayer3", false, "number of inactive chips on ITS layer 3 are below threshold "};
145146
Configurable<bool> cfgRequireGoodITSLayer0123{"cfgRequireGoodITSLayer0123", false, "number of inactive chips on ITS layers 0-3 are below threshold "};
146147
Configurable<bool> cfgRequireGoodITSLayersAll{"cfgRequireGoodITSLayersAll", false, "number of inactive chips on all ITS layers are below threshold "};
148+
// for RCT
149+
Configurable<bool> cfgRequireGoodRCT{"cfgRequireGoodRCT", false, "require good detector flag in run condtion table"};
150+
Configurable<std::string> cfgRCTLabel{"cfgRCTLabel", "CBT_hadronPID", "select 1 [CBT, CBT_hadron, CBT_muon_glo] see O2Physics/Common/CCDB/RCTSelectionFlags.h"};
151+
Configurable<bool> cfgCheckZDC{"cfgCheckZDC", false, "set ZDC flag for PbPb"};
152+
Configurable<bool> cfgTreatLimitedAcceptanceAsBad{"cfgTreatLimitedAcceptanceAsBad", false, "reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance"};
147153
} eventcuts;
148154

149155
DielectronCut fDielectronCut;
@@ -268,6 +274,7 @@ struct DileptonMC {
268274
Configurable<bool> enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"};
269275
} dimuoncuts;
270276

277+
o2::aod::rctsel::RCTFlagsChecker rctChecker;
271278
o2::ccdb::CcdbApi ccdbApi;
272279
Service<o2::ccdb::BasicCCDBManager> ccdb;
273280
o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE;
@@ -445,11 +452,11 @@ struct DileptonMC {
445452
}
446453

447454
// for correlated bkg due to mis-identified hadrons, and true combinatorial bkg
448-
fRegistry.add("Pair/corr_bkg_eh/uls/hs", "rec. bkg", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true);
449-
fRegistry.addClone("Pair/corr_bkg_eh/uls/", "Pair/corr_bkg_eh/lspp/");
450-
fRegistry.addClone("Pair/corr_bkg_eh/uls/", "Pair/corr_bkg_eh/lsmm/");
451-
fRegistry.addClone("Pair/corr_bkg_eh/", "Pair/corr_bkg_hh/");
452-
fRegistry.addClone("Pair/corr_bkg_eh/", "Pair/comb_bkg/");
455+
fRegistry.add("Pair/corr_bkg_lh/uls/hs", "rec. bkg", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true);
456+
fRegistry.addClone("Pair/corr_bkg_lh/uls/", "Pair/corr_bkg_lh/lspp/");
457+
fRegistry.addClone("Pair/corr_bkg_lh/uls/", "Pair/corr_bkg_lh/lsmm/");
458+
fRegistry.addClone("Pair/corr_bkg_lh/", "Pair/corr_bkg_hh/");
459+
fRegistry.addClone("Pair/corr_bkg_lh/", "Pair/comb_bkg/");
453460

454461
if (cfgFillUnfolding) {
455462
// for 2D unfolding
@@ -493,6 +500,7 @@ struct DileptonMC {
493500
ccdb->setCaching(true);
494501
ccdb->setLocalObjectValidityChecking();
495502
ccdb->setFatalWhenNull(false);
503+
rctChecker.init(eventcuts.cfgRCTLabel.value, eventcuts.cfgCheckZDC.value, eventcuts.cfgTreatLimitedAcceptanceAsBad.value);
496504

497505
DefineEMEventCut();
498506
addhistograms();
@@ -512,11 +520,13 @@ struct DileptonMC {
512520
fRegistry.addClone("Event/before/hCollisionCounter", "Event/norm/hCollisionCounter");
513521
}
514522
if (doprocessBC) {
515-
auto hTVXCounter = fRegistry.add<TH1>("BC/hTVXCounter", "TVX counter", kTH1D, {{4, -0.5f, 3.5f}});
523+
auto hTVXCounter = fRegistry.add<TH1>("BC/hTVXCounter", "TVX counter", kTH1D, {{6, -0.5f, 5.5f}});
516524
hTVXCounter->GetXaxis()->SetBinLabel(1, "TVX");
517525
hTVXCounter->GetXaxis()->SetBinLabel(2, "TVX && NoTFB");
518526
hTVXCounter->GetXaxis()->SetBinLabel(3, "TVX && NoITSROFB");
519-
hTVXCounter->GetXaxis()->SetBinLabel(4, "TVX && NoTFB && NoITSROFB");
527+
hTVXCounter->GetXaxis()->SetBinLabel(4, "TVX && GoodRCT");
528+
hTVXCounter->GetXaxis()->SetBinLabel(5, "TVX && NoTFB && NoITSROFB");
529+
hTVXCounter->GetXaxis()->SetBinLabel(6, "TVX && NoTFB && NoITSROFB && GoodRCT");
520530
}
521531
}
522532

@@ -903,7 +913,7 @@ struct DileptonMC {
903913
o2::math_utils::bringToPMPi(phiCS);
904914

905915
if ((FindCommonMotherFrom2ProngsWithoutPDG(t1mc, t2mc) > 0 || IsHF(t1mc, t2mc, mcparticles) > 0) && is_pair_from_same_mcevent) { // for bkg study
906-
if (std::abs(t1mc.pdgCode()) != pdg_lepton || std::abs(t2mc.pdgCode()) != pdg_lepton) { // hh or eh correlated bkg
916+
if (std::abs(t1mc.pdgCode()) != pdg_lepton || std::abs(t2mc.pdgCode()) != pdg_lepton) { // hh or lh correlated bkg
907917
if (std::abs(t1mc.pdgCode()) != pdg_lepton && std::abs(t2mc.pdgCode()) != pdg_lepton) { // hh correlated bkg
908918
if (t1.sign() * t2.sign() < 0) { // ULS
909919
fRegistry.fill(HIST("Pair/corr_bkg_hh/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight);
@@ -912,13 +922,13 @@ struct DileptonMC {
912922
} else if (t1.sign() < 0 && t2.sign() < 0) { // LS--
913923
fRegistry.fill(HIST("Pair/corr_bkg_hh/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight);
914924
}
915-
} else { // eh correlated bkg
925+
} else { // lh correlated bkg
916926
if (t1.sign() * t2.sign() < 0) { // ULS
917-
fRegistry.fill(HIST("Pair/corr_bkg_eh/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight);
927+
fRegistry.fill(HIST("Pair/corr_bkg_lh/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight);
918928
} else if (t1.sign() > 0 && t2.sign() > 0) { // LS++
919-
fRegistry.fill(HIST("Pair/corr_bkg_eh/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight);
929+
fRegistry.fill(HIST("Pair/corr_bkg_lh/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight);
920930
} else if (t1.sign() < 0 && t2.sign() < 0) { // LS--
921-
fRegistry.fill(HIST("Pair/corr_bkg_eh/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight);
931+
fRegistry.fill(HIST("Pair/corr_bkg_lh/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight);
922932
}
923933
}
924934
}
@@ -1213,6 +1223,9 @@ struct DileptonMC {
12131223
if (!fEMEventCut.IsSelected(collision)) {
12141224
continue;
12151225
}
1226+
if (eventcuts.cfgRequireGoodRCT && !rctChecker.checkTable(collision)) {
1227+
continue;
1228+
}
12161229
o2::aod::pwgem::dilepton::utils::eventhistogram::fillEventInfo<1, -1>(&fRegistry, collision);
12171230
fRegistry.fill(HIST("Event/before/hCollisionCounter"), o2::aod::pwgem::dilepton::utils::eventhistogram::nbin_ev); // accepted
12181231
fRegistry.fill(HIST("Event/after/hCollisionCounter"), o2::aod::pwgem::dilepton::utils::eventhistogram::nbin_ev); // accepted
@@ -1257,6 +1270,9 @@ struct DileptonMC {
12571270
if (!fEMEventCut.IsSelected(collision)) {
12581271
continue;
12591272
}
1273+
if (eventcuts.cfgRequireGoodRCT && !rctChecker.checkTable(collision)) {
1274+
continue;
1275+
}
12601276
fRegistry.fill(HIST("MCEvent/after/hZvtx"), mccollision.posZ());
12611277

12621278
auto posTracks_per_coll = posTracksMC.sliceByCachedUnsorted(aod::emmcparticle::emmceventId, mccollision.globalIndex(), cache);
@@ -1859,6 +1875,9 @@ struct DileptonMC {
18591875
if (!fEMEventCut.IsSelected(collision)) {
18601876
continue;
18611877
}
1878+
if (eventcuts.cfgRequireGoodRCT && !rctChecker.checkTable(collision)) {
1879+
continue;
1880+
}
18621881

18631882
// auto mccollision = collision.template emmcevent_as<TMCCollisions>();
18641883
// if (cfgEventGeneratorType >= 0 && mccollision.getSubGeneratorId() != cfgEventGeneratorType) {
@@ -2000,6 +2019,9 @@ struct DileptonMC {
20002019
if (!fEMEventCut.IsSelected(collision)) {
20012020
continue;
20022021
}
2022+
if (eventcuts.cfgRequireGoodRCT && !rctChecker.checkTable(collision)) {
2023+
continue;
2024+
}
20032025

20042026
auto posTracks_per_coll = posTracks.sliceByCached(perCollision, collision.globalIndex(), cache); // reconstructed pos tracks
20052027
auto negTracks_per_coll = negTracks.sliceByCached(perCollision, collision.globalIndex(), cache); // reconstructed neg tracks
@@ -2374,6 +2396,9 @@ struct DileptonMC {
23742396
if (!fEMEventCut.IsSelected(collision)) {
23752397
continue;
23762398
}
2399+
if (eventcuts.cfgRequireGoodRCT && !rctChecker.checkTable(collision)) {
2400+
continue;
2401+
}
23772402
auto mccollision = collision.template emmcevent_as<MyMCCollisions>();
23782403
if (cfgEventGeneratorType >= 0 && mccollision.getSubGeneratorId() != cfgEventGeneratorType) {
23792404
continue;
@@ -2473,6 +2498,9 @@ struct DileptonMC {
24732498
if (!fEMEventCut.IsSelected(collision)) {
24742499
continue;
24752500
}
2501+
if (eventcuts.cfgRequireGoodRCT && !rctChecker.checkTable(collision)) {
2502+
continue;
2503+
}
24762504
fRegistry.fill(HIST("Event/norm/hCollisionCounter"), o2::aod::pwgem::dilepton::utils::eventhistogram::nbin_ev); // accepted
24772505
} // end of collision loop
24782506
}
@@ -2481,17 +2509,24 @@ struct DileptonMC {
24812509
void processBC(aod::EMBCs const& bcs)
24822510
{
24832511
for (const auto& bc : bcs) {
2484-
if (bc.isTriggerTVX()) {
2512+
if (bc.selection_bit(o2::aod::evsel::kIsTriggerTVX)) {
24852513
fRegistry.fill(HIST("BC/hTVXCounter"), 0.f);
2486-
if (bc.isNoTimeFrameBorder()) {
2514+
2515+
if (bc.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) {
24872516
fRegistry.fill(HIST("BC/hTVXCounter"), 1.f);
24882517
}
2489-
if (bc.isNoITSROFrameBorder()) {
2518+
if (bc.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) {
24902519
fRegistry.fill(HIST("BC/hTVXCounter"), 2.f);
24912520
}
2492-
if (bc.isNoTimeFrameBorder() && bc.isNoITSROFrameBorder()) {
2521+
if (rctChecker(bc)) {
24932522
fRegistry.fill(HIST("BC/hTVXCounter"), 3.f);
24942523
}
2524+
if (bc.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) && bc.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) {
2525+
fRegistry.fill(HIST("BC/hTVXCounter"), 4.f);
2526+
}
2527+
if (bc.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) && bc.selection_bit(o2::aod::evsel::kNoITSROFrameBorder) && rctChecker(bc)) {
2528+
fRegistry.fill(HIST("BC/hTVXCounter"), 5.f);
2529+
}
24952530
}
24962531
}
24972532
}

0 commit comments

Comments
 (0)