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
253 changes: 138 additions & 115 deletions PWGHF/HFL/Tasks/taskSingleElectron.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#include "Common/DataModel/PIDResponse.h"
#include "Common/DataModel/TrackSelectionTables.h"

#include "Framework/AnalysisTask.h"
#include "Framework/ASoAHelpers.h"
#include "Framework/AnalysisTask.h"
#include "Framework/runDataProcessing.h"

using namespace o2;
Expand Down Expand Up @@ -56,8 +56,8 @@
using TracksEl = soa::Join<aod::Tracks, aod::TrackExtra, aod::TracksDCA, aod::pidTOFFullEl, aod::pidTPCFullEl>;

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

Check failure on line 59 in PWGHF/HFL/Tasks/taskSingleElectron.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.

// Partition

// ConfigurableAxis
Expand All @@ -71,7 +71,7 @@
const AxisSpec axisPt{nBinsPt, 0., 15., "p_{T}"};
const AxisSpec axisNsig{800, -20., 20.};
const AxisSpec axisTrackIp{4000, -0.2, 0.2, "dca"};
const AxisSpec axisDeltaPhi{nBinsDeltaPhi, -PIHalf, PI+PIHalf, "#Delta#varphi"};
const AxisSpec axisDeltaPhi{nBinsDeltaPhi, -PIHalf, PI + PIHalf, "#Delta#varphi"};
const AxisSpec axisDeltaEta{nBinsDeltaEta, -1.0, +1.0, "#Delta#eta"};

