Skip to content
Closed
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
120 changes: 85 additions & 35 deletions PWGHF/HFL/Tasks/taskSingleElectron.cxx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright
// holders. All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

Check failure on line 10 in PWGHF/HFL/Tasks/taskSingleElectron.cxx

View workflow job for this annotation

GitHub Actions / PR formatting / copyright headers

Missing or malformed copyright notice

This source file is missing the correct copyright notice.
///
/// \file taskSingleElectron.cxx
/// \brief task for electrons from heavy-flavour hadron decays
/// \author Jonghan Park (Jeonbuk National University)
/// \author Seul I Jeong (Pusan National University)

#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/PIDResponseTOF.h"
Expand Down Expand Up @@ -41,11 +42,9 @@
using namespace o2::framework;
using namespace o2::framework::expressions;

enum PdgCode {
kEta = 221,
kOmega = 223,
kEtaPrime = 331
};
enum PdgCode { kEta = 221,
kOmega = 223,
kEtaPrime = 331 };

enum SourceType {
NotElec = 0, // not electron
Expand Down Expand Up @@ -88,38 +87,63 @@
Configurable<float> ptTrackMax{"ptTrackMax", 10., "max pt cut"};
Configurable<float> ptTrackMin{"ptTrackMin", 0.5, "min pt cut"};
Configurable<float> etaTrackMax{"etaTrackMax", 0.8, "eta cut"};
Configurable<int> tpcNCrossedRowMin{"tpcNCrossedRowMin", 70, "max of TPC n cluster crossed rows"};
Configurable<float> tpcNClsFoundOverFindableMin{"tpcNClsFoundOverFindableMin", 0.8, "min # of TPC found/findable clusters"};
Configurable<float> tpcChi2perNClMax{"tpcChi2perNClMax", 4., "min # of tpc chi2 per clusters"};
Configurable<int> itsIBClsMin{"itsIBClsMin", 3, "min # of its clusters in IB"};
Configurable<float> itsChi2perNClMax{"itsChi2perNClMax", 6., "min # of tpc chi2 per clusters"};
Configurable<int> tpcNCrossedRowMin{"tpcNCrossedRowMin", 70,
"max of TPC n cluster crossed rows"};
Configurable<float> tpcNClsFoundOverFindableMin{
"tpcNClsFoundOverFindableMin", 0.8,
"min # of TPC found/findable clusters"};
Configurable<float> tpcChi2perNClMax{"tpcChi2perNClMax", 4.,
"min # of tpc chi2 per clusters"};
Configurable<int> itsIBClsMin{"itsIBClsMin", 3,
"min # of its clusters in IB"};
Configurable<float> itsChi2perNClMax{"itsChi2perNClMax", 6.,
"min # of tpc chi2 per clusters"};
Configurable<float> dcaxyMax{"dcaxyMax", 1., "max of track dca in xy"};
Configurable<float> dcazMax{"dcazMax", 2., "max of track dca in z"};
Configurable<float> tofNSigmaMax{"tofNSigmaMax", 3., "max of tof nsigma"};
Configurable<float> tpcNSigmaMin{"tpcNSigmaMin", -1., "min of tpc nsigma"};
Configurable<float> tpcNSigmaMax{"tpcNSigmaMax", 3., "max of tpc nsigma"};

Configurable<int> nBinsP{"nBinsP", 1500, "number of bins of particle momentum"};
Configurable<int> nBinsP{"nBinsP", 1500,
"number of bins of particle momentum"};
Configurable<int> nBinsPt{"nBinsPt", 100, "N bins in pT histo"};

Configurable<int> tpcNSigmaHadronMax{"tpcNSigmaHadronMax", -3,
"max of tpc hadron nsigma"};
Configurable<int> tpcNSigmaHadronMin{"tpcNSigmaHadronMin", -5,
"min of tpc hadron nsigma"};

// SliceCache
SliceCache cache;

// using declarations
using MyCollisions = soa::Join<aod::Collisions, aod::EvSels>;
using TracksEl = soa::Join<aod::Tracks, aod::TrackSelection, aod::TrackSelectionExtension, aod::TracksExtra, aod::TracksDCA, aod::pidTOFFullEl, aod::pidTPCFullEl>;
using McTracksEl = soa::Join<aod::Tracks, aod::TrackExtra, aod::TracksDCA, aod::pidTOFFullEl, aod::pidTPCFullEl, aod::McTrackLabels>;
using TracksEl =
soa::Join<aod::Tracks, aod::TrackSelection, aod::TrackSelectionExtension,
aod::TracksExtra, aod::TracksDCA, aod::pidTOFFullEl,
aod::pidTPCFullEl>;
using McTracksEl =
soa::Join<aod::Tracks, aod::TrackExtra, aod::TracksDCA, aod::pidTOFFullEl,
aod::pidTPCFullEl, aod::McTrackLabels>;

// Filter
Filter collZFilter = nabs(aod::collision::posZ) < posZMax;

// Partition

// ConfigurableAxis
ConfigurableAxis axisPtEl{"axisPtEl", {VARIABLE_WIDTH, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.75f, 2.0f, 2.25f, 2.5f, 2.75f, 3.f, 3.5f, 4.0f, 5.0f, 6.0f, 8.0f, 10.0f}, "electron pt bins"};
ConfigurableAxis axisPtEl{
"axisPtEl",
{VARIABLE_WIDTH, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.f, 1.1f,
1.2f, 1.3f, 1.4f, 1.5f, 1.75f, 2.0f, 2.25f, 2.5f,
2.75f, 3.f, 3.5f, 4.0f, 5.0f, 6.0f, 8.0f, 10.0f},
"electron pt bins"};

// Histogram registry
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
HistogramRegistry histos{
"histos",
{},
OutputObjHandlingPolicy::AnalysisObject};

void init(InitContext const&)
{
Expand All @@ -137,7 +161,10 @@
histos.add("nEvents", "Number of events", kTH1D, {{1, 0., 1.}});
histos.add("VtxZ", "VtxZ; cm; entries", kTH1D, {axisPosZ});
histos.add("etaTrack", "etaTrack; #eta; entries", kTH1D, {axisEta});
histos.add("ptTrack", "#it{p}_{T} distribution of selected tracks; #it{p}_{T} (GeV/#it{c}); entries", kTH1D, {axisPt});
histos.add("ptTrack",
"#it{p}_{T} distribution of selected tracks; #it{p}_{T} "
"(GeV/#it{c}); entries",
kTH1D, {axisPt});

// QA plots for trigger track selection
histos.add("tpcNClsTrack", "tpcNClsTrack", kTH1D, {{200, 0, 200}});
Expand All @@ -163,6 +190,7 @@
histos.add("dcaCharm", "", kTH2D, {{axisPtEl}, {axisTrackIp}});
histos.add("dcaDalitz", "", kTH2D, {{axisPtEl}, {axisTrackIp}});
histos.add("dcaConv", "", kTH2D, {{axisPtEl}, {axisTrackIp}});
histos.add("dcaHadron", "", kTH2D, {{axisPtEl}, {axisTrackIp}});

// QA plots for MC
histos.add("hPdgC", "", kTH1D, {{10001, -0.5, 10000.5}});
Expand Down Expand Up @@ -227,17 +255,20 @@
int grmotherPt = -999;
int ggrmotherPt = -999.; // mother, grand mother, grand grand mother pt

auto partMother = mcpart.template mothers_as<aod::McParticles>(); // first mother particle of electron
auto partMotherCopy = partMother; // copy of the first mother
auto mctrack = partMother; // will change all the time
auto partMother =
mcpart.template mothers_as<aod::McParticles>(); // first mother particle
// of electron
auto partMotherCopy = partMother; // copy of the first mother
auto mctrack = partMother; // will change all the time

motherPt = partMother.front().pt(); // first mother pt
motherPdg = std::abs(partMother.front().pdgCode()); // first mother pdg
mpt = motherPt; // copy of first mother pt
mpdg = motherPdg; // copy of first mother pdg

// check if electron from charm hadrons
if ((static_cast<int>(motherPdg / 100.) % 10) == kCharm || (static_cast<int>(motherPdg / 1000.) % 10) == kCharm) {
if ((static_cast<int>(motherPdg / 100.) % 10) == kCharm ||
(static_cast<int>(motherPdg / 1000.) % 10) == kCharm) {

// iterate until B hadron is found as an ancestor
while (partMother.size()) {
Expand All @@ -250,17 +281,21 @@
}
grmotherPt = mctrack.front().pt();
grmotherPdg = std::abs(mctrack.front().pdgCode());
if ((static_cast<int>(grmotherPdg / 100.) % 10) == kBottom || (static_cast<int>(grmotherPdg / 1000.) % 10) == kBottom) {
if ((static_cast<int>(grmotherPdg / 100.) % 10) == kBottom ||
(static_cast<int>(grmotherPdg / 1000.) % 10) == kBottom) {
mpt = grmotherPt;
mpdg = grmotherPdg;
return BeautyCharm;
}
}
partMother = mctrack;
}
} else if ((static_cast<int>(motherPdg / 100.) % 10) == kBottom || (static_cast<int>(motherPdg / 1000.) % 10) == kBottom) { // check if electron from beauty hadrons
} else if ((static_cast<int>(motherPdg / 100.) % 10) == kBottom ||
(static_cast<int>(motherPdg / 1000.) % 10) ==
kBottom) { // check if electron from beauty hadrons
return DirectBeauty;
} else if (motherPdg == kGamma) { // check if electron from photon conversion
} else if (motherPdg ==
kGamma) { // check if electron from photon conversion
mctrack = partMother.front().template mothers_as<aod::McParticles>();
if (mctrack.size()) {
auto const& grmothersIdsVec = mctrack.front().mothersIds();
Expand Down Expand Up @@ -451,7 +486,8 @@
histos.fill(HIST("ptTrack"), track.pt());

histos.fill(HIST("tpcNClsTrack"), track.tpcNClsCrossedRows());
histos.fill(HIST("tpcFoundFindableTrack"), track.tpcCrossedRowsOverFindableCls());
histos.fill(HIST("tpcFoundFindableTrack"),
track.tpcCrossedRowsOverFindableCls());
histos.fill(HIST("tpcChi2Track"), track.tpcChi2NCl());
histos.fill(HIST("itsIBClsTrack"), track.itsNClsInnerBarrel());
histos.fill(HIST("itsChi2Track"), track.itsChi2NCl());
Expand All @@ -467,11 +503,20 @@
}
histos.fill(HIST("tofNSigPtQA"), track.pt(), track.tofNSigmaEl());
histos.fill(HIST("tpcNSigPAfterTofCut"), track.p(), track.tpcNSigmaEl());
histos.fill(HIST("tpcNSigPtAfterTofCut"), track.pt(), track.tpcNSigmaEl());
histos.fill(HIST("tpcNSigPtAfterTofCut"), track.pt(),
track.tpcNSigmaEl());

if (track.tpcNSigmaEl() < tpcNSigmaMin || track.tpcNSigmaEl() > tpcNSigmaMax) {
if (track.tpcNSigmaEl() < tpcNSigmaMin ||
track.tpcNSigmaEl() > tpcNSigmaMax) {
continue;
}

if (track.tpcNSigmaEl() < tpcNSigmaHadronMax &&
track.tpcNSigmaEl() > tpcNSigmaHadronMin) {

histos.fill(HIST("dcaHadron"), track.pt(), track.dcaXY());
}

histos.fill(HIST("tpcNSigPtQA"), track.pt(), track.tpcNSigmaEl());

histos.fill(HIST("dcaTrack"), track.pt(), track.dcaXY());
Expand All @@ -480,8 +525,7 @@
PROCESS_SWITCH(HfTaskSingleElectron, processData, "For real data", true);

void processMc(soa::Filtered<MyCollisions>::iterator const& collision,
McTracksEl const& tracks,
aod::McParticles const&)
McTracksEl const& tracks, aod::McParticles const&)
{
float const flagAnalysedEvt = 0.5;

Expand All @@ -506,7 +550,8 @@
histos.fill(HIST("ptTrack"), track.pt());

histos.fill(HIST("tpcNClsTrack"), track.tpcNClsCrossedRows());
histos.fill(HIST("tpcFoundFindableTrack"), track.tpcCrossedRowsOverFindableCls());
histos.fill(HIST("tpcFoundFindableTrack"),
track.tpcCrossedRowsOverFindableCls());
histos.fill(HIST("tpcChi2Track"), track.tpcChi2NCl());
histos.fill(HIST("itsIBClsTrack"), track.itsNClsInnerBarrel());
histos.fill(HIST("dcaXYTrack"), track.dcaXY());
Expand Down Expand Up @@ -539,13 +584,19 @@
histos.fill(HIST("dcaDalitz"), track.pt(), track.dcaXY());
}

if (track.tpcNSigmaEl() < tpcNSigmaHadronMax &&
track.tpcNSigmaEl() > tpcNSigmaHadronMin)
histos.fill(HIST("dcaHadron"), track.pt(), track.dcaXY());

if (std::abs(track.tofNSigmaEl()) > tofNSigmaMax) {
continue;
}
histos.fill(HIST("tofNSigPtQA"), track.pt(), track.tofNSigmaEl());
histos.fill(HIST("tpcNSigPtAfterTofCut"), track.pt(), track.tpcNSigmaEl());
histos.fill(HIST("tpcNSigPtAfterTofCut"), track.pt(),
track.tpcNSigmaEl());

if (track.tpcNSigmaEl() < tpcNSigmaMin || track.tpcNSigmaEl() > tpcNSigmaMax) {
if (track.tpcNSigmaEl() < tpcNSigmaMin ||
track.tpcNSigmaEl() > tpcNSigmaMax) {
continue;
}
histos.fill(HIST("tpcNSigPtQA"), track.pt(), track.tpcNSigmaEl());
Expand All @@ -558,6 +609,5 @@

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<HfTaskSingleElectron>(cfgc)};
return WorkflowSpec{adaptAnalysisTask<HfTaskSingleElectron>(cfgc)};
}
Loading