Skip to content

Commit 128121f

Browse files
authored
Merge c2ae4a6 into sapling-pr-archive-ktf
2 parents f90c6ce + c2ae4a6 commit 128121f

56 files changed

Lines changed: 1703 additions & 450 deletions

File tree

Some content is hidden

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

Common/Field/src/MagFieldFast.cxx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@ MagFieldFast::MagFieldFast(float factor, int nomField, const string inpFmt) : mF
6161
bool MagFieldFast::LoadData(const string inpFName)
6262
{
6363
// load field from text file
64-
65-
std::ifstream in(gSystem->ExpandPathName(inpFName.data()), std::ifstream::in);
64+
TString sName(inpFName);
65+
if (gSystem->ExpandPathName(sName)) {
66+
LOG(fatal) << "Failed to expand file name " << inpFName;
67+
}
68+
std::ifstream in(sName.Data(), std::ifstream::in);
6669
if (in.fail()) {
6770
LOG(fatal) << "Failed to open file " << inpFName;
6871
return false;

Common/Field/src/MagneticField.cxx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
/// \author ruben.shahoyan@cern.ch
1515

1616
#include "Field/MagneticField.h"
17-
#include <TFile.h> // for TFile
18-
#include <TPRegexp.h> // for TPRegexp
19-
#include <TSystem.h> // for TSystem, gSystem
17+
#include <TFile.h> // for TFile
18+
#include <TPRegexp.h> // for TPRegexp
19+
#include <TString.h> // for TString
20+
#include <TSystem.h> // for TSystem, gSystem
2021
#include <fairlogger/Logger.h> // for FairLogger
2122
#include "FairParamList.h"
2223
#include "FairRun.h"
@@ -242,7 +243,8 @@ Bool_t MagneticField::loadParameterization()
242243
LOG(fatal) << "MagneticField::loadParameterization: Field data " << getParameterName()
243244
<< " are already loaded from " << getDataFileName() << "\n";
244245
}
245-
const char* fname = gSystem->ExpandPathName(getDataFileName());
246+
TString fname = getDataFileName();
247+
gSystem->ExpandPathName(fname);
246248
TFile* file = TFile::Open(fname);
247249
if (!file) {
248250
LOG(fatal) << "MagneticField::loadParameterization: Failed to open magnetic field data file " << fname << "\n";

Common/Utils/include/CommonUtils/ConfigurableParamHelper.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include "CommonUtils/ConfigurableParam.h"
1818
#include "TClass.h"
19+
#include <memory>
1920
#include <type_traits>
2021
#include <typeinfo>
2122
#include "TFile.h"
@@ -105,22 +106,23 @@ class ConfigurableParamHelper : virtual public ConfigurableParam
105106
if (!isInitialized()) {
106107
initialize();
107108
}
108-
auto members = getDataMembers();
109-
_ParamHelper::printMembersImpl(getName(), members, showProv, useLogger, withPadding, showHash);
109+
auto members = std::unique_ptr<std::vector<ParamDataMember>>(getDataMembers());
110+
_ParamHelper::printMembersImpl(getName(), members.get(), showProv, useLogger, withPadding, showHash);
110111
}
111112

112113
//
113114
size_t getHash() const final
114115
{
115-
return _ParamHelper::getHashImpl(getName(), getDataMembers());
116+
auto members = std::unique_ptr<std::vector<ParamDataMember>>(getDataMembers());
117+
return _ParamHelper::getHashImpl(getName(), members.get());
116118
}
117119

118120
// ----------------------------------------------------------------
119121

120122
void output(std::ostream& out) const final
121123
{
122-
auto members = getDataMembers();
123-
_ParamHelper::outputMembersImpl(out, getName(), members, true, false);
124+
auto members = std::unique_ptr<std::vector<ParamDataMember>>(getDataMembers());
125+
_ParamHelper::outputMembersImpl(out, getName(), members.get(), true, false);
124126
}
125127

126128
// ----------------------------------------------------------------
@@ -242,22 +244,23 @@ class ConfigurableParamPromoter : public Base, virtual public ConfigurableParam
242244
if (!isInitialized()) {
243245
initialize();
244246
}
245-
auto members = getDataMembers();
246-
_ParamHelper::printMembersImpl(getName(), members, showProv, useLogger, withPadding, showHash);
247+
auto members = std::unique_ptr<std::vector<ParamDataMember>>(getDataMembers());
248+
_ParamHelper::printMembersImpl(getName(), members.get(), showProv, useLogger, withPadding, showHash);
247249
}
248250

