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
183 changes: 98 additions & 85 deletions PWGLF/TableProducer/QC/sigma0QC.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 PWGLF/TableProducer/QC/sigma0QC.cxx

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,9 +8,9 @@
// 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 11 in PWGLF/TableProducer/QC/sigma0QC.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \author is missing, incorrect or misplaced.

Check failure on line 11 in PWGLF/TableProducer/QC/sigma0QC.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \brief is missing, incorrect or misplaced.

Check failure on line 11 in PWGLF/TableProducer/QC/sigma0QC.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.
// This is a task that employs the standard derived V0 tables and attempts to combine
// two V0s into a Sigma0 -> Lambda + gamma candidate.
// two V0s into a Sigma0 -> Lambda + gamma candidate.
// *+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*
// Sigma0 QC task
// *+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*
Expand All @@ -20,48 +20,50 @@
// gianni.shigeru.setoue.liveraro@cern.ch
//

#include <Math/Vector4D.h>
#include <cmath>
#include <array>
#include <cstdlib>
#include "PWGLF/DataModel/LFSigmaTables.h"
#include "PWGLF/DataModel/LFStrangenessMLTables.h"
#include "PWGLF/DataModel/LFStrangenessPIDTables.h"
#include "PWGLF/DataModel/LFStrangenessTables.h"
#include <PWGLF/Utils/sigma0BuilderHelper.h>

#include "Framework/runDataProcessing.h"
#include "Framework/AnalysisTask.h"
#include "Framework/AnalysisDataModel.h"
#include "Framework/ASoAHelpers.h"
#include "Framework/ASoA.h"
#include "ReconstructionDataFormats/Track.h"
#include "Common/CCDB/ctpRateFetcher.h"
#include "Common/Core/RecoDecay.h"
#include "Common/Core/trackUtilities.h"
#include "Common/Core/TrackSelection.h"
#include "Common/DataModel/TrackSelectionTables.h"
#include "Common/DataModel/EventSelection.h"
#include "Common/Core/trackUtilities.h"
#include "Common/DataModel/Centrality.h"
#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/PIDResponse.h"
#include "Common/CCDB/ctpRateFetcher.h"
#include "PWGLF/DataModel/LFStrangenessTables.h"
#include "PWGLF/DataModel/LFStrangenessPIDTables.h"
#include "PWGLF/DataModel/LFStrangenessMLTables.h"
#include "PWGLF/DataModel/LFSigmaTables.h"
#include "Common/DataModel/TrackSelectionTables.h"

#include "CCDB/BasicCCDBManager.h"
#include "Framework/ASoA.h"
#include "Framework/ASoAHelpers.h"
#include "Framework/AnalysisDataModel.h"
#include "Framework/AnalysisTask.h"
#include "Framework/runDataProcessing.h"
#include "ReconstructionDataFormats/Track.h"

#include <Math/Vector4D.h>
#include <TDatabasePDG.h>

Check failure on line 47 in PWGLF/TableProducer/QC/sigma0QC.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/database]

Do not use TDatabasePDG directly. Use o2::constants::physics::Mass... or Service<o2::framework::O2DatabasePDG> instead.
#include <TFile.h>
#include <TH2F.h>
#include <TProfile.h>
#include <TLorentzVector.h>

Check failure on line 50 in PWGLF/TableProducer/QC/sigma0QC.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
#include <TPDGCode.h>
#include <TDatabasePDG.h>
#include <PWGLF/Utils/sigma0BuilderHelper.h>
#include <TProfile.h>

#include <array>
#include <cmath>
#include <cstdlib>

using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;
using std::array;
using dauTracks = soa::Join<aod::DauTrackExtras, aod::DauTrackTPCPIDs>;

Check failure on line 62 in PWGLF/TableProducer/QC/sigma0QC.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/type]

Use UpperCamelCase for names of defined types (including concepts).
using V0StandardDerivedDatas = soa::Join<aod::V0Cores, aod::V0CollRefs, aod::V0Extras, aod::V0TOFPIDs, aod::V0TOFNSigmas, aod::V0LambdaMLScores, aod::V0AntiLambdaMLScores, aod::V0GammaMLScores>;
using StraColls = soa::Join<aod::StraCollisions, aod::StraCents, aod::StraEvSels, aod::StraStamps>;


struct sigma0Sorted {

Check failure on line 66 in PWGLF/TableProducer/QC/sigma0QC.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/struct]

Use UpperCamelCase for names of structs.
Service<o2::ccdb::BasicCCDBManager> ccdb;
ctpRateFetcher rateFetcher;

Expand All @@ -72,13 +74,13 @@
o2::pwglf::sigma0::photonselConfigurables photonselOpts;
o2::pwglf::sigma0::sigma0selConfigurables sigma0selOpts;
o2::pwglf::sigma0::pi0selConfigurables pi0selOpts;
o2::pwglf::sigma0::axisConfigurables axisOpts;
o2::pwglf::sigma0::axisConfigurables axisOpts;

