Project
Loading...
Searching...
No Matches
DigiReco.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#include <map>
13#include <deque>
14#include <gsl/span>
15#include <TFile.h>
16#include <TTree.h>
17#include "Framework/Logger.h"
18#include "ZDCBase/Constants.h"
34
35#ifndef ALICEO2_ZDC_DIGI_RECO_H
36#define ALICEO2_ZDC_DIGI_RECO_H
37
38//#define ALICEO2_ZDC_DIGI_RECO_DEBUG
39#ifdef O2_ZDC_DEBUG
40#ifndef ALICEO2_ZDC_DIGI_RECO_DEBUG
41#define ALICEO2_ZDC_DIGI_RECO_DEBUG
42#endif
43#endif
44
45namespace o2
46{
47namespace zdc
48{
50
53 {
54 val = myval;
55 amp = myamp;
56 ir = myir;
57 }
61};
62
64{
65 public:
66 DigiReco() = default;
67 ~DigiReco() = default;
68 void init();
70 int process(const gsl::span<const o2::zdc::OrbitData>& orbitdata,
71 const gsl::span<const o2::zdc::BCData>& bcdata,
72 const gsl::span<const o2::zdc::ChannelData>& chdata);
73 int write();
74 void setVerbosity(int v)
75 {
76 mVerbosity = v;
77 }
78 int getVerbosity() const { return mVerbosity; }
79 void setDebugOutput(bool state = true)
80 {
81 mTreeDbg = state;
82 }
83 void eor();
84 uint8_t getTriggerCondition() { return mTriggerCondition; }
85 void setTripleTrigger() { mTriggerCondition = 0x7; }
86 void setDoubleTrigger() { mTriggerCondition = 0x3; }
87 void setSingleTrigger() { mTriggerCondition = 0x1; }
88
89 void setAlpha(double v) { mAlpha = v; };
90 double getAlpha() { return mAlpha; };
91
92 void setModuleConfig(const ModuleConfig* moduleConfig) { mModuleConfig = moduleConfig; };
93 const ModuleConfig* getModuleConfig() { return mModuleConfig; };
94 void setTDCParam(const ZDCTDCParam* param) { mTDCParam = param; };
95 const ZDCTDCParam* getTDCParam() { return mTDCParam; };
96 void setTDCCorr(const ZDCTDCCorr* param) { mTDCCorr = param; };
97 const ZDCTDCCorr* getTDCCorr() { return mTDCCorr; };
98 void setEnergyParam(const ZDCEnergyParam* param) { mEnergyParam = param; };
99 const ZDCEnergyParam* getEnergyParam() { return mEnergyParam; };
100 void setTowerParam(const ZDCTowerParam* param) { mTowerParam = param; };
101 const ZDCTowerParam* getTowerParam() { return mTowerParam; };
102 void setBaselineParam(const BaselineParam* param) { mPedParam = param; };
103 const BaselineParam* getBaselineParam() { return mPedParam; };
104 void setRecoConfigZDC(const RecoConfigZDC* cfg) { mRecoConfigZDC = cfg; };
105 const RecoConfigZDC* getRecoConfigZDC() { return mRecoConfigZDC; };
106 // Enable or disable low pass filtering
107 void setLowPassFilter(bool val = true)
108 {
109 mLowPassFilter = val;
110 mLowPassFilterSet = true;
111 LOG(warn) << __func__ << " Configuration of low pass filtering: " << (mLowPassFilter ? "enabled" : "disabled");
112 };
113 bool getLowPassFilter() { return mLowPassFilter; };
114 void setFullInterpolation(bool val = true)
115 {
116 mFullInterpolation = val;
117 mFullInterpolationSet = true;
118 LOG(warn) << __func__ << " Full waveform interpolation: " << (mFullInterpolation ? "enabled" : "disabled");
119 };
120 bool getFullInterpolation() { return mFullInterpolation; };
121 // Enable or disable TDC corrections
122 void setCorrSignal(bool val = true)
123 {
124 mCorrSignal = val;
125 mCorrSignalSet = true;
126 LOG(warn) << __func__ << " Configuration of TDC signal correction: " << (mCorrSignal ? "enabled" : "disabled");
127 };
128 bool getCorrSignal() { return mCorrSignal; };
129 void setCorrBackground(bool val = true)
130 {
131 mCorrBackground = val;
132 mCorrBackgroundSet = true;
133 LOG(warn) << __func__ << " Configuration of TDC pile-up correction: " << (mCorrBackground ? "enabled" : "disabled");
134 };
135 bool getCorrBackground() { return mCorrBackground; };
136 bool inError()
137 {
138 return mInError;
139 }
140
141 const uint32_t* getTDCMask() const { return mTDCMask; }
142 const uint32_t* getChMask() const { return mChMask; }
143 const std::vector<o2::zdc::RecEventAux>& getReco() { return mReco; }
144
145 private:
146 const ModuleConfig* mModuleConfig = nullptr;
147 void updateOffsets(int ibun);
148 void lowPassFilter();
149 int reconstructTDC(int seq_beg, int seq_end);
150 int reconstruct(int seq_beg, int seq_end);
151 int processTrigger(int itdc, int ibeg, int iend);
152 int processTriggerExtended(int itdc, int ibeg, int iend);
153 int interpolate(int itdc, int ibeg, int iend);
154 int fullInterpolation(int itdc, int ibeg, int iend);
155 void correctTDCPile();
156 bool mLowPassFilter = true;
157 bool mLowPassFilterSet = false;
158 bool mFullInterpolation = false;
159 bool mFullInterpolationSet = false;
160 int mFullInterpolationMinLength = 2;
161 int mInterpolationStep = 25;
162 bool mCorrSignal = true;
163 bool mCorrSignalSet = false;
164 bool mCorrBackground = true;
165 bool mCorrBackgroundSet = false;
166 bool mInError = false;
167 int mAssignedTDC[NTDCChannels] = {0};
168
169 int correctTDCSignal(int itdc, int16_t TDCVal, float TDCAmp, float& fTDCVal, float& fTDCAmp, bool isbeg, bool isend);
170 int correctTDCBackground(int ibc, int itdc, std::deque<DigiRecoTDC>& tdc);
171
172 O2_ZDC_DIGIRECO_FLT getPoint(int itdc, int ibeg, int iend, int i);
173 void setPoint(int itdc, int ibeg, int iend, int i);
174
175 void assignTDC(int ibun, int ibeg, int iend, int itdc, int tdc, float amp);
176 void findSignals(int ibeg, int iend);
177 const RecoParamZDC* mRopt = nullptr;
178 bool mIsContinuous = true;
179 uint8_t mTriggerCondition = 0x3;
180 int mNBCAHead = 0;
181 const ZDCTDCParam* mTDCParam = nullptr;
182 const ZDCTDCCorr* mTDCCorr = nullptr;
183 const ZDCEnergyParam* mEnergyParam = nullptr;
184 const ZDCTowerParam* mTowerParam = nullptr;
185 const BaselineParam* mPedParam = nullptr;
186 uint32_t mTriggerMask = 0;
187 uint32_t mTDCMask[NTDCChannels] = {0};
188 uint32_t mChMask[NChannels] = {0};
189 const RecoConfigZDC* mRecoConfigZDC = nullptr;
190 int32_t mVerbosity = DbgMinimal;
192 bool mTreeDbg = false;
193 std::unique_ptr<TFile> mDbg = nullptr;
194 std::unique_ptr<TTree> mTDbg = nullptr;
195 gsl::span<const o2::zdc::OrbitData> mOrbitData;
196 gsl::span<const o2::zdc::BCData> mBCData;
197 gsl::span<const o2::zdc::ChannelData> mChData;
198 std::vector<o2::zdc::RecEventAux> mReco;
199 std::map<uint32_t, int> mOrbit;
200 float mOffset[NChannels];
201 uint32_t mOffsetOrbit = 0xffffffff;
202 uint8_t mSource[NChannels];
203 static constexpr int mNSB = TSN * NTimeBinsPerBC;
204 RecEventAux mRec;
205 int mNBC = 0;
206 int mNLonely = 0;
207 int mLonely[o2::constants::lhc::LHCMaxBunches] = {0};
208 int mLonelyTrig[o2::constants::lhc::LHCMaxBunches] = {0};
209 uint32_t mMissingPed[NChannels] = {0};
210 int16_t tdc_shift[NTDCChannels] = {0};
211 float tdc_calib[NTDCChannels] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
212 float tdc_offset[NTDCChannels] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
213 constexpr static uint16_t mMask[NTimeBinsPerBC] = {0x0001, 0x002, 0x004, 0x008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800};
214 O2_ZDC_DIGIRECO_FLT mAlpha = 3; // Parameter of interpolation function
215 // Configuration of interpolation for current TDC
216 int mNbun; // Number of adjacent bunches
217 int mNsam; // Number of acquired samples
218 int mNtot; // Total number of points in the interpolated arrays
219 int mIlast; // Index of last acquired sample
220 int mNint; // Total points in the interpolation region (-1)
221 O2_ZDC_DIGIRECO_FLT mFirstSample;
222 O2_ZDC_DIGIRECO_FLT mLastSample;
223};
224} // namespace zdc
225} // namespace o2
226#endif
Class to describe fired triggered and/or stored channels for the BC and to refer to channel data.
Baseline calibration data.
unsigned short int uint16_t
unsigned int uint32_t
int32_t i
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
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
configStandalone Reconstruction rec_tpc float
SurfaceTrackState state
Class to describe pedestal data accumulated over the orbit.
Class to describe reconstructed ZDC event (single BC with signal in one of detectors)
ZDC reconstruction parameters.
ZDC reconstruction parameters.
ZDC Energy calibration.
ZDC TDC correction parameters.
Parameters to correct TDCs (produced by QA)
ZDC Tower calibration.
Container class to store NTimeBinsPerBC ADC values of single ZDC channel.
const ZDCTDCCorr * getTDCCorr()
Definition DigiReco.h:97
void setFullInterpolation(bool val=true)
Definition DigiReco.h:114
void setAlpha(double v)
Definition DigiReco.h:89
void setDebugOutput(bool state=true)
Definition DigiReco.h:79
void setTowerParam(const ZDCTowerParam *param)
Definition DigiReco.h:100
void setCorrBackground(bool val=true)
Definition DigiReco.h:129
void setCorrSignal(bool val=true)
Definition DigiReco.h:122
const BaselineParam * getBaselineParam()
Definition DigiReco.h:103
uint8_t getTriggerCondition()
Definition DigiReco.h:84
double getAlpha()
Definition DigiReco.h:90
bool getFullInterpolation()
Definition DigiReco.h:120
~DigiReco()=default
const ModuleConfig * getModuleConfig()
Definition DigiReco.h:93
void setRecoConfigZDC(const RecoConfigZDC *cfg)
Definition DigiReco.h:104
void setModuleConfig(const ModuleConfig *moduleConfig)
Definition DigiReco.h:92
int getVerbosity() const
Definition DigiReco.h:78
const RecoConfigZDC * getRecoConfigZDC()
Definition DigiReco.h:105
void prepareInterpolation()
Definition DigiReco.cxx:463
DigiReco()=default
void setTripleTrigger()
Definition DigiReco.h:85
bool getCorrSignal()
Definition DigiReco.h:128
const uint32_t * getChMask() const
Definition DigiReco.h:142
bool getCorrBackground()
Definition DigiReco.h:135
const uint32_t * getTDCMask() const
Definition DigiReco.h:141
void setSingleTrigger()
Definition DigiReco.h:87
const ZDCTowerParam * getTowerParam()
Definition DigiReco.h:101
void setBaselineParam(const BaselineParam *param)
Definition DigiReco.h:102
const std::vector< o2::zdc::RecEventAux > & getReco()
Definition DigiReco.h:143
void setDoubleTrigger()
Definition DigiReco.h:86
void setTDCParam(const ZDCTDCParam *param)
Definition DigiReco.h:94
void setLowPassFilter(bool val=true)
Definition DigiReco.h:107
const ZDCTDCParam * getTDCParam()
Definition DigiReco.h:95
void setVerbosity(int v)
Definition DigiReco.h:74
void setEnergyParam(const ZDCEnergyParam *param)
Definition DigiReco.h:98
void setTDCCorr(const ZDCTDCCorr *param)
Definition DigiReco.h:96
const ZDCEnergyParam * getEnergyParam()
Definition DigiReco.h:99
bool getLowPassFilter()
Definition DigiReco.h:113
const GLdouble * v
Definition glcorearb.h:832
GLuint GLfloat * val
Definition glcorearb.h:1582
GLenum GLfloat param
Definition glcorearb.h:271
struct o2::upgrades_utils::@482 zdc
structure to keep FT0 information
float O2_ZDC_DIGIRECO_FLT
Definition DigiReco.h:49
constexpr int NTimeBinsPerBC
Definition Constants.h:53
constexpr int NTDCChannels
Definition Constants.h:90
constexpr int NChannels
Definition Constants.h:65
constexpr int TSN
Definition Constants.h:94
constexpr int NTS
Definition Constants.h:96
constexpr int DbgMinimal
Definition Constants.h:208
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
o2::InteractionRecord ir
Definition DigiReco.h:60
DigiRecoTDC(uint16_t myval, uint16_t myamp, o2::InteractionRecord myir)
Definition DigiReco.h:52
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"