32#include <fmt/format.h>
48 for (
const auto& p : sm) {
58 std::shared_ptr<base::GRPGeomRequest> ggRequest)
59 : mUseBadChannels(useBadChannels),
60 mUseRejectList(useRejectList),
62 mGGRequest(ggRequest) {}
71 mHVStatusCreator.
clear();
73 mUpdateStatusMap =
false;
75 auto stop = [
this]() {
76 auto fullTime = mFindBadHVsTime + mFindCurrentBadHVsTime + mUpdateStatusTime;
77 LOGP(info,
"duration: {:g} ms (findBadHVs: {:g} ms, findCurrentBadHVs: {:g} ms, updateStatusMap: {:g} ms)",
78 fullTime.count(), mFindBadHVsTime.count(), mFindCurrentBadHVsTime.count(), mUpdateStatusTime.count());
86 auto bad =
static_cast<std::vector<o2::mch::DsChannelId>*
>(obj);
88 mUpdateStatusMap =
true;
90 auto rl =
static_cast<std::vector<o2::mch::DsChannelId>*
>(obj);
92 mUpdateStatusMap =
true;
94 auto tStart = std::chrono::high_resolution_clock::now();
97 mFindBadHVsTime += std::chrono::high_resolution_clock::now() - tStart;
98 }
else if (mGGRequest) {
109 if (mUseBadChannels) {
111 pc.
inputs().
get<std::vector<o2::mch::DsChannelId>*>(
"badchannels");
114 if (mUseRejectList) {
116 pc.
inputs().
get<std::vector<o2::mch::DsChannelId>*>(
"rejectlist");
124 auto tStart = std::chrono::high_resolution_clock::now();
127 auto timestamp = orbitReset +
static_cast<uint64_t>(firstTForbit * constants::lhc::LHCOrbitMUS * 1.e-3);
129 LOGP(info,
"HV status updated at timestamp {}", timestamp);
130 mUpdateStatusMap =
true;
132 mFindCurrentBadHVsTime += std::chrono::high_resolution_clock::now() - tStart;
136 if (mUpdateStatusMap) {
138 LOGP(info,
"Sending updated StatusMap of size {}",
size(mStatusMap));
140 LOGP(info,
"Sending unchanged StatusMap of size {}",
size(mStatusMap));
148 bool mUseBadChannels{
false};
149 bool mUseRejectList{
false};
151 std::shared_ptr<base::GRPGeomRequest> mGGRequest{};
152 std::vector<o2::mch::DsChannelId> mBadChannels{};
153 std::vector<o2::mch::DsChannelId> mRejectList{};
154 HVStatusCreator mHVStatusCreator{};
155 StatusMap mStatusMap{};
156 bool mUpdateStatusMap{
false};
157 std::chrono::duration<double, std::milli> mFindBadHVsTime{};
158 std::chrono::duration<double, std::milli> mFindCurrentBadHVsTime{};
159 std::chrono::duration<double, std::milli> mUpdateStatusTime{};
161 void updateStatusMap()
163 auto tStart = std::chrono::high_resolution_clock::now();
168 mUpdateStatusMap =
false;
169 mUpdateStatusTime += std::chrono::high_resolution_clock::now() - tStart;
178 std::shared_ptr<base::GRPGeomRequest> ggRequest{};
180 std::vector<InputSpec> inputs{};
181 if (useBadChannels) {
182 inputs.emplace_back(
InputSpec{
"badchannels",
"MCH",
"BADCHANNELS", 0, Lifetime::Condition,
ccdbParamSpec(
"MCH/Calib/BadChannel")});
185 inputs.emplace_back(
InputSpec{
"rejectlist",
"MCH",
"REJECTLIST", 0, Lifetime::Condition,
ccdbParamSpec(
"MCH/Calib/RejectList")});
188 inputs.emplace_back(
InputSpec{
"hv",
"MCH",
"HV", 0, Lifetime::Condition,
ccdbParamSpec(
"MCH/Calib/HV", {}, 1)});
190 ggRequest = std::make_shared<base::GRPGeomRequest>(
true,
199 std::vector<OutputSpec> outputs{};
200 outputs.emplace_back(
OutputSpec{{
"statusmap"},
"MCH",
"STATUSMAP", 0, Lifetime::Timeframe});
202 if (inputs.empty()) {
209 ctx.services().get<
ControlService>().readyToQuit(QuitRequest::Me);
219 AlgorithmSpec{adaptFromTask<StatusMapCreatorTask>(useBadChannels, useRejectList, useHV, ggRequest)},
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
Helper for geometry and GRP related CCDB requests.
Header to collect LHC related constants.
auto getOrbitResetTimeMS() const
void checkUpdates(o2::framework::ProcessingContext &pc)
bool finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj)
static GRPGeomHelper & instance()
void setRequest(std::shared_ptr< GRPGeomRequest > req)
static const StatusMapCreatorParam & Instance()
void snapshot(const Output &spec, T const &object)
ServiceRegistryRef services()
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
ServiceRegistryRef services()
The services registry associated with this processing context.
void findBadHVs(const DPMAP &dpMap)
std::unordered_map< DPID, std::vector< DPVAL > > DPMAP
bool findCurrentBadHVs(uint64_t timestamp)
void updateStatusMap(StatusMap &statusMap) const
void clear()
Clear the internal lists of HV issues.
void init(InitContext &ic)
void finaliseCCDB(ConcreteDataMatcher &matcher, void *obj)
void run(ProcessingContext &pc)
StatusMapCreatorTask(bool useBadChannels, bool useRejectList, bool useHV, std::shared_ptr< base::GRPGeomRequest > ggRequest)
void add(gsl::span< const DsChannelId > badchannels, uint32_t mask)
Defining ITS Vertex explicitly as messageable.
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
o2::framework::DataProcessorSpec getStatusMapCreatorSpec(std::string_view specName="mch-statusmap-creator")
bool useBadChannels
reject bad channels (obtained during pedestal calibration runs)
bool useRejectList
use extra rejection list (relative to other bad channels sources)
bool useHV
reject channels connected to bad HV sectors