Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions PWGDQ/Core/VarManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ TString VarManager::fgVariableUnits[VarManager::kNVars] = {""};
std::map<TString, int> VarManager::fgVarNamesMap;
bool VarManager::fgUsedVars[VarManager::kNVars] = {false};
bool VarManager::fgUsedKF = false;
bool VarManager::fgPVrecalKF = true;
float VarManager::fgMagField = 0.5;
float VarManager::fgzMatching = -77.5;
float VarManager::fgzShiftFwd = 0.0;
Expand Down
79 changes: 76 additions & 3 deletions PWGDQ/Core/VarManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,11 @@
return false;
}

// Flag to set PV recalculation via KF

Check failure on line 1107 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / PR formatting / whitespace

Trailing spaces

Remove the trailing spaces at the end of the line.
static void SetPVrecalculationKF(const bool pvRecalKF) {
fgPVrecalKF = pvRecalKF;

Check failure on line 1109 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / PR formatting / whitespace

Trailing spaces

Remove the trailing spaces at the end of the line.
}

// Setup the collision system
static void SetCollisionSystem(TString system, float energy);
static void SetCollisionSystem(o2::parameters::GRPLHCIFData* grplhcif);
Expand Down Expand Up @@ -1306,6 +1311,8 @@
static void FillQuadMC(T1 const& t1, T2 const& t2, T2 const& t3, float* values = nullptr);
template <int pairType, uint32_t collFillMap, uint32_t fillMap, typename C, typename T>
static void FillPairVertexing(C const& collision, T const& t1, T const& t2, bool propToSV = false, float* values = nullptr);
template <int pairType, uint32_t collFillMap, uint32_t fillMap, typename C, typename T>

Check failure on line 1314 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / PR formatting / whitespace

Trailing spaces

Remove the trailing spaces at the end of the line.
static void FillPairVertexingRecomputePV(C const& /*collision*/, T const& t1, T const& t2, o2::dataformats::VertexBase pvRefitted, float* values = nullptr);
template <uint32_t collFillMap, uint32_t fillMap, typename C, typename T>
static void FillTripletVertexing(C const& collision, T const& t1, T const& t2, T const& t3, PairCandidateType tripletType, float* values = nullptr);
template <int candidateType, uint32_t collFillMap, uint32_t fillMap, typename C, typename T1>
Expand Down Expand Up @@ -1418,6 +1425,7 @@
private:
static bool fgUsedVars[kNVars]; // holds flags for when the corresponding variable is needed (e.g., in the histogram manager, in cuts, mixing handler, etc.)
static bool fgUsedKF;
static bool fgPVrecalKF;
static void SetVariableDependencies(); // toggle those variables on which other used variables might depend

static float fgMagField;
Expand Down Expand Up @@ -4194,6 +4202,7 @@

if constexpr ((pairType == kDecayToEE || pairType == kDecayToKPi) && trackHasCov) {
secondaryVertex = fgFitterTwoProngBarrel.getPCACandidate();
// printf("secVtx (first) %f %f %f \n",secondaryVertex[0],secondaryVertex[1],secondaryVertex[2]);

Check failure on line 4205 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / PR formatting / whitespace

Tab characters found

Indent code using spaces instead of tabs.
covMatrixPCA = fgFitterTwoProngBarrel.calcPCACovMatrixFlat();
auto chi2PCA = fgFitterTwoProngBarrel.getChi2AtPCACandidate();
auto trackParVar0 = fgFitterTwoProngBarrel.getTrack(0);
Expand All @@ -4202,7 +4211,7 @@
v1 = {trackParVar0.getPt(), trackParVar0.getEta(), trackParVar0.getPhi(), m1};
v2 = {trackParVar1.getPt(), trackParVar1.getEta(), trackParVar1.getPhi(), m2};
v12 = v1 + v2;
primaryVertexNew = RecalculatePrimaryVertex(t1, t2, collision);
if(fgPVrecalKF) primaryVertexNew = RecalculatePrimaryVertex(t1, t2, collision);

} else if constexpr (pairType == kDecayToMuMu && muonHasCov) {
// Get pca candidate from forward DCA fitter
Expand Down Expand Up @@ -4260,13 +4269,14 @@
values[kVertexingLxyProjected] = values[kVertexingLxyProjected] / TMath::Sqrt((v12.Px() * v12.Px()) + (v12.Py() * v12.Py()));
values[kVertexingLxyzProjected] = ((secondaryVertex[0] - collision.posX()) * v12.Px()) + ((secondaryVertex[1] - collision.posY()) * v12.Py()) + ((secondaryVertex[2] - collision.posZ()) * v12.Pz());
values[kVertexingLxyzProjected] = values[kVertexingLxyzProjected] / TMath::Sqrt((v12.Px() * v12.Px()) + (v12.Py() * v12.Py()) + (v12.Pz() * v12.Pz()));
if(fgPVrecalKF){
values[kVertexingLxyProjectedRecalculatePV] = (secondaryVertex[0] - primaryVertexNew.getX()) * v12.Px() + (secondaryVertex[1] - primaryVertexNew.getY()) * v12.Py();
values[kVertexingLxyProjectedRecalculatePV] = values[kVertexingLxyProjectedRecalculatePV] / v12.Pt();

}
values[kVertexingTauxyProjected] = values[kVertexingLxyProjected] * v12.M() / (v12.Pt());
values[kVertexingTauxyProjectedPoleJPsiMass] = values[kVertexingLxyProjected] * o2::constants::physics::MassJPsi / (v12.Pt());
values[kVertexingTauxyProjectedNs] = values[kVertexingTauxyProjected] / o2::constants::physics::LightSpeedCm2NS;
values[kVertexingTauxyProjectedPoleJPsiMassRecalculatePV] = values[kVertexingLxyProjectedRecalculatePV] * o2::constants::physics::MassJPsi / (v12.Pt());
if(fgPVrecalKF) values[kVertexingTauxyProjectedPoleJPsiMassRecalculatePV] = values[kVertexingLxyProjectedRecalculatePV] * o2::constants::physics::MassJPsi / (v12.Pt());
values[kVertexingTauzProjected] = values[kVertexingLzProjected] * v12.M() / TMath::Abs(v12.Pz());
values[kVertexingTauxyzProjected] = values[kVertexingLxyzProjected] * v12.M() / (v12.P());
}
Expand Down Expand Up @@ -4484,6 +4494,69 @@
}
}

