Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 10 additions & 2 deletions PWGLF/DataModel/LFStrangenessTables.h
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 warning on line 1 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Provide mandatory file documentation.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand All @@ -8,7 +8,7 @@
// 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.
#ifndef PWGLF_DATAMODEL_LFSTRANGENESSTABLES_H_

Check warning on line 11 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.

Check warning on line 11 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \brief is missing, incorrect or misplaced.

Check warning on line 11 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \author is missing, incorrect or misplaced.
#define PWGLF_DATAMODEL_LFSTRANGENESSTABLES_H_

#include <cmath>
Expand Down Expand Up @@ -243,6 +243,11 @@
using StraCollision = StraCollisions::iterator;
using StraCent = StraCents::iterator;

namespace stramccollision
{
DECLARE_SOA_COLUMN(TotalMultMCParticles, totalMultMCParticles, int); //! total number of MC particles in a generated collision
} // namespace stramccollision

//______________________________________________________
// for correlating information with MC
// also allows for collision association cross-checks
Expand All @@ -253,11 +258,14 @@
o2::soa::Index<>, mccollision::PosX, mccollision::PosY, mccollision::PosZ,
mccollision::ImpactParameter, mccollision::EventPlaneAngle);
using StraMCCollisions = StraMCCollisions_001;
using StraMCCollision = StraMCCollisions::iterator;

