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
85 changes: 85 additions & 0 deletions PWGCF/EbyEFluctuations/Tasks/netprotcumulants.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,41 @@
using namespace o2::framework;
using namespace o2::framework::expressions;

namespace o2::aod
{

// ===== Event columns =====
DECLARE_SOA_COLUMN(EventId, eventId, int);
DECLARE_SOA_COLUMN(MyCent, myCent, float);
DECLARE_SOA_COLUMN(Vz, vz, float);
DECLARE_SOA_COLUMN(Ntrk, ntrk, int);
DECLARE_SOA_COLUMN(Np, np, int);
DECLARE_SOA_COLUMN(Npbar, npbar, int);

// ===== Track columns =====
DECLARE_SOA_COLUMN(Pt, pt, float);
DECLARE_SOA_COLUMN(Eta, eta, float);
DECLARE_SOA_COLUMN(Pid, pid, int);
DECLARE_SOA_COLUMN(Eff, eff, float);

// ===== Tables =====
DECLARE_SOA_TABLE(EventTable, "AOD", "MYEVENT",
EventId,
MyCent,
Vz,
Ntrk,
Np,
Npbar);

DECLARE_SOA_TABLE(MYTrackTable, "AOD", "MYTRACK",
EventId,
Pt,
Eta,
Pid,
Eff);

} // namespace o2::aod

struct NetProtCumulants {
// events
Configurable<float> cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"};
Expand Down Expand Up @@ -110,6 +145,26 @@

HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};

Produces<aod::EventTable> eventTable;
Produces<aod::MYTrackTable> trackTable;

int eventCounter = 0;
int eventId = 0;

// event variables
int Ntrk_event = 0;
int Np_event = 0;
int Npbar_event = 0;

float cent_event = 0;
float vz_event = 0;

// track variables
float pt_track = 0;
float eta_track = 0;
int pid_track = 0;
float eff_track = 0;

TRandom3* fRndm = new TRandom3(0);

// Eff histograms 2d: eff(pT, eta)
Expand All @@ -120,7 +175,7 @@

// Filter command for rec (data)***********
Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtLower) && (aod::track::pt < 5.0f) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t)true)) && (aod::track::tpcChi2NCl < cfgCutTpcChi2NCl) && (aod::track::itsChi2NCl < cfgCutItsChi2NCl) && (nabs(aod::track::dcaZ) < cfgCutDCAz) && (nabs(aod::track::dcaXY) < cfgCutDCAxy);

Check failure on line 178 in PWGCF/EbyEFluctuations/Tasks/netprotcumulants.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.

// filtering collisions and tracks for real data***********
using AodCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::CentFDDMs>>;
Expand Down Expand Up @@ -855,6 +910,7 @@
if (cfgUsePtDepDCAz) {
fPtDepDCAz = new TF1("ptDepDCAz", cfgDCAzFunc->c_str(), 0.001, 10.0);
}

} // end init()

template <typename T>
Expand All @@ -867,22 +923,22 @@
//! ----------------------------------------------------------------------
int flag = 0; //! pid check main flag

