File indexing completed on 2024-04-06 12:22:01
0001 #include "L1Trigger/TrackFindingTracklet/interface/Residual.h"
0002 #include "L1Trigger/TrackFindingTracklet/interface/Settings.h"
0003
0004 using namespace std;
0005 using namespace trklet;
0006
0007 void Residual::init(Settings const& settings,
0008 unsigned int layerdisk,
0009 int iphiresid,
0010 int irzresid,
0011 int istubid,
0012 double phiresid,
0013 double rzresid,
0014 double phiresidapprox,
0015 double rzresidapprox,
0016 const Stub* stubptr) {
0017 assert(layerdisk < N_LAYER + N_DISK);
0018
0019 if (valid_ && (std::abs(iphiresid) > std::abs(fpgaphiresid_.value())))
0020 return;
0021
0022 valid_ = true;
0023
0024 layerdisk_ = layerdisk;
0025
0026 fpgaphiresid_.set(iphiresid, settings.phiresidbits(), false, __LINE__, __FILE__);
0027 if (layerdisk < N_LAYER) {
0028 fpgarzresid_.set(irzresid, settings.zresidbits(), false, __LINE__, __FILE__);
0029 } else {
0030 fpgarzresid_.set(irzresid, settings.rresidbits(), false, __LINE__, __FILE__);
0031 }
0032
0033 int nbitsid = 10;
0034 fpgastubid_.set(istubid, nbitsid, true, __LINE__, __FILE__);
0035 assert(!fpgaphiresid_.atExtreme());
0036
0037 phiresid_ = phiresid;
0038 rzresid_ = rzresid;
0039
0040 phiresidapprox_ = phiresidapprox;
0041 rzresidapprox_ = rzresidapprox;
0042
0043 stubptr_ = stubptr;
0044 }