Project
Loading...
Searching...
No Matches
NoiseCalibSpec.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_TRD_NOISECALIBSPEC_H
13#define O2_TRD_NOISECALIBSPEC_H
14
17
18#include "Framework/Task.h"
25
26using namespace o2::framework;
27
28namespace o2
29{
30namespace trd
31{
32
34{
35 public:
36 TRDNoiseCalibSpec(bool dummy) : mIsDummy(dummy) {}
38 {
39 // Do we need to initialize something?
40 }
41
43 {
44 auto digits = pc.inputs().get<gsl::span<Digit>>("trddigits");
45 auto trigRecs = pc.inputs().get<gsl::span<TriggerRecord>>("trdtriggerrec");
46
47 if (mIsDummy) {
48 return;
49 }
50
51 // Obtain rough time from the data header (done only once)
52 if (mStartTime == 0) {
55 if (!ti.isDummy()) {
56 mStartTime = ti.creation;
57 }
58 }
59
60 // process the digits, as long as we have not reached the limit
61 if (!mCalibrator.hasEnoughData()) {
62 mCalibrator.process(digits);
63 } else {
64 if (!mHaveSentOutput) {
65 LOGP(important, "Enough data received after {} TFs seen, finalizing noise calibration", mNTFsProcessed);
66 mCalibrator.collectChannelInfo();
67 sendOutput(pc.outputs());
68 mHaveSentOutput = true;
69 } else {
70 if ((mNTFsProcessed % 200) == 0) {
71 LOGP(important, "Not processing anymore. Seen {} TFs in total. Run can be stopped", mNTFsProcessed);
72 }
73 }
74 }
75 ++mNTFsProcessed;
76 }
77
79 {
80 // extract CCDB infos and calibration objects, convert it to TMemFile and send them to the output
81
82 const auto& payload = mCalibrator.getCcdbObject();
83
84 auto clName = o2::utils::MemFileHelper::getClassName(payload);
85 auto flName = o2::ccdb::CcdbApi::generateFileName(clName);
86 std::map<std::string, std::string> metadata; // do we want to add something?
87 long startValidity = mStartTime;
88 o2::ccdb::CcdbObjectInfo info("TRD/Calib/ChannelStatus", clName, flName, metadata, startValidity, startValidity + 3 * o2::ccdb::CcdbObjectInfo::MONTH);
89
90 auto image = o2::ccdb::CcdbApi::createObjectImage(&payload, &info);
91 LOG(info) << "Sending object " << info.getPath() << "/" << info.getFileName() << " of size " << image->size()
92 << " bytes, valid for " << info.getStartValidityTimestamp() << " : " << info.getEndValidityTimestamp();
93
94 output.snapshot(Output{o2::calibration::Utils::gDataOriginCDBPayload, "PADSTATUS", 0}, *image.get()); // vector<char>
95 output.snapshot(Output{o2::calibration::Utils::gDataOriginCDBWrapper, "PADSTATUS", 0}, info); // root-serialized
96 }
97
99 {
100 if (mHaveSentOutput) {
101 LOGP(important, "Received EoS after sending calibration object. All OK");
102 } else {
103 if (!mIsDummy) {
104 LOGP(alarm, "Received EoS before sending calibration object. Not enough digits received");
105 }
106 }
107 }
108
109 private:
110 CalibratorNoise mCalibrator{};
111 size_t mNTFsProcessed{0};
112 bool mHaveSentOutput{false};
113 bool mIsDummy{false};
114 uint64_t mStartTime{0};
115};
116
118{
119 std::vector<InputSpec> inputs;
120 inputs.emplace_back("trddigits", o2::header::gDataOriginTRD, "DIGITS", 0, Lifetime::Timeframe);
121 inputs.emplace_back("trdtriggerrec", o2::header::gDataOriginTRD, "TRKTRGRD", 0, Lifetime::Timeframe);
122
123 std::vector<OutputSpec> outputs;
124 outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBPayload, "PADSTATUS"}, Lifetime::Sporadic);
125 outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBWrapper, "PADSTATUS"}, Lifetime::Sporadic);
126
127 return DataProcessorSpec{
128 "trd-noise-calib",
129 inputs,
130 outputs,
131 AlgorithmSpec{adaptFromTask<TRDNoiseCalibSpec>(dummy)},
132 Options{}};
133}
134
135} // namespace trd
136} // namespace o2
137
138#endif // O2_TRD_NOISECALIBSPEC_H
TRD pad calibration.
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
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 trd
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
static std::string generateFileName(const std::string &inp)
Definition CcdbApi.cxx:905
static std::unique_ptr< std::vector< char > > createObjectImage(const T *obj, CcdbObjectInfo *info=nullptr)
Definition CcdbApi.h:109
static constexpr long MONTH
void process(const gsl::span< const Digit > &digits)
const ChannelInfoContainer & getCcdbObject() const
void run(o2::framework::ProcessingContext &pc) final
void sendOutput(DataAllocator &output)
void init(o2::framework::InitContext &ic) final
void endOfStream(o2::framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
GLeglImageOES image
Definition glcorearb.h:4021
constexpr o2::header::DataOrigin gDataOriginTRD
Definition DataHeader.h:580
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
o2::framework::DataProcessorSpec getTRDNoiseCalibSpec(bool dummy)
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)
static constexpr o2::header::DataOrigin gDataOriginCDBWrapper
Definition Utils.h:44
static constexpr o2::header::DataOrigin gDataOriginCDBPayload
Definition Utils.h:43
static std::string getClassName(const T &obj)
get the class name of the object
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< Digit > digits