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
15 changes: 12 additions & 3 deletions Common/Core/fwdtrackUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#ifndef COMMON_CORE_FWDTRACKUTILITIES_H_
#define COMMON_CORE_FWDTRACKUTILITIES_H_

#include <Framework/AnalysisDataModel.h>
#include <Framework/DataTypes.h>
#include <GlobalTracking/MatchGlobalFwd.h>
#include <MCHTracking/TrackExtrap.h>
Expand Down Expand Up @@ -48,22 +47,32 @@
using SMatrix55Std = ROOT::Math::SMatrix<double, 5>;
using SMatrix5 = ROOT::Math::SVector<double, 5>;

template <typename T>
concept is_fwd_track = requires(T t) {
{ t.rAtAbsorberEnd() } -> std::same_as<float>;
};

template <typename T>
concept is_fwd_cov = requires(T t) {
{ t.sigmaX() } -> std::same_as<float>;
};

/// Produce TrackParCovFwds for MFT and FwdTracks, w/ or w/o cov, with z shift
template <typename TFwdTrack, typename... TCovariance>
o2::track::TrackParCovFwd getTrackParCovFwdShift(TFwdTrack const& track, float zshift, TCovariance const&... covOpt)
{
double chi2 = track.chi2();
if constexpr (sizeof...(covOpt) == 0) {
// No covariance passed
if constexpr (std::is_same_v<std::decay_t<TFwdTrack>, aod::FwdTracks::iterator>) {
if constexpr (is_fwd_track<TFwdTrack>) {
if (track.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) {
chi2 = track.chi2() * (2.f * track.nClusters() - 5.f);
}
}
} else {
// Covariance passed
using TCov = std::decay_t<decltype((covOpt, ...))>;
if constexpr (std::is_same_v<TCov, aod::FwdTracksCov::iterator>) {
if constexpr (is_fwd_cov<TCov>) {
if (track.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) {
chi2 = track.chi2() * (2.f * track.nClusters() - 5.f);
}
Expand Down Expand Up @@ -144,7 +153,7 @@
o2::dataformats::GlobalFwdTrack propmuon;
o2::globaltracking::MatchGlobalFwd mMatching;

if (trackType > 2) { // MCH-MID or MCH standalone

Check failure on line 156 in Common/Core/fwdtrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
o2::dataformats::GlobalFwdTrack track;
track.setParameters(fwdtrack.getParameters());
track.setZ(fwdtrack.getZ());
Expand All @@ -165,7 +174,7 @@
propmuon.setParameters(proptrack.getParameters());
propmuon.setZ(proptrack.getZ());
propmuon.setCovariances(proptrack.getCovariances());
} else if (trackType < 2) { // MFT-MCH-MID

Check failure on line 177 in Common/Core/fwdtrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
// const double centerMFT[3] = {0, 0, -61.4};
// o2::field::MagneticField* field = static_cast<o2::field::MagneticField*>(TGeoGlobalMagField::Instance()->GetField());
// auto Bz = field->getBz(centerMFT); // Get field at centre of MFT in kG.
Expand Down
1 change: 0 additions & 1 deletion PWGJE/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ o2physics_target_root_dictionary(PWGJECore
FastJetUtilities.h
JetTaggingUtilities.h
JetBkgSubUtils.h
JetDerivedDataUtilities.h
emcalCrossTalkEmulation.h
utilsTrackMatchingEMC.h
LINKDEF PWGJECoreLinkDef.h)
Expand Down
158 changes: 158 additions & 0 deletions PWGUD/Core/decayTree.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <Framework/HistogramRegistry.h>
#include <Framework/Logger.h>

#include <TDatabasePDG.h>

Check failure on line 17 in PWGUD/Core/decayTree.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/database]

Do not use TDatabasePDG directly. Use o2::constants::physics::Mass... or Service<o2::framework::O2DatabasePDG> instead.

#include <rapidjson/document.h>
#include <rapidjson/filereadstream.h>
Expand Down Expand Up @@ -140,7 +140,7 @@
fmomHistMax = 3.0;

// invariant mass
fIVM = TLorentzVector(0., 0., 0., 0.);

Check failure on line 143 in PWGUD/Core/decayTree.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
fCharge = 0;

// pid cuts
Expand Down Expand Up @@ -231,7 +231,7 @@
// decayTree
decayTree::decayTree()
{
fPDG = TDatabasePDG::Instance();

Check failure on line 234 in PWGUD/Core/decayTree.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/database]

Do not use TDatabasePDG directly. Use o2::constants::physics::Mass... or Service<o2::framework::O2DatabasePDG> instead.
}

bool decayTree::init(std::string const& parFile, o2::framework::HistogramRegistry& registry)
Expand Down Expand Up @@ -335,7 +335,7 @@
if (fin.HasMember(itemName)) {
if (fin[itemName].IsArray()) {
auto lims = fin[itemName].GetArray();
if (lims.Size() == 2) {

Check failure on line 338 in PWGUD/Core/decayTree.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
newRes->setPtRange(lims[0].GetFloat(), lims[1].GetFloat());
} else {
LOGF(error, "Check the parameter file! %s must have two elements!", itemName);
Expand All @@ -354,7 +354,7 @@
if (fin.HasMember(itemName)) {
if (fin[itemName].IsArray()) {
auto lims = fin[itemName].GetArray();
if (lims.Size() == 2) {

Check failure on line 357 in PWGUD/Core/decayTree.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
newRes->setEtaRange(lims[0].GetFloat(), lims[1].GetFloat());
} else {
LOGF(error, "Check the parameter file! %s must have two elements!", itemName);
Expand All @@ -377,7 +377,7 @@
if (fin.HasMember(itemName)) {
if (fin[itemName].IsArray()) {
auto hits = fin[itemName].GetArray();
if (hits.Size() == 4) {

Check failure on line 380 in PWGUD/Core/decayTree.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
newRes->setDetectorHits(hits[0].GetInt(), hits[1].GetInt(), hits[2].GetInt(), hits[3].GetInt());
} else {
LOGF(error, "Check the parameter file! %s must have four elements!", itemName);
Expand All @@ -396,7 +396,7 @@
if (fin.HasMember(itemName)) {
if (fin[itemName].IsArray()) {
auto lims = fin[itemName].GetArray();
if (lims.Size() == 2) {

Check failure on line 399 in PWGUD/Core/decayTree.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
newRes->setNcltpcRange(lims[0].GetFloat(), lims[1].GetFloat());
} else {
LOGF(error, "Check the parameter file! %s must have two elements!", itemName);
Expand All @@ -415,7 +415,7 @@
if (fin.HasMember(itemName)) {
if (fin[itemName].IsArray()) {
auto lims = fin[itemName].GetArray();
if (lims.Size() == 2) {

Check failure on line 418 in PWGUD/Core/decayTree.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
newRes->setChi2ncltpcRange(lims[0].GetFloat(), lims[1].GetFloat());
} else {
LOGF(error, "Check the parameter file! %s must have two elements!", itemName);
Expand Down Expand Up @@ -1228,4 +1228,162 @@
return copes;
}

void decayTree::createHistograms(o2::framework::HistogramRegistry& registry)
{
// definitions
auto etax = o2::framework::AxisSpec(100, -1.5, 1.5);
auto nSax = o2::framework::AxisSpec(300, -15.0, 15.0);
auto chi2ax = o2::framework::AxisSpec(100, 0.0, 5.0);
auto nClax = o2::framework::AxisSpec(170, 0.0, 170.0);
auto angax = o2::framework::AxisSpec(315, 0.0, 3.15);
auto dcaxyax = o2::framework::AxisSpec(400, -0.2, 0.2);
auto dcazax = o2::framework::AxisSpec(600, -0.3, 0.3);
auto sTPCax = o2::framework::AxisSpec(1000, 0., 1000.);

std::string base;
std::string hname;
std::string annot;
fhistPointers.clear();
for (const auto& res : getResonances()) {
auto max = o2::framework::AxisSpec(res->nmassBins(), res->massHistRange()[0], res->massHistRange()[1]);
auto momax = o2::framework::AxisSpec(res->nmomBins(), res->momHistRange()[0], res->momHistRange()[1]);

// M-pT, M-eta, pT-eta
for (const auto& cc : fccs) {
base = cc;
base.append("/").append(res->name()).append("/");
hname = base + "mpt";
annot = "M versus pT; M (" + res->name() + ") GeV/c^{2}; pT (" + res->name() + ") GeV/c";
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, momax}})});
hname = base + "meta";
annot = "M versus eta; M (" + res->name() + ") GeV/c^{2}; eta (" + res->name() + ")";
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, etax}})});
hname = base + "pteta";
annot = "pT versus eta; pT (" + res->name() + ") GeV/c; eta (" + res->name() + ")";
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {momax, etax}})});

// M versus daughters
auto daughs = res->getDaughters();
auto ndaughs = daughs.size();
for (auto i = 0; i < static_cast<int>(ndaughs); i++) {
auto d1 = getResonance(daughs[i]);

// M vs pT daughter
hname = base;
hname.append("MvspT_").append(res->name()).append(d1->name());
annot = "M versus pT; M (" + res->name() + ") GeV/c^{2}; pT (" + d1->name() + ") GeV/c";
auto momax1 = o2::framework::AxisSpec(d1->nmomBins(), d1->momHistRange()[0], d1->momHistRange()[1]);
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, momax1}})});

// M vs eta daughter
hname = base;
hname.append("Mvseta_").append(res->name()).append(d1->name());
annot = "M versus eta; M (" + res->name() + ") GeV/c^{2}; eta (" + d1->name() + ")";
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, etax}})});

