Skip to content

Commit

Permalink
[PWGCF] Use global track selection (#8192)
Browse files Browse the repository at this point in the history
Co-authored-by: ALICE Action Bot <[email protected]>
  • Loading branch information
ilikmeta and alibuild authored Oct 29, 2024
1 parent d1642fb commit f531a63
Showing 1 changed file with 116 additions and 115 deletions.
231 changes: 116 additions & 115 deletions PWGCF/Flow/Tasks/FlowGFWPbPb.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,6 @@ using namespace o2::aod::evsel;

#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable<TYPE> NAME{#NAME, DEFAULT, HELP};

static constexpr TrackSelectionFlags::flagtype trackSelectionITS =
TrackSelectionFlags::kITSNCls | TrackSelectionFlags::kITSChi2NDF |
TrackSelectionFlags::kITSHits;
static constexpr TrackSelectionFlags::flagtype trackSelectionTPC =
TrackSelectionFlags::kTPCNCls |
TrackSelectionFlags::kTPCCrossedRowsOverNCls |
TrackSelectionFlags::kTPCChi2NDF;
static constexpr TrackSelectionFlags::flagtype trackSelectionDCA =
TrackSelectionFlags::kDCAz | TrackSelectionFlags::kDCAxy;
static constexpr TrackSelectionFlags::flagtype trackSelectionDCAXYonly =
TrackSelectionFlags::kDCAxy;

struct FlowGFWPbPb {

O2_DEFINE_CONFIGURABLE(cfgCutVertex, float, 10.0f, "Accepted z-vertex range")
Expand All @@ -64,8 +52,8 @@ struct FlowGFWPbPb {
O2_DEFINE_CONFIGURABLE(cfgCutEta, float, 0.8f, "Eta range for tracks")
O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5, "Chi2 per TPC clusters")
O2_DEFINE_CONFIGURABLE(cfgCutTPCclu, float, 70.0f, "minimum TPC clusters")
O2_DEFINE_CONFIGURABLE(cfgUseAdditionalEventCut, bool, false, "Use additional event cut on mult correlations")
O2_DEFINE_CONFIGURABLE(cfgUseAdditionalTrackCut, bool, false, "Use additional track cut on phi")
O2_DEFINE_CONFIGURABLE(cfgUseAdditionalEventCut, bool, true, "Use additional event cut on mult correlations")
O2_DEFINE_CONFIGURABLE(cfgUseAdditionalTrackCut, bool, true, "Use additional track cut on phi")
O2_DEFINE_CONFIGURABLE(cfgUseNch, bool, false, "Use Nch for flow observables")
O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 10, "Number of subsamples")
O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeights, bool, false, "Fill and output NUA weights")
Expand All @@ -74,10 +62,16 @@ struct FlowGFWPbPb {
O2_DEFINE_CONFIGURABLE(cfgMagnetField, std::string, "GLO/Config/GRPMagField", "CCDB path to Magnet field object")
O2_DEFINE_CONFIGURABLE(cfgCutOccupancyHigh, int, 500, "High cut on TPC occupancy")
O2_DEFINE_CONFIGURABLE(cfgCutOccupancyLow, int, 0, "Low cut on TPC occupancy")
O2_DEFINE_CONFIGURABLE(dcaZ, float, 0.2f, "Custom DCA Z cut (ignored if negative)")
O2_DEFINE_CONFIGURABLE(GlobalplusITS, bool, false, "Global and ITS tracks")
O2_DEFINE_CONFIGURABLE(Globalonly, bool, false, "Global only tracks")
O2_DEFINE_CONFIGURABLE(ITSonly, bool, false, "ITS only tracks")
O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2, "Custom DCA Z cut")
O2_DEFINE_CONFIGURABLE(cfgCutDCAxy, float, 0.2f, "Custom DCA XY cut")
O2_DEFINE_CONFIGURABLE(cfgTVXinTRD, bool, false, "Use kTVXinTRD (reject TRD triggered events)");
O2_DEFINE_CONFIGURABLE(cfgNoTimeFrameBorder, bool, false, "kNoTimeFrameBorder");
O2_DEFINE_CONFIGURABLE(cfgNoITSROFrameBorder, bool, false, "kNoITSROFrameBorder");
O2_DEFINE_CONFIGURABLE(cfgNoSameBunchPileup, bool, false, "kNoSameBunchPileup");
O2_DEFINE_CONFIGURABLE(cfgIsGoodZvtxFT0vsPV, bool, false, "kIsGoodZvtxFT0vsPV");
O2_DEFINE_CONFIGURABLE(cfgNoCollInTimeRangeStandard, bool, false, "kNoCollInTimeRangeStandard");
O2_DEFINE_CONFIGURABLE(cfgOccupancy, bool, false, "Bool for event selection on detector occupancy");
O2_DEFINE_CONFIGURABLE(cfgMultCut, bool, false, "Use additional event cut on mult correlations");

ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for histograms"};
ConfigurableAxis axisPhi{"axisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"};
Expand Down Expand Up @@ -147,11 +141,18 @@ struct FlowGFWPbPb {
ccdb->setCreatedNotAfter(nolaterthan.value);

// Add some output objects to the histogram registry
registry.add("hEventCount", "Number of Events;; No. of Events", {HistType::kTH1D, {{4, 0, 4}}});
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(1, "Filtered Events");
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(2, "After sel8");
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(3, "After additional event cut");
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(4, "After correction loads");
registry.add("hEventCount", "Number of Events;; No. of Events", {HistType::kTH1D, {{11, 0, 11}}});
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(1, "Filtered events");
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(2, "Sel8");
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(3, "Occupancy");
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(4, "kTVXinTRD");
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(5, "kNoTimeFrameBorder");
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(6, "kNoITSROFrameBorder");
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(7, "kNoSameBunchPileup");
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(8, "kIsGoodZvtxFT0vsPV");
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(9, "kNoCollInTimeRangeStandard");
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(10, "After Mult cuts");
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(11, "Centrality");
registry.add("hPhi", "#phi distribution", {HistType::kTH1D, {axisPhi}});
registry.add("hPhiWeighted", "corrected #phi distribution", {HistType::kTH1D, {axisPhi}});
registry.add("hEta", "", {HistType::kTH1D, {axisEta}});
Expand Down Expand Up @@ -179,13 +180,9 @@ struct FlowGFWPbPb {
registry.add("multT0C_centT0C_Aft", "after cut;Centrality T0C;mulplicity T0C", {HistType::kTH2D, {axisCentForQA, axisT0C}});

// Track types
registry.add("GlobalplusITS", "Global plus ITS;Centrality FT0C;No. of Events", kTH1F, {axisCentrality});
registry.add("Globalonly", "Global only;Centrality FT0C;No. of Events", kTH1F, {axisCentrality});
registry.add("ITSonly", "ITS only;Centrality FT0C;No. of Events", kTH1F, {axisCentrality});
registry.add("Global_Tracks", "Global Tracks;Centrality FT0C;No. of Events", kTH1F, {axisCentrality});
registry.add("Events_per_Centrality_Bin", "Events_per_Centrality_Bin;Centrality FT0C;No. of Events", kTH1F, {axisCentrality});
registry.add("GlobalplusITS_Nch_vs_Cent", "Global plus ITS;Centrality (%); M (|#eta| < 0.8);", {HistType::kTH2D, {axisCentrality, axisNch}});
registry.add("Globalonly_Nch_vs_Cent", "Global only;Centrality (%); M (|#eta| < 0.8);", {HistType::kTH2D, {axisCentrality, axisNch}});
registry.add("ITSonly_Nch_vs_Cent", "ITS only;Centrality (%); M (|#eta| < 0.8);", {HistType::kTH2D, {axisCentrality, axisNch}});
registry.add("Global_Tracks_Nch_vs_Cent", "Global Tracks;Centrality (%); M (|#eta| < 0.8);", {HistType::kTH2D, {axisCentrality, axisNch}});

// Track QA
registry.add("hPt", "p_{T} distribution before cut", {HistType::kTH1D, {axisPtHist}});
Expand Down Expand Up @@ -367,30 +364,53 @@ struct FlowGFWPbPb {
template <typename TCollision>
bool eventSelected(o2::aod::mult::MultNTracksPV, TCollision collision, const int multTrk, const float centrality)
{
if (collision.alias_bit(kTVXinTRD)) {
// TRD triggered
return false;
if (cfgTVXinTRD) {
if (collision.alias_bit(kTVXinTRD)) {
// TRD triggered
return false;
}
registry.fill(HIST("hEventCount"), 3.5);
}
if (!collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) {
// reject collisions close to Time Frame borders
// https://its.cern.ch/jira/browse/O2-4623
return false;
if (cfgNoTimeFrameBorder) {
if (!collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) {
// reject collisions close to Time Frame borders
// https://its.cern.ch/jira/browse/O2-4623
return false;
}
registry.fill(HIST("hEventCount"), 4.5);
}
if (!collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) {
// reject events affected by the ITS ROF border
// https://its.cern.ch/jira/browse/O2-4309
return false;
if (cfgNoITSROFrameBorder) {
if (!collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) {
// reject events affected by the ITS ROF border
// https://its.cern.ch/jira/browse/O2-4309
return false;
}
registry.fill(HIST("hEventCount"), 5.5);
}
if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) {
// rejects collisions which are associated with the same "found-by-T0" bunch crossing
// https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof
return false;
if (cfgNoSameBunchPileup) {
if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) {
// rejects collisions which are associated with the same "found-by-T0" bunch crossing
// https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof
return false;
}
registry.fill(HIST("hEventCount"), 6.5);
}
if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) {
// removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference
// use this cut at low multiplicities with caution
return false;
if (cfgIsGoodZvtxFT0vsPV) {
if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) {
// removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference
// use this cut at low multiplicities with caution
return false;
}
registry.fill(HIST("hEventCount"), 7.5);
}
if (cfgNoCollInTimeRangeStandard) {
if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) {
// no collisions in specified time range
return false;
}
registry.fill(HIST("hEventCount"), 8.5);
}

float vtxz = -999;
if (collision.numContrib() > 1) {
vtxz = collision.posZ();
Expand All @@ -400,22 +420,21 @@ struct FlowGFWPbPb {
}

auto multNTracksPV = collision.multNTracksPV();
auto occupancy = collision.trackOccupancyInTimeRange();

if (centrality >= 70. || centrality < 0)
return false;
if (abs(vtxz) > cfgCutVertex)
return false;
if (multNTracksPV < fMultPVCutLow->Eval(centrality))
return false;
if (multNTracksPV > fMultPVCutHigh->Eval(centrality))
return false;
if (multTrk < fMultCutLow->Eval(centrality))
return false;
if (multTrk > fMultCutHigh->Eval(centrality))
return false;
if (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh)
return false;

if (cfgMultCut) {
if (multNTracksPV < fMultPVCutLow->Eval(centrality))
return false;
if (multNTracksPV > fMultPVCutHigh->Eval(centrality))
return false;
if (multTrk < fMultCutLow->Eval(centrality))
return false;
if (multTrk > fMultCutHigh->Eval(centrality))
return false;
registry.fill(HIST("hEventCount"), 9.5);
}

// V0A T0A 5 sigma cut
if (abs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > 5 * fT0AV0ASigma->Eval(collision.multFT0A()))
Expand Down Expand Up @@ -460,13 +479,7 @@ struct FlowGFWPbPb {

// Apply process filters
Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
Filter trackFilter = ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) &&
ncheckbit(aod::track::trackCutFlag, trackSelectionITS) &&
ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC),
ncheckbit(aod::track::trackCutFlag, trackSelectionTPC), true) &&
ifnode(dcaZ.node() > 0.f, nabs(aod::track::dcaZ) <= dcaZ && ncheckbit(aod::track::trackCutFlag, trackSelectionDCAXYonly),
ncheckbit(aod::track::trackCutFlag, trackSelectionDCA)) &&
(nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax);
Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz) && (nabs(aod::track::dcaXY) < cfgCutDCAxy);

using Colls = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::MultsExtra, aod::CentFT0Cs>>; // collisions filter
using aodTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TrackSelection, aod::TracksDCA, aod::TracksExtra>>; // tracks filter
Expand All @@ -491,25 +504,33 @@ struct FlowGFWPbPb {
registry.fill(HIST("BeforeCut_multT0C_centT0C"), collision.centFT0C(), collision.multFT0C());
registry.fill(HIST("hEventCount"), 1.5);

const auto cent = collision.centFT0C();
const auto centrality = collision.centFT0C();

if (cfgUseAdditionalEventCut && !eventSelected(o2::aod::mult::MultNTracksPV(), collision, tracks.size(), cent)) {
if (cfgOccupancy) {
int occupancy = collision.trackOccupancyInTimeRange();
if (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh)
return;
registry.fill(HIST("hEventCount"), 2.5);
}

if (cfgUseAdditionalEventCut && !eventSelected(o2::aod::mult::MultNTracksPV(), collision, tracks.size(), centrality)) {
return;
}

registry.fill(HIST("hEventCount"), 2.5);
if (centrality < 0 || centrality >= 70.)
return;

float vtxz = collision.posZ();
float l_Random = fRndm->Rndm();
registry.fill(HIST("hVtxZ"), vtxz);
registry.fill(HIST("hMult"), Ntot);
registry.fill(HIST("hCent"), cent);
registry.fill(HIST("cent_vs_Nch"), cent, Ntot);
registry.fill(HIST("hCent"), centrality);
registry.fill(HIST("cent_vs_Nch"), centrality, Ntot);
fGFW->Clear();

auto bc = collision.bc_as<aod::BCsWithTimestamps>();
loadCorrections(bc.timestamp());
registry.fill(HIST("hEventCount"), 3.5);
registry.fill(HIST("hEventCount"), 10.5);

// fill event QA after cuts
registry.fill(HIST("globalTracks_centT0C_Aft"), collision.centFT0C(), tracks.size());
Expand All @@ -530,16 +551,16 @@ struct FlowGFWPbPb {
}

// track loop
int globalplusits_nch{0};
int gloabalonly_nch{0};
int itsonly_nch{0};
int globaltracks_nch{0};

for (auto& track : tracks) {

if (track.tpcNClsFound() < cfgCutTPCclu)
continue;
if (cfgUseAdditionalTrackCut && !trackSelected(track, Magnetfield))
continue;
if (cfgOutputNUAWeights)
fWeights->Fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0);
fWeights->Fill(track.phi(), track.eta(), vtxz, track.pt(), centrality, 0);
if (!setCurrentParticleWeights(weff, wacc, track.phi(), track.eta(), track.pt(), vtxz))
continue;

Expand All @@ -558,54 +579,34 @@ struct FlowGFWPbPb {
registry.fill(HIST("hDCAxy"), track.dcaXY(), track.pt());
}

globalplusits_nch++;
registry.fill(HIST("GlobalplusITS"), collision.centFT0C());
if (GlobalplusITS) {
if (WithinPtRef)
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 1);
}

if (track.hasTPC()) {
gloabalonly_nch++;
registry.fill(HIST("Globalonly"), collision.centFT0C());
if (Globalonly) {
if (WithinPtRef)
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 1);
}
} else {
itsonly_nch++;
registry.fill(HIST("ITSonly"), collision.centFT0C());
if (ITSonly) {
if (WithinPtRef)
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 1);
}
}
globaltracks_nch++;
registry.fill(HIST("Global_Tracks"), collision.centFT0C());
if (WithinPtRef)
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 1);

} // End of track loop