// Histogram registry
Expand All @@ -80,136 +80,159 @@
void init(InitContext const&)
{
// create histograms
histos.add("hEventCounter", "hEventCounter", kTH1F, {axisEvt});
histos.add("nEvents", "Number of events", kTH1F, {{1, 0., 1.}});
histos.add("VtxZ", "VtxZ; cm; entries", kTH1F, {axisPosZ});
histos.add("hEventCounter", "hEventCounter", kTH1F, {axisEvt});
histos.add("nEvents", "Number of events", kTH1F, {{1, 0., 1.}});
histos.add("VtxZ", "VtxZ; cm; entries", kTH1F, {axisPosZ});
histos.add("etaTrack", "etaTrack; #eta; entries", kTH1F, {axisEta});
histos.add("ptTrack", "#it{p}_{T} distribution of selected tracks; #it{p}_{T} (GeV/#it{c}); entries", kTH1F, {axisPt});

// QA plots for trigger track selection
histos.add("tpcNClsTrack", "tpcNClsTrack", kTH1F, {{200, 0, 200}});
histos.add("tpcFoundFindableTrack", "", kTH1F, {{10, 0, 1}});
histos.add("tpcChi2Track", "", kTH1F, {{100, 0, 10}});
histos.add("itsIBClsTrack", "", kTH1F, {{10, 0, 10}});
histos.add("dcaXYTrack", "", kTH1F, {{600, -3, 3}});
histos.add("dcaZTrack", "", kTH1F, {{600, -3, 3}});

// QA plots for associated track selection
histos.add("tpcNClsAsso", "tpcNClsAsso", kTH1F, {{200, 0, 200}});
histos.add("tpcFoundFindableAsso", "", kTH1F, {{10, 0, 1}});
histos.add("tpcChi2Asso", "", kTH1F, {{100, 0, 10}});
histos.add("itsIBClsAsso", "", kTH1F, {{10, 0, 10}});
histos.add("dcaXYAsso", "", kTH1F, {{600, -3, 3}});
histos.add("dcaZAsso", "", kTH1F, {{600, -3, 3}});

histos.add("correlationFunction", "correlationFunction", kTH1F, {axisDeltaPhi});
histos.add("correlationFunction2d", "correlationFunction2d", kTH2F, {axisDeltaPhi, axisDeltaEta});

// pid
histos.add("tofNSigPt", "", kTH2F, {{axisPtEl}, {axisNsig}});
histos.add("tofNSigPtQA", "", kTH2F, {{axisPtEl}, {axisNsig}});
histos.add("tpcNSigPt", "", kTH2F, {{axisPtEl}, {axisNsig}});
histos.add("tpcNSigPtAfterTofCut", "", kTH2F, {{axisPtEl}, {axisNsig}});
histos.add("tpcNSigPtQA", "", kTH2F, {{axisPtEl}, {axisNsig}});

// track impact parameter
histos.add("dcaTrack", "", kTH2F, {{axisPtEl}, {axisTrackIp}});

// QA plots for trigger track selection
histos.add("tpcNClsTrack", "tpcNClsTrack", kTH1F, {{200, 0, 200}});
histos.add("tpcFoundFindableTrack", "", kTH1F, {{10, 0, 1}});
histos.add("tpcChi2Track", "", kTH1F, {{100, 0, 10}});
histos.add("itsIBClsTrack", "", kTH1F, {{10, 0, 10}});
histos.add("dcaXYTrack", "", kTH1F, {{600, -3, 3}});
histos.add("dcaZTrack", "", kTH1F, {{600, -3, 3}});

// QA plots for associated track selection
histos.add("tpcNClsAsso", "tpcNClsAsso", kTH1F, {{200, 0, 200}});
histos.add("tpcFoundFindableAsso", "", kTH1F, {{10, 0, 1}});
histos.add("tpcChi2Asso", "", kTH1F, {{100, 0, 10}});
histos.add("itsIBClsAsso", "", kTH1F, {{10, 0, 10}});
histos.add("dcaXYAsso", "", kTH1F, {{600, -3, 3}});
histos.add("dcaZAsso", "", kTH1F, {{600, -3, 3}});

histos.add("correlationFunction", "correlationFunction", kTH1F, {axisDeltaPhi});
histos.add("correlationFunction2d", "correlationFunction2d", kTH2F, {axisDeltaPhi, axisDeltaEta});

// pid
histos.add("tofNSigPt", "", kTH2F, {{axisPtEl}, {axisNsig}});
histos.add("tofNSigPtQA", "", kTH2F, {{axisPtEl}, {axisNsig}});
histos.add("tpcNSigPt", "", kTH2F, {{axisPtEl}, {axisNsig}});
histos.add("tpcNSigPtAfterTofCut", "", kTH2F, {{axisPtEl}, {axisNsig}});
histos.add("tpcNSigPtQA", "", kTH2F, {{axisPtEl}, {axisNsig}});

// track impact parameter
histos.add("dcaTrack", "", kTH2F, {{axisPtEl}, {axisTrackIp}});
}