if (d1->isFinal()) {
// M vs dcaXYZ
hname = base;
hname.append("MvsdcaXY_").append(res->name()).append(d1->name());
annot = "M versus dcaXY; M (" + res->name() + ") GeV/c^{2}; dca_{XY} (" + d1->name() + ") #mu m";
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, dcaxyax}})});
hname = base;
hname.append("MvsdcaZ_").append(res->name()).append(d1->name());
annot = "M versus dcaZ; M (" + res->name() + ") GeV/c^{2}; dca_{Z} (" + d1->name() + ") #mu m";
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, dcazax}})});

// M vs chi2 track
hname = base;
hname.append("Mvschi2_").append(res->name()).append(d1->name());
annot = "M versus chi2; M (" + res->name() + ") GeV/c^{2}; chi2 (" + d1->name() + ")";
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, chi2ax}})});

// M vs nCl track
hname = base;
hname.append("MvsnCl_").append(res->name()).append(d1->name());
annot = "M versus nCl; M (" + res->name() + ") GeV/c^{2}; nCl (" + d1->name() + ")";
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, nClax}})});

// M versus detector hits
hname = base;
hname.append("MvsdetHits_").append(res->name()).append(d1->name());
annot = "M versus detector hits; M (" + res->name() + ") GeV/c^{2}; ITS + 2*TPC + 4*TRD + 8*TOF (" + d1->name() + ")";
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, {16, -0.5, 15.5}}})});
} else {
// M vs Mi
hname = base;
hname.append("MvsM_").append(res->name()).append(d1->name());
annot = "M versus M; M (" + res->name() + ") GeV/c^{2}; M (" + d1->name() + ") GeV/c^{2}";
auto max1 = o2::framework::AxisSpec(res->nmassBins(), d1->massHistRange()[0], d1->massHistRange()[1]);
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, max1}})});
}
}

