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
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-
6768using namespace o2 ;
6869using namespace o2 ::framework;
6970using 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 }
0 commit comments