Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef L1Trigger_TrackFindingTMTT_DigitalTrack_h
0002 #define L1Trigger_TrackFindingTMTT_DigitalTrack_h
0003 
0004 #include "FWCore/Utilities/interface/Exception.h"
0005 #include <cmath>
0006 #include <string>
0007 #include <set>
0008 
0009 namespace tmtt {
0010 
0011   class Settings;
0012   class L1fittedTrack;
0013 
0014   //====================================================================================================
0015   /**
0016  * Used to digitize the fitted track helix params.
0017  * WARNING: Digitizes according to common format agreed for KF and SimpleLR4 fitters, 
0018  * and uses KF digitisation cfg for all fitters except SimpleLR4.
0019  */
0020   //====================================================================================================
0021 
0022   class DigitalTrack {
0023   public:
0024     // Digitize track
0025     DigitalTrack(const Settings* settings, const std::string& fitterName, const L1fittedTrack* fitTrk);
0026 
0027     //--- The functions below return variables post-digitization.
0028 
0029     // half inverse curvature of track.
0030     int iDigi_oneOver2r() const { return iDigi_oneOver2r_; }
0031     int iDigi_d0() const { return iDigi_d0_; }
0032     // measured relative to centre of sector
0033     int iDigi_phi0rel() const { return iDigi_phi0rel_; }
0034     int iDigi_z0() const { return iDigi_z0_; }
0035     int iDigi_tanLambda() const { return iDigi_tanLambda_; }
0036     unsigned int iDigi_chisquaredRphi() const { return iDigi_chisquaredRphi_; }
0037     unsigned int iDigi_chisquaredRz() const { return iDigi_chisquaredRz_; }
0038 
0039     // Digits corresponding to track params with post-fit beam-spot constraint.
0040     int iDigi_oneOver2r_bcon() const { return iDigi_oneOver2r_bcon_; }  // half inverse curvature of track.
0041     int iDigi_phi0rel_bcon() const { return iDigi_phi0rel_bcon_; }      // measured relative to centre of sector
0042     unsigned int iDigi_chisquaredRphi_bcon() const { return iDigi_chisquaredRphi_bcon_; }
0043 
0044     // Floating point track params derived from digitized info (so with degraded resolution).
0045     float qOverPt() const { return qOverPt_; }
0046     float oneOver2r() const { return oneOver2r_; }  // half inverse curvature of track.
0047     float d0() const { return d0_; }
0048     float phi0() const { return phi0_; }
0049     float phi0rel() const { return phi0rel_; }  // measured relative to centre of sector
0050     float z0() const { return z0_; }
0051     float tanLambda() const { return tanLambda_; }
0052     float chisquaredRphi() const { return chisquaredRphi_; }
0053     float chisquaredRz() const { return chisquaredRz_; }
0054 
0055     // Floating point track params derived from digitized track params with post-fit beam-spot constraint.
0056     float qOverPt_bcon() const { return qOverPt_bcon_; }
0057     float oneOver2r_bcon() const { return oneOver2r_bcon_; }  // half inverse curvature of track.
0058     float phi0_bcon() const { return phi0_bcon_; }
0059     float phi0rel_bcon() const { return phi0rel_bcon_; }  // measured relative to centre of sector
0060     float chisquaredRphi_bcon() const { return chisquaredRphi_bcon_; }
0061 
0062     unsigned int iPhiSec() const { return iPhiSec_; }
0063     unsigned int iEtaReg() const { return iEtaReg_; }
0064     int mBinhelix() const { return mBinhelix_; }
0065     int cBinhelix() const { return cBinhelix_; }
0066     unsigned int nlayers() const { return nlayers_; }
0067     int mBinHT() const { return mBin_; }
0068     int cBinHT() const { return cBin_; }
0069     bool accepted() const { return accepted_; }
0070     unsigned int hitPattern() const { return hitPattern_; }
0071 
0072     //--- The functions below give access to the original variables prior to digitization.
0073     //%%% Those common to GP & HT input.
0074     float orig_qOverPt() const { return qOverPt_orig_; }
0075     float orig_oneOver2r() const { return oneOver2r_orig_; }  // half inverse curvature of track.
0076     float orig_d0() const { return d0_orig_; }
0077     float orig_phi0() const { return phi0_orig_; }
0078     float orig_phi0rel() const { return phi0rel_orig_; }  // measured relative to centre of sector
0079     float orig_z0() const { return z0_orig_; }
0080     float orig_tanLambda() const { return tanLambda_orig_; }
0081     float orig_chisquaredRphi() const { return chisquaredRphi_orig_; }
0082     float orig_chisquaredRz() const { return chisquaredRz_orig_; }
0083 
0084     float tp_pt() const { return tp_pt_; }
0085     float tp_eta() const { return tp_eta_; }
0086     float tp_d0() const { return tp_d0_; }
0087     float tp_phi0() const { return tp_phi0_; }
0088     float tp_tanLambda() const { return tp_tanLambda_; }
0089     float tp_z0() const { return tp_z0_; }
0090     float tp_qoverpt() const { return tp_qoverpt_; }
0091     int tp_index() const { return tp_index_; }
0092     float tp_useForAlgEff() const { return tp_useForAlgEff_; }
0093     float tp_useForEff() const { return tp_useForEff_; }
0094     float tp_pdgId() const { return tp_pdgId_; }
0095 
0096     //--- Utility: return phi nonant number corresponding to given phi sector number.
0097     unsigned int iGetNonant(unsigned int iPhiSec) const { return floor(iPhiSec * numPhiNonants_ / numPhiSectors_); }
0098 
0099   private:
0100     // Load digitisation configuration parameters for the specific track fitter being used here.
0101     void loadDigiCfg(const std::string& fitterName);
0102 
0103     // Digitize track
0104     void makeDigitalTrack();
0105 
0106     // Check that stub coords. are within assumed digitization range.
0107     void checkInRange() const;
0108 
0109     // Check that digitisation followed by undigitisation doesn't change significantly the track params.
0110     void checkAccuracy() const;
0111 
0112   private:
0113     // Configuration params
0114     const Settings* settings_;
0115 
0116     // Number of phi sectors and phi nonants.
0117     unsigned int numPhiSectors_;
0118     unsigned int numPhiNonants_;
0119     double phiSectorWidth_;
0120     double phiNonantWidth_;
0121     double phiSectorCentre_;
0122     float chosenRofPhi_;
0123     unsigned int nbinsPt_;
0124     float invPtToDPhi_;
0125 
0126     // Digitization configuration
0127     bool skipTrackDigi_;
0128     unsigned int oneOver2rBits_;
0129     float oneOver2rRange_;
0130     unsigned int d0Bits_;
0131     float d0Range_;
0132     unsigned int phi0Bits_;
0133     float phi0Range_;
0134     unsigned int z0Bits_;
0135     float z0Range_;
0136     unsigned int tanLambdaBits_;
0137     float tanLambdaRange_;
0138     unsigned int chisquaredBits_;
0139     float chisquaredRange_;
0140 
0141     double oneOver2rMult_;
0142     double d0Mult_;
0143     double phi0Mult_;
0144     double z0Mult_;
0145     double tanLambdaMult_;
0146     double chisquaredMult_;
0147 
0148     // Fitted track
0149 
0150     std::string fitterName_;
0151     unsigned int nHelixParams_;
0152 
0153     // Integer data after digitization (which doesn't degrade its resolution, but can recast it in a different form).
0154     unsigned int nlayers_;
0155     unsigned int iPhiSec_;
0156     unsigned int iEtaReg_;
0157     int mBin_;
0158     int cBin_;
0159     int mBinhelix_;
0160     int cBinhelix_;
0161     unsigned int hitPattern_;
0162     bool consistent_;
0163     bool consistentSect_;
0164     bool accepted_;
0165 
0166     //--- Original floating point stub coords before digitization.
0167 
0168     float qOverPt_orig_;
0169     float oneOver2r_orig_;
0170     float d0_orig_;
0171     float phi0_orig_;
0172     float phi0rel_orig_;
0173     float tanLambda_orig_;
0174     float z0_orig_;
0175     float chisquaredRphi_orig_;
0176     float chisquaredRz_orig_;
0177 
0178     float qOverPt_bcon_orig_;
0179     float oneOver2r_bcon_orig_;
0180     float phi0_bcon_orig_;
0181     float phi0rel_bcon_orig_;
0182     float chisquaredRphi_bcon_orig_;
0183 
0184     //--- Digits corresponding to track params.
0185 
0186     int iDigi_oneOver2r_;
0187     int iDigi_d0_;
0188     int iDigi_phi0rel_;
0189     int iDigi_z0_;
0190     int iDigi_tanLambda_;
0191     unsigned int iDigi_chisquaredRphi_;
0192     unsigned int iDigi_chisquaredRz_;
0193 
0194     int iDigi_oneOver2r_bcon_;
0195     int iDigi_phi0rel_bcon_;
0196     unsigned int iDigi_chisquaredRphi_bcon_;
0197 
0198     //--- Floating point track coords derived from digitized info (so with degraded resolution).
0199 
0200     float qOverPt_;
0201     float oneOver2r_;
0202     float d0_;
0203     float phi0_;
0204     float phi0rel_;
0205     float z0_;
0206     float tanLambda_;
0207     float chisquaredRphi_;
0208     float chisquaredRz_;
0209 
0210     float qOverPt_bcon_;
0211     float oneOver2r_bcon_;
0212     float phi0_bcon_;
0213     float phi0rel_bcon_;
0214     float chisquaredRphi_bcon_;
0215 
0216     // Truth
0217     float tp_qoverpt_;
0218     float tp_pt_;
0219     float tp_eta_;
0220     float tp_d0_;
0221     float tp_phi0_;
0222     float tp_tanLambda_;
0223     float tp_z0_;
0224     int tp_index_;
0225     bool tp_useForAlgEff_;
0226     bool tp_useForEff_;
0227     int tp_pdgId_;
0228   };
0229 
0230 }  // namespace tmtt
0231 #endif