Skip to content

Commit 3f0f1ec

Browse files
authored
[PWGCF] add TPCsectorOverlap check on request (#12735)
1 parent b454fe9 commit 3f0f1ec

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

PWGCF/Flow/Tasks/flowTask.cxx

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "Framework/RunningWorkflowInfo.h"
3737
#include "Framework/runDataProcessing.h"
3838
#include <CCDB/BasicCCDBManager.h>
39+
#include <DataFormatsParameters/GRPMagField.h>
3940

4041
#include "TList.h"
4142
#include <TF1.h>
@@ -141,6 +142,13 @@ struct FlowTask {
141142
TF1* fMultMultV0ACutHigh = nullptr;
142143
TF1* fT0AV0AMean = nullptr;
143144
TF1* fT0AV0ASigma = nullptr;
145+
// for TPC sector boundary
146+
O2_DEFINE_CONFIGURABLE(cfgShowTPCsectorOverlap, bool, true, "Draw TPC sector overlap")
147+
O2_DEFINE_CONFIGURABLE(cfgRejectionTPCsectorOverlap, bool, false, "rejection for TPC sector overlap")
148+
O2_DEFINE_CONFIGURABLE(cfgMagnetField, std::string, "GLO/Config/GRPMagField", "CCDB path to Magnet field object")
149+
ConfigurableAxis axisPhiMod{"axisPhiMod", {100, 0, constants::math::PI / 9}, "fmod(#varphi,#pi/9)"};
150+
TF1* fPhiCutLow = nullptr;
151+
TF1* fPhiCutHigh = nullptr;
144152
} cfgFuncParas;
145153

146154
ConfigurableAxis axisPtHist{"axisPtHist", {100, 0., 10.}, "pt axis for histograms"};
@@ -283,6 +291,8 @@ struct FlowTask {
283291
registry.add("hEta", "#eta distribution", {HistType::kTH1D, {axisEta}});
284292
registry.add("hPt", "p_{T} distribution before cut", {HistType::kTH1D, {axisPtHist}});
285293
registry.add("hPtRef", "p_{T} distribution after cut", {HistType::kTH1D, {axisPtHist}});
294+
registry.add("pt_phi_bef", "before cut;p_{T};#phi_{modn}", {HistType::kTH2D, {axisPt, cfgFuncParas.axisPhiMod}});
295+
registry.add("pt_phi_aft", "after cut;p_{T};#phi_{modn}", {HistType::kTH2D, {axisPt, cfgFuncParas.axisPhiMod}});
286296
registry.add("hChi2prTPCcls", "#chi^{2}/cluster for the TPC track segment", {HistType::kTH1D, {{100, 0., 5.}}});
287297
registry.add("hChi2prITScls", "#chi^{2}/cluster for the ITS track", {HistType::kTH1D, {{100, 0., 50.}}});
288298
registry.add("hnTPCClu", "Number of found TPC clusters", {HistType::kTH1D, {{100, 40, 180}}});
@@ -501,6 +511,11 @@ struct FlowTask {
501511
cfgFuncParas.fT0AV0ASigma->SetParameters(463.4144, 6.796509e-02, -9.097136e-07, 7.971088e-12, -2.600581e-17);
502512
}
503513

514+
if (cfgFuncParas.cfgShowTPCsectorOverlap) {
515+
cfgFuncParas.fPhiCutLow = new TF1("fPhiCutLow", "0.06/x+pi/18.0-0.06", 0, 100);
516+
cfgFuncParas.fPhiCutHigh = new TF1("fPhiCutHigh", "0.1/x+pi/18.0+0.06", 0, 100);
517+
}
518+
504519
if (cfgTrackDensityCorrUse) {
505520
std::vector<double> pTEffBins = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.4, 1.8, 2.2, 2.6, 3.0};
506521
hFindPtBin = new TH1D("hFindPtBin", "hFindPtBin", pTEffBins.size() - 1, &pTEffBins[0]);
@@ -730,12 +745,49 @@ struct FlowTask {
730745
return 1;
731746
}
732747

748+
int getMagneticField(uint64_t timestamp)
749+
{
750+
static o2::parameters::GRPMagField* grpo = nullptr;
751+
if (grpo == nullptr) {
752+
grpo = ccdb->getForTimeStamp<o2::parameters::GRPMagField>(cfgFuncParas.cfgMagnetField, timestamp);
753+
if (grpo == nullptr) {
754+
LOGF(fatal, "GRP object not found in %s for timestamp %llu", cfgFuncParas.cfgMagnetField.value.c_str(), timestamp);
755+
return 0;
756+
}
757+
LOGF(info, "Retrieved GRP from %s for timestamp %llu with magnetic field of %d kG", cfgFuncParas.cfgMagnetField.value.c_str(), timestamp, grpo->getNominalL3Field());
758+
}
759+
return grpo->getNominalL3Field();
760+
}
761+
733762
template <typename TTrack>
734763
bool trackSelected(TTrack track)
735764
{
736765
return ((track.tpcNClsFound() >= cfgCutTPCclu) && (track.tpcNClsCrossedRows() >= cfgCutTPCCrossedRows) && (track.itsNCls() >= cfgCutITSclu));
737766
}
738767

768+
template <typename TTrack>
769+
bool rejectionTPCoverlap(TTrack track, const int field)
770+
{
771+
double phimodn = track.phi();
772+
if (field < 0) // for negative polarity field
773+
phimodn = o2::constants::math::TwoPI - phimodn;
774+
if (track.sign() < 0) // for negative charge
775+
phimodn = o2::constants::math::TwoPI - phimodn;
776+
if (phimodn < 0)
777+
LOGF(warning, "phi < 0: %g", phimodn);
778+
779+
float middle = o2::constants::math::TwoPI / 18.0;
780+
phimodn += middle; // to center gap in the middle
781+
phimodn = fmod(phimodn, o2::constants::math::TwoPI / 9.0);
782+
registry.fill(HIST("pt_phi_bef"), track.pt(), phimodn);
783+
if (cfgFuncParas.cfgRejectionTPCsectorOverlap) {
784+
if (phimodn < cfgFuncParas.fPhiCutHigh->Eval(track.pt()) && phimodn > cfgFuncParas.fPhiCutLow->Eval(track.pt()))
785+
return false; // reject track
786+
}
787+
registry.fill(HIST("pt_phi_aft"), track.pt(), phimodn);
788+
return true;
789+
}
790+
739791
void initHadronicRate(aod::BCsWithTimestamps::iterator const& bc)
740792
{
741793
if (mRunNumber == bc.runNumber()) {
@@ -844,9 +896,14 @@ struct FlowTask {
844896
// track weights
845897
float weff = 1, wacc = 1;
846898
double nTracksCorrected = 0;
899+
int magnetfield = 0;
847900
float independent = cent;
848901
if (cfgUseNch)
849902
independent = static_cast<float>(tracks.size());
903+
if (cfgFuncParas.cfgShowTPCsectorOverlap) {
904+
// magnet field dependence cut
905+
magnetfield = getMagneticField(bc.timestamp());
906+
}
850907

851908
double psi2Est = 0, psi3Est = 0, psi4Est = 0;
852909
float wEPeff = 1;
@@ -879,6 +936,8 @@ struct FlowTask {
879936
for (const auto& track : tracks) {
880937
if (!trackSelected(track))
881938
continue;
939+
if (cfgFuncParas.cfgShowTPCsectorOverlap && !rejectionTPCoverlap(track, magnetfield))
940+
continue;
882941
bool withinPtPOI = (cfgCutPtPOIMin < track.pt()) && (track.pt() < cfgCutPtPOIMax); // within POI pT range
883942
bool withinPtRef = (cfgCutPtRefMin < track.pt()) && (track.pt() < cfgCutPtRefMax); // within RF pT range
884943
if (cfgOutputNUAWeights) {

0 commit comments

Comments
 (0)