Skip to content

Commit cf6a5b7

Browse files
authored
PWGDQ/EM: Add variable PhiV to VarManager, add histogram for pairs, T… (#1456)
* PWGDQ/EM: Add variable PhiV to VarManager, add histogram for pairs, TPC NCls vs NcrosRow * PWGDQ: VarManager fix old MegaLinter errors * PWGDQ: VarManager change ifndef to PWGDQ_CORE_VARMANAGER_H_ * PWGDQ: VarManager add '#include <utility>' and ifndef, define, endif for HistogramsLibrary.h
1 parent 3300e75 commit cf6a5b7

3 files changed

Lines changed: 94 additions & 17 deletions

File tree

PWGDQ/Core/HistogramsLibrary.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
//
1212
// Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no
1313
//
14+
15+
#ifndef PWGDQ_CORE_HISTOGRAMSLIBRARY_H_
16+
#define PWGDQ_CORE_HISTOGRAMSLIBRARY_H_
17+
1418
#include <TString.h>
1519
#include "PWGDQ/Core/HistogramManager.h"
1620
#include "PWGDQ/Core/VarManager.h"
@@ -159,6 +163,7 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h
159163
hm->AddHistogram(histClass, "TPCncls_Run", "Number of cluster in TPC", true, (VarManager::GetNRuns() > 0 ? VarManager::GetNRuns() : 1), 0.5, 0.5 + VarManager::GetNRuns(), VarManager::kRunId,
160164
10, -0.5, 159.5, VarManager::kTPCncls, 10, 0., 1., VarManager::kNothing, VarManager::GetRunStr().Data());
161165
hm->AddHistogram(histClass, "TPCnclsCR", "Number of crossed rows in TPC", false, 160, -0.5, 159.5, VarManager::kTPCnclsCR);
166+
hm->AddHistogram(histClass, "TPCncls_TPCnclsCR", "Number of TPC cluster vs Number of crossed rows in TPC", false, 160, -0.5, 159.5, VarManager::kTPCncls, 160, -0.5, 159.5, VarManager::kTPCnclsCR);
162167
hm->AddHistogram(histClass, "IsTPCrefit", "", false, 2, -0.5, 1.5, VarManager::kIsTPCrefit);
163168
hm->AddHistogram(histClass, "IsGoldenChi2", "", false, 2, -0.5, 1.5, VarManager::kIsGoldenChi2);
164169
hm->AddHistogram(histClass, "TPCchi2", "TPC chi2", false, 100, 0.0, 10.0, VarManager::kTPCchi2);
@@ -294,6 +299,8 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h
294299
hm->AddHistogram(histClass, "Eta_Pt", "", false, 125, -2.0, 2.0, VarManager::kEta, 100, 0.0, 20.0, VarManager::kPt);
295300
hm->AddHistogram(histClass, "Mass_VtxZ", "", true, 30, -15.0, 15.0, VarManager::kVtxZ, 100, 0.0, 20.0, VarManager::kMass);
296301
hm->AddHistogram(histClass, "cosThetaHE", "", false, 100, -1., 1., VarManager::kCosThetaHE);
302+
hm->AddHistogram(histClass, "PhiV", "", false, 100, 0.0, 3.2, VarManager::kPairPhiv);
303+
hm->AddHistogram(histClass, "Mass_Pt_PhiV", "", false, 125, 0.0, 5.0, VarManager::kMass, 100, 0.0, 20.0, VarManager::kPt, 100, 0.0, 3.2, VarManager::kPairPhiv);
297304
if (subGroupStr.Contains("vertexing-barrel")) {
298305
hm->AddHistogram(histClass, "Lxy", "", false, 100, 0.0, 10.0, VarManager::kVertexingLxy);
299306
hm->AddHistogram(histClass, "Lxyz", "", false, 100, 0.0, 10.0, VarManager::kVertexingLxyz);
@@ -372,3 +379,5 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h
372379
hm->AddHistogram(histClass, "DeltaEta_DeltaPhiSym", "", false, 20, -2.0, 2.0, VarManager::kDeltaEta, 50, -8.0, 8.0, VarManager::kDeltaPhiSym);
373380
}
374381
}
382+
383+
#endif // PWGDQ_CORE_HISTOGRAMSLIBRARY_H_

