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/Core/DelphesO2LutWriter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
#include <ReconstructionDataFormats/Track.h>

#include <TAxis.h>
#include <TDatabasePDG.h>

Check failure on line 32 in ALICE3/Core/DelphesO2LutWriter.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 <TGraph.h>
#include <TLorentzVector.h>

Check failure on line 34 in ALICE3/Core/DelphesO2LutWriter.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 <TMatrixD.h> // IWYU pragma: keep (do not replace with TMatrixDfwd.h)
#include <TMatrixDSymEigen.h>
#include <TMatrixDSymfwd.h>
Expand Down Expand Up @@ -97,10 +97,10 @@
{
lutEntry.valid = false;

static TLorentzVector tlv;

Check failure on line 100 in ALICE3/Core/DelphesO2LutWriter.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.
tlv.SetPtEtaPhiM(pt, eta, 0., mass);
o2::track::TrackParCov trkIn;
o2::upgrade::convertTLorentzVectorToO2Track(q, tlv, {0., 0., 0.}, trkIn);

Check failure on line 103 in ALICE3/Core/DelphesO2LutWriter.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.
// tlv.Print();
// return fmt::format("X:{:+.4e} Alp:{:+.3e} Par: {:+.4e} {:+.4e} {:+.4e} {:+.4e} {:+.4e} |Q|:{:d} {:s}\n",
// getX(), getAlpha(), getY(), getZ(), getSnp(), getTgl(), getQ2Pt(), getAbsCharge(), getPID().getName());
Expand Down Expand Up @@ -205,7 +205,7 @@
const float momresTot = pt * std::sqrt(relmomresPos * relmomresPos + relmomresMS * relmomresMS); // total absolute mom reso

// Fill cov matrix diag
for (int i = 0; i < 15; ++i)

Check failure on line 208 in ALICE3/Core/DelphesO2LutWriter.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.
lutEntry.covm[i] = 0;

lutEntry.covm[0] = covmbarrel[0];
Expand All @@ -218,7 +218,7 @@
lutEntry.covm[9] = covmbarrel[9]; // sigma^2 tanl
lutEntry.covm[14] = momresTot * momresTot / pt / pt / pt / pt; // sigma^2 1/pt
// Check that all numbers are numbers
for (int i = 0; i < 15; ++i) {

Check failure on line 221 in ALICE3/Core/DelphesO2LutWriter.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.
if (std::isnan(lutEntry.covm[i])) {
LOGF(info, " --- lutEntry.covm[%d] is NaN", i);
return false;
Expand Down Expand Up @@ -246,7 +246,7 @@
lutHeader_t lutHeader;
// pid
lutHeader.pdg = pdg;
const TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(pdg);

Check failure on line 249 in ALICE3/Core/DelphesO2LutWriter.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.
if (!particle) {
LOG(fatal) << "Cannot find particle with PDG code " << pdg;
return;
Expand Down Expand Up @@ -311,7 +311,7 @@
lutEntry.valid = false;
lutEntry.eff = 0.;
lutEntry.eff2 = 0.;
for (int i = 0; i < 15; ++i) {

Check failure on line 314 in ALICE3/Core/DelphesO2LutWriter.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.
lutEntry.covm[i] = 0.;
}
successfullCalls--;
Expand Down Expand Up @@ -342,7 +342,7 @@
if (!retval) {
LOGF(info, " --- fwdSolve: error");
lutEntry.valid = false;
for (int i = 0; i < 15; ++i) {

Check failure on line 345 in ALICE3/Core/DelphesO2LutWriter.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.
lutEntry.covm[i] = 0.;
}
successfullCalls--;
Expand Down Expand Up @@ -376,7 +376,7 @@
// m.Print();
TMatrixDSymEigen eigen(m);
// eigenvalues vector
TVectorD eigenVal = eigen.GetEigenValues();
const TVectorD& eigenVal = eigen.GetEigenValues();
for (int i = 0; i < kEig; ++i)
lutEntry.eigval[i] = eigenVal[i];
// eigenvectors matrix
Expand Down
6 changes: 3 additions & 3 deletions ALICE3/Core/FastTracker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

// +-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+

DetLayer* FastTracker::AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi, float resZ, float eff, int type)
DetLayer* FastTracker::AddLayer(const TString& name, float r, float z, float x0, float xrho, float resRPhi, float resZ, float eff, int type)
{
LOG(debug) << "Adding layer " << name << " r=" << r << " z=" << z << " x0=" << x0 << " xrho=" << xrho << " resRPhi=" << resRPhi << " resZ=" << resZ << " eff=" << eff << " type=" << type;
DetLayer newLayer(name, r, z, x0, xrho, resRPhi, resZ, eff, type);
Expand Down Expand Up @@ -154,7 +154,7 @@
}
}

void FastTracker::AddGenericDetector(o2::fastsim::GeometryEntry configMap, o2::ccdb::BasicCCDBManager* ccdbManager)
void FastTracker::AddGenericDetector(const o2::fastsim::GeometryEntry& configMap, o2::ccdb::BasicCCDBManager* ccdbManager)
{
// Layers
for (const auto& layer : configMap.getLayerNames()) {
Expand Down Expand Up @@ -576,7 +576,7 @@
if (fcovm[ii][jj] * fcovm[ii][jj] > std::abs(fcovm[ii][ii] * fcovm[jj][jj])) {
rubenConditional = true;
if (makePositiveDefinite) {
fcovm[ii][jj] = TMath::Sign(1, fcovm[ii][jj]) * covMatFactor * sqrt(std::abs(fcovm[ii][ii] * fcovm[jj][jj]));

Check failure on line 579 in ALICE3/Core/FastTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
}
}
}
Expand All @@ -586,7 +586,7 @@
m.SetMatrixArray(reinterpret_cast<double*>(fcovm));
TMatrixDSymEigen eigen(m);
TMatrixD eigVec = eigen.GetEigenVectors();
TVectorD eigVal = eigen.GetEigenValues();
const TVectorD& eigVal = eigen.GetEigenValues();
bool negEigVal = false;
for (int ii = 0; ii < 5; ii++) {
if (eigVal[ii] < 0.0f)
Expand Down
14 changes: 7 additions & 7 deletions ALICE3/Core/FastTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class FastTracker
virtual ~FastTracker() {}

// Layer and layer configuration
DetLayer* 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);
DetLayer* AddLayer(const 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);

/// Add a dead region in phi for a specific layer
/// \param layerName Name of the layer to modify
Expand All @@ -59,11 +59,11 @@ class FastTracker
size_t GetNLayers() const { return layers.size(); }
bool IsLayerInert(const int layer) const { return layers[layer].isInert(); }
void ClearLayers() { layers.clear(); }
void SetRadiationLength(const std::string layerName, float x0) { layers[GetLayerIndex(layerName)].setRadiationLength(x0); }
void SetRadius(const std::string layerName, float r) { layers[GetLayerIndex(layerName)].setRadius(r); }
void SetResolutionRPhi(const std::string layerName, float resRPhi) { layers[GetLayerIndex(layerName)].setResolutionRPhi(resRPhi); }
void SetResolutionZ(const std::string layerName, float resZ) { layers[GetLayerIndex(layerName)].setResolutionZ(resZ); }
void SetResolution(const std::string layerName, float resRPhi, float resZ)
void SetRadiationLength(const std::string& layerName, float x0) { layers[GetLayerIndex(layerName)].setRadiationLength(x0); }
void SetRadius(const std::string& layerName, float r) { layers[GetLayerIndex(layerName)].setRadius(r); }
void SetResolutionRPhi(const std::string& layerName, float resRPhi) { layers[GetLayerIndex(layerName)].setResolutionRPhi(resRPhi); }
void SetResolutionZ(const std::string& layerName, float resZ) { layers[GetLayerIndex(layerName)].setResolutionZ(resZ); }
void SetResolution(const std::string& layerName, float resRPhi, float resZ)
{
SetResolutionRPhi(layerName, resRPhi);
SetResolutionZ(layerName, resZ);
Expand All @@ -80,7 +80,7 @@ class FastTracker
*
* @param configMap Configuration map describing the detector.
*/
void AddGenericDetector(o2::fastsim::GeometryEntry configMap, o2::ccdb::BasicCCDBManager* ccdbManager = nullptr);
void AddGenericDetector(const o2::fastsim::GeometryEntry& configMap, o2::ccdb::BasicCCDBManager* ccdbManager = nullptr);

void Print();

Expand Down
2 changes: 1 addition & 1 deletion ALICE3/Core/FlatLutWriter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ void FlatLutWriter::diagonalise(lutEntry_t& lutEntry)
TMatrixDSymEigen eigen(m);

// Eigenvalues
TVectorD eigenVal = eigen.GetEigenValues();
const TVectorD& eigenVal = eigen.GetEigenValues();
for (int i = 0; i < kEig; ++i)
lutEntry.eigval[i] = eigenVal[i];

Expand Down
2 changes: 1 addition & 1 deletion ALICE3/Core/GeometryContainer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void GeometryEntry::replaceValue(const std::string& layerName, const std::string
setValue(layerName, key, value);
}

std::string GeometryEntry::accessFile(const std::string& path, const std::string downloadPath, o2::ccdb::BasicCCDBManager* ccdb, int timeoutSeconds)
std::string GeometryEntry::accessFile(const std::string& path, const std::string& downloadPath, o2::ccdb::BasicCCDBManager* ccdb, int timeoutSeconds)
{

if (path.rfind("ccdb:", 0) == 0) {
Expand Down
4 changes: 2 additions & 2 deletions ALICE3/Core/GeometryContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace o2::fastsim
struct GeometryEntry {
// Default constructor
GeometryEntry() = default;
explicit GeometryEntry(std::string filename, o2::ccdb::BasicCCDBManager* ccdb = nullptr)
explicit GeometryEntry(const std::string& filename, o2::ccdb::BasicCCDBManager* ccdb = nullptr)
{
mFileName = accessFile(filename, "./.ALICE3/Configuration/", ccdb);
mConfigurations = GeometryEntry::parseTEnvConfiguration(mFileName, mLayerNames);
Expand All @@ -59,7 +59,7 @@ struct GeometryEntry {
* @param timeoutSeconds If positive, then this function will wait for these seconds after download before removing the downloaded file.
* @return The local path to the file, either the original local path or the path to the retrieved file from ccdb
*/
static std::string accessFile(const std::string& path, const std::string downloadPath = "/tmp/GeometryContainer/", o2::ccdb::BasicCCDBManager* ccdb = nullptr, int timeoutSeconds = 0);
static std::string accessFile(const std::string& path, const std::string& downloadPath = "/tmp/GeometryContainer/", o2::ccdb::BasicCCDBManager* ccdb = nullptr, int timeoutSeconds = 0);

std::map<std::string, std::map<std::string, std::string>> getConfigurations() const { return mConfigurations; }
std::map<std::string, std::string> getConfiguration(const std::string& layerName) const;
Expand Down
2 changes: 1 addition & 1 deletion ALICE3/Macros/testFastTracker.C
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <string>

void testFastTracker(std::string geometryFile = "a3geo.ini")
void testFastTracker(const std::string& geometryFile = "a3geo.ini")
{

fair::Logger::SetConsoleSeverity(fair::Severity::debug);
Expand Down
2 changes: 1 addition & 1 deletion ALICE3/TableProducer/OTF/onTheFlyTracker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ struct OnTheFlyTracker {
std::get<std::shared_ptr<T>>(it->second)->Fill(std::forward<Args>(args)...);
}

void insertHist(const std::string& name, const std::string& title, HistType type, std::vector<AxisSpec> axisSpecs)
void insertHist(const std::string& name, const std::string& title, HistType type, const std::vector<AxisSpec>& axisSpecs)
{
histPointers[name] = histos.add(name.c_str(), title.c_str(), type, axisSpecs);
}
Expand Down
4 changes: 2 additions & 2 deletions ALICE3/TableProducer/OTF/onTheFlyTrackerPid.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ struct OnTheFlyTrackerPid {
return (measuredToT - expectedToT) / resolution;
}

float getToTMeanFromMomentumSlice(std::shared_ptr<TH2> hist, float momentum)
float getToTMeanFromMomentumSlice(const std::shared_ptr<TH2>& hist, float momentum)
{
if (!hist)
return -1.f;
Expand All @@ -319,7 +319,7 @@ struct OnTheFlyTrackerPid {
return mean;
}

float getToTResolutionFromMomentumSlice(std::shared_ptr<TH2> hist, float momentum)
float getToTResolutionFromMomentumSlice(const std::shared_ptr<TH2>& hist, float momentum)
{
if (!hist)
return -1.f;
Expand Down
11 changes: 6 additions & 5 deletions ALICE3/TableProducer/alice3TrackingTranslator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>

TString inputPath;
Expand Down Expand Up @@ -113,7 +114,7 @@ struct Alice3TrackingTranslator {
}

struct FileStruct {
FileStruct(std::string filename, std::string treename) : mFile(filename.c_str(), "READ")
FileStruct(const std::string& filename, const std::string& treename) : mFile(filename.c_str(), "READ")
{
if (mFile.IsZombie()) {
LOG(fatal) << "Could not open file '" << filename << "'";
Expand All @@ -137,7 +138,7 @@ struct Alice3TrackingTranslator {
};

struct ParticleStruct : public FileStruct {
ParticleStruct(std::string filename, std::string treename) : FileStruct(filename, treename)
ParticleStruct(const std::string& filename, const std::string& treename) : FileStruct(std::move(filename), std::move(treename))
{
// mTree->Print();
SETADDRESS("particle_type", m_particle_type);
Expand Down Expand Up @@ -180,7 +181,7 @@ struct Alice3TrackingTranslator {
};

struct VertexStruct : public FileStruct {
VertexStruct(std::string filename, std::string treename) : FileStruct(filename, treename)
VertexStruct(const std::string& filename, const std::string& treename) : FileStruct(filename, treename)
{
SETADDRESS("vx", m_x);
SETADDRESS("vy", m_y);
Expand Down Expand Up @@ -214,7 +215,7 @@ struct Alice3TrackingTranslator {
};

struct TrackStruct : public FileStruct {
TrackStruct(std::string filename, std::string treename) : FileStruct(filename, treename)
TrackStruct(const std::string& filename, const std::string& treename) : FileStruct(std::move(filename), std::move(treename))
{
mTree->Print();
// Set branch addresses for ACTS track parameters
Expand Down Expand Up @@ -288,7 +289,7 @@ struct Alice3TrackingTranslator {
};

struct HitsStruct : public FileStruct {
HitsStruct(std::string filename, std::string treename) : FileStruct(filename, treename)
HitsStruct(const std::string& filename, const std::string& treename) : FileStruct(std::move(filename), std::move(treename))
{
mTree->Print();
SETADDRESS("barcode", barcode);
Expand Down
Loading