Skip to content

Commit 9c426e1

Browse files
authored
Merge branch 'AliceO2Group:master' into master
2 parents 3bfea57 + e80c2c8 commit 9c426e1

File tree

84 files changed

+6954
-1466
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+6954
-1466
lines changed

ALICE3/TableProducer/OTF/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ o2physics_add_dpl_workflow(onthefly-tofpid
2020
COMPONENT_NAME Analysis)
2121

2222
o2physics_add_dpl_workflow(onthefly-richpid
23-
SOURCES onTheFlyRICHPID.cxx
23+
SOURCES onTheFlyRichPid.cxx
2424
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2::ReconstructionDataFormats O2::DetectorsCommonDataFormats O2Physics::ALICE3Core
2525
COMPONENT_NAME Analysis)

ALICE3/TableProducer/OTF/onTheFlyRICHPID.cxx renamed to ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx

Lines changed: 54 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,33 @@
88
// In applying this license CERN does not waive the privileges and immunities
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
11-
12-
//
13-
// Task to add a table of track parameters propagated to the primary vertex
14-
//
11+
///
12+
/// \file onTheFlyRichPid.cxx
13+
///
14+
/// \brief This task goes straight from a combination of track table and mcParticles
15+
/// and a projective bRICH configuration to a table of TOF NSigmas for the particles
16+
/// being analysed. It currently contemplates 5 particle types:
17+
/// electrons, pions, kaons, protons and muons
18+
///
19+
/// More particles could be added but would have to be added to the LUT
20+
/// being used in the onTheFly tracker task.
21+
///
22+
/// \warning Geometry parameters are configurable, but resolution values should be adapted.
23+
/// Since angular resolution depends on the specific geometric details, it is better to
24+
/// calculate it from full simulation and add new input. Alternatively, an analytical
25+
/// expression can be provided as a function of the main parameters.
26+
/// Latest version: analytical parametrization of angular resolution !!!
27+
///
28+
/// \author David Dobrigkeit Chinellato, UNICAMP
29+
/// \author Nicola Nicassio, University and INFN Bari
30+
/// \since May 22, 2024
31+
///
1532

1633
#include <utility>
1734
#include <cmath>
35+
#include <vector>
36+
#include <map>
37+
#include <string>
1838

1939
#include <TPDGCode.h>
2040

@@ -42,28 +62,9 @@
4262
#include "TString.h"
4363
#include "ALICE3/DataModel/OTFRICH.h"
4464
#include "DetectorsVertexing/HelixHelper.h"
45-
4665
#include "TableHelper.h"
4766
#include "ALICE3/Core/DelphesO2TrackSmearer.h"
4867

