File indexing completed on 2025-08-05 08:16:54
0001 #ifndef TRACKRECO_PHTPCRESIDUALS_H
0002 #define TRACKRECO_PHTPCRESIDUALS_H
0003
0004 #include <fun4all/SubsysReco.h>
0005 #include <tpc/TpcGlobalPositionWrapper.h>
0006 #include <trackbase/ActsGeometry.h>
0007 #include <trackbase/TrkrDefs.h>
0008 #include <trackbase_historic/ActsTransformations.h>
0009
0010 #include <Acts/EventData/TrackParameters.hpp>
0011 #include <Acts/Utilities/Result.hpp>
0012
0013 #include <memory>
0014 #include <optional>
0015
0016 class PHCompositeNode;
0017 class SvtxTrack;
0018 class SvtxTrackMap;
0019 class TpcSpaceChargeMatrixContainer;
0020 class TrkrCluster;
0021 class TrkrClusterContainer;
0022
0023 class TFile;
0024 class TH1;
0025 class TH2;
0026 class TTree;
0027
0028
0029
0030
0031
0032
0033
0034 class PHTpcResiduals : public SubsysReco
0035 {
0036 public:
0037 PHTpcResiduals(const std::string &name = "PHTpcResiduals");
0038 ~PHTpcResiduals() override = default;
0039
0040 int Init(PHCompositeNode *topNode) override;
0041 int InitRun(PHCompositeNode *topNode) override;
0042 int process_event(PHCompositeNode *topNode) override;
0043 int End(PHCompositeNode *topNode) override;
0044
0045
0046
0047 void setMaxTrackAlpha(float maxTAlpha)
0048 {
0049 m_maxTAlpha = maxTAlpha;
0050 }
0051
0052 void setMaxTrackBeta(float maxTBeta)
0053 {
0054 m_maxTBeta = maxTBeta;
0055 }
0056
0057 void setMaxTrackResidualDrphi(float maxResidualDrphi)
0058 {
0059 m_maxResidualDrphi = maxResidualDrphi;
0060 }
0061
0062 void setMaxTrackResidualDz(float maxResidualDz)
0063 {
0064 m_maxResidualDz = maxResidualDz;
0065 }
0066
0067
0068
0069 void setMinPt(double value)
0070 {
0071 m_minPt = value;
0072 }
0073
0074
0075 void setGridDimensions(const int phiBins, const int rBins, const int zBins);
0076
0077
0078 void setSavehistograms(bool) {}
0079
0080
0081 void setHistogramOutputfile(const std::string &) {}
0082
0083
0084 void setOutputfile(const std::string &outputfile)
0085 {
0086 m_outputfile = outputfile;
0087 }
0088
0089
0090 void setUseMicromegas(bool value)
0091 {
0092 m_useMicromegas = value;
0093 }
0094
0095 private:
0096 using BoundTrackParam =
0097 const Acts::BoundTrackParameters;
0098
0099
0100 using BoundTrackParamPair = std::pair<float, BoundTrackParam>;
0101
0102 int getNodes(PHCompositeNode *topNode);
0103 int createNodes(PHCompositeNode *topNode);
0104
0105 int processTracks(PHCompositeNode *topNode);
0106
0107 bool checkTrack(SvtxTrack *track) const;
0108 void processTrack(SvtxTrack *track);
0109
0110
0111 void addTrackState(SvtxTrack *track, TrkrDefs::cluskey key, float pathlength, const Acts::BoundTrackParameters ¶ms);
0112
0113
0114 int getCell(const Acts::Vector3 &loc);
0115
0116
0117 Acts::BoundTrackParameters makeTrackParams(SvtxTrack *) const;
0118
0119
0120 Acts::BoundTrackParameters makeTrackParams(SvtxTrack *, SvtxTrackState *) const;
0121
0122
0123 ActsTransformations m_transformer;
0124
0125
0126
0127 SvtxTrackMap *m_trackMap = nullptr;
0128 ActsGeometry *m_tGeometry = nullptr;
0129 TrkrClusterContainer *m_clusterContainer = nullptr;
0130
0131
0132 TpcGlobalPositionWrapper m_globalPositionWrapper;
0133
0134 float m_maxTAlpha = 0.6;
0135 float m_maxResidualDrphi = 0.5;
0136 float m_maxTBeta = 1.5;
0137 float m_maxResidualDz = 0.5;
0138
0139 static constexpr float m_phiMin = 0;
0140 static constexpr float m_phiMax = 2. * M_PI;
0141
0142 static constexpr float m_rMin = 20;
0143 static constexpr float m_rMax = 78;
0144
0145 static constexpr int m_minClusCount = 10;
0146
0147
0148 static constexpr unsigned int m_nLayersTpc = 48;
0149 static constexpr float m_zMin = -105.5;
0150 static constexpr float m_zMax = 105.5;
0151
0152
0153 std::unique_ptr<TpcSpaceChargeMatrixContainer> m_matrix_container;
0154
0155
0156 int m_event = 0;
0157
0158
0159 bool m_useMicromegas = true;
0160
0161
0162 double m_minPt = 0.5;
0163
0164
0165 std::string m_outputfile = "TpcSpaceChargeMatrices.root";
0166
0167
0168
0169 int m_total_tracks = 0;
0170 int m_accepted_tracks = 0;
0171
0172 int m_total_clusters = 0;
0173 int m_accepted_clusters = 0;
0174
0175 };
0176
0177 #endif