249251
//
250252
size_t getHash() const final
251253
{
252-
return _ParamHelper::getHashImpl(getName(), getDataMembers());
254+
auto members = std::unique_ptr<std::vector<ParamDataMember>>(getDataMembers());
255+
return _ParamHelper::getHashImpl(getName(), members.get());
253256
}
254257

255258
// ----------------------------------------------------------------
256259

257260
void output(std::ostream& out) const final
258261
{
259-
auto members = getDataMembers();
260-
_ParamHelper::outputMembersImpl(out, getName(), members, true, false);
262+
auto members = std::unique_ptr<std::vector<ParamDataMember>>(getDataMembers());
263+
_ParamHelper::outputMembersImpl(out, getName(), members.get(), true, false);
261264
}
262265

263266
// ----------------------------------------------------------------

DataFormats/Detectors/FIT/common/include/DataFormatsFIT/LookUpTable.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <Rtypes.h>
2525
#include <iostream>
2626
#include <tuple>
27+
#include <TString.h>
2728
#include <TSystem.h>
2829
#include <map>
2930
#include <string>
@@ -236,7 +237,9 @@ class LookupTableBase
236237
}
237238
inputDir += "/share/Detectors/FT0/files/";
238239
filepath = inputDir + "LookupTable_FT0.json";
239-
filepath = gSystem->ExpandPathName(filepath.data()); // Expand $(ALICE_ROOT) into real system path
240+
TString expandedFilepath = filepath;
241+
gSystem->ExpandPathName(expandedFilepath); // Expand $(ALICE_ROOT) into real system path
242+
filepath = expandedFilepath.Data();
240243
} else {
241244
filepath = pathToFile;
242245
}

DataFormats/Detectors/ITSMFT/ITS/include/DataFormatsITS/TrackITS.h

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ namespace its
3535