template <int pairType, uint32_t collFillMap, uint32_t fillMap, typename C, typename T>
void VarManager::FillPairVertexingRecomputePV(C const& /*collision*/, T const& t1, T const& t2, o2::dataformats::VertexBase pvRefitted, float* values )
{

Check failure on line 4499 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / PR formatting / whitespace

Trailing spaces

Remove the trailing spaces at the end of the line.
// recompute decay lenght variables using updated primary vertex

// check at compile time that the event and cov matrix have the cov matrix
constexpr bool eventHasVtxCov = ((collFillMap & Collision) > 0 || (collFillMap & ReducedEventVtxCov) > 0);
constexpr bool trackHasCov = ((fillMap & TrackCov) > 0 || (fillMap & ReducedTrackBarrelCov) > 0);
constexpr bool muonHasCov = ((fillMap & MuonCov) > 0 || (fillMap & ReducedMuonCov) > 0);

if (!values) {
values = fgValues;
}

float m1 = o2::constants::physics::MassElectron;
float m2 = o2::constants::physics::MassElectron;
if constexpr (pairType == kDecayToKPi) {
m1 = o2::constants::physics::MassKaonCharged;
m2 = o2::constants::physics::MassPionCharged;
}
if constexpr (pairType == kDecayToMuMu && muonHasCov) {
m1 = o2::constants::physics::MassMuon;
m2 = o2::constants::physics::MassMuon;
}
ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), m1);
ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), m2);
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;

if(fgFitterTwoProngBarrel.getNCandidates() == 0) return;
Vec3D secondaryVertex;

if (!fgUsedKF) { // to be updated when seconday vertex is computed with KF
if constexpr (eventHasVtxCov) {

if constexpr ((pairType == kDecayToEE || pairType == kDecayToKPi) && trackHasCov) {
// Get pca candidate from forward DCA fitter
// no need to re-compute secondary vertex (done already in FillPairVertexing)
secondaryVertex = fgFitterTwoProngBarrel.getPCACandidate();
auto trackParVar0 = fgFitterTwoProngBarrel.getTrack(0);
auto trackParVar1 = fgFitterTwoProngBarrel.getTrack(1);
v1 = {trackParVar0.getPt(), trackParVar0.getEta(), trackParVar0.getPhi(), m1};
v2 = {trackParVar1.getPt(), trackParVar1.getEta(), trackParVar1.getPhi(), m2};
v12 = v1 + v2;

} else if constexpr (pairType == kDecayToMuMu && muonHasCov) {
// Get pca candidate from forward DCA fitter
// no need to re-compute secondary vertex (done already in FillPairVertexing)
secondaryVertex = fgFitterTwoProngFwd.getPCACandidate();
auto trackParVar0 = fgFitterTwoProngFwd.getTrack(0);
auto trackParVar1 = fgFitterTwoProngFwd.getTrack(1);
v1 = {trackParVar0.getPt(), trackParVar0.getEta(), trackParVar0.getPhi(), m1};
v2 = {trackParVar1.getPt(), trackParVar1.getEta(), trackParVar1.getPhi(), m2};
v12 = v1 + v2;
}

values[kVertexingLxyProjectedRecalculatePV] = (secondaryVertex[0] - pvRefitted.getX()) * v12.Px() + (secondaryVertex[1] - pvRefitted.getY()) * v12.Py();
values[kVertexingLxyProjectedRecalculatePV] = values[kVertexingLxyProjectedRecalculatePV] / v12.Pt();
values[kVertexingTauxyProjectedPoleJPsiMassRecalculatePV] = values[kVertexingLxyProjectedRecalculatePV] * o2::constants::physics::MassJPsi / (v12.Pt());
}
}

}

template <uint32_t collFillMap, uint32_t fillMap, typename C, typename T>
void VarManager::FillTripletVertexing(C const& collision, T const& t1, T const& t2, T const& t3, VarManager::PairCandidateType tripletType, float* values)
{
Expand Down
7 changes: 6 additions & 1 deletion PWGDQ/Tasks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ o2physics_add_dpl_workflow(table-reader-with-assoc
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::PWGDQCore O2Physics::MLCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(table-reader-with-assoc-direct
SOURCES tableReader_withAssoc_direct.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::PWGDQCore O2Physics::MLCore O2::ReconstructionDataFormats O2::DetectorsCommonDataFormats O2::DetectorsVertexing
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(efficiency
SOURCES dqEfficiency.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGDQCore
Expand All @@ -31,7 +36,7 @@ o2physics_add_dpl_workflow(efficiency-with-assoc

o2physics_add_dpl_workflow(efficiency-with-assoc-direct
SOURCES dqEfficiency_withAssoc_direct.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGDQCore
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGDQCore O2::ReconstructionDataFormats O2::DetectorsCommonDataFormats O2::DetectorsVertexing
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(filter-pp
Expand Down
Loading
Loading