registry.fill(HIST("Events_per_Centrality_Bin"), cent);
registry.fill(HIST("GlobalplusITS_Nch_vs_Cent"), cent, globalplusits_nch);
registry.fill(HIST("Globalonly_Nch_vs_Cent"), cent, gloabalonly_nch);
registry.fill(HIST("ITSonly_Nch_vs_Cent"), cent, itsonly_nch);
registry.fill(HIST("Events_per_Centrality_Bin"), centrality);
registry.fill(HIST("Global_Tracks_Nch_vs_Cent"), centrality, globaltracks_nch);

// Filling c22 with ROOT TProfile
FillProfile(corrconfigs.at(0), HIST("c22"), cent);
FillProfile(corrconfigs.at(1), HIST("c24"), cent);
FillProfile(corrconfigs.at(2), HIST("c26"), cent);
FillProfile(corrconfigs.at(3), HIST("c28"), cent);
FillProfile(corrconfigs.at(4), HIST("c22etagap"), cent);
FillProfile(corrconfigs.at(0), HIST("c22"), centrality);
FillProfile(corrconfigs.at(1), HIST("c24"), centrality);
FillProfile(corrconfigs.at(2), HIST("c26"), centrality);
FillProfile(corrconfigs.at(3), HIST("c28"), centrality);
FillProfile(corrconfigs.at(4), HIST("c22etagap"), centrality);