if (candidate.pt() > 0.2f && candidate.pt() <= cfgCutPtUpperTPC) {

Check failure on line 926 in PWGCF/EbyEFluctuations/Tasks/netprotcumulants.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.
if (std::abs(candidate.tpcNSigmaPr()) < cfgnSigmaCutTPC) {
flag = 1;
}
}
if (candidate.hasTOF() && candidate.pt() > cfgCutPtUpperTPC && candidate.pt() < 5.0f) {

Check failure on line 931 in PWGCF/EbyEFluctuations/Tasks/netprotcumulants.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.
const float combNSigmaPr = std::sqrt(std::pow(candidate.tpcNSigmaPr(), 2.0) + std::pow(candidate.tofNSigmaPr(), 2.0));
const float combNSigmaPi = std::sqrt(std::pow(candidate.tpcNSigmaPi(), 2.0) + std::pow(candidate.tofNSigmaPi(), 2.0));
const float combNSigmaKa = std::sqrt(std::pow(candidate.tpcNSigmaKa(), 2.0) + std::pow(candidate.tofNSigmaKa(), 2.0));

int flag2 = 0;
if (combNSigmaPr < 3.0)

Check failure on line 937 in PWGCF/EbyEFluctuations/Tasks/netprotcumulants.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.
flag2 += 1;
if (combNSigmaPi < 3.0)

Check failure on line 939 in PWGCF/EbyEFluctuations/Tasks/netprotcumulants.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.
flag2 += 1;
if (combNSigmaKa < 3.0)

Check failure on line 941 in PWGCF/EbyEFluctuations/Tasks/netprotcumulants.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.
flag2 += 1;
if (!(flag2 > 1) && !(combNSigmaPr > combNSigmaPi) && !(combNSigmaPr > combNSigmaKa)) {
if (combNSigmaPr < cfgnSigmaCutCombTPCTOF) {
Expand All @@ -906,7 +962,7 @@
//! ----------------------------------------------------------------------
int flag = 0; //! pid check main flag

if (candidate.pt() > 0.2f && candidate.pt() <= cfgCutPtUpperTPC) {

Check failure on line 965 in PWGCF/EbyEFluctuations/Tasks/netprotcumulants.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.
if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPr()) < cfgnSigmaCutTPC) {
flag = 1;
}
Expand All @@ -914,15 +970,15 @@
flag = 1;
}
}
if (candidate.hasTOF() && candidate.pt() > cfgCutPtUpperTPC && candidate.pt() < 5.0f) {

Check failure on line 973 in PWGCF/EbyEFluctuations/Tasks/netprotcumulants.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.
const float combNSigmaPr = std::sqrt(std::pow(candidate.tpcNSigmaPr(), 2.0) + std::pow(candidate.tofNSigmaPr(), 2.0));
const float combNSigmaPi = std::sqrt(std::pow(candidate.tpcNSigmaPi(), 2.0) + std::pow(candidate.tofNSigmaPi(), 2.0));
const float combNSigmaKa = std::sqrt(std::pow(candidate.tpcNSigmaKa(), 2.0) + std::pow(candidate.tofNSigmaKa(), 2.0));

int flag2 = 0;
if (combNSigmaPr < 3.0)

Check failure on line 979 in PWGCF/EbyEFluctuations/Tasks/netprotcumulants.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.
flag2 += 1;
if (combNSigmaPi < 3.0)

Check failure on line 981 in PWGCF/EbyEFluctuations/Tasks/netprotcumulants.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.
flag2 += 1;
if (combNSigmaKa < 3.0)
flag2 += 1;
Expand Down Expand Up @@ -2134,6 +2190,18 @@

void processDataRec(AodCollisions::iterator const& coll, aod::BCsWithTimestamps const&, AodTracks const& inputTracks)
{

// reset per event
Ntrk_event = 0;
Np_event = 0;
Npbar_event = 0;

// assign event ID
eventId = eventCounter++;

// store event info
cent_event = coll.centFT0C();
vz_event = coll.posZ();
if (!coll.sel8()) {
return;
}
Expand Down Expand Up @@ -2263,6 +2331,7 @@
if (cfgIfMandatoryTOF && !track.hasTOF()) {
continue;
}
Ntrk_event++;

bool trackSelected = false;
if (cfgPIDchoice == 0)
Expand Down Expand Up @@ -2293,11 +2362,18 @@

if (track.pt() < cfgCutPtUpper) {
nProt = nProt + 1.0;
Np_event++;
float pEff = getEfficiency(track); // get efficiency of track
if (pEff != 0) {
for (int i = 1; i < 7; i++) {
powerEffProt[i] += std::pow(1.0 / pEff, i);
}
pt_track = track.pt();
eta_track = track.eta();
pid_track = +1;
eff_track = pEff;

trackTable(eventId, pt_track, eta_track, pid_track, eff_track);
}
}
}
Expand All @@ -2311,18 +2387,27 @@
histos.fill(HIST("hrecDcaZAntiproton"), track.dcaZ());
if (track.pt() < cfgCutPtUpper) {
nAntiprot = nAntiprot + 1.0;
Npbar_event++;
float pEff = getEfficiency(track); // get efficiency of track
if (pEff != 0) {
for (int i = 1; i < 7; i++) {
powerEffAntiprot[i] += std::pow(1.0 / pEff, i);
}
pt_track = track.pt();
eta_track = track.eta();
pid_track = -1;
eff_track = pEff;

trackTable(eventId, pt_track, eta_track, pid_track, eff_track);
}
}
}

} //! checking PID
} //! end track loop

eventTable(eventId, cent_event, vz_event, Ntrk_event, Np_event, Npbar_event);

float netProt = nProt - nAntiprot;
float nTracks = nProt + nAntiprot;
histos.fill(HIST("hNTracksVsCent"), cent, nTracks);
Expand Down
Loading