Project
Loading...
Searching...
No Matches
Digit.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_TRD_DIGIT_H_
13#define ALICEO2_TRD_DIGIT_H_
14
15#include <cstdint>
16#include <vector>
17#include <array>
18#include <unordered_map>
19#include <numeric>
20#include "Rtypes.h" // for ClassDef
21
24#include <gsl/span>
25
26namespace o2
27{
28namespace trd
29{
30
31using ADC_t = std::uint16_t;
32using ArrayADC = std::array<ADC_t, constants::TIMEBINS>;
33
34// Digit class for TRD
35// Notes:
36// Shared pads:
37// the lower mcm and rob is chosen for a given shared pad.
38// this negates the need for need alternate indexing strategies.
39// if you are trying to go from mcm/rob/adc to pad/row and back to mcm/rob/adc ,
40// you may not end up in the same place, you need to remember to manually check for shared pads.
41// Pre Trigger phase:
42// LHC clock runs at 40.08MHz, ADC run at 1/4 or 10MHz and the trap runs at 120MHz or LHC*3.
43// The trap clock can therefore be in 1 of 12 positions relative to the ADC clock.
44// Only 4 of those positions are valid, dependent on the TRAP assembly program timing offset, as of 11/2022 pre-trigger phase: 0,3,6,9.
45// vaguely graphically below:
46// LHC ___---___---___---___---___---___---___---___---___---___---___---___---___---___---___---___---___---___---___---___---___---___---___
47// TRAP _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
48// ADC ___------------____________------------____________------------____________------------____________------------____________------------
49// _________------------____________------------____________------------____________------------____________------------____________------
50// ---____________------------____________------------____________------------____________------------____________------------____________
51// ---------____________------------____________------------____________------------____________------------____________------------______
52// PreTrig _________------________________________------________________________------________________________------________________________------
53
54class Digit
55{
56 public:
57 Digit() = default;
58 ~Digit() = default;
59 Digit(int det, int row, int pad, ArrayADC adc, int phase = 0);
60 Digit(int det, int row, int pad); // add adc data and pretrigger phase in a separate step
61 Digit(int det, int rob, int mcm, int channel, ArrayADC adc, int phase = 0);
62 Digit(int det, int rob, int mcm, int channel, int phase = 0); // add adc data
63
64 // Copy
65 Digit(const Digit&) = default;
66 // Assignment
67 Digit& operator=(const Digit&) = default;
68 // Modifiers
69 void setROB(int rob) { mROB = rob; }
70 void setMCM(int mcm) { mMCM = mcm; }
71 void setROB(int row, int col) { mROB = HelperMethods::getROBfromPad(row, col); } // set ROB from pad row, column
72 void setMCM(int row, int col) { mMCM = HelperMethods::getMCMfromPad(row, col); } // set MCM from pad row, column
73 void setChannel(int channel) { mChannel = channel; }
74 void setDetector(int det) { mDetector = ((mDetector & 0xf000) | (det & 0xfff)); }
75 void setADC(ArrayADC const& adc) { mADC = adc; }
76 void setADC(const gsl::span<ADC_t>& adc) { std::copy(adc.begin(), adc.end(), mADC.begin()); }
77 // set the trigger phase make sure it is mapped to 2 bits as it can only have 4 valid numbers shifted 0,3,6,9 or 1,4,7,10 etc.
78 void setPreTrigPhase(int phase);
79 // Get methods
80 int getDetector() const { return mDetector & 0xfff; }
81 int getDetectorInFull() const { return mDetector; } // return the entire mDetector 16 bits, so far only for CTF encoding.
82 int getHCId() const { return (mDetector & 0xfff) * 2 + (mROB % 2); }
83 int getPadRow() const { return HelperMethods::getPadRowFromMCM(mROB, mMCM); }
84 int getPadCol() const { return HelperMethods::getPadColFromADC(mROB, mMCM, mChannel); }
85 int getROB() const { return mROB; }
86 int getMCM() const { return mMCM; }
87 int getMCMCol() const { return (getMCM() % constants::NMCMROBINCOL) + constants::NMCMROBINCOL * (getROB() % 2); }
88 int getChannel() const { return mChannel; }
89 int getPreTrigPhase() const { return ((mDetector >> 12) & 0xf); }
90 bool isSharedDigit() const;
91 bool isNeighbour(const Digit& other) const;
92
93 ArrayADC const& getADC() const { return mADC; }
94 ADC_t getADCsum() const { return std::accumulate(mADC.begin(), mADC.end(), (ADC_t)0); }
95 // returns the max ADC value and sets idx to the time bin with the largest ADC value
96 ADC_t getADCmax(int& idx) const;
97 ADC_t getADCval(int tb) const { return mADC[tb]; }
98
99 bool operator==(const Digit& o) const
100 {
101 return mDetector == o.mDetector && mROB == o.mROB && mMCM == o.mMCM && mChannel == o.mChannel && mADC == o.mADC;
102 }
103
104 private:
111 std::uint16_t mDetector{0};
112 std::uint8_t mROB{0};
113 std::uint8_t mMCM{0};
114 std::uint8_t mChannel{0};
115 ArrayADC mADC{};
116 ClassDefNV(Digit, 4);
117};
118
119std::ostream& operator<<(std::ostream& stream, const Digit& d);
120
121} // namespace trd
122} // namespace o2
123
124#endif
uint16_t mcm
uint16_t rob
Global TRD definitions and constants.
uint64_t phase
Definition RawEventData.h:7
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 d
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
uint32_t col
Definition RawData.h:4
ADC_t getADCsum() const
Definition Digit.h:94
int getPreTrigPhase() const
Definition Digit.h:89
void setMCM(int mcm)
Definition Digit.h:70
ADC_t getADCval(int tb) const
Definition Digit.h:97
ADC_t getADCmax(int &idx) const
Definition Digit.cxx:78
int getDetector() const
Definition Digit.h:80
~Digit()=default
int getPadRow() const
Definition Digit.h:83
int getDetectorInFull() const
Definition Digit.h:81
void setADC(const gsl::span< ADC_t > &adc)
Definition Digit.h:76
Digit & operator=(const Digit &)=default
bool isNeighbour(const Digit &other) const
Definition Digit.cxx:73
bool isSharedDigit() const
Definition Digit.cxx:64
void setROB(int row, int col)
Definition Digit.h:71
void setADC(ArrayADC const &adc)
Definition Digit.h:75
void setPreTrigPhase(int phase)
Definition Digit.cxx:59
int getChannel() const
Definition Digit.h:88
int getMCM() const
Definition Digit.h:86
int getMCMCol() const
Definition Digit.h:87
void setMCM(int row, int col)
Definition Digit.h:72
Digit(const Digit &)=default
int getHCId() const
Definition Digit.h:82
ArrayADC const & getADC() const
Definition Digit.h:93
void setROB(int rob)
Definition Digit.h:69
int getROB() const
Definition Digit.h:85
int getPadCol() const
Definition Digit.h:84
Digit()=default
void setDetector(int det)
Definition Digit.h:74
bool operator==(const Digit &o) const
Definition Digit.h:99
void setChannel(int channel)
Definition Digit.h:73
GLuint GLuint stream
Definition glcorearb.h:1806
std::uint16_t ADC_t
Definition Digit.h:31
std::array< ADC_t, constants::TIMEBINS > ArrayADC
Definition Digit.h:32
std::ostream & operator<<(std::ostream &stream, const Digit &d)
Definition Digit.cxx:85
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
static int getROBfromPad(int irow, int icol)
static int getPadRowFromMCM(int irob, int imcm)
static int getPadColFromADC(int irob, int imcm, int iadc)
static int getMCMfromPad(int irow, int icol)
VectorOfTObjectPtrs other
std::vector< int > row
ArrayADC adc