Skip to content

Commit

Permalink
[PWGCF] DptDpt -- Tracking the TPC sector borders (#9055)
Browse files Browse the repository at this point in the history
Co-authored-by: Victor <[email protected]>
  • Loading branch information
victor-gonzalez and Victor authored Dec 19, 2024
1 parent 3c9dad0 commit d9e659c
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 50 deletions.
20 changes: 18 additions & 2 deletions PWGCF/TableProducer/dptdptfilter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,14 @@ struct DptDptFilter {
Configurable<std::string> cfgTriggSel{"triggsel", "MB", "Trigger selection: MB,VTXTOFMATCHED,VTXTRDMATCHED,VTXTRDTOFMATCHED,None. Default MB"};
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"};
Configurable<float> cfgOverallMinP{"overallminp", 0.0f, "The overall minimum momentum for the analysis. Default: 0.0"};
Configurable<int> cfgTpcExclusionMethod{"cfgTpcExclusionMethod", 0, "The method for excluding tracks within the TPC. 0: no exclusion; 1: static; 2: dynamic. Default: 0"};
struct : ConfigurableGroup {
std::string prefix = "cfgTpcExclusion";
Configurable<int> method{"method", 0, "The method for excluding tracks within the TPC. 0: no exclusion; 1: static; 2: dynamic. Default: 0"};
Configurable<std::string> positiveLowCut{"positiveLowCut", "0.0787/x - 0.0236", "The lower cut function for positive tracks"};
Configurable<std::string> positiveUpCut{"positiveUpCut", "0.0892/x + 0.0251", "The upper cut function for positive tracks"};
Configurable<std::string> negativeLowCut{"negativeLowCut", "pi/9.0 - (0.0892/x + 0.0251)", "The lower cut function for negative tracks"};
Configurable<std::string> negativeUpCut{"negativeUpCut", "pi/9 - (0.0787/x - 0.0236)", "The upper cut function for negative tracks"};
} cfgTpcExclusion;
Configurable<o2::analysis::DptDptBinningCuts> cfgBinning{"binning",
{28, -7.0, 7.0, 18, 0.2, 2.0, 16, -0.8, 0.8, 72, 0.5},
"triplets - nbins, min, max - for z_vtx, pT, eta and phi, binning plus bin fraction of phi origin shift"};
Expand Down Expand Up @@ -807,9 +814,17 @@ struct DptDptFilterTracks {
getTaskOptionValue(initContext, "dpt-dpt-filter", "binning.mPhibinshift", phibinshift, false);

TpcExclusionMethod tpcExclude = kNOEXCLUSION; ///< exclude tracks within the TPC according to this method
std::string pLowCut;
std::string pUpCut;
std::string nLowCut;
std::string nUpCut;
{
int tmpTpcExclude = 0;
getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgTpcExclusionMethod", tmpTpcExclude, false);
getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgTpcExclusion.method", tmpTpcExclude, false);
getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgTpcExclusion.positiveLowCut", pLowCut, false);
getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgTpcExclusion.positiveUpCut", pUpCut, false);
getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgTpcExclusion.negativeLowCut", nLowCut, false);
getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgTpcExclusion.negativeUpCut", nUpCut, false);
tpcExclude = static_cast<TpcExclusionMethod>(tmpTpcExclude);
}
/* self configure the CCDB access to the input file */
Expand All @@ -828,6 +843,7 @@ struct DptDptFilterTracks {

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

/* self configure system type and data type */
/* if the system type is not known at this time, we have to put the initialization somewhere else */
Expand Down
25 changes: 23 additions & 2 deletions PWGCF/TableProducer/dptdptfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define PWGCF_TABLEPRODUCER_DPTDPTFILTER_H_

#include <CCDB/BasicCCDBManager.h>
#include <TF1.h>
#include <TList.h>
#include <vector>
#include <bitset>
Expand Down Expand Up @@ -1017,7 +1018,6 @@ struct TpcExcludeTrack {
}
break;
case kDYNAMIC:
LOGF(fatal, "Dynamic TPC exclusion method still not implemented");
method = m;
break;
default:
Expand All @@ -1040,6 +1040,9 @@ struct TpcExcludeTrack {
template <typename TrackObject>
bool exclude(TrackObject const& track)
{
constexpr int kNoOfTpcSectors = 18;
constexpr float kTpcPhiSectorWidth = (constants::math::TwoPI) / kNoOfTpcSectors;

switch (method) {
case kNOEXCLUSION: {
return false;
Expand All @@ -1054,15 +1057,33 @@ struct TpcExcludeTrack {
}
} break;
case kDYNAMIC: {
return false;
float phiInTpcSector = std::fmod(track.phi(), kTpcPhiSectorWidth);
if (track.sign() > 0) {
return (phiInTpcSector < positiveUpCut->Eval(track.pt())) && (positiveLowCut->Eval(track.pt()) < phiInTpcSector);
} else {
return (phiInTpcSector < negativeUpCut->Eval(track.pt())) && (negativeLowCut->Eval(track.pt()) < phiInTpcSector);
}
} break;
default:
return false;
}
}

void setCuts(std::string pLowCut, std::string pUpCut, std::string nLowCut, std::string nUpCut)
{
LOGF(info, "Setting the TPC exclusion cuts: pLow=%s, pUp=%s, nLow=%s, nUp=%s", pLowCut, pUpCut, nLowCut, nUpCut);
positiveLowCut = new TF1("posLowCut", pLowCut.c_str(), ptlow, ptup);
positiveUpCut = new TF1("posUpCut", pUpCut.c_str(), ptlow, ptup);
negativeLowCut = new TF1("negLowCut", nLowCut.c_str(), ptlow, ptup);
negativeUpCut = new TF1("negUpCut", nUpCut.c_str(), ptlow, ptup);
}

TpcExclusionMethod method = kNOEXCLUSION;
float phibinwidth = 0.0;
TF1* positiveLowCut = nullptr;
TF1* positiveUpCut = nullptr;
TF1* negativeLowCut = nullptr;
TF1* negativeUpCut = nullptr;
};

template <typename TrackObject>
Expand Down
7 changes: 5 additions & 2 deletions PWGCF/Tasks/match-reco-gen.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ struct CheckGeneratorLevelVsDetectorLevel {
Configurable<o2::analysis::DptDptBinningCuts> cfgBinning{"binning",
{28, -7.0, 7.0, 18, 0.2, 2.0, 16, -0.8, 0.8, 72, 0.5},
"triplets - nbins, min, max - for z_vtx, pT, eta and phi, binning plus bin fraction of phi origin shift"};
Configurable<int> cfgTpcExclusionMethod{"cfgTpcExclusionMethod", 0, "The method for excluding tracks within the TPC. 0: no exclusion; 1: static; 2: dynamic. Default: 0"};
struct : ConfigurableGroup {
std::string prefix = "cfgTpcExclusion";
Configurable<int> method{"method", 0, "The method for excluding tracks within the TPC. 0: no exclusion; 1: static; 2: dynamic. Default: 0"};
} cfgTpcExclusion;
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}"};
Configurable<float> cfgTraceOutOfSpeciesParticles{"trackoutparticles", false, "Track the particles which are not e,mu,pi,K,p: false/true. Default false"};
Configurable<int> cfgRecoIdMethod{"recoidmethod", 0, "Method for identifying reconstructed tracks: 0 PID, 1 mcparticle. Default 0"};
Expand Down Expand Up @@ -107,7 +110,7 @@ struct CheckGeneratorLevelVsDetectorLevel {

/* the TPC excluder object instance */
TpcExclusionMethod tpcExclude = kNOEXCLUSION; ///< exclude tracks within the TPC according to this method
tpcExclude = static_cast<TpcExclusionMethod>(cfgTpcExclusionMethod.value);
tpcExclude = static_cast<TpcExclusionMethod>(cfgTpcExclusion.method.value);
tpcExcluder = TpcExcludeTrack(tpcExclude);

/* the track types and combinations */
Expand Down
101 changes: 57 additions & 44 deletions PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -555,16 +555,16 @@ struct PidDataCollectingEngine {
}

template <o2::track::PID::ID id, typename TrackObject>
void fillAllSpeciesPID(uint ix, TrackObject const& track, float mom)
void fillAllSpeciesPID(uint ix, TrackObject const& track, float tpcmom, float tofmom)
{
if (track.sign() < 0) {
ix = 2 * ix + 1;
} else {
ix = 2 * ix;
}
for (uint when = 0; when < 2; ++when) {
fhTPCnSigmasVsP[when][ix]->Fill(mom, o2::aod::pidutils::tpcNSigma<id>(track));
fhTOFnSigmasVsP[when][ix]->Fill(mom, o2::aod::pidutils::tofNSigma<id>(track));
fhTPCnSigmasVsP[when][ix]->Fill(tpcmom, o2::aod::pidutils::tpcNSigma<id>(track));
fhTOFnSigmasVsP[when][ix]->Fill(tofmom, o2::aod::pidutils::tofNSigma<id>(track));
if (track.trackacceptedid() < 0) {
/* track not accepted */
return;
Expand All @@ -573,17 +573,17 @@ struct PidDataCollectingEngine {
}

template <o2::track::PID::ID id, typename TrackObject>
void fillSpeciesPID(uint ix, TrackObject const& track, float mom)
void fillSpeciesPID(uint ix, TrackObject const& track, float tpcmom, float tofmom)
{
if (track.sign() < 0) {
ix = 2 * ix + 1;
} else {
ix = 2 * ix;
}
for (uint when = 0; when < 2; ++when) {
fhTPCdEdxSignalDiffVsP[when][ix]->Fill(mom, o2::aod::pidutils::tpcExpSignalDiff<id>(track));
fhTOFSignalDiffVsP[when][ix]->Fill(mom, o2::aod::pidutils::tofExpSignalDiff<id>(track));
fhTPCTOFSigmaVsP[when][ix]->Fill(mom, o2::aod::pidutils::tpcNSigma<id>(track), o2::aod::pidutils::tofNSigma<id>(track));
fhTPCdEdxSignalDiffVsP[when][ix]->Fill(tpcmom, o2::aod::pidutils::tpcExpSignalDiff<id>(track));
fhTOFSignalDiffVsP[when][ix]->Fill(tofmom, o2::aod::pidutils::tofExpSignalDiff<id>(track));
fhTPCTOFSigmaVsP[when][ix]->Fill(tpcmom, o2::aod::pidutils::tpcNSigma<id>(track), o2::aod::pidutils::tofNSigma<id>(track));
if (track.trackacceptedid() < 0) {
/* track not accepted */
return;
Expand All @@ -592,12 +592,16 @@ struct PidDataCollectingEngine {
}

template <typename TrackObject>
void fillPID(TrackObject const& track, float mom)
void fillPID(TrackObject const& track, float tpcmom, float tofmom)
{
for (uint when = 0; when < 2; ++when) {
fhTPCdEdxSignalVsP[when]->Fill(mom, track.tpcSignal());
fhTOFSignalVsP[when]->Fill(mom, track.beta());
fhPvsTOFSqMass[when]->Fill(track.mass() * track.mass(), mom);
if constexpr (framework::has_type_v<o2::aod::mcpidtpc::DeDxTunedMc, typename TrackObject::all_columns>) {
fhTPCdEdxSignalVsP[when]->Fill(tpcmom, track.mcTunedTPCSignal());
} else {
fhTPCdEdxSignalVsP[when]->Fill(tpcmom, track.tpcSignal());
}
fhTOFSignalVsP[when]->Fill(tofmom, track.beta());
fhPvsTOFSqMass[when]->Fill(track.mass() * track.mass(), tofmom);
if (track.trackacceptedid() < 0) {
/* track not accepted */
return;
Expand All @@ -606,20 +610,20 @@ struct PidDataCollectingEngine {
}

template <efficiencyandqatask::KindOfData kindOfData, typename TrackObject>
void processTrack(TrackObject const& track, float mom)
void processTrack(TrackObject const& track, float tpcmom, float tofmom)
{
using namespace efficiencyandqatask;

if constexpr (kindOfData == kReco) {
fillPID(track, mom);
fillSpeciesPID<o2::track::PID::Pion>(0, track, mom);
fillSpeciesPID<o2::track::PID::Kaon>(1, track, mom);
fillSpeciesPID<o2::track::PID::Proton>(2, track, mom);
fillAllSpeciesPID<o2::track::PID::Electron>(0, track, mom);
fillAllSpeciesPID<o2::track::PID::Muon>(1, track, mom);
fillAllSpeciesPID<o2::track::PID::Pion>(2, track, mom);
fillAllSpeciesPID<o2::track::PID::Kaon>(3, track, mom);
fillAllSpeciesPID<o2::track::PID::Proton>(4, track, mom);
fillPID(track, tpcmom, tofmom);
fillSpeciesPID<o2::track::PID::Pion>(0, track, tpcmom, tofmom);
fillSpeciesPID<o2::track::PID::Kaon>(1, track, tpcmom, tofmom);
fillSpeciesPID<o2::track::PID::Proton>(2, track, tpcmom, tofmom);
fillAllSpeciesPID<o2::track::PID::Electron>(0, track, tpcmom, tofmom);
fillAllSpeciesPID<o2::track::PID::Muon>(1, track, tpcmom, tofmom);
fillAllSpeciesPID<o2::track::PID::Pion>(2, track, tpcmom, tofmom);
fillAllSpeciesPID<o2::track::PID::Kaon>(3, track, tpcmom, tofmom);
fillAllSpeciesPID<o2::track::PID::Proton>(4, track, tpcmom, tofmom);
}
}
};
Expand Down Expand Up @@ -688,7 +692,7 @@ struct PidExtraDataCollectingEngine {
}

template <o2::track::PID::ID id, typename TrackObject>
void fillAllSpeciesPID(uint ix, TrackObject const& track, float mom)
void fillAllSpeciesPID(uint ix, TrackObject const& track, float tpcmom, float tofmom)
{
if (track.trackacceptedid() < 0) {
/* track not accepted */
Expand All @@ -699,46 +703,54 @@ struct PidExtraDataCollectingEngine {
} else {
ix = 2 * ix;
}
fhIdTPCnSigmasVsP[track.trackacceptedid()][ix]->Fill(mom, o2::aod::pidutils::tpcNSigma<id>(track));
fhIdTOFnSigmasVsP[track.trackacceptedid()][ix]->Fill(mom, o2::aod::pidutils::tofNSigma<id>(track));
fhIdTPCnSigmasVsP[track.trackacceptedid()][ix]->Fill(tpcmom, o2::aod::pidutils::tpcNSigma<id>(track));
fhIdTOFnSigmasVsP[track.trackacceptedid()][ix]->Fill(tofmom, o2::aod::pidutils::tofNSigma<id>(track));
if (efficiencyandqatask::pidselector.isGlobalSpecies(track.trackacceptedid() / 2, id)) {
/* only if the species of the selected track matches the target of the number of sigmas */
fpIdTPCdEdxSignalVsPSigmas[track.trackacceptedid()]->Fill(mom, track.tpcSignal(), o2::aod::pidutils::tpcNSigma<id>(track));
fpIdTOFSignalVsPSigmas[track.trackacceptedid()]->Fill(mom, track.beta(), o2::aod::pidutils::tofNSigma<id>(track));
if constexpr (framework::has_type_v<o2::aod::mcpidtpc::DeDxTunedMc, typename TrackObject::all_columns>) {
fpIdTPCdEdxSignalVsPSigmas[track.trackacceptedid()]->Fill(tpcmom, track.mcTunedTPCSignal(), o2::aod::pidutils::tpcNSigma<id>(track));
} else {
fpIdTPCdEdxSignalVsPSigmas[track.trackacceptedid()]->Fill(tpcmom, track.tpcSignal(), o2::aod::pidutils::tpcNSigma<id>(track));
}
fpIdTOFSignalVsPSigmas[track.trackacceptedid()]->Fill(tofmom, track.beta(), o2::aod::pidutils::tofNSigma<id>(track));
}
}

template <o2::track::PID::ID id, typename TrackObject>
void fillSpeciesPID(uint, TrackObject const&, float)
void fillSpeciesPID(uint, TrackObject const&, float, float)
{
}

template <typename TrackObject>
void fillPID(TrackObject const& track, float mom)
void fillPID(TrackObject const& track, float tpcmom, float tofmom)
{
if (track.trackacceptedid() < 0) {
/* track not accepted */
return;
}
fhIdTPCdEdxSignalVsP[track.trackacceptedid()]->Fill(mom, track.tpcSignal());
fhIdTOFSignalVsP[track.trackacceptedid()]->Fill(mom, track.beta());
if constexpr (framework::has_type_v<o2::aod::mcpidtpc::DeDxTunedMc, typename TrackObject::all_columns>) {
fhIdTPCdEdxSignalVsP[track.trackacceptedid()]->Fill(tpcmom, track.mcTunedTPCSignal());
} else {
fhIdTPCdEdxSignalVsP[track.trackacceptedid()]->Fill(tpcmom, track.tpcSignal());
}
fhIdTOFSignalVsP[track.trackacceptedid()]->Fill(tofmom, track.beta());
}

template <efficiencyandqatask::KindOfData kindOfData, typename TrackObject>
void processTrack(TrackObject const& track, float mom)
void processTrack(TrackObject const& track, float tpcmom, float tofmom)
{
using namespace efficiencyandqatask;

if constexpr (kindOfData == kReco) {
fillPID(track, mom);
fillSpeciesPID<o2::track::PID::Pion>(0, track, mom);
fillSpeciesPID<o2::track::PID::Kaon>(1, track, mom);
fillSpeciesPID<o2::track::PID::Proton>(2, track, mom);
fillAllSpeciesPID<o2::track::PID::Electron>(0, track, mom);
fillAllSpeciesPID<o2::track::PID::Muon>(1, track, mom);
fillAllSpeciesPID<o2::track::PID::Pion>(2, track, mom);
fillAllSpeciesPID<o2::track::PID::Kaon>(3, track, mom);
fillAllSpeciesPID<o2::track::PID::Proton>(4, track, mom);
fillPID(track, tpcmom, tofmom);
fillSpeciesPID<o2::track::PID::Pion>(0, track, tpcmom, tofmom);
fillSpeciesPID<o2::track::PID::Kaon>(1, track, tpcmom, tofmom);
fillSpeciesPID<o2::track::PID::Proton>(2, track, tpcmom, tofmom);
fillAllSpeciesPID<o2::track::PID::Electron>(0, track, tpcmom, tofmom);
fillAllSpeciesPID<o2::track::PID::Muon>(1, track, tpcmom, tofmom);
fillAllSpeciesPID<o2::track::PID::Pion>(2, track, tpcmom, tofmom);
fillAllSpeciesPID<o2::track::PID::Kaon>(3, track, tpcmom, tofmom);
fillAllSpeciesPID<o2::track::PID::Proton>(4, track, tpcmom, tofmom);
}
}
};
Expand Down Expand Up @@ -973,20 +985,21 @@ struct DptDptEfficiencyAndQc {
int ixDCE = getDCEindex(collision);
if (!(ixDCE < 0)) {
for (auto const& track : tracks) {
float mom = track.p();
float tpcmom = track.p();
float tofmom = track.p();
if (useTPCInnerWallMomentum.value) {
if constexpr (!framework::has_type_v<aod::mcparticle::PdgCode, typename PassedTracks::iterator::all_columns>) {
mom = track.tpcInnerParam();
tpcmom = track.tpcInnerParam();
}
}
if constexpr (kindOfProcess == kBASIC) {
qaDataCE[ixDCE]->processTrack<kindOfData, FilteredCollisions>(collision.posZ(), track);
}
if constexpr (kindOfProcess == kPID) {
pidDataCE[ixDCE]->processTrack<kindOfData>(track, mom);
pidDataCE[ixDCE]->processTrack<kindOfData>(track, tpcmom, tofmom);
}
if constexpr (kindOfProcess == kPIDEXTRA) {
pidExtraDataCE[ixDCE]->processTrack<kindOfData>(track, mom);
pidExtraDataCE[ixDCE]->processTrack<kindOfData>(track, tpcmom, tofmom);
}
}
}
Expand Down

0 comments on commit d9e659c

Please sign in to comment.