Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:35:55

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