3636
class TrackITS : public o2::track::TrackParCov
3737
{
38+
public:
39+
static constexpr unsigned int ExtendedPatternShift = 24;
40+
static constexpr int MaxLayersInTrackPattern = 8;
41+
42+
private:
3843
enum UserBits {
3944
kSharedClusters = 1 << 28
4045
};
@@ -106,16 +111,47 @@ class TrackITS : public o2::track::TrackParCov
106111
GPUhdi() uint32_t getPattern() const { return mPattern; }
107112
bool hasHitOnLayer(uint32_t i) const { return mPattern & (0x1 << i); }
108113
bool isFakeOnLayer(uint32_t i) const { return !(mPattern & (0x1 << (16 + i))); }
109-
bool isExtendedOnLayer(uint32_t i) const { return (mPattern & (0x1 << (24 + i))); } // only correct if getNClusters <= 8 on layers <= 8
110-
uint32_t getLastClusterLayer() const
114+
bool isExtendedOnLayer(uint32_t i) const { return (mPattern & (0x1 << (ExtendedPatternShift + i))); } // only correct if getNClusters <= 8 on layers <= 8
115+
template <int NLayers>
116+
GPUhdi() static constexpr uint32_t getLayerPatternMask()
117+
{
118+
return (NLayers >= 32) ? 0xffffffffu : ((1u << NLayers) - 1u);
119+
}
120+
template <int NLayers>
121+
GPUhdi() void setExtendedLayerPattern(uint32_t pattern)
122+
{
123+
pattern &= getLayerPatternMask<NLayers>();
124+
setUserField(static_cast<uint16_t>(pattern));
125+
if constexpr (NLayers <= MaxLayersInTrackPattern) {
126+
setPattern(getPattern() | (pattern << ExtendedPatternShift));
127+
}
128+
}
129+
template <int NLayers>
130+
GPUhdi() uint32_t getExtendedLayerPattern() const
131+
{
132+
const auto mask = getLayerPatternMask<NLayers>();
133+
if constexpr (NLayers <= MaxLayersInTrackPattern) {
134+
const auto pattern = (getPattern() >> ExtendedPatternShift) & mask;
135+
if (pattern) {
136+
return pattern;
137+
}
138+
}
139+
return getUserField() & mask;
140+
}
141+
GPUhdi() void clearExtendedLayerPattern()
142+
{
143+
setUserField(0);
144+
getParamOut().setUserField(0);
145+
}
146+
GPUhdi() uint32_t getLastClusterLayer() const
111147
{
112148
uint32_t r{0}, v{mPattern & ((1 << 16) - 1)};
113149
while (v >>= 1) {
114150
r++;
115151
}
116152
return r;
117153
}
118-
uint32_t getFirstClusterLayer() const
154+
GPUhdi() uint32_t getFirstClusterLayer() const
119155
{
120156
int s{0};
121157
while (!(mPattern & (1 << s))) {

DataFormats/Detectors/ITSMFT/common/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ o2_target_root_dictionary(DataFormatsITSMFT
3535
include/DataFormatsITSMFT/GBTCalibData.h
3636
include/DataFormatsITSMFT/NoiseMap.h
3737
include/DataFormatsITSMFT/TimeDeadMap.h
38+
include/DataFormatsITSMFT/StuckPixelData.h
3839
include/DataFormatsITSMFT/Cluster.h
3940
include/DataFormatsITSMFT/CompCluster.h
4041
include/DataFormatsITSMFT/ClusterPattern.h
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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 StuckPixelData.h
13+
/// @brief CCDB-serializable container for stuck (repeating) pixel error records.
14+
///
15+
/// Design rationale
16+
/// ----------------
17+
/// TTree-based storage is intentionally avoided for CCDB objects because TTree
18+
/// branches hold internal file-pointer state; serialising an in-memory TTree
19+
/// via CcdbApi::createObjectImage() can silently drop the last unflushed basket.
20+
/// A plain std::vector<StuckPixelEntry> has no such issue: ROOT's TClass
21+
/// machinery serialises it correctly via the generated dictionary, exactly as
22+
/// it does for TimeDeadMap.
23+
24+
#ifndef ITSMFT_STUCKPIXELDATA_H
25+
#define ITSMFT_STUCKPIXELDATA_H
26+
27+
#include <vector>
28+
#include <cstdint>
29+
#include <Rtypes.h> // ClassDefNV
30+
31+
namespace o2
32+
{
33+
namespace itsmft
34+
{
35+
36+
/// One stuck-pixel (RepeatingPixel error) record.
37+
struct StuckPixelEntry {
38+
Long64_t orbit{0}; ///< first orbit of the TF in which the error was seen
39+
uint16_t chipID{0}; ///< global chip ID (ITS only)
40+
uint16_t row{0}; ///< pixel row
41+
uint16_t col{0}; ///< pixel column
42+
43+
StuckPixelEntry() = default;
44+
StuckPixelEntry(Long64_t o, uint16_t c, uint16_t r, uint16_t col_)
45+
: orbit(o), chipID(c), row(r), col(col_) {}
46+
47+
ClassDefNV(StuckPixelEntry, 1);
48+
};
49+
50+
/// CCDB payload object: a run-level collection of stuck-pixel records.
51+
class StuckPixelData
52+
{
53+
public:
54+
StuckPixelData() = default;
55+
~StuckPixelData() = default;
56+
57+
void addEntry(Long64_t orbit, uint16_t chipID, uint16_t row, uint16_t col)
58+
{
59+
mEntries.emplace_back(orbit, chipID, row, col);
60+
}
61+
62+
void clear() { mEntries.clear(); }
63+
64+
const std::vector<StuckPixelEntry>& getEntries() const { return mEntries; }
65+
std::size_t size() const { return mEntries.size(); }
66+
bool empty() const { return mEntries.empty(); }
67+
68+
private:
69+
std::vector<StuckPixelEntry> mEntries;
70+
71+
ClassDefNV(StuckPixelData, 1);
72+
};
73+
74+
} // namespace itsmft
75+
} // namespace o2
76+
77+
#endif // ITSMFT_STUCKPIXELDATA_H

DataFormats/Detectors/ITSMFT/common/src/ITSMFTDataFormatsLinkDef.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
#pragma link C++ class o2::itsmft::Digit + ;
2424
#pragma link C++ class o2::itsmft::NoiseMap + ;
2525
#pragma link C++ class o2::itsmft::TimeDeadMap + ;
26+
#pragma link C++ class o2::itsmft::StuckPixelEntry + ;
27+
#pragma link C++ class std::vector < o2::itsmft::StuckPixelEntry> + ;
28+
#pragma link C++ class o2::itsmft::StuckPixelData + ;
2629
#pragma link C++ class std::vector < o2::itsmft::Digit> + ;
2730

2831
#pragma link C++ class o2::itsmft::GBTCalibData + ;

Detectors/FIT/FT0/simulation/src/Detector.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,7 @@ void Detector::DefineOpticalProperties()
12681268
inputDir += "/share/Detectors/FT0/files/";
12691269

12701270
TString optPropPath = inputDir + "quartzOptProperties.txt";
1271-
optPropPath = gSystem->ExpandPathName(optPropPath.Data()); // Expand $(ALICE_ROOT) into real system path
1271+
gSystem->ExpandPathName(optPropPath); // Expand $(ALICE_ROOT) into real system path
12721272

12731273
Int_t result = ReadOptProperties(optPropPath.Data());
12741274
if (result < 0) {
@@ -1426,15 +1426,15 @@ void Detector::DefineSim2LUTindex()
14261426
}
14271427
inputDir += "/share/Detectors/FT0/files/";
14281428

1429-
std::string indPath = inputDir + "Sim2DataChannels.txt";
1430-
indPath = gSystem->ExpandPathName(indPath.data()); // Expand $(ALICE_ROOT) into real system path
1429+
TString indPath = inputDir + "Sim2DataChannels.txt";
1430+
gSystem->ExpandPathName(indPath); // Expand $(ALICE_ROOT) into real system path
14311431

14321432
std::ifstream infile;
1433-
infile.open(indPath.data());
1434-
LOG(info) << " file open " << indPath.data();
1433+
infile.open(indPath.Data());
1434+
LOG(info) << " file open " << indPath.Data();
14351435
// Check if file is opened correctly
14361436
if (infile.fail() == true) {
1437-
LOG(error) << "Error opening ascii file (it is probably a folder!): " << indPath.c_str();
1437+
LOG(error) << "Error opening ascii file (it is probably a folder!): " << indPath;
14381438
}
14391439
int fromfile;
14401440
for (int iind = 0; iind < Geometry::Nchannels; iind++) {

Detectors/GlobalTrackingWorkflow/study/src/HistoManager.cxx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <TPaveStats.h>
2323
#include <TROOT.h>
2424
#include <TSystem.h>
25+
#include <TString.h>
2526
#include "Framework/Logger.h"
2627
#include "GlobalTrackingStudy/HistoManager.h"
2728

@@ -384,7 +385,9 @@ void HistoManager::purify(bool emptyToo)
384385

385386
void HistoManager::setFileName(const std::string& name)
386387
{
387-
mDefName = gSystem->ExpandPathName(name.c_str());
388+
TString sName = name;
389+
gSystem->ExpandPathName(sName);
390+
mDefName = sName.Data();
388391
}
389392

390393
void HistoManager::reset()
@@ -401,7 +404,12 @@ void HistoManager::reset()
401404

402405
int HistoManager::load(const std::string& fname, const std::string& dirname)
403406
{
404-
TFile* file = TFile::Open(gSystem->ExpandPathName(fname.c_str()));
407+
TString sName = fname;
408+
if (gSystem->ExpandPathName(sName)) {
409+
LOGP(error, "Cannot expand file name {}", fname);
410+
return 0;
411+
}
412+
TFile* file = TFile::Open(sName);
405413
if (!file) {
406414
LOGP(error, "No file {}", fname);
407415
return 0;

0 commit comments

Comments
 (0)