Skip to content

Commit d9e659c

Browse files
victor-gonzalezVictor
andauthored
[PWGCF] DptDpt -- Tracking the TPC sector borders (#9055)
Co-authored-by: Victor <victor@cern.ch>
1 parent 3c9dad0 commit d9e659c

File tree

4 files changed

+103
-50
lines changed

4 files changed

+103
-50
lines changed

PWGCF/TableProducer/dptdptfilter.cxx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,14 @@ struct DptDptFilter {
368368
Configurable<std::string> cfgTriggSel{"triggsel", "MB", "Trigger selection: MB,VTXTOFMATCHED,VTXTRDMATCHED,VTXTRDTOFMATCHED,None. Default MB"};
369369
Configurable<std::string> cfgCentSpec{"centralities", "00-10,10-20,20-30,30-40,40-50,50-60,60-70,70-80", "Centrality/multiplicity ranges in min-max separated by commas"};
370370
Configurable<float> cfgOverallMinP{"overallminp", 0.0f, "The overall minimum momentum for the analysis. Default: 0.0"};
371-
Configurable<int> cfgTpcExclusionMethod{"cfgTpcExclusionMethod", 0, "The method for excluding tracks within the TPC. 0: no exclusion; 1: static; 2: dynamic. Default: 0"};
371+
struct : ConfigurableGroup {
372+
std::string prefix = "cfgTpcExclusion";
373+
Configurable<int> method{"method", 0, "The method for excluding tracks within the TPC. 0: no exclusion; 1: static; 2: dynamic. Default: 0"};
374+
Configurable<std::string> positiveLowCut{"positiveLowCut", "0.0787/x - 0.0236", "The lower cut function for positive tracks"};
375+
Configurable<std::string> positiveUpCut{"positiveUpCut", "0.0892/x + 0.0251", "The upper cut function for positive tracks"};
376+
Configurable<std::string> negativeLowCut{"negativeLowCut", "pi/9.0 - (0.0892/x + 0.0251)", "The lower cut function for negative tracks"};
377+
Configurable<std::string> negativeUpCut{"negativeUpCut", "pi/9 - (0.0787/x - 0.0236)", "The upper cut function for negative tracks"};
378+
} cfgTpcExclusion;
372379
Configurable<o2::analysis::DptDptBinningCuts> cfgBinning{"binning",
373380
{28, -7.0, 7.0, 18, 0.2, 2.0, 16, -0.8, 0.8, 72, 0.5},
374381
"triplets - nbins, min, max - for z_vtx, pT, eta and phi, binning plus bin fraction of phi origin shift"};
@@ -807,9 +814,17 @@ struct DptDptFilterTracks {
807814
getTaskOptionValue(initContext, "dpt-dpt-filter", "binning.mPhibinshift", phibinshift, false);
808815

809816
TpcExclusionMethod tpcExclude = kNOEXCLUSION; ///< exclude tracks within the TPC according to this method
817+
std::string pLowCut;
818+
std::string pUpCut;
819+
std::string nLowCut;
820+
std::string nUpCut;
810821
{
811822
int tmpTpcExclude = 0;
812-
getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgTpcExclusionMethod", tmpTpcExclude, false);
823+
getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgTpcExclusion.method", tmpTpcExclude, false);
824+
getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgTpcExclusion.positiveLowCut", pLowCut, false);
825+
getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgTpcExclusion.positiveUpCut", pUpCut, false);
826+
getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgTpcExclusion.negativeLowCut", nLowCut, false);
827+
getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgTpcExclusion.negativeUpCut", nUpCut, false);
813828
tpcExclude = static_cast<TpcExclusionMethod>(tmpTpcExclude);
814829
}
815830
/* self configure the CCDB access to the input file */
@@ -828,6 +843,7 @@ struct DptDptFilterTracks {
828843

829844
/* the TPC excluder object instance */
830845
tpcExcluder = TpcExcludeTrack(tpcExclude);
846+
tpcExcluder.setCuts(pLowCut, pUpCut, nLowCut, nUpCut);
831847

832848
/* self configure system type and data type */
833849
/* if the system type is not known at this time, we have to put the initialization somewhere else */

PWGCF/TableProducer/dptdptfilter.h

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define PWGCF_TABLEPRODUCER_DPTDPTFILTER_H_
1818

1919
#include <CCDB/BasicCCDBManager.h>
20+
#include <TF1.h>
2021
#include <TList.h>
2122
#include <vector>
2223
#include <bitset>
@@ -1017,7 +1018,6 @@ struct TpcExcludeTrack {
10171018
}
10181019
break;
10191020
case kDYNAMIC:
1020-
LOGF(fatal, "Dynamic TPC exclusion method still not implemented");
10211021
method = m;
10221022
break;
10231023
default:
@@ -1040,6 +1040,9 @@ struct TpcExcludeTrack {
10401040
template <typename TrackObject>
10411041
bool exclude(TrackObject const& track)
10421042
{
1043+
constexpr int kNoOfTpcSectors = 18;
1044+
constexpr float kTpcPhiSectorWidth = (constants::math::TwoPI) / kNoOfTpcSectors;
1045+
10431046
switch (method) {
10441047
case kNOEXCLUSION: {
10451048
return false;
@@ -1054,15 +1057,33 @@ struct TpcExcludeTrack {
10541057
}
10551058
} break;
10561059
case kDYNAMIC: {
1057-
return false;
1060+
float phiInTpcSector = std::fmod(track.phi(), kTpcPhiSectorWidth);
1061+
if (track.sign() > 0) {
1062+
return (phiInTpcSector < positiveUpCut->Eval(track.pt())) && (positiveLowCut->Eval(track.pt()) < phiInTpcSector);
1063+
} else {
1064+
return (phiInTpcSector < negativeUpCut->Eval(track.pt())) && (negativeLowCut->Eval(track.pt()) < phiInTpcSector);
1065+
}
10581066
} break;
10591067
default:
10601068
return false;
10611069
}
10621070
}
10631071

1072+
void setCuts(std::string pLowCut, std::string pUpCut, std::string nLowCut, std::string nUpCut)
1073+
{
1074+
LOGF(info, "Setting the TPC exclusion cuts: pLow=%s, pUp=%s, nLow=%s, nUp=%s", pLowCut, pUpCut, nLowCut, nUpCut);
1075+
positiveLowCut = new TF1("posLowCut", pLowCut.c_str(), ptlow, ptup);
1076+
positiveUpCut = new TF1("posUpCut", pUpCut.c_str(), ptlow, ptup);
1077+
negativeLowCut = new TF1("negLowCut", nLowCut.c_str(), ptlow, ptup);
1078+
negativeUpCut = new TF1("negUpCut", nUpCut.c_str(), ptlow, ptup);
1079+
}
1080+
10641081
TpcExclusionMethod method = kNOEXCLUSION;
10651082
float phibinwidth = 0.0;
1083+
TF1* positiveLowCut = nullptr;
1084+
TF1* positiveUpCut = nullptr;
1085+
TF1* negativeLowCut = nullptr;
1086+
TF1* negativeUpCut = nullptr;
10661087
};
10671088

10681089
template <typename TrackObject>

PWGCF/Tasks/match-reco-gen.cxx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ struct CheckGeneratorLevelVsDetectorLevel {
6767
Configurable<o2::analysis::DptDptBinningCuts> cfgBinning{"binning",
6868
{28, -7.0, 7.0, 18, 0.2, 2.0, 16, -0.8, 0.8, 72, 0.5},
6969
"triplets - nbins, min, max - for z_vtx, pT, eta and phi, binning plus bin fraction of phi origin shift"};
70-
Configurable<int> cfgTpcExclusionMethod{"cfgTpcExclusionMethod", 0, "The method for excluding tracks within the TPC. 0: no exclusion; 1: static; 2: dynamic. Default: 0"};
70+
struct : ConfigurableGroup {
71+
std::string prefix = "cfgTpcExclusion";
72+
Configurable<int> method{"method", 0, "The method for excluding tracks within the TPC. 0: no exclusion; 1: static; 2: dynamic. Default: 0"};
73+
} cfgTpcExclusion;
7174
Configurable<o2::analysis::CheckRangeCfg> cfgTraceDCAOutliers{"trackdcaoutliers", {false, 0.0, 0.0}, "Track the generator level DCAxy outliers: false/true, low dcaxy, up dcaxy. Default {false,0.0,0.0}"};
7275
Configurable<float> cfgTraceOutOfSpeciesParticles{"trackoutparticles", false, "Track the particles which are not e,mu,pi,K,p: false/true. Default false"};
7376
Configurable<int> cfgRecoIdMethod{"recoidmethod", 0, "Method for identifying reconstructed tracks: 0 PID, 1 mcparticle. Default 0"};
@@ -107,7 +110,7 @@ struct CheckGeneratorLevelVsDetectorLevel {
107110

108111
/* the TPC excluder object instance */
109112
TpcExclusionMethod tpcExclude = kNOEXCLUSION; ///< exclude tracks within the TPC according to this method
110-
tpcExclude = static_cast<TpcExclusionMethod>(cfgTpcExclusionMethod.value);
113+
tpcExclude = static_cast<TpcExclusionMethod>(cfgTpcExclusion.method.value);
111114
tpcExcluder = TpcExcludeTrack(tpcExclude);
112115

113116
/* the track types and combinations */

PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx

Lines changed: 57 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -555,16 +555,16 @@ struct PidDataCollectingEngine {
555555
}
556556

557557
template <o2::track::PID::ID id, typename TrackObject>
558-
void fillAllSpeciesPID(uint ix, TrackObject const& track, float mom)
558+
void fillAllSpeciesPID(uint ix, TrackObject const& track, float tpcmom, float tofmom)
559559
{
560560
if (track.sign() < 0) {
561561
ix = 2 * ix + 1;
562562
} else {
563563
ix = 2 * ix;
564564
}
565565
for (uint when = 0; when < 2; ++when) {
566-
fhTPCnSigmasVsP[when][ix]->Fill(mom, o2::aod::pidutils::tpcNSigma<id>(track));
567-
fhTOFnSigmasVsP[when][ix]->Fill(mom, o2::aod::pidutils::tofNSigma<id>(track));
566+
fhTPCnSigmasVsP[when][ix]->Fill(tpcmom, o2::aod::pidutils::tpcNSigma<id>(track));
567+
fhTOFnSigmasVsP[when][ix]->Fill(tofmom, o2::aod::pidutils::tofNSigma<id>(track));
568568
if (track.trackacceptedid() < 0) {
569569
/* track not accepted */
570570
return;
@@ -573,17 +573,17 @@ struct PidDataCollectingEngine {
573573
}
574574

575575
template <o2::track::PID::ID id, typename TrackObject>
576-
void fillSpeciesPID(uint ix, TrackObject const& track, float mom)
576+
void fillSpeciesPID(uint ix, TrackObject const& track, float tpcmom, float tofmom)
577577
{
578578
if (track.sign() < 0) {
579579
ix = 2 * ix + 1;
580580
} else {
581581
ix = 2 * ix;
582582
}
583583
for (uint when = 0; when < 2; ++when) {
584-
fhTPCdEdxSignalDiffVsP[when][ix]->Fill(mom, o2::aod::pidutils::tpcExpSignalDiff<id>(track));
585-
fhTOFSignalDiffVsP[when][ix]->Fill(mom, o2::aod::pidutils::tofExpSignalDiff<id>(track));
586-
fhTPCTOFSigmaVsP[when][ix]->Fill(mom, o2::aod::pidutils::tpcNSigma<id>(track), o2::aod::pidutils::tofNSigma<id>(track));
584+
fhTPCdEdxSignalDiffVsP[when][ix]->Fill(tpcmom, o2::aod::pidutils::tpcExpSignalDiff<id>(track));
585+
fhTOFSignalDiffVsP[when][ix]->Fill(tofmom, o2::aod::pidutils::tofExpSignalDiff<id>(track));
586+
fhTPCTOFSigmaVsP[when][ix]->Fill(tpcmom, o2::aod::pidutils::tpcNSigma<id>(track), o2::aod::pidutils::tofNSigma<id>(track));
587587
if (track.trackacceptedid() < 0) {
588588
/* track not accepted */
589589
return;
@@ -592,12 +592,16 @@ struct PidDataCollectingEngine {
592592
}
593593

594594
template <typename TrackObject>
595-
void fillPID(TrackObject const& track, float mom)
595+
void fillPID(TrackObject const& track, float tpcmom, float tofmom)
596596
{
597597
for (uint when = 0; when < 2; ++when) {
598-
fhTPCdEdxSignalVsP[when]->Fill(mom, track.tpcSignal());
599-
fhTOFSignalVsP[when]->Fill(mom, track.beta());
600-
fhPvsTOFSqMass[when]->Fill(track.mass() * track.mass(), mom);
598+
if constexpr (framework::has_type_v<o2::aod::mcpidtpc::DeDxTunedMc, typename TrackObject::all_columns>) {
599+
fhTPCdEdxSignalVsP[when]->Fill(tpcmom, track.mcTunedTPCSignal());
600+
} else {
601+
fhTPCdEdxSignalVsP[when]->Fill(tpcmom, track.tpcSignal());
602+
}
603+
fhTOFSignalVsP[when]->Fill(tofmom, track.beta());
604+
fhPvsTOFSqMass[when]->Fill(track.mass() * track.mass(), tofmom);
601605
if (track.trackacceptedid() < 0) {
602606
/* track not accepted */
603607
return;
@@ -606,20 +610,20 @@ struct PidDataCollectingEngine {
606610
}
607611

608612
template <efficiencyandqatask::KindOfData kindOfData, typename TrackObject>
609-
void processTrack(TrackObject const& track, float mom)
613+
void processTrack(TrackObject const& track, float tpcmom, float tofmom)
610614
{
611615
using namespace efficiencyandqatask;
612616

613617
if constexpr (kindOfData == kReco) {
614-
fillPID(track, mom);
615-
fillSpeciesPID<o2::track::PID::Pion>(0, track, mom);
616-
fillSpeciesPID<o2::track::PID::Kaon>(1, track, mom);
617-
fillSpeciesPID<o2::track::PID::Proton>(2, track, mom);
618-
fillAllSpeciesPID<o2::track::PID::Electron>(0, track, mom);
619-
fillAllSpeciesPID<o2::track::PID::Muon>(1, track, mom);
620-
fillAllSpeciesPID<o2::track::PID::Pion>(2, track, mom);
621-
fillAllSpeciesPID<o2::track::PID::Kaon>(3, track, mom);
622-
fillAllSpeciesPID<o2::track::PID::Proton>(4, track, mom);
618+
fillPID(track, tpcmom, tofmom);
619+
fillSpeciesPID<o2::track::PID::Pion>(0, track, tpcmom, tofmom);
620+
fillSpeciesPID<o2::track::PID::Kaon>(1, track, tpcmom, tofmom);
621+
fillSpeciesPID<o2::track::PID::Proton>(2, track, tpcmom, tofmom);
622+
fillAllSpeciesPID<o2::track::PID::Electron>(0, track, tpcmom, tofmom);
623+
fillAllSpeciesPID<o2::track::PID::Muon>(1, track, tpcmom, tofmom);
624+
fillAllSpeciesPID<o2::track::PID::Pion>(2, track, tpcmom, tofmom);
625+
fillAllSpeciesPID<o2::track::PID::Kaon>(3, track, tpcmom, tofmom);
626+
fillAllSpeciesPID<o2::track::PID::Proton>(4, track, tpcmom, tofmom);
623627
}
624628
}
625629
};
@@ -688,7 +692,7 @@ struct PidExtraDataCollectingEngine {
688692
}
689693

690694
template <o2::track::PID::ID id, typename TrackObject>
691-
void fillAllSpeciesPID(uint ix, TrackObject const& track, float mom)
695+
void fillAllSpeciesPID(uint ix, TrackObject const& track, float tpcmom, float tofmom)
692696
{
693697
if (track.trackacceptedid() < 0) {
694698
/* track not accepted */
@@ -699,46 +703,54 @@ struct PidExtraDataCollectingEngine {
699703
} else {
700704
ix = 2 * ix;
701705
}
702-
fhIdTPCnSigmasVsP[track.trackacceptedid()][ix]->Fill(mom, o2::aod::pidutils::tpcNSigma<id>(track));
703-
fhIdTOFnSigmasVsP[track.trackacceptedid()][ix]->Fill(mom, o2::aod::pidutils::tofNSigma<id>(track));
706+
fhIdTPCnSigmasVsP[track.trackacceptedid()][ix]->Fill(tpcmom, o2::aod::pidutils::tpcNSigma<id>(track));
707+
fhIdTOFnSigmasVsP[track.trackacceptedid()][ix]->Fill(tofmom, o2::aod::pidutils::tofNSigma<id>(track));
704708
if (efficiencyandqatask::pidselector.isGlobalSpecies(track.trackacceptedid() / 2, id)) {
705709
/* only if the species of the selected track matches the target of the number of sigmas */
706-
fpIdTPCdEdxSignalVsPSigmas[track.trackacceptedid()]->Fill(mom, track.tpcSignal(), o2::aod::pidutils::tpcNSigma<id>(track));
707-
fpIdTOFSignalVsPSigmas[track.trackacceptedid()]->Fill(mom, track.beta(), o2::aod::pidutils::tofNSigma<id>(track));
710+
if constexpr (framework::has_type_v<o2::aod::mcpidtpc::DeDxTunedMc, typename TrackObject::all_columns>) {
711+
fpIdTPCdEdxSignalVsPSigmas[track.trackacceptedid()]->Fill(tpcmom, track.mcTunedTPCSignal(), o2::aod::pidutils::tpcNSigma<id>(track));
712+
} else {
713+
fpIdTPCdEdxSignalVsPSigmas[track.trackacceptedid()]->Fill(tpcmom, track.tpcSignal(), o2::aod::pidutils::tpcNSigma<id>(track));
714+
}
715+
fpIdTOFSignalVsPSigmas[track.trackacceptedid()]->Fill(tofmom, track.beta(), o2::aod::pidutils::tofNSigma<id>(track));
708716
}
709717
}
710718

711719
template <o2::track::PID::ID id, typename TrackObject>
712-
void fillSpeciesPID(uint, TrackObject const&, float)
720+
void fillSpeciesPID(uint, TrackObject const&, float, float)
713721
{
714722
}
715723

716724
template <typename TrackObject>
717-
void fillPID(TrackObject const& track, float mom)
725+
void fillPID(TrackObject const& track, float tpcmom, float tofmom)
718726
{
719727
if (track.trackacceptedid() < 0) {
720728
/* track not accepted */
721729
return;
722730
}
723-
fhIdTPCdEdxSignalVsP[track.trackacceptedid()]->Fill(mom, track.tpcSignal());
724-
fhIdTOFSignalVsP[track.trackacceptedid()]->Fill(mom, track.beta());
731+
if constexpr (framework::has_type_v<o2::aod::mcpidtpc::DeDxTunedMc, typename TrackObject::all_columns>) {
732+
fhIdTPCdEdxSignalVsP[track.trackacceptedid()]->Fill(tpcmom, track.mcTunedTPCSignal());
733+
} else {
734+
fhIdTPCdEdxSignalVsP[track.trackacceptedid()]->Fill(tpcmom, track.tpcSignal());
735+
}
736+
fhIdTOFSignalVsP[track.trackacceptedid()]->Fill(tofmom, track.beta());
725737
}
726738

727739
template <efficiencyandqatask::KindOfData kindOfData, typename TrackObject>
728-
void processTrack(TrackObject const& track, float mom)
740+
void processTrack(TrackObject const& track, float tpcmom, float tofmom)
729741
{
730742
using namespace efficiencyandqatask;
731743

732744
if constexpr (kindOfData == kReco) {
733-
fillPID(track, mom);
734-
fillSpeciesPID<o2::track::PID::Pion>(0, track, mom);
735-
fillSpeciesPID<o2::track::PID::Kaon>(1, track, mom);
736-
fillSpeciesPID<o2::track::PID::Proton>(2, track, mom);
737-
fillAllSpeciesPID<o2::track::PID::Electron>(0, track, mom);
738-
fillAllSpeciesPID<o2::track::PID::Muon>(1, track, mom);
739-
fillAllSpeciesPID<o2::track::PID::Pion>(2, track, mom);
740-
fillAllSpeciesPID<o2::track::PID::Kaon>(3, track, mom);
741-
fillAllSpeciesPID<o2::track::PID::Proton>(4, track, mom);
745+
fillPID(track, tpcmom, tofmom);
746+
fillSpeciesPID<o2::track::PID::Pion>(0, track, tpcmom, tofmom);
747+
fillSpeciesPID<o2::track::PID::Kaon>(1, track, tpcmom, tofmom);
748+
fillSpeciesPID<o2::track::PID::Proton>(2, track, tpcmom, tofmom);
749+
fillAllSpeciesPID<o2::track::PID::Electron>(0, track, tpcmom, tofmom);
750+
fillAllSpeciesPID<o2::track::PID::Muon>(1, track, tpcmom, tofmom);
751+
fillAllSpeciesPID<o2::track::PID::Pion>(2, track, tpcmom, tofmom);
752+
fillAllSpeciesPID<o2::track::PID::Kaon>(3, track, tpcmom, tofmom);
753+
fillAllSpeciesPID<o2::track::PID::Proton>(4, track, tpcmom, tofmom);
742754
}
743755
}
744756
};
@@ -973,20 +985,21 @@ struct DptDptEfficiencyAndQc {
973985
int ixDCE = getDCEindex(collision);
974986
if (!(ixDCE < 0)) {
975987
for (auto const& track : tracks) {
976-
float mom = track.p();
988+
float tpcmom = track.p();
989+
float tofmom = track.p();
977990
if (useTPCInnerWallMomentum.value) {
978991
if constexpr (!framework::has_type_v<aod::mcparticle::PdgCode, typename PassedTracks::iterator::all_columns>) {
979-
mom = track.tpcInnerParam();
992+
tpcmom = track.tpcInnerParam();
980993
}
981994
}
982995
if constexpr (kindOfProcess == kBASIC) {
983996
qaDataCE[ixDCE]->processTrack<kindOfData, FilteredCollisions>(collision.posZ(), track);
984997
}
985998
if constexpr (kindOfProcess == kPID) {
986-
pidDataCE[ixDCE]->processTrack<kindOfData>(track, mom);
999+
pidDataCE[ixDCE]->processTrack<kindOfData>(track, tpcmom, tofmom);
9871000
}
9881001
if constexpr (kindOfProcess == kPIDEXTRA) {
989-
pidExtraDataCE[ixDCE]->processTrack<kindOfData>(track, mom);
1002+
pidExtraDataCE[ixDCE]->processTrack<kindOfData>(track, tpcmom, tofmom);
9901003
}
9911004
}
9921005
}

0 commit comments

Comments
 (0)