Skip to content

Commit 674a93e

Browse files
authored
Merge branch 'dev' into retractable_IRIS
2 parents ba18575 + ef43f9f commit 674a93e

File tree

527 files changed

+4447
-11241
lines changed

Some content is hidden

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

527 files changed

+4447
-11241
lines changed

CCDB/include/CCDB/CcdbApi.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,11 @@ class CcdbApi //: public DatabaseInterface
348348
TObject* retrieveFromTFile(std::string const& path, std::map<std::string, std::string> const& metadata, long timestamp,
349349
std::map<std::string, std::string>* headers, std::string const& etag,
350350
const std::string& createdNotAfter, const std::string& createdNotBefore) const;
351+
void loadFileToMemory(std::vector<char>& dest, std::string const& path,
352+
std::map<std::string, std::string> const& metadata, long timestamp,
353+
std::map<std::string, std::string>* headers, std::string const& etag,
354+
const std::string& createdNotAfter, const std::string& createdNotBefore, bool considerSnapshot = true) const;
355+
351356
#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__ROOTCLING__) && !defined(__CLING__)
352357
typedef struct RequestContext {
353358
o2::pmr::vector<char>& dest;

CCDB/src/CcdbApi.cxx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,6 +1870,21 @@ void CcdbApi::saveSnapshot(RequestContext& requestContext) const
18701870
}
18711871
}
18721872

1873+
void CcdbApi::loadFileToMemory(std::vector<char>& dest, std::string const& path,
1874+
std::map<std::string, std::string> const& metadata, long timestamp,
1875+
std::map<std::string, std::string>* headers, std::string const& etag,
1876+
const std::string& createdNotAfter, const std::string& createdNotBefore, bool considerSnapshot) const
1877+
{
1878+
o2::pmr::vector<char> destP;
1879+
destP.reserve(dest.size());
1880+
loadFileToMemory(destP, path, metadata, timestamp, headers, etag, createdNotAfter, createdNotBefore, considerSnapshot);
1881+
dest.clear();
1882+
dest.reserve(destP.size());
1883+
for (const auto c : destP) {
1884+
dest.push_back(c);
1885+
}
1886+
}
1887+
18731888
void CcdbApi::loadFileToMemory(o2::pmr::vector<char>& dest, std::string const& path,
18741889
std::map<std::string, std::string> const& metadata, long timestamp,
18751890
std::map<std::string, std::string>* headers, std::string const& etag,

Common/DCAFitter/include/DCAFitter/DCAFitterN.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,13 @@ class DCAFitterN
324324
pnt[2] = tr.getZ();
325325
}
326326

327+
GPUdi() void clearLogThrottlers()
328+
{
329+
mLoggerBadCov.clear();
330+
mLoggerBadInv.clear();
331+
mLoggerBadProp.clear();
332+
}
333+
327334
void setBadCovPolicy(BadCovPolicy v) { mBadCovPolicy = v; }
328335
BadCovPolicy getBadCovPolicy() const { return mBadCovPolicy; }
329336

