Skip to content

Commit c8983ac

Browse files
author
Veronika Barbasova
committed
[PWGLF] TOF shift, Flags for Gen and pt dependent DCA cut
Signed-off-by: Veronika Barbasova <vernika.barbasova@cern.ch>
1 parent cd50e54 commit c8983ac

1 file changed

Lines changed: 95 additions & 24 deletions

File tree

‎PWGLF/Tasks/Resonances/phianalysisTHnSparse.cxx‎

Lines changed: 95 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "PWGLF/Utils/rsnOutput.h"
1919

2020
#include "Common/CCDB/EventSelectionParams.h"
21+
#include "Common/CCDB/RCTSelectionFlags.h"
2122
#include "Common/DataModel/Centrality.h"
2223
#include "Common/DataModel/EventSelection.h"
2324
#include "Common/DataModel/Multiplicity.h"
@@ -62,6 +63,7 @@ using namespace o2;
6263
using namespace o2::analysis;
6364
using namespace o2::framework;
6465
using namespace o2::framework::expressions;
66+
using namespace o2::aod::rctsel;
6567

6668
struct PhianalysisTHnSparse {
6769

@@ -98,11 +100,15 @@ struct PhianalysisTHnSparse {
98100
Configurable<float> etatrack{"etatrack", 1.0f, "Cut: Maximal value of tracks eta."};
99101
Configurable<float> dcaXY{"dcaXY", 1.0f, "Cut: Maximal value of tracks DCA XY."};
100102
Configurable<float> dcaZ{"dcaZ", 1.0f, "Cut: Maximal value of tracks DCA Z."};
103+
Configurable<bool> ptDependentDCA{"ptDependentDCA", false, "Use pT dependent DCA cut according to formula dcaXY = n_sigma * (0.0105 + 0.0350 * pow(pt, -1.1))."};
104+
Configurable<float> dcaNSigma{"dcaNSigma", 7.0f, "Cut: Maximal value of tracks DCA NSigma."};
101105
Configurable<float> tpcnSigmaPos{"tpcnSigmaPos", 10.0f, "Cut: Maximal value of TPC NSigma of the positive particle."};
102106
Configurable<float> tpcnSigmaNeg{"tpcnSigmaNeg", 10.0f, "Cut: Maximal value of TPC NSigma of the negative particle."};
103107
Configurable<bool> tpcPidOnly{"tpcPidOnly", false, "Use TPC only for PID."};
104108
Configurable<float> combinedNSigma{"combinedNSigma", 3.0f, "Cut: Maximal value of NSigma for combined TPC and TOF NSigma cut."};
105109
Configurable<float> ptTOFThreshold{"ptTOFThreshold", 0.5f, "Cut: Minimal value of tracks pt for using TOF PID."};
110+
Configurable<float> tofNSigmaPosShift{"tofNSigmaPosShift", 0.0f, "Shift of TOF NSigma of the positive particle."};
111+
Configurable<float> tofNSigmaNegShift{"tofNSigmaNegShift", 0.0f, "Shift of TOF NSigma of the negative particle."};
106112
Configurable<int> tpcNClsFound{"tpcNClsFound", 0, "Cut: Minimal value of found TPC clusters"};
107113
Configurable<int> tpcNClsCrossedRows{"tpcNClsCrossedRows", 0, "Cut: Minimal value of crossed rows in TPC"};
108114
Configurable<bool> globalTrack{"globalTrack", false, "Use isGlobalTrack track selection."};
@@ -111,6 +117,17 @@ struct PhianalysisTHnSparse {
111117
Configurable<float> rapidity{"rapidity", 0.5f, "Cut: Maximal value of particle rapidity."};
112118
} trackCuts;
113119

120+
struct : ConfigurableGroup {
121+
Configurable<bool> bcBorderCutsGen{"bcBorderCutsGen", false, "Use BC TF/ITS ROF border cuts on Gen events."};
122+
Configurable<bool> rctCheckGen{"rctCheckGen", false, "Use RCT flag cut on Gen events."};
123+
Configurable<std::string> rctCheckerLabel{"rctCheckerLabel", "CBT_hadronPID", "RCT flag checker label"};
124+
Configurable<bool> rctCheckerZDC{"rctCheckerZDC", false, "RCT flag checker ZDC check"};
125+
Configurable<bool> rctCheckerLimitAcceptAsBad{"rctCheckerLimitAcceptAsBad", false, "RCT flag checker treat Limited Acceptance As Bad"};
126+
127+
} mcCuts;
128+
129+
RCTFlagsChecker rctChecker;
130+
114131
Configurable<std::vector<std::string>> sparseAxes{"sparseAxes", std::vector<std::string>{o2::analysis::rsn::pair_axis::names}, "Axes."};
115132
Configurable<std::vector<std::string>> sysAxes{"sysAxes", std::vector<std::string>{o2::analysis::rsn::systematic_axis::names}, "Axes."};
116133

@@ -148,8 +165,8 @@ struct PhianalysisTHnSparse {
148165

149166
// Axes specifications
150167
AxisSpec vzQAaxis = {200, -20., 20., "V_{z} (cm)"};
151-
AxisSpec dcaXYQAaxis = {200, -0.5, 0.5, "DCA_{xy} (cm)"};
152-
AxisSpec dcaZQAaxis = {200, -0.5, 0.5, "DCA_{z} (cm)"};
168+
AxisSpec dcaXYQAaxis = {2000, -0.2, 0.2, "DCA_{xy} (cm)"};
169+
AxisSpec dcaZQAaxis = {2000, -0.2, 0.2, "DCA_{z} (cm)"};
153170
AxisSpec etaQAaxis = {200, -1.0, 1.0, "#eta"};
154171
AxisSpec rapidityQAaxis = {200, -1.0, 1.0, "y"};
155172
AxisSpec tpcNClsQAaxis = {200, 0., 200., "TPC NClusters"};
@@ -238,6 +255,8 @@ struct PhianalysisTHnSparse {
238255
rsnOutput = new o2::analysis::rsn::OutputSparse();
239256
rsnOutput->init(sparseAxes, allAxes, sysAxes, allAxesSys, static_cast<bool>(produce.produceMC), mixingType, static_cast<bool>(produce.produceLikesign), static_cast<bool>(produce.produceRotational), static_cast<bool>(eventCuts.inelGt0), &registry);
240257

258+
rctChecker.init(mcCuts.rctCheckerLabel, mcCuts.rctCheckerZDC, mcCuts.rctCheckerLimitAcceptAsBad, mcCuts.rctCheckGen);
259+
241260
// Print summary of configuration
242261
LOGF(info, "=== PhianalysisTHnSparse configuration summary ===");
243262
LOGF(info, "produceMC: %s", static_cast<bool>(produce.produceMC) ? "true" : "false");
@@ -261,6 +280,8 @@ struct PhianalysisTHnSparse {
261280
LOGF(info, "tpcPidOnly: %s", static_cast<bool>(trackCuts.tpcPidOnly) ? "true" : "false");
262281
LOGF(info, "combinedNSigma: %.2f", static_cast<float>(trackCuts.combinedNSigma));
263282
LOGF(info, "ptTOFThreshold: %.2f", static_cast<float>(trackCuts.ptTOFThreshold));
283+
LOGF(info, "tofNSigmaPosShift: %.2f", static_cast<float>(trackCuts.tofNSigmaPosShift));
284+
LOGF(info, "tofNSigmaNegShift: %.2f", static_cast<float>(trackCuts.tofNSigmaNegShift));
264285
LOGF(info, "tpcNClsFound: %d", static_cast<int>(trackCuts.tpcNClsFound));
265286
LOGF(info, "tpcNClsCrossedRows: %d", static_cast<int>(trackCuts.tpcNClsCrossedRows));
266287
LOGF(info, "globalTrack: %s", static_cast<bool>(trackCuts.globalTrack) ? "true" : "false");
@@ -446,24 +467,28 @@ struct PhianalysisTHnSparse {
446467

447468
// ----------------------- MC Corrections -----------------------
448469

449-
registry.add("QAMC/Gen/hNEvents", "Number of MC Gen Events", kTH1F, {{6, 0.0f, 6.0f}});
470+
registry.add("QAMC/Gen/hNEvents", "Number of MC Gen Events", kTH1F, {{8, 0.0f, 8.0f}});
450471
auto hNEventsGen = registry.get<TH1>(HIST("QAMC/Gen/hNEvents"));
451-
hNEventsGen->GetXaxis()->SetBinLabel(1, "all"); // All generated events
452-
hNEventsGen->GetXaxis()->SetBinLabel(2, "V_z cut"); // Generated events passing Vz cut
453-
hNEventsGen->GetXaxis()->SetBinLabel(3, "INEL"); // Generated events passing INEL cut
454-
hNEventsGen->GetXaxis()->SetBinLabel(4, "INEL>0"); // Passing INELgt0 cut --> EL numerator for INEL>0
455-
hNEventsGen->GetXaxis()->SetBinLabel(5, "ALORE INEL"); // Passing ALORE INEL cut
456-
hNEventsGen->GetXaxis()->SetBinLabel(6, "ALORE INEL>0"); // Passing ALORE INEL>0 cut
472+
hNEventsGen->GetXaxis()->SetBinLabel(1, "all"); // All generated events
473+
hNEventsGen->GetXaxis()->SetBinLabel(2, "V_z cut"); // Generated events passing Vz cut
474+
hNEventsGen->GetXaxis()->SetBinLabel(3, "BC TF/ITS ROF border"); // Passing BC TF/ITS ROF border cut
475+
hNEventsGen->GetXaxis()->SetBinLabel(4, "RCTFlagsChecker"); // Passing RCTFlagsChecker cut
476+
hNEventsGen->GetXaxis()->SetBinLabel(5, "INEL"); // Generated events passing INEL cut
477+
hNEventsGen->GetXaxis()->SetBinLabel(6, "INEL>0"); // Passing INELgt0 cut --> EL numerator for INEL>0
478+
hNEventsGen->GetXaxis()->SetBinLabel(7, "ALORE INEL"); // Passing ALORE INEL cut
479+
hNEventsGen->GetXaxis()->SetBinLabel(8, "ALORE INEL>0"); // Passing ALORE INEL>0 cut
457480
hNEventsGen->SetMinimum(0.1);
458481

459-
registry.add("QAMC/Gen/hNEventsCent", "Generated events", HistType::kTH2F, {centQAAxis, {6, 0, 6}});
482+
registry.add("QAMC/Gen/hNEventsCent", "Generated events", HistType::kTH2F, {centQAAxis, {8, 0, 8}});
460483
auto hNEventsGenCent = registry.get<TH2>(HIST("QAMC/Gen/hNEventsCent"));
461484
hNEventsGenCent->GetYaxis()->SetBinLabel(1, "all");
462485
hNEventsGenCent->GetYaxis()->SetBinLabel(2, "V_z cut");
463-
hNEventsGenCent->GetYaxis()->SetBinLabel(3, "INEL");
464-
hNEventsGenCent->GetYaxis()->SetBinLabel(4, "INEL>0");
465-
hNEventsGenCent->GetYaxis()->SetBinLabel(5, "ALORE INEL");
466-
hNEventsGenCent->GetYaxis()->SetBinLabel(6, "ALORE INEL>0");
486+
hNEventsGenCent->GetYaxis()->SetBinLabel(3, "BC TF/ITS ROF border");
487+
hNEventsGenCent->GetYaxis()->SetBinLabel(4, "RCTFlagsChecker");
488+
hNEventsGenCent->GetYaxis()->SetBinLabel(5, "INEL");
489+
hNEventsGenCent->GetYaxis()->SetBinLabel(6, "INEL>0");
490+
hNEventsGenCent->GetYaxis()->SetBinLabel(7, "ALORE INEL");
491+
hNEventsGenCent->GetYaxis()->SetBinLabel(8, "ALORE INEL>0");
467492

468493
registry.add("QAMC/Rec/hNEvents", "Number of MC Rec Events", kTH1F, {{3, 0.0f, 3.0f}});
469494
auto hNEventsRec = registry.get<TH1>(HIST("QAMC/Rec/hNEvents"));
@@ -600,13 +625,14 @@ struct PhianalysisTHnSparse {
600625
{
601626
float tofNsigma = 0.0f;
602627
int particleType = (track.sign() > 0) ? static_cast<int>(daughterPos) : static_cast<int>(daughterNeg);
628+
float tofNSigmaShift = (track.sign() > 0) ? static_cast<float>(trackCuts.tofNSigmaPosShift) : static_cast<float>(trackCuts.tofNSigmaNegShift);
603629

604630
if (particleType == pion) {
605-
tofNsigma = track.tofNSigmaPi();
631+
tofNsigma = track.tofNSigmaPi() + tofNSigmaShift;
606632
} else if (particleType == kaon) {
607-
tofNsigma = track.tofNSigmaKa();
633+
tofNsigma = track.tofNSigmaKa() + tofNSigmaShift;
608634
} else if (particleType == proton) {
609-
tofNsigma = track.tofNSigmaPr();
635+
tofNsigma = track.tofNSigmaPr() + tofNSigmaShift;
610636
}
611637
return tofNsigma;
612638
}
@@ -631,7 +657,13 @@ struct PhianalysisTHnSparse {
631657
registry.fill(HIST("QA/Track/hSelection"), 2.5);
632658
}
633659

634-
if (std::abs(track.dcaXY()) >= static_cast<float>(trackCuts.dcaXY) ||
660+
float dcaXY = static_cast<float>(trackCuts.dcaXY);
661+
if (static_cast<bool>(trackCuts.ptDependentDCA)) {
662+
double dcaNSigma = static_cast<double>(trackCuts.dcaNSigma);
663+
dcaXY = (dcaNSigma / 7) * (0.0105 + 0.0350 / std::pow(track.pt(), 1.1));
664+
}
665+
666+
if (std::abs(track.dcaXY()) >= dcaXY ||
635667
std::abs(track.dcaZ()) >= static_cast<float>(trackCuts.dcaZ)) {
636668
return false;
637669
}
@@ -731,6 +763,30 @@ struct PhianalysisTHnSparse {
731763
return pointPair;
732764
}
733765

766+
template <typename T>
767+
bool selectedGenEventBcBorderCuts(T const& bc)
768+
{
769+
if (!static_cast<bool>(mcCuts.bcBorderCutsGen)) {
770+
return true;
771+
}
772+
if (static_cast<bool>(eventCuts.noTimeFrameBorder) && !bc.selection_bit(aod::evsel::kNoTimeFrameBorder)) {
773+
return false;
774+
}
775+
if (static_cast<bool>(eventCuts.noITSROFrameBorder) && !bc.selection_bit(aod::evsel::kNoITSROFrameBorder)) {
776+
return false;
777+
}
778+
return true;
779+
}
780+
781+
template <typename TBC>
782+
bool selectedGenEventRCT(TBC const& bc)
783+
{
784+
if (!static_cast<bool>(mcCuts.rctCheckGen)) {
785+
return true;
786+
}
787+
return !static_cast<bool>(mcCuts.rctCheckGen) || rctChecker(bc);
788+
}
789+
734790
void processQA(EventCandidate const& collision, TrackCandidates const& tracks)
735791
{
736792
if (!static_cast<bool>(produce.produceQA)) {
@@ -1569,14 +1625,29 @@ struct PhianalysisTHnSparse {
15691625
registry.fill(HIST("QAMC/Gen/hNEvents"), 1.5);
15701626
registry.fill(HIST("QAMC/Gen/hNEventsCent"), mcCollision.centFT0M(), 1.5);
15711627

1628+
// Accepted generated border cuts
1629+
const auto bc = mcCollision.bc_as<soa::Join<aod::BCsWithTimestamps, aod::BcSels>>();
1630+
if (!selectedGenEventBcBorderCuts(bc)) {
1631+
return;
1632+
}
15721633
registry.fill(HIST("QAMC/Gen/hNEvents"), 2.5);
15731634
registry.fill(HIST("QAMC/Gen/hNEventsCent"), mcCollision.centFT0M(), 2.5);
15741635

1636+
// Accepted generated event RCT flags
1637+
if (!selectedGenEventRCT(bc)) {
1638+
return;
1639+
}
1640+
registry.fill(HIST("QAMC/Gen/hNEvents"), 3.5);
1641+
registry.fill(HIST("QAMC/Gen/hNEventsCent"), mcCollision.centFT0M(), 3.5);
1642+
1643+
registry.fill(HIST("QAMC/Gen/hNEvents"), 4.5);
1644+
registry.fill(HIST("QAMC/Gen/hNEventsCent"), mcCollision.centFT0M(), 4.5);
1645+
15751646
bool isINELgt0 = false;
15761647
if (pwglf::isINELgtNmc(mcParticles, 0, pdg)) {
15771648
isINELgt0 = true;
1578-
registry.fill(HIST("QAMC/Gen/hNEvents"), 3.5);
1579-
registry.fill(HIST("QAMC/Gen/hNEventsCent"), mcCollision.centFT0M(), 3.5); // Event Loss Denominator
1649+
registry.fill(HIST("QAMC/Gen/hNEvents"), 5.5);
1650+
registry.fill(HIST("QAMC/Gen/hNEventsCent"), mcCollision.centFT0M(), 5.5); // Event Loss Denominator
15801651
}
15811652

15821653
for (const auto& mcParticle : mcParticles) {
@@ -1641,12 +1712,12 @@ struct PhianalysisTHnSparse {
16411712
return;
16421713
}
16431714

1644-
registry.fill(HIST("QAMC/Gen/hNEvents"), 4.5);
1645-
registry.fill(HIST("QAMC/Gen/hNEventsCent"), mcCollision.centFT0M(), 4.5);
1715+
registry.fill(HIST("QAMC/Gen/hNEvents"), 6.5);
1716+
registry.fill(HIST("QAMC/Gen/hNEventsCent"), mcCollision.centFT0M(), 6.5);
16461717

16471718
if (nRecoInelGt0Coll > 0) {
1648-
registry.fill(HIST("QAMC/Gen/hNEvents"), 5.5);
1649-
registry.fill(HIST("QAMC/Gen/hNEventsCent"), mcCollision.centFT0M(), 5.5); // Event Loss Numerator
1719+
registry.fill(HIST("QAMC/Gen/hNEvents"), 7.5);
1720+
registry.fill(HIST("QAMC/Gen/hNEventsCent"), mcCollision.centFT0M(), 7.5); // Event Loss Numerator
16501721
}
16511722

16521723
for (const auto& mcParticle : mcParticles) {

0 commit comments

Comments
 (0)