Skip to content

Commit 4668cac

Browse files
fmazzascFrancesco Mazzaschi
andauthored
[PWGLF] Add mother decay radius and remove track tuner (AliceO2Group#11499)
Co-authored-by: Francesco Mazzaschi <[email protected]>
1 parent d0016f5 commit 4668cac

File tree

2 files changed

+24
-55
lines changed

2 files changed

+24
-55
lines changed

PWGLF/DataModel/LFSlimNucleiTables.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ DECLARE_SOA_COLUMN(ITSclsMap, itsClsMap, uint8_t);
4444
DECLARE_SOA_COLUMN(TPCnCls, tpcNCls, uint8_t);
4545
DECLARE_SOA_COLUMN(TPCnClsShared, tpcNClsShared, uint8_t);
4646
DECLARE_SOA_COLUMN(ITSclusterSizes, itsClusterSizes, uint32_t);
47+
DECLARE_SOA_COLUMN(SurvivedEventSelection, survivedEventSelection, bool);
4748
DECLARE_SOA_COLUMN(gPt, genPt, float);
4849
DECLARE_SOA_COLUMN(gEta, genEta, float);
4950
DECLARE_SOA_COLUMN(gPhi, genPhi, float);
5051
DECLARE_SOA_COLUMN(PDGcode, pdgCode, int);
5152
DECLARE_SOA_COLUMN(MotherPDGcode, MotherpdgCode, int);
52-
DECLARE_SOA_COLUMN(SurvivedEventSelection, survivedEventSelection, bool);
53+
DECLARE_SOA_COLUMN(MotherDecRad, motherDecRad, float);
5354
DECLARE_SOA_COLUMN(AbsoDecL, absoDecL, float);
5455

5556
} // namespace NucleiTableNS
@@ -151,12 +152,13 @@ DECLARE_SOA_TABLE(NucleiTableMC, "AOD", "NUCLEITABLEMC",
151152
NucleiTableNS::TPCnCls,
152153
NucleiTableNS::TPCnClsShared,
153154
NucleiTableNS::ITSclusterSizes,
155+
NucleiTableNS::SurvivedEventSelection,
154156
NucleiTableNS::gPt,
155157
NucleiTableNS::gEta,
156158
NucleiTableNS::gPhi,
157159
NucleiTableNS::PDGcode,
158160
NucleiTableNS::MotherPDGcode,
159-
NucleiTableNS::SurvivedEventSelection,
161+
NucleiTableNS::MotherDecRad,
160162
NucleiTableNS::AbsoDecL);
161163

