Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:30:40

0001 #ifndef L1Trigger_TrackFindingTMTT_DigitalStub_h
0002 #define L1Trigger_TrackFindingTMTT_DigitalStub_h
0003 
0004 #include "FWCore/Utilities/interface/Exception.h"
0005 #include <cmath>
0006 #include <string>
0007 
0008 //=== Digtizes stubs for input to GP, HT & KF
0009 
0010 namespace tmtt {
0011 
0012   class Settings;
0013 
0014   class DigitalStub {
0015   public:
0016     //--- Hybrid tracking: simplified digitization for KF.
0017 
0018     DigitalStub(const Settings* settings, double r, double phi, double z, unsigned int iPhiSec);
0019 
0020     //--- TMTT tracking:
0021     // Initialize stub with floating point stub coords, range of HT m-bin values consistent with bend,
0022     // bend and phi sector.
0023     DigitalStub(const Settings* settings,
0024                 double phi_orig,
0025                 double r_orig,
0026                 double z_orig,
0027                 unsigned int mbin_min_orig,
0028                 unsigned int mbin_max_orig,
0029                 double bend_orig,
0030                 unsigned int iPhiSec);
0031 
0032     // Redo phi digitisation assigning stub to a different phi sector;
0033     // (Return arg indicates if any work done).
0034     bool changePhiSec(unsigned int iPhiSec);
0035 
0036     //--- Original floating point stub data before digitization.
0037     double r_orig() const { return r_orig_; }
0038     double rt_orig() const { return rt_orig_; }  // r with respect to reference radius
0039     double phi_orig() const { return phi_orig_; }
0040     double phiS_orig() const { return phiS_orig_; }  // with respect to centre of sector
0041     double phiN_orig() const { return phiN_orig_; }  // with respect to centre of nonant
0042     double z_orig() const { return z_orig_; }
0043     unsigned int mbin_min_orig() const { return mbin_min_orig_; }
0044     unsigned int mbin_max_orig() const { return mbin_max_orig_; }
0045     double bend_orig() const { return bend_orig_; }
0046 
0047     //--- Digitised stub data
0048 
0049     int iDigi_PhiN() const { return iDigi_PhiN_; }
0050     int iDigi_Bend() const { return iDigi_Bend_; }
0051     int iDigi_PhiS() const { return iDigi_PhiS_; }
0052     int mbin_min() const { return mbin_min_; }
0053     int mbin_max() const { return mbin_max_; }
0054     int iDigi_Rt() const { return iDigi_Rt_; }
0055     unsigned int iDigi_R() const { return iDigi_R_; }
0056     int iDigi_Z() const { return iDigi_Z_; }
0057 
0058     //--- floating point stub data following digitisation & undigitisation again
0059     // "GP" indicates valid variable for input to GP etc. If no such name, always valid.
0060     double phiN() const { return phiN_; }
0061     double phi_GP() const { return phi_GP_; }
0062     double bend() const { return bend_; }
0063     double phiS() const { return phiS_; }
0064     double phi_HT_TF() const { return phi_HT_TF_; }
0065     double rt_GP_HT() const { return rt_GP_HT_; }
0066     double r_GP_HT() const { return r_GP_HT_; }
0067     double r_SF_TF() const { return r_SF_TF_; }
0068     double rt_SF_TF() const { return rt_SF_TF_; }
0069     double z() const { return z_; }
0070 
0071     //--- Utility: return phi nonant number corresponding to given phi sector number.
0072 
0073     unsigned int iNonant(unsigned int iPhiSec) const { return floor(iPhiSec * numPhiNonants_ / numPhiSectors_); }
0074 
0075   private:
0076     // Set cfg params.
0077     void setCfgParams(const Settings* settings);
0078 
0079     // Digitize stub
0080     void digitize(unsigned int iPhiSec);
0081 
0082     // Undigitize stub again
0083     void undigitize(unsigned int iPhiSec);
0084 
0085     // Check that stub coords. & bend angle are within assumed digitization range.
0086     void checkInRange() const;
0087 
0088     // Check that digitisation followed by undigitisation doesn't change significantly the stub coordinates.
0089     void checkAccuracy() const;
0090 
0091   private:
0092     //--- Configuration
0093 
0094     // Digitization configuration
0095     int iFirmwareType_;
0096     unsigned int phiSectorBits_;
0097     unsigned int phiSBits_;
0098     double phiSRange_;
0099     unsigned int rtBits_;
0100     double rtRange_;
0101     unsigned int zBits_;
0102     double zRange_;
0103     unsigned int phiNBits_;
0104     double phiNRange_;
0105     unsigned int bendBits_;
0106     double bendRange_;
0107 
0108     // Digitization multipliers
0109     double phiSMult_;
0110     double rtMult_;
0111     double zMult_;
0112     double phiNMult_;
0113     double bendMult_;
0114 
0115     // Number of phi sectors and phi nonants.
0116     unsigned int numPhiSectors_;
0117     unsigned int numPhiNonants_;
0118     // Phi sector and phi nonant width (radians)
0119     double phiSectorWidth_;
0120     double phiNonantWidth_;
0121     // Centre of phi sector 0.
0122     double phiCentreSec0_;
0123     // Centre of this phi sector & nonant.
0124     double phiSectorCentre_;
0125     double phiNonantCentre_;
0126     // Radius from beamline with respect to which stub r coord. is measured.
0127     double chosenRofPhi_;
0128     // Number of q/Pt bins in Hough  transform array.
0129     unsigned int nbinsPt_;
0130     // Min. of HT m-bin array in firmware.
0131     int min_array_mbin_;
0132 
0133     // Used to check if new digitisation requests were already done.
0134     unsigned int iPhiSec_done_;
0135 
0136     //--- Original floating point stub data before digitization.
0137     double r_orig_;
0138     double rt_orig_;
0139     double phi_orig_;
0140     double phiS_orig_;
0141     double phiN_orig_;
0142     double z_orig_;
0143     unsigned int mbin_min_orig_;
0144     unsigned int mbin_max_orig_;
0145     double bend_orig_;
0146 
0147     //--- Digitised stub data
0148 
0149     int iDigi_PhiN_;
0150     int iDigi_Bend_;
0151     int iDigi_PhiS_;
0152     int mbin_min_;
0153     int mbin_max_;
0154     int iDigi_Rt_;
0155     unsigned int iDigi_R_;
0156     int iDigi_Z_;
0157 
0158     //--- floating point stub data following digitisation & undigitisation again
0159     double phiN_;
0160     double phi_GP_;
0161     double bend_;
0162     double phiS_;
0163     double phi_HT_TF_;
0164     double rt_GP_HT_;
0165     double r_GP_HT_;
0166     double r_SF_TF_;
0167     double rt_SF_TF_;
0168     double z_;
0169   };
0170 
0171 }  // namespace tmtt
0172 #endif