@@ -1084,10 +1091,16 @@ template <int N, typename... Args>
10841091
GPUd() void DCAFitterN<N, Args...>::print() const
10851092
{
10861093
#ifndef GPUCA_GPUCODE_DEVICE
1087-
LOG(info) << N << "-prong vertex fitter in " << (mUseAbsDCA ? "abs." : "weighted") << " distance minimization mode";
1088-
LOG(info) << "Bz: " << mBz << " MaxIter: " << mMaxIter << " MaxChi2: " << mMaxChi2;
1094+
LOG(info) << N << "-prong vertex fitter in " << (mUseAbsDCA ? "abs." : "weighted") << " distance minimization mode, collinear tracks mode: " << (mIsCollinear ? "ON" : "OFF");
1095+
LOG(info) << "Bz: " << mBz << " MaxIter: " << mMaxIter << " MaxChi2: " << mMaxChi2 << " MatCorrType: " << int(mMatCorr);
10891096
LOG(info) << "Stopping condition: Max.param change < " << mMinParamChange << " Rel.Chi2 change > " << mMinRelChi2Change;
10901097
LOG(info) << "Discard candidates for : Rvtx > " << getMaxR() << " DZ between tracks > " << mMaxDZIni;
1098+
LOG(info) << "PropagateToPCA:" << mPropagateToPCA << " WeightedFinalPCA:" << mWeightedFinalPCA << " UsePropagator:" << mUsePropagator << " RefitWithMatCorr:" << mRefitWithMatCorr;
1099+
std::string rep{};
1100+
for (int i = 0; i < mCrossings.nDCA; i++) {
1101+
rep += fmt::format("seed{}:{}/{} ", i, mTrPropDone[i], mPropFailed[i]);
1102+
}
1103+
LOG(info) << "Last call: NCand:" << mCurHyp << " from " << mCrossings.nDCA << " seeds, prop.done/failed: " << rep;
10911104
#else
10921105
if (mUseAbsDCA) {
10931106
printf("%d-prong vertex fitter in abs. distance minimization mode\n", N);

Common/DCAFitter/test/testDCAFitterN.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ BOOST_AUTO_TEST_CASE(DCAFitterNProngs)
238238
BOOST_CHECK(meanDA < 0.1);
239239
BOOST_CHECK(meanDAW < 0.1);
240240
BOOST_CHECK(meanDW < 0.1);
241+
ft.print();
241242
}
242243

243244
// 2 prongs vertices with collinear tracks (gamma conversion)
@@ -316,6 +317,7 @@ BOOST_AUTO_TEST_CASE(DCAFitterNProngs)
316317
BOOST_CHECK(meanDA < 2.1);
317318
BOOST_CHECK(meanDAW < 2.1);
318319
BOOST_CHECK(meanDW < 2.1);
320+
ft.print();
319321
}
320322

321323
// 2 prongs vertices with one of charges set to 0: Helix : Line
@@ -394,6 +396,7 @@ BOOST_AUTO_TEST_CASE(DCAFitterNProngs)
394396
BOOST_CHECK(meanDA < 0.1);
395397
BOOST_CHECK(meanDAW < 0.1);
396398
BOOST_CHECK(meanDW < 0.1);
399+
ft.print();
397400
}
398401

399402
// 2 prongs vertices with both of charges set to 0: Line : Line
@@ -471,6 +474,7 @@ BOOST_AUTO_TEST_CASE(DCAFitterNProngs)
471474
BOOST_CHECK(meanDA < 0.1);
472475
BOOST_CHECK(meanDAW < 0.1);
473476
BOOST_CHECK(meanDW < 0.1);
477+
ft.print();
474478
}
475479

476480
// 3 prongs vertices
@@ -547,8 +551,8 @@ BOOST_AUTO_TEST_CASE(DCAFitterNProngs)
547551
BOOST_CHECK(meanDA < 0.1);
548552
BOOST_CHECK(meanDAW < 0.1);
549553
BOOST_CHECK(meanDW < 0.1);
554+
ft.print();
550555
}
551-
552556
outStream.Close();
553557
}
554558

Common/MathUtils/include/MathUtils/LegendrePols.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class Legendre2DPolynominal final : public TNamed,
200200
boost::math::legendre_p(i - j, y);
201201
}
202202

203-
inline int getFlatIdx(int i, int j) const { return i * (i - 1) / 2 + j; }
203+
inline int getFlatIdx(int i, int j) const { return i * (i + 1) / 2 + j; }
204204

205205
unsigned int fOrder{0};
206206
std::vector<double> fParams;

Common/Topologies/o2prototype_topology.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ The following parameters need adjustment when extending the FLP-EPN configuratio
7474
</decltask>
7575

