ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
KFParticle_Tools.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file KFParticle_Tools.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_KFPARTICLETOOLS_H
23 #define KFPARTICLESPHENIX_KFPARTICLETOOLS_H
24 
25 #include "KFParticle_MVA.h"
27 
28 #include <KFParticle.h>
29 
30 #include <map>
31 #include <vector>
32 
33 class PHCompositeNode;
34 
35 class SvtxVertexMap;
36 class SvtxTrackMap;
37 class SvtxVertex;
38 class SvtxTrack;
39 
41 {
42  public:
44 
45  virtual ~KFParticle_Tools() {}
46 
47  KFParticle makeVertex(PHCompositeNode *topNode);
48 
49  std::vector<KFParticle> makeAllPrimaryVertices(PHCompositeNode *topNode, std::string vertexMapName);
50 
51  KFParticle makeParticle(PHCompositeNode *topNode);
52 
53  std::vector<KFParticle> makeAllDaughterParticles(PHCompositeNode *topNode);
54 
55  int getTracksFromVertex(PHCompositeNode *topNode, KFParticle vertex, std::string vertexMapName);
56 
57  /*const*/ bool isGoodTrack(KFParticle particle, const std::vector<KFParticle> primaryVertices);
58 
59  int calcMinIP(KFParticle track, std::vector<KFParticle> PVs, float& minimumIP, float& minimumIPchi2);
60 
61  std::vector<int> findAllGoodTracks(std::vector<KFParticle> daughterParticles, std::vector<KFParticle> primaryVertices);
62 
63  std::vector<std::vector<int>> findTwoProngs(std::vector<KFParticle> daughterParticles, std::vector<int> goodTrackIndex, int nTracks);
64 
65  std::vector<std::vector<int>> findNProngs(std::vector<KFParticle> daughterParticles,
66  std::vector<int> goodTrackIndex,
67  std::vector<std::vector<int>> goodTracksThatMeet,
68  int nRequiredTracks, unsigned int nProngs);
69 
70  std::vector<std::vector<int>> appendTracksToIntermediates(KFParticle intermediateResonances[], std::vector<KFParticle> daughterParticles, std::vector<int> goodTrackIndex, int num_remaining_tracks);
71 
73  float eventDIRA(KFParticle particle, KFParticle vertex);
74 
75  float flightDistanceChi2(KFParticle particle, KFParticle vertex);
76 
77  std::tuple<KFParticle, bool> buildMother(KFParticle vDaughters[], std::string daughterOrder[], bool isIntermediate, int intermediateNumber, int nTracks, bool constrainMass, float required_vertexID);
78 
79  void constrainToVertex(KFParticle &particle, bool &goodCandidate, KFParticle &vertex);
80 
81  std::tuple<KFParticle, bool> getCombination(KFParticle vDaughters[], std::string daughterOrder[], KFParticle vertex,
82  bool constrain_to_vertex, bool isIntermediate, int intermediateNumber, int nTracks, bool constrainMass, float required_vertexID);
83 
84  std::vector<std::vector<std::string>> findUniqueDaughterCombinations(int start, int end);
85 
86  double calculateEllipsoidRadius(int posOrNeg, double sigma_ii, double sigma_jj, double sigma_ij);
87 
88  float calculateEllipsoidVolume(KFParticle particle);
89 
90  float calculateJT(KFParticle mother, KFParticle daughter);
91 
92  bool isInRange(float min, float value, float max);
93 
94  void identify(KFParticle particle);
95 
96  protected:
97  std::string m_mother_name_Tools;
100  std::vector<std::string> m_daughter_name;
101  std::vector<int> m_daughter_charge;
102  int m_num_tracks = -1;
103 
105  std::vector<std::string> m_intermediate_name;
106  std::vector<int> m_intermediate_charge;
107  std::vector<std::pair<float, float>> m_intermediate_mass_range;
108  std::vector<float> m_intermediate_min_pt;
109  std::vector<float> m_intermediate_min_dira;
110  std::vector<float> m_intermediate_min_fdchi2;
111  std::vector<float> m_intermediate_min_ip;
112  std::vector<float> m_intermediate_max_ip;
113  std::vector<float> m_intermediate_min_ipchi2;
114  std::vector<float> m_intermediate_max_ipchi2;
115 
116  float m_min_mass = -1;
117 
118  float m_max_mass = -1;
119 
120  float m_min_decayTime = -1;
121 
123 
124  float m_min_decayLength = -1;
125 
127 
128  float m_track_pt = -1;
129 
131 
132  float m_track_ip = -1;
133 
134  float m_track_ipchi2 = -1;
135 
137 
139 
141 
142  float m_fdchi2 = -1;
143 
144  float m_dira_min = -1;
145 
146  float m_dira_max = 1;
147 
148  float m_mother_pt = -1;
149 
151 
152  float m_mva_cut_value = -1;
153 
155 
156  bool m_allowZeroMassTracks = false;
157 
158  std::string m_vtx_map_node_name;
159  std::string m_trk_map_node_name;
163  SvtxTrack *m_dst_track = nullptr;
164 
165  private:
166  void removeDuplicates(std::vector<double> &v);
167  void removeDuplicates(std::vector<int> &v);
168  void removeDuplicates(std::vector<std::vector<int>> &v);
169  void removeDuplicates(std::vector<std::vector<std::string>> &v);
170 
171 };
172 
173 #endif //KFPARTICLESPHENIX_KFPARTICLETOOLS_H