File indexing completed on 2025-12-17 09:21:24
0001
0002
0003 #ifndef QA_SIMULATIONMODULES_QAG4SIMULATIONTRUTHDECAY_H
0004 #define QA_SIMULATIONMODULES_QAG4SIMULATIONTRUTHDECAY_H
0005
0006 #include <fun4all/SubsysReco.h>
0007
0008 #include <string>
0009 #include <vector>
0010
0011 class DecayFinderContainerBase;
0012 class PHCompositeNode;
0013 class PHG4TruthInfoContainer;
0014 class PHG4Particle;
0015 class PHG4VtxPoint;
0016 class TFile;
0017 class TTree;
0018
0019 class QAG4SimulationTruthDecay : public SubsysReco
0020 {
0021 public:
0022 QAG4SimulationTruthDecay(const std::string &name = "QAG4SimulationTruthDecay");
0023
0024 virtual ~QAG4SimulationTruthDecay() = default;
0025
0026
0027
0028
0029
0030
0031 int Init(PHCompositeNode *topNode) override;
0032
0033
0034
0035
0036 int process_event(PHCompositeNode *topNode) override;
0037
0038 std::string get_histo_prefix();
0039
0040
0041 int End(PHCompositeNode *topNode) override;
0042
0043 void setMotherPDG(int PDGID) { m_decay_pdg_id = PDGID; }
0044
0045 void setMotherPDGRange(int min, int max)
0046 {
0047 m_mother_PDG_ID_min = min;
0048 m_mother_PDG_ID_max = max;
0049 };
0050 void setDaughterPDGRange(int min, int max)
0051 {
0052 m_daughter_PDG_ID_min = min;
0053 m_daughter_PDG_ID_max = max;
0054 };
0055
0056 void setMinPT(float value) { m_pt_min = value; }
0057
0058 void setEtaRange(float min, float max)
0059 {
0060 m_eta_min = min;
0061 m_eta_max = max;
0062 }
0063
0064 void setNBinsMass(int nBins) { m_mass_nBins = nBins; }
0065 void setMassRange(float min, float max)
0066 {
0067 m_mass_min = min;
0068 m_mass_max = max;
0069 }
0070
0071 void setNBinsDecayLength(int nBins) { m_decayLength_nBins = nBins; }
0072 void setDecayLengthRange(float min, float max)
0073 {
0074 m_decayLength_min = min;
0075 m_decayLength_max = max;
0076 }
0077
0078 void setNBinsDecayTime(int nBins) { m_decayTime_nBins = nBins; }
0079 void setDecayTimeRange(float min, float max)
0080 {
0081 m_decayTime_min = min;
0082 m_decayTime_max = max;
0083 }
0084
0085 void setDFNodeName(const std::string &name) { m_df_module_name = name; }
0086 void setOutputName(const std::string &name) { m_outfile_name = name; }
0087 void writeTuple(bool write) { m_write_nTuple = write; }
0088
0089 private:
0090 typedef std::vector<std::pair<std::pair<int, int>, int>> Decay;
0091
0092 unsigned int m_nTracks;
0093 float m_pt_min;
0094 float m_eta_min;
0095 float m_eta_max;
0096 int m_decay_pdg_id;
0097
0098 PHG4TruthInfoContainer *m_truth_info;
0099 PHG4Particle *m_g4particle;
0100 std::string m_df_module_name;
0101 std::string m_outfile_name;
0102 TFile *m_outfile;
0103 TTree *m_tree;
0104 bool m_write_nTuple;
0105 bool m_write_QAHists;
0106 DecayFinderContainerBase *m_decayMap = nullptr;
0107
0108 void initializeBranches();
0109 void getMotherPDG(PHCompositeNode *topNode);
0110 std::vector<int> getDecayFinderMothers(PHCompositeNode *topNode);
0111 bool isInRange(float min, float value, float max);
0112 void resetValues();
0113
0114 int m_mother_PDG_ID_min = -421;
0115 int m_mother_PDG_ID_max = 421;
0116 int m_daughter_PDG_ID_min = -321;
0117 int m_daughter_PDG_ID_max = 321;
0118
0119 int m_mass_nBins = 100;
0120 float m_mass_min = 0;
0121 float m_mass_max = 2;
0122
0123 int m_decayLength_nBins = 100;
0124 float m_decayLength_min = 0;
0125 float m_decayLength_max = 1;
0126
0127 int m_decayTime_nBins = 100;
0128 float m_decayTime_min = 0;
0129 float m_decayTime_max = 0.1;
0130
0131 static const int max_tracks = 20;
0132 unsigned int m_event_number = 0;
0133 float m_mother_mass = -99;
0134 float m_daughter_sum_mass = 0;
0135 float m_mother_decayLength = -99;
0136 float m_mother_decayTime = -99;
0137 int m_mother_pdg_id = -99;
0138 float m_mother_px = 0;
0139 float m_mother_py = 0;
0140 float m_mother_pz = 0;
0141 float m_mother_pE = 0;
0142 float m_mother_pT = 0;
0143 float m_mother_eta = 0;
0144 int m_mother_barcode = -99;
0145 int m_track_pdg_id[max_tracks] = {0};
0146 float m_track_px[max_tracks] = {0};
0147 float m_track_py[max_tracks] = {0};
0148 float m_track_pz[max_tracks] = {0};
0149 float m_track_pE[max_tracks] = {0};
0150 float m_track_pT[max_tracks] = {0};
0151 float m_track_eta[max_tracks] = {0};
0152 float m_track_mass[max_tracks] = {0};
0153 int m_track_mother_barcode[max_tracks] = {0};
0154 float m_delta_px = 0;
0155 float m_delta_py = 0;
0156 float m_delta_pz = 0;
0157 float m_delta_pE = 0;
0158 bool m_accept_px_1percent = false;
0159 bool m_accept_py_1percent = false;
0160 bool m_accept_pz_1percent = false;
0161 bool m_accept_pE_1percent = false;
0162 bool m_accept_px_5percent = false;
0163 bool m_accept_py_5percent = false;
0164 bool m_accept_pz_5percent = false;
0165 bool m_accept_pE_5percent = false;
0166 bool m_accept_px_15percent = false;
0167 bool m_accept_py_15percent = false;
0168 bool m_accept_pz_15percent = false;
0169 bool m_accept_pE_15percent = false;
0170 bool m_accept_eta = true;
0171 bool m_accept_pT = true;
0172 };
0173
0174 #endif