7676
<decltask id="tracker">
77-
<exe reachable="true">$ALICEO2_INSTALL_DIR/bin/aliceHLTWrapper Tracker_%collectionIndex%_%taskIndex% 1 --dds --poll-period 100 --input type=pull,size=5000,method=connect,property=EPNReceiverOutputAddress,count=1 --output type=push,size=500,method=bind,property=TrackingOutputAddress,min-port=48000 --library libAliHLTTPC.so --component TPCCATracker --run 167808 --parameter '-GlobalTracking -allowGPU -GPUHelperThreads 4 -loglevel=0x7c'</exe>
77+
<exe reachable="true">$ALICEO2_INSTALL_DIR/bin/aliceHLTWrapper Tracker_%collectionIndex%_%taskIndex% 1 --dds --poll-period 100 --input type=pull,size=5000,method=connect,property=EPNReceiverOutputAddress,count=1 --output type=push,size=500,method=bind,property=TrackingOutputAddress,min-port=48000 --library libAliHLTTPC.so --component TPCCATracker --run 167808 --parameter '-GlobalTracking -allowGPU -loglevel=0x7c'</exe>
7878
<!-- <requirement></requirement> -->
7979
<properties>
8080
<id access="read">EPNReceiverOutputAddress</id>

Common/Utils/src/FileFetcher.cxx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ bool FileFetcher::copyFile(size_t id)
329329
bool aliencpMode = false;
330330
std::string uuid{};
331331
std::vector<std::string> logsToClean;
332+
std::string dbgset{};
332333
if (mCopyCmd.find("alien") != std::string::npos) {
333334
if (!gGrid && !TGrid::Connect("alien://")) {
334335
LOG(error) << "Copy command refers to alien but connection to Grid failed";
@@ -339,18 +340,18 @@ bool FileFetcher::copyFile(size_t id)
339340
c = '_';
340341
}
341342
}
342-
gSystem->Setenv("ALIENPY_DEBUG", "1");
343-
logsToClean.push_back(fmt::format("log_alienpy_{}.txt", uuid));
344-
gSystem->Setenv("ALIENPY_DEBUG_FILE", logsToClean.back().c_str());
345-
gSystem->Setenv("XRD_LOGLEVEL", "Dump");
346-
logsToClean.push_back(fmt::format("log_xrd_{}.txt", uuid));
347-
gSystem->Setenv("XRD_LOGFILE", logsToClean.back().c_str());
348-
LOGP(info, "debug log files for {}: ALIENPY_DEBUG_FILE={} XRD_LOGFILE={}", mInputFiles[id].getOrigName(),
349-
getenv("ALIENPY_DEBUG_FILE") ? getenv("ALIENPY_DEBUG_FILE") : "",
350-
getenv("XRD_LOGFILE") ? getenv("XRD_LOGFILE") : "");
343+
if (!(getenv("ALIENPY_DEBUG") && std::stoi(getenv("ALIENPY_DEBUG")) == 1)) {
344+
logsToClean.push_back(fmt::format("log_alienpy_{}.txt", uuid));
345+
dbgset += fmt::format("ALIENPY_DEBUG=1 ALIENPY_DEBUG_FILE={} ", logsToClean.back());
346+
}
347+
if (!(getenv("XRD_LOGLEVEL") && strcmp(getenv("XRD_LOGLEVEL"), "Dump") == 0)) {
348+
logsToClean.push_back(fmt::format("log_xrd_{}.txt", uuid));
349+
dbgset += fmt::format("XRD_LOGLEVEL=Dump XRD_LOGFILE={} ", logsToClean.back());
350+
}
351+
LOGP(debug, "debug setting for for {}: {}", mInputFiles[id].getOrigName(), dbgset);
351352
}
352353
auto realCmd = std::regex_replace(std::regex_replace(mCopyCmd, std::regex(R"(\?src)"), mInputFiles[id].getOrigName()), std::regex(R"(\?dst)"), mInputFiles[id].getLocalName());
353-
auto fullCmd = fmt::format(R"(sh -c "{}" >> {} 2>&1)", realCmd, mCopyCmdLogFile);
354+
auto fullCmd = fmt::format(R"(sh -c "{}{}" >> {} 2>&1)", dbgset, realCmd, mCopyCmdLogFile);
354355
LOG(info) << "Executing " << fullCmd;
355356
const auto sysRet = gSystem->Exec(fullCmd.c_str());
356357
if (sysRet != 0) {

DataFormats/Detectors/CTP/include/DataFormatsCTP/CTPRateFetcher.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,18 @@ class CTPRateFetcher
3333
void setupRun(int runNumber, o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, bool initScalers);
3434
void updateScalers(ctp::CTPRunScalers& scalers);
3535
int getRates(std::array<double, 3>& rates, o2::ccdb::BasicCCDBManager* ccdb, int runNumber, const std::string sourceName); // rates at start,stop and middle of the run
36-
void setOrbit(bool orb) { mOrbit = orb; }
37-
void setOutsideLimits(bool qc) { mOutsideLimits = qc; }
36+
double getLumi(o2::ccdb::BasicCCDBManager* ccdb, int runNumber, const std::string sourceName, int puCorr = 0); // total lumi for a run
37+
double getLumiNoPuCorr(const std::string& classname, int type = 1);
38+
double getLumiWPuCorr(const std::string& classname, int type = 1);
39+
void setOrbit(bool orb) { mOrbit = orb; } // use orbit instead of time
40+
void setOutsideLimits(bool qc) { mOutsideLimits = qc; } // return first/last rate of time outside of run
3841

3942
private:
4043
double fetchCTPratesInputs(uint64_t timeStamp, int input);
4144
double fetchCTPratesClasses(uint64_t timeStamp, const std::string& className, int inputType = 1);
4245
double fetchCTPratesInputsNoPuCorr(uint64_t timeStamp, int input);
4346
double fetchCTPratesClassesNoPuCorr(uint64_t timeStamp, const std::string& className, int inputType = 1);
44-
47+
double getLumi(const std::string& classname, int type = 1, int puCorr = 0);
4548
double pileUpCorrection(double rate);
4649
int mRunNumber = -1;
4750
bool mOutsideLimits = 0;

DataFormats/Detectors/CTP/include/DataFormatsCTP/Scalers.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ class CTPRunScalers
143143
mScalerRecordO2[mScalerRecordO2.size() - 1].scalers[i].l1After - mScalerRecordO2[0].scalers[i].l1After,
144144
};
145145
}
146+
/// retrieves integral - same interface as getRate, no pileup correction
147+
uint64_t getLumiNoPuCorr(int classindex, int type) const;
148+
/// retrieves vector of counters - same interface as getRate, needed for
149+
std::vector<std::pair<double_t, double_t>> getRatesForIndex(int classindex, int type) const;
146150
/// retrieves time boundaries of this scaler object from O2 scalers
147151
std::pair<unsigned long, unsigned long> getTimeLimit() const
148152
{

DataFormats/Detectors/CTP/src/CTPRateFetcher.cxx

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ double CTPRateFetcher::fetchNoPuCorr(o2::ccdb::BasicCCDBManager* ccdb, uint64_t
4141
if (runNumber < 534202) {
4242
return fetchCTPratesClassesNoPuCorr(timeStamp, "minbias_TVX_L0", 3); // 2022
4343
} else {
44-
double_t ret = fetchCTPratesClassesNoPuCorr(timeStamp, "CMTVX-B-NOPF");
44+
double ret = fetchCTPratesClassesNoPuCorr(timeStamp, "CMTVX-B-NOPF");
4545
if (ret == -2.) {
4646
LOG(info) << "Trying different class";
4747
ret = fetchCTPratesClassesNoPuCorr(timeStamp, "CMTVX-NONE");
@@ -77,6 +77,94 @@ int CTPRateFetcher::getRates(std::array<double, 3>& rates, o2::ccdb::BasicCCDBMa
7777
rates[2] = rateM;
7878
return 0;
7979
}
80+
double CTPRateFetcher::getLumiNoPuCorr(const std::string& classname, int type)
81+
{
82+
if (classname == "zncinp") {
83+
return mScalers.getLumiNoPuCorr(26, 7);
84+
}
85+
std::vector<ctp::CTPClass>& ctpcls = mConfig.getCTPClasses();
86+
std::vector<int> clslist = mConfig.getTriggerClassList();
87+
int classIndex = -1;
88+
for (size_t i = 0; i < clslist.size(); i++) {
89+
if (ctpcls[i].name.find(classname) != std::string::npos) {
90+
classIndex = i;
91+
break;
92+
}
93+
}
94+
if (classIndex == -1) {
95+
LOG(warn) << "Trigger class " << classname << " not found in CTPConfiguration";
96+
return -1;
97+
}
98+
return mScalers.getLumiNoPuCorr(classIndex, type);
99+
}
100+
double CTPRateFetcher::getLumiWPuCorr(const std::string& classname, int type)
101+
{
102+
std::vector<std::pair<double, double>> scals;
103+
if (classname == "zncinp") {
104+
scals = mScalers.getRatesForIndex(26, 7);
105+
} else {
106+
std::vector<ctp::CTPClass>& ctpcls = mConfig.getCTPClasses();
107+
std::vector<int> clslist = mConfig.getTriggerClassList();
108+
int classIndex = -1;
109+
for (size_t i = 0; i < clslist.size(); i++) {
110+
if (ctpcls[i].name.find(classname) != std::string::npos) {
111+
classIndex = i;
112+
break;
113+
}
114+
}
115+
if (classIndex == -1) {
116+
LOG(warn) << "Trigger class " << classname << " not found in CTPConfiguration";
117+
return -1;
118+
}
119+
scals = mScalers.getRatesForIndex(classIndex, type);
120+
}
121+
double lumi = 0;
122+
for (auto const& ss : scals) {
123+
// std::cout << ss.first << " " << ss.second << " " << pileUpCorrection(ss.first/ss.second) << std::endl;
124+
lumi += pileUpCorrection(ss.first / ss.second) * ss.second;
125+
}
126+
return lumi;
127+
}
128+
double CTPRateFetcher::getLumi(const std::string& classname, int type, int puCorr)
129+
{
130+
if (puCorr) {
131+
return getLumiWPuCorr(classname, type);
132+
} else {
133+
return getLumiNoPuCorr(classname, type);
134+
}
135+
}
136+
137+
double CTPRateFetcher::getLumi(o2::ccdb::BasicCCDBManager* ccdb, int runNumber, const std::string sourceName, int puCorr)
138+
{
139+
// setupRun(runNumber, ccdb, timeStamp, 1);
140+
if (sourceName.find("ZNC") != std::string::npos) {
141+
if (runNumber < 544448) {
142+
return getLumi("zncinp", 1, puCorr) / (sourceName.find("hadronic") != std::string::npos ? 28. : 1.);
143+
} else {
144+
return getLumi("C1ZNC-B-NOPF-CRU", 6, puCorr) / (sourceName.find("hadronic") != std::string::npos ? 28. : 1.);
145+
}
146+
} else if (sourceName == "T0CE") {
147+
return getLumi("CMTVXTCE-B-NOPF", 1, puCorr);
148+
} else if (sourceName == "T0SC") {
149+
return getLumi("CMTVXTSC-B-NOPF", 1, puCorr);
150+
} else if (sourceName == "T0VTX") {
151+
if (runNumber < 534202) {
152+
return getLumi("minbias_TVX_L0", 3, puCorr); // 2022
153+
} else {
154+
double ret = getLumi("CMTVX-B-NOPF", 1, puCorr);
155+
if (ret == -1.) {
156+
LOG(info) << "Trying different class";
157+
ret = getLumi("CMTVX-NONE", 1, puCorr);
158+
if (ret < 0) {
159+
LOG(fatal) << "None of the classes used for lumi found";
160+
}
161+
}
162+
return ret;
163+
}
164+
}
165+
LOG(error) << "CTP Lumi for " << sourceName << " not available";
166+
return 0;
167+
}
80168
//
81169
double CTPRateFetcher::fetchCTPratesClasses(uint64_t timeStamp, const std::string& className, int inputType)
82170
{

0 commit comments

Comments
 (0)