49-
/// \file onTheFlyRichPid.cxx
50-
///
51-
/// \brief This task goes straight from a combination of track table and mcParticles
52-
/// and a projective bRICH configuration to a table of TOF NSigmas for the particles
53-
/// being analysed. It currently contemplates 5 particle types:
54-
/// electrons, pions, kaons, protons and muons.
55-
///
56-
/// More particles could be added but would have to be added to the LUT
57-
/// being used in the onTheFly tracker task.
58-
///
59-
/// \warning Geometry parameters are configurable, but resolution values should be adapted.
60-
/// Since angular resolution depends on the specific geometric details, it is better to
61-
/// calculate it from full simulation and add new input. Alternatively, an analytical
62-
/// expression can be provided as a function of the main parameters.
63-
/// Latest version: analytical parametrization of angular resolution !!!
64-
///
65-
/// \author David Dobrigkeit Chinellato, UNICAMP, Nicola Nicassio, University and INFN Bari
66-
6768
using namespace o2;
6869
using namespace o2::framework;
6970
using namespace o2::constants::math;
@@ -143,11 +144,13 @@ struct OnTheFlyRichPid {
143144
Configurable<float> bRICHPixelSize{"bRICHPixelSize", 0.1, "barrel RICH pixel size (cm)"};
144145
Configurable<float> bRichGapRefractiveIndex{"bRichGapRefractiveIndex", 1.000283, "barrel RICH gap refractive index"};
145146

146-
Configurable<std::string> lutEl{"lutEl", "lutCovm.el.dat", "LUT for electrons"};
147-
Configurable<std::string> lutMu{"lutMu", "lutCovm.mu.dat", "LUT for muons"};
148-
Configurable<std::string> lutPi{"lutPi", "lutCovm.pi.dat", "LUT for pions"};
149-
Configurable<std::string> lutKa{"lutKa", "lutCovm.ka.dat", "LUT for kaons"};
150-
Configurable<std::string> lutPr{"lutPr", "lutCovm.pr.dat", "LUT for protons"};
147+
struct : ConfigurableGroup {
148+
Configurable<std::string> lutEl{"lutEl", "inherit", "LUT for electrons (if inherit, inherits from otf tracker task)"};
149+
Configurable<std::string> lutMu{"lutMu", "inherit", "LUT for muons (if inherit, inherits from otf tracker task)"};
150+
Configurable<std::string> lutPi{"lutPi", "inherit", "LUT for pions (if inherit, inherits from otf tracker task)"};
151+
Configurable<std::string> lutKa{"lutKa", "inherit", "LUT for kaons (if inherit, inherits from otf tracker task)"};
152+
Configurable<std::string> lutPr{"lutPr", "inherit", "LUT for protons (if inherit, inherits from otf tracker task)"};
153+
} simConfig;
151154

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

@@ -257,9 +260,7 @@ struct OnTheFlyRichPid {
257260
aerogel_rindex[2 * i_central_mirror - i] = bRichRefractiveIndexSector[i - i_central_mirror];
258261
mProjectiveLengthInner = R_min * t; // <-- At the end of the loop this will be the maximum Z
259262
}
260-
}
261-
// Even number of sectors
262-
else {
263+
} else { // Even number of sectors
263264
float two_half_gap = 1.0;
264265
int i_central_mirror = static_cast<int>((number_of_sectors_in_z) / 2.0);
265266
float m_val = std::tan(0.0);
@@ -315,18 +316,33 @@ struct OnTheFlyRichPid {
315316
// std::cout << std::endl << std::endl;
316317
}
317318

318-
void init(o2::framework::InitContext& /*initContext*/)
319+
void init(o2::framework::InitContext& initContext)
319320
{
320321
pRandomNumberGenerator.SetSeed(0); // fully randomize
321322

323+
// Check if inheriting the LUT configuration
324+
auto configLutPath = [&](Configurable<std::string>& lut) {
325+
if (lut.value != "inherit") {
326+
return;
327+
}
328+
if (!getTaskOptionValue(initContext, "on-the-fly-tracker", lut.name, lut.value, true)) {
329+
LOG(fatal) << "Could not get " << lut.name << " from on-the-fly-tracker task";
330+
}
331+
};
332+
configLutPath(simConfig.lutEl);
333+
configLutPath(simConfig.lutMu);
334+
configLutPath(simConfig.lutPi);
335+
configLutPath(simConfig.lutKa);
336+
configLutPath(simConfig.lutPr);
337+
322338
// Load LUT for pt and eta smearing
323339
if (flagIncludeTrackAngularRes && flagRICHLoadDelphesLUTs) {
324340
std::map<int, const char*> mapPdgLut;
325-
const char* lutElChar = lutEl->c_str();
326-
const char* lutMuChar = lutMu->c_str();
327-
const char* lutPiChar = lutPi->c_str();
328-
const char* lutKaChar = lutKa->c_str();
329-
const char* lutPrChar = lutPr->c_str();
341+
const char* lutElChar = simConfig.lutEl->c_str();
342+
const char* lutMuChar = simConfig.lutMu->c_str();
343+
const char* lutPiChar = simConfig.lutPi->c_str();
344+
const char* lutKaChar = simConfig.lutKa->c_str();
345+
const char* lutPrChar = simConfig.lutPr->c_str();
330346

331347
LOGF(info, "Will load electron lut file ..: %s for RICH PID", lutElChar);
332348
LOGF(info, "Will load muon lut file ......: %s for RICH PID", lutMuChar);
@@ -340,7 +356,7 @@ struct OnTheFlyRichPid {
340356
mapPdgLut.insert(std::make_pair(321, lutKaChar));
341357
mapPdgLut.insert(std::make_pair(2212, lutPrChar));
342358

343-
for (auto e : mapPdgLut) {
359+
for (const auto& e : mapPdgLut) {
344360
if (!mSmearer.loadTable(e.first, e.second)) {
345361
LOG(fatal) << "Having issue with loading the LUT " << e.first << " " << e.second;
346362
}

ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
#include "DetectorsVertexing/HelixHelper.h"
5656
#include "TableHelper.h"
5757
#include "ALICE3/Core/DelphesO2TrackSmearer.h"
58+
#include "TEfficiency.h"
59+
#include "THashList.h"
5860

5961
using namespace o2;
6062
using namespace o2::framework;
@@ -117,6 +119,8 @@ struct OnTheFlyTofPid {
117119
Configurable<int> nBinsTimeRes{"nBinsTimeRes", 400, "number of bins plots time resolution"};
118120
Configurable<int> nBinsRelativeEtaPt{"nBinsRelativeEtaPt", 400, "number of bins plots pt and eta relative errors"};
119121
Configurable<int> nBinsEta{"nBinsEta", 400, "number of bins plot relative eta error"};
122+
Configurable<int> nBinsMult{"nBinsMult", 200, "number of bins in multiplicity"};
123+
Configurable<float> maxMultRange{"maxMultRange", 1000.f, "upper limit in multiplicity plots"};
120124
} plotsConfig;
121125

122126
o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE;
@@ -129,6 +133,7 @@ struct OnTheFlyTofPid {
129133

130134
// for handling basic QA histograms if requested
131135
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
136+
OutputObj<THashList> listEfficiency{"efficiency"};
132137
static constexpr int kParticles = 5;
133138

134139
void init(o2::framework::InitContext& initContext)
@@ -179,13 +184,16 @@ struct OnTheFlyTofPid {
179184
}
180185

181186
if (plotsConfig.doQAplots) {
182-
const AxisSpec axisdNdeta{200, 0.0f, 1000.0f, Form("dN/d#eta in |#eta| < %f", simConfig.multiplicityEtaRange.value)};
187+
const AxisSpec axisdNdeta{plotsConfig.nBinsMult, 0.0f, plotsConfig.maxMultRange, Form("dN/d#eta in |#eta| < %f", simConfig.multiplicityEtaRange.value)};
183188

184189
histos.add("h1dNdeta", "h2dNdeta", kTH1F, {axisdNdeta});
185190
histos.add("h2dEventTime", "h2dEventTime", kTH2F, {{200, -1000, 1000, "computed"}, {200, -1000, 1000, "generated"}});
186191
histos.add("h1dEventTimegen", "h1dEventTimegen", kTH1F, {{200, -1000, 1000, "generated"}});
187192
histos.add("h1dEventTimerec", "h1dEventTimerec", kTH1F, {{200, -1000, 1000, "computed"}});
193+
histos.add("h1dEventTimedelta", "h1dEventTimedelta", kTH1F, {{200, -1000, 1000, "generated - computed"}});
188194
histos.add("h2dEventTimeres", "h2dEventTimeres", kTH2F, {axisdNdeta, {300, 0, 300, "resolution"}});
195+
listEfficiency.setObject(new THashList);
196+
listEfficiency->Add(new TEfficiency("effEventTime", "effEventTime", plotsConfig.nBinsMult, 0.0f, plotsConfig.maxMultRange));
189197

190198
const AxisSpec axisMomentum{static_cast<int>(plotsConfig.nBinsP), 0.0f, +10.0f, "#it{p} (GeV/#it{c})"};
191199
const AxisSpec axisMomentumSmall{static_cast<int>(plotsConfig.nBinsP), 0.0f, +1.0f, "#it{p} (GeV/#it{c})"};
@@ -564,8 +572,9 @@ struct OnTheFlyTofPid {
564572
// Now we compute the event time for the tracks
565573

566574
std::array<float, 2> tzero = {0.f, 0.f};
575+
bool etStatus = false;
567576
if (simConfig.considerEventTime.value) {
568-
const bool etStatus = eventTime(tracksWithTime, tzero);
577+
etStatus = eventTime(tracksWithTime, tzero);
569578
if (!etStatus) {
570579
LOG(warning) << "Event time calculation failed with " << tracksWithTime.size() << " tracks";
571580
}
@@ -576,6 +585,10 @@ struct OnTheFlyTofPid {
576585
histos.fill(HIST("h1dEventTimegen"), eventCollisionTimePS);
577586
histos.fill(HIST("h1dEventTimerec"), tzero[0]);
578587
histos.fill(HIST("h2dEventTimeres"), dNdEta, tzero[1]);
588+
if (etStatus) {
589+
histos.fill(HIST("h1dEventTimedelta"), eventCollisionTimePS - tzero[0]);
590+
}
591+
static_cast<TEfficiency*>(listEfficiency->At(0))->Fill(etStatus, dNdEta);
579592
}
580593

581594
// Then we do a second loop to compute the measured quantities with the measured event time

ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,9 @@ struct OnTheFlyTracker {
870870
posClusterCandidate[2] = gRandom->Gaus(posClusterCandidate[2], currentTrackingLayer.resZ);
871871
}
872872

873+
if (std::isnan(phi))
874+
continue; // Catch when getXatLabR misses layer[i]
875+
873876
// towards adding cluster: move to track alpha
874877
double alpha = cascadeTrack.getAlpha();
875878
double xyz1[3]{

0 commit comments

Comments
 (0)