Skip to content

Commit 8c7a5d8

Browse files
authored
Merge branch 'master' into master
2 parents aefc741 + a01e2e9 commit 8c7a5d8

File tree

15 files changed

+1664
-514
lines changed

15 files changed

+1664
-514
lines changed

.github/workflows/mega-linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
id: ml
3939
# You can override MegaLinter flavor used to have faster performances
4040
# More info at https://megalinter.io/flavors/
41-
uses: oxsecurity/megalinter@v8.8.0
41+
uses: oxsecurity/megalinter@v9.0.1
4242
env:
4343
# All available variables are described in documentation:
4444
# https://megalinter.io/configuration/

ALICE3/Core/FastTracker.cxx

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
#include "TMatrixD.h"
1818
#include "TMatrixDSymEigen.h"
1919
#include "TRandom.h"
20+
#include <TEnv.h>
21+
#include <THashList.h>
22+
#include <TObject.h>
2023

24+
#include <fstream>
2125
#include <map>
2226
#include <string>
2327
#include <vector>
@@ -261,27 +265,47 @@ void FastTracker::AddGenericDetector(std::string filename, o2::ccdb::BasicCCDBMa
261265
return;
262266
}
263267

264-
std::ifstream infile(filename);
265-
if (!infile.is_open()) {
266-
LOG(fatal) << "Could not open detector configuration file: " << filename;
267-
return;
268-
}
269-
270-
std::string line;
271-
while (std::getline(infile, line)) {
272-
if (line.empty() || line[0] == '#')
273-
continue; // skip comments and empty lines
274-
std::istringstream iss(line);
275-
std::string name;
276-
float r, z, x0, xrho, resRPhi, resZ, eff;
277-
int type;
278-
if (!(iss >> name >> r >> z >> x0 >> xrho >> resRPhi >> resZ >> eff >> type)) {
279-
LOG(error) << "Malformed line in detector config: " << line;
268+
TEnv env(filename.c_str());
269+
THashList* table = env.GetTable();
270+
std::vector<std::string> layers;
271+
for (int i = 0; i < table->GetEntries(); ++i) {
272+
const std::string key = table->At(i)->GetName();
273+
// key should contain exactly one dot
274+
if (key.find('.') == std::string::npos || key.find('.') != key.rfind('.')) {
275+
LOG(fatal) << "Key " << key << " does not contain exactly one dot";
280276
continue;
281277
}
282-
AddLayer(name.c_str(), r, z, x0, xrho, resRPhi, resZ, eff, type);
278+
const std::string firstPart = key.substr(0, key.find('.'));
279+
if (std::find(layers.begin(), layers.end(), firstPart) == layers.end()) {
280+
layers.push_back(firstPart);
281+
}
282+
}
283+
// env.Print();
284+
// Layers
285+
for (const auto& layer : layers) {
286+
LOG(info) << " Reading layer " << layer;
287+
288+
auto getKey = [&layer, &env](const std::string& name) {
289+
std::string key = layer + "." + name;
290+
if (!env.Defined(key.c_str())) {
291+
LOG(warning) << "Key " << key << " not defined in configuration file, getting the default value";
292+
}
293+
LOG(info) << " Getting key " << key;
294+
return key;
295+
};
296+
const float r = env.GetValue(getKey("r").c_str(), -1.0f);
297+
LOG(info) << " Layer " << layer << " has radius " << r;
298+
const float z = env.GetValue(getKey("z").c_str(), -1.0f);
299+
const float x0 = env.GetValue(getKey("x0").c_str(), 0.0f);
300+
const float xrho = env.GetValue(getKey("xrho").c_str(), 0.0f);
301+
const float resRPhi = env.GetValue(getKey("resRPhi").c_str(), 0.0f);
302+
const float resZ = env.GetValue(getKey("resZ").c_str(), 0.0f);
303+
const float eff = env.GetValue(getKey("eff").c_str(), 0.0f);
304+
const int type = env.GetValue(getKey("type").c_str(), 0);
305+
306+
// void AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi = 0.0f, float resZ = 0.0f, float eff = 0.0f, int type = 0);
307+
AddLayer(layer.c_str(), r, z, x0, xrho, resRPhi, resZ, eff, type);
283308
}
284-
infile.close();
285309
}
286310

287311
float FastTracker::Dist(float z, float r)

ALICE3/macros/testFastTracker.cxx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file testFastTracker.C
13+
/// \author Nicolò Jacazio nicolo.jacazio@cern.ch
14+
/// \brief Test the FastTracker functionality
15+
16+
#include "ALICE3/Core/FastTracker.h"
17+
18+
#include "CCDB/BasicCCDBManager.h"
19+
#include "DataFormatsParameters/GRPLHCIFData.h"
20+
21+
void testFastTracker(std::string geometryFile = "a3geo.ini")
22+
{
23+
24+
// auto& ccdb = o2::ccdb::BasicCCDBManager::instance();
25+
// ccdb.setURL("http://alice-ccdb.cern.ch");
26+
o2::fastsim::FastTracker fastTracker;
27+
fastTracker.AddGenericDetector(geometryFile);
28+
// fastTracker.AddGenericDetector(geometryFile, &ccdb);
29+
fastTracker.Print();
30+
}

CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
/PWGLF/TableProducer/Resonances @alibuild @sustripathy @skundu692 @mpuccio @dmallick2 @smaff92
5252
/PWGLF/Tasks/Strangeness @alibuild @sustripathy @skundu692 @mpuccio @ercolessi @romainschotter
5353
/PWGLF/TableProducer/Strangeness @alibuild @sustripathy @mpuccio @skundu692 @ercolessi @romainschotter
54+
/PWGLF/TableProducer/QC @alibuild @sustripathy @skundu692 @mpuccio @gbencedi @abmodak @fmazzasc @maciacco @dmallick2 @smaff92 @ercolessi @romainschotter
55+
/PWGLF/Tasks/QC @alibuild @sustripathy @skundu692 @mpuccio @gbencedi @abmodak @fmazzasc @maciacco @dmallick2 @smaff92 @ercolessi @romainschotter
5456
/PWGLF/Utils @alibuild @sustripathy @skundu692 @mpuccio @gbencedi @abmodak @fmazzasc @maciacco @dmallick2 @smaff92 @ercolessi @romainschotter
5557

5658
# PWG-MM (fused with LF, LF conveners included. Directories to be merged in the future)

0 commit comments

Comments
 (0)