Skip to content
Merged
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
75 changes: 74 additions & 1 deletion PWGEM/Dilepton/Tasks/createTTP.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in PWGEM/Dilepton/Tasks/createTTP.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/workflow-file]

Name of a workflow file must match the name of the main struct in it (without the PWG prefix). (Class implementation files should be in "Core" directories.)

Check failure on line 1 in PWGEM/Dilepton/Tasks/createTTP.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-task]

Specify task name only when it cannot be derived from the struct name. Only append to the default name.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand All @@ -14,6 +14,7 @@
// This code creates parameters used in track tuner.
// Please write to: daiki.sekihata@cern.ch

#include "PWGEM/Dilepton/Utils/MCUtilities.h"
#include "PWGEM/Dilepton/Utils/PairUtilities.h"

#include "Common/CCDB/EventSelectionParams.h"
Expand Down Expand Up @@ -74,13 +75,13 @@

struct createTTP {
// Configurables
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};

Check failure on line 78 in PWGEM/Dilepton/Tasks/createTTP.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
Configurable<std::string> grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"};
Configurable<std::string> grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
Configurable<std::string> lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"};
Configurable<int> cfgEventGeneratorType{"cfgEventGeneratorType", -1, "if positive, select event generator type. i.e. gap or signal"};

ConfigurableAxis ConfPtBins{"ConfPtBins", {VARIABLE_WIDTH, 0.00, 0.10, 0.15, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.5, 6.0, 7.5, 7.0, 7.5, 8.0, 9.0, 10.0, 15, 20}, "pT bins for output histograms"};

Check failure on line 84 in PWGEM/Dilepton/Tasks/createTTP.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
Configurable<int> cfgNbinsEta{"cfgNbinsEta", 20, "number of eta bins for output histograms"};
Configurable<int> cfgNbinsPhi{"cfgNbinsPhi", 36, "number of phi bins for output histograms"};
ConfigurableAxis ConfDCABins{"ConfDCABins", {200, -1000, +1000}, "DCA bins for output histograms"};
Expand Down Expand Up @@ -246,6 +247,8 @@
const AxisSpec axis_eta{cfgNbinsEta, -1, +1, "#eta"};
const AxisSpec axis_phi{cfgNbinsPhi, 0.0, 2 * M_PI, "#varphi (rad.)"};
const AxisSpec axis_sign{3, -1.5, +1.5, "sign"};
const AxisSpec axis_mass{400, 0, 4, "m_{ee} (GeV/c^{2})"};
const AxisSpec axis_ptee{100, 0, 10, "p_{T,ee} (GeV/c)"};

const AxisSpec axis_mean_dcaXY{ConfDCABins, "DCA_{xy} (#mum)"};
const AxisSpec axis_mean_dcaZ{ConfDCABins, "DCA_{z} (#mum)"};
Expand All @@ -255,6 +258,12 @@
fRegistry.add("Track/hs", "electron", kTHnSparseD, {axis_pt, axis_eta, axis_phi, axis_sign, axis_mean_dcaXY, axis_mean_dcaZ, axis_pull_dcaXY, axis_pull_dcaZ}, false);
fRegistry.add("Track/hTPCNsigmaEl", "TPC n sigma el;p_{in} (GeV/c);n #sigma_{e}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5.f, +5.f}}, false);
fRegistry.add("Pair/hMvsPhiV", "m_{ee} vs. #varphi_{V} ULS;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0.f, M_PI}, {100, 0, 0.1}});

if (doprocessMC) {
fRegistry.add("Pair/hMvsPt_omega", "#omega->ee", kTH2D, {axis_mass, axis_ptee}, false);
fRegistry.add("Pair/hMvsPt_phi", "#phi->ee", kTH2D, {axis_mass, axis_ptee}, false);
fRegistry.add("Pair/hMvsPt_jpsi", "J/#psi->ee", kTH2D, {axis_mass, axis_ptee}, false);
}
}

template <typename TTrack>
Expand Down Expand Up @@ -593,13 +602,20 @@
}
PROCESS_SWITCH(createTTP, processData, "process data", true);

struct lepton {
float pt{0};
float eta{0};
float phi{0};
int mcParticleId{-1};
};

using MyCollisionsMC = soa::Join<MyCollisions, aod::McCollisionLabels>;
using MyTracksMC = soa::Join<MyTracks, aod::McTrackLabels>;

using FilteredMyCollisionsMC = soa::Filtered<MyCollisionsMC>;
using FilteredMyTracksMC = soa::Filtered<MyTracksMC>;

void processMC(MyBCs const&, FilteredMyCollisionsMC const& collisions, FilteredMyTracksMC const& tracks, aod::McCollisions const&, aod::McParticles const&)
void processMC(MyBCs const&, FilteredMyCollisionsMC const& collisions, FilteredMyTracksMC const& tracks, aod::McCollisions const&, aod::McParticles const& mcParticles)
{
for (const auto& collision : collisions) {
if (!collision.has_mcCollision()) {
Expand All @@ -623,6 +639,9 @@
mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()});
mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ());

