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
2 changes: 1 addition & 1 deletion ALICE3/TableProducer/OTF/CMakeLists.txt
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 ALICE3/TableProducer/OTF/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Use kebab-case for names of workflows and match the name of the workflow file.
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
# All rights not expressly granted are reserved.
#
Expand All @@ -9,17 +9,17 @@
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

o2physics_add_dpl_workflow(onthefly-tracker

Check failure on line 12 in ALICE3/TableProducer/OTF/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name onthefly-tracker does not match its file name onTheFlyTracker.cxx. (Matches ontheflyTracker.cxx.)
SOURCES onTheFlyTracker.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2::ReconstructionDataFormats O2::DetectorsCommonDataFormats O2::DetectorsVertexing O2::DCAFitter O2Physics::ALICE3Core O2Physics::FastTracker
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(onthefly-tofpid

Check failure on line 17 in ALICE3/TableProducer/OTF/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name onthefly-tofpid does not match its file name onTheFlyTofPid.cxx. (Matches ontheflyTofpid.cxx.)
SOURCES onTheFlyTofPid.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2::ReconstructionDataFormats O2::DetectorsCommonDataFormats O2Physics::ALICE3Core
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(onthefly-richpid

Check failure on line 22 in ALICE3/TableProducer/OTF/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name onthefly-richpid does not match its file name onTheFlyRichPid.cxx. (Matches ontheflyRichpid.cxx.)
SOURCES onTheFlyRICHPID.cxx
SOURCES onTheFlyRichPid.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2::ReconstructionDataFormats O2::DetectorsCommonDataFormats O2Physics::ALICE3Core
COMPONENT_NAME Analysis)
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,33 @@
// 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.

//
// Task to add a table of track parameters propagated to the primary vertex
//
///
/// \file onTheFlyRichPid.cxx
///
/// \brief This task goes straight from a combination of track table and mcParticles
/// and a projective bRICH configuration to a table of TOF NSigmas for the particles
/// being analysed. It currently contemplates 5 particle types:
/// electrons, pions, kaons, protons and muons
///
/// More particles could be added but would have to be added to the LUT
/// being used in the onTheFly tracker task.
///
/// \warning Geometry parameters are configurable, but resolution values should be adapted.
/// Since angular resolution depends on the specific geometric details, it is better to
/// calculate it from full simulation and add new input. Alternatively, an analytical
/// expression can be provided as a function of the main parameters.
/// Latest version: analytical parametrization of angular resolution !!!
///
/// \author David Dobrigkeit Chinellato, UNICAMP
/// \author Nicola Nicassio, University and INFN Bari
/// \since May 22, 2024
///

#include <utility>
#include <cmath>
#include <vector>
#include <map>
#include <string>

#include <TPDGCode.h>

Expand Down Expand Up @@ -42,28 +62,9 @@
#include "TString.h"
#include "ALICE3/DataModel/OTFRICH.h"
#include "DetectorsVertexing/HelixHelper.h"

#include "TableHelper.h"
#include "ALICE3/Core/DelphesO2TrackSmearer.h"

/// \file onTheFlyRichPid.cxx
///
/// \brief This task goes straight from a combination of track table and mcParticles
/// and a projective bRICH configuration to a table of TOF NSigmas for the particles
/// being analysed. It currently contemplates 5 particle types:
/// electrons, pions, kaons, protons and muons.
///
/// More particles could be added but would have to be added to the LUT
/// being used in the onTheFly tracker task.
///
/// \warning Geometry parameters are configurable, but resolution values should be adapted.
/// Since angular resolution depends on the specific geometric details, it is better to
/// calculate it from full simulation and add new input. Alternatively, an analytical
/// expression can be provided as a function of the main parameters.
/// Latest version: analytical parametrization of angular resolution !!!
///
/// \author David Dobrigkeit Chinellato, UNICAMP, Nicola Nicassio, University and INFN Bari

using namespace o2;
using namespace o2::framework;
using namespace o2::constants::math;
Expand Down Expand Up @@ -143,11 +144,13 @@
Configurable<float> bRICHPixelSize{"bRICHPixelSize", 0.1, "barrel RICH pixel size (cm)"};
Configurable<float> bRichGapRefractiveIndex{"bRichGapRefractiveIndex", 1.000283, "barrel RICH gap refractive index"};

Configurable<std::string> lutEl{"lutEl", "lutCovm.el.dat", "LUT for electrons"};
Configurable<std::string> lutMu{"lutMu", "lutCovm.mu.dat", "LUT for muons"};
Configurable<std::string> lutPi{"lutPi", "lutCovm.pi.dat", "LUT for pions"};
Configurable<std::string> lutKa{"lutKa", "lutCovm.ka.dat", "LUT for kaons"};
Configurable<std::string> lutPr{"lutPr", "lutCovm.pr.dat", "LUT for protons"};
struct : ConfigurableGroup {
Configurable<std::string> lutEl{"lutEl", "inherit", "LUT for electrons (if inherit, inherits from otf tracker task)"};
Configurable<std::string> lutMu{"lutMu", "inherit", "LUT for muons (if inherit, inherits from otf tracker task)"};
Configurable<std::string> lutPi{"lutPi", "inherit", "LUT for pions (if inherit, inherits from otf tracker task)"};
Configurable<std::string> lutKa{"lutKa", "inherit", "LUT for kaons (if inherit, inherits from otf tracker task)"};
Configurable<std::string> lutPr{"lutPr", "inherit", "LUT for protons (if inherit, inherits from otf tracker task)"};
} simConfig;

o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE;

Expand Down Expand Up @@ -226,19 +229,19 @@
l_aerogel_z[i_central_mirror] = std::sqrt(1.0 + m_val * m_val) * R_min * square_size_barrel_cylinder / (std::sqrt(1.0 + m_val * m_val) * R_max - m_val * square_size_barrel_cylinder);
T_r_plus_g[i_central_mirror] = R_max - R_min;
float t = std::tan(std::atan(m_val) + std::atan(square_size_barrel_cylinder / (2.0 * R_max * std::sqrt(1.0 + m_val * m_val) - square_size_barrel_cylinder * m_val)));
theta_max[i_central_mirror] = M_PI / 2.0 - std::atan(t);

Check failure on line 232 in ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
theta_min[i_central_mirror] = M_PI / 2.0 + std::atan(t);

Check failure on line 233 in ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
mProjectiveLengthInner = R_min * t;
aerogel_rindex[i_central_mirror] = bRichRefractiveIndexSector[0];
for (int i = i_central_mirror + 1; i < number_of_sectors_in_z; i++) {
float par_a = t;
float par_b = 2.0 * R_max / square_size_z;
m_val = (std::sqrt(par_a * par_a * par_b * par_b + par_b * par_b - 1.0) + par_a * par_b * par_b) / (par_b * par_b - 1.0);
theta_min[i] = M_PI / 2.0 - std::atan(t);

Check failure on line 240 in ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
theta_max[2 * i_central_mirror - i] = M_PI / 2.0 + std::atan(t);

Check failure on line 241 in ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
t = std::tan(std::atan(m_val) + std::atan(square_size_z / (2.0 * R_max * std::sqrt(1.0 + m_val * m_val) - square_size_z * m_val)));
theta_max[i] = M_PI / 2.0 - std::atan(t);

Check failure on line 243 in ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
theta_min[2 * i_central_mirror - i] = M_PI / 2.0 + std::atan(t);

Check failure on line 244 in ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
// Forward sectors
theta_bi[i] = std::atan(m_val);
R0_tilt[i] = R_max - square_size_z / 2.0 * std::sin(std::atan(m_val));
Expand All @@ -257,9 +260,7 @@
aerogel_rindex[2 * i_central_mirror - i] = bRichRefractiveIndexSector[i - i_central_mirror];
mProjectiveLengthInner = R_min * t; // <-- At the end of the loop this will be the maximum Z
}
}
// Even number of sectors
else {
} else { // Even number of sectors
float two_half_gap = 1.0;
int i_central_mirror = static_cast<int>((number_of_sectors_in_z) / 2.0);
float m_val = std::tan(0.0);
Expand Down Expand Up @@ -315,18 +316,33 @@
// std::cout << std::endl << std::endl;
}

void init(o2::framework::InitContext& /*initContext*/)
void init(o2::framework::InitContext& initContext)
{
pRandomNumberGenerator.SetSeed(0); // fully randomize

// Check if inheriting the LUT configuration
auto configLutPath = [&](Configurable<std::string>& lut) {
if (lut.value != "inherit") {
return;
}
if (!getTaskOptionValue(initContext, "on-the-fly-tracker", lut.name, lut.value, true)) {
LOG(fatal) << "Could not get " << lut.name << " from on-the-fly-tracker task";
}
};
configLutPath(simConfig.lutEl);
configLutPath(simConfig.lutMu);
configLutPath(simConfig.lutPi);
configLutPath(simConfig.lutKa);
configLutPath(simConfig.lutPr);

// Load LUT for pt and eta smearing
if (flagIncludeTrackAngularRes && flagRICHLoadDelphesLUTs) {
std::map<int, const char*> mapPdgLut;
const char* lutElChar = lutEl->c_str();
const char* lutMuChar = lutMu->c_str();
const char* lutPiChar = lutPi->c_str();
const char* lutKaChar = lutKa->c_str();
const char* lutPrChar = lutPr->c_str();
const char* lutElChar = simConfig.lutEl->c_str();
const char* lutMuChar = simConfig.lutMu->c_str();
const char* lutPiChar = simConfig.lutPi->c_str();
const char* lutKaChar = simConfig.lutKa->c_str();
const char* lutPrChar = simConfig.lutPr->c_str();

LOGF(info, "Will load electron lut file ..: %s for RICH PID", lutElChar);
LOGF(info, "Will load muon lut file ......: %s for RICH PID", lutMuChar);
Expand All @@ -340,7 +356,7 @@
mapPdgLut.insert(std::make_pair(321, lutKaChar));
mapPdgLut.insert(std::make_pair(2212, lutPrChar));

for (auto e : mapPdgLut) {
for (const auto& e : mapPdgLut) {
if (!mSmearer.loadTable(e.first, e.second)) {
LOG(fatal) << "Having issue with loading the LUT " << e.first << " " << e.second;
}
Expand Down
Loading