43int main(
int argc,
char** argv)
45 const std::string testCCDB =
"http://ccdb-test.cern.ch:8080";
47 const std::string aliceCCDB =
"http://alice-ccdb.cern.ch";
48 bpo::variables_map vm;
49 bpo::options_description opt_general(
"Usage:\n " + std::string(argv[0]) +
50 " Write ctp config or scalers to BK\n");
51 bpo::options_description opt_hidden(
"");
52 bpo::options_description opt_all;
53 bpo::positional_options_description opt_pos;
55 auto add_option = opt_general.add_options();
56 add_option(
"help,h",
"Print this help message");
57 add_option(
"input-file,f", bpo::value<std::string>()->default_value(
"none"),
"input file name, none - do not read file");
58 add_option(
"bkhost,b", bpo::value<std::string>()->default_value(
"none"),
"bk web address");
59 add_option(
"ccdb", bpo::value<std::string>()->default_value(
"alice"),
"choose databse: test- test ccdb; prod - production ccdb; alice - alice ccdb; else ccdb parameter");
60 add_option(
"run-number,r", bpo::value<uint32_t>()->default_value(0),
"run number");
61 add_option(
"timestamp,t", bpo::value<uint64_t>()->default_value(0),
"timestamp; if 0 timestamp is calulated inside this code");
62 add_option(
"cfg,c", bpo::value<bool>()->default_value(0),
"Do cfg");
63 add_option(
"scalers,s", bpo::value<bool>()->default_value(0),
"Do scalers");
65 opt_all.add(opt_general).add(opt_hidden);
66 bpo::store(bpo::command_line_parser(argc, argv).options(opt_all).positional(opt_pos).run(), vm);
67 if (vm.count(
"help")) {
68 std::cout << opt_general << std::endl;
72 }
catch (bpo::error&
e) {
73 std::cerr <<
"ERROR: " <<
e.what() << std::endl
75 std::cerr << opt_general << std::endl;
77 }
catch (std::exception&
e) {
78 std::cerr <<
e.what() <<
", application will now exit" << std::endl;
84 std::vector<std::string>
runs;
86 std::cout <<
"run:" << run << std::endl;
88 std::cout <<
"pushing" << std::endl;
92 std::string
filename = vm[
"input-file"].as<std::string>();
95 if (!
file.is_open()) {
96 LOG(fatal) <<
"Cannot open file:" <<
filename << std::endl;
99 while (std::getline(
file, line)) {
100 std::cout << line <<
"\n";
103 runs.push_back(tokens[0]);
107 bool cfg = vm[
"cfg"].as<
bool>();
108 bool scalers = vm[
"scalers"].as<
bool>();
109 std::cout <<
"Doing: cfg:" << cfg <<
" scal:" << scalers << std::endl;
110 if (cfg || scalers) {
111 std::string bkhost = vm[
"bkhost"].as<std::string>();
112 std::unique_ptr<o2::bkp::api::BkpClient> mBKClient = o2::bkp::api::BkpClientFactory::create(bkhost);
114 std::string ccdbAddress;
115 if (vm[
"ccdb"].as<std::string>() ==
"prod") {
117 }
else if (vm[
"ccdb"].as<std::string>() ==
"test") {
118 ccdbAddress = testCCDB;
119 }
else if (vm[
"ccdb"].as<std::string>() ==
"alice") {
120 ccdbAddress = aliceCCDB;
122 ccdbAddress = vm[
"ccdb"].as<std::string>();
125 std::cout <<
"CCDB: " << vm[
"ccdb"].as<std::string>() <<
" " << ccdbAddress << std::endl;
126 std::map<std::string, std::string> metadata;
127 for (
auto const& run :
runs) {
128 metadata[
"runNumber"] = run;
130 int runNumber = std::stoi(run);
134 std::string ctpcfgstr = ctpcfg.getConfigString();
136 mBKClient->run()->setRawCtpTriggerConfiguration(runNumber, ctpcfgstr);
137 }
catch (std::runtime_error&
error) {
138 std::cerr <<
"An error occurred: " <<
error.what() << std::endl;
141 LOG(info) <<
"Run BK:" << run <<
" CFG:" << cfg;
145 ctpcnts.convertRawToO2();
146 std::vector<uint32_t> clsinds = ctpcnts.getClassIndexes();
147 long ts = ctpcnts.getTimeLimit().second;
149 for (
auto const& ind : clsinds) {
150 std::array<uint64_t, 7> cntsbk = ctpcnts.getIntegralForClass(
i);
151 std::string clsname = ctpcfg.getClassNameFromHWIndex(cntsbk[0]);
153 mBKClient->ctpTriggerCounters()->createOrUpdateForRun(runNumber, clsname, ts, cntsbk[1], cntsbk[2], cntsbk[3], cntsbk[4], cntsbk[5], cntsbk[6]);
154 std::cout << runNumber <<
" clsname: " << cntsbk[0] <<
" " << clsname <<
" t:" << ts <<
" cnts:" << cntsbk[1] <<
" " << cntsbk[2] <<
" " << cntsbk[3] <<
" " << cntsbk[4] <<
" " << cntsbk[5] <<
" " << cntsbk[6] << std::endl;
157 }
catch (std::runtime_error&
error) {
158 std::cerr <<
"An error occurred: " <<
error.what() << std::endl;
168 std::cout <<
"o2-ctp-bk-write done" << std::endl;
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions Compile RTC in deterministic with NO_FAST_MATH flags and GPUCA_DETERMINISTIC_MODE define Use RTC to optimize GPU code h configStandalone Processing proc_rtctech Use a file lock to serialize access to the cache folder int32_t