EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
KFParticle_sPHENIX.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file KFParticle_sPHENIX.h
1 /*
2  * This file is part of KFParticle package
3  * Copyright (C) 2007-2019 FIAS Frankfurt Institute for Advanced Studies
4  * 2007-2019 Goethe University of Frankfurt
5  * 2007-2019 Ivan Kisel <I.Kisel@compeng.uni-frankfurt.de>
6  * 2007-2019 Maksym Zyzak
7  *
8  * KFParticle is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * KFParticle is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef KFPARTICLESPHENIX_KFPARTICLESPHENIX_H
23 #define KFPARTICLESPHENIX_KFPARTICLESPHENIX_H
24 
26 #include "KFParticle_nTuple.h"
27 #include "KFParticle_DST.h"
28 
29 //sPHENIX stuff
30 #include <fun4all/SubsysReco.h>
31 
32 //KFParticle stuff
33 #include <KFParticle.h>
34 
35 #include <map>
36 #include <string>
37 
38 class TFile;
39 
41 {
42  public:
44 
45  explicit KFParticle_sPHENIX(const std::string &name);
46 
47  virtual ~KFParticle_sPHENIX(){}
48 
49  int Init(PHCompositeNode *topNode);
50 
51  int process_event(PHCompositeNode *topNode);
52 
53  int End(PHCompositeNode *topNode);
54 
60  void printParticles(KFParticle motherParticle,
61  KFParticle chosenVertex,
62  std::vector<KFParticle> daughterParticles,
63  std::vector<KFParticle> intermediateParticles,
64  int numPVs, int numTracks);
65 
67 
68  bool findParticle(std::string particle);
69 
71 
72  void setDecayDescriptor(const std::string &decayDescriptor) { m_decayDescriptor = decayDescriptor; }
73 
74  static const int max_particles = 99;
75 
76  void setMotherName(const std::string& mother_name)
77  {
78  m_mother_name = mother_name;
79  m_mother_name_Tools = mother_name;
80  }
81 
82  void useIntermediateName(bool use_intermediate_name) { m_use_intermediate_name = use_intermediate_name; }
83 
84  void hasIntermediateStates(bool has_intermediates)
85  {
86  m_has_intermediates = has_intermediates;
87  m_has_intermediates_nTuple = has_intermediates;
88  m_has_intermediates_sPHENIX = has_intermediates;
89  m_has_intermediates_DST = has_intermediates;
90  }
91 
92  void setNumberOfTracks(int num_tracks)
93  {
94  m_num_tracks = num_tracks;
95  m_num_tracks_nTuple = num_tracks;
96  }
97 
98  void setNumberTracksFromIntermeditateState(const std::vector<int> & num_tracks)
99  {
100  for (unsigned int i = 0; i < num_tracks.size(); ++i)
101  {
102  m_num_tracks_from_intermediate.push_back(num_tracks[i]);
103  m_num_tracks_from_intermediate_nTuple.push_back(num_tracks[i]);
104  }
105  }
106 
107  void setNumberOfIntermediateStates(int n_intermediates)
108  {
109  m_num_intermediate_states = n_intermediates;
110  m_num_intermediate_states_nTuple = n_intermediates;
111  }
112 
113  void getChargeConjugate(bool get_charge_conjugate)
114  {
115  m_get_charge_conjugate_nTuple = get_charge_conjugate;
116  m_get_charge_conjugate = get_charge_conjugate;
117  }
118 
119  void setDaughters(std::vector<std::pair<std::string, int>> daughter_list)
120  {
121  for (unsigned int i = 0; i < daughter_list.size(); ++i)
122  {
123  m_daughter_name.push_back(daughter_list[i].first);
124  m_daughter_charge.push_back(daughter_list[i].second);
125  }
126  }
127 
128  void setIntermediateStates(std::vector<std::pair<std::string, int>> intermediate_list)
129  {
130  for (unsigned int i = 0; i < intermediate_list.size(); ++i)
131  {
132  m_intermediate_name_ntuple.push_back(intermediate_list[i].first);
133  m_intermediate_name.push_back(intermediate_list[i].first);
134  m_intermediate_charge.push_back(intermediate_list[i].second);
135  }
136  }
137 
138  void setMinimumMass(float min_mass) { m_min_mass = min_mass; }
139 
140  void setMaximumMass(float max_mass) { m_max_mass = max_mass; }
141 
142  void setDecayTimeRange(float min_decayTime, float max_decayTime)
143  {
144  m_min_decayTime = min_decayTime;
145  m_max_decayTime = max_decayTime;
146  }
147 
148  void setDecayLengthRange(float min_decayLength, float max_decayLength)
149  {
150  m_min_decayLength = min_decayLength;
151  m_max_decayLength = max_decayLength;
152  }
153 
154  void setMinimumTrackPT(float pt) { m_track_pt = pt; }
155 
156  void setMaximumTrackPTchi2(float ptchi2) { m_track_ptchi2 = ptchi2; }
157 
158  void setMinimumTrackIP(float ip) { m_track_ip = ip; }
159 
160  void setMinimumTrackIPchi2(float ipchi2) { m_track_ipchi2 = ipchi2; }
161 
162  void setMaximumTrackchi2nDOF(float trackchi2ndof) { m_track_chi2ndof = trackchi2ndof; }
163 
164  void setMaximumDaughterDCA(float dca) { m_comb_DCA = dca; }
165 
166  void setMaximumVertexchi2nDOF(float vertexchi2nDOF) { m_vertex_chi2ndof = vertexchi2nDOF; }
167 
168  void setFlightDistancechi2(float fdchi2) { m_fdchi2 = fdchi2; }
169 
170  void setMinDIRA(float dira_min) { m_dira_min = dira_min; }
171 
172  void setMaxDIRA(float dira_max) { m_dira_max = dira_max; }
173 
174  void setMotherPT(float mother_pt) { m_mother_pt = mother_pt; }
175 
176  void setMotherIPchi2(float mother_ipchi2) { m_mother_ipchi2 = mother_ipchi2; }
177 
178  void constrainToPrimaryVertex(bool constrain_to_vertex)
179  {
180  m_constrain_to_vertex = constrain_to_vertex;
181  m_constrain_to_vertex_nTuple = constrain_to_vertex;
182  m_constrain_to_vertex_sPHENIX = constrain_to_vertex;
183  }
184 
185  void useFakePrimaryVertex(bool use_fake) { m_use_fake_pv = use_fake; }
186 
187  void allowZeroMassTracks(bool allow) { m_allowZeroMassTracks = allow; }
188 
189  void constrainIntermediateMasses(bool constrain_int_mass) { m_constrain_int_mass = constrain_int_mass; }
190 
191  void setIntermediateMassRange(std::vector<std::pair<float, float>> intermediate_mass_range)
192  {
193  for (unsigned int i = 0; i < intermediate_mass_range.size(); ++i) m_intermediate_mass_range.push_back(intermediate_mass_range[i]);
194  }
195 
196  void setIntermediateMinPT(std::vector<float> intermediate_min_pt)
197  {
198  m_intermediate_min_pt = intermediate_min_pt;
199  }
200 
201  void setIntermediateMinIP(std::vector<float> intermediate_min_IP)
202  {
203  for (unsigned int i = 0; i < intermediate_min_IP.size(); ++i) m_intermediate_min_ip.push_back(intermediate_min_IP[i]);
204  }
205 
206  void setIntermediateIPRange(std::vector<std::pair<float, float>> intermediate_IP_range)
207  {
208  for (unsigned int i = 0; i < intermediate_IP_range.size(); ++i)
209  {
210  m_intermediate_min_ip.push_back(intermediate_IP_range[i].first);
211  m_intermediate_max_ip.push_back(intermediate_IP_range[i].second);
212  }
213  }
214 
215  void setIntermediateMinIPchi2(std::vector<float> intermediate_min_IPchi2)
216  {
217  for (unsigned int i = 0; i < intermediate_min_IPchi2.size(); ++i) m_intermediate_min_ipchi2.push_back(intermediate_min_IPchi2[i]);
218  }
219 
220  void setIntermediateIPchi2Range(std::vector<std::pair<float, float>> intermediate_IPchi2_range)
221  {
222  for (unsigned int i = 0; i < intermediate_IPchi2_range.size(); ++i)
223  {
224  m_intermediate_min_ipchi2.push_back(intermediate_IPchi2_range[i].first);
225  m_intermediate_max_ipchi2.push_back(intermediate_IPchi2_range[i].second);
226  }
227  }
228 
229  void setIntermediateMinDIRA(std::vector<float> intermediate_min_DIRA)
230  {
231  for (unsigned int i = 0; i < intermediate_min_DIRA.size(); ++i) m_intermediate_min_dira.push_back(intermediate_min_DIRA[i]);
232  }
233 
234  void setIntermediateMinFDchi2(std::vector<float> intermediate_min_FDchi2)
235  {
236  for (unsigned int i = 0; i < intermediate_min_FDchi2.size(); ++i) m_intermediate_min_fdchi2.push_back(intermediate_min_FDchi2[i]);
237  }
238 
239  void useMVA(bool require_mva) { m_require_mva = require_mva; }
240 
241  void setNumMVAPars(unsigned int nPars) { m_nPars = nPars; }
242 
243  void setMVAVarList(std::vector<std::string> mva_variable_list)
244  {
245  for (unsigned int i = 0; i < mva_variable_list.size(); ++i) m_mva_variable_list.push_back(mva_variable_list[i]);
246  }
247 
248  void setMVAType(const std::string& mva_type) { m_mva_type = mva_type; }
249 
250  void setMVAWeightsPath(const std::string& mva_weights_path) { m_mva_path = mva_weights_path; }
251 
252  void setMVACutValue(float cut_value) { m_mva_cut_value = cut_value; }
253 
254  void saveDST(bool save) { m_save_dst = save; }
255 
256  void saveTrackContainer(bool save) { m_write_track_container = save; }
257 
259 
260  void setContainerName(const std::string& name) { m_container_name = name; }
261 
262  void saveOutput(bool save) { m_save_output = save; }
263 
264  void setOutputName(const std::string& name) { m_outfile_name = name; }
265 
266  void doTruthMatching(bool truth) { m_truth_matching = truth; }
267 
268  void getDetectorInfo(bool detinfo) { m_detector_info = detinfo; }
269 
270  void getCaloInfo(bool caloinfo) { m_calo_info = caloinfo; }
271 
272  void getAllPVInfo(bool pvinfo) { m_get_all_PVs = pvinfo; }
273 
275  void setVertexMapNodeName(const std::string& vtx_map_node_name) { m_vtx_map_node_name = m_vtx_map_node_name_nTuple = vtx_map_node_name; }
276 
278  void setTrackMapNodeName(const std::string& trk_map_node_name) { m_trk_map_node_name = m_trk_map_node_name_nTuple = trk_map_node_name; }
279 
280  private:
286  std::string m_outfile_name;
287  TFile *m_outfile;
288  std::string m_decayDescriptor;
289 };
290 
291 #endif //KFPARTICLESPHENIX_KFPARTICLESPHENIX_H