template <typename TrackType>
bool TrackSel(TrackType track){
if(track.pt() > ptTrackMax || track.pt() < ptTrackMin) return false;
if(std::abs(track.eta()) > etaTrackMax) return false;

int tpcNClsFound = track.tpcNClsCrossedRows();
int tpcNClsFindable = track.tpcNClsFindable();
float tpcFoundOverFindable = (tpcNClsFindable ? static_cast<float>(tpcNClsFound)/static_cast<float>(tpcNClsFindable) : 0);

if(tpcNClsFound < ptcNCrossedRowMax) return false;
if(tpcFoundOverFindable < tpcNClsFoundOverFindableMin) return false;
if(track.tpcChi2NCl() > tpcChi2perNClMax) return false;

if(!(track.itsNClsInnerBarrel()==itsIBClsMin)) return false;

if(std::abs(track.dcaXY()) > dcaxyMax) return false;
if(std::abs(track.dcaZ()) > dcazMax) return false;
bool TrackSel(TrackType track)
{
if (track.pt() > ptTrackMax || track.pt() < ptTrackMin)
return false;
if (std::abs(track.eta()) > etaTrackMax)
return false;

int tpcNClsFound = track.tpcNClsCrossedRows();
int tpcNClsFindable = track.tpcNClsFindable();
float tpcFoundOverFindable = (tpcNClsFindable ? static_cast<float>(tpcNClsFound) / static_cast<float>(tpcNClsFindable) : 0);

if (tpcNClsFound < ptcNCrossedRowMax)
return false;
if (tpcFoundOverFindable < tpcNClsFoundOverFindableMin)
return false;
if (track.tpcChi2NCl() > tpcChi2perNClMax)
return false;

if (!(track.itsNClsInnerBarrel() == itsIBClsMin))
return false;

if (std::abs(track.dcaXY()) > dcaxyMax)
return false;
if (std::abs(track.dcaZ()) > dcazMax)
return false;

histos.fill(HIST("etaTrack"), track.eta());
histos.fill(HIST("ptTrack"), track.pt());
histos.fill(HIST("tpcNClsTrack"), tpcNClsFound);
histos.fill(HIST("tpcFoundFindableTrack"), tpcFoundOverFindable);
histos.fill(HIST("tpcChi2Track"), track.tpcChi2NCl());
histos.fill(HIST("itsIBClsTrack"), track.itsNClsInnerBarrel());
histos.fill(HIST("dcaXYTrack"), track.dcaXY());
histos.fill(HIST("dcaZTrack"), track.dcaZ());
return true;

histos.fill(HIST("tpcNClsTrack"), tpcNClsFound);
histos.fill(HIST("tpcFoundFindableTrack"), tpcFoundOverFindable);
histos.fill(HIST("tpcChi2Track"), track.tpcChi2NCl());
histos.fill(HIST("itsIBClsTrack"), track.itsNClsInnerBarrel());
histos.fill(HIST("dcaXYTrack"), track.dcaXY());
histos.fill(HIST("dcaZTrack"), track.dcaZ());

return true;
}

template <typename TrackType>
bool AssoTrackSel(TrackType track){

if(std::abs(track.eta()) > etaTrackMax) return false;
if (track.pt() < 4.0f || track.pt() > 6.0f) return false;

int tpcNClsFound = track.tpcNClsCrossedRows();
int tpcNClsFindable = track.tpcNClsFindable();
float tpcFoundOverFindable = (tpcNClsFindable ? static_cast<float>(tpcNClsFound)/static_cast<float>(tpcNClsFindable) : 0);

if(tpcNClsFound < 60) return false;
if(track.tpcChi2NCl() > tpcChi2perNClMax) return false;

if(std::abs(track.dcaXY()) > dcaxyMax) return false;
if(std::abs(track.dcaZ()) > dcazMax) return false;

histos.fill(HIST("tpcNClsAsso"), tpcNClsFound);
histos.fill(HIST("tpcFoundFindableAsso"), tpcFoundOverFindable);
histos.fill(HIST("tpcChi2Asso"), track.tpcChi2NCl());
histos.fill(HIST("itsIBClsAsso"), track.itsNClsInnerBarrel());
histos.fill(HIST("dcaXYAsso"), track.dcaXY());
histos.fill(HIST("dcaZAsso"), track.dcaZ());

return true;
bool AssoTrackSel(TrackType track)
{

if (std::abs(track.eta()) > etaTrackMax)
return false;
if (track.pt() < 4.0f || track.pt() > 6.0f)

Check failure on line 165 in PWGHF/HFL/Tasks/taskSingleElectron.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.
return false;

int tpcNClsFound = track.tpcNClsCrossedRows();
int tpcNClsFindable = track.tpcNClsFindable();
float tpcFoundOverFindable = (tpcNClsFindable ? static_cast<float>(tpcNClsFound) / static_cast<float>(tpcNClsFindable) : 0);

if (tpcNClsFound < 60)

Check failure on line 172 in PWGHF/HFL/Tasks/taskSingleElectron.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.
return false;
if (track.tpcChi2NCl() > tpcChi2perNClMax)
return false;

if (std::abs(track.dcaXY()) > dcaxyMax)
return false;
if (std::abs(track.dcaZ()) > dcazMax)
return false;

histos.fill(HIST("tpcNClsAsso"), tpcNClsFound);
histos.fill(HIST("tpcFoundFindableAsso"), tpcFoundOverFindable);
histos.fill(HIST("tpcChi2Asso"), track.tpcChi2NCl());
histos.fill(HIST("itsIBClsAsso"), track.itsNClsInnerBarrel());
histos.fill(HIST("dcaXYAsso"), track.dcaXY());
histos.fill(HIST("dcaZAsso"), track.dcaZ());

return true;
}

double ComputeDeltaPhi(double phi1, double phi2){
double deltaPhi = phi1 - phi2;
if (deltaPhi < -PIHalf) deltaPhi += 2. * PI;
if (deltaPhi > 3. * PIHalf) deltaPhi -= 2. * PI;
return deltaPhi;
double ComputeDeltaPhi(double phi1, double phi2)
{
double deltaPhi = phi1 - phi2;
if (deltaPhi < -PIHalf)
deltaPhi += 2. * PI;

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

View workflow job for this annotation

GitHub Actions / O2 linter

[pi-multiple-fraction]

Use multiples/fractions of PI defined in o2::constants::math.

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

View workflow job for this annotation

GitHub Actions / O2 linter

[two-pi-add-subtract]

Use RecoDecay::constrainAngle to restrict angle to a given range.
if (deltaPhi > 3. * PIHalf)

Check failure on line 197 in PWGHF/HFL/Tasks/taskSingleElectron.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.
deltaPhi -= 2. * PI;

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

View workflow job for this annotation

GitHub Actions / O2 linter

[pi-multiple-fraction]

Use multiples/fractions of PI defined in o2::constants::math.

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

View workflow job for this annotation

GitHub Actions / O2 linter

[two-pi-add-subtract]

Use RecoDecay::constrainAngle to restrict angle to a given range.
return deltaPhi;
}

void process(soa::Filtered<MyCollisions>::iterator const& collision, TracksEl const& tracks)
{
histos.fill(HIST("hEventCounter"), 0.5);

if(!collision.sel8()) return;
histos.fill(HIST("hEventCounter"), 1.5);

if(collision.numContrib()<2) return;
histos.fill(HIST("hEventCounter"), 2.5);

histos.fill(HIST("VtxZ"), collision.posZ());
histos.fill(HIST("hEventCounter"), 3.5);
histos.fill(HIST("nEvents"), 0.5);

for (auto& track : tracks) {

if (!TrackSel(track)) continue;

histos.fill(HIST("tofNSigPt"), track.pt(), track.tofNSigmaEl());
histos.fill(HIST("tpcNSigPt"), track.pt(), track.tpcNSigmaEl());

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

if(track.tpcNSigmaEl() < tpcNSigmaMin || track.tpcNSigmaEl() > tpcNSigmaMax) continue;
histos.fill(HIST("tpcNSigPtQA"), track.pt(), track.tpcNSigmaEl());

histos.fill(HIST("dcaTrack"), track.pt(), track.dcaXY());
histos.fill(HIST("hEventCounter"), 0.5);

if (!collision.sel8())
return;
histos.fill(HIST("hEventCounter"), 1.5);

if (collision.numContrib() < 2)

Check failure on line 210 in PWGHF/HFL/Tasks/taskSingleElectron.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.
return;
histos.fill(HIST("hEventCounter"), 2.5);

histos.fill(HIST("VtxZ"), collision.posZ());
histos.fill(HIST("hEventCounter"), 3.5);
histos.fill(HIST("nEvents"), 0.5);

for (auto& track : tracks) {

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

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.

if (!TrackSel(track))
continue;

histos.fill(HIST("tofNSigPt"), track.pt(), track.tofNSigmaEl());
histos.fill(HIST("tpcNSigPt"), track.pt(), track.tpcNSigmaEl());

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

if (track.tpcNSigmaEl() < tpcNSigmaMin || track.tpcNSigmaEl() > tpcNSigmaMax)
continue;
histos.fill(HIST("tpcNSigPtQA"), track.pt(), track.tpcNSigmaEl());

histos.fill(HIST("dcaTrack"), track.pt(), track.dcaXY());
}
}
};
Expand Down
Loading