1111
1212#define _USE_MATH_DEFINES
1313
14- #include < cmath>
15- #include < memory>
16- #include < unordered_map>
17-
1814// root includes
1915#include " TFile.h"
20- #include < TH1.h >
16+ #include " TH1I.h "
2117
2218// o2 includes
2319#include " TPCQC/GPUErrorQA.h"
@@ -41,7 +37,7 @@ void GPUErrorQA::initializeHistograms()
4137 };
4238
4339 // 1D histogram counting all reported errors
44- mMapHist [" ErrorCounter" ] = std::make_unique<TH1F >(" ErrorCounter" , " ErrorCounter" , errorNames.size (), 0 , errorNames.size ());
40+ mMapHist [" ErrorCounter" ] = std::make_unique<TH1I >(" ErrorCounter" , " ErrorCounter" , errorNames.size (), - 0.5 , errorNames.size () - 0.5 );
4541 mMapHist [" ErrorCounter" ]->GetXaxis ()->SetTitle (" Error Codes" );
4642 mMapHist [" ErrorCounter" ]->GetYaxis ()->SetTitle (" Entries" );
4743 // for convienence, label each bin with the error name
@@ -58,22 +54,22 @@ void GPUErrorQA::resetHistograms()
5854 }
5955}
6056// ______________________________________________________________________________
61- void GPUErrorQA::processErrors (gsl::span< const std::array<uint32_t , 4 >> errors)
57+ void GPUErrorQA::processErrors (std::vector< std::array<uint32_t , 4 >> errors)
6258{
6359 for (const auto & error : errors) {
6460 uint32_t errorCode = error[0 ];
65- mMapHist [" ErrorCounter" ]->Fill ( static_cast < float >( errorCode) );
61+ mMapHist [" ErrorCounter" ]->AddBinContent ( errorCode);
6662 }
6763}
6864
6965// ______________________________________________________________________________
7066void GPUErrorQA::dumpToFile (const std::string filename)
7167{
7268 auto f = std::unique_ptr<TFile>(TFile::Open (filename.data (), " recreate" ));
69+ TObjArray arr;
70+ arr.SetName (" GPUErrorQA_Hists" );
7371 for (const auto & [name, hist] : mMapHist ) {
74- TObjArray arr;
75- arr.SetName (name.data ());
7672 arr.Add (hist.get ());
77- arr.Write (arr.GetName (), TObject::kSingleKey );
7873 }
74+ arr.Write (arr.GetName (), TObject::kSingleKey );
7975}
0 commit comments