// daughters vs daughters
for (auto i = 0; i < static_cast<int>(ndaughs - 1); i++) {
auto d1 = getResonance(daughs[i]);
auto max1 = o2::framework::AxisSpec(d1->nmassBins(), d1->massHistRange()[0], d1->massHistRange()[1]);
for (auto j = i + 1; j < static_cast<int>(ndaughs); j++) {
auto d2 = getResonance(daughs[j]);
auto max2 = o2::framework::AxisSpec(d2->nmassBins(), d2->massHistRange()[0], d2->massHistRange()[1]);

// M1 vs M2
hname = base;
hname.append("MvsM_").append(d1->name()).append(d2->name());
annot = std::string("M versus M; M (").append(d1->name()).append(") GeV/c^{2}; M (").append(d2->name()).append(") GeV/c^{2}");
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max1, max2}})});

// angle(d1, d2)
hname = base;
hname.append("angle_").append(d1->name()).append(d2->name());
annot = std::string("angle; Angle (").append(d1->name()).append(", ").append(d2->name()).append(")");
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH1F, {angax}})});

// M vs angle(d1, d2)
hname = base;
hname.append("Mvsangle_").append(d1->name()).append(d2->name());
annot = std::string("M versus angle; M (").append(res->name()).append(") GeV/c^{2}; Angle (").append(d1->name()).append(", ").append(d2->name()).append(")");
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, angax}})});

// both daughters are finals
if (d1->isFinal() && d2->isFinal()) {
hname = base;
hname.append("TPCsignal_").append(d1->name()).append(d2->name());
annot = std::string("TPC signal of both tracks; TPCsignal (").append(d1->name()).append("); TPCsignal (").append(d2->name()).append(")");
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {sTPCax, sTPCax}})});
}
}
}

// for finals only
if (res->isFinal()) {
// dca
hname = base;
hname.append("dcaXY");
annot = std::string("dcaXY; dca_{XY}(").append(res->name()).append(")");
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH1F, {dcaxyax}})});
hname = base;
hname.append("dcaZ");
annot = std::string("dcaZ; dca_{Z}(").append(res->name()).append(")");
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH1F, {dcazax}})});

// nSIgma[TPC, TOF] vs pT
for (const auto& det : fdets) {
for (const auto& part : fparts) {
hname = base;
hname.append("nS").append(part).append(det);
annot = std::string("nSigma_").append(det).append(" versus p; p (").append(res->name()).append(") GeV/c; nSigma_{").append(det).append(", ").append(part).append("} (").append(res->name()).append(")");
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {momax, nSax}})});
}
}

// detector hits
hname = base;
hname.append("detectorHits");
annot = std::string("detectorHits; Detector(").append(res->name()).append(")");
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH1F, {{4, 0.5, 4.5}}})});
}
}
}
}
// -----------------------------------------------------------------------------
Loading
Loading