tdaq-develop-2025-02-12
DQMHistosBase.h
1 #ifndef _ots_DQMHistosBase_h_
2 #define _ots_DQMHistosBase_h_
3 
4 #include <map>
5 #include <string>
6 
7 class TFile;
8 class TDirectory;
9 class TObject;
10 
11 namespace ots
12 {
13 class VisualDataManager;
15 {
16  public:
17  DQMHistosBase(void);
18  virtual ~DQMHistosBase(void);
19 
20  virtual void book(void) { ; }
21  virtual void fill(std::string& /*buffer*/,
22  std::map<std::string, std::string> /*header*/)
23  {
24  ;
25  }
26  virtual void load(std::string /*fileName*/) { ; }
27 
28  void setDataManager(VisualDataManager* dataManager) { theDataManager_ = dataManager; }
29 
30  TObject* get(std::string name);
31  TFile* getFile(void) { return theFile_; }
32 
33  protected:
34  void setAutoSave(bool autoSave) { autoSave_ = autoSave; }
35  bool isFileOpen(void);
36  virtual void save(void);
37  virtual void openFile(std::string fileName);
38  virtual void closeFile(void);
39  virtual void autoSave(
40  bool force =
41  false);
42  virtual void setAutoSaveInterval(unsigned int interval)
43  {
44  autoSaveInterval_ = interval;
45  } // Default is in the protected variables = 300
46 
47  TFile* theFile_ = nullptr;
48  TDirectory* myDirectory_ = nullptr;
49  bool autoSave_ = true;
50  bool autoSaveInterval_ = 300;
51  time_t beginTime_ = 0;
52 
53  private:
54  VisualDataManager* theDataManager_;
55 };
56 } // namespace ots
57 
58 #endif
void setAutoSave(bool autoSave)
Default is true.
Definition: DQMHistosBase.h:34
virtual void autoSave(bool force=false)
The file will be saved if force == true or currentTime - beginTimeTime_ is >= autoSaveInterval_.