// Filling Bootstrap Samples
int SampleIndex = static_cast<int>(cfgNbootstrap * l_Random);
FillProfile(corrconfigs.at(0), BootstrapArray[SampleIndex][kc22], cent);
FillProfile(corrconfigs.at(1), BootstrapArray[SampleIndex][kc24], cent);
FillProfile(corrconfigs.at(2), BootstrapArray[SampleIndex][kc26], cent);
FillProfile(corrconfigs.at(3), BootstrapArray[SampleIndex][kc28], cent);
FillProfile(corrconfigs.at(4), BootstrapArray[SampleIndex][kc22etagap], cent);
FillProfile(corrconfigs.at(0), BootstrapArray[SampleIndex][kc22], centrality);
FillProfile(corrconfigs.at(1), BootstrapArray[SampleIndex][kc24], centrality);
FillProfile(corrconfigs.at(2), BootstrapArray[SampleIndex][kc26], centrality);
FillProfile(corrconfigs.at(3), BootstrapArray[SampleIndex][kc28], centrality);
FillProfile(corrconfigs.at(4), BootstrapArray[SampleIndex][kc22etagap], centrality);

// Filling Flow Container
for (uint l_ind = 0; l_ind < corrconfigs.size(); l_ind++) {
FillFC(corrconfigs.at(l_ind), cent, l_Random);
FillFC(corrconfigs.at(l_ind), centrality, l_Random);
}

} // End of process
Expand Down

0 comments on commit f531a63

Please sign in to comment.