Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-16 02:42:43

0001 //-------------------------------------------------
0002 //
0003 /**  \class MuonStub
0004  *
0005  *  Class that creates a super-primitive for all chambers
0006  *
0007  *
0008  *   M.Bachtis (UCLA)
0009  */
0010 //
0011 //--------------------------------------------------
0012 #ifndef L1TMUPHASE2GMTSTUB_H
0013 #define L1TMUPHASE2GMTSTUB_H
0014 //---------------
0015 // C++ Headers --
0016 //---------------
0017 
0018 #include <iosfwd>
0019 #include <vector>
0020 
0021 //----------------------
0022 // Base Class Headers --
0023 //----------------------
0024 
0025 //------------------------------------
0026 // Collaborating Class Declarations --
0027 //------------------------------------
0028 
0029 //#include "DataFormats/L1TMuon/interface/BMTF/L1MuBMTrackSegLoc.h"
0030 #include "DataFormats/L1Trigger/interface/BXVector.h"
0031 #include "DataFormats/Common/interface/Ref.h"
0032 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0033 
0034 //              ---------------------
0035 //              -- Class Interface --
0036 //              ---------------------
0037 
0038 namespace l1t {
0039 
0040   class MuonStub;
0041 
0042   typedef std::vector<MuonStub> MuonStubCollection;
0043   typedef edm::Ref<MuonStubCollection> MuonStubRef;
0044   typedef std::vector<edm::Ref<MuonStubCollection> > MuonStubRefVector;
0045 
0046   class MuonStub {
0047   public:
0048     /// default constructor
0049     MuonStub();
0050 
0051     /// constructor
0052     MuonStub(int etaRegion,
0053              int phiRegion,
0054              int depthRegion,
0055              uint tfLayer,
0056              int coord1,
0057              int coord2,
0058              int id,
0059              int bx,
0060              int quality,
0061              int eta1 = 0,
0062              int eta2 = 0,
0063              int etaQuality = -1,
0064              int type = 0);
0065     ~MuonStub();
0066     /// return wheel
0067     inline int etaRegion() const { return etaRegion_; }
0068     /// return sector
0069     inline int phiRegion() const { return phiRegion_; }
0070     /// return station
0071     inline int depthRegion() const { return depthRegion_; }
0072     /// return track finder layer
0073     inline uint tfLayer() const { return tfLayer_; }
0074     /// return phi
0075     inline int coord1() const { return coord1_; }
0076     /// return phib
0077     inline int coord2() const { return coord2_; }
0078     /// return quality code
0079     inline int quality() const { return quality_; }
0080     /// return tag (second TS tag)
0081     inline int id() const { return id_; }
0082     inline int index() const { return id_; }
0083     /// return  address
0084     inline int address() const {
0085       int addr = id_ | (phiRegion_ << 2);
0086       if (etaRegion_ >= 0) {
0087         return addr | (etaRegion_ << 8);
0088       } else {
0089         int twos_comp = ((-etaRegion_) ^ 0xf) + 1;
0090         return addr | (twos_comp << 8);
0091       }
0092     }
0093 
0094     inline int kmtf_address() const {
0095       int addr = id_ | (phiRegion_ << 2);
0096       if (etaRegion_ >= 0) {
0097         return addr | (etaRegion_ << 6);
0098       } else {
0099         int twos_comp = ((-etaRegion_) ^ 0x7) + 1;
0100         return addr | (twos_comp << 6);
0101       }
0102     }
0103 
0104     /// return bunch crossing
0105     inline int bxNum() const { return bxNum_; }
0106 
0107     /// return eta
0108     inline int eta1() const { return eta1_; }
0109     inline int eta2() const { return eta2_; }
0110     /// return first eta quality
0111     inline int etaQuality() const { return etaQuality_; }
0112     //return type
0113     inline int type() const { return type_; }
0114 
0115     inline bool isBarrel() const { return (type_ == 1); }
0116     inline bool isEndcap() const { return (type_ == 0); }
0117 
0118     inline double offline_coord1() const { return offline_coord1_; }
0119     inline double offline_coord2() const { return offline_coord2_; }
0120     inline double offline_eta1() const { return offline_eta1_; }
0121     inline double offline_eta2() const { return offline_eta2_; }
0122 
0123     void setOfflineQuantities(double coord1, double coord2, double eta1, double eta2) {
0124       offline_coord1_ = coord1;
0125       offline_coord2_ = coord2;
0126       offline_eta1_ = eta1;
0127       offline_eta2_ = eta2;
0128     }
0129     void setEta(int eta1, int eta2, int etaQ) {
0130       eta1_ = eta1;
0131       eta2_ = eta2;
0132       etaQuality_ = etaQ;
0133     }
0134 
0135     void setID(int id) { id_ = id; }
0136     /// equal operator
0137     bool operator==(const MuonStub&) const;
0138     /// unequal operator
0139     bool operator!=(const MuonStub&) const;
0140 
0141     void print() const;
0142 
0143   private:
0144     int etaRegion_;    //In the barrel this is wheel. In the endcap it is 6-ring
0145     int phiRegion_;    //In the barrel it is sector. In the endcap it is chamber
0146     int depthRegion_;  //Station
0147     uint tfLayer_;     //TF Layer
0148     int coord1_;       // global position angle in units of 30 degrees/2048
0149     int coord2_;       // bending angle  only in barrel for now
0150     int id_;           // stub id in case of more stubs per chamber
0151     int quality_;      //
0152     int bxNum_;        // bunch crossing identifier
0153     int eta1_;         // eta coordinate - in units of 3.0/512.
0154     int eta2_;         // eta coordinate - in units of 3.0/512.
0155     int etaQuality_;   // quality of the eta information
0156     int type_;         //Type: 0 TwinMux or DT, 1 RPC Barrel, 2 CSC, 3 RPC endcap
0157     /////////members that are not hardware but used for offline studies///////////////////////////////
0158     double offline_coord1_;  //offline coordinate 1
0159     double offline_coord2_;  //offline coordinate two
0160     double offline_eta1_;    //offline eta1
0161     double offline_eta2_;    //offline eta2
0162   };
0163 
0164 }  // namespace l1t
0165 #endif