Skip to content

Commit 16ae122

Browse files
author
Ionut Cristian Arsene
committed
merged changes in VarManager
1 parent 8977f96 commit 16ae122

File tree

5 files changed

+3268
-35
lines changed

5 files changed

+3268
-35
lines changed

PWGDQ/Core/MCProng.cxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,10 @@ void MCProng::Print() const
159159
<< ") ExcludePDG(" << fExcludePDG[i] << ") SourceBits(" << fSourceBits[i] << ") ExcludeSource(" << fExcludeSource[i]
160160
<< ") UseANDonSource(" << fUseANDonSourceBitMap[i] << ") CheckGenerationsInTime(" << fCheckGenerationsInTime << ")";
161161
for (std::size_t j = 0; j < fPDGInHistory.size(); j++) {
162-
std::cout << " #" << j << " PDGInHistory(" << fPDGInHistory[j] << ") ExcludePDGInHistory(" << fExcludePDGInHistory[j] << ")";
162+
std::cout << " #" << j << " PDGInHistory(" << fPDGInHistory[j] << ")";
163+
}
164+
for (std::size_t j = 0; j < fExcludePDGInHistory.size(); j++) {
165+
std::cout << " #" << j << " ExcludePDGInHistory(" << fExcludePDGInHistory[j] << ")";
163166
}
164167
std::cout << std::endl;
165168
}

PWGDQ/Core/VarManager.h

Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "Common/Core/EventPlaneHelper.h"
3030
#include "Common/Core/fwdtrackUtilities.h"
3131
#include "Common/Core/trackUtilities.h"
32+
#include "Common/Core/PID/PIDTOFParamService.h"
3233

3334
#include <CommonConstants/LHCConstants.h>
3435
#include <CommonConstants/PhysicsConstants.h>
@@ -129,18 +130,19 @@ class VarManager : public TObject
129130
ReducedMuon = BIT(14),
130131
ReducedMuonExtra = BIT(15),
131132
ReducedMuonCov = BIT(16),
132-
ParticleMC = BIT(17),
133-
Pair = BIT(18), // TODO: check whether we really need the Pair member here
134-
AmbiTrack = BIT(19),
135-
AmbiMuon = BIT(20),
136-
DalitzBits = BIT(21),
137-
TrackTPCPID = BIT(22),
138-
TrackMFT = BIT(23),
139-
ReducedTrackCollInfo = BIT(24), // TODO: remove it once new reduced data tables are produced for dielectron with ReducedTracksBarrelInfo
140-
ReducedMuonCollInfo = BIT(25), // TODO: remove it once new reduced data tables are produced for dielectron with ReducedTracksBarrelInfo
141-
MuonRealign = BIT(26),
142-
MuonCovRealign = BIT(27),
143-
MFTCov = BIT(28)
133+
Pair = BIT(17), // TODO: check whether we really need the Pair member here
134+
AmbiTrack = BIT(18),
135+
AmbiMuon = BIT(19),
136+
DalitzBits = BIT(20),
137+
TrackTPCPID = BIT(21),
138+
TrackMFT = BIT(22),
139+
ReducedTrackCollInfo = BIT(23), // TODO: remove it once new reduced data tables are produced for dielectron with ReducedTracksBarrelInfo
140+
ReducedMuonCollInfo = BIT(24), // TODO: remove it once new reduced data tables are produced for dielectron with ReducedTracksBarrelInfo
141+
MuonRealign = BIT(25),
142+
MuonCovRealign = BIT(26),
143+
MFTCov = BIT(27),
144+
TrackTOFService = BIT(28),
145+
ParticleMC = BIT(29)
144146
};
145147

146148
enum PairCandidateType {
@@ -1190,7 +1192,7 @@ class VarManager : public TObject
11901192
static void FillPhoton(T const& photon, float* values = nullptr);
11911193
template <uint32_t fillMap, typename T, typename C>
11921194
static void FillTrackCollision(T const& track, C const& collision, float* values = nullptr);
1193-
template <int candidateType, typename T1, typename T2, typename C>
1195+
template <int candidateType, uint32_t fillMap, typename T1, typename T2, typename C>
11941196
static void FillTrackCollisionMC(T1 const& track, T2 const& MotherTrack, C const& collision, float* values = nullptr);
11951197
template <uint32_t fillMap, typename T, typename C, typename M, typename P>
11961198
static void FillTrackCollisionMatCorr(T const& track, C const& collision, M const& materialCorr, P const& propagator, float* values = nullptr);
@@ -1309,7 +1311,7 @@ class VarManager : public TObject
13091311
fgITSROFBorderMarginLow = marginLow;
13101312
fgITSROFBorderMarginHigh = marginHigh;
13111313
}
1312-
1314+
13131315
static void SetSORandEOR(uint64_t sor, uint64_t eor)
13141316
{
13151317
fgSOR = sor;
@@ -2657,6 +2659,12 @@ void VarManager::FillTrack(T const& track, float* values)
26572659
values[kTOFbeta] = track.beta();
26582660
}
26592661
}
2662+
if constexpr ((fillMap & TrackTOFService) > 0) {
2663+
values[kTOFnSigmaEl] = track.tofNSigmaDynEl();
2664+
values[kTOFnSigmaEl] = track.tofNSigmaDynPi();
2665+
values[kTOFnSigmaEl] = track.tofNSigmaDynKa();
2666+
values[kTOFnSigmaEl] = track.tofNSigmaDynPr();
2667+
}
26602668
if constexpr ((fillMap & TrackTPCPID) > 0) {
26612669
values[kTPCnSigmaEl] = track.tpcNSigmaEl();
26622670
values[kTPCnSigmaPi] = track.tpcNSigmaPi();
@@ -2847,47 +2855,55 @@ void VarManager::FillTrackMC(const U& mcStack, T const& track, float* values)
28472855
FillTrackDerived(values);
28482856
}
28492857

