EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHActsSiliconSeeding.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHActsSiliconSeeding.h
1 #ifndef TRACKRECO_PHACTSSILICONSEEDING_H
2 #define TRACKRECO_PHACTSSILICONSEEDING_H
3 
5 
6 #include <fun4all/SubsysReco.h>
7 #include <trackbase/TrkrDefs.h>
9 
13 #include <Acts/Utilities/Units.hpp>
14 
17 
19 
20 #include <boost/bimap.hpp>
21 
22 #include <string>
23 #include <map>
24 #include <TFile.h>
25 #include <TH1.h>
26 #include <TH2.h>
27 
28 class PHCompositeNode;
30 class SvtxTrackMap;
31 class SvtxVertexMap;
32 class TrkrCluster;
36 
38 typedef boost::bimap<TrkrDefs::cluskey, unsigned int> CluskeyBimap;
39 
43 struct SpacePoint {
45  float m_x;
46  float m_y;
47  float m_z;
48  float m_r;
51  float m_varianceZ;
52 
53  TrkrDefs::cluskey Id() const { return m_clusKey; }
54 
56  float x() const { return m_x; }
57  float y() const { return m_y; }
58  float z() const { return m_z; }
59  float r() const { return m_r; }
60 
61 };
62 
64 inline bool operator==(SpacePoint a, SpacePoint b) {
65  return (a.m_clusKey == b.m_clusKey);
66 }
67 
68 using SpacePointPtr = std::unique_ptr<SpacePoint>;
69 using GridSeeds = std::vector<std::vector<Acts::Seed<SpacePoint>>>;
70 
78 {
79  public:
80  PHActsSiliconSeeding(const std::string& name = "PHActsSiliconSeeding");
81  int Init(PHCompositeNode *topNode) override;
82  int InitRun(PHCompositeNode *topNode) override;
83  int process_event(PHCompositeNode *topNode) override;
84  int End(PHCompositeNode *topNode) override;
85 
89 
93 
95  void fieldMapName(const std::string& fieldmap)
97 
102 
103  void rMax(const float rMax)
104  { m_rMax = rMax; }
105  void rMin(const float rMin)
106  { m_rMin = rMin; }
107  void zMax(const float zMax)
108  {m_zMax = zMax; }
109  void zMin(const float zMin)
110  {m_zMin = zMin; }
111  void deltaRMax(const float deltaRMax)
113  void cotThetaMax(const float cotThetaMax)
115  void gridFactor(const float gridFactor)
117 
120  void largeGridSpacing(const bool spacing);
121 
122  void set_track_map_name(const std::string &map_name) { _track_map_name = map_name; }
123  void SetIteration(int iter){_n_iteration = iter;}
124 
125  private:
126 
127  int getNodes(PHCompositeNode *topNode);
128  int createNodes(PHCompositeNode *topNode);
129 
130  GridSeeds runSeeder(std::vector<const SpacePoint*>& spVec);
131 
136 
138  void makeSvtxTracks(GridSeeds& seedVector);
139 
142  const SourceLink& sl);
143 
145  std::vector<const SpacePoint*> getMvtxSpacePoints();
146 
149  int circleFitSeed(std::vector<TrkrCluster*>& clusters,
150  std::vector<Acts::Vector3D>& clusGlobPos,
151  double& x, double& y, double& z,
152  double& px, double& py, double& pz);
153 
154  void circleFitByTaubin(const std::vector<Acts::Vector3D>& globalPositions,
155  double& R, double& X0, double& Y0);
156  void lineFit(const std::vector<Acts::Vector3D>& globPos,
157  double& A, double& B);
158  void findRoot(const double R, const double X0, const double Y0,
159  double& x, double& y);
160  int getCharge(const std::vector<Acts::Vector3D>& globalPos,
161  const double circPhi);
162 
165  std::vector<TrkrDefs::cluskey> findInttMatches(
166  std::vector<Acts::Vector3D>& clusters,
167  const double R,
168  const double X0,
169  const double Y0,
170  const double B,
171  const double m);
172 
173  std::vector<TrkrDefs::cluskey> matchInttClusters(std::vector<Acts::Vector3D>& clusters,
174  const double xProj[],
175  const double yProj[],
176  const double zProj[]);
177  void circleCircleIntersection(const double layerRadius,
178  const double circRadius,
179  const double circX0,
180  const double circY0,
181  double& xplus,
182  double& yplus,
183  double& xminus,
184  double& yminus);
185 
186  void createSvtxTrack(const double x,
187  const double y,
188  const double z,
189  const double px,
190  const double py,
191  const double pz,
192  const int charge,
193  std::vector<TrkrCluster*>& clusters,
194  std::vector<Acts::Vector3D>& clusGlobPos);
195  std::map<const unsigned int, std::pair<std::vector<TrkrCluster*>,std::vector<Acts::Vector3D>>>
196  makePossibleStubs(std::vector<TrkrCluster*>& allClusters,
197  std::vector<Acts::Vector3D>& clusGlobPos);
198 
200 
201  std::map<const unsigned int, std::pair<std::vector<TrkrCluster*>,std::vector<Acts::Vector3D>>>
202  identifyBestSeed(std::map<const unsigned int,
203  std::pair<std::vector<TrkrCluster*>,
204  std::vector<Acts::Vector3D>>>);
205 
206  void createHistograms();
207  void writeHistograms();
208  double normPhi2Pi(const double phi);
209 
216 
220 
223  float m_minSeedPt = 100;
224 
228 
231  float m_rMax = 200.;
232  float m_rMin = 23.;
233  float m_zMax = 300.;
234  float m_zMin = -300.;
235 
238  float m_gridFactor = 2.3809;
239 
241  float m_deltaRMax = 15;
242 
244  float m_cotThetaMax = 2.9;
245 
248  float m_bField = 1.4 / 1000.;
249 
250  std::shared_ptr<Acts::BinFinder<SpacePoint>>
252 
253  int m_event = 0;
254 
256  double m_maxSeedPCA = 2.;
257 
258  const static unsigned int m_nInttLayers = 4;
260  {7.188, 7.732, 9.680,10.262};
261 
263  double m_rPhiSearchWin = 0.1;
264 
266  bool m_useTruthClusters = false;
267 
268  bool m_cleanSeeds = false;
269 
270  int m_nBadUpdates = 0;
272  std::string m_fieldMapName = "";
274  int _n_iteration = 0;
275  std::string _track_map_name = "SvtxSiliconTrackMap";
276 
277  bool m_seedAnalysis = false;
278  TFile *m_file = nullptr;
279  TH2 *h_nInttProj = nullptr;
280  TH1 *h_nMvtxHits = nullptr;
281  TH1 *h_nInttHits = nullptr;
282  TH2 *h_nHits = nullptr;
283  TH1 *h_nSeeds = nullptr;
284  TH1 *h_nActsSeeds = nullptr;
285  TH1 *h_nTotSeeds = nullptr;
286  TH1 *h_nInputMeas = nullptr;
287  TH1 *h_nInputMvtxMeas = nullptr;
288  TH1 *h_nInputInttMeas = nullptr;
289  TH2 *h_hits = nullptr;
290  TH2 *h_zhits = nullptr;
291  TH2 *h_projHits = nullptr;
292  TH2 *h_zprojHits = nullptr;
293  TH2 *h_resids = nullptr;
294 
295 };
296 
297 
298 #endif