Project
Loading...
Searching...
No Matches
WindowFiller.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 ALICEO2_TOF_WINDOWFILLER_H_
13#define ALICEO2_TOF_WINDOWFILLER_H_
14
15#include "TOFBase/Geo.h"
16#include "TOFBase/Digit.h"
17#include "TOFBase/Strip.h"
20#include "TOFBase/Utils.h"
21
22namespace o2
23{
24namespace tof
25{
26
28{
29 public:
30 struct PatternData {
32 int icrate;
33
34 unsigned long row;
35
36 PatternData(uint32_t patt = 0, int icr = 0, unsigned long rw = 0) : pattern(patt), icrate(icr), row(rw) {}
37 };
38
44
46 ~WindowFiller() = default;
47
48 void initObj();
49
50 void reset();
51
58
59 std::vector<Digit>* getDigitPerTimeFrame() { return &mDigitsPerTimeFrame; }
60 std::vector<ReadoutWindowData>* getReadoutWindowData() { return &mReadoutWindowData; }
61 std::vector<ReadoutWindowData>* getReadoutWindowDataFiltered() { return &mReadoutWindowDataFiltered; }
63
64 template <typename VROF, typename VPAT>
65 void setReadoutWindowData(const VROF& row, const VPAT& pattern)
66 {
67 // copy rowdata info needed to call fillDiagonsticFrequency when reading frm file (digits/ctf). Not needed when digitizing or decoding
68 mPatterns.clear();
69 mReadoutWindowData.clear();
70 for (const auto crow : row) {
71 mReadoutWindowData.push_back(crow);
72 }
73
74 for (const auto dia : pattern) {
75 mPatterns.push_back(dia);
76 }
77 }
78
80 void fillOutputContainer(std::vector<Digit>& digits);
81 void flushOutputContainer(std::vector<Digit>& digits); // flush all residual buffered data
82 void setContinuous(bool value = true) { mContinuous = value; }
83 bool isContinuous() const { return mContinuous; }
84
86
88
90
92
94 {
96 }
97
98 std::vector<uint8_t>& getPatterns() { return mPatterns; }
99 void addPattern(const uint32_t val, int icrate, int orbit, int bc) { mCratePatterns.emplace_back(val, icrate, ((unsigned long)orbit) * 3 + (bc + 100) / Geo::BC_IN_WINDOW); }
100 void addCrateHeaderData(unsigned long orbit, int crate, int32_t bc, uint32_t eventCounter);
102
103 void addCount(int channel) { mChannelCounts[channel]++; }
104
105 protected:
106 // info TOF timewindow
107 uint64_t mReadoutWindowCurrent = 0; // keeps track of current readout window
108 InteractionRecord mFirstIR{0, 0}; // reference IR (1st IR of the timeframe)
110
111 bool mContinuous = true;
112 bool mFutureToBeSorted = false;
113
114 // only needed from Decoder
115 int mMaskNoiseRate = -11;
116 int mChannelCounts[o2::tof::Geo::NCHANNELS]; // count of channel hits in the current TF (if MaskNoiseRate enabled)
117
118 // digit info
119 //std::vector<Digit>* mDigits;
120
121 static const int MAXWINDOWS = 2; // how many readout windows we can buffer
122
123 std::vector<Digit> mDigitsPerTimeFrame;
124 std::vector<ReadoutWindowData> mReadoutWindowData;
125 std::vector<ReadoutWindowData> mReadoutWindowDataFiltered;
126
128
129 // array of strips to store the digits per strip (one for the current readout window, one for the next one)
130 std::vector<Strip> mStrips[MAXWINDOWS];
131 std::vector<Strip>* mStripsCurrent = &(mStrips[0]);
132 std::vector<Strip>* mStripsNext[MAXWINDOWS - 1];
133
134 // arrays with digit and MCLabels out of the current readout windows (stored to fill future readout window)
135 std::vector<Digit> mFutureDigits;
136
137 std::vector<uint8_t> mPatterns;
138 std::vector<uint64_t> mErrors;
139
141
142 std::vector<PatternData> mCratePatterns;
143 std::vector<CrateHeaderData> mCrateHeaderData;
144
146
147 void fillDigitsInStrip(std::vector<Strip>* strips, int channel, int tdc, int tot, uint64_t nbc, UInt_t istrip, uint32_t triggerorbit = 0, uint16_t triggerbunch = 0);
148 // void fillDigitsInStrip(std::vector<Strip>* strips, o2::dataformats::MCTruthContainer<o2::tof::MCLabel>* mcTruthContainer, int channel, int tdc, int tot, int nbc, UInt_t istrip, Int_t trackID, Int_t eventID, Int_t sourceID);
149
152
153 void insertDigitInFuture(Int_t channel, Int_t tdc, Int_t tot, uint64_t bc, Int_t label = 0, uint32_t triggerorbit = 0, uint16_t triggerbunch = 0)
154 {
155 mFutureDigits.emplace_back(channel, tdc, tot, bc, label, triggerorbit, triggerbunch);
156 mFutureToBeSorted = true;
157 }
158
159 bool isMergable(Digit digit1, Digit digit2)
160 {
161 if (digit1.getChannel() != digit2.getChannel()) {
162 return false;
163 }
164
165 if (digit1.getBC() != digit2.getBC()) {
166 return false;
167 }
168
169 // Check if the difference is larger than the TDC dead time
170 if (std::abs(digit1.getTDC() - digit2.getTDC()) > Geo::DEADTIMETDC) {
171 return false;
172 }
173 return true;
174 }
175
177};
178} // namespace tof
179} // namespace o2
180#endif
Definition of the TOF cluster.
uint64_t orbit
Definition RawEventData.h:6
uint64_t bc
Definition RawEventData.h:5
unsigned short int uint16_t
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
Diagnostic class for TOF.
Definition Diagnostic.h:32
TOF digit implementation.
Definition Digit.h:31
uint64_t getBC() const
Definition Digit.h:58
Int_t getChannel() const
Definition Digit.h:49
uint16_t getTDC() const
Definition Digit.h:52
static constexpr double DEADTIMETDC
Single channel TDC dead time (ps)
Definition Geo.h:164
@ kNCrate
Definition Geo.h:97
static constexpr int NCHANNELS
Definition Geo.h:126
static constexpr int BC_IN_WINDOW
Definition Geo.h:167
static void setNOrbitInTF(uint32_t norb)
Definition Utils.h:73
void addCrateHeaderData(unsigned long orbit, int crate, int32_t bc, uint32_t eventCounter)
std::vector< uint64_t > mErrors
void fillDigitsInStrip(std::vector< Strip > *strips, int channel, int tdc, int tot, uint64_t nbc, UInt_t istrip, uint32_t triggerorbit=0, uint16_t triggerbunch=0)
std::vector< uint8_t > & getPatterns()
std::vector< CrateHeaderData > mCrateHeaderData
void setContinuous(bool value=true)
Diagnostic & getDiagnosticFrequency()
std::vector< Strip > mStrips[MAXWINDOWS]
static const int MAXWINDOWS
void addCount(int channel)
std::vector< PatternData > mCratePatterns
InteractionTimeRecord mEventTime
bool isContinuous() const
void setReadoutWindowData(const VROF &row, const VPAT &pattern)
bool isMergable(Digit digit1, Digit digit2)
std::vector< Strip > * mStripsCurrent
int mChannelCounts[o2::tof::Geo::NCHANNELS]
void resizeVectorFutureDigit(int size)
std::vector< Strip > * mStripsNext[MAXWINDOWS - 1]
void flushOutputContainer(std::vector< Digit > &digits)
void addPattern(const uint32_t val, int icrate, int orbit, int bc)
std::vector< Digit > * getDigitPerTimeFrame()
std::vector< ReadoutWindowData > mReadoutWindowDataFiltered
DigitHeader & getDigitHeader()
void setNOrbitInTF(uint32_t norb)
void setEventTime(InteractionTimeRecord value)
ClassDefNV(WindowFiller, 2)
std::vector< uint8_t > mPatterns
Diagnostic mDiagnosticFrequency
std::vector< Digit > mDigitsPerTimeFrame
void maskNoiseRate(int val)
void insertDigitInFuture(Int_t channel, Int_t tdc, Int_t tot, uint64_t bc, Int_t label=0, uint32_t triggerorbit=0, uint16_t triggerbunch=0)
std::vector< Digit > mFutureDigits
std::vector< ReadoutWindowData > mReadoutWindowData
void setCurrentReadoutWindow(uint64_t value)
uint64_t getCurrentReadoutWindow() const
void setFirstIR(const o2::InteractionRecord &ir)
void fillOutputContainer(std::vector< Digit > &digits)
std::vector< ReadoutWindowData > * getReadoutWindowDataFiltered()
std::vector< ReadoutWindowData > * getReadoutWindowData()
InteractionRecord mFirstIR
GLsizeiptr size
Definition glcorearb.h:659
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLuint GLsizei const GLchar * label
Definition glcorearb.h:2519
GLuint GLfloat * val
Definition glcorearb.h:1582
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
uint32_t eventCounter[Geo::kNCrate]
PatternData(uint32_t patt=0, int icr=0, unsigned long rw=0)
o2::InteractionRecord ir(0, 0)
std::vector< Digit > digits
std::vector< int > row
std::array< uint16_t, 5 > pattern