o2::pwglf::sigma0::Sigma0BuilderModule sigma0Module;

// For manual sliceBy
// For manual sliceBy
SliceCache cache;
Preslice<V0StandardDerivedDatas> perCollisionSTDDerived = o2::aod::v0data::straCollisionId;
Preslice<V0StandardDerivedDatas> perCollisionSTDDerived = o2::aod::v0data::straCollisionId;

// Histogram registry
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
Expand All @@ -95,24 +97,26 @@
sigma0Module.init(histos, evselOpts, lambdaselOpts, photonselOpts, sigma0selOpts, pi0selOpts, axisOpts);
}

// Dummy process function
void process(StraColls const&){}
// Dummy process function
void process(StraColls const&) {}

void processRealData(StraColls const& collisions, V0StandardDerivedDatas const& fullV0s, dauTracks const&){
auto start = std::chrono::high_resolution_clock::now();
void processRealData(StraColls const& collisions, V0StandardDerivedDatas const& fullV0s, dauTracks const&)
{
auto start = std::chrono::high_resolution_clock::now();

sigma0Module.processSlicing(collisions, fullV0s, perCollisionSTDDerived, histos, ccdb, rateFetcher);

sigma0Module.processSlicing(collisions, fullV0s, perCollisionSTDDerived, histos, ccdb, rateFetcher);

auto end = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = end - start;
auto end = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = end - start;

if (fverbose) LOGF(info, "[Process function call, Sorted] N. Collisions: %i, N. V0s: %i, Processing time (s): %lf", collisions.size(), fullV0s.size(), elapsed.count());
if (fverbose)
LOGF(info, "[Process function call, Sorted] N. Collisions: %i, N. V0s: %i, Processing time (s): %lf", collisions.size(), fullV0s.size(), elapsed.count());
}
PROCESS_SWITCH(sigma0Sorted, processRealData, "process run 3 real data", true);

PROCESS_SWITCH(sigma0Sorted, processRealData, "process run 3 real data", true);
};

struct sigma0Unsorted {

Check failure on line 119 in PWGLF/TableProducer/QC/sigma0QC.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/struct]

Use UpperCamelCase for names of structs.
Service<o2::ccdb::BasicCCDBManager> ccdb;
ctpRateFetcher rateFetcher;

Expand All @@ -123,16 +127,16 @@
o2::pwglf::sigma0::photonselConfigurables photonselOpts;
o2::pwglf::sigma0::sigma0selConfigurables sigma0selOpts;
o2::pwglf::sigma0::pi0selConfigurables pi0selOpts;
o2::pwglf::sigma0::axisConfigurables axisOpts;
o2::pwglf::sigma0::axisConfigurables axisOpts;

o2::pwglf::sigma0::Sigma0BuilderModule sigma0Module;

// For manual sliceBy
// For manual sliceBy
SliceCache cache;
PresliceUnsorted<V0StandardDerivedDatas> perCollisionSTDDerived = o2::aod::v0data::straCollisionId;
PresliceUnsorted<V0StandardDerivedDatas> perCollisionSTDDerived = o2::aod::v0data::straCollisionId;

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

void init(InitContext const&)
{
Expand All @@ -146,21 +150,23 @@
sigma0Module.init(histos, evselOpts, lambdaselOpts, photonselOpts, sigma0selOpts, pi0selOpts, axisOpts);
}

// Dummy process function
void process(StraColls const&){}
// Dummy process function
void process(StraColls const&) {}

void processRealData(StraColls const& collisions, V0StandardDerivedDatas const& fullV0s, dauTracks const&)
{
auto start = std::chrono::high_resolution_clock::now();

void processRealData(StraColls const& collisions, V0StandardDerivedDatas const& fullV0s, dauTracks const&){
auto start = std::chrono::high_resolution_clock::now();
sigma0Module.processSlicing(collisions, fullV0s, perCollisionSTDDerived, histos, ccdb, rateFetcher);

sigma0Module.processSlicing(collisions, fullV0s, perCollisionSTDDerived, histos, ccdb, rateFetcher);

auto end = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = end - start;
auto end = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = end - start;

if (fverbose) LOGF(info, "[Process function call, Unsorted] N. Collisions: %i, N. V0s: %i, Processing time (s): %lf", collisions.size(), fullV0s.size(), elapsed.count());
if (fverbose)
LOGF(info, "[Process function call, Unsorted] N. Collisions: %i, N. V0s: %i, Processing time (s): %lf", collisions.size(), fullV0s.size(), elapsed.count());
}
PROCESS_SWITCH(sigma0Unsorted, processRealData, "process run 3 real data", true);

PROCESS_SWITCH(sigma0Unsorted, processRealData, "process run 3 real data", true);
};