162164
DECLARE_SOA_TABLE(NucleiPairTable, "AOD", "NUCLEIPAIRTABLE",

PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx

Lines changed: 20 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
#include "Common/TableProducer/PID/pidTOFBase.h"
4242
#include "Common/Core/EventPlaneHelper.h"
4343
#include "Common/DataModel/Qvectors.h"
44-
#include "Common/Tools/TrackTuner.h"
4544
#include "Common/Core/RecoDecay.h"
4645

4746
#include "DataFormatsParameters/GRPMagField.h"
@@ -273,7 +272,6 @@ struct nucleiSpectra {
273272
Service<o2::ccdb::BasicCCDBManager> ccdb;
274273
Zorro zorro;
275274
OutputObj<ZorroSummary> zorroSummary{"zorroSummary"};
276-
TrackTuner trackTunerObj;
277275

278276
Configurable<bool> cfgCompensatePIDinTracking{"cfgCompensatePIDinTracking", false, "If true, divide tpcInnerParam by the electric charge"};
279277

@@ -282,8 +280,8 @@ struct nucleiSpectra {
282280
Configurable<float> cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"};
283281
Configurable<float> cfgCutEta{"cfgCutEta", 0.8f, "Eta range for tracks"};
284282
Configurable<float> cfgCutTpcMom{"cfgCutTpcMom", 0.2f, "Minimum TPC momentum for tracks"};
285-
Configurable<float> cfgCutRapidityMin{"cfgCutRapidityMin", -0.5, "Minimum rapidity for tracks"};
286-
Configurable<float> cfgCutRapidityMax{"cfgCutRapidityMax", 0.5, "Maximum rapidity for tracks"};
283+
Configurable<float> cfgCutRapidityMin{"cfgCutRapidityMin", -1., "Minimum rapidity for tracks"};
284+
Configurable<float> cfgCutRapidityMax{"cfgCutRapidityMax", 1., "Maximum rapidity for tracks"};
287285
Configurable<bool> cfgCutOnReconstructedRapidity{"cfgCutOnReconstructedRapidity", false, "Cut on reconstructed rapidity"};
288286
Configurable<float> cfgCutNclusITS{"cfgCutNclusITS", 5, "Minimum number of ITS clusters"};
289287
Configurable<float> cfgCutNclusTPC{"cfgCutNclusTPC", 70, "Minimum number of TPC clusters"};
@@ -327,9 +325,6 @@ struct nucleiSpectra {
327325

328326
Configurable<bool> cfgSkimmedProcessing{"cfgSkimmedProcessing", false, "Skimmed dataset processing"};
329327

330-
// configurables for track tuner
331-
Configurable<bool> cfgUseTrackTuner{"cfgUseTrackTuner", false, "Apply track tuner corrections to MC tracks"};
332-
Configurable<std::string> cfgTrackTunerParams{"cfgTrackTunerParams", "debugInfo=0|updateTrackDCAs=1|updateTrackCovMat=1|updateCurvature=0|updateCurvatureIU=0|updatePulls=1|isInputFileFromCCDB=1|pathInputFile=Users/m/mfaggin/test/inputsTrackTuner/pp2023/smoothHighPtMC|nameInputFile=trackTuner_DataLHC23fPass1_McLHC23k4b_run535085.root|pathFileQoverPt=Users/h/hsharma/qOverPtGraphs|nameFileQoverPt=D0sigma_Data_removal_itstps_MC_LHC22b1b.root|usePvRefitCorrections=0|qOverPtMC=-1.|qOverPtData=-1.", "TrackTuner parameter initialization (format: <name>=<value>|<name>=<value>)"};
333328
// running variables for track tuner
334329
o2::dataformats::DCA mDcaInfoCov;
335330
o2::track::TrackParametrizationWithError<float> mTrackParCov;
@@ -516,7 +511,7 @@ struct nucleiSpectra {
516511
spectra.add("hTpcSignalData", "Specific energy loss", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {1400, 0, 1400, "d#it{E} / d#it{X} (a. u.)"}});
517512
spectra.add("hTpcSignalDataSelected", "Specific energy loss for selected particles", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {1400, 0, 1400, "d#it{E} / d#it{X} (a. u.)"}});
518513
spectra.add("hTofSignalData", "TOF beta", HistType::kTH2F, {{500, 0., 5., "#it{p} (GeV/#it{c})"}, {750, 0, 1.5, "TOF #beta"}});
519-
spectra.add("hMCDCAxyVsDecRadius", "DCA xy vs DecayRadius", HistType::kTH2F, {{20, 0., 0.2, "Decay radius"}, {150, -0.05, 0.05, "DCA_{xy} (cm)"}});
514+
520515
for (int iC{0}; iC < 2; ++iC) {
521516
nuclei::hGloTOFtracks[iC] = spectra.add<TH2>(fmt::format("hTPCTOFtracks{}", nuclei::matter[iC]).data(), fmt::format("Global vs TOF matched {} tracks in a collision", nuclei::chargeLabelNames[iC]).data(), HistType::kTH2D, {{300, -0.5, 300.5, "Number of global tracks"}, {300, -0.5, 300.5, "Number of TOF matched tracks"}});
522517

@@ -562,12 +557,6 @@ struct nucleiSpectra {
562557
}
563558

564559
nuclei::lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get<o2::base::MatLayerCylSet>("GLO/Param/MatLUT"));
565-
// TrackTuner initialization
566-
if (cfgUseTrackTuner) {
567-
std::string outputStringParams = trackTunerObj.configParams(cfgTrackTunerParams);
568-
spectra.add("hTrackTunedTracks", outputStringParams.c_str(), HistType::kTH1F, {{1, 0.5, 1.5, ""}});
569-
trackTunerObj.getDcaGraphs();
570-
}
571560
}
572561

573562
template <typename Tcoll>
@@ -665,20 +654,6 @@ struct nucleiSpectra {
665654
mDcaInfoCov.set(999, 999, 999, 999, 999);
666655
setTrackParCov(track, mTrackParCov);
667656
mTrackParCov.setPID(track.pidForTracking());
668-
if constexpr (
669-
requires {
670-
track.has_mcParticle();
671-
}) {
672-
if (cfgUseTrackTuner) {
673-
bool hasMcParticle = track.has_mcParticle();
674-
if (hasMcParticle) {
675-
spectra.get<TH1>(HIST("hTrackTunedTracks"))->Fill(1); // all tracks
676-
auto mcParticle = track.mcParticle();
677-
trackTunerObj.tuneTrackParams(mcParticle, mTrackParCov, matCorr, &mDcaInfoCov, spectra.get<TH1>(HIST("hTrackTunedTracks")));
678-
}
679-
}
680-
}
681-
682657
std::array<float, 2> dcaInfo;
683658
o2::base::Propagator::Instance()->propagateToDCA(collVtx, mTrackParCov, mBz, 2.f, static_cast<o2::base::Propagator::MatCorrType>(cfgMaterialCorrection.value), &dcaInfo);
684659

@@ -957,24 +932,6 @@ struct nucleiSpectra {
957932
if (!c.correctPV) {
958933
c.flags |= kIsAmbiguous;
959934
}
960-
if (!particle.isPhysicalPrimary()) {
961-
c.isSecondary = true;
962-
if (particle.getProcess() == 4) {
963-
c.fromWeakDecay = true;
964-
}
965-
} else {
966-
// if the particle has a hf mother it is flagged as secondary
967-
if (particle.has_mothers()) {
968-
for (auto& motherparticle : particle.mothers_as<aod::McParticles>()) {
969-
if (std::find(nuclei::hfMothCodes.begin(), nuclei::hfMothCodes.end(), std::abs(motherparticle.pdgCode())) != nuclei::hfMothCodes.end()) {
970-
c.isSecondary = true;
971-
c.fromWeakDecay = true;
972-
break;
973-
}
974-
}
975-
}
976-
}
977-
978935
if (c.fillDCAHist && cfgDCAHists->get(iS, c.pt < 0)) {
979936
nuclei::hDCAHists[c.pt < 0][iS]->Fill(std::abs(c.pt), c.DCAxy, c.DCAz, c.nSigmaTPC[iS], c.tofMasses[iS], c.ITSnCls, c.TPCnCls, c.correctPV, c.isSecondary, c.fromWeakDecay);
980937
}
@@ -983,31 +940,38 @@ struct nucleiSpectra {
983940
if (!storeIt) {
984941
continue;
985942
}
986-
int MotherpdgCode = 0;
943+
if (particle.y() < cfgCutRapidityMin || particle.y() > cfgCutRapidityMax) {
944+
continue;
945+
}
946+
947+
int motherPdgCode = 0;
948+
float motherDecRadius = -1;
987949
isReconstructed[particle.globalIndex()] = true;
988950
if (particle.isPhysicalPrimary()) {
989951
c.flags |= kIsPhysicalPrimary;
990952
if (particle.has_mothers()) {
991953
for (auto& motherparticle : particle.mothers_as<aod::McParticles>()) {
992954
if (std::find(nuclei::hfMothCodes.begin(), nuclei::hfMothCodes.end(), std::abs(motherparticle.pdgCode())) != nuclei::hfMothCodes.end()) {
993955
c.flags |= kIsSecondaryFromWeakDecay;
994-
MotherpdgCode = motherparticle.pdgCode();
995-
float decRadius = std::hypot(particle.vx() - motherparticle.vx(), particle.vy() - motherparticle.vy());
996-
spectra.fill(HIST("hMCDCAxyVsDecRadius"), decRadius, c.DCAxy);
956+
motherPdgCode = motherparticle.pdgCode();
957+
motherDecRadius = std::hypot(particle.vx() - motherparticle.vx(), particle.vy() - motherparticle.vy());
997958
break;
998959
}
999960
}
1000961
}
1001962
} else if (particle.has_mothers()) {
1002963
c.flags |= kIsSecondaryFromWeakDecay;
1003964
for (auto& motherparticle : particle.mothers_as<aod::McParticles>()) {
1004-
MotherpdgCode = motherparticle.pdgCode();
965+
motherPdgCode = motherparticle.pdgCode();
966+
motherDecRadius = std::hypot(particle.vx() - motherparticle.vx(), particle.vy() - motherparticle.vy());
1005967
}
1006968
} else {
1007969
c.flags |= kIsSecondaryFromMaterial;
1008970
}
971+
972+
isReconstructed[particle.globalIndex()] = true;
1009973
float absoDecL = computeAbsoDecL(particle);
1010-
nucleiTableMC(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.TOFchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.TPCnClsShared, c.clusterSizesITS, particle.pt(), particle.eta(), particle.phi(), particle.pdgCode(), MotherpdgCode, goodCollisions[particle.mcCollisionId()], absoDecL);
974+
nucleiTableMC(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.TOFchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.TPCnClsShared, c.clusterSizesITS, goodCollisions[particle.mcCollisionId()], particle.pt(), particle.eta(), particle.phi(), particle.pdgCode(), motherPdgCode, motherDecRadius, absoDecL);
1011975
}
1012976

1013977
int index{0};
@@ -1023,6 +987,7 @@ struct nucleiSpectra {
1023987

1024988
uint16_t flags = 0;
1025989
int motherPdgCode = 0;
990+
float motherDecRadius = -1;
1026991
if (particle.isPhysicalPrimary()) {
1027992
flags |= kIsPhysicalPrimary;
1028993
nuclei::hGenNuclei[iS][particle.pdgCode() < 0]->Fill(1., particle.pt());
@@ -1031,6 +996,7 @@ struct nucleiSpectra {
1031996
if (std::find(nuclei::hfMothCodes.begin(), nuclei::hfMothCodes.end(), std::abs(motherparticle.pdgCode())) != nuclei::hfMothCodes.end()) {
1032997
flags |= kIsSecondaryFromWeakDecay;
1033998
motherPdgCode = motherparticle.pdgCode();
999+
motherDecRadius = std::hypot(particle.vx() - motherparticle.vx(), particle.vy() - motherparticle.vy());
10341000
break;
10351001
}
10361002
}
@@ -1039,6 +1005,7 @@ struct nucleiSpectra {
10391005
flags |= kIsSecondaryFromWeakDecay;
10401006
for (auto& motherparticle : particle.mothers_as<aod::McParticles>()) {
10411007
motherPdgCode = motherparticle.pdgCode();
1008+
motherDecRadius = std::hypot(particle.vx() - motherparticle.vx(), particle.vy() - motherparticle.vy());
10421009
}
10431010
} else {
10441011
flags |= kIsSecondaryFromMaterial;
@@ -1047,7 +1014,7 @@ struct nucleiSpectra {
10471014
if (!isReconstructed[index] && (cfgTreeConfig->get(iS, 0u) || cfgTreeConfig->get(iS, 1u))) {
10481015
float absDecL = computeAbsoDecL(particle);
10491016

1050-
nucleiTableMC(999., 999., 999., 0., 0., 999., 999., 999., -1, -1, -1, -1, flags, 0, 0, 0, 0, 0, 0, particle.pt(), particle.eta(), particle.phi(), particle.pdgCode(), motherPdgCode, goodCollisions[particle.mcCollisionId()], absDecL);
1017+
nucleiTableMC(999., 999., 999., 0., 0., 999., 999., 999., -1, -1, -1, -1, flags, 0, 0, 0, 0, 0, 0, goodCollisions[particle.mcCollisionId()], particle.pt(), particle.eta(), particle.phi(), particle.pdgCode(), motherPdgCode, motherDecRadius, absDecL);
10511018
}
10521019
break;
10531020
}

0 commit comments

Comments
 (0)