Project
Loading...
Searching...
No Matches
DebugStreamer.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_DEBUGSTREAMER_H_
17#define ALICEO2_TPC_DEBUGSTREAMER_H_
18
19#include "GPUCommonDef.h"
20#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
22#include <boost/property_tree/ptree.hpp>
23#if defined(DEBUG_STREAMER)
25#include <tbb/concurrent_unordered_map.h>
26#endif
27#endif
28
29namespace o2::utils
30{
31
46
55
56#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
57
59{
60 return static_cast<StreamFlags>(static_cast<int>(a) | static_cast<int>(b));
61}
62inline StreamFlags operator&(StreamFlags a, StreamFlags b) { return static_cast<StreamFlags>(static_cast<int>(a) & static_cast<int>(b)); }
63inline StreamFlags operator~(StreamFlags a) { return static_cast<StreamFlags>(~static_cast<int>(a)); }
64
73
74#endif
75
78{
79
80// CPU implementation of the class
81#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) && defined(DEBUG_STREAMER)
82 public:
85
86 static DebugStreamer* instance()
87 {
88 static DebugStreamer streamer;
89 return &streamer;
90 }
91
96 void setStreamer(const char* outFile, const char* option, const size_t id = getCPUID());
97
100 bool isStreamerSet(const size_t id = getCPUID()) const { return getStreamerPtr(id); }
101
104 void flush(const size_t id);
105
107 void flush();
108
111 o2::utils::TreeStreamRedirector& getStreamer(const size_t id = getCPUID()) { return *(mTreeStreamer[id]); }
112
117 o2::utils::TreeStreamRedirector& getStreamer(const char* outFile, const char* option, const size_t id = getCPUID());
118
121 o2::utils::TreeStreamRedirector* getStreamerPtr(const size_t id = getCPUID()) const;
122
124 static StreamFlags getStreamFlags() { return static_cast<StreamFlags>(ParameterDebugStreamer::Instance().streamLevel); }
125
127 static std::pair<SamplingTypes, float> getSamplingTypeFrequency(const StreamFlags streamFlag);
128
130 static float getSamplingFrequency(const StreamFlags streamFlag) { return getSamplingTypeFrequency(streamFlag).second; }
131
133 static size_t getCPUID();
134
137 int getNTrees(const size_t id = getCPUID()) const;
138
142 std::string getUniqueTreeName(const char* tree, const size_t id = getCPUID()) const;
143
145 static void setStreamFlags(const StreamFlags streamFlags) { o2::conf::ConfigurableParam::setValue<int>("DebugStreamerParam", "streamLevel", static_cast<int>(streamFlags)); }
146
148 static void enableStream(const StreamFlags streamFlag);
149
151 static void disableStream(const StreamFlags streamFlag);
152
156 static bool checkStream(const StreamFlags streamFlag, const size_t samplingID = -1, const float weight = 1);
157
162 static void mergeTrees(const char* inpFile, const char* outFile, const char* option = "fast");
163
165 static int getIndex(const StreamFlags streamFlag);
166
168 static float getRandom(float min = 0, float max = 1);
169
170 private:
171 using StreamersPerFlag = tbb::concurrent_unordered_map<size_t, std::unique_ptr<o2::utils::TreeStreamRedirector>>;
172 StreamersPerFlag mTreeStreamer;
173#else
174
175 // empty implementation of the class for GPU or when the debug streamer is not build for CPU
176 public:
178 template <typename... Args>
179 GPUd() void setStreamer(Args... args){};
180
182 GPUd() static bool checkStream(const StreamFlags, const int samplingID = 0) { return false; }
183
184 GPUd() static DebugStreamer* instance() { return nullptr; }
185
186 class StreamerDummy
187 {
188 public:
189 GPUd() int data() const { return 0; };
190
191 template <typename Type>
192 GPUd() StreamerDummy& operator<<(Type)
193 {
194 return *this;
195 }
196 };
197
198 GPUd() StreamerDummy getStreamer(const int id = 0) const { return StreamerDummy{}; };
199
201 template <typename... Args>
202 GPUd() StreamerDummy getStreamer(Args... args) const
203 {
204 return StreamerDummy{};
205 };
206
207 template <typename Type>
208 GPUd() StreamerDummy getUniqueTreeName(Type, const int id = 0) const
209 {
210 return StreamerDummy{};
211 }
212
213 GPUd() void flush() const {};
214
215#endif
216};
217
218} // namespace o2::utils
219
220#endif
#define GPUd()
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 Print launch bounds used for RTC code as debugging option
class to enable streaming debug information to root files
GPUd() StreamerDummy getStreamer(Args... args) const
empty for GPU
GPUd() StreamerDummy getUniqueTreeName(Type
GPUd() static bool checkStream(const StreamFlags
always false for GPU
GPUd() void setStreamer(Args... args)
empty for GPU
GPUd() StreamerDummy getStreamer(const int id=0) const
GLuint GLuint GLfloat weight
Definition glcorearb.h:5477
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
StreamFlags operator|(StreamFlags a, StreamFlags b)
@ sampleIDGlobal
in case different streamers have access to the same IDs use this gloabl ID
@ sampleTsallis
perform sampling on tsallis pdf
@ sampleAll
use all data (default)
@ sampleID
sample every n IDs (per example track)
@ sampleWeights
perform sampling on weights, defined where the streamer is called
@ sampleRandom
sample randomly every n points
StreamFlags operator~(StreamFlags a)
StreamFlags
struct defining the flags which can be used to check if a certain debug streamer is used
@ streamdEdx
stream corrections and cluster properties used for the dE/dx
@ streamDigits
stream digit information
@ streamFastTransform
stream tpc fast transform
@ streamMergeBorderTracksBest
stream MergeBorderTracks best track
@ streamFlagsCount
total number of streamers
@ streamRejectCluster
stream cluster rejection informations
@ streamMergeBorderTracksAll
stream MergeBorderTracks all tracks
@ streamITCorr
stream ion tail correction information
@ streamDigitFolding
stream ion tail and saturatio information
@ streamDistortionsSC
stream distortions applied in the TPC space-charge class (used for example in the tpc digitizer)
@ streamUpdateTrack
stream update track informations
StreamFlags operator&(StreamFlags a, StreamFlags b)
struct for setting and storing the streamer level
int sampleIDGlobal[StreamFlags::streamFlagsCount]
storage of reference streamer used for sampleIDFromOtherStreamer
float samplingFrequency[StreamFlags::streamFlagsCount]
frequency which is used for the sampling (0.1 -> 10% is written if sampling is used)
O2ParamDef(ParameterDebugStreamer, "DebugStreamerParam")
SamplingTypes samplingType[StreamFlags::streamFlagsCount]
flag to store what will be streamed
constexpr size_t min
constexpr size_t max
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))