File indexing completed on 2026-10-16 08:28:09
0001 #ifndef TPCCALIB_LASERCLUSTERTRUTHMATCHER_H
0002 #define TPCCALIB_LASERCLUSTERTRUTHMATCHER_H
0003
0004 #include <cdbobjects/CDBTTree.h>
0005
0006 #include <tpc/LaserClusterHelper.h>
0007 #include <tpc/TpcDistortionCorrection.h>
0008 #include <tpc/TpcDistortionCorrectionContainer.h>
0009
0010 #include <fun4all/SubsysReco.h>
0011
0012 #include <map>
0013 #include <string>
0014 #include <vector>
0015
0016
0017 class PHCompositeNode;
0018 class LaserClusterContainer;
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 struct TruthRow
0040 {
0041 double R{0.0};
0042 double dphi{0.0};
0043 int nstripes{0};
0044 };
0045
0046 struct TruthRowPattern
0047 {
0048 std::vector<double> stripePhi;
0049 std::vector<int> stripeIPhi;
0050 };
0051
0052 class LaserClusterTruthMatcher : public SubsysReco
0053 {
0054 public:
0055 explicit LaserClusterTruthMatcher(const std::string &name = "LaserClusterTruthMatcher");
0056 ~LaserClusterTruthMatcher() override { delete m_cdbttree; }
0057 LaserClusterTruthMatcher(const LaserClusterTruthMatcher&) = delete;
0058 LaserClusterTruthMatcher& operator=(const LaserClusterTruthMatcher&) = delete;
0059 LaserClusterTruthMatcher(LaserClusterTruthMatcher&&) = delete;
0060 LaserClusterTruthMatcher& operator=(LaserClusterTruthMatcher&&) = delete;
0061
0062 int InitRun(PHCompositeNode *topNode) override;
0063 int process_event(PHCompositeNode *topNode) override;
0064 int End(PHCompositeNode *topNode) override;
0065
0066
0067
0068
0069
0070 void setTruthFile(const std::string &file) { m_truthFile = file; }
0071
0072
0073 void setLaserClusterNodeName(const std::string &name) { m_laserClusterNodeName = name; }
0074 void setLaserClusterNodeNameOut(const std::string &name) { m_laserClusterNodeNameOut = name; }
0075
0076 void set_useGlobal(bool use) { m_useGlobal = use; }
0077
0078 void set_usePHGarfieldDistortions(bool use) { m_usePHGarfieldDistortions = use; }
0079 void set_garfield_cmvoltage(double use) { m_garfield_cmvoltage = use; }
0080 void set_garfield_zerofield(bool use) { m_garfield_zerofield = use; }
0081 void set_garfield_keffside0(double use) { m_garfield_keffside0 = use; m_manual_garfield_keffside0 = true; }
0082 void set_garfield_keffside1(double use) { m_garfield_keffside1 = use; m_manual_garfield_keffside1 = true;}
0083 void set_garfield_stepns(double use) { m_garfield_stepns = use; }
0084
0085 void set_QABase(const std::string &name) { m_QABase = name; }
0086
0087 void set_grid_dimensions(int phibins, int rbins){ m_phibins = phibins; m_rbins = rbins; }
0088 void setDistortionOutputfile(const std::string &outputfile) { m_distortionOutputfile = outputfile; }
0089
0090 private:
0091 int getNodes(PHCompositeNode *topNode);
0092
0093 std::string m_truthFile{"CMStripePattern_full.root"};
0094 std::string m_laserClusterNodeName{"LASER_AGGREGATED_CLUSTER"};
0095 std::string m_laserClusterNodeNameOut{"LASER_AGGREGATED_CLUSTER_MATCHED"};
0096 std::string m_QABase;
0097
0098 LaserClusterContainer *m_laserClusterContainer{nullptr};
0099 CDBTTree *m_cdbttree{nullptr};
0100
0101 std::map<int, TruthRowPattern> m_truthRowPatterns[2];
0102 std::vector<TruthRow> m_truthRows[2];
0103
0104 LaserClusterHelper m_laserClusterHelper;
0105 bool m_useGlobal{true};
0106 bool m_usePHGarfieldDistortions{false};
0107 double m_garfield_cmvoltage{380.0};
0108 bool m_garfield_zerofield{false};
0109 bool m_manual_garfield_keffside0{false};
0110 bool m_manual_garfield_keffside1{false};
0111 double m_garfield_keffside0{1.0};
0112 double m_garfield_keffside1{1.0};
0113 double m_garfield_stepns{50.0};
0114
0115 std::string m_distortionOutputfile{"CMDistortionCorrections.root"};
0116
0117 TpcDistortionCorrectionContainer *m_dcc_out{nullptr};
0118
0119 int m_phibins{500};
0120
0121 static constexpr float m_phiMin{0};
0122 static constexpr float m_phiMax{2. * M_PI};
0123
0124
0125
0126 int m_rbins{500};
0127
0128 static constexpr float m_rMin{20};
0129 static constexpr float m_rMax{80};
0130
0131 };
0132
0133 #endif