std::vector<lepton> posLeptons;
std::vector<lepton> negLeptons;

o2::dataformats::DCA mDcaInfoCov;
auto tracks_per_coll = tracks.sliceBy(perCol, collision.globalIndex());
for (const auto& track : tracks_per_coll) {
Expand All @@ -631,12 +650,15 @@
}
auto mcParticle = track.template mcParticle_as<aod::McParticles>();
auto mcCollision = mcParticle.template mcCollision_as<aod::McCollisions>();
if (std::abs(mcParticle.pdgCode()) != 11) {

Check failure on line 653 in PWGEM/Dilepton/Tasks/createTTP.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.

Check failure on line 653 in PWGEM/Dilepton/Tasks/createTTP.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
continue;
}
if (!(mcParticle.isPhysicalPrimary() || mcParticle.producedByGenerator())) {
continue;
}
if (!mcParticle.has_mothers()) {
continue;
}

if (cfgEventGeneratorType >= 0 && mcCollision.getSubGeneratorId() != cfgEventGeneratorType) {
continue;
Expand All @@ -655,7 +677,58 @@

fRegistry.fill(HIST("Track/hs"), trackParCov.getPt(), trackParCov.getEta(), RecoDecay::constrainAngle(trackParCov.getPhi(), 0, 1U), track.sign(), mDcaInfoCov.getY() * 1e+4, mDcaInfoCov.getZ() * 1e+4, mDcaInfoCov.getY() / std::sqrt(trackParCov.getSigmaY2()), mDcaInfoCov.getZ() / std::sqrt(trackParCov.getSigmaZ2()));

lepton tmp;
tmp.pt = trackParCov.getPt();
tmp.eta = trackParCov.getEta();
tmp.phi = RecoDecay::constrainAngle(trackParCov.getPhi(), 0, 1U);
tmp.mcParticleId = mcParticle.globalIndex();

if (track.sign() > 0) {
posLeptons.emplace_back(tmp);
} else {
negLeptons.emplace_back(tmp);
}
} // end of track loop

for (const auto& pos : posLeptons) {
for (const auto& neg : negLeptons) {
ROOT::Math::PtEtaPhiMVector v1(pos.pt, pos.eta, pos.phi, o2::constants::physics::MassElectron);
ROOT::Math::PtEtaPhiMVector v2(neg.pt, neg.eta, neg.phi, o2::constants::physics::MassElectron);
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;

auto posmc = mcParticles.rawIteratorAt(pos.mcParticleId);
auto negmc = mcParticles.rawIteratorAt(neg.mcParticleId);

int omegaId = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom2Prongs(posmc, negmc, -11, 11, 223, mcParticles);
int phiId = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom2Prongs(posmc, negmc, -11, 11, 333, mcParticles);
int jpsiId = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom2Prongs(posmc, negmc, -11, 11, 443, mcParticles);
if (omegaId > 0) {
auto mcMother = mcParticles.rawIteratorAt(omegaId);
int ndau = mcMother.daughtersIds()[1] - mcMother.daughtersIds()[0] + 1;
if (ndau == 2) {

Check failure on line 708 in PWGEM/Dilepton/Tasks/createTTP.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.
fRegistry.fill(HIST("Pair/hMvsPt_omega"), v12.M(), v12.Pt());
}
} else if (phiId > 0) {
auto mcMother = mcParticles.rawIteratorAt(phiId);
int ndau = mcMother.daughtersIds()[1] - mcMother.daughtersIds()[0] + 1;
if (ndau == 2) {

Check failure on line 714 in PWGEM/Dilepton/Tasks/createTTP.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.
fRegistry.fill(HIST("Pair/hMvsPt_phi"), v12.M(), v12.Pt());
}
} else if (jpsiId > 0) {
auto mcMother = mcParticles.rawIteratorAt(jpsiId);
int ndau = mcMother.daughtersIds()[1] - mcMother.daughtersIds()[0] + 1;
if (ndau == 2) {

Check failure on line 720 in PWGEM/Dilepton/Tasks/createTTP.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.
fRegistry.fill(HIST("Pair/hMvsPt_jpsi"), v12.M(), v12.Pt());
}
}
} // end of electron loop
} // end of positron loop

posLeptons.clear();
posLeptons.shrink_to_fit();
negLeptons.clear();
negLeptons.shrink_to_fit();

} // end of collision loop
}
PROCESS_SWITCH(createTTP, processMC, "process MC", false);
Expand All @@ -664,5 +737,5 @@
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<createTTP>(cfgc, TaskName{"create-ttp"})};

Check failure on line 740 in PWGEM/Dilepton/Tasks/createTTP.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-task]

Device names create-ttp and create-t-t-p generated from the specified task name create-ttp and from the struct name createTTP, respectively, differ in hyphenation. Consider fixing capitalisation of the struct name to CreateTtp and removing TaskName.
}
Loading