Skip to content

Commit 4c76e0f

Browse files
victor-gonzalezVictor
andauthored
[PWGCF] DptDpt - Increasing the level of pT bins tracking (#10887)
Co-authored-by: Victor <victor@cern.ch>
1 parent 0646804 commit 4c76e0f

File tree

1 file changed

+42
-31
lines changed

1 file changed

+42
-31
lines changed

PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <TProfile2D.h>
1818
#include <THnSparse.h>
1919
#include <TPDGCode.h>
20+
#include <TMCProcess.h>
2021
#include <CCDB/BasicCCDBManager.h>
2122
#include <vector>
2223
#include <algorithm>
@@ -391,6 +392,9 @@ struct QADataCollectingEngine {
391392
using namespace analysis::dptdptfilter;
392393
using namespace o2::aod::track;
393394

395+
constexpr float kFiftyPerCent = 50.0f;
396+
constexpr float kHundredPerCent = 100.0f;
397+
394398
fhPtB[kindOfData]->Fill(track.pt());
395399
fhPtVsEtaB[kindOfData]->Fill(track.eta(), track.pt());
396400
fhPtVsZvtxB[kindOfData]->Fill(zvtx, track.pt());
@@ -411,7 +415,7 @@ struct QADataCollectingEngine {
411415

412416
float phiInTpcSector = std::fmod(track.phi(), kTpcPhiSectorWidth);
413417
float phiShiftedPercentInTpcSector = phiInTpcSector * 100 / kTpcPhiSectorWidth;
414-
phiShiftedPercentInTpcSector = (phiShiftedPercentInTpcSector > 50.0f) ? (phiShiftedPercentInTpcSector - 100.0f) : phiShiftedPercentInTpcSector;
418+
phiShiftedPercentInTpcSector = (phiShiftedPercentInTpcSector > kFiftyPerCent) ? (phiShiftedPercentInTpcSector - kHundredPerCent) : phiShiftedPercentInTpcSector;
415419
if (track.sign() > 0) {
416420
fhPhiVsPtPosB->Fill(track.pt(), phiInTpcSector);
417421
fhPerColNchVsPhiVsPtPosB->Fill(track.pt(), phiInTpcSector);
@@ -490,7 +494,7 @@ struct QADataCollectingEngine {
490494
float genid = findgenid(mcparticle);
491495

492496
bool isprimary = mcparticle.isPhysicalPrimary();
493-
bool issecdecay = !isprimary && (mcparticle.getProcess() == 4);
497+
bool issecdecay = !isprimary && (mcparticle.getProcess() == TMCProcess::kPDecay);
494498
bool isfrommaterial = !isprimary && !issecdecay;
495499
fillpurityhistos(fhPtPurityPosPrimA, fhPtPurityNegPrimA, genid, track, isprimary);
496500
fillpurityhistos(fhPtPurityPosSecA, fhPtPurityNegSecA, genid, track, issecdecay);
@@ -524,7 +528,7 @@ struct QADataCollectingEngine {
524528
/* pure generator level */
525529
if (track.isPhysicalPrimary()) {
526530
fhPtVsEtaPrimA[track.trackacceptedid()]->Fill(track.eta(), track.pt());
527-
} else if (track.getProcess() == 4) {
531+
} else if (track.getProcess() == TMCProcess::kPDecay) {
528532
fhPtVsEtaSecA[track.trackacceptedid()]->Fill(track.eta(), track.pt());
529533
} else {
530534
fhPtVsEtaMatA[track.trackacceptedid()]->Fill(track.eta(), track.pt());
@@ -608,13 +612,16 @@ struct QAExtraDataCollectingEngine {
608612
AxisSpec ptOfInterestAxis = {static_cast<int>(ptBinsOfInterest.size()), 0.5f, static_cast<float>(ptBinsOfInterest.size()) + 0.5f, "#it{p}_{T} (GeV/#it{c})"};
609613

610614
/* the mapping between pT bins of interest and internal representation, and histogram title to keep track of them offline */
615+
LOGF(info, "Configuring the pT bins of interest");
611616
std::string hPtRangesOfInterestTitle;
612617
for (size_t ix = 0; ix < ptBinsOfInterest.size(); ++ix) {
613618
TString ptRange = TString::Format("%s%.2f-%.2f", ix == 0 ? "" : ",", ptAxis.GetBinLowEdge(ptBinsOfInterest[ix]), ptAxis.GetBinUpEdge(ptBinsOfInterest[ix]));
614619
/* remember our internal axis starts in 0.5 value, i.e. its first central value is 1 */
615620
ptOfInterestBinMap[ptBinsOfInterest[ix]] = ix + 1;
616621
hPtRangesOfInterestTitle += ptRange.Data();
622+
LOGF(info, " Added pT bin %d as internal axis value %d", ptBinsOfInterest[ix], ix + 1);
617623
}
624+
LOGF(info, " Final pT bins tilte: %s", hPtRangesOfInterestTitle.c_str());
618625

619626
/* the reconstructed and generated levels histograms */
620627
std::string recogen = (kindOfData == kReco) ? "Reco" : "Gen";
@@ -688,16 +695,18 @@ struct PidDataCollectingEngine {
688695
uint nmainsp = static_cast<uint>(efficiencyandqatask::mainspnames.size());
689696
uint nallmainsp = static_cast<uint>(efficiencyandqatask::allmainspnames.size());
690697

698+
constexpr static uint kNoOfSteps = 2; /* Before and after track selection */
699+
691700
/* PID histograms */
692701
/* before and after */
693-
std::vector<std::shared_ptr<TH2>> fhTPCdEdxSignalVsP{2, nullptr};
694-
std::vector<std::vector<std::shared_ptr<TH2>>> fhTPCdEdxSignalDiffVsP{2, {nmainsp, nullptr}};
695-
std::vector<std::vector<std::shared_ptr<TH2>>> fhTPCnSigmasVsP{2, {nallmainsp, nullptr}};
696-
std::vector<std::shared_ptr<TH2>> fhTOFSignalVsP{2, nullptr};
697-
std::vector<std::vector<std::shared_ptr<TH2>>> fhTOFSignalDiffVsP{2, {nmainsp, nullptr}};
698-
std::vector<std::vector<std::shared_ptr<TH2>>> fhTOFnSigmasVsP{2, {nallmainsp, nullptr}};
699-
std::vector<std::shared_ptr<TH2>> fhPvsTOFSqMass{2, nullptr};
700-
std::vector<std::vector<std::shared_ptr<TH3>>> fhTPCTOFSigmaVsP{2, {nmainsp, nullptr}};
702+
std::vector<std::shared_ptr<TH2>> fhTPCdEdxSignalVsP{kNoOfSteps, nullptr};
703+
std::vector<std::vector<std::shared_ptr<TH2>>> fhTPCdEdxSignalDiffVsP{kNoOfSteps, {nmainsp, nullptr}};
704+
std::vector<std::vector<std::shared_ptr<TH2>>> fhTPCnSigmasVsP{kNoOfSteps, {nallmainsp, nullptr}};
705+
std::vector<std::shared_ptr<TH2>> fhTOFSignalVsP{kNoOfSteps, nullptr};
706+
std::vector<std::vector<std::shared_ptr<TH2>>> fhTOFSignalDiffVsP{kNoOfSteps, {nmainsp, nullptr}};
707+
std::vector<std::vector<std::shared_ptr<TH2>>> fhTOFnSigmasVsP{kNoOfSteps, {nallmainsp, nullptr}};
708+
std::vector<std::shared_ptr<TH2>> fhPvsTOFSqMass{kNoOfSteps, nullptr};
709+
std::vector<std::vector<std::shared_ptr<TH3>>> fhTPCTOFSigmaVsP{kNoOfSteps, {nmainsp, nullptr}};
701710

702711
template <efficiencyandqatask::KindOfData kindOfData>
703712
void init(HistogramRegistry& registry, const char* dirname)
@@ -711,9 +720,9 @@ struct PidDataCollectingEngine {
711720
if constexpr (kindOfData == kReco) {
712721
/* PID histograms */
713722
std::vector<std::string> whenname{"Before", "After"};
714-
char whenprefix[2]{'B', 'A'};
723+
constexpr char whenprefix[kNoOfSteps]{'B', 'A'};
715724
std::vector<std::string> whentitle{"before", ""};
716-
for (uint ix = 0; ix < whenname.size(); ++ix) {
725+
for (uint ix = 0; ix < kNoOfSteps; ++ix) {
717726
fhTPCdEdxSignalVsP[ix] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()),
718727
HNAMESTRING("tpcSignalVsP%c", whenprefix[ix]),
719728
HTITLESTRING("TPC dE/dx signal %s", whentitle[ix].c_str()), kTH2F, {pidPAxis, dEdxAxis});
@@ -761,7 +770,7 @@ struct PidDataCollectingEngine {
761770
} else {
762771
ix = 2 * ix;
763772
}
764-
for (uint when = 0; when < 2; ++when) {
773+
for (uint when = 0; when < kNoOfSteps; ++when) {
765774
fhTPCnSigmasVsP[when][ix]->Fill(tpcmom, o2::aod::pidutils::tpcNSigma<id>(track));
766775
fhTOFnSigmasVsP[when][ix]->Fill(tofmom, o2::aod::pidutils::tofNSigma<id>(track));
767776
if (track.trackacceptedid() < 0) {
@@ -779,7 +788,7 @@ struct PidDataCollectingEngine {
779788
} else {
780789
ix = 2 * ix;
781790
}
782-
for (uint when = 0; when < 2; ++when) {
791+
for (uint when = 0; when < kNoOfSteps; ++when) {
783792
fhTPCdEdxSignalDiffVsP[when][ix]->Fill(tpcmom, o2::aod::pidutils::tpcExpSignalDiff<id>(track));
784793
fhTOFSignalDiffVsP[when][ix]->Fill(tofmom, o2::aod::pidutils::tofExpSignalDiff<id>(track));
785794
fhTPCTOFSigmaVsP[when][ix]->Fill(tpcmom, o2::aod::pidutils::tpcNSigma<id>(track), o2::aod::pidutils::tofNSigma<id>(track));
@@ -793,7 +802,7 @@ struct PidDataCollectingEngine {
793802
template <typename TrackObject>
794803
void fillPID(TrackObject const& track, float tpcmom, float tofmom)
795804
{
796-
for (uint when = 0; when < 2; ++when) {
805+
for (uint when = 0; when < kNoOfSteps; ++when) {
797806
if constexpr (framework::has_type_v<o2::aod::mcpidtpc::DeDxTunedMc, typename TrackObject::all_columns>) {
798807
fhTPCdEdxSignalVsP[when]->Fill(tpcmom, track.mcTunedTPCSignal());
799808
} else {
@@ -1228,22 +1237,24 @@ struct DptDptEfficiencyAndQc {
12281237
if constexpr (kindOfProcess == kEXTRA) {
12291238
qaExtraDataCE[ixDCE]->processTrackPairs<kindOfData, FilteredCollisions>(tracks, tracks);
12301239
}
1231-
for (auto const& track : tracks) {
1232-
float tpcmom = track.p();
1233-
float tofmom = track.p();
1234-
if (useTPCInnerWallMomentum.value) {
1235-
if constexpr (!framework::has_type_v<aod::mcparticle::PdgCode, typename PassedTracks::iterator::all_columns>) {
1236-
tpcmom = track.tpcInnerParam();
1240+
if constexpr (kindOfProcess == kBASIC || kindOfProcess == kPID || kindOfProcess == kPIDEXTRA) {
1241+
for (auto const& track : tracks) {
1242+
float tpcmom = track.p();
1243+
float tofmom = track.p();
1244+
if (useTPCInnerWallMomentum.value) {
1245+
if constexpr (!framework::has_type_v<aod::mcparticle::PdgCode, typename PassedTracks::iterator::all_columns>) {
1246+
tpcmom = track.tpcInnerParam();
1247+
}
1248+
}
1249+
if constexpr (kindOfProcess == kBASIC) {
1250+
qaDataCE[ixDCE]->processTrack<kindOfData, FilteredCollisions>(collision.posZ(), track);
1251+
}
1252+
if constexpr (kindOfProcess == kPID) {
1253+
pidDataCE[ixDCE]->processTrack<kindOfData>(track, tpcmom, tofmom);
1254+
}
1255+
if constexpr (kindOfProcess == kPIDEXTRA) {
1256+
pidExtraDataCE[ixDCE]->processTrack<kindOfData>(track, tpcmom, tofmom);
12371257
}
1238-
}
1239-
if constexpr (kindOfProcess == kBASIC) {
1240-
qaDataCE[ixDCE]->processTrack<kindOfData, FilteredCollisions>(collision.posZ(), track);
1241-
}
1242-
if constexpr (kindOfProcess == kPID) {
1243-
pidDataCE[ixDCE]->processTrack<kindOfData>(track, tpcmom, tofmom);
1244-
}
1245-
if constexpr (kindOfProcess == kPIDEXTRA) {
1246-
pidExtraDataCE[ixDCE]->processTrack<kindOfData>(track, tpcmom, tofmom);
12471258
}
12481259
}
12491260
if constexpr (kindOfProcess == kBASIC) {

0 commit comments

Comments
 (0)