Project
Loading...
Searching...
No Matches
TOFDCSProcessor.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 DETECTOR_TOFDCSPROCESSOR_H_
13#define DETECTOR_TOFDCSPROCESSOR_H_
14
15#include <memory>
16#include <Rtypes.h>
17#include <unordered_map>
18#include <deque>
19#include <numeric>
20#include "Framework/Logger.h"
21#include "Framework/O2LongInt.h"
26#include "CCDB/CcdbObjectInfo.h"
28#include "CCDB/CcdbApi.h"
29#include <gsl/gsl>
30#include "TOFBase/Geo.h"
31
33
34namespace o2
35{
36namespace tof
37{
38
42
43struct TOFDCSinfo {
44 std::pair<O2LongUInt, double> firstValue; // first value seen by the TOF DCS processor
45 std::pair<O2LongUInt, double> lastValue; // last value seen by the TOF DCS processor
46 std::pair<O2LongUInt, double> midValue; // mid value seen by the TOF DCS processor
47 std::pair<std::array<O2LongUInt, 2>, double> maxChange; // maximum variation seen by the TOF DCS processor (previous - subsequent value)
48 std::pair<O2LongUInt, double> minValue; // smallest measurement seen by the TOF DCS processor
49 std::pair<O2LongUInt, double> maxValue; // largest measurement seen by the TOF DCS processor
50 bool updated = false;
52 {
53 firstValue = std::make_pair(0, -999999999);
54 lastValue = std::make_pair(0, -999999999);
55 midValue = std::make_pair(0, -999999999);
56 std::array<O2LongUInt, 2> atmp = {0, 0};
57 maxChange = std::make_pair(atmp, 0);
58 minValue = std::make_pair(0, 99999999999);
59 maxValue = std::make_pair(0, -99999999999);
60 }
61 void makeEmpty()
62 {
63 firstValue.first = lastValue.first = midValue.first = maxChange.first[0] = maxChange.first[1] = minValue.first = maxValue.first = maxChange.second = 0;
64 firstValue.second = lastValue.second = midValue.second = -999999999;
65 minValue.second = 99999999999;
66 maxValue.second = -99999999999;
67 }
68 void print() const;
69
71};
72
74 std::array<int32_t, 6> stripInSM = {-1, -1, -1, -1, -1, -1};
77};
78
80{
81
82 public:
84 using DQDoubles = std::deque<double>;
85
86 static constexpr int NFEACS = 8;
87 static constexpr int NDDLS = Geo::kNDDL * Geo::NSECTORS;
88
89 TOFDCSProcessor() = default;
90 ~TOFDCSProcessor() = default;
91
92 void init(const std::vector<DPID>& pids);
93
94 //int process(const std::vector<DPCOM>& dps);
95 int process(const gsl::span<const DPCOM> dps);
96 int processDP(const DPCOM& dpcom);
97 uint64_t processFlags(uint64_t flag, const char* pid);
98
99 void updateDPsCCDB();
100 void getStripsConnectedToFEAC(int nDDL, int nFEAC, TOFFEACinfo& info) const;
101 void updateFEACCCDB();
102 void updateHVCCDB();
103
104 const CcdbObjectInfo& getccdbDPsInfo() const { return mccdbDPsInfo; }
105 CcdbObjectInfo& getccdbDPsInfo() { return mccdbDPsInfo; }
106 const std::unordered_map<DPID, TOFDCSinfo>& getTOFDPsInfo() const { return mTOFDCS; }
107
108 const CcdbObjectInfo& getccdbLVInfo() const { return mccdbLVInfo; }
109 CcdbObjectInfo& getccdbLVInfo() { return mccdbLVInfo; }
110 const std::bitset<Geo::NCHANNELS>& getLVStatus() const { return mFeac; }
111 bool isLVUpdated() const { return mUpdateFeacStatus; }
112
113 const CcdbObjectInfo& getccdbHVInfo() const { return mccdbHVInfo; }
114 CcdbObjectInfo& getccdbHVInfo() { return mccdbHVInfo; }
115 const std::bitset<Geo::NCHANNELS>& getHVStatus() const { return mHV; }
116 bool isHVUpdated() const { return mUpdateHVStatus; }
117
118 void setStartValidityDPs(long t) { mStartValidityDPs = t; }
119 void setStartValidityLV(long t) { mStartValidityLV = t; }
120 void setStartValidityHV(long t) { mStartValidityHV = t; }
121 long getStartValidityDPs() const { return mStartValidityDPs; }
122 long getStartValidityLV() const { return mStartValidityLV; }
123 long getStartValidityHV() const { return mStartValidityHV; }
127 void useVerboseModeDP() { mVerboseDP = true; }
128 void useVerboseModeHVLV() { mVerboseHVLV = true; }
129
131 {
132 mDpsdoublesmap.clear();
133 // mTOFDCS.clear();
134 }
135
137 {
138 for (auto& it : mPids) {
139 if (!it.second) {
140 return false;
141 }
142 }
143 return true;
144 }
145
146 private:
147 std::unordered_map<DPID, TOFDCSinfo> mTOFDCS; // this is the object that will go to the CCDB
148 std::unordered_map<DPID, bool> mPids; // contains all PIDs for the processor, the bool
149 // will be true if the DP was processed at least once
150 std::unordered_map<DPID, std::vector<DPVAL>> mDpsdoublesmap; // this is the map that will hold the DPs for the
151 // double type (voltages and currents)
152
153 std::array<std::array<TOFFEACinfo, NFEACS>, NDDLS> mFeacInfo; // contains the strip/pad info per FEAC
154 std::array<std::bitset<8>, NDDLS> mPrevFEACstatus; // previous FEAC status
155 std::bitset<Geo::NCHANNELS> mFeac; // bitset with feac status per channel
156 bool mUpdateFeacStatus = false; // whether to update the FEAC status in CCDB or not
157 std::bitset<Geo::NCHANNELS> mHV; // bitset with HV status per channel
158 std::array<std::array<std::bitset<19>, Geo::NSECTORS>, Geo::NPLATES> mPrevHVstatus; // previous HV status
159 bool mUpdateHVStatus = false; // whether to update the HV status in CCDB or not
160 CcdbObjectInfo mccdbDPsInfo;
161 CcdbObjectInfo mccdbLVInfo;
162 CcdbObjectInfo mccdbHVInfo;
163 long mStartValidityDPs = o2::ccdb::CcdbObjectInfo::INFINITE_TIMESTAMP; // TF index for processing, used to store CCDB object for DPs
164 long mStartValidityLV = o2::ccdb::CcdbObjectInfo::INFINITE_TIMESTAMP; // TF index for processing, used to store CCDB object for LV
165 long mStartValidityHV = o2::ccdb::CcdbObjectInfo::INFINITE_TIMESTAMP; // TF index for processing, used to store CCDB object for HV
166
167 bool mVerboseDP = false;
168 bool mVerboseHVLV = false;
169
170 ClassDefNV(TOFDCSProcessor, 0);
171};
172} // namespace tof
173} // namespace o2
174
175#endif
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 process
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 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
static constexpr long INFINITE_TIMESTAMP
static constexpr Int_t NSECTORS
Definition Geo.h:122
@ kNDDL
Definition Geo.h:93
static constexpr Int_t NPLATES
Definition Geo.h:124
const CcdbObjectInfo & getccdbDPsInfo() const
CcdbObjectInfo & getccdbLVInfo()
void init(const std::vector< DPID > &pids)
std::deque< double > DQDoubles
static constexpr int NDDLS
CcdbObjectInfo & getccdbDPsInfo()
CcdbObjectInfo & getccdbHVInfo()
const std::bitset< Geo::NCHANNELS > & getLVStatus() const
void getStripsConnectedToFEAC(int nDDL, int nFEAC, TOFFEACinfo &info) const
const std::bitset< Geo::NCHANNELS > & getHVStatus() const
const CcdbObjectInfo & getccdbHVInfo() const
int processDP(const DPCOM &dpcom)
const CcdbObjectInfo & getccdbLVInfo() const
const std::unordered_map< DPID, TOFDCSinfo > & getTOFDPsInfo() const
uint64_t processFlags(uint64_t flag, const char *pid)
static constexpr int NFEACS
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
ClassDefNV(TOFDCSinfo, 2)
std::pair< O2LongUInt, double > minValue
std::pair< O2LongUInt, double > midValue
std::pair< O2LongUInt, double > firstValue
std::pair< std::array< O2LongUInt, 2 >, double > maxChange
std::pair< O2LongUInt, double > lastValue
std::pair< O2LongUInt, double > maxValue
std::array< int32_t, 6 > stripInSM