File indexing completed on 2025-12-18 09:20:29
0001 #ifndef G4HISTOS_G4SNGLTREE_H
0002 #define G4HISTOS_G4SNGLTREE_H
0003
0004 #include "G4EvtTree.h"
0005
0006 #include <fun4all/SubsysReco.h>
0007
0008 #include <map>
0009 #include <set>
0010 #include <string>
0011
0012
0013 class PHCompositeNode;
0014 class PHG4HitContainer;
0015 class TFile;
0016 class TTree;
0017
0018 class G4SnglTree : public SubsysReco
0019 {
0020 public:
0021
0022 G4SnglTree(const std::string &name = "G4SnglTree", const std::string &filename = "G4SnglTree.root");
0023
0024
0025 ~G4SnglTree() override = default;
0026
0027
0028 int Init(PHCompositeNode *) override;
0029
0030
0031 int process_event(PHCompositeNode *) override;
0032
0033
0034 int process_hit(PHG4HitContainer *hits, const std::string &dName, int detid, int &nhits);
0035
0036
0037 int End(PHCompositeNode *) override;
0038
0039 void AddNode(const std::string &name, const int detid = 0);
0040
0041 private:
0042
0043 std::string _filename;
0044 std::set<std::string> _node_postfix;
0045 std::map<std::string, int> _detid;
0046
0047 TTree *g4tree{nullptr};
0048 G4EvtTree mG4EvtTree{};
0049 TFile *outfile{nullptr};
0050 };
0051
0052 #endif