Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-06 22:54:33

0001 // Class for muon tracks in EMTF - AWB 04.01.16
0002 // Mostly copied from L1Trigger/L1TMuonEndCap/interface/MuonInternalTrack.h
0003 
0004 #ifndef DataFormats_L1TMuon_EMTFTrack_h
0005 #define DataFormats_L1TMuon_EMTFTrack_h
0006 
0007 #include <cstdint>
0008 #include <vector>
0009 
0010 #include "DataFormats/L1TMuon/interface/EMTFHit.h"
0011 #include "DataFormats/L1TMuon/interface/EMTFRoad.h"
0012 #include "DataFormats/L1TMuon/interface/EMTF/SP.h"
0013 
0014 namespace l1t {
0015 
0016   namespace emtf {
0017     // Want a scoped enum, not necessarily a strongly-typed enum.
0018     // This is because of all the casting that will be required throughout legacy code
0019     // (usage will likely rely on implicit integer casting)
0020     enum class EMTFCSCStation { ME1 = 0, ME2, ME3, ME4 };
0021     enum class EMTFCSCSection { ME1sub1 = 0, ME1sub2, ME2, ME3, ME4 };
0022   }  // namespace emtf
0023 
0024   struct EMTFPtLUT {
0025     uint64_t address;
0026     uint16_t mode;
0027     uint16_t theta;
0028     uint16_t st1_ring2;
0029     uint16_t eta;
0030     uint16_t delta_ph[6];  // index: 0=12, 1=13, 2=14, 3=23, 4=24, 5=34
0031     uint16_t delta_th[6];  // ^
0032     uint16_t sign_ph[6];   // ^
0033     uint16_t sign_th[6];   // ^
0034     uint16_t cpattern[4];  // index: 0=ME1, 1=ME2, 2=ME3, 3=ME4
0035     uint16_t csign[4];     // index: 0=ME1, 1=ME2, 2=ME3, 3=ME4
0036     uint16_t slope[4];     // index: 0=ME1, 1=ME2, 2=ME3, 3=ME4
0037     uint16_t fr[4];        // ^
0038     uint16_t bt_vi[5];     // index: 0=ME1sub1, 1=ME1sub2, 2=ME2, 3=ME3, 4=ME4
0039     uint16_t bt_hi[5];     // ^
0040     uint16_t bt_ci[5];     // ^
0041     uint16_t bt_si[5];     // ^
0042   };
0043 
0044   class EMTFTrack {
0045   public:
0046     EMTFTrack()
0047         : _PtLUT(),
0048           endcap(-99),
0049           sector(-99),
0050           sector_idx(-99),
0051           mode(-99),
0052           mode_CSC(0),
0053           mode_RPC(0),
0054           mode_GEM(0),
0055           mode_neighbor(0),
0056           mode_inv(-99),
0057           rank(-99),
0058           winner(-99),
0059           charge(-99),
0060           bx(-99),
0061           first_bx(-99),
0062           second_bx(-99),
0063           pt(-99),
0064           pt_XML(-99),
0065           pt_dxy(-99),
0066           dxy(-99),
0067           zone(-99),
0068           ph_num(-99),
0069           ph_q(-99),
0070           theta_fp(-99),
0071           theta(-99),
0072           eta(-99),
0073           phi_fp(-99),
0074           phi_loc(-99),
0075           phi_glob(-999),
0076           gmt_pt(-99),
0077           gmt_pt_dxy(-99),
0078           gmt_dxy(-99),
0079           gmt_phi(-999),
0080           gmt_eta(-999),
0081           gmt_quality(-99),
0082           gmt_charge(-99),
0083           gmt_charge_valid(-99),
0084           track_num(-99),
0085           numHits(-99){};
0086 
0087     virtual ~EMTFTrack(){};
0088 
0089     void ImportSP(const emtf::SP _SP, int _sector);
0090     // void ImportPtLUT( int _mode, unsigned long _address );
0091 
0092     void clear_Hits() {
0093       _Hits.clear();
0094       numHits = 0;
0095       mode_CSC = 0;
0096       mode_RPC = 0;
0097       mode_GEM = 0;
0098       mode_neighbor = 0;
0099     }
0100 
0101     void push_Hit(const EMTFHit& hit) {
0102       _Hits.push_back(hit);
0103       numHits = _Hits.size();
0104       if (hit.Is_CSC())
0105         mode_CSC |= (1 << (4 - hit.Station()));
0106       if (hit.Is_RPC())
0107         mode_RPC |= (1 << (4 - hit.Station()));
0108       if (hit.Is_GEM())
0109         mode_GEM |= (1 << (4 - hit.Station()));
0110       if (hit.Neighbor())
0111         mode_neighbor |= (1 << (4 - hit.Station()));
0112     }
0113 
0114     void set_Hits(const EMTFHitCollection& hits) {
0115       clear_Hits();
0116       for (const auto& hit : hits)
0117         push_Hit(hit);
0118     }
0119 
0120     void clear_HitIdx() { _HitIdx.clear(); }
0121     void push_HitIdx(unsigned int bits) { _HitIdx.push_back(bits); }
0122     void set_HitIdx(const std::vector<unsigned int>& bits) { _HitIdx = bits; }
0123 
0124     int NumHits() const { return numHits; }
0125     EMTFHitCollection Hits() const { return _Hits; }
0126     std::vector<unsigned int> HitIdx() const { return _HitIdx; }
0127 
0128     void set_PtLUT(EMTFPtLUT bits) { _PtLUT = bits; }
0129     EMTFPtLUT PtLUT() const { return _PtLUT; }
0130 
0131     void set_endcap(int bits) { endcap = bits; }
0132     void set_sector(int bits) { sector = bits; }
0133     void set_sector_idx(int bits) { sector_idx = bits; }
0134     void set_mode(int bits) { mode = bits; }
0135     void set_mode_inv(int bits) { mode_inv = bits; }
0136     void set_rank(int bits) { rank = bits; }
0137     void set_winner(int bits) { winner = bits; }
0138     void set_charge(int bits) { charge = bits; }
0139     void set_bx(int bits) { bx = bits; }
0140     void set_first_bx(int bits) { first_bx = bits; }
0141     void set_second_bx(int bits) { second_bx = bits; }
0142     void set_pt(float val) { pt = val; }
0143     void set_pt_XML(float val) { pt_XML = val; }
0144     void set_pt_dxy(float val) { pt_dxy = val; }
0145     void set_dxy(float val) { dxy = val; }
0146     void set_zone(int bits) { zone = bits; }
0147     void set_ph_num(int bits) { ph_num = bits; }
0148     void set_ph_q(int bits) { ph_q = bits; }
0149     void set_theta_fp(int bits) { theta_fp = bits; }
0150     void set_theta(float val) { theta = val; }
0151     void set_eta(float val) { eta = val; }
0152     void set_phi_fp(int bits) { phi_fp = bits; }
0153     void set_phi_loc(float val) { phi_loc = val; }
0154     void set_phi_glob(float val) { phi_glob = val; }
0155     void set_gmt_pt(int bits) { gmt_pt = bits; }
0156     void set_gmt_pt_dxy(int bits) { gmt_pt_dxy = bits; }
0157     void set_gmt_dxy(int bits) { gmt_dxy = bits; }
0158     void set_gmt_phi(int bits) { gmt_phi = bits; }
0159     void set_gmt_eta(int bits) { gmt_eta = bits; }
0160     void set_gmt_quality(int bits) { gmt_quality = bits; }
0161     void set_gmt_charge(int bits) { gmt_charge = bits; }
0162     void set_gmt_charge_valid(int bits) { gmt_charge_valid = bits; }
0163     void set_track_num(int bits) { track_num = bits; }
0164 
0165     int Endcap() const { return endcap; }
0166     int Sector() const { return sector; }
0167     int Sector_idx() const { return sector_idx; }
0168     int Mode() const { return mode; }
0169     int Mode_CSC() const { return mode_CSC; }
0170     int Mode_RPC() const { return mode_RPC; }
0171     int Mode_GEM() const { return mode_GEM; }
0172     int Mode_neighbor() const { return mode_neighbor; }
0173     int Mode_inv() const { return mode_inv; }
0174     int Rank() const { return rank; }
0175     int Winner() const { return winner; }
0176     int Charge() const { return charge; }
0177     int BX() const { return bx; }
0178     int First_BX() const { return first_bx; }
0179     int Second_BX() const { return second_bx; }
0180     float Pt() const { return pt; }
0181     float Pt_XML() const { return pt_XML; }
0182     float Pt_dxy() const { return pt_dxy; }
0183     float Dxy() const { return dxy; }
0184     int Zone() const { return zone; }
0185     int Ph_num() const { return ph_num; }
0186     int Ph_q() const { return ph_q; }
0187     int Theta_fp() const { return theta_fp; }
0188     float Theta() const { return theta; }
0189     float Eta() const { return eta; }
0190     int Phi_fp() const { return phi_fp; }
0191     float Phi_loc() const { return phi_loc; }
0192     float Phi_glob() const { return phi_glob; }
0193     int GMT_pt() const { return gmt_pt; }
0194     int GMT_pt_dxy() const { return gmt_pt_dxy; }
0195     int GMT_dxy() const { return gmt_dxy; }
0196     int GMT_phi() const { return gmt_phi; }
0197     int GMT_eta() const { return gmt_eta; }
0198     int GMT_quality() const { return gmt_quality; }
0199     int GMT_charge() const { return gmt_charge; }
0200     int GMT_charge_valid() const { return gmt_charge_valid; }
0201     int Track_num() const { return track_num; }
0202 
0203   private:
0204     EMTFHitCollection _Hits;
0205     std::vector<unsigned int> _HitIdx;
0206 
0207     EMTFPtLUT _PtLUT;
0208 
0209     int endcap;      //    +/-1.  For ME+ and ME-.
0210     int sector;      //  1 -  6.
0211     int sector_idx;  //  0 - 11.  0 - 5 for ME+, 6 - 11 for ME-.
0212     int mode;        //  0 - 15.
0213     int mode_CSC;    //  0 - 15, CSC-only
0214     int mode_RPC;    //  0 - 15, RPC-only
0215     int mode_GEM;  //  0 - 15, GEM-only // TODO: verify if needed when including GEM, also start the good habit of documenting these
0216     int mode_neighbor;  // 0 - 15, only neighbor hits
0217     int mode_inv;       // 15 -  0.
0218     int rank;           //  0 - 127  (Range? - AWB 03.03.17)
0219     int winner;         //  0 -  2.  (Range? - AWB 03.03.17)
0220     int charge;         //    +/-1.  For physical charge (reversed from GMT convention)
0221     int bx;             // -3 - +3.
0222     int first_bx;       // -3 - +3.
0223     int second_bx;      // -3 - +3.
0224     float pt;           //  0 - 255
0225     float pt_XML;       //  0 - 999
0226     float pt_dxy;       //  0 - 127
0227     float dxy;          //  0 -  3
0228     int zone;           //  0 -  3.
0229     int ph_num;
0230     int ph_q;
0231     int theta_fp;    //  0 - 127
0232     float theta;     //  0 - 90.
0233     float eta;       //  +/-2.5.
0234     int phi_fp;      // 0 - 4920
0235     float phi_loc;   // -22 - 60  (Range? - AWB 03.03.17)
0236     float phi_glob;  //  +/-180.
0237     int gmt_pt;
0238     int gmt_pt_dxy;
0239     int gmt_dxy;
0240     int gmt_phi;
0241     int gmt_eta;
0242     int gmt_quality;
0243     int gmt_charge;
0244     int gmt_charge_valid;
0245     int track_num;  //  0 - ??.  (Range? - AWB 03.03.17)
0246     int numHits;    //  1 -  4.
0247 
0248   };  // End of class EMTFTrack
0249 
0250   // Define a vector of EMTFTrack
0251   typedef std::vector<EMTFTrack> EMTFTrackCollection;
0252 
0253 }  // End of namespace l1t
0254 
0255 #endif /* define DataFormats_L1TMuon_EMTFTrack_h */