DECLARE_SOA_TABLE(StraMCCollMults, "AOD", "STRAMCCOLLMULTS", //! MC collision multiplicities
DECLARE_SOA_TABLE(StraMCCollMults_000, "AOD", "STRAMCCOLLMULTS", //! MC collision multiplicities
mult::MultMCFT0A, mult::MultMCFT0C, mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10, o2::soa::Marker<2>);
DECLARE_SOA_TABLE_VERSIONED(StraMCCollMults_001, "AOD", "STRAMCCOLLMULTS", 1, //! MC collision multiplicities
mult::MultMCFT0A, mult::MultMCFT0C, mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10, stramccollision::TotalMultMCParticles);

using StraMCCollision = StraMCCollisions::iterator;
using StraMCCollMults = StraMCCollMults_001;

namespace dautrack
{
Expand All @@ -265,10 +273,10 @@
// Daughter track declarations for derived data analysis
// These definitions are for the first version of the table
// The latest version will inherit most properties from TracksExtra
DECLARE_SOA_COLUMN(ITSChi2PerNcl, itsChi2PerNcl, float); //! ITS chi2 per N cluster

Check warning on line 276 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(DetectorMap, detectorMap, uint8_t); //! detector map for reference (see DetectorMapEnum)
DECLARE_SOA_COLUMN(ITSClusterSizes, itsClusterSizes, uint32_t); //! ITS cluster sizes per layer

Check warning on line 278 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(TPCClusters, tpcClusters, uint8_t); //! N TPC clusters

Check warning on line 279 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(TPCCrossedRows, tpcCrossedRows, uint8_t); //! N TPC clusters

//______________________________________________________
Expand Down Expand Up @@ -556,7 +564,7 @@
// Distance Over To Mom
DECLARE_SOA_DYNAMIC_COLUMN(DistOverTotMom, distovertotmom, //! PV to V0decay distance over total momentum
[](float X, float Y, float Z, float Px, float Py, float Pz, float pvX, float pvY, float pvZ) {
float P = RecoDecay::sqrtSumOfSquares(Px, Py, Pz);

Check warning on line 567 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
return std::sqrt(std::pow(X - pvX, 2) + std::pow(Y - pvY, 2) + std::pow(Z - pvZ, 2)) / (P + 1E-10);
});

Expand Down Expand Up @@ -592,14 +600,14 @@
DECLARE_SOA_DYNAMIC_COLUMN(PFracPos, pfracpos,
[](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) {
float ppos = RecoDecay::sqrtSumOfSquares(pxpos, pypos, pzpos);
float PV0 = RecoDecay::sqrtSumOfSquares(pxpos + pxneg, pypos + pyneg, pzpos + pzneg);

Check warning on line 603 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
return (ppos / PV0);
});

DECLARE_SOA_DYNAMIC_COLUMN(PFracNeg, pfracneg,
[](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) {
float pneg = RecoDecay::sqrtSumOfSquares(pxneg, pyneg, pzneg);
float PV0 = RecoDecay::sqrtSumOfSquares(pxpos + pxneg, pypos + pyneg, pzpos + pzneg);

Check warning on line 610 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
return (pneg / PV0);
});

Expand Down
5 changes: 5 additions & 0 deletions PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,9 @@ o2physics_add_dpl_workflow(stramccollisionconverter
o2physics_add_dpl_workflow(strastampsconverter
SOURCES strastampsconverter.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(stramccollmultconverter
SOURCES stramccollmultconverter.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// 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.
//
// 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.
#include "Framework/runDataProcessing.h"
#include "Framework/AnalysisTask.h"
#include "Framework/AnalysisDataModel.h"
#include "PWGLF/DataModel/LFStrangenessTables.h"

using namespace o2;
using namespace o2::framework;

// Converts V0 version 001 to 002
struct stramccollmultconverter {
Produces<aod::StraMCCollMults_001> straMCCollMults_001;

void process(aod::StraMCCollMults_000 const& straMCcolls)
{
for (auto& straMCcoll : straMCcolls) {
straMCCollMults_001(straMCcoll.multMCFT0A(),
straMCcoll.multMCFT0C(),
straMCcoll.multMCNParticlesEta05(),
straMCcoll.multMCNParticlesEta08(),
straMCcoll.multMCNParticlesEta10(),
-1 /* dummy value for totalMultMCParticles */);
}
}
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<stramccollmultconverter>(cfgc)};
}
41 changes: 34 additions & 7 deletions PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include "Common/DataModel/PIDResponse.h"
#include "Common/DataModel/Qvectors.h"
#include "Framework/StaticFor.h"
#include "Framework/O2DatabasePDGPlugin.h"
#include "Common/DataModel/McCollisionExtra.h"
#include "PWGLF/DataModel/EPCalibrationTables.h"

Expand Down Expand Up @@ -202,6 +203,8 @@ struct strangederivedbuilder {
Preslice<aod::McParticles> mcParticlePerMcCollision = o2::aod::mcparticle::mcCollisionId;
Preslice<UDCollisionsFull> udCollisionsPerCollision = o2::aod::udcollision::collisionId;

Service<o2::framework::O2DatabasePDG> pdg;

std::vector<uint32_t> genK0Short;
std::vector<uint32_t> genLambda;
std::vector<uint32_t> genAntiLambda;
Expand Down Expand Up @@ -549,18 +552,42 @@ struct strangederivedbuilder {
}

// master function to process a collision
template <typename mccoll>
void populateMCCollisionTable(mccoll const& mcCollisions)
template <typename mccoll, typename mcparts>
void populateMCCollisionTable(mccoll const& mcCollisions, mcparts const& mcParticlesEntireTable)
{
// ______________________________________________
// fill all MC collisions, correlate via index later on
for (const auto& mccollision : mcCollisions) {
const uint64_t mcCollIndex = mccollision.globalIndex();
auto mcParticles = mcParticlesEntireTable.sliceBy(mcParticlePerMcCollision, mcCollIndex);

// count total MC multiplicity in generated collision
// reproduces what is done here:
// https://github.com/AliceO2Group/O2Physics/blob/master/Common/TableProducer/multiplicityTable.cxx#L654
int totalMult = 0;
for (const auto& mcPart : mcParticles) {
if (!mcPart.isPhysicalPrimary()) {
continue;
}

auto charge = 0.;
auto* p = pdg->GetParticle(mcPart.pdgCode());
if (p != nullptr) {
charge = p->Charge();
}
if (std::abs(charge) < 1e-3) {
continue; // reject neutral particles in counters
}
totalMult++;
}

strangeMCColl(mccollision.posX(), mccollision.posY(), mccollision.posZ(),
mccollision.impactParameter(), mccollision.eventPlaneAngle());
strangeMCMults(mccollision.multMCFT0A(), mccollision.multMCFT0C(),
mccollision.multMCNParticlesEta05(),
mccollision.multMCNParticlesEta08(),
mccollision.multMCNParticlesEta10());
mccollision.multMCNParticlesEta10(),
totalMult);
}
}

Expand All @@ -574,15 +601,15 @@ struct strangederivedbuilder {
populateCollisionTables(collisions, udCollisions, V0s, Cascades, KFCascades, TraCascades);
}

void processCollisionsWithMC(soa::Join<aod::Collisions, aod::FT0Mults, aod::FV0Mults, aod::FDDMults, aod::PVMults, aod::ZDCMults, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::CentFV0As, aod::EvSels, aod::McCollisionLabels, aod::MultsExtra, aod::MultsGlobal> const& collisions, soa::Join<aod::V0Datas, aod::McV0Labels> const& V0s, soa::Join<aod::V0MCCores, aod::V0MCCollRefs> const& /*V0MCCores*/, soa::Join<aod::CascDatas, aod::McCascLabels> const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, aod::BCsWithTimestamps const& /*bcs*/, soa::Join<aod::McCollisions, aod::McCollsExtra, aod::MultsExtraMC> const& mcCollisions, aod::McParticles const&)
void processCollisionsWithMC(soa::Join<aod::Collisions, aod::FT0Mults, aod::FV0Mults, aod::FDDMults, aod::PVMults, aod::ZDCMults, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::CentFV0As, aod::EvSels, aod::McCollisionLabels, aod::MultsExtra, aod::MultsGlobal> const& collisions, soa::Join<aod::V0Datas, aod::McV0Labels> const& V0s, soa::Join<aod::V0MCCores, aod::V0MCCollRefs> const& /*V0MCCores*/, soa::Join<aod::CascDatas, aod::McCascLabels> const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, aod::BCsWithTimestamps const& /*bcs*/, soa::Join<aod::McCollisions, aod::McCollsExtra, aod::MultsExtraMC> const& mcCollisions, aod::McParticles const& mcParticles)
{
populateMCCollisionTable(mcCollisions);
populateMCCollisionTable(mcCollisions, mcParticles);
populateCollisionTables(collisions, collisions, V0s, Cascades, KFCascades, TraCascades);
}

void processCollisionsWithUDWithMC(soa::Join<aod::Collisions, aod::FT0Mults, aod::FV0Mults, aod::FDDMults, aod::PVMults, aod::ZDCMults, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::CentFV0As, aod::EvSels, aod::McCollisionLabels, aod::MultsExtra, aod::MultsGlobal> const& collisions, soa::Join<aod::V0Datas, aod::McV0Labels> const& V0s, soa::Join<aod::V0MCCores, aod::V0MCCollRefs> const& /*V0MCCores*/, soa::Join<aod::CascDatas, aod::McCascLabels> const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, aod::BCsWithTimestamps const& /*bcs*/, UDCollisionsFull const& udCollisions, soa::Join<aod::McCollisions, aod::McCollsExtra, aod::MultsExtraMC> const& mcCollisions, aod::McParticles const&)
void processCollisionsWithUDWithMC(soa::Join<aod::Collisions, aod::FT0Mults, aod::FV0Mults, aod::FDDMults, aod::PVMults, aod::ZDCMults, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::CentFV0As, aod::EvSels, aod::McCollisionLabels, aod::MultsExtra, aod::MultsGlobal> const& collisions, soa::Join<aod::V0Datas, aod::McV0Labels> const& V0s, soa::Join<aod::V0MCCores, aod::V0MCCollRefs> const& /*V0MCCores*/, soa::Join<aod::CascDatas, aod::McCascLabels> const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, aod::BCsWithTimestamps const& /*bcs*/, UDCollisionsFull const& udCollisions, soa::Join<aod::McCollisions, aod::McCollsExtra, aod::MultsExtraMC> const& mcCollisions, aod::McParticles const& mcParticles)
{
populateMCCollisionTable(mcCollisions);
populateMCCollisionTable(mcCollisions, mcParticles);
populateCollisionTables(collisions, udCollisions, V0s, Cascades, KFCascades, TraCascades);
}

Expand Down
Loading