2850-
template <int candidateType, typename T1, typename T2, typename C>
2858+
template <int candidateType, uint32_t fillMap, typename T1, typename T2, typename C>
28512859
void VarManager::FillTrackCollisionMC(T1 const& track, T2 const& MotherTrack, C const& collision, float* values)
28522860
{
28532861

28542862
if (!values) {
28552863
values = fgValues;
28562864
}
28572865

2858-
float m = 0.0;
2859-
float pdgLifetime = 0.0;
2860-
if (std::abs(MotherTrack.pdgCode()) == 521) {
2861-
m = o2::constants::physics::MassBPlus;
2862-
pdgLifetime = 1.638e-12; // s
2863-
}
2866+
float m = o2::constants::physics::MassBPlus;
2867+
float pdgLifetime = 1.638e-12; // s
28642868
if (std::abs(MotherTrack.pdgCode()) == 511) {
28652869
m = o2::constants::physics::MassB0;
28662870
pdgLifetime = 1.517e-12; // s
28672871
}
28682872

2873+
// Extract the collision primary vertex position using constexpr, since the collision type may be CollisionMC or ReducedMCEvent
2874+
double collPos[3] = {0.0, 0.0, 0.0};
2875+
if constexpr (fillMap & ObjTypes::CollisionMC) {
2876+
collPos[0] = collision.posX();
2877+
collPos[1] = collision.posY();
2878+
collPos[2] = collision.posZ();
2879+
} else if constexpr (fillMap & ObjTypes::ReducedEventMC) {
2880+
collPos[0] = collision.mcPosX();
2881+
collPos[1] = collision.mcPosY();
2882+
collPos[2] = collision.mcPosZ();
2883+
}
2884+
28692885
// displaced vertex is compued with decay product (track) and momentum of mother particle (MotherTrack)
2870-
values[kMCVertexingLxy] = (collision.mcPosX() - track.vx()) * (collision.mcPosX() - track.vx()) +
2871-
(collision.mcPosY() - track.vy()) * (collision.mcPosY() - track.vy());
2872-
values[kMCVertexingLz] = (collision.mcPosZ() - track.vz()) * (collision.mcPosZ() - track.vz());
2886+
values[kMCVertexingLxy] = (collPos[0] - track.vx()) * (collPos[0] - track.vx()) +
2887+
(collPos[1] - track.vy()) * (collPos[1] - track.vy());
2888+
values[kMCVertexingLz] = (collPos[2] - track.vz()) * (collPos[2] - track.vz());
28732889
values[kMCVertexingLxyz] = values[kMCVertexingLxy] + values[kMCVertexingLz];
28742890
values[kMCVertexingLxy] = std::sqrt(values[kMCVertexingLxy]);
28752891
values[kMCVertexingLz] = std::sqrt(values[kMCVertexingLz]);
28762892
values[kMCVertexingLxyz] = std::sqrt(values[kMCVertexingLxyz]);
2877-
values[kMCVertexingTauz] = (collision.mcPosZ() - track.vz()) * m / (TMath::Abs(MotherTrack.pz()) * o2::constants::physics::LightSpeedCm2NS);
2893+
values[kMCVertexingTauz] = (collPos[2] - track.vz()) * m / (TMath::Abs(MotherTrack.pz()) * o2::constants::physics::LightSpeedCm2NS);
28782894
values[kMCVertexingTauxy] = values[kMCVertexingLxy] * m / (MotherTrack.pt() * o2::constants::physics::LightSpeedCm2NS);
28792895

2880-
values[kMCCosPointingAngle] = ((collision.mcPosX() - track.vx()) * MotherTrack.px() +
2881-
(collision.mcPosY() - track.vy()) * MotherTrack.py() +
2882-
(collision.mcPosZ() - track.vz()) * MotherTrack.pz()) /
2896+
values[kMCCosPointingAngle] = ((collPos[0] - track.vx()) * MotherTrack.px() +
2897+
(collPos[1] - track.vy()) * MotherTrack.py() +
2898+
(collPos[2] - track.vz()) * MotherTrack.pz()) /
28832899
(MotherTrack.p() * values[VarManager::kMCVertexingLxyz]);
28842900

28852901
values[kMCLxyExpected] = (MotherTrack.pt() / m) * (pdgLifetime * o2::constants::physics::LightSpeedCm2S);
28862902
values[kMCLxyzExpected] = (MotherTrack.p() / m) * (pdgLifetime * o2::constants::physics::LightSpeedCm2S);
28872903

2888-
values[kMCVertexingLzProjected] = ((track.vz() - collision.mcPosZ()) * MotherTrack.pz()) / TMath::Abs(MotherTrack.pz());
2889-
values[kMCVertexingLxyProjected] = (((track.vx() - collision.mcPosX()) * MotherTrack.px()) + ((track.vy() - collision.mcPosY()) * MotherTrack.py())) / TMath::Abs(MotherTrack.pt());
2890-
values[kMCVertexingLxyzProjected] = (((track.vx() - collision.mcPosX()) * MotherTrack.px()) + ((track.vy() - collision.mcPosY()) * MotherTrack.py()) + ((track.vz() - collision.mcPosZ()) * MotherTrack.pz())) / MotherTrack.p();
2904+
values[kMCVertexingLzProjected] = ((track.vz() - collPos[2]) * MotherTrack.pz()) / TMath::Abs(MotherTrack.pz());
2905+
values[kMCVertexingLxyProjected] = (((track.vx() - collPos[0]) * MotherTrack.px()) + ((track.vy() - collPos[1]) * MotherTrack.py())) / TMath::Abs(MotherTrack.pt());
2906+
values[kMCVertexingLxyzProjected] = (((track.vx() - collPos[1]) * MotherTrack.px()) + ((track.vy() - collPos[1]) * MotherTrack.py()) + ((track.vz() - collPos[2]) * MotherTrack.pz())) / MotherTrack.p();
28912907
values[kMCVertexingTauxyProjected] = values[kMCVertexingLxyProjected] * m / (MotherTrack.pt());
28922908
values[kMCVertexingTauzProjected] = values[kMCVertexingLzProjected] * m / TMath::Abs(MotherTrack.pz());
28932909
values[kMCVertexingTauxyzProjected] = values[kMCVertexingLxyzProjected] * m / (MotherTrack.p());

PWGDQ/DataModel/ReducedInfoTables.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ DECLARE_SOA_COLUMN(DeviationxyTrk1KF, deviationxyTrk1KF, float); //! 2D chi2 dev
718718
// pair information
719719
namespace reducedpair
720720
{
721-
DECLARE_SOA_INDEX_COLUMN(ReducedEvent, reducedevent); //!
721+
DECLARE_SOA_INDEX_COLUMN(ReducedEvent, reducedevent);
722722
DECLARE_SOA_INDEX_COLUMN_FULL(Index0, index0, int, ReducedTracks, "_0"); //! Index to first prong
723723
DECLARE_SOA_INDEX_COLUMN_FULL(Index1, index1, int, ReducedTracks, "_1"); //! Index to second prong
724724
DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, Tracks, "_0"); //! Index of first prong in Tracks table
@@ -818,7 +818,7 @@ DECLARE_SOA_TABLE_STAGED(Dielectrons, "RTDIELECTRON", //!
818818
reducedpair::Px<reducedpair::Pt, reducedpair::Phi>,
819819
reducedpair::Py<reducedpair::Pt, reducedpair::Phi>,
820820
reducedpair::Pz<reducedpair::Pt, reducedpair::Eta>,
821-
reducedpair::P<reducedpair::Pt, reducedpair::Eta>);
821+
reducedpair::P<reducedpair::Pt, reducedpair::Eta>);
822822

823823
DECLARE_SOA_TABLE(Dimuons, "AOD", "RTDIMUON", //!
824824
o2::soa::Index<>, reducedpair::ReducedEventId,

PWGDQ/Tasks/dqEfficiency_withAssoc.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4075,7 +4075,7 @@ struct AnalysisDileptonTrack {
40754075
}
40764076
}
40774077
// fill mc truth vertexing (for the associated track as this will have a displaced vertex, while the B hadron is produced in the PV)
4078-
VarManager::FillTrackCollisionMC<VarManager::kBtoJpsiEEK>(trackMC, currentMCParticle, event.reducedMCevent(), fValuesHadron);
4078+
VarManager::FillTrackCollisionMC<VarManager::kBtoJpsiEEK, TEventFillMap>(trackMC, currentMCParticle, event.reducedMCevent(), fValuesHadron);
40794079
}
40804080

40814081
// table to be written out for ML analysis

0 commit comments

Comments
 (0)