PWGDQ/Core/VarManager.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void VarManager::FillEventDerived(float* values)
9696
// Fill event-wise derived quantities (these are all quantities which can be computed just based on the values already filled in the FillEvent() function)
9797
//
9898
if (fgUsedVars[kRunId]) {
99-
values[kRunId] = (fgRunMap.size() > 0 ? fgRunMap[int(values[kRunNo])] : 0);
99+
values[kRunId] = (fgRunMap.size() > 0 ? fgRunMap[static_cast<int>(values[kRunNo])] : 0);
100100
}
101101
}
102102

@@ -439,6 +439,8 @@ void VarManager::SetDefaultVarNames()
439439
fgVariableUnits[kPairEta] = "";
440440
fgVariableNames[kPairPhi] = "#varphi";
441441
fgVariableUnits[kPairPhi] = "rad.";
442+
fgVariableNames[kPairPhiv] = "#varphi_{V}";
443+
fgVariableUnits[kPairPhiv] = "rad.";
442444
fgVariableNames[kDeltaEta] = "#Delta#eta";
443445
fgVariableUnits[kDeltaEta] = "";
444446
fgVariableNames[kDeltaPhi] = "#Delta#phi";

PWGDQ/Core/VarManager.h

Lines changed: 82 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,21 @@
1414
// Class to handle analysis variables
1515
//
1616

17-
#ifndef VarManager_H
18-
#define VarManager_H
19-
20-
#include <TObject.h>
21-
#include <TString.h>
22-
#include <Math/Vector4D.h>
23-
#include "Math/Vector3D.h"
24-
#include "Math/GenVector/Boost.h"
25-
#include <TRandom.h>
17+
#ifndef PWGDQ_CORE_VARMANAGER_H_
18+
#define PWGDQ_CORE_VARMANAGER_H_
2619

2720
#include <vector>
2821
#include <map>
2922
#include <cmath>
3023
#include <iostream>
24+
#include <utility>
25+
26+
#include <TObject.h>
27+
#include <TString.h>
28+
#include "TRandom.h"
29+
#include "Math/Vector4D.h"
30+
#include "Math/Vector3D.h"
31+
#include "Math/GenVector/Boost.h"
3132

3233
#include "Framework/DataTypes.h"
3334
#include "ReconstructionDataFormats/Track.h"
@@ -315,6 +316,7 @@ class VarManager : public TObject
315316
kPairPtDau,
316317
kPairEta,
317318
kPairPhi,
319+
kPairPhiv,
318320
kDeltaEta,
319321
kDeltaPhi,
320322
kDeltaPhiSym,
@@ -671,13 +673,13 @@ void VarManager::FillTrack(T const& track, float* values)
671673
values[kIsGlobalTrack] = track.filteringFlags() & (uint64_t(1) << 0);
672674
values[kIsGlobalTrackSDD] = track.filteringFlags() & (uint64_t(1) << 1);
673675

674-
values[kIsLegFromGamma] = bool(track.filteringFlags() & (uint64_t(1) << 2));
675-
values[kIsLegFromK0S] = bool(track.filteringFlags() & (uint64_t(1) << 3));
676-
values[kIsLegFromLambda] = bool(track.filteringFlags() & (uint64_t(1) << 4));
677-
values[kIsLegFromAntiLambda] = bool(track.filteringFlags() & (uint64_t(1) << 5));
678-
values[kIsLegFromOmega] = bool(track.filteringFlags() & (uint64_t(1) << 6));
676+
values[kIsLegFromGamma] = static_cast<bool>(track.filteringFlags() & (uint64_t(1) << 2));
677+
values[kIsLegFromK0S] = static_cast<bool>(track.filteringFlags() & (uint64_t(1) << 3));
678+
values[kIsLegFromLambda] = static_cast<bool>(track.filteringFlags() & (uint64_t(1) << 4));
679+
values[kIsLegFromAntiLambda] = static_cast<bool>(track.filteringFlags() & (uint64_t(1) << 5));
680+
values[kIsLegFromOmega] = static_cast<bool>(track.filteringFlags() & (uint64_t(1) << 6));
679681

680-
values[kIsProtonFromLambdaAndAntiLambda] = bool((values[kIsLegFromLambda] * track.sign() > 0) || (values[kIsLegFromAntiLambda] * (-track.sign()) > 0));
682+
values[kIsProtonFromLambdaAndAntiLambda] = static_cast<bool>((values[kIsLegFromLambda] * track.sign() > 0) || (values[kIsLegFromAntiLambda] * (-track.sign()) > 0));
681683
}
682684
}
683685

