Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHNodeIOManager.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHNodeIOManager.h
1 #ifndef PHOOL_PHNODEIOMANAGER_H
2 #define PHOOL_PHNODEIOMANAGER_H
3 
4 // Declaration of class PHNodeIOManager
5 // Purpose: manages file IO for PHIODataNodes
6 // Author: Matthias Messer
7 
8 #include "PHIOManager.h"
9 
10 #include "phool.h"
11 
12 #include <cstddef>
13 #include <map>
14 #include <string>
15 
16 class PHCompositeNode;
17 class TBranch;
18 class TFile;
19 class TObject;
20 class TTree;
21 
23 {
24  public:
28  PHNodeIOManager(const std::string &, const PHAccessType, const PHTreeType);
29  ~PHNodeIOManager() override;
30 
31 // cppcheck-suppress [virtualCallInConstructor]
32  void closeFile() override;
33  bool write(PHCompositeNode *) override;
34  void print() const override;
35 
36  bool setFile(const std::string &, const std::string &, const PHAccessType = PHReadOnly);
37  PHCompositeNode *read(PHCompositeNode * = nullptr, size_t = 0);
38  bool read(size_t requestedEvent);
39  int readSpecific(size_t requestedEvent, const std::string &objectName);
40  void selectObjectToRead(const std::string &objectName, bool readit);
41  bool isSelected(const std::string &objectName);
42  int isFunctional() const { return isFunctionalFlag; }
43  bool SetCompressionSetting(const int level);
44  uint64_t GetBytesWritten();
45  uint64_t GetFileSize();
46  std::map<std::string, TBranch *> *GetBranchMap();
47 
48  bool write(TObject **, const std::string &, int buffersize, int splitlevel);
49  bool NodeExist(const std::string &nodename);
50 
51  private:
52  int FillBranchMap();
54  bool readEventFromFile(size_t requestedEvent);
56 
57  TFile *file {nullptr};
58  TTree *tree {nullptr};
61  int m_CompressionSetting {505}; // ZSTD
62  int isFunctionalFlag {0}; // flag to tell if that object initialized properly
63  std::map<std::string, TBranch *> fBranches;
64  std::map<std::string, bool> objectToRead;
65 
66 };
67 
68 #endif