Project
Loading...
Searching...
No Matches
TOFCalibCollectorSpec.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#ifndef O2_CALIBRATION_TOFCALIB_COLLECTOR_H
13#define O2_CALIBRATION_TOFCALIB_COLLECTOR_H
14
17
21#include "Framework/Task.h"
26#include "TOFBase/Geo.h"
30
31#include <limits>
32
33using namespace o2::framework;
34
35namespace o2
36{
37namespace calibration
38{
39
41{
44
45 public:
46 TOFCalibCollectorDevice(std::shared_ptr<o2::base::GRPGeomRequest> req, bool useCCDB) : mCCDBRequest(req), mUseCCDB(useCCDB) {}
47
49 {
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(); // finalize slot once stat is ok and create next one
60 mCollector->setCheckIntervalInfiniteSlot(updateInterval);
61 mCollector->setMaxSlotsDelay(0);
62 }
63
64 //_________________________________________________________________
65 void finaliseCCDB(o2::framework::ConcreteDataMatcher& matcher, void* obj) final
66 {
68 }
69
71 {
73 auto data = pc.inputs().get<gsl::span<o2::dataformats::CalibInfoTOF>>("input");
74
75 if (mUseCCDB) { // read calibration objects from ccdb
76 const auto lhcPhaseIn = pc.inputs().get<LHCphase*>("tofccdbLHCphase");
77 const auto channelCalibIn = pc.inputs().get<TimeSlewing*>("tofccdbChannelCalib");
78
79 float phase = lhcPhaseIn->getLHCphase(0);
80 int bcshift = (phase + 5000) * o2::tof::Geo::BC_TIME_INPS_INV;
81 mCollector->setLHCphase(phase - bcshift * o2::tof::Geo::BC_TIME_INPS);
82 }
83
84 o2::base::TFIDInfoHelper::fillTFIDInfo(pc, mCollector->getCurrentTFInfo());
85 LOG(detail) << "Processing TF " << mCollector->getCurrentTFInfo().tfCounter << " with " << data.size() << " tracks";
86 mCollector->process(data);
87 sendOutput(pc.outputs());
88 }
89
91 {
92 mCollector->checkSlotsToFinalize(o2::calibration::INFINITE_TF);
93 // we force finalizing slot zero (unless everything was already finalized), no matter how many entries we had
94 if (mCollector->getNSlots() != 0) {
95 mCollector->finalizeSlot(mCollector->getSlot(0));
96 }
97 sendOutput(ec.outputs());
98 }
99
100 private:
101 std::unique_ptr<o2::tof::TOFCalibCollector> mCollector;
102 std::shared_ptr<o2::base::GRPGeomRequest> mCCDBRequest;
103 int mMaxNumOfHits = 0;
104 bool mUseCCDB = false;
105
106 //________________________________________________________________
107 void sendOutput(DataAllocator& output)
108 {
109 // in output we send the calibration tree
110 auto& collectedInfo = mCollector->getCollectedCalibInfo();
111 LOG(debug) << "In CollectorSpec sendOutput: size = " << collectedInfo.size();
112 if (collectedInfo.size()) {
113 auto entries = collectedInfo.size();
114 // this means that we are ready to send the output
115 auto entriesPerChannel = mCollector->getEntriesPerChannel();
116 output.snapshot(Output{o2::header::gDataOriginTOF, "COLLECTEDINFO", 0}, collectedInfo);
117 output.snapshot(Output{o2::header::gDataOriginTOF, "ENTRIESCH", 0}, entriesPerChannel);
118 mCollector->initOutput(); // reset the output for the next round
119 }
120 }
121};
122
123} // namespace calibration
124
125namespace framework
126{
127
128DataProcessorSpec getTOFCalibCollectorDeviceSpec(bool useCCDB)
129{
132
133 std::vector<OutputSpec> outputs;
134 outputs.emplace_back(o2::header::gDataOriginTOF, "COLLECTEDINFO", 0, Lifetime::Timeframe);
135 outputs.emplace_back(o2::header::gDataOriginTOF, "ENTRIESCH", 0, Lifetime::Timeframe);
136
137 std::vector<InputSpec> inputs;
138 inputs.emplace_back("input", "TOF", "CALIBDATA");
139 auto ccdbRequest = std::make_shared<o2::base::GRPGeomRequest>(true, // orbitResetTime
140 true, // GRPECS=true
141 false, // GRPLHCIF
142 false, // GRPMagField
143 false, // askMatLUT
145 inputs);
146
147 if (useCCDB) {
148 inputs.emplace_back("tofccdbLHCphase", o2::header::gDataOriginTOF, "LHCphase", 0, Lifetime::Condition, ccdbParamSpec("TOF/Calib/LHCphase"));
149 inputs.emplace_back("tofccdbChannelCalib", o2::header::gDataOriginTOF, "ChannelCalib", 0, Lifetime::Condition, ccdbParamSpec("TOF/Calib/ChannelCalib"));
150 }
151
152 return DataProcessorSpec{
153 "calib-tofcalib-collector",
154 inputs,
155 outputs,
156 AlgorithmSpec{adaptFromTask<device>(ccdbRequest, useCCDB)},
157 Options{
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"}}}};
163}
164
165} // namespace framework
166} // namespace o2
167
168#endif
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.
std::ostringstream debug
uint64_t phase
Definition RawEventData.h:7
unsigned int uint32_t
std::vector< long > entries
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 Print launch bounds used for RTC code as debugging for exit after Allow RTC with slave GPUReconstruction instances with optConstexpr and optSpecialcode Maximum number of RTC cache files per backend in the cache the oldest are Prepend RTC compilation commands by this string Load a parameter object containing the launch bounds from a file h configStandalone Processing proc_param TPC Cluster Z Error Parameterization h configStandalone Processing settings for neural network proc_nn std::string Specify inference device(cpu(default), rocm, cuda)") AddOption(nnInferenceDeviceId
Helper for geometry and GRP related CCDB requests.
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
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
Definition Geo.h:105
static constexpr Double_t BC_TIME_INPS_INV
Definition Geo.h:106
constexpr o2::header::DataOrigin gDataOriginTOF
Definition DataHeader.h:578
constexpr TFType INFINITE_TF
Definition TimeSlot.h:30
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
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"