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
154 changes: 79 additions & 75 deletions PWGUD/Tasks/ptSpectraInclusiveUpc.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 PWGUD/Tasks/ptSpectraInclusiveUpc.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.)
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand Down Expand Up @@ -43,8 +43,8 @@
using namespace o2::framework;
using namespace o2::framework::expressions;

struct ptSpectraInclusiveUpc{
struct ptSpectraInclusiveUpc {

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

Configurable<int> nBinsPt{"nBinsPt", 100, "N bins in pT histos"};
Expand Down Expand Up @@ -76,7 +76,8 @@
const double sigmaMax = 3.;
const double dcaZlimit = 2.;

void init(InitContext const&){
void init(InitContext const&)
{

massPion = o2::constants::physics::MassPionCharged;
massKaon = o2::constants::physics::MassKaonCharged;
Expand All @@ -88,52 +89,53 @@
const AxisSpec axisDCAxy{nBinsDCAxy, -0.6, 0.6, "DCA_{xy} cm"};

// histograms
histos.add("ptGeneratedPion", "ptGeneratedPion", kTH1F, {axisPt});
histos.add("ptGeneratedKaon", "ptGeneratedKaon", kTH1F, {axisPt});
histos.add("ptGeneratedPion", "ptGeneratedPion", kTH1F, {axisPt});
histos.add("ptGeneratedKaon", "ptGeneratedKaon", kTH1F, {axisPt});
histos.add("ptGeneratedProton", "ptGeneratedProton", kTH1F, {axisPt});

histos.add("ptReconstructedTPCPion", "ptReconstructedTPCPion", kTH1F, {axisPt});
histos.add("ptReconstructedTPCKaon", "ptReconstructedTPCKaon", kTH1F, {axisPt});
histos.add("ptReconstructedTPCPion", "ptReconstructedTPCPion", kTH1F, {axisPt});
histos.add("ptReconstructedTPCKaon", "ptReconstructedTPCKaon", kTH1F, {axisPt});
histos.add("ptReconstructedTPCProton", "ptReconstructedTPCProton", kTH1F, {axisPt});

histos.add("ptReconstructedTOFPion", "ptReconstructedTOFPion", kTH1F, {axisPt});
histos.add("ptReconstructedTOFKaon", "ptReconstructedTOFKaon", kTH1F, {axisPt});
histos.add("ptReconstructedTOFPion", "ptReconstructedTOFPion", kTH1F, {axisPt});
histos.add("ptReconstructedTOFKaon", "ptReconstructedTOFKaon", kTH1F, {axisPt});
histos.add("ptReconstructedTOFProton", "ptReconstructedTOFProton", kTH1F, {axisPt});

histos.add("ptDataTPCPion", "ptDataTPCPion", kTH1F, {axisPt});
histos.add("ptDataTPCKaon", "ptDataTPCKaon", kTH1F, {axisPt});
histos.add("ptDataTPCPion", "ptDataTPCPion", kTH1F, {axisPt});
histos.add("ptDataTPCKaon", "ptDataTPCKaon", kTH1F, {axisPt});
histos.add("ptDataTPCProton", "ptDataTPCProton", kTH1F, {axisPt});

histos.add("ptDataTOFPion", "ptDataTOFPion", kTH1F, {axisPt});
histos.add("ptDataTOFKaon", "ptDataTOFKaon", kTH1F, {axisPt});
histos.add("ptDataTOFPion", "ptDataTOFPion", kTH1F, {axisPt});
histos.add("ptDataTOFKaon", "ptDataTOFKaon", kTH1F, {axisPt});
histos.add("ptDataTOFProton", "ptDataTOFProton", kTH1F, {axisPt});

histos.add("myEventCounter", "myEventCounter", kTH1F, {axisEventCounter});
histos.add("DCAxy_primary_pions", "DCAxy_primary_pions", kTH1F, {axisDCAxy});
histos.add("DCAxy_primary_pions", "DCAxy_primary_pions", kTH1F, {axisDCAxy});
histos.add("DCAxy_secondary_pions", "DCAxy_secondary_pions", kTH1F, {axisDCAxy});
histos.add("DCAxy_primary_kaons", "DCAxy_primary_kaons", kTH1F, {axisDCAxy});
histos.add("DCAxy_primary_kaons", "DCAxy_primary_kaons", kTH1F, {axisDCAxy});
histos.add("DCAxy_secondary_kaons", "DCAxy_secondary_kaons", kTH1F, {axisDCAxy});
histos.add("DCAxy_primary_protons", "DCAxy_primary_protons", kTH1F, {axisDCAxy});
histos.add("DCAxy_primary_protons", "DCAxy_primary_protons", kTH1F, {axisDCAxy});
histos.add("DCAxy_secondary_protons", "DCAxy_secondary_protons", kTH1F, {axisDCAxy});
histos.add("DCAxy_material_protons", "DCAxy_material_protons", kTH1F, {axisDCAxy});
histos.add("DCAxy_data_pions", "DCAxy_data_pions", kTH1F, {axisDCAxy});
histos.add("DCAxy_data_kaons", "DCAxy_data_kaons", kTH1F, {axisDCAxy});
histos.add("DCAxy_data_pions", "DCAxy_data_pions", kTH1F, {axisDCAxy});
histos.add("DCAxy_data_kaons", "DCAxy_data_kaons", kTH1F, {axisDCAxy});
histos.add("DCAxy_data_protons", "DCAxy_data_protons", kTH1F, {axisDCAxy});
}

void processSim(aod::UDMcCollisions::iterator const& mcCollision, aod::UDMcParticles const& mcParticles){
void processSim(aod::UDMcCollisions::iterator const& mcCollision, aod::UDMcParticles const& mcParticles)
{

for (const auto& mcParticle : mcParticles){
for (const auto& mcParticle : mcParticles) {
if (!mcParticle.isPhysicalPrimary())
continue;

LorentzVectorM pMC(mcParticle.px(), mcParticle.py(), mcParticle.pz(), massPion);
if (applyKineCutsInGen){

if (applyKineCutsInGen) {
if (fabs(pMC.Eta()) > etaMax)

Check failure on line 135 in PWGUD/Tasks/ptSpectraInclusiveUpc.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
continue;

if (fabs(pMC.Rapidity()) > yMax)

Check failure on line 138 in PWGUD/Tasks/ptSpectraInclusiveUpc.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
continue;

if (pMC.Pt() < ptMin)
Expand All @@ -158,7 +160,8 @@
}
}

void processReco(CC const& collision, TCs const& tracks, aod::UDMcParticles const& mcParticles){
void processReco(CC const& collision, TCs const& tracks, aod::UDMcParticles const& mcParticles)
{

Partition<TCs> pvContributors = aod::udtrack::isPVContributor == true;
pvContributors.bindTable(tracks);
Expand All @@ -172,9 +175,9 @@
auto nSigmaKaTOF = -999.;
auto nSigmaPrTOF = -999.;

LorentzVectorM *pion = new LorentzVectorM();
LorentzVectorM *kaon = new LorentzVectorM();
LorentzVectorM *proton = new LorentzVectorM();
LorentzVectorM* pion = new LorentzVectorM();
LorentzVectorM* kaon = new LorentzVectorM();
LorentzVectorM* proton = new LorentzVectorM();

for (const auto& track : tracks) {
if (!track.isPVContributor()) {
Expand All @@ -186,7 +189,7 @@
}

if (track.pt() < ptMin) {
continue;
continue;
}

if (!(std::abs(track.dcaZ()) < dcaZlimit)) {
Expand All @@ -213,18 +216,18 @@
proton->SetPz(track.pz());
proton->SetM(massProton);

if (!track.has_udMcParticle()){
if (!track.has_udMcParticle()) {
continue;
}
auto mcParticle = track.udMcParticle();

bool has_tpc = false;
// TPC tracks
if (track.hasTPC()) {
has_tpc = true;
nSigmaPi = track.tpcNSigmaPi();
nSigmaKa = track.tpcNSigmaKa();
nSigmaPr = track.tpcNSigmaPr();
has_tpc = true;
nSigmaPi = track.tpcNSigmaPi();
nSigmaKa = track.tpcNSigmaKa();
nSigmaPr = track.tpcNSigmaPr();

if (std::abs(nSigmaPi) < sigmaMax) {
if (std::abs(pion->Rapidity()) > yMax) {
Expand All @@ -233,9 +236,9 @@

if (mcParticle.isPhysicalPrimary()) {
histos.fill(HIST("ptReconstructedTPCPion"), pion->Pt());
//selEv = true;
// selEv = true;
histos.fill(HIST("DCAxy_primary_pions"), track.dcaXY());
}else{
} else {
histos.fill(HIST("DCAxy_secondary_pions"), track.dcaXY());
}
}
Expand All @@ -246,9 +249,9 @@

if (mcParticle.isPhysicalPrimary()) {
histos.fill(HIST("ptReconstructedTPCKaon"), kaon->Pt());
//selEv = true;
// selEv = true;
histos.fill(HIST("DCAxy_primary_kaons"), track.dcaXY());
}else{
} else {
histos.fill(HIST("DCAxy_secondary_kaons"), track.dcaXY());
}
}
Expand All @@ -260,25 +263,23 @@

if (mcParticle.isPhysicalPrimary()) {
histos.fill(HIST("ptReconstructedTPCProton"), proton->Pt());
//selEv = true;
// selEv = true;
histos.fill(HIST("DCAxy_primary_protons"), track.dcaXY());
}else{
} else {
if (mcParticle.getProcess() == kPDecay) {
histos.fill(HIST("DCAxy_secondary_protons"), track.dcaXY());
}
else{
} else {
histos.fill(HIST("DCAxy_material_protons"), track.dcaXY());
}
}
}

}

// TPC tracks
if (track.hasTOF()) {
nSigmaPi = track.tofNSigmaPi();
nSigmaKa = track.tofNSigmaKa();
nSigmaPr = track.tofNSigmaPr();
nSigmaPi = track.tofNSigmaPi();
nSigmaKa = track.tofNSigmaKa();
nSigmaPr = track.tofNSigmaPr();

if (std::abs(nSigmaPi) < sigmaMax) {
if (std::abs(pion->Rapidity()) > yMax) {
Expand All @@ -287,9 +288,11 @@

if (mcParticle.isPhysicalPrimary()) {
histos.fill(HIST("ptReconstructedTOFPion"), pion->Pt());
if(!has_tpc) histos.fill(HIST("DCAxy_primary_pions"), track.dcaXY());
}else{
if(!has_tpc) histos.fill(HIST("DCAxy_secondary_pions"), track.dcaXY());
if (!has_tpc)
histos.fill(HIST("DCAxy_primary_pions"), track.dcaXY());
} else {
if (!has_tpc)
histos.fill(HIST("DCAxy_secondary_pions"), track.dcaXY());
}
}
if (std::abs(nSigmaKa) < sigmaMax) {
Expand All @@ -299,9 +302,11 @@

if (mcParticle.isPhysicalPrimary()) {
histos.fill(HIST("ptReconstructedTOFKaon"), kaon->Pt());
if(!has_tpc) histos.fill(HIST("DCAxy_primary_kaons"), track.dcaXY());
}else{
if(!has_tpc) histos.fill(HIST("DCAxy_secondary_kaons"), track.dcaXY());
if (!has_tpc)
histos.fill(HIST("DCAxy_primary_kaons"), track.dcaXY());
} else {
if (!has_tpc)
histos.fill(HIST("DCAxy_secondary_kaons"), track.dcaXY());
}
}

Expand All @@ -312,24 +317,24 @@

if (mcParticle.isPhysicalPrimary()) {
histos.fill(HIST("ptReconstructedTOFProton"), proton->Pt());
if(!has_tpc) histos.fill(HIST("DCAxy_primary_protons"), track.dcaXY());
}else{
if(!has_tpc) {
if (!has_tpc)
histos.fill(HIST("DCAxy_primary_protons"), track.dcaXY());
} else {
if (!has_tpc) {
if (mcParticle.getProcess() == kPDecay) {
histos.fill(HIST("DCAxy_secondary_protons"), track.dcaXY());
}
else{
} else {
histos.fill(HIST("DCAxy_material_protons"), track.dcaXY());
}
}
}
}

}
}
}

void processData(CC const& collision, TCs const& tracks){
void processData(CC const& collision, TCs const& tracks)
{

Partition<TCs> pvContributors = aod::udtrack::isPVContributor == true;
pvContributors.bindTable(tracks);
Expand All @@ -343,9 +348,9 @@
auto nSigmaKaTOF = -999.;
auto nSigmaPrTOF = -999.;

LorentzVectorM *pion = new LorentzVectorM();
LorentzVectorM *kaon = new LorentzVectorM();
LorentzVectorM *proton = new LorentzVectorM();
LorentzVectorM* pion = new LorentzVectorM();
LorentzVectorM* kaon = new LorentzVectorM();
LorentzVectorM* proton = new LorentzVectorM();

for (const auto& track : tracks) {
if (!track.isPVContributor()) {
Expand All @@ -357,7 +362,7 @@
}

if (track.pt() < ptMin) {
continue;
continue;
}

if (!(std::abs(track.dcaZ()) < dcaZlimit)) {
Expand Down Expand Up @@ -387,10 +392,10 @@
bool has_tpc = false;
// TPC tracks
if (track.hasTPC()) {
has_tpc = true;
nSigmaPi = track.tpcNSigmaPi();
nSigmaKa = track.tpcNSigmaKa();
nSigmaPr = track.tpcNSigmaPr();
has_tpc = true;
nSigmaPi = track.tpcNSigmaPi();
nSigmaKa = track.tpcNSigmaKa();
nSigmaPr = track.tpcNSigmaPr();

if (std::abs(nSigmaPi) < sigmaMax) {
if (std::abs(pion->Rapidity()) > yMax) {
Expand All @@ -415,49 +420,48 @@
histos.fill(HIST("ptDataTPCProton"), proton->Pt());
histos.fill(HIST("DCAxy_data_protons"), track.dcaXY());
}

}

// TPC tracks
if (track.hasTOF()) {
nSigmaPi = track.tofNSigmaPi();
nSigmaKa = track.tofNSigmaKa();
nSigmaPr = track.tofNSigmaPr();
nSigmaPi = track.tofNSigmaPi();
nSigmaKa = track.tofNSigmaKa();
nSigmaPr = track.tofNSigmaPr();

if (std::abs(nSigmaPi) < sigmaMax) {
if (std::abs(pion->Rapidity()) > yMax) {
continue;
}
histos.fill(HIST("ptDataTOFPion"), pion->Pt());
if(!has_tpc) histos.fill(HIST("DCAxy_data_pions"), track.dcaXY());
if (!has_tpc)
histos.fill(HIST("DCAxy_data_pions"), track.dcaXY());
}
if (std::abs(nSigmaKa) < sigmaMax) {
if (std::abs(kaon->Rapidity()) > yMax) {
continue;
}
histos.fill(HIST("ptDataTOFKaon"), kaon->Pt());
if(!has_tpc) histos.fill(HIST("DCAxy_data_kaons"), track.dcaXY());
if (!has_tpc)
histos.fill(HIST("DCAxy_data_kaons"), track.dcaXY());
}

if (std::abs(nSigmaPr) < sigmaMax) {
if (std::abs(proton->Rapidity()) > yMax) {
continue;
}
histos.fill(HIST("ptDataTOFProton"), proton->Pt());
if(!has_tpc) histos.fill(HIST("DCAxy_data_protons"), track.dcaXY());
if (!has_tpc)
histos.fill(HIST("DCAxy_data_protons"), track.dcaXY());
}

}
}
}


PROCESS_SWITCH(ptSpectraInclusiveUpc, processSim, "processSim", true);

PROCESS_SWITCH(ptSpectraInclusiveUpc, processReco, "processReco", true);

PROCESS_SWITCH(ptSpectraInclusiveUpc, processData, "processData", true);

};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
Expand Down
Loading