31class TGraphAsymmErrors;
34#if !defined(GPUCA_BUILD_QA) || defined(GPUCA_GPUCODE)
44 int32_t
InitQA(int32_t tasks = 0) {
return 1; }
45 void RunQA(
bool matchOnly =
false) {}
68#ifdef GPUCA_TPC_GEOMETRY_O2
78struct ClusterNativeAccess;
86class GPUChainTracking;
89struct checkClusterStateResult;
92struct GPUQAGarbageCollection;
99 GPUQA(GPUChainTracking*
chain,
const GPUSettingsQA* config =
nullptr,
const GPUParam*
param =
nullptr);
102#ifdef GPUCA_TPC_GEOMETRY_O2
103 using mcLabels_t = gsl::span<const o2::MCCompLabel>;
116 void UpdateParam(
const GPUParam*
param) { mParam =
param; }
117 int32_t
InitQA(int32_t tasks = -1);
118 void RunQA(
bool matchOnly =
false,
const std::vector<o2::tpc::TrackTPC>* tracksExternal =
nullptr,
const std::vector<o2::MCCompLabel>* tracksExtMC =
nullptr,
const o2::tpc::ClusterNativeAccess* clNative =
nullptr);
120 void DrawQAHistogramsCleanup();
126 uint32_t GetMCLabelCol(
const mcLabel_t&
label)
const;
128 void InitO2MCData(GPUTrackingInOutPointers* updateIOPtr =
nullptr);
135 const std::vector<TH1F>& getHistograms1D()
const {
return *mHist1D; }
136 const std::vector<TH2F>& getHistograms2D()
const {
return *mHist2D; }
137 const std::vector<TH1D>& getHistograms1Dd()
const {
return *mHist1Dd; }
138 const std::vector<TGraphAsymmErrors>& getGraphs()
const {
return *mHistGraph; }
140 int32_t loadHistograms(std::vector<TH1F>& i1, std::vector<TH2F>& i2, std::vector<TH1D>& i3, std::vector<TGraphAsymmErrors>& i4, int32_t tasks = -1);
143 static constexpr int32_t N_CLS_HIST = 8;
144 static constexpr int32_t N_CLS_TYPE = 3;
146 static constexpr int32_t MC_LABEL_INVALID = -1e9;
151 taskTrackingResPull = 4,
152 taskClusterAttach = 8,
153 taskTrackStatistics = 16,
154 taskClusterCounts = 32,
156 taskDefaultPostprocess = 31,
161 struct additionalMCParameters {
162 float pt,
phi, theta, eta, nWeightCls;
165 struct additionalClusterParameters {
166 int32_t attached, fakeAttached, adjacent, fakeAdjacent;
170 int32_t InitQACreateHistograms();
171 int32_t DoClusterCounts(uint64_t* attachClusterCounts, int32_t
mode = 0);
172 void PrintClusterCount(int32_t
mode, int32_t&
num,
const char*
name, uint64_t
n, uint64_t normalization);
173 void CopyO2MCtoIOPtr(GPUTrackingInOutPointers*
ptr);
175 void SetAxisSize(T* e);
176 void SetLegend(TLegend* l,
bool bigText =
false);
177 double* CreateLogAxis(int32_t nbins,
float xmin,
float xmax);
178 void ChangePadTitleSize(TPad* p,
float size);
179 void DrawHisto(TH1* histo,
char*
filename,
char* options);
180 void doPerfFigure(
float x,
float y,
float size);
181 void GetName(
char* fname, int32_t k,
bool noDash =
false);
183 T* GetHist(T*& ee, std::vector<std::unique_ptr<TFile>>& tin, int32_t k, int32_t nNewInput);
185 using mcInfo_t = GPUTPCMCInfo;
186#ifdef GPUCA_TPC_GEOMETRY_O2
187 mcLabels_t GetMCLabel(uint32_t
i);
188 mcLabel_t GetMCLabel(uint32_t
i, uint32_t
j);
191 int32_t getTrackID()
const {
return AbsLabelID(track); }
192 int32_t getEventID()
const {
return 0; }
193 int32_t getSourceID()
const {
return 0; }
194 int64_t getTrackEventSourceID()
const {
return getTrackID(); }
195 bool isFake()
const {
return track < 0; }
196 bool isValid()
const {
return track != MC_LABEL_INVALID; }
197 void invalidate() { track = MC_LABEL_INVALID; }
198 void setFakeFlag(
bool v =
true) { track =
v ? FakeLabelID(track) : AbsLabelID(track); }
199 void setNoise() { track = MC_LABEL_INVALID; }
201 bool operator!=(
const mcLabel_t& l) {
return !(*
this == l); }
204 int32_t track = MC_LABEL_INVALID;
206 const mcLabels_t& GetMCLabel(uint32_t
i);
207 const mcLabel_t& GetMCLabel(uint32_t
i, uint32_t
j);
209 static int32_t FakeLabelID(
const int32_t
id);
210 static int32_t AbsLabelID(
const int32_t
id);
213 auto& GetMCTrackObj(T& obj,
const mcLabelI_t& l);
215 uint32_t GetNMCCollissions()
const;
216 uint32_t GetNMCTracks(int32_t iCol)
const;
218 uint32_t GetNMCLabels()
const;
219 const mcInfo_t& GetMCTrack(uint32_t iTrk, uint32_t iCol);
220 const mcInfo_t& GetMCTrack(
const mcLabel_t&
label);
221 int32_t GetMCLabelNID(
const mcLabels_t&
label);
222 int32_t GetMCLabelNID(uint32_t
i);
223 int32_t GetMCLabelID(uint32_t
i, uint32_t
j);
224 uint32_t GetMCLabelCol(uint32_t
i, uint32_t
j);
225 static int32_t GetMCLabelID(
const mcLabels_t&
label, uint32_t
j);
226 static int32_t GetMCLabelID(
const mcLabel_t&
label);
227 float GetMCLabelWeight(uint32_t
i, uint32_t
j);
228 float GetMCLabelWeight(
const mcLabels_t&
label, uint32_t
j);
229 float GetMCLabelWeight(
const mcLabel_t&
label);
231 const auto& GetClusterLabels();
234 template <
bool COUNT = false,
class T =
void>
235 checkClusterStateResult checkClusterState(uint32_t attach, T* counts =
nullptr)
const;
237 GPUChainTracking* mTracking;
238 const GPUSettingsQA& mConfig;
239 const GPUParam* mParam;
243 std::vector<mcLabelI_t> mTrackMCLabels;
244#ifdef GPUCA_TPC_GEOMETRY_O2
245 std::vector<std::vector<int32_t>> mTrackMCLabelsReverse;
246 std::vector<std::vector<int32_t>> mRecTracks;
247 std::vector<std::vector<int32_t>> mFakeTracks;
248 std::vector<std::vector<additionalMCParameters>> mMCParam;
250 std::vector<int32_t> mTrackMCLabelsReverse[1];
251 std::vector<int32_t> mRecTracks[1];
252 std::vector<int32_t> mFakeTracks[1];
253 std::vector<additionalMCParameters> mMCParam[1];
255 std::vector<mcInfo_t> mMCInfos;
256 std::vector<GPUTPCMCInfoCol> mMCInfosCol;
257 std::vector<uint32_t> mMCNEvents;
258 std::vector<uint32_t> mMCEventOffset;
260 std::vector<additionalClusterParameters> mClusterParam;
261 int32_t mNTotalFakes = 0;
263 TH1F* mEff[6][2][2][5];
264 TGraphAsymmErrors* mEffResult[4][2][2][5];
275 TH1F* mPull[5][5][2];
281 enum CL_types { CL_attached = 0,
289 TH1D* mClusters[N_CLS_TYPE * N_CLS_HIST - 1];
290 TCanvas* mCClust[N_CLS_TYPE];
291 TPad* mPClust[N_CLS_TYPE];
292 TLegend* mLClust[N_CLS_TYPE];
295 int64_t nRejected = 0, nTube = 0, nTube200 = 0, nLoopers = 0, nLowPt = 0, n200MeV = 0, nPhysics = 0, nProt = 0, nUnattached = 0, nTotal = 0, nHighIncl = 0, nAbove400 = 0, nFakeRemove400 = 0, nFullFakeRemove400 = 0, nBelow40 = 0, nFakeProtect40 = 0;
296 int64_t nMergedLooperConnected = 0, nMergedLooperUnconnected = 0, nCorrectlyAttachedNormalized = 0, nCorrectlyAttachedNormalizedNonFake = 0;
297 double nUnaccessible = 0;
327 TCanvas* mCPadRow[2];
330 std::vector<TH2F*> mHistClusterCount;
332 std::vector<TH1F>* mHist1D =
nullptr;
333 std::vector<TH2F>* mHist2D =
nullptr;
334 std::vector<TH1D>* mHist1Dd =
nullptr;
335 std::vector<TGraphAsymmErrors>* mHistGraph =
nullptr;
336 bool mHaveExternalHists =
false;
337 std::vector<TH1F**> mHist1D_pos{};
338 std::vector<TH2F**> mHist2D_pos{};
339 std::vector<TH1D**> mHist1Dd_pos{};
340 std::vector<TGraphAsymmErrors**> mHistGraph_pos{};
343 template <
class T,
typename... Args>
344 void createHist(T*&
h,
const char*
name, Args... args);
346 std::unique_ptr<internal::GPUQAGarbageCollection> mGarbageCollector;
347 template <
class T,
typename... Args>
348 T* createGarbageCollected(Args... args);
349 void clearGarbagageCollector();
351 int32_t mNEvents = 0;
352 bool mQAInitialized =
false;
353 bool mO2MCDataLoaded =
false;
354 int32_t mQATasks = 0;
355 std::vector<std::vector<int32_t>> mcEffBuffer;
356 std::vector<std::vector<int32_t>> mcLabelBuffer;
357 std::vector<std::vector<bool>> mGoodTracks;
358 std::vector<std::vector<bool>> mGoodHits;
360 std::vector<uint64_t> mTrackingScratchBuffer;
362 static std::vector<TColor*> mColors;
363 static int32_t initColors();
365 int32_t mMCTrackMin = -1, mMCTrackMax = -1;
370inline bool GPUQA::SuppressTrack(int32_t iTrack)
const {
return (mConfig.matchMCLabels.size() && !mGoodTracks[mNEvents][iTrack]); }
371inline bool GPUQA::SuppressHit(int32_t iHit)
const {
return (mConfig.matchMCLabels.size() && !mGoodHits[mNEvents - 1][iHit]); }
372inline int32_t
GPUQA::HitAttachStatus(int32_t iHit)
const {
return (mClusterParam.size() && mClusterParam[iHit].fakeAttached ? (mClusterParam[iHit].attached ? 1 : 2) : 0); }
Class for time synchronization of RawReader instances.
int32_t ReadO2MCData(const char *filename)
bool clusterRemovable(int32_t attach, bool prot) const
int32_t HitAttachStatus(int32_t iHit) const
void * AllocateScratchBuffer(size_t nBytes)
static bool QAAvailable()
void SetMCTrackRange(int32_t min, int32_t max)
bool SuppressTrack(int32_t iTrack) const
mcLabelI_t GetMCTrackLabel(uint32_t trackId) const
int32_t DrawQAHistograms()
void UpdateChain(GPUChainTracking *chain)
static bool IsInitialized()
bool SuppressHit(int32_t iHit) const
int32_t InitQA(int32_t tasks=0)
void DumpO2MCData(const char *filename) const
void RunQA(bool matchOnly=false)
GLuint const GLchar * name
GLuint GLsizei const GLchar * label
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
bool operator!=(const observer_ptr< W1 > &p1, const observer_ptr< W2 > &p2)
bool operator==(const observer_ptr< W1 > &p1, const observer_ptr< W2 > &p2)
bool isValid(std::string alias)