@@ -922,6 +924,70 @@ void VarManager::FillPair(T1 const& t1, T2 const& t2, float* values)
922924
values[kQuadDCAsigXY] = std::sqrt((dca1sig * dca1sig + dca2sig * dca2sig) / 2);
923925
}
924926
}
927+
if (fgUsedVars[kPairPhiv]) {
928+
// cos(phiv) = w*a /|w||a|
929+
// with w = u x v
930+
// and a = u x z / |u x z| , unit vector perpendicular to v12 and z-direction (magnetic field)
931+
// u = v12 / |v12| , the unit vector of v12
932+
// v = v1 x v2 / |v1 x v2| , unit vector perpendicular to v1 and v2
933+
934+
float bz = fgFitterTwoProngBarrel.getBz();
935+
936+
// ordering of tracks, so v1 has larger momentum
937+
if (v1.P() < v2.P()) {
938+
ROOT::Math::PtEtaPhiMVector v3 = v1;
939+
v1 = v2;
940+
v2 = v3;
941+
}
942+
943+
// momentum of e+ and e- in (ax,ay,az) axis. Note that az=0 by definition.
944+
// vector product of pep X pem
945+
float vpx = 0, vpy = 0, vpz = 0;
946+
if (t1.sign() * t2.sign() > 0) { // Like Sign
947+
if (bz * t1.sign() < 0) {
948+
vpx = v1.Py() * v2.Pz() - v1.Pz() * v2.Py();
949+
vpy = v1.Pz() * v2.Px() - v1.Px() * v2.Pz();
950+
vpz = v1.Px() * v2.Py() - v1.Py() * v2.Px();
951+
} else {
952+
vpx = v2.Py() * v1.Pz() - v2.Pz() * v1.Py();
953+
vpy = v2.Pz() * v1.Px() - v2.Px() * v1.Pz();
954+
vpz = v2.Px() * v1.Py() - v2.Py() * v1.Px();
955+
}
956+
} else { // Unlike Sign
957+
if (bz * t1.sign() > 0) {
958+
vpx = v1.Py() * v2.Pz() - v1.Pz() * v2.Py();
959+
vpy = v1.Pz() * v2.Px() - v1.Px() * v2.Pz();
960+
vpz = v1.Px() * v2.Py() - v1.Py() * v2.Px();
961+
} else {
962+
vpx = v2.Py() * v1.Pz() - v2.Pz() * v1.Py();
963+
vpy = v2.Pz() * v1.Px() - v2.Px() * v1.Pz();
964+
vpz = v2.Px() * v1.Py() - v2.Py() * v1.Px();
965+
}
966+
}
967+
968+
// unit vector of pep X pem
969+
float vx = vpx / TMath::Sqrt(vpx * vpx + vpy * vpy + vpz * vpz);
970+
float vy = vpy / TMath::Sqrt(vpx * vpx + vpy * vpy + vpz * vpz);
971+
float vz = vpz / TMath::Sqrt(vpx * vpx + vpy * vpy + vpz * vpz);
972+
973+
float px = v12.Px();
974+
float py = v12.Py();
975+
float pz = v12.Pz();
976+
977+
// unit vector of (pep+pem)
978+
float ux = px / TMath::Sqrt(px * px + py * py + pz * pz);
979+
float uy = py / TMath::Sqrt(px * px + py * py + pz * pz);
980+
float uz = pz / TMath::Sqrt(px * px + py * py + pz * pz);
981+
float ax = uy / TMath::Sqrt(ux * ux + uy * uy);
982+
float ay = -ux / TMath::Sqrt(ux * ux + uy * uy);
983+
984+
// The third axis defined by vector product (ux,uy,uz)X(vx,vy,vz)
985+
float wx = uy * vz - uz * vy;
986+
float wy = uz * vx - ux * vz;
987+
// by construction, (wx,wy,wz) must be a unit vector. Measure angle between (wx,wy,wz) and (ax,ay,0).
988+
// The angle between them should be small if the pair is conversion. This function then returns values close to pi!
989+
values[kPairPhiv] = TMath::ACos(wx * ax + wy * ay); // phiv in [0,pi] //cosPhiV = wx * ax + wy * ay;
990+
}
925991
}
926992

927993
template <int pairType, typename T1, typename T2>
@@ -1399,4 +1465,4 @@ void VarManager::FillDileptonHadron(T1 const& dilepton, T2 const& hadron, float*
13991465
values[kDeltaEta] = dilepton.eta() - hadron.eta();
14001466
}
14011467
}
1402-
#endif
1468+
#endif // PWGDQ_CORE_VARMANAGER_H_

0 commit comments

Comments
 (0)