File indexing completed on 2025-10-16 08:21:02
0001 #ifndef TRUTHNEUTRALMESONBUILDER_H
0002 #define TRUTHNEUTRALMESONBUILDER_H
0003
0004 #include <fun4all/SubsysReco.h>
0005
0006 #include <g4main/PHG4Particle.h>
0007 #include <g4main/PHG4Shower.h>
0008 #include <g4main/PHG4VtxPoint.h>
0009
0010 #include <map>
0011 #include <set>
0012 #include <string>
0013 #include <unordered_map>
0014 #include <unordered_set>
0015
0016 class PHCompositeNode;
0017 class PHG4Shower;
0018 class PHG4TruthInfoContainer;
0019 class PHHepMCGenEvent;
0020 class PHHepMCGenEventMap;
0021 class TruthNeutralMesonContainer;
0022 namespace HepMC
0023 {
0024 class GenParticle;
0025 }
0026
0027 class TruthNeutralMesonBuilder : public SubsysReco
0028 {
0029 public:
0030 explicit TruthNeutralMesonBuilder(const std::string &name = "TruthNeutralMesonBuilder");
0031 ~TruthNeutralMesonBuilder() override = default;
0032
0033 int Init(PHCompositeNode *topNode) override;
0034 int End(PHCompositeNode *topNode) override;
0035
0036 void classify_eta_decay(int bc, HepMC::GenParticle *hepMom, bool &eta_3pi0, bool &eta_pi0pipm);
0037
0038 virtual bool FindConversion(PHG4TruthInfoContainer *_truthinfo, int trackid, float energy);
0039 virtual bool RejectShowerMeson(PHG4TruthInfoContainer *_truthinfo, int parent_trackid, int this_trackid);
0040
0041 int process_event(PHCompositeNode *topNode) override;
0042
0043 void set_conversion_radius(float conversion_radius) { m_conversion_radius_limit = conversion_radius; }
0044 void set_truthnmeson_NodeName(const std::string &inputNodeName) { m_truthnmeson_node_name = inputNodeName; }
0045
0046 void set_save_eta(bool _sv) { m_save_eta = _sv; }
0047 void set_save_pi0(bool _sv) { m_save_pi0 = _sv; }
0048
0049 private:
0050 int CreateNodes(PHCompositeNode *topNode);
0051
0052 bool m_save_eta{true};
0053 bool m_save_pi0{true};
0054
0055 float m_conversion_radius_limit{93};
0056 float m_shower_reject_radius{1};
0057
0058 std::string m_truthnmeson_node_name = "TruthNeutralMeson";
0059
0060 std::set<std::pair<int, int>> m_seen_mother_keys;
0061
0062 PHG4TruthInfoContainer *truthinfo{nullptr};
0063 PHHepMCGenEventMap *genevtmap{nullptr};
0064 TruthNeutralMesonContainer *_container{nullptr};
0065
0066 std::unordered_map<int, PHG4Particle *> g4_by_barcode;
0067 std::unordered_map<int, PHG4Particle *> g4_by_id;
0068 std::unordered_map<int, std::vector<PHG4Particle *>> g4_children;
0069 std::map<int, std::pair<HepMC::GenParticle *, int>> hepmc_by_barcode;
0070 std::unordered_set<int> m_seen_barcodes;
0071 };
0072
0073 #endif