File indexing completed on 2025-12-16 09:20:27
0001 #ifndef TPCCALIB_TPCLAMINATIONFITTING_H
0002 #define TPCCALIB_TPCLAMINATIONFITTING_H
0003
0004 #include <tpc/TpcDistortionCorrection.h>
0005 #include <tpc/TpcDistortionCorrectionContainer.h>
0006
0007 #include <trackbase/TrkrClusterContainer.h>
0008 #include <trackbase/TrkrDefs.h>
0009
0010 #include <fun4all/SubsysReco.h>
0011
0012 class PHCompositeNode;
0013
0014 class LaserClusterContainer;
0015 class EventHeader;
0016
0017 class TF1;
0018 class TFile;
0019 class TH1;
0020 class TH2;
0021 class TGraph;
0022 class TNtuple;
0023 class TTree;
0024 class TVector3;
0025
0026 class TpcLaminationFitting : public SubsysReco
0027 {
0028 public:
0029 TpcLaminationFitting(const std::string &name = "TpcLaminationFitting");
0030 ~TpcLaminationFitting() override = default;
0031
0032
0033 void setOutputfile(const std::string &outputfile);
0034
0035 void set_event_sequence(int seq)
0036 {
0037 m_event_sequence = seq;
0038 m_event_index = 100 * seq;
0039 }
0040
0041 void set_QAFileName(const std::string &QAFileName)
0042 {
0043 m_QAFileName = QAFileName;
0044 }
0045
0046 void set_ppMode(bool mode){ ppMode = mode; }
0047
0048 void set_grid_dimensions(int phibins, int rbins);
0049
0050 void set_nLayerCut(unsigned int cut) { m_nLayerCut = cut; }
0051
0052 int InitRun(PHCompositeNode *topNode) override;
0053
0054 int process_event(PHCompositeNode *topNode) override;
0055
0056 int End(PHCompositeNode *topNode) override;
0057
0058 private:
0059 EventHeader *eventHeader{nullptr};
0060
0061 int GetNodes(PHCompositeNode *topNode);
0062
0063 int fitLaminations();
0064 int InterpolatePhiDistortions(TH2 *simPhiDistortion[2]);
0065 void fill_guarding_bins(TpcDistortionCorrectionContainer *dcc);
0066
0067 TpcDistortionCorrection m_distortionCorrection;
0068
0069 LaserClusterContainer *m_correctedCMcluster_map{nullptr};
0070
0071 TpcDistortionCorrectionContainer *m_dcc_in_module_edge{nullptr};
0072 TpcDistortionCorrectionContainer *m_dcc_in_static{nullptr};
0073
0074 TpcDistortionCorrectionContainer *m_dcc_out{nullptr};
0075
0076 std::string m_outputfile{"CMDistortionCorrections.root"};
0077 std::string m_QAFileName{""};
0078
0079 TH2 *m_hLamination[18][2]{{nullptr}};
0080 TF1 *m_fLamination[18][2]{{nullptr}};
0081 double m_laminationCenter[18][2]{{0.0}};
0082 double m_laminationOffset[18][2]{{0.0}};
0083 bool m_laminationGoodFit[18][2]{{false}};
0084 double m_distanceToFit[18][2]{{0.0}};
0085 int m_nBinsFit[18][2]{{0}};
0086
0087 TH2 *phiDistortionLamination[2]{nullptr};
0088 TH2 *scaleFactorMap[2]{nullptr};
0089
0090 unsigned int m_nLayerCut{1};
0091
0092 bool m_useHeader{true};
0093
0094 int m_event_index{0};
0095 int m_event_sequence{0};
0096
0097 double m_nClusters{0};
0098 int m_nEvents{0};
0099 int m_runnumber{};
0100
0101 bool ppMode{false};
0102 double m_ZDC_coincidence{0};
0103
0104
0105
0106 TTree *m_laminationTree{nullptr};
0107 bool m_side{false};
0108 int m_lamIndex{0};
0109 double m_lamPhi{0};
0110 bool m_goodFit{false};
0111 double m_A{0};
0112 double m_B{0};
0113 double m_C{0};
0114 double m_A_err{0};
0115 double m_B_err{0};
0116 double m_C_err{0};
0117 double m_dist{0};
0118 int m_nBins{0};
0119
0120 int m_phibins{24};
0121 static constexpr float m_phiMin{0};
0122 static constexpr float m_phiMax{2. * M_PI};
0123
0124 int m_rbins{12};
0125 static constexpr float m_rMin{20};
0126 static constexpr float m_rMax{80};
0127 };
0128
0129 #endif