-
Notifications
You must be signed in to change notification settings - Fork 496
Expand file tree
/
Copy pathUploadDummyAlignment.C
More file actions
35 lines (32 loc) · 1.39 KB
/
UploadDummyAlignment.C
File metadata and controls
35 lines (32 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#if !defined(__CLING__) || defined(__ROOTCLING__)
//#define ENABLE_UPGRADES
#include "DetectorsCommonDataFormats/DetID.h"
#include "DetectorsCommonDataFormats/DetectorNameConf.h"
#include "DetectorsCommonDataFormats/AlignParam.h"
#include "CCDB/CcdbApi.h"
#include "Framework/Logger.h"
#include <vector>
#include <fmt/format.h>
#endif
using DetID = o2::detectors::DetID;
// upload dummy alignment objects to CCDB
void UploadDummyAlignment(const std::string& ccdbHost = "http://ccdb-test.cern.ch:8080", long tmin = 1, long tmax = o2::ccdb::CcdbObjectInfo::INFINITE_TIMESTAMP, DetID::mask_t msk = DetID::FullMask)
{
DetID::mask_t dets = msk & DetID::FullMask;
LOG(info) << "Mask = " << dets;
o2::ccdb::CcdbApi api;
api.init(ccdbHost.c_str()); // or http://localhost:8080 for a local installation
std::vector<o2::detectors::AlignParam> params;
for (auto id = DetID::First; id <= DetID::Last; id++) {
if (!dets[id]) {
continue;
}
std::map<std::string, std::string> metadata; // can be empty
DetID det(id);
metadata["comment"] = fmt::format("Empty alignment object for {}", det.getName());
metadata["default"] = "true"; // tag default objects
metadata["Created"] = "2"; // tag default objects
api.storeAsTFileAny(¶ms, o2::base::DetectorNameConf::getAlignmentPath(det), metadata, tmin, tmax);
LOG(info) << "Uploaded dummy alignment for " << det.getName();
}
}