File indexing completed on 2024-04-06 12:19:45
0001 #ifndef L1Trigger_DTTriggerPhase2_MuonPathFitter_h
0002 #define L1Trigger_DTTriggerPhase2_MuonPathFitter_h
0003
0004 #include "L1Trigger/DTTriggerPhase2/interface/MuonPathAnalyzer.h"
0005 #include "L1Trigger/DTTriggerPhase2/interface/vhdl_functions.h"
0006
0007
0008
0009
0010
0011 using coeff_arr_t = std::vector<std::vector<int>>;
0012 struct coeffs_t {
0013 coeff_arr_t t0;
0014 coeff_arr_t position;
0015 coeff_arr_t slope;
0016 coeffs_t()
0017 : t0(cmsdt::N_COEFFS, std::vector<int>(cmsdt::GENERIC_COEFF_WIDTH, 0)),
0018 position(cmsdt::N_COEFFS, std::vector<int>(cmsdt::GENERIC_COEFF_WIDTH, 0)),
0019 slope(cmsdt::N_COEFFS, std::vector<int>(cmsdt::GENERIC_COEFF_WIDTH, 0)) {}
0020 };
0021
0022 struct SLhitP {
0023 int ti;
0024 int wi;
0025 int ly;
0026 int wp;
0027 };
0028
0029 struct fit_common_in_t {
0030
0031 std::vector<SLhitP> hits;
0032 std::vector<int> hits_valid;
0033 std::vector<int> lateralities;
0034 coeffs_t coeffs;
0035 int coarse_bctr;
0036 int coarse_wirepos;
0037 };
0038
0039 struct fit_common_out_t {
0040 int t0;
0041 int slope;
0042 int position;
0043 int chi2;
0044 int valid_fit;
0045 fit_common_out_t() : t0(0), slope(0), position(0), chi2(0), valid_fit(0) {}
0046 };
0047
0048
0049
0050
0051
0052 class MuonPathFitter : public MuonPathAnalyzer {
0053 public:
0054
0055 MuonPathFitter(const edm::ParameterSet &pset,
0056 edm::ConsumesCollector &iC,
0057 std::shared_ptr<GlobalCoordsObtainer> &globalcoordsobtainer);
0058 ~MuonPathFitter() override;
0059
0060
0061
0062
0063 coeffs_t RomDataConvert(std::vector<int> slv,
0064 short COEFF_WIDTH_T0,
0065 short COEFF_WIDTH_POSITION,
0066 short COEFF_WIDTH_SLOPE,
0067 short LOLY,
0068 short HILY);
0069
0070 bool hasPosRF(int wh, int sec) { return wh > 0 || (wh == 0 && sec % 4 > 1); };
0071 void setChi2Th(double chi2Th) { chi2Th_ = chi2Th; };
0072 void setTanPhiTh(double tanPhiTh) { tanPhiTh_ = tanPhiTh; };
0073
0074
0075 DTGeometry const *dtGeo_;
0076 edm::ESGetToken<DTGeometry, MuonGeometryRecord> dtGeomH;
0077
0078
0079 edm::FileInPath shift_filename_;
0080 std::map<int, float> shiftinfo_;
0081
0082
0083 edm::FileInPath maxdrift_filename_;
0084 int maxdriftinfo_[5][4][14];
0085 int max_drift_tdc = -1;
0086
0087 int get_rom_addr(MuonPathPtr &inMPath, latcomb lats);
0088 fit_common_out_t fit(fit_common_in_t fit_common_in,
0089 int XI_WIDTH,
0090 int COEFF_WIDTH_T0,
0091 int COEFF_WIDTH_POSITION,
0092 int COEFF_WIDTH_SLOPE,
0093 int PRECISSION_T0,
0094 int PRECISSION_POSITION,
0095 int PRECISSION_SLOPE,
0096 int PROD_RESIZE_T0,
0097 int PROD_RESIZE_POSITION,
0098 int PROD_RESIZE_SLOPE,
0099 int MAX_DRIFT_TDC,
0100 int sl);
0101
0102 double tanPhiTh_;
0103 const bool debug_;
0104 double chi2Th_;
0105
0106
0107 std::shared_ptr<GlobalCoordsObtainer> globalcoordsobtainer_;
0108
0109 private:
0110
0111
0112
0113 };
0114
0115 #endif