ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4AllHistoManager.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4AllHistoManager.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef FUN4ALL_FUN4ALLHISTOMANAGER_H
4 #define FUN4ALL_FUN4ALLHISTOMANAGER_H
5 
6 #include "Fun4AllBase.h"
7 
8 #include <map>
9 #include <string>
10 
11 class TNamed;
12 
14 {
15  public:
16  Fun4AllHistoManager(const std::string &name);
17  ~Fun4AllHistoManager() override;
18 
19  void Print(const std::string &what = "ALL") const override;
20 
23  bool registerHisto(const std::string &hname, TNamed *h1d, const int replace = 0);
24 
27  bool registerHisto(TNamed *h1d, const int replace = 0);
28 
29  template <typename T>
31  {
32  if (not registerHisto(t))
33  {
34  delete t;
35  t = nullptr;
36  }
37  return t;
38  }
39  int isHistoRegistered(const std::string &name) const;
40  TNamed *getHisto(const std::string &hname) const;
41  TNamed *getHisto(const unsigned int ihisto) const;
42  std::string getHistoName(const unsigned int ihisto) const;
43  unsigned int nHistos() const { return Histo.size(); }
44  void Reset();
45  int dumpHistos(const std::string &filename = "", const std::string &openmode = "RECREATE");
46  void setOutfileName(const std::string &filename) { outfilename = filename; }
47 
48  private:
49  std::string outfilename;
50  std::map<const std::string, TNamed *> Histo;
51 };
52 
53 #endif /* __FUN4ALLHISTOMANAGER_H */