Project
Loading...
Searching...
No Matches
DigitTime.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
15
16#ifndef ALICEO2_TPC_DigitTime_H_
17#define ALICEO2_TPC_DigitTime_H_
18
19#include "TPCBase/Mapper.h"
20#include "TPCBase/CalDet.h"
25
26namespace o2::tpc
27{
28
29class Digit;
30
36
38{
39 public:
42
44 DigitTime();
45
47 ~DigitTime() = default;
48
50 void reset();
51
55 float getCommonMode(const GEMstack& gemstack) const;
56
60 float getCommonMode(const CRU& cru) const { return getCommonMode(cru.gemStack()); }
61
68 void addDigit(const MCCompLabel& label, const CRU& cru, GlobalPadNumber globalPad, float signal);
69
78 template <DigitzationMode MODE>
80 std::vector<CommonMode>& commonModeOutput, const Sector& sector, TimeBin timeBin,
81 SAMPAProcessing& sampaProcessing, std::vector<std::pair<MCCompLabel, int>>& labelCollector,
82 PrevDigitInfoArray* prevTime = nullptr, Streamer* debugStream = nullptr,
83 const CalPad* padParams[3] = nullptr, const CalDet<bool>* deadMap = nullptr);
84
85 private:
86 std::array<float, GEMSTACKSPERSECTOR> mCommonMode;
87 std::array<DigitGlobalPad, Mapper::getPadsInSector()> mGlobalPads;
88 int mDigitCounter = 0;
89
91 // std::deque<int> mOccupiedPads; // iterable container of occupied pads
92};
93
94inline DigitTime::DigitTime() : mCommonMode(), mGlobalPads()
95{
96 mCommonMode.fill(0.f);
97 mLabels.reserve(Mapper::getPadsInSector() / 3);
98}
99
100inline void DigitTime::addDigit(const MCCompLabel& label, const CRU& cru, GlobalPadNumber globalPad, float signal)
101{
102 auto& paddigit = mGlobalPads[globalPad];
103 if (paddigit.getID() == -1) {
104 // this means we have a new digit
105 paddigit.setID(mDigitCounter++);
106 // could also register this pad in a vector of digits
107 }
108
109 // previous digit for CM and ToT calculation
110 paddigit.addDigit(label, signal, mLabels);
111 // mCommonMode[cru.gemStack()] += signal * 0.5; // TODO: Replace 0.5 by k-factor, take into account ion tail
112}
113
114inline void DigitTime::reset()
115{
116 for (auto& pad : mGlobalPads) {
117 pad.reset();
118 }
119 mCommonMode.fill(0.f);
120}
121
122inline float DigitTime::getCommonMode(const GEMstack& gemstack) const
123{
125 const Mapper& mapper = Mapper::instance();
126 const auto nPads = mapper.getNumberOfPads(gemstack);
127 return mCommonMode[gemstack] / static_cast<float>(nPads);
128}
129
130template <DigitzationMode MODE>
132 std::vector<CommonMode>& commonModeOutput, const Sector& sector, TimeBin timeBin,
133 SAMPAProcessing& sampaProcessing, std::vector<std::pair<MCCompLabel, int>>& labelCollector,
134 PrevDigitInfoArray* prevTime, Streamer* debugStream, const CalPad* padParams[3],
135 const CalDet<bool>* deadMap)
136{
137 const auto& mapper = Mapper::instance();
138 const auto& eleParam = ParameterElectronics::Instance();
139
140 // at this point we only have the pure signals from tracks
141 // loop over all pads to calculated ion tail, common mode and ToT for saturated signals
142 for (size_t iPad = 0; iPad < mGlobalPads.size(); ++iPad) {
143 auto& digit = mGlobalPads[iPad];
144 if (prevTime) {
145 auto& prevDigit = (*prevTime)[iPad];
146 if (prevDigit.hasSignal()) {
147 digit.foldSignal(prevDigit, sector.getSector(), iPad, timeBin, debugStream, padParams);
148 }
149 prevDigit.signal = digit.getChargePad(); // to make hasSignal() check work in next time bin
150 }
151 const CRU cru = mapper.getCRU(sector, iPad);
152 const float cmKValue = (padParams[2]) ? padParams[2]->getValue(sector.getSector(), iPad) : 1.f;
153 mCommonMode[cru.gemStack()] += digit.getChargePad() * eleParam.commonModeCoupling * cmKValue; // TODO: Add stack-by-stack variation?
154 }
155
156 // fill common mode output container
157 for (size_t i = 0; i < mCommonMode.size(); ++i) {
158 const float cm = getCommonMode(GEMstack(i));
159 if (cm > 0.) {
160 commonModeOutput.push_back({cm, timeBin, static_cast<unsigned char>(i)});
161 }
162 }
163
164 for (size_t iPad = 0; iPad < mGlobalPads.size(); ++iPad) {
165 auto& digit = mGlobalPads[iPad];
166 if (eleParam.doNoiseEmptyPads || (digit.getChargePad() > 0.f)) {
167 PrevDigitInfo prevDigit;
168 if (prevTime) {
169 prevDigit = (*prevTime)[iPad];
170 }
171 const CRU cru = mapper.getCRU(sector, iPad);
172 digit.fillOutputContainer<MODE>(output, mcTruth, cru, timeBin, iPad, mLabels, sampaProcessing, labelCollector, getCommonMode(cru), prevDigit, debugStream, deadMap);
173 }
174 }
175}
176} // namespace o2::tpc
177
178#endif // ALICEO2_TPC_DigitTime_H_
Definition of the common mode container class.
Definition of class for writing debug informations.
Definition of the GlobalPad container.
int32_t i
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual sector
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 cm(in case phi of track=lorentz angle)") AddOptionRTC(trkltResVsTanPhiMisalign
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
GEMstack gemStack() const
Definition CRU.h:82
o2::utils::DebugStreamer Streamer
Definition DigitTime.h:40
void reset()
Resets the container.
Definition DigitTime.h:114
DigitTime()
Constructor.
Definition DigitTime.h:94
std::array< PrevDigitInfo, Mapper::getPadsInSector()> PrevDigitInfoArray
Definition DigitTime.h:41
float getCommonMode(const GEMstack &gemstack) const
Definition DigitTime.h:122
void fillOutputContainer(std::vector< Digit > &output, dataformats::MCTruthContainer< MCCompLabel > &mcTruth, std::vector< CommonMode > &commonModeOutput, const Sector &sector, TimeBin timeBin, SAMPAProcessing &sampaProcessing, std::vector< std::pair< MCCompLabel, int > > &labelCollector, PrevDigitInfoArray *prevTime=nullptr, Streamer *debugStream=nullptr, const CalPad *padParams[3]=nullptr, const CalDet< bool > *deadMap=nullptr)
Definition DigitTime.h:131
float getCommonMode(const CRU &cru) const
Definition DigitTime.h:60
~DigitTime()=default
Destructor.
void addDigit(const MCCompLabel &label, const CRU &cru, GlobalPadNumber globalPad, float signal)
Definition DigitTime.h:100
static Mapper & instance(const std::string mappingDir="")
Definition Mapper.h:44
static constexpr unsigned short getPadsInSector()
Definition Mapper.h:414
static constexpr unsigned short getNumberOfPads(const GEMstack gemStack)
Definition Mapper.h:416
class to enable streaming debug information to root files
GLuint GLsizei const GLchar * label
Definition glcorearb.h:2519
o2::cpv::Digit Digit
Global TPC definitions and constants.
GEMstack
TPC GEM stack types.
Definition Defs.h:55
unsigned short GlobalPadNumber
global pad number
Definition Defs.h:114
double getValue(DPVAL dp)