Skip to content

Commit 09d229f

Browse files
authored
Use Framework Logger (#2744)
1 parent 311e431 commit 09d229f

3 files changed

Lines changed: 30 additions & 28 deletions

File tree

PWGDQ/Core/HistogramManager.cxx

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <iostream>
1515
#include <memory>
1616
#include <fstream>
17+
#include "Framework/Logger.h"
1718
using namespace std;
1819

1920
#include <TObject.h>
@@ -99,11 +100,11 @@ void HistogramManager::AddHistClass(const char* histClass)
99100
// Add a new histogram list
100101
//
101102
if (fMainList->FindObject(histClass)) {
102-
cout << "Warning in HistogramManager::AddHistClass(): Cannot add histogram class " << histClass
103-
<< " because it already exists." << endl;
103+
LOG(warn) << "HistogramManager::AddHistClass(): Cannot add histogram class " << histClass
104+
<< " because it already exists.";
104105
return;
105106
}
106-
TList* hList = new TList;
107+
auto* hList = new TList;
107108
hList->SetOwner(kTRUE);
108109
hList->SetName(histClass);
109110
fMainList->Add(hList);
@@ -127,15 +128,15 @@ void HistogramManager::AddHistogram(const char* histClass, const char* hname, co
127128
// TODO: replace the cout warning messages with LOG (same for all the other functions)
128129

129130
// get the list to which the histogram should be added
130-
TList* hList = reinterpret_cast<TList*>(fMainList->FindObject(histClass));
131+
auto* hList = reinterpret_cast<TList*>(fMainList->FindObject(histClass));
131132
if (!hList) {
132-
cout << "Warning in HistogramManager::AddHistogram(): Histogram list " << histClass << " not found!" << endl;
133-
cout << " Histogram not created" << endl;
133+
LOG(warn) << "HistogramManager::AddHistogram(): Histogram list " << histClass << " not found!";
134+
LOG(warn) << " Histogram not created";
134135
return;
135136
}
136137
// check whether this histogram name was used before
137138
if (hList->FindObject(hname)) {
138-
cout << "Warning in HistogramManager::AddHistogram(): Histogram " << hname << " already exists" << endl;
139+
LOG(warn) << "HistogramManager::AddHistogram(): Histogram " << hname << " already exists";
139140
return;
140141
}
141142

@@ -325,15 +326,15 @@ void HistogramManager::AddHistogram(const char* histClass, const char* hname, co
325326
//
326327

327328
// get the list to which the histogram should be added
328-
TList* hList = reinterpret_cast<TList*>(fMainList->FindObject(histClass));
329+
auto* hList = reinterpret_cast<TList*>(fMainList->FindObject(histClass));
329330
if (!hList) {
330-
cout << "Warning in HistogramManager::AddHistogram(): Histogram list " << histClass << " not found!" << endl;
331-
cout << " Histogram not created" << endl;
331+
LOG(warn) << "HistogramManager::AddHistogram(): Histogram list " << histClass << " not found!";
332+
LOG(warn) << " Histogram not created";
332333
return;
333334
}
334335
// check whether this histogram name was used before
335336
if (hList->FindObject(hname)) {
336-
cout << "Warning in HistogramManager::AddHistogram(): Histogram " << hname << " already exists" << endl;
337+
LOG(warn) << "HistogramManager::AddHistogram(): Histogram " << hname << " already exists";
337338
return;
338339
}
339340

@@ -517,15 +518,15 @@ void HistogramManager::AddHistogram(const char* histClass, const char* hname, co
517518
//
518519

519520
// get the list to which the histogram should be added
520-
TList* hList = reinterpret_cast<TList*>(fMainList->FindObject(histClass));
521+
auto* hList = reinterpret_cast<TList*>(fMainList->FindObject(histClass));
521522
if (!hList) {
522-
cout << "Warning in HistogramManager::AddHistogram(): Histogram list " << histClass << " not found!" << endl;
523-
cout << " Histogram not created" << endl;
523+
LOG(warn) << "HistogramManager::AddHistogram(): Histogram list " << histClass << " not found!";
524+
LOG(warn) << " Histogram not created";
524525
return;
525526
}
526527
// check whether this histogram name was used before
527528
if (hList->FindObject(hname)) {
528-
cout << "Warning in HistogramManager::AddHistogram(): Histogram " << hname << " already exists" << endl;
529+
LOG(warn) << "HistogramManager::AddHistogram(): Histogram " << hname << " already exists";
529530
return;
530531
}
531532

@@ -596,15 +597,15 @@ void HistogramManager::AddHistogram(const char* histClass, const char* hname, co
596597
//
597598

598599
// get the list to which the histogram should be added
599-
TList* hList = reinterpret_cast<TList*>(fMainList->FindObject(histClass));
600+
auto* hList = reinterpret_cast<TList*>(fMainList->FindObject(histClass));
600601
if (!hList) {
601-
cout << "Warning in HistogramManager::AddHistogram(): Histogram list " << histClass << " not found!" << endl;
602-
cout << " Histogram not created" << endl;
602+
LOG(warn) << "HistogramManager::AddHistogram(): Histogram list " << histClass << " not found!";
603+
LOG(warn) << " Histogram not created";
603604
return;
604605
}
605606
// check whether this histogram name was used before
606607
if (hList->FindObject(hname)) {
607-
cout << "Warning in HistogramManager::AddHistogram(): Histogram " << hname << " already exists" << endl;
608+
LOG(warn) << "HistogramManager::AddHistogram(): Histogram " << hname << " already exists";
608609
return;
609610
}
610611

@@ -631,8 +632,8 @@ void HistogramManager::AddHistogram(const char* histClass, const char* hname, co
631632
fVariablesMap[histClass] = varList;
632633

633634
// get the min and max for each axis
634-
double* xmin = new double[nDimensions];
635-
double* xmax = new double[nDimensions];
635+
auto* xmin = new double[nDimensions];
636+
auto* xmax = new double[nDimensions];
636637
int* nBins = new int[nDimensions];
637638
for (int idim = 0; idim < nDimensions; ++idim) {
638639
nBins[idim] = binLimits[idim].GetSize() - 1;
@@ -686,11 +687,11 @@ void HistogramManager::FillHistClass(const char* className, Float_t* values)
686687
//
687688

688689
// get the needed histogram list
689-
TList* hList = reinterpret_cast<TList*>(fMainList->FindObject(className));
690+
auto* hList = reinterpret_cast<TList*>(fMainList->FindObject(className));
690691
if (!hList) {
691692
// TODO: add some meaningfull error message
692-
/*cout << "Warning in HistogramManager::FillHistClass(): Histogram list " << className << " not found!" << endl;
693-
cout << " Histogram list not filled" << endl; */
693+
/*LOG(warn) << "HistogramManager::FillHistClass(): Histogram list " << className << " not found!";
694+
LOG(warn) << " Histogram list not filled" << endl; */
694695
return;
695696
}
696697

@@ -830,7 +831,7 @@ void HistogramManager::Print(Option_t*) const
830831
cout << "###################################################################" << endl;
831832
cout << "HistogramManager:: " << fMainList->GetName() << endl;
832833
for (int i = 0; i < fMainList->GetEntries(); ++i) {
833-
TList* list = reinterpret_cast<TList*>(fMainList->At(i));
834+
auto* list = reinterpret_cast<TList*>(fMainList->At(i));
834835
cout << "************** List " << list->GetName() << endl;
835836
for (int j = 0; j < list->GetEntries(); ++j) {
836837
TObject* obj = list->At(j);

PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//
1212
// Contact: daiki.sekihata@cern.ch
1313
//
14-
14+
#include "Framework/Logger.h"
1515
#include <iostream>
1616
#include <memory>
1717
#include <fstream>
@@ -248,11 +248,11 @@ void o2::aod::emphotonhistograms::DefineHistograms(THashList* list, const char*
248248
void o2::aod::emphotonhistograms::AddHistClass(THashList* list, const char* histClass)
249249
{
250250
if (list->FindObject(histClass)) {
251-
std::cout << "Warning in HistogramsLibrary::AddHistClass(): Cannot add histogram class " << histClass << " because it already exists." << std::endl;
251+
LOG(warn) << "HistogramsLibrary::AddHistClass(): Cannot add histogram class " << histClass << " because it already exists.";
252252
return;
253253
}
254254

255-
THashList* sublist = new THashList();
255+
auto* sublist = new THashList();
256256
sublist->SetOwner(true);
257257
sublist->SetName(histClass);
258258
list->Add(sublist);

PWGUD/Tasks/DGCandAnalyzer.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "PWGUD/Core/DGPIDSelector.h"
2525
#include "PWGUD/Core/UDGoodRunSelector.h"
2626
#include "PWGUD/Core/UDFSParser.h"
27+
#include <set>
2728

2829
using namespace o2;
2930
using namespace o2::framework;

0 commit comments

Comments
 (0)