Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackResiduals.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrackResiduals.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef TRACKRESIDUALS_H
4 #define TRACKRESIDUALS_H
5 
6 #include <fun4all/SubsysReco.h>
7 
8 #include <TFile.h>
9 #include <TH1.h>
10 #include <TTree.h>
11 #include <string>
12 
13 #include <trackbase/ActsGeometry.h>
15 #include <trackbase/TrkrDefs.h>
16 
17 #include <cmath>
18 #include <iostream>
19 #include <limits>
20 
21 class TrkrCluster;
22 class PHCompositeNode;
23 class ActsGeometry;
24 class SvtxTrack;
29 class TrackResiduals : public SubsysReco
30 {
31  public:
32  TrackResiduals(const std::string &name = "TrackResiduals");
33 
34  ~TrackResiduals() override;
35 
36  int Init(PHCompositeNode *topNode) override;
37  int InitRun(PHCompositeNode *topNode) override;
38  int process_event(PHCompositeNode *topNode) override;
39  int End(PHCompositeNode *topNode) override;
41  void alignment(bool align) { m_doAlignment = align; }
44  void clusterTree() { m_doClusters = true; }
45  void hitTree() { m_doHits = true; }
46  void zeroField() { m_zeroField = true; }
47 
48  private:
50  TrkrCluster *cluster, ActsGeometry *geometry);
52  void createBranches();
53  float convertTimeToZ(ActsGeometry *geometry, TrkrDefs::cluskey cluster_key, TrkrCluster *cluster);
59  PHCompositeNode *topNode);
60  void lineFitClusters(std::vector<TrkrDefs::cluskey> &keys, ActsGeometry *geometry,
62 
64  TFile *m_outfile = nullptr;
65  TTree *m_tree = nullptr;
66  TTree *m_clustree = nullptr;
67  TTree *m_hittree = nullptr;
68  bool m_doClusters = false;
69  bool m_doHits = false;
70  bool m_zeroField = false;
71 
73  std::string m_alignmentMapName = "SvtxAlignmentStateMap";
74  std::string m_trackMapName = "SvtxTrackMap";
75 
76  bool m_doAlignment = false;
77 
78  int m_event = 0;
80  uint64_t m_bco = std::numeric_limits<uint64_t>::quiet_NaN();
81  uint64_t m_bcotr = std::numeric_limits<uint64_t>::quiet_NaN();
82  unsigned int m_trackid = std::numeric_limits<unsigned int>::quiet_NaN();
83  unsigned int m_crossing = std::numeric_limits<unsigned int>::quiet_NaN();
84  float m_px = std::numeric_limits<float>::quiet_NaN();
85  float m_py = std::numeric_limits<float>::quiet_NaN();
86  float m_pz = std::numeric_limits<float>::quiet_NaN();
87  float m_pt = std::numeric_limits<float>::quiet_NaN();
88  float m_eta = std::numeric_limits<float>::quiet_NaN();
89  float m_phi = std::numeric_limits<float>::quiet_NaN();
90  float m_deltapt = std::numeric_limits<float>::quiet_NaN();
91  int m_charge = std::numeric_limits<int>::quiet_NaN();
92  float m_quality = std::numeric_limits<float>::quiet_NaN();
93  float m_chisq = std::numeric_limits<float>::quiet_NaN();
94  float m_ndf = std::numeric_limits<float>::quiet_NaN();
95  int m_nhits = std::numeric_limits<int>::quiet_NaN();
96  int m_nmaps = std::numeric_limits<int>::quiet_NaN();
97  int m_nintt = std::numeric_limits<int>::quiet_NaN();
98  int m_ntpc = std::numeric_limits<int>::quiet_NaN();
99  int m_nmms = std::numeric_limits<int>::quiet_NaN();
100  unsigned int m_vertexid = std::numeric_limits<unsigned int>::quiet_NaN();
101  float m_vx = std::numeric_limits<float>::quiet_NaN();
102  float m_vy = std::numeric_limits<float>::quiet_NaN();
103  float m_vz = std::numeric_limits<float>::quiet_NaN();
104  float m_pcax = std::numeric_limits<float>::quiet_NaN();
105  float m_pcay = std::numeric_limits<float>::quiet_NaN();
106  float m_pcaz = std::numeric_limits<float>::quiet_NaN();
107  float m_rzslope = std::numeric_limits<float>::quiet_NaN();
108  float m_rzint = std::numeric_limits<float>::quiet_NaN();
109  float m_xyslope = std::numeric_limits<float>::quiet_NaN();
110  float m_xyint = std::numeric_limits<float>::quiet_NaN();
111 
113  uint32_t m_hitsetkey = std::numeric_limits<uint32_t>::quiet_NaN();
114  float m_hitgx = std::numeric_limits<float>::quiet_NaN();
115  float m_hitgy = std::numeric_limits<float>::quiet_NaN();
116  float m_hitgz = std::numeric_limits<float>::quiet_NaN();
117  int m_hitlayer = std::numeric_limits<int>::quiet_NaN();
118  int m_sector = std::numeric_limits<int>::quiet_NaN();
119  int m_hitpad = std::numeric_limits<int>::quiet_NaN();
120  int m_hittbin = std::numeric_limits<int>::quiet_NaN();
121  int m_col = std::numeric_limits<int>::quiet_NaN();
122  int m_row = std::numeric_limits<int>::quiet_NaN();
123  int m_strip = std::numeric_limits<int>::quiet_NaN();
124 
126  float m_sclusgr = std::numeric_limits<float>::quiet_NaN();
127  float m_sclusphi = std::numeric_limits<float>::quiet_NaN();
128  float m_scluseta = std::numeric_limits<float>::quiet_NaN();
129  float m_adc = std::numeric_limits<float>::quiet_NaN();
130  float m_clusmaxadc = std::numeric_limits<float>::quiet_NaN();
131  int m_phisize = std::numeric_limits<int>::quiet_NaN();
132  int m_zsize = std::numeric_limits<int>::quiet_NaN();
133  float m_scluslx = std::numeric_limits<float>::quiet_NaN();
134  float m_scluslz = std::numeric_limits<float>::quiet_NaN();
135  float m_sclusgx = std::numeric_limits<float>::quiet_NaN();
136  float m_sclusgy = std::numeric_limits<float>::quiet_NaN();
137  float m_sclusgz = std::numeric_limits<float>::quiet_NaN();
138  int m_scluslayer = std::numeric_limits<int>::quiet_NaN();
139  float m_scluselx = std::numeric_limits<float>::quiet_NaN();
140  float m_scluselz = std::numeric_limits<float>::quiet_NaN();
141  int m_clussector = std::numeric_limits<int>::quiet_NaN();
142  int m_side = std::numeric_limits<int>::quiet_NaN();
143  int m_staveid = std::numeric_limits<int>::quiet_NaN();
144  int m_chipid = std::numeric_limits<int>::quiet_NaN();
145  int m_strobeid = std::numeric_limits<int>::quiet_NaN();
146  int m_ladderzid = std::numeric_limits<int>::quiet_NaN();
147  int m_ladderphiid = std::numeric_limits<int>::quiet_NaN();
148  int m_timebucket = std::numeric_limits<int>::quiet_NaN();
149  int m_segtype = std::numeric_limits<int>::quiet_NaN();
150  int m_tileid = std::numeric_limits<int>::quiet_NaN();
151 
153  std::vector<float> m_cluslx;
154  std::vector<float> m_cluslz;
155  std::vector<float> m_cluselx;
156  std::vector<float> m_cluselz;
157  std::vector<float> m_clusgx;
158  std::vector<float> m_clusgy;
159  std::vector<float> m_clusgz;
160  std::vector<int> m_cluslayer;
161  std::vector<int> m_clussize;
162  std::vector<int> m_clusedge;
163  std::vector<int> m_clusoverlap;
164  std::vector<uint32_t> m_clushitsetkey;
165  std::vector<uint64_t> m_cluskeys;
166  std::vector<float> m_idealsurfcenterx;
167  std::vector<float> m_idealsurfcentery;
168  std::vector<float> m_idealsurfcenterz;
169  std::vector<float> m_idealsurfnormx;
170  std::vector<float> m_idealsurfnormy;
171  std::vector<float> m_idealsurfnormz;
172  std::vector<float> m_missurfcenterx;
173  std::vector<float> m_missurfcentery;
174  std::vector<float> m_missurfcenterz;
175  std::vector<float> m_missurfnormx;
176  std::vector<float> m_missurfnormy;
177  std::vector<float> m_missurfnormz;
178  std::vector<float> m_clusgxideal;
179  std::vector<float> m_clusgyideal;
180  std::vector<float> m_clusgzideal;
181  std::vector<float> m_idealsurfalpha;
182  std::vector<float> m_idealsurfbeta;
183  std::vector<float> m_idealsurfgamma;
184  std::vector<float> m_missurfalpha;
185  std::vector<float> m_missurfbeta;
186  std::vector<float> m_missurfgamma;
187 
189  std::vector<float> m_statelx;
190  std::vector<float> m_statelz;
191  std::vector<float> m_stateelx;
192  std::vector<float> m_stateelz;
193  std::vector<float> m_stategx;
194  std::vector<float> m_stategy;
195  std::vector<float> m_stategz;
196  std::vector<float> m_statepx;
197  std::vector<float> m_statepy;
198  std::vector<float> m_statepz;
199  std::vector<float> m_statepl;
200 
201  std::vector<float> m_statelxglobderivdx;
202  std::vector<float> m_statelxglobderivdy;
203  std::vector<float> m_statelxglobderivdz;
204  std::vector<float> m_statelxglobderivdalpha;
205  std::vector<float> m_statelxglobderivdbeta;
206  std::vector<float> m_statelxglobderivdgamma;
207 
208  std::vector<float> m_statelxlocderivd0;
209  std::vector<float> m_statelxlocderivz0;
210  std::vector<float> m_statelxlocderivphi;
211  std::vector<float> m_statelxlocderivtheta;
212  std::vector<float> m_statelxlocderivqop;
213 
214  std::vector<float> m_statelzglobderivdx;
215  std::vector<float> m_statelzglobderivdy;
216  std::vector<float> m_statelzglobderivdz;
217  std::vector<float> m_statelzglobderivdalpha;
218  std::vector<float> m_statelzglobderivdbeta;
219  std::vector<float> m_statelzglobderivdgamma;
220 
221  std::vector<float> m_statelzlocderivd0;
222  std::vector<float> m_statelzlocderivz0;
223  std::vector<float> m_statelzlocderivphi;
224  std::vector<float> m_statelzlocderivtheta;
225  std::vector<float> m_statelzlocderivqop;
226 };
227 
228 #endif // TRACKRESIDUALS_H