Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-24 02:52:14

0001 #ifndef L1Trigger_CSCTriggerPrimitives_GEMInternalCluster_h
0002 #define L1Trigger_CSCTriggerPrimitives_GEMInternalCluster_h
0003 
0004 /** \class GEMInternalCluster
0005  *
0006  * Helper class to contain detids, clusters and corresponding
0007  * 1/2-strips, 1/8-strips and wiregroups for easy matching with CSC TPs
0008  *
0009  * Author: Sven Dildick (Rice University)
0010  *
0011  */
0012 
0013 #include "DataFormats/MuonDetId/interface/GEMDetId.h"
0014 #include "DataFormats/GEMDigi/interface/GEMPadDigiCluster.h"
0015 #include "DataFormats/GEMDigi/interface/GEMPadDigi.h"
0016 #include "DataFormats/GEMDigi/interface/GEMCoPadDigi.h"
0017 
0018 class GEMInternalCluster {
0019 public:
0020   // constructor
0021   GEMInternalCluster(const GEMDetId& id, const GEMPadDigiCluster& cluster1, const GEMPadDigiCluster& cluster2);
0022 
0023   // empty object
0024   GEMInternalCluster();
0025 
0026   GEMDetId id() const { return id_; }
0027   GEMPadDigiCluster cl1() const { return cl1_; }
0028   GEMPadDigiCluster cl2() const { return cl2_; }
0029 
0030   // an internal cluster is valid if at least one is valid
0031   bool isValid() const { return isValid_; }
0032 
0033   // return the centers of the pads
0034   GEMPadDigi mid1() const;
0035   GEMPadDigi mid2() const;
0036 
0037   // return the coincidence pad
0038   GEMCoPadDigi copad() const;
0039 
0040   int bx() const { return bx_; }
0041   int roll() const { return id_.roll(); }
0042   int layer1_pad() const { return layer1_pad_; }
0043   int layer1_size() const { return layer1_size_; }
0044   int layer2_pad() const { return layer2_pad_; }
0045   int layer2_size() const { return layer2_size_; }
0046   int layer1_min_wg() const { return layer1_min_wg_; }
0047   int layer1_max_wg() const { return layer1_max_wg_; }
0048   int layer2_min_wg() const { return layer2_min_wg_; }
0049   int layer2_max_wg() const { return layer2_max_wg_; }
0050   int min_wg() const;
0051   int max_wg() const;
0052   bool isCoincidence() const { return isCoincidence_; }
0053 
0054   // return "key wiregroup" and "key half-strip" for a cluster
0055   // these are approximate numbers obviously for LCTs with lower quality
0056   unsigned getKeyWG() const { return (min_wg() + max_wg()) / 2.; }
0057   uint16_t getKeyStrip(int n = 2) const;
0058   uint16_t getKeyStripME1a(int n = 2) const;
0059 
0060   // first and last 1/2-strips
0061   int layer1_first_hs() const { return layer1_first_hs_; }
0062   int layer2_first_hs() const { return layer2_first_hs_; }
0063   int layer1_last_hs() const { return layer1_last_hs_; }
0064   int layer2_last_hs() const { return layer2_last_hs_; }
0065 
0066   int layer1_first_hs_me1a() const { return layer1_first_hs_me1a_; }
0067   int layer2_first_hs_me1a() const { return layer2_first_hs_me1a_; }
0068   int layer1_last_hs_me1a() const { return layer1_last_hs_me1a_; }
0069   int layer2_last_hs_me1a() const { return layer2_last_hs_me1a_; }
0070 
0071   // middle 1/2-strips (sum divided by two)
0072   int layer1_middle_hs() const { return layer1_middle_hs_; }
0073   int layer2_middle_hs() const { return layer2_middle_hs_; }
0074 
0075   int layer1_middle_hs_me1a() const { return layer1_middle_hs_me1a_; }
0076   int layer2_middle_hs_me1a() const { return layer2_middle_hs_me1a_; }
0077 
0078   // first and last 1/8-strips
0079   int layer1_first_es() const { return layer1_first_es_; }
0080   int layer2_first_es() const { return layer2_first_es_; }
0081   int layer1_last_es() const { return layer1_last_es_; }
0082   int layer2_last_es() const { return layer2_last_es_; }
0083 
0084   int layer1_first_es_me1a() const { return layer1_first_es_me1a_; }
0085   int layer2_first_es_me1a() const { return layer2_first_es_me1a_; }
0086   int layer1_last_es_me1a() const { return layer1_last_es_me1a_; }
0087   int layer2_last_es_me1a() const { return layer2_last_es_me1a_; }
0088 
0089   // middle 1/8-strips (sum divided by two)
0090   int layer1_middle_es() const { return layer1_middle_es_; }
0091   int layer2_middle_es() const { return layer2_middle_es_; }
0092 
0093   int layer1_middle_es_me1a() const { return layer1_middle_es_me1a_; }
0094   int layer2_middle_es_me1a() const { return layer2_middle_es_me1a_; }
0095 
0096   // setters for first/last 1/2-strip
0097   void set_layer1_first_hs(const int hs) { layer1_first_hs_ = hs; }
0098   void set_layer2_first_hs(const int hs) { layer2_first_hs_ = hs; }
0099   void set_layer1_last_hs(const int hs) { layer1_last_hs_ = hs; }
0100   void set_layer2_last_hs(const int hs) { layer2_last_hs_ = hs; }
0101 
0102   void set_layer1_first_hs_me1a(const int hs) { layer1_first_hs_me1a_ = hs; }
0103   void set_layer2_first_hs_me1a(const int hs) { layer2_first_hs_me1a_ = hs; }
0104   void set_layer1_last_hs_me1a(const int hs) { layer1_last_hs_me1a_ = hs; }
0105   void set_layer2_last_hs_me1a(const int hs) { layer2_last_hs_me1a_ = hs; }
0106 
0107   // setters for middle 1/2-strip
0108   void set_layer1_middle_hs(const int hs) { layer1_middle_hs_ = hs; }
0109   void set_layer2_middle_hs(const int hs) { layer2_middle_hs_ = hs; }
0110   void set_layer1_middle_hs_me1a(const int hs) { layer1_middle_hs_me1a_ = hs; }
0111   void set_layer2_middle_hs_me1a(const int hs) { layer2_middle_hs_me1a_ = hs; }
0112 
0113   // setters for first/last 1/8-strip
0114   void set_layer1_first_es(const int es) { layer1_first_es_ = es; }
0115   void set_layer2_first_es(const int es) { layer2_first_es_ = es; }
0116   void set_layer1_last_es(const int es) { layer1_last_es_ = es; }
0117   void set_layer2_last_es(const int es) { layer2_last_es_ = es; }
0118 
0119   void set_layer1_first_es_me1a(const int es) { layer1_first_es_me1a_ = es; }
0120   void set_layer2_first_es_me1a(const int es) { layer2_first_es_me1a_ = es; }
0121   void set_layer1_last_es_me1a(const int es) { layer1_last_es_me1a_ = es; }
0122   void set_layer2_last_es_me1a(const int es) { layer2_last_es_me1a_ = es; }
0123 
0124   // setters for middle 1/8-strip
0125   void set_layer1_middle_es(const int es) { layer1_middle_es_ = es; }
0126   void set_layer2_middle_es(const int es) { layer2_middle_es_ = es; }
0127   void set_layer1_middle_es_me1a(const int es) { layer1_middle_es_me1a_ = es; }
0128   void set_layer2_middle_es_me1a(const int es) { layer2_middle_es_me1a_ = es; }
0129 
0130   // set the corresponding wiregroup numbers
0131   void set_layer1_min_wg(const int wg) { layer1_min_wg_ = wg; }
0132   void set_layer1_max_wg(const int wg) { layer1_max_wg_ = wg; }
0133   void set_layer2_min_wg(const int wg) { layer2_min_wg_ = wg; }
0134   void set_layer2_max_wg(const int wg) { layer2_max_wg_ = wg; }
0135 
0136   bool has_cluster(const GEMPadDigiCluster& cluster) const;
0137 
0138   // equality operator: detid, cluster 1 and cluster 2
0139   bool operator==(const GEMInternalCluster& cluster) const;
0140 
0141 private:
0142   /*
0143     Detector id. There are three cases. For single clusters in layer 1
0144     the GEMDetId in layer 1 is stored. Similarly, for single clusters in
0145     layer 2 the GEMDetId in layer 2 is stored. For coincidences the  GEMDetId
0146     in layer 1 is stored
0147   */
0148   GEMDetId id_;
0149   GEMPadDigiCluster cl1_;
0150   GEMPadDigiCluster cl2_;
0151 
0152   bool isValid_;
0153 
0154   // bunch crossing
0155   int bx_;
0156 
0157   // starting pads and sizes of the clusters in each layer
0158   // depending on the presence of a coincidence, layer 1, layer2, or both
0159   // can be filled
0160   int layer1_pad_;
0161   int layer1_size_;
0162   int layer2_pad_;
0163   int layer2_size_;
0164 
0165   // corresponding CSC 1/2-strip coordinates (es) of the cluster
0166   // in each layer (if applicable)
0167   int layer1_first_hs_;
0168   int layer1_last_hs_;
0169   int layer2_first_hs_;
0170   int layer2_last_hs_;
0171   // for ME1/a
0172   int layer1_first_hs_me1a_;
0173   int layer1_last_hs_me1a_;
0174   int layer2_first_hs_me1a_;
0175   int layer2_last_hs_me1a_;
0176 
0177   // middle CSC 1/2-strip
0178   int layer1_middle_hs_;
0179   int layer2_middle_hs_;
0180   // for ME1/a
0181   int layer1_middle_hs_me1a_;
0182   int layer2_middle_hs_me1a_;
0183 
0184   // corresponding CSC 1/8-strip coordinates (es) of the cluster
0185   // in each layer (if applicable)
0186   int layer1_first_es_;
0187   int layer1_last_es_;
0188   int layer2_first_es_;
0189   int layer2_last_es_;
0190   // for ME1/a
0191   int layer1_first_es_me1a_;
0192   int layer1_last_es_me1a_;
0193   int layer2_first_es_me1a_;
0194   int layer2_last_es_me1a_;
0195 
0196   // middle CSC 1/8-strip
0197   int layer1_middle_es_;
0198   int layer2_middle_es_;
0199   // for ME1/a
0200   int layer1_middle_es_me1a_;
0201   int layer2_middle_es_me1a_;
0202 
0203   // corresponding min and max wiregroup
0204   int layer1_min_wg_;
0205   int layer1_max_wg_;
0206   int layer2_min_wg_;
0207   int layer2_max_wg_;
0208 
0209   // flag to signal if it is a coincidence
0210   bool isCoincidence_;
0211 };
0212 
0213 std::ostream& operator<<(std::ostream& os, const GEMInternalCluster& cl);
0214 
0215 #endif