12#ifndef O2_CALIBRATION_TOFCALIB_COLLECTOR_H
13#define O2_CALIBRATION_TOFCALIB_COLLECTOR_H
46 TOFCalibCollectorDevice(std::shared_ptr<o2::base::GRPGeomRequest> req,
bool useCCDB) : mCCDBRequest(req), mUseCCDB(useCCDB) {}
51 bool isTFsendingPolicy = ic.options().get<
bool>(
"tf-sending-policy");
52 int maxEnt = ic.options().get<
int>(
"max-number-hits-to-fill-tree");
53 bool isTest = ic.options().get<
bool>(
"running-in-test-mode");
54 bool absMaxEnt = ic.options().get<
bool>(
"is-max-number-hits-to-fill-tree-absolute");
55 auto updateInterval = ic.options().get<uint32_t>(
"update-interval");
56 mCollector = std::make_unique<o2::tof::TOFCalibCollector>(isTFsendingPolicy, maxEnt);
57 mCollector->setIsTest(isTest);
58 mCollector->setIsMaxNumberOfHitsAbsolute(absMaxEnt);
59 mCollector->setFinalizeWhenReady();
60 mCollector->setCheckIntervalInfiniteSlot(updateInterval);
61 mCollector->setMaxSlotsDelay(0);
73 auto data = pc.inputs().get<gsl::span<o2::dataformats::CalibInfoTOF>>(
"input");
76 const auto lhcPhaseIn = pc.inputs().get<
LHCphase*>(
"tofccdbLHCphase");
77 const auto channelCalibIn = pc.inputs().get<
TimeSlewing*>(
"tofccdbChannelCalib");
79 float phase = lhcPhaseIn->getLHCphase(0);
85 LOG(detail) <<
"Processing TF " << mCollector->getCurrentTFInfo().tfCounter <<
" with " <<
data.size() <<
" tracks";
86 mCollector->process(
data);
87 sendOutput(pc.outputs());
94 if (mCollector->getNSlots() != 0) {
95 mCollector->finalizeSlot(mCollector->getSlot(0));
97 sendOutput(ec.outputs());
101 std::unique_ptr<o2::tof::TOFCalibCollector> mCollector;
102 std::shared_ptr<o2::base::GRPGeomRequest> mCCDBRequest;
103 int mMaxNumOfHits = 0;
104 bool mUseCCDB =
false;
110 auto& collectedInfo = mCollector->getCollectedCalibInfo();
111 LOG(
debug) <<
"In CollectorSpec sendOutput: size = " << collectedInfo.size();
112 if (collectedInfo.size()) {
113 auto entries = collectedInfo.size();
115 auto entriesPerChannel = mCollector->getEntriesPerChannel();
118 mCollector->initOutput();
133 std::vector<OutputSpec> outputs;
137 std::vector<InputSpec> inputs;
138 inputs.emplace_back(
"input",
"TOF",
"CALIBDATA");
139 auto ccdbRequest = std::make_shared<o2::base::GRPGeomRequest>(
true,
153 "calib-tofcalib-collector",
158 {
"max-number-hits-to-fill-tree",
VariantType::Int, 500, {
"maximum number of entries in one channel to trigger teh filling of the tree"}},
159 {
"is-max-number-hits-to-fill-tree-absolute",
VariantType::Bool,
false, {
"to decide if we want to multiply the max-number-hits-to-fill-tree by the number of channels (when set to true), or not (when set to false) for fast checks"}},
160 {
"tf-sending-policy",
VariantType::Bool,
false, {
"if we are sending output at every TF; otherwise, we use the max-number-hits-to-fill-tree"}},
161 {
"running-in-test-mode",
VariantType::Bool,
false, {
"to run in test mode for simplification"}},
162 {
"update-interval",
VariantType::UInt32, 10u, {
"number of TF after which to try to finalize calibration"}}}};
Class to store the output of the matching to TOF for calibration.
Class to store the output of the matching to TOF for calibration.
Class to store the output of the matching to TOF for calibration.
Utils and constants for calibration and related workflows.
Helper for geometry and GRP related CCDB requests.
void checkUpdates(o2::framework::ProcessingContext &pc)
bool finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj)
static GRPGeomHelper & instance()
void setRequest(std::shared_ptr< GRPGeomRequest > req)
void endOfStream(o2::framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
TOFCalibCollectorDevice(std::shared_ptr< o2::base::GRPGeomRequest > req, bool useCCDB)
void init(o2::framework::InitContext &ic) final
void run(o2::framework::ProcessingContext &pc) final
void finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj) final
static constexpr Double_t BC_TIME_INPS
static constexpr Double_t BC_TIME_INPS_INV
constexpr o2::header::DataOrigin gDataOriginTOF
constexpr TFType INFINITE_TF
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
static void fillTFIDInfo(o2::framework::ProcessingContext &pc, o2::dataformats::TFIDInfo &ti)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"