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
57 changes: 41 additions & 16 deletions PWGLF/TableProducer/Strangeness/cascademlselection.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/Strangeness/cascademlselection.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,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.
//

Check failure on line 11 in PWGLF/TableProducer/Strangeness/cascademlselection.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/Strangeness/cascademlselection.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/Strangeness/cascademlselection.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.
// *+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*
// Lambdakzero ML selection task
// *+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*
Expand Down Expand Up @@ -46,9 +46,9 @@
#include <TFile.h>
#include <TH2F.h>
#include <TProfile.h>
#include <TLorentzVector.h>

Check failure on line 49 in PWGLF/TableProducer/Strangeness/cascademlselection.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>

Check failure on line 51 in PWGLF/TableProducer/Strangeness/cascademlselection.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 "Tools/ML/MlResponse.h"
#include "Tools/ML/model.h"

Expand All @@ -67,12 +67,15 @@
// For derived data analysis
using CascDerivedDatas = soa::Join<aod::CascCores, aod::CascExtras, aod::CascCollRefs>;

struct cascademlselection {

Check failure on line 70 in PWGLF/TableProducer/Strangeness/cascademlselection.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/struct]

Use UpperCamelCase for names of structs.
o2::ml::OnnxModel mlModelXiMinus;
o2::ml::OnnxModel mlModelXiPlus;
o2::ml::OnnxModel mlModelOmegaMinus;
o2::ml::OnnxModel mlModelOmegaPlus;

// Custom grouping
std::vector<std::vector<int>> cascadesGrouped;

std::map<std::string, std::string> metadata;

Produces<aod::CascXiMLScores> xiMLSelections; // optionally aggregate information from ML output for posterior analysis (derived data)
Expand Down Expand Up @@ -159,7 +162,7 @@
}

// function to load models for ML-based classifiers
void LoadMachines(int64_t timeStampML)

Check failure on line 165 in PWGLF/TableProducer/Strangeness/cascademlselection.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
{
if (mlConfigurations.loadModelsFromCCDB) {
ccdbApi.init(ccdbConfigurations.ccdburl);
Expand Down Expand Up @@ -261,30 +264,52 @@
}
}

void processDerivedData(soa::Join<aod::StraCollisions, aod::StraStamps>::iterator const& collision, CascDerivedDatas const& cascades)
void processDerivedData(soa::Join<aod::StraCollisions, aod::StraStamps> const& collisions, CascDerivedDatas const& cascades)
{
initCCDB(collision);
// Custom grouping
cascadesGrouped.clear();
cascadesGrouped.resize(collisions.size());

for (const auto& cascade : cascades) {
cascadesGrouped[cascade.straCollisionId()].push_back(cascade.globalIndex());
}

histos.fill(HIST("hEventVertexZ"), collision.posZ());
for (auto& casc : cascades) {
nCandidates++;
if (nCandidates % 50000 == 0) {
LOG(info) << "Candidates processed: " << nCandidates;
for (const auto& collision : collisions) {
initCCDB(collision);

histos.fill(HIST("hEventVertexZ"), collision.posZ());
for (std::size_t i = 0; i < cascadesGrouped[collision.globalIndex()].size(); i++) {
auto casc = cascades.rawIteratorAt(cascadesGrouped[collision.globalIndex()][i]);
nCandidates++;
if (nCandidates % 50000 == 0) {

Check failure on line 284 in PWGLF/TableProducer/Strangeness/cascademlselection.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.
LOG(info) << "Candidates processed: " << nCandidates;
}
processCandidate(casc);
}
processCandidate(casc);
}
}
void processStandardData(aod::Collision const& collision, CascOriginalDatas const& cascades)
void processStandardData(aod::Collisions const& collisions, CascOriginalDatas const& cascades)
{
initCCDB(collision);
// Custom grouping
cascadesGrouped.clear();
cascadesGrouped.resize(collisions.size());

histos.fill(HIST("hEventVertexZ"), collision.posZ());
for (auto& casc : cascades) {
nCandidates++;
if (nCandidates % 50000 == 0) {
LOG(info) << "Candidates processed: " << nCandidates;
for (const auto& cascade : cascades) {
cascadesGrouped[cascade.collisionId()].push_back(cascade.globalIndex());
}

for (const auto& collision : collisions) {
initCCDB(collision);

histos.fill(HIST("hEventVertexZ"), collision.posZ());
for (std::size_t i = 0; i < cascadesGrouped[collision.globalIndex()].size(); i++) {
auto casc = cascades.rawIteratorAt(cascadesGrouped[collision.globalIndex()][i]);
nCandidates++;
if (nCandidates % 50000 == 0) {

Check failure on line 308 in PWGLF/TableProducer/Strangeness/cascademlselection.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.
LOG(info) << "Candidates processed: " << nCandidates;
}
processCandidate(casc);
}
processCandidate(casc);
}
}

Expand Down
Loading
Loading