EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHTpcResiduals.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHTpcResiduals.h
1 #ifndef TRACKRECO_PHTPCRESIDUALS_H
2 #define TRACKRECO_PHTPCRESIDUALS_H
3 
4 #include <fun4all/SubsysReco.h>
5 #include <trackbase/TrkrDefs.h>
6 
9 
13 
16 
17 class PHCompositeNode;
18 class SvtxTrack;
19 class SvtxTrackMap;
21 class TrkrCluster;
23 
24 namespace ActsExamples
25 {
26  class TrkrClusterSourceLink;
27 }
28 
29 #include <memory>
30 class TFile;
31 class TH1;
32 class TH2;
33 class TTree;
34 
41 class PHTpcResiduals : public SubsysReco
42 {
43 
44  public:
45 
46  PHTpcResiduals(const std::string &name = "PHTpcResiduals");
47  ~PHTpcResiduals() override = default;
48 
49  int Init(PHCompositeNode *topNode) override;
50  int InitRun(PHCompositeNode *topNode) override;
51  int process_event(PHCompositeNode *topNode) override;
52  int End(PHCompositeNode *topNode) override;
53 
55  void setMaxTrackAlpha(float maxTAlpha)
56  { m_maxTAlpha = maxTAlpha;}
57  void setMaxTrackBeta(float maxTBeta)
58  { m_maxTBeta = maxTBeta; }
59  void setMaxTrackResidualDrphi(float maxResidualDrphi)
60  { m_maxResidualDrphi = maxResidualDrphi;}
61 
62  void setMaxTrackResidualDz(float maxResidualDz)
63  { m_maxResidualDz = maxResidualDz; }
64 
65  void setGridDimensions(const int phiBins, const int rBins, const int zBins);
66 
69 
72 
74  void setOutputfile(const std::string &outputfile) {m_outputfile = outputfile;}
75 
77  void setUseMicromegas( bool value )
78  { m_useMicromegas = value; }
79 
80  private:
81 
83  using BoundTrackParamPtr =
84  std::unique_ptr<const Acts::BoundTrackParameters>;
85 
87  using BoundTrackParamPtrPair = std::pair<float,BoundTrackParamPtr>;
88 
91 
92  int getNodes(PHCompositeNode *topNode);
93  int createNodes(PHCompositeNode *topNode);
94 
95  int processTracks(PHCompositeNode *topNode);
96 
97  bool checkTrack(SvtxTrack* track);
98  void processTrack(SvtxTrack* track);
99 
101  void addTrackState( SvtxTrack* track, float pathlength, const Acts::BoundTrackParameters& params );
102 
105  void calculateTpcResiduals(const Acts::BoundTrackParameters& params, TrkrCluster* cluster);
106 
114  const Acts::BoundTrackParameters& params,
115  const SourceLink& sl);
116 
118  int getCell(const Acts::Vector3D& loc);
119 
120  void makeHistograms();
125 
129 
136 
137  float m_maxTAlpha = 0.6;
138  float m_maxResidualDrphi = 0.5; // cm
139  float m_maxTBeta = 1.5;
140  float m_maxResidualDz = 0.5; // cm
141 
142  static constexpr float m_phiMin = 0;
143  static constexpr float m_phiMax = 2. * M_PI;
144 
145  static constexpr float m_rMin = 20; // cm
146  static constexpr float m_rMax = 78; // cm
147 
148  static constexpr int m_minClusCount = 10;
149 
151  static constexpr unsigned int m_nLayersTpc = 48;
152  static constexpr float m_zMin = -105.5; // cm
153  static constexpr float m_zMax = 105.5; // cm
154 
156  std::unique_ptr<TpcSpaceChargeMatrixContainer> m_matrix_container;
157 
158  // TODO: check if needed
159  int m_event = 0;
160 
162  int m_nBadProps = 0;
163 
165  bool m_useMicromegas = true;
166 
167  std::string m_outputfile = "TpcSpaceChargeMatrices.root";
168 
170  bool m_savehistograms = false;
171  TH2 *h_rphiResid = nullptr;
172  TH2 *h_zResid = nullptr;
173  TH2 *h_etaResidLayer = nullptr;
174  TH2 *h_zResidLayer = nullptr;
175  TH2 *h_etaResid = nullptr;
176  TH1 *h_index = nullptr;
177  TH2 *h_alpha = nullptr;
178  TH2 *h_beta = nullptr;
179  TTree *residTup = nullptr;
180 
182  TH2 *h_deltarphi_layer = nullptr;
183 
185  TH2 *h_deltaz_layer = nullptr;
186 
187  std::string m_histogramfilename = "PHTpcResiduals.root";
188  std::unique_ptr<TFile> m_histogramfile = nullptr;
189 
191  double tanAlpha = 0;
192  double tanBeta = 0;
193  double drphi = 0;
194  double dz = 0;
195  double clusR = 0;
196  double clusPhi = 0;
197  double clusZ = 0;
198  double statePhi = 0;
199  double stateZ = 0;
200  double stateRPhiErr = 0;
201  double stateZErr = 0;
202  double clusRPhiErr = 0;
203  double clusZErr = 0;
204  double stateR = 0;
206 
207 };
208 
209 #endif
210