struct sigma0Iterator {
Expand All @@ -174,13 +180,13 @@
o2::pwglf::sigma0::photonselConfigurables photonselOpts;
o2::pwglf::sigma0::sigma0selConfigurables sigma0selOpts;
o2::pwglf::sigma0::pi0selConfigurables pi0selOpts;
o2::pwglf::sigma0::axisConfigurables axisOpts;
o2::pwglf::sigma0::axisConfigurables axisOpts;

o2::pwglf::sigma0::Sigma0BuilderModule sigma0Module;

// Histogram registry
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
uint64_t CollIDBuffer = 0;

Check failure on line 189 in PWGLF/TableProducer/QC/sigma0QC.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
std::chrono::high_resolution_clock::time_point start{};
std::chrono::high_resolution_clock::time_point end{};
void init(InitContext const&)
Expand All @@ -195,37 +201,42 @@
sigma0Module.init(histos, evselOpts, lambdaselOpts, photonselOpts, sigma0selOpts, pi0selOpts, axisOpts);
}

// Dummy process function
void process(V0StandardDerivedDatas const&){}
// Dummy process function
void process(V0StandardDerivedDatas const&) {}

void processCheckIndexOrdered(V0StandardDerivedDatas const& fullV0s){
CollIDBuffer=0;
void processCheckIndexOrdered(V0StandardDerivedDatas const& fullV0s)
{
CollIDBuffer = 0;
for (const auto& v0 : fullV0s) {
const uint64_t v0collidx = v0.straCollisionId();
if (v0collidx < CollIDBuffer)
LOGF(fatal, "V0 -> stracollision: index unsorted! Previous index: %i, current index: %i", CollIDBuffer, v0collidx);
const uint64_t v0collidx = v0.straCollisionId();
if (v0collidx < CollIDBuffer)
LOGF(fatal, "V0 -> stracollision: index unsorted! Previous index: %i, current index: %i", CollIDBuffer, v0collidx);
CollIDBuffer = v0collidx;
}
}
void processTI(StraColls const&){
void processTI(StraColls const&)
{
start = std::chrono::high_resolution_clock::now();
}

void processRealData(StraColls::iterator const& collision, V0StandardDerivedDatas const& fullV0s, dauTracks const&){
sigma0Module.processIterator(collision, fullV0s, histos, ccdb, rateFetcher);
void processRealData(StraColls::iterator const& collision, V0StandardDerivedDatas const& fullV0s, dauTracks const&)
{
sigma0Module.processIterator(collision, fullV0s, histos, ccdb, rateFetcher);
}

void processTF(StraColls const& collisions, V0StandardDerivedDatas const& fullV0s){
void processTF(StraColls const& collisions, V0StandardDerivedDatas const& fullV0s)
{
end = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = end - start;

if (fverbose) LOGF(info, "[Process function call, Iterator] N. Collisions: %i, N. V0s: %i, Processing time (s): %lf", collisions.size(), fullV0s.size(), elapsed.count());
if (fverbose)
LOGF(info, "[Process function call, Iterator] N. Collisions: %i, N. V0s: %i, Processing time (s): %lf", collisions.size(), fullV0s.size(), elapsed.count());
}

PROCESS_SWITCH(sigma0Iterator, processCheckIndexOrdered, "check ordering", true);
PROCESS_SWITCH(sigma0Iterator, processTI, "Initial setup", true);
PROCESS_SWITCH(sigma0Iterator, processRealData, "process data", true);
PROCESS_SWITCH(sigma0Iterator, processTF, "Printouts", true);
PROCESS_SWITCH(sigma0Iterator, processTF, "Printouts", true);
};

struct sigma0CustomGrouping {
Expand All @@ -239,12 +250,12 @@
o2::pwglf::sigma0::photonselConfigurables photonselOpts;
o2::pwglf::sigma0::sigma0selConfigurables sigma0selOpts;
o2::pwglf::sigma0::pi0selConfigurables pi0selOpts;
o2::pwglf::sigma0::axisConfigurables axisOpts;
o2::pwglf::sigma0::axisConfigurables axisOpts;

o2::pwglf::sigma0::Sigma0BuilderModule sigma0Module;

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

void init(InitContext const&)
{
Expand All @@ -258,28 +269,30 @@
sigma0Module.init(histos, evselOpts, lambdaselOpts, photonselOpts, sigma0selOpts, pi0selOpts, axisOpts);
}

// Dummy process function
void process(StraColls const&){}
// Dummy process function
void process(StraColls const&) {}

void processRealData(StraColls const& collisions, V0StandardDerivedDatas const& fullV0s, dauTracks const&){
auto start = std::chrono::high_resolution_clock::now();
void processRealData(StraColls const& collisions, V0StandardDerivedDatas const& fullV0s, dauTracks const&)
{
auto start = std::chrono::high_resolution_clock::now();

sigma0Module.processCustomGrouping(collisions, fullV0s, histos, ccdb, rateFetcher);

sigma0Module.processCustomGrouping(collisions, fullV0s, histos, ccdb, rateFetcher);

auto end = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = end - start;
auto end = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = end - start;

if (fverbose) LOGF(info, "[Process function call, Custom] N. Collisions: %i, N. V0s: %i, Processing time (s): %lf", collisions.size(), fullV0s.size(), elapsed.count());
if (fverbose)
LOGF(info, "[Process function call, Custom] N. Collisions: %i, N. V0s: %i, Processing time (s): %lf", collisions.size(), fullV0s.size(), elapsed.count());
}
PROCESS_SWITCH(sigma0CustomGrouping, processRealData, "process run 3 real data", true);

PROCESS_SWITCH(sigma0CustomGrouping, processRealData, "process run 3 real data", true);
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<sigma0Sorted>(cfgc),
adaptAnalysisTask<sigma0Unsorted>(cfgc),
adaptAnalysisTask<sigma0Iterator>(cfgc),
adaptAnalysisTask<sigma0CustomGrouping>(cfgc)};
adaptAnalysisTask<sigma0Sorted>(cfgc),
adaptAnalysisTask<sigma0Unsorted>(cfgc),
adaptAnalysisTask<sigma0Iterator>(cfgc),
adaptAnalysisTask<sigma0CustomGrouping>(cfgc)};
}
20 changes: 10 additions & 10 deletions PWGLF/TableProducer/Strangeness/sigma0builder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@ struct sigma0builder {
Service<o2::ccdb::BasicCCDBManager> ccdb;
ctpRateFetcher rateFetcher;

//SliceCache cache;
// SliceCache cache;

Produces<aod::Sigma0Cores> sigma0cores; // save sigma0 candidates for analysis
Produces<aod::SigmaPhotonExtras> sigmaPhotonExtras; // save sigma0 candidates for analysis
Produces<aod::SigmaLambdaExtras> sigmaLambdaExtras; // save sigma0 candidates for analysis
Produces<aod::SigmaMCCores> sigma0mccores;

// For manual sliceBy
//PresliceUnsorted<V0DerivedMCDatas> perCollisionMCDerived = o2::aod::v0data::straCollisionId;
//PresliceUnsorted<V0StandardDerivedDatas> perCollisionSTDDerived = o2::aod::v0data::straCollisionId;
// PresliceUnsorted<V0DerivedMCDatas> perCollisionMCDerived = o2::aod::v0data::straCollisionId;
// PresliceUnsorted<V0StandardDerivedDatas> perCollisionSTDDerived = o2::aod::v0data::straCollisionId;
PresliceUnsorted<soa::Join<aod::StraCollisions, aod::StraCents, aod::StraEvSels, aod::StraCollLabels>> perMcCollision = aod::v0data::straMCCollisionId;

// pack track quality but separte also afterburner
Expand Down Expand Up @@ -1138,9 +1138,9 @@ struct sigma0builder {

void processMonteCarlo(soa::Join<aod::StraCollisions, aod::StraCents, aod::StraEvSels, aod::StraStamps, aod::StraCollLabels> const& collisions, V0DerivedMCDatas const& fullV0s, dauTracks const&, aod::MotherMCParts const&, soa::Join<aod::StraMCCollisions, aod::StraMCCollMults> const&, soa::Join<aod::V0MCCores, aod::V0MCCollRefs> const&)
{
// brute force grouped index construction
std::vector<std::vector<int>> v0grouped(collisions.size());
// brute force grouped index construction
std::vector<std::vector<int>> v0grouped(collisions.size());

for (const auto& v0 : fullV0s) {
v0grouped[v0.straCollisionId()].push_back(v0.globalIndex());
}
Expand All @@ -1151,7 +1151,7 @@ struct sigma0builder {
continue;

float centrality = doPPAnalysis ? coll.centFT0M() : coll.centFT0C();

bool fhasMCColl = false;
if (coll.has_straMCCollision())
fhasMCColl = true;
Expand Down Expand Up @@ -1323,9 +1323,9 @@ struct sigma0builder {

void processRealData(soa::Join<aod::StraCollisions, aod::StraCents, aod::StraEvSels, aod::StraStamps> const& collisions, V0StandardDerivedDatas const& fullV0s, dauTracks const&)
{
// brute force grouped index construction
std::vector<std::vector<int>> v0grouped(collisions.size());
// brute force grouped index construction
std::vector<std::vector<int>> v0grouped(collisions.size());

for (const auto& v0 : fullV0s) {
v0grouped[v0.straCollisionId()].push_back(v0.globalIndex());
}
Expand Down
Loading
Loading