Skip to content

Commit a23fdc9

Browse files
committed
Merge branch 'dev' into gpu_clusterizer
2 parents f1af003 + ce065f9 commit a23fdc9

Some content is hidden

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

47 files changed

+1564
-1270
lines changed

.github/workflows/reports.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ jobs:
1717
if: github.repository == 'AliceO2Group/AliceO2'
1818

1919
steps:
20-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
2121
- name: Set up Python 3.10
2222
uses: actions/setup-python@v5
2323
with:
2424
python-version: '3.10'
25-
- uses: actions/cache@v2
25+
- uses: actions/cache@v4
2626
name: Configure pip caching
2727
with:
2828
path: ~/.cache/pip

CCDB/include/CCDB/CCDBDownloader.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ struct HeaderObjectPair_t {
4747

4848
typedef struct DownloaderRequestData {
4949
std::vector<std::string> hosts;
50+
std::vector<std::string> locations;
5051
std::string path;
5152
long timestamp;
5253
HeaderObjectPair_t hoPair;
@@ -231,12 +232,13 @@ class CCDBDownloader
231232
std::string prepareRedirectedURL(std::string address, std::string potentialHost) const;
232233

233234
/**
234-
* Returns a vector of possible content locations based on the redirect headers.
235+
* Updates the locations vector with the the locations.
235236
*
236-
* @param baseUrl Content path.
237237
* @param headerMap Map containing response headers.
238+
* @param locations Location list to be updated.
239+
* @param locIndex Index of the next locaiton to be tried.
238240
*/
239-
std::vector<std::string> getLocations(std::multimap<std::string, std::string>* headerMap) const;
241+
void updateLocations(std::multimap<std::string, std::string>* headerMap, std::vector<std::string>* locations, int* locIndex) const;
240242

241243
std::string mUserAgentId = "CCDBDownloader";
242244
/**

CCDB/include/CCDB/CcdbApi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ class CcdbApi //: public DatabaseInterface
388388
static bool removeSemaphore(std::string const& name, bool remove = false);
389389
static void removeLeakingSemaphores(std::string const& basedir, bool remove = false);
390390

391-
void loadFileToMemory(o2::pmr::vector<char>& dest, const std::string& path, std::map<std::string, std::string>* localHeaders = nullptr) const;
391+
void loadFileToMemory(o2::pmr::vector<char>& dest, const std::string& path, std::map<std::string, std::string>* localHeaders = nullptr, bool fetchLocalMetaData = true) const;
392392
void loadFileToMemory(o2::pmr::vector<char>& dest, std::string const& path,
393393
std::map<std::string, std::string> const& metadata, long timestamp,
394394
std::map<std::string, std::string>* headers, std::string const& etag,

CCDB/src/CCDBDownloader.cxx

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ void CCDBDownloader::tryNewHost(PerformData* performData, CURL* easy_handle)
362362
{
363363
auto requestData = performData->requestData;
364364
std::string newUrl = requestData->hosts.at(performData->hostInd) + "/" + requestData->path + "/" + std::to_string(requestData->timestamp);
365-
LOG(debug) << "Connecting to another host " << newUrl;
365+
LOG(debug) << "Connecting to another host " << newUrl << "\n";
366366
requestData->hoPair.header.clear();
367367
curl_easy_setopt(easy_handle, CURLOPT_URL, newUrl.c_str());
368368
mHandlesToBeAdded.push_back(easy_handle);
@@ -374,9 +374,11 @@ void CCDBDownloader::getLocalContent(PerformData* performData, std::string& newL
374374
LOG(debug) << "Redirecting to local content " << newLocation << "\n";
375375
if (requestData->localContentCallback(newLocation)) {
376376
contentRetrieved = true;
377+
LOG(debug) << "Local content retrieved succesfully: " << newLocation << " n";
377378
} else {
378379
// Prepare next redirect url
379380
newLocation = getNewLocation(performData, locations);
381+
LOG(debug) << "Failed to retrieve local content: " << newLocation << "\n";
380382
}
381383
}
382384

@@ -396,15 +398,15 @@ std::string CCDBDownloader::getNewLocation(PerformData* performData, std::vector
396398
void CCDBDownloader::httpRedirect(PerformData* performData, std::string& newLocation, CURL* easy_handle)
397399
{
398400
auto requestData = performData->requestData;
399-
LOG(debug) << "Trying content location " << newLocation;
401+
LOG(debug) << "Trying content location " << newLocation << "\n";
400402
curl_easy_setopt(easy_handle, CURLOPT_URL, newLocation.c_str());
401403
mHandlesToBeAdded.push_back(easy_handle);
402404
}
403405

404406
void CCDBDownloader::followRedirect(PerformData* performData, CURL* easy_handle, std::vector<std::string>& locations, bool& rescheduled, bool& contentRetrieved)
405407
{
406408
std::string newLocation = getNewLocation(performData, locations);
407-
if (newLocation.find("alien:/", 0) != std::string::npos || newLocation.find("file:/", 0) != std::string::npos) {
409+
while (!contentRetrieved && (newLocation.find("alien:/", 0) != std::string::npos || newLocation.find("file:/", 0) != std::string::npos)) {
408410
getLocalContent(performData, newLocation, contentRetrieved, locations);
409411
}
410412
if (!contentRetrieved && newLocation != "") {
@@ -508,17 +510,17 @@ void CCDBDownloader::transferFinished(CURL* easy_handle, CURLcode curlCode)
508510
std::string currentHost = requestData->hosts[performData->hostInd];
509511
std::string loggingMessage = prepareLogMessage(currentHost, requestData->userAgent, requestData->path, requestData->timestamp, requestData->headers, httpCode);
510512

511-
// Get alternative locations for the same host
512-
auto locations = getLocations(&(requestData->hoPair.header));
513+
// Get new locations based on received headers
514+
updateLocations(&(requestData->hoPair.header), &requestData->locations, &performData->locInd);
513515

514516
// React to received http code
515517
if (200 <= httpCode && httpCode < 400) {
516518
LOG(debug) << loggingMessage;
517519
if (304 == httpCode) {
518520
LOGP(debug, "Object exists but I am not serving it since it's already in your possession");
519521
contentRetrieved = true;
520-
} else if (300 <= httpCode && httpCode < 400 && performData->locInd < locations.size()) {
521-
followRedirect(performData, easy_handle, locations, rescheduled, contentRetrieved);
522+
} else if (300 <= httpCode && httpCode < 400 && performData->locInd < requestData->locations.size()) {
523+
followRedirect(performData, easy_handle, requestData->locations, rescheduled, contentRetrieved);
522524
} else if (200 <= httpCode && httpCode < 300) {
523525
contentRetrieved = true; // Can be overruled by following error check
524526
}
@@ -531,8 +533,16 @@ void CCDBDownloader::transferFinished(CURL* easy_handle, CURLcode curlCode)
531533
contentRetrieved = false;
532534
}
533535

534-
// Check if content was retrieved, or scheduled to be retrieved
535-
if (!rescheduled && !contentRetrieved && performData->locInd == locations.size()) {
536+
// Check if content was retrieved or scheduled to be retrieved
537+
if (!rescheduled && !contentRetrieved) {
538+
// Current location failed without providing 3xx http code, try next redirect for the same host
539+
if (performData->locInd < requestData->locations.size()) {
540+
followRedirect(performData, easy_handle, requestData->locations, rescheduled, contentRetrieved);
541+
}
542+
}
543+
544+
// Check again because content might have been retrieved or rescheduled via a redirect
545+
if (!rescheduled && !contentRetrieved) {
536546
// Ran out of locations to redirect, try new host
537547
if (++performData->hostInd < requestData->hosts.size()) {
538548
tryNewHost(performData, easy_handle);
@@ -650,24 +660,37 @@ CURLcode CCDBDownloader::perform(CURL* handle)
650660
return batchBlockingPerform(handleVector).back();
651661
}
652662

653-
std::vector<std::string> CCDBDownloader::getLocations(std::multimap<std::string, std::string>* headerMap) const
663+
void CCDBDownloader::updateLocations(std::multimap<std::string, std::string>* headerMap, std::vector<std::string>* locations, int* locIndex) const
654664
{
655-
std::vector<std::string> locs;
665+
std::vector<std::string> newLocations;
666+
656667
auto iter = headerMap->find("Location");
657668
if (iter != headerMap->end()) {
658-
locs.push_back(iter->second);
669+
auto range = headerMap->equal_range("Location");
670+
for (auto it = range.first; it != range.second; ++it) {
671+
if (std::find(locations->begin(), locations->end(), it->second) == locations->end()) {
672+
if (std::find(newLocations.begin(), newLocations.end(), it->second) == newLocations.end()) {
673+
newLocations.push_back(it->second);
674+
}
675+
}
676+
}
659677
}
678+
660679
// add alternative locations (not yet included)
661680
auto iter2 = headerMap->find("Content-Location");
662681
if (iter2 != headerMap->end()) {
663682
auto range = headerMap->equal_range("Content-Location");
664683
for (auto it = range.first; it != range.second; ++it) {
665-
if (std::find(locs.begin(), locs.end(), it->second) == locs.end()) {
666-
locs.push_back(it->second);
684+
if (std::find(locations->begin(), locations->end(), it->second) == locations->end()) {
685+
if (std::find(newLocations.begin(), newLocations.end(), it->second) == newLocations.end()) {
686+
newLocations.push_back(it->second);
687+
}
667688
}
668689
}
669690
}
670-
return locs;
691+
692+
// Insert location list at the current location index. This assures that the provided locations will be tried first.
693+
locations->insert(locations->begin() + (*locIndex), newLocations.begin(), newLocations.end());
671694
}
672695

673696
std::vector<CURLcode> CCDBDownloader::batchBlockingPerform(std::vector<CURL*> const& handleVector)

CCDB/src/CcdbApi.cxx

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,23 @@ size_t header_map_callback(char* buffer, size_t size, size_t nitems, void* userd
667667
}
668668
}
669669
}
670+
671+
// Keep only the first ETag encountered
672+
if (key == "ETag") {
673+
auto cl = headers->find("ETag");
674+
if (cl != headers->end()) {
675+
insert = false;
676+
}
677+
}
678+
679+
// Keep only the first Content-Type encountered
680+
if (key == "Content-Type") {
681+
auto cl = headers->find("Content-Type");
682+
if (cl != headers->end()) {
683+
insert = false;
684+
}
685+
}
686+
670687
if (insert) {
671688
headers->insert(std::make_pair(key, value));
672689
}
@@ -1971,20 +1988,32 @@ void CcdbApi::vectoredLoadFileToMemory(std::vector<RequestContext>& requestConte
19711988
bool CcdbApi::loadLocalContentToMemory(o2::pmr::vector<char>& dest, std::string& url) const
19721989
{
19731990
if (url.find("alien:/", 0) != std::string::npos) {
1974-
loadFileToMemory(dest, url, nullptr); // headers loaded from the file in case of the snapshot reading only
1975-
return true;
1991+
std::map<std::string, std::string> localHeaders;
1992+
loadFileToMemory(dest, url, &localHeaders, false);
1993+
auto it = localHeaders.find("Error");
1994+
if (it != localHeaders.end() && it->second == "An error occurred during retrieval") {
1995+
return false;
1996+
} else {
1997+
return true;
1998+
}
19761999
}
19772000
if ((url.find("file:/", 0) != std::string::npos)) {
19782001
std::string path = url.substr(7);
19792002
if (std::filesystem::exists(path)) {
1980-
loadFileToMemory(dest, path, nullptr);
1981-
return true;
2003+
std::map<std::string, std::string> localHeaders;
2004+
loadFileToMemory(dest, url, &localHeaders, o2::utils::Str::endsWith(path, ".root"));
2005+
auto it = localHeaders.find("Error");
2006+
if (it != localHeaders.end() && it->second == "An error occurred during retrieval") {
2007+
return false;
2008+
} else {
2009+
return true;
2010+
}
19822011
}
19832012
}
19842013
return false;
19852014
}
19862015

1987-
void CcdbApi::loadFileToMemory(o2::pmr::vector<char>& dest, const std::string& path, std::map<std::string, std::string>* localHeaders) const
2016+
void CcdbApi::loadFileToMemory(o2::pmr::vector<char>& dest, const std::string& path, std::map<std::string, std::string>* localHeaders, bool fetchLocalMetaData) const
19882017
{
19892018
// Read file to memory as vector. For special case of the locally cached file retriev metadata stored directly in the file
19902019
constexpr size_t MaxCopySize = 0x1L << 25;
@@ -2032,7 +2061,7 @@ void CcdbApi::loadFileToMemory(o2::pmr::vector<char>& dest, const std::string& p
20322061
totalread += nread;
20332062
} while (nread == (long)MaxCopySize);
20342063

2035-
if (localHeaders) {
2064+
if (localHeaders && fetchLocalMetaData) {
20362065
TMemFile memFile("name", const_cast<char*>(dest.data()), dest.size(), "READ");
20372066
auto storedmeta = (std::map<std::string, std::string>*)extractFromTFile(memFile, TClass::GetClass("std::map<std::string, std::string>"), CCDBMETA_ENTRY);
20382067
if (storedmeta) {

CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
/DataFormats/Detectors/CPV @peressounko @kharlov
3030
/DataFormats/Detectors/CTP @lietava
3131
/DataFormats/Detectors/EMCAL @mfasDa @jokonig
32-
/DataFormats/Detectors/FIT @jotwinow @afurs @andreasmolander @arvindkhuntia @mslupeck
32+
/DataFormats/Detectors/FIT @jotwinow @afurs @andreasmolander @sahilupadhyaya92
3333
/DataFormats/Detectors/FOCAL @maxrauch @mfasDa @iarsene @matthiasrichter
3434
/DataFormats/Detectors/GlobalTracking @shahor02
3535
/DataFormats/Detectors/GlobalTrackingWorkflow @shahor02
@@ -59,7 +59,7 @@
5959
/Detectors/Calibration @chiarazampolli @shahor02
6060
/Detectors/CPV @peressounko @kharlov
6161
/Detectors/EMCAL @mfasDa @jokonig
62-
/Detectors/FIT @jotwinow @afurs @andreasmolander @arvindkhuntia @mslupeck
62+
/Detectors/FIT @jotwinow @afurs @andreasmolander @sahilupadhyaya92
6363
/Detectors/FOCAL @maxrauch @mfasDa @iarsene @matthiasrichter
6464
/Detectors/Geometry @sawenzel @shahor02
6565
/Detectors/GlobalTracking @shahor02

Detectors/ITSMFT/ITS/tracking/src/TrackingInterface.cxx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,15 @@ void ITSTrackingInterface::initialise()
120120
for (auto& params : trackParams) {
121121
params.CorrType = o2::base::PropagatorImpl<float>::MatCorrType::USEMatCorrLUT;
122122
}
123-
124123
// adjust pT settings to actual mag. field
125124
for (size_t ip = 0; ip < trackParams.size(); ip++) {
126125
auto& param = trackParams[ip];
126+
param.TrackletMinPt *= bFactor;
127127
for (int ilg = trackConf.MaxTrackLenght; ilg >= trackConf.MinTrackLenght; ilg--) {
128128
int lslot = trackConf.MaxTrackLenght - ilg;
129129
param.MinPt[lslot] *= bFactor;
130-
param.TrackletMinPt *= bFactor;
131130
}
132131
}
133-
134132
mTracker->setParameters(trackParams);
135133
mVertexer->setParameters(vertParams);
136134
}

Detectors/MUON/MCH/Conditions/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ o2_add_executable(
3737
O2::MCHGlobalMapping
3838
)
3939

40+
o2_add_executable(
41+
scan-hvlv-ccdb
42+
COMPONENT_NAME mch
43+
SOURCES src/scan-hvlv-ccdb.cxx
44+
PUBLIC_LINK_LIBRARIES
45+
O2::CCDB
46+
O2::CommonUtils
47+
O2::DetectorsDCS
48+
O2::MCHConditions
49+
O2::MCHStatus
50+
)
51+
4052
if(BUILD_TESTING)
4153
o2_add_test(
4254
dcs-aliases

Detectors/MUON/MCH/Conditions/README.md

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ Those objects are stored at the following CCDB paths :
1717
- MCH/Calib/BadChannel
1818
- MCH/Calib/RejectList
1919

20-
The BadChannel and RejectList objects can be uploaded, e.g. for debug purposes, using the `o2-mch-bad-channels-ccdb` program :
20+
# o2-mch-bad-channels-ccdb
21+
22+
The BadChannel and RejectList objects can be uploaded, e.g. for debug purposes, using the `o2-mch-bad-channels-ccdb` program:
2123

2224
```shell
2325
$ o2-mch-bad-channels-ccdb --help
@@ -46,10 +48,57 @@ Usage:
4648
-a [ --alias ] arg DCS alias (HV or LV) to reject
4749
```
4850

49-
For instance, to create in a local CCDB a RejectList object which declares solar number 32 as bad, from Tuesday 1 November 2022 00:00:01 UTC to Saturday 31 December 2022 23:59:59, use :
51+
For instance, to create in a local CCDB a RejectList object which declares solar number 32 as bad, from Tuesday 1 November 2022 00:00:01 UTC to Saturday 31 December 2022 23:59:59, use:
5052

5153
```shell
5254
$ o2-mch-bad-channels-ccdb -p -s 32 -t RejectList --starttimestamp 1667260801000 --endtimestamp 1672531199000
5355
```
5456

5557
The program will search the reference CCDB (defined with `--referenceccdb`) for existing objects valid during this period and propose you to either overwrite them or update them. In the first case, a single object will be created, valid for the whole period, containing only the new bad channels. In the second case, as many objects as necessary will be created with appropriate validity ranges, adding the new bad channels to the existing ones.
58+
59+
# o2-mch-scan-hvlv-ccdb
60+
61+
the HV or LV DCS datapoints stored in the CCDB (http://alice-ccdb.cern.ch) can be scanned using the `o2-mch-scan-hvlv-ccdb` program:
62+
63+
```shell
64+
$ o2-mch-scan-hvlv-ccdb -h
65+
This program scans HV or LV channels looking for issues
66+
Usage:
67+
-h [ --help ] produce help message
68+
-r [ --runs ] arg run(s) to scan (comma separated list of runs
69+
or ASCII file with one run per line)
70+
-c [ --channels ] arg channel(s) to scan ("HV" or "LV" or comma
71+
separated list of (part of) DCS aliases)
72+
--configKeyValues arg Semicolon separated key=value strings to
73+
change HV thresholds
74+
-d [ --duration ] arg (=0) minimum duration (ms) of HV/LV issues to
75+
consider
76+
-w [ --warning ] arg (=1) warning level (0, 1 or 2)
77+
-p [ --print ] arg (=1) print level (0, 1, 2 or 3)
78+
-o [ --output ] arg (=scan.root) output root file name
79+
```
80+
81+
It takes as input a list of runs and a list of either HV or LV channels to scan. **Note that it will scan the CCDB from the begining of the first run to the end of the last one, which can represent quite of lot of files.** More details about the options are given below.
82+
83+
It produces as output a list of detected issues, with time, duration and affected runs, and a root file with the displays of the data points per channel per chamber for a visual inspection. Issues are triggered when HV/LV values go below a given threshold. For HV channels it also compares the issues found by the internal algorithm with the ones found by [Detectors/MUON/MCH/Status/src/HVStatusCreator.cxx](../Status/src/HVStatusCreator.cxx).
84+
85+
For instance, to scan all HV channels for runs 545222 and 545223 and detect issues of a minimum duration of 10s, use:
86+
```shell
87+
o2-mch-scan-hvlv-ccdb -r 545222,545223 -c HV -d 10000
88+
```
89+
90+
### channel input formats:
91+
* "HV" to scan all HV channels
92+
* "LV" to scan all LV channels
93+
* comma separated list of (part of) DCS aliases, which must be all of the same type, i.e contain either Quad/Slat (type = HV), or Group/an/di/Sol (type = LV)
94+
95+
### warning levels:
96+
* 0: no warning
97+
* 1: check data points timestamp w.r.t. HV/LV file validity range with ±5s tolerance
98+
* 2: check data points timestamp w.r.t. HV/LV file validity range without tolerance
99+
100+
### print levels:
101+
* 0: print detected issues
102+
* 1: same as 0 + print validity range of runs and HV/LV files
103+
* 2: same as 1 + print the first and last data points of each selected channel
104+
* 3: same as 1 + print all the data points of each selected channel

0 commit comments

Comments
 (0)