ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QAHistManagerDef.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file QAHistManagerDef.cc
1 // $Id: $
2 
11 #include "QAHistManagerDef.h"
12 
14 #include <fun4all/Fun4AllServer.h>
15 
16 #include <TAxis.h>
17 
18 #include <cassert>
19 #include <cmath>
20 #include <iosfwd> // for std
21 #include <vector>
22 
23 namespace QAHistManagerDef
24 {
28  {
31 
32  if (not hm)
33  {
34  // std::cout
35  // << "QAHistManagerDef::get_HistoManager - Making Fun4AllHistoManager EMCalAna_HISTOS"
36  // << std::endl;
38  se->registerHistoManager(hm);
39  }
40 
41  assert(hm);
42 
43  return hm;
44  }
45 
47  void saveQARootFile(const std::string &file_name)
48  {
49  getHistoManager()->dumpHistos(file_name);
50  }
51 
53  void useLogBins(TAxis *axis)
54  {
55  assert(axis);
56  assert(axis->GetXmin() > 0);
57  assert(axis->GetXmax() > 0);
58 
59  const int bins = axis->GetNbins();
60 
61  Axis_t from = log10(axis->GetXmin());
62  Axis_t to = log10(axis->GetXmax());
63  Axis_t width = (to - from) / bins;
64  std::vector<Axis_t> new_bins(bins + 1);
65 
66  for (int i = 0; i <= bins; i++)
67  {
68  new_bins[i] = pow(10, from + i * width);
69  }
70  axis->Set(bins, new_bins.data());
71  }
72 } // namespace QAHistManagerDef