32class TGraphAsymmErrors;
35#if !defined(GPUCA_BUILD_QA) || defined(GPUCA_GPUCODE)
45 int32_t
InitQA(int32_t tasks = 0) {
return 1; }
46 void RunQA(
bool matchOnly =
false) {}
71#ifdef GPUCA_TPC_GEOMETRY_O2
81struct ClusterNativeAccess;
89class GPUChainTracking;
92struct checkClusterStateResult;
95struct GPUQAGarbageCollection;
102 GPUQA(GPUChainTracking*
chain,
const GPUSettingsQA* config =
nullptr,
const GPUParam*
param =
nullptr);
105#ifdef GPUCA_TPC_GEOMETRY_O2
106 using mcLabels_t = gsl::span<const o2::MCCompLabel>;
119 void UpdateParam(
const GPUParam*
param) { mParam =
param; }
120 int32_t
InitQA(int32_t tasks = -1);
121 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);
123 void DrawQAHistogramsCleanup();
129 uint32_t GetMCLabelCol(
const mcLabel_t&
label)
const;
131 void InitO2MCData(GPUTrackingInOutPointers* updateIOPtr =
nullptr);
138 const std::vector<TH1F>& getHistograms1D()
const {
return *mHist1D; }
139 const std::vector<TH2F>& getHistograms2D()
const {
return *mHist2D; }
140 const std::vector<TH1D>& getHistograms1Dd()
const {
return *mHist1Dd; }
141 const std::vector<TGraphAsymmErrors>& getGraphs()
const {
return *mHistGraph; }
143 int32_t loadHistograms(std::vector<TH1F>& i1, std::vector<TH2F>& i2, std::vector<TH1D>& i3, std::vector<TGraphAsymmErrors>& i4, int32_t tasks = -1);
146 static constexpr int32_t N_CLS_HIST = 8;
147 static constexpr int32_t N_CLS_TYPE = 3;
149 static constexpr int32_t MC_LABEL_INVALID = -1e9;
154 struct additionalMCParameters {
155 float pt,
phi, theta, eta, nWeightCls;
158 struct additionalClusterParameters {
159 int32_t attached, fakeAttached, adjacent, fakeAdjacent;
163 int32_t InitQACreateHistograms();
164 int32_t DoClusterCounts(uint64_t* attachClusterCounts, int32_t
mode = 0);
165 void PrintClusterCount(int32_t
mode, int32_t&
num,
const char*
name, uint64_t
n, uint64_t normalization);
166 void CopyO2MCtoIOPtr(GPUTrackingInOutPointers*
ptr);
168 void SetAxisSize(T* e);
169 void SetLegend(TLegend* l,
bool bigText =
false);
170 double* CreateLogAxis(int32_t nbins,
float xmin,
float xmax);
171 void ChangePadTitleSize(TPad* p,
float size);
172 void DrawHisto(TH1* histo,
char*
filename,
char* options);
173 void doPerfFigure(
float x,
float y,
float size);
174 void GetName(
char* fname, int32_t k,
bool noDash =
false);
176 T* GetHist(T*& ee, std::vector<std::unique_ptr<TFile>>& tin, int32_t k, int32_t nNewInput);
178 using mcInfo_t = GPUTPCMCInfo;
179#ifdef GPUCA_TPC_GEOMETRY_O2
180 mcLabels_t GetMCLabel(uint32_t
i);
181 mcLabel_t GetMCLabel(uint32_t
i, uint32_t
j);
184 int32_t getTrackID()
const {
return AbsLabelID(track); }
185 int32_t getEventID()
const {
return 0; }
186 int32_t getSourceID()
const {
return 0; }
187 int64_t getTrackEventSourceID()
const {
return getTrackID(); }
188 bool isFake()
const {
return track < 0; }
189 bool isValid()
const {
return track != MC_LABEL_INVALID; }
190 void invalidate() { track = MC_LABEL_INVALID; }
191 void setFakeFlag(
bool v =
true) { track =
v ? FakeLabelID(track) : AbsLabelID(track); }
192 void setNoise() { track = MC_LABEL_INVALID; }
194 bool operator!=(
const mcLabel_t& l) {
return !(*
this == l); }
197 int32_t track = MC_LABEL_INVALID;
199 const mcLabels_t& GetMCLabel(uint32_t
i);
200 const mcLabel_t& GetMCLabel(uint32_t
i, uint32_t
j);
202 static int32_t FakeLabelID(
const int32_t
id);
203 static int32_t AbsLabelID(
const int32_t
id);
206 auto& GetMCTrackObj(T& obj,
const mcLabelI_t& l);
208 uint32_t GetNMCCollissions()
const;
209 uint32_t GetNMCTracks(int32_t iCol)
const;
211 uint32_t GetNMCLabels()
const;
212 const mcInfo_t& GetMCTrack(uint32_t iTrk, uint32_t iCol);
213 const mcInfo_t& GetMCTrack(
const mcLabel_t&
label);
214 int32_t GetMCLabelNID(
const mcLabels_t&
label);
215 int32_t GetMCLabelNID(uint32_t
i);
216 int32_t GetMCLabelID(uint32_t
i, uint32_t
j);
217 uint32_t GetMCLabelCol(uint32_t
i, uint32_t
j);
218 static int32_t GetMCLabelID(
const mcLabels_t&
label, uint32_t
j);
219 static int32_t GetMCLabelID(
const mcLabel_t&
label);
220 float GetMCLabelWeight(uint32_t
i, uint32_t
j);
221 float GetMCLabelWeight(
const mcLabels_t&
label, uint32_t
j);
222 float GetMCLabelWeight(
const mcLabel_t&
label);
224 const auto& GetClusterLabels();
227 template <
bool COUNT = false,
class T =
void>
228 checkClusterStateResult checkClusterState(uint32_t attach, T* counts =
nullptr)
const;
230 GPUChainTracking* mTracking;
231 const GPUSettingsQA& mConfig;
232 const GPUParam* mParam;
236 std::vector<mcLabelI_t> mTrackMCLabels;
237#ifdef GPUCA_TPC_GEOMETRY_O2
238 std::vector<std::vector<int32_t>> mTrackMCLabelsReverse;
239 std::vector<std::vector<int32_t>> mRecTracks;
240 std::vector<std::vector<int32_t>> mFakeTracks;
241 std::vector<std::vector<additionalMCParameters>> mMCParam;
243 std::vector<int32_t> mTrackMCLabelsReverse[1];
244 std::vector<int32_t> mRecTracks[1];
245 std::vector<int32_t> mFakeTracks[1];
246 std::vector<additionalMCParameters> mMCParam[1];
248 std::vector<mcInfo_t> mMCInfos;
249 std::vector<GPUTPCMCInfoCol> mMCInfosCol;
250 std::vector<uint32_t> mMCNEvents;
251 std::vector<uint32_t> mMCEventOffset;
253 std::vector<additionalClusterParameters> mClusterParam;
254 int32_t mNTotalFakes = 0;
256 TH1F* mEff[6][2][2][5];
257 TGraphAsymmErrors* mEffResult[4][2][2][5];
268 TH1F* mPull[5][5][2];
274 enum CL_types { CL_attached = 0,
282 TH1D* mClusters[N_CLS_TYPE * N_CLS_HIST - 1];
283 TCanvas* mCClust[N_CLS_TYPE];
284 TPad* mPClust[N_CLS_TYPE];
285 TLegend* mLClust[N_CLS_TYPE];
288 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;
289 int64_t nMergedLooperConnected = 0, nMergedLooperUnconnected = 0, nCorrectlyAttachedNormalized = 0, nCorrectlyAttachedNormalizedNonFake = 0;
290 double nUnaccessible = 0;
320 TCanvas* mCPadRow[4];
323 std::vector<TH2F*> mHistClusterCount;
325 std::vector<TH1F>* mHist1D =
nullptr;
326 std::vector<TH2F>* mHist2D =
nullptr;
327 std::vector<TH1D>* mHist1Dd =
nullptr;
328 std::vector<TGraphAsymmErrors>* mHistGraph =
nullptr;
329 bool mHaveExternalHists =
false;
330 std::vector<TH1F**> mHist1D_pos{};
331 std::vector<TH2F**> mHist2D_pos{};
332 std::vector<TH1D**> mHist1Dd_pos{};
333 std::vector<TGraphAsymmErrors**> mHistGraph_pos{};
336 template <
class T,
typename... Args>
337 void createHist(T*&
h,
const char*
name, Args... args);
339 std::unique_ptr<internal::GPUQAGarbageCollection> mGarbageCollector;
340 template <
class T,
typename... Args>
341 T* createGarbageCollected(Args... args);
342 void clearGarbagageCollector();
344 int32_t mNEvents = 0;
345 bool mQAInitialized =
false;
346 bool mO2MCDataLoaded =
false;
347 int32_t mQATasks = 0;
348 std::vector<std::vector<int32_t>> mcEffBuffer;
349 std::vector<std::vector<int32_t>> mcLabelBuffer;
350 std::vector<std::vector<bool>> mGoodTracks;
351 std::vector<std::vector<bool>> mGoodHits;
353 std::vector<uint64_t> mTrackingScratchBuffer;
355 static std::vector<TColor*> mColors;
356 static int32_t initColors();
358 int32_t mMCTrackMin = -1, mMCTrackMax = -1;
361 FILE* mTextDump =
nullptr;
364inline bool GPUQA::SuppressTrack(int32_t iTrack)
const {
return (mConfig.matchMCLabels.size() && !mGoodTracks[mNEvents][iTrack]); }
365inline bool GPUQA::SuppressHit(int32_t iHit)
const {
return (mConfig.matchMCLabels.size() && !mGoodHits[mNEvents - 1][iHit]); }
366inline 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)