Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-07-12 02:58:08

0001 // Class for input trigger primitives to EMTF - AWB 04.01.16
0002 // Based on L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h
0003 // In particular, see struct CSCData
0004 
0005 #ifndef DataFormats_L1TMuon_EMTFHit_h
0006 #define DataFormats_L1TMuon_EMTFHit_h
0007 
0008 #include <cstdint>
0009 #include <vector>
0010 
0011 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
0012 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
0013 #include "DataFormats/MuonDetId/interface/GEMDetId.h"
0014 #include "DataFormats/MuonDetId/interface/ME0DetId.h"
0015 #include "DataFormats/MuonDetId/interface/DTChamberId.h"
0016 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h"
0017 #include "DataFormats/GEMDigi/interface/GEMPadDigiCluster.h"
0018 #include "DataFormats/L1TMuon/interface/CPPFDigi.h"
0019 #include "DataFormats/L1TMuon/interface/L1TMuonSubsystems.h"
0020 
0021 namespace l1t {
0022 
0023   namespace l1tmu = L1TMuon;
0024 
0025   class EMTFHit {
0026   public:
0027     EMTFHit()
0028         : rawDetId(0),
0029           subsystem(-99),
0030           endcap(-99),
0031           station(-99),
0032           ring(-99),
0033           sector(-99),
0034           sector_RPC(-99),
0035           sector_idx(-99),
0036           subsector(-99),
0037           subsector_RPC(-99),
0038           chamber(-99),
0039           csc_ID(-99),
0040           csc_nID(-99),
0041           roll(-99),
0042           neighbor(-99),
0043           mpc_link(-99),
0044           pc_sector(-99),
0045           pc_station(-99),
0046           pc_chamber(-99),
0047           pc_segment(-99),
0048           wire(-99),
0049           strip(-99),
0050           strip_hi(-99),
0051           strip_low(-99),
0052           strip_quart(-99),       // Run 3
0053           strip_eighth(-99),      // Run 3
0054           strip_quart_bit(-99),   // Run 3
0055           strip_eighth_bit(-99),  // Run 3
0056           track_num(-99),
0057           quality(-99),
0058           pattern(-99),
0059           pattern_run3(-99),  // Run 3
0060           bend(-99),
0061           slope(-99),  // Run 3
0062           valid(-99),
0063           sync_err(-99),
0064           layer(-99),  // TODO: verify inclusion for GEM, or better to generalize this class... - JS 06.07.20
0065           bc0(-99),
0066           bx(-99),
0067           stub_num(-99),
0068           phi_fp(-99),
0069           theta_fp(-99),
0070           zone_hit(-99),
0071           zone_code(-99),
0072           fs_segment(-99),
0073           fs_zone_code(-99),
0074           bt_station(-99),
0075           bt_segment(-99),
0076           phi_loc(-99),
0077           phi_glob(-999),
0078           theta(-99),
0079           eta(-99),
0080           time(-99),
0081           phi_sim(-999),
0082           theta_sim(-99),
0083           eta_sim(-99),
0084           rho_sim(-99),
0085           z_sim(-99),
0086           alct_quality(-99),
0087           clct_quality(-99){};
0088 
0089     virtual ~EMTFHit(){};
0090 
0091     CSCDetId CreateCSCDetId() const;
0092     RPCDetId CreateRPCDetId() const;
0093     GEMDetId CreateGEMDetId() const;
0094     ME0DetId CreateME0DetId() const;
0095 
0096     // void ImportCSCCorrelatedLCTDigi (const CSCCorrelatedLCTDigi& _digi);
0097     CSCCorrelatedLCTDigi CreateCSCCorrelatedLCTDigi(const bool isRun3) const;
0098     // void ImportRPCDigi (const RPCDigi& _digi);
0099     // RPCDigi CreateRPCDigi() const;
0100     // void ImportCPPFDigi (const CPPFDigi& _digi);
0101     CPPFDigi CreateCPPFDigi() const;
0102     // void ImportGEMPadDigiCluster (const GEMPadDigiCluster& _digi);  // TODO: implement placeholder when others are implemented
0103     GEMPadDigiCluster CreateGEMPadDigiCluster() const;
0104 
0105     // void PrintSimulatorHeader() const;
0106     // void PrintForSimulator() const;
0107 
0108     //void SetCSCDetId   (const CSCDetId& id)                 { csc_DetId         = id;        }
0109     //void SetRPCDetId   (const RPCDetId& id)                 { rpc_DetId         = id;        }
0110     //void SetGEMDetId   (const GEMDetId& id)                 { gem_DetId         = id;        }
0111     //void SetCSCLCTDigi (const CSCCorrelatedLCTDigi& digi)   { csc_LCTDigi       = digi;      }
0112     //void SetRPCDigi    (const RPCDigi& digi)                { rpc_Digi          = digi;      }
0113     //void SetCPPFDigi   (const CPPFDigi& digi)               { cppf_Digi         = digi;      }
0114     //void SetGEMPadDigiCluster (const GEMPadDigiCluster& digi)             { gem_PadClusterDigi       = digi;      }
0115     void SetCSCDetId(const CSCDetId& id) { rawDetId = id.rawId(); }
0116     void SetRPCDetId(const RPCDetId& id) { rawDetId = id.rawId(); }
0117     void SetGEMDetId(const GEMDetId& id) { rawDetId = id.rawId(); }
0118     void SetME0DetId(const ME0DetId& id) { rawDetId = id.rawId(); }
0119     void SetDTDetId(const DTChamberId& id) { rawDetId = id.rawId(); }
0120 
0121     //CSCDetId CSC_DetId                          () const { return csc_DetId;    }
0122     //RPCDetId RPC_DetId                          () const { return rpc_DetId;    }
0123     //GEMDetId GEM_DetId                          () const { return gem_DetId;    }
0124     //CSCCorrelatedLCTDigi CSC_LCTDigi            () const { return csc_LCTDigi;  }
0125     //RPCDigi RPC_Digi                            () const { return rpc_Digi;     }
0126     //CPPFDigi CPPF_Digi                          () const { return cppf_Digi;    }
0127     //GEMPadDigiCluster GEM_PadClusterDigi        () const { return gem_PadClusterDigi;  }
0128     CSCDetId CSC_DetId() const { return CSCDetId(rawDetId); }
0129     RPCDetId RPC_DetId() const { return RPCDetId(rawDetId); }
0130     GEMDetId GEM_DetId() const { return GEMDetId(rawDetId); }
0131     ME0DetId ME0_DetId() const { return ME0DetId(rawDetId); }
0132     DTChamberId DT_DetId() const { return DTChamberId(rawDetId); }
0133 
0134     void set_subsystem(int bits) { subsystem = bits; }
0135     void set_endcap(int bits) { endcap = bits; }
0136     void set_station(int bits) { station = bits; }
0137     void set_ring(int bits) { ring = bits; }
0138     void set_sector(int bits) { sector = bits; }
0139     void set_sector_RPC(int bits) { sector_RPC = bits; }
0140     void set_sector_idx(int bits) { sector_idx = bits; }
0141     void set_subsector(int bits) { subsector = bits; }
0142     void set_subsector_RPC(int bits) { subsector_RPC = bits; }
0143     void set_chamber(int bits) { chamber = bits; }
0144     void set_csc_ID(int bits) { csc_ID = bits; }
0145     void set_csc_nID(int bits) { csc_nID = bits; }
0146     void set_roll(int bits) { roll = bits; }
0147     void set_neighbor(int bits) { neighbor = bits; }
0148     void set_mpc_link(int bits) { mpc_link = bits; }
0149     void set_pc_sector(int bits) { pc_sector = bits; }
0150     void set_pc_station(int bits) { pc_station = bits; }
0151     void set_pc_chamber(int bits) { pc_chamber = bits; }
0152     void set_pc_segment(int bits) { pc_segment = bits; }
0153     void set_wire(int bits) { wire = bits; }
0154     void set_strip(int bits) { strip = bits; }
0155     void set_strip_hi(int bits) { strip_hi = bits; }
0156     void set_strip_low(int bits) { strip_low = bits; }
0157     void set_strip_quart(int bits) { strip_quart = bits; }            // Run 3
0158     void set_strip_eighth(int bits) { strip_eighth = bits; }          // Run 3
0159     void set_strip_quart_bit(int bits) { strip_quart_bit = bits; }    // Run 3
0160     void set_strip_eighth_bit(int bits) { strip_eighth_bit = bits; }  // Run 3
0161     void set_track_num(int bits) { track_num = bits; }
0162     void set_quality(int bits) { quality = bits; }
0163     void set_pattern(int bits) { pattern = bits; }
0164     void set_pattern_run3(int bits) { pattern_run3 = bits; }  // Run 3
0165     void set_bend(int bits) { bend = bits; }
0166     void set_slope(int bits) { slope = bits; }  // Run 3
0167     void set_valid(int bits) { valid = bits; }
0168     void set_sync_err(int bits) { sync_err = bits; }
0169     // GEM specific aliases
0170     void set_pad(int bits) { set_strip(bits); }
0171     void set_pad_hi(int bits) { set_strip_hi(bits); }
0172     void set_pad_low(int bits) { set_strip_low(bits); }
0173     void set_partition(int bits) { set_roll(bits); }
0174     void set_layer(int bits) { layer = bits; }
0175     void set_cluster_size(int bits) { set_quality(bits); }
0176     void set_cluster_id(int bits) { set_track_num(bits); }
0177     // END GEM specific
0178     void set_bc0(int bits) { bc0 = bits; }
0179     void set_bx(int bits) { bx = bits; }
0180     void set_stub_num(int bits) { stub_num = bits; }
0181     void set_phi_fp(int bits) { phi_fp = bits; }
0182     void set_theta_fp(int bits) { theta_fp = bits; }
0183     void set_zone_hit(int bits) { zone_hit = bits; }
0184     void set_zone_code(int bits) { zone_code = bits; }
0185     void set_fs_segment(int bits) { fs_segment = bits; }
0186     void set_fs_zone_code(int bits) { fs_zone_code = bits; }
0187     void set_bt_station(int bits) { bt_station = bits; }
0188     void set_bt_segment(int bits) { bt_segment = bits; }
0189     void set_phi_loc(float val) { phi_loc = val; }
0190     void set_phi_glob(float val) { phi_glob = val; }
0191     void set_theta(float val) { theta = val; }
0192     void set_eta(float val) { eta = val; }
0193     void set_time(float val) { time = val; }
0194     void set_phi_sim(float val) { phi_sim = val; }
0195     void set_theta_sim(float val) { theta_sim = val; }
0196     void set_eta_sim(float val) { eta_sim = val; }
0197     void set_rho_sim(float val) { rho_sim = val; }
0198     void set_z_sim(float val) { z_sim = val; }
0199     void set_alct_quality(int bits) { alct_quality = bits; }
0200     void set_clct_quality(int bits) { clct_quality = bits; }
0201 
0202     int Subsystem() const { return subsystem; }
0203     int Endcap() const { return endcap; }
0204     int Station() const { return station; }
0205     int Ring() const { return ring; }
0206     int Sector() const { return sector; }
0207     int Sector_RPC() const { return sector_RPC; }
0208     int Sector_idx() const { return sector_idx; }
0209     int Subsector() const { return subsector; }
0210     int Subsector_RPC() const { return subsector_RPC; }
0211     int Chamber() const { return chamber; }
0212     int CSC_ID() const { return csc_ID; }
0213     int CSC_nID() const { return csc_nID; }
0214     int Roll() const { return roll; }
0215     int Neighbor() const { return neighbor; }
0216     int MPC_link() const { return mpc_link; }
0217     int PC_sector() const { return pc_sector; }
0218     int PC_station() const { return pc_station; }
0219     int PC_chamber() const { return pc_chamber; }
0220     int PC_segment() const { return pc_segment; }
0221     int Wire() const { return wire; }
0222     int Strip() const { return strip; }
0223     int Strip_hi() const { return strip_hi; }
0224     int Strip_low() const { return strip_low; }
0225     int Strip_quart() const { return strip_quart; }            // Run 3
0226     int Strip_eighth() const { return strip_eighth; }          // Run 3
0227     int Strip_quart_bit() const { return strip_quart_bit; }    // Run 3
0228     int Strip_eighth_bit() const { return strip_eighth_bit; }  // Run 3
0229     int Track_num() const { return track_num; }
0230     int Quality() const { return quality; }
0231     int Pattern() const { return pattern; }
0232     int Pattern_run3() const { return pattern_run3; }  // Run 3
0233     int Bend() const { return bend; }
0234     int Slope() const { return slope; }  // Run 3
0235     int Valid() const { return valid; }
0236     int Sync_err() const { return sync_err; }
0237     // GEM specific aliases for member variables that don't match GEM nomenclature
0238     /*
0239      * Each GEM pad is the OR of two neighbouring strips in phi.
0240      * For GE1/1 (10 degree chambers) this results in a total of 192 pads per eta partition
0241        * 128 strips per phi sector
0242        * 3 phi sectors per eta partition
0243      * For GE2/1 (20 degree chambers) this results in a total of 384 pads per eta partition
0244        * 128 strips per phi sector
0245        * 6 phi sectors per eta partition
0246      */
0247     /// Repurpose "strip" as GEM pad for GEM sourced hits
0248     int Pad() const { return Strip(); }
0249     /// Repurpose "strip" as GEM pad for GEM sourced hits
0250     int Pad_hi() const { return Strip_hi(); }
0251     /// Repurpose "strip" as GEM pad for GEM sourced hits
0252     int Pad_low() const { return Strip_low(); }
0253     /// "roll" corresponds to the GEM eta partition
0254     int Partition() const { return Roll(); }
0255     int Layer() const { return layer; }
0256     /// Repurpose "quality" as the GEM cluster_size (number of pads in the cluster)
0257     int ClusterSize() const { return Quality(); }
0258     /// Repurpose "track_num" as the GEM cluster_id
0259     int ClusterID() const { return Track_num(); }
0260     // END GEM specific
0261     int BC0() const { return bc0; }
0262     int BX() const { return bx; }
0263     int Stub_num() const { return stub_num; }
0264     int Phi_fp() const { return phi_fp; }
0265     int Theta_fp() const { return theta_fp; }
0266     int Zone_hit() const { return zone_hit; }
0267     int Zone_code() const { return zone_code; }
0268     int FS_segment() const { return fs_segment; }
0269     int FS_zone_code() const { return fs_zone_code; }
0270     int BT_station() const { return bt_station; }
0271     int BT_segment() const { return bt_segment; }
0272     float Phi_loc() const { return phi_loc; }
0273     float Phi_glob() const { return phi_glob; }
0274     float Theta() const { return theta; }
0275     float Eta() const { return eta; }
0276     float Time() const { return time; }
0277     float Phi_sim() const { return phi_sim; }
0278     float Theta_sim() const { return theta_sim; }
0279     float Eta_sim() const { return eta_sim; }
0280     float Rho_sim() const { return rho_sim; }
0281     float Z_sim() const { return z_sim; }
0282     int ALCT_quality() const { return alct_quality; }
0283     int CLCT_quality() const { return clct_quality; }
0284 
0285     bool Is_DT() const { return subsystem == l1tmu::kDT; }
0286     bool Is_CSC() const { return subsystem == l1tmu::kCSC; }
0287     bool Is_RPC() const { return subsystem == l1tmu::kRPC; }
0288     bool Is_GEM() const { return subsystem == l1tmu::kGEM; }
0289     bool Is_ME0() const { return subsystem == l1tmu::kME0; }
0290 
0291   private:
0292     //CSCDetId csc_DetId;
0293     //RPCDetId rpc_DetId;
0294     //GEMDetId gem_DetId;
0295     //CSCCorrelatedLCTDigi csc_LCTDigi;
0296     //RPCDigi rpc_Digi;
0297     //CPPFDigi cppf_Digi;
0298     //GEMPadDigiCluster gem_PadClusterDigi;
0299 
0300     uint32_t rawDetId;  ///< raw CMSSW DetId
0301     int subsystem;      ///<  0 -  4.  0 for DT, 1 for CSC, 2 for RPC, 3 for GEM, 4 for ME0
0302     int endcap;         ///<    +/-1.  For ME+ and ME-.
0303     int station;        ///<  1 -  4.
0304     int ring;  ///<  1 -  4.  ME1/1a is denoted as "Ring 4".  Should check dependence on input CSCDetId convention. - AWB 02.03.17
0305     int sector;      ///<  1 -  6.  CSC / GEM / EMTF sector convention: sector 1 starts at 15 degrees
0306     int sector_RPC;  ///<  1 -  6.  RPC sector convention (in CMSSW): sector 1 starts at -5 degrees
0307     int sector_idx;  ///<  0 - 11.  0 - 5 for ME+, 6 - 11 for ME-.  For neighbor hits, set by EMTF sector that received it.
0308     int subsector;  ///<  0 -  6.  In CSCs, 1 or 2 for ME1, 0 for ME2/3/4.
0309     int subsector_RPC;  ///<  0 -  6.  RPC sector convention (in CMSSW): subsector 3 is the first chamber in the EMTF sector.
0310     int chamber;        ///<  1 - 36.  Chamber 1 starts at -5 degrees.
0311     int csc_ID;         ///<  1 -  9.  For CSCs only.
0312     int csc_nID;        ///<  1 - 15.  For CSCs only.  Neighbors 10 - 15, 12 not filled.
0313     int roll;           ///<  1 -  3.  For RPCs only, sub-division of ring. (Range? - AWB 02.03.17)
0314     int neighbor;       ///<  0 or 1.  Filled in EMTFBlock(ME|GEM|RPC).cc
0315     int mpc_link;       ///<  1 -  3.  Filled in EMTFHit.cc from CSCCorrelatedLCTDigi
0316     int pc_sector;         ///<  1 -  6.  EMTF sector that received the LCT, even those sent from neighbor sectors.
0317     int pc_station;        ///<  0 -  5.  0 for ME1 subsector 1, 5 for neighbor hits.
0318     int pc_chamber;        ///<  0 -  8.
0319     int pc_segment;        ///<  0 -  3.
0320     int wire;              ///<  0 - 111  For CSCs only.
0321     int strip;             ///<  0 - 158  For CSCs only.
0322     int strip_hi;          ///<  ? -  ?.  For RPCs only, highest strip in a cluster.  (Range? - AWB 02.03.17)
0323     int strip_low;         ///<  ? -  ?.  For RPCs only, lowest strip in a cluster.  (Range? - AWB 02.03.17)
0324     int strip_quart;       ///< Run 3 CSC parameters
0325     int strip_eighth;      ///< Run 3 CSC parameters
0326     int strip_quart_bit;   ///< Run 3 CSC parameters
0327     int strip_eighth_bit;  ///< Run 3 CSC parameters
0328     int track_num;         ///<  ? -  ?.  For CSCs only.  (Range? - AWB 02.03.17)
0329     int quality;           ///<  0 - 15.  For CSCs only.
0330     int pattern;           ///<  0 - 10.  For CSCs only.
0331     int pattern_run3;      ///< Run 3 For CSC only.
0332     int bend;              ///<  0 or 1.  For CSCs only.
0333     int slope;             ///<  Run 3 For CSC only.
0334     int valid;             ///<  0 or 1.  For CSCs only (for now; could use to flag failing clusters? - AWB 02.03.17)
0335     int sync_err;          ///<  0 or 1.  For CSCs only.
0336     // GEM specific
0337     int layer;  ///<  0 -   1.  For GEMs only, superchamber detector layer (1 or 2).
0338     // END GEM specific
0339     int bc0;           ///<  0 or 1.  Only from unpacked data? - AWB 02.03.17
0340     int bx;            ///< -3 - +3.
0341     int stub_num;      ///<  0 or 1.  Only from unpacked data? - AWB 02.03.17
0342     int phi_fp;        ///<  0 - 4920
0343     int theta_fp;      ///<  0 - 127
0344     int zone_hit;      ///<  4 - 156  (Range? - AWB 02.03.17)
0345     int zone_code;     ///<  0 - 12.  (Range? - AWB 02.03.17)
0346     int fs_segment;    ///<  0 - 13.  (Range? - AWB 02.03.17)
0347     int fs_zone_code;  ///<  1 - 14.  (Range? - AWB 02.03.17)
0348     int bt_station;    ///<  0 -  4.
0349     int bt_segment;    ///<  0 - 25.  (Range? - AWB 02.03.17)
0350     float phi_loc;     ///< -20 - 60  (Range? - AWB 02.03.17)
0351     float phi_glob;    ///< +/-180.
0352     float theta;       ///< 0 - 90.
0353     float eta;         ///< +/-2.5.
0354     float time;        ///<  ? -  ?.  RPC time information (ns)
0355     float phi_sim;     ///< +/-180.
0356     float theta_sim;   ///< 0 - 90.
0357     float eta_sim;     ///< +/-2.5.
0358     float rho_sim;     ///<  ? -  ?.
0359     float z_sim;       ///<  ? -  ?.
0360     int alct_quality;  ///<  1 -  3.  For emulated CSC LCTs only, maps to number of ALCT layers (4 - 6).
0361     int clct_quality;  ///<  4 -  6.  For emulated CSC LCTs only, maps to number of CLCT layers (4 - 6).
0362 
0363   };  // End of class EMTFHit
0364 
0365   // Define a vector of EMTFHit
0366   typedef std::vector<EMTFHit> EMTFHitCollection;
0367 
0368 }  // End of namespace l1t
0369 
0370 #endif /* define DataFormats_L1TMuon_EMTFHit_h */