Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:35

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  * Updates by Giovanni Mocellin (UC Davis)
0011  */
0012 
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014 #include "DataFormats/MuonDetId/interface/GEMDetId.h"
0015 #include "DataFormats/GEMDigi/interface/GEMPadDigiCluster.h"
0016 #include "DataFormats/GEMDigi/interface/GEMPadDigi.h"
0017 #include "DataFormats/GEMDigi/interface/GEMCoPadDigi.h"
0018 
0019 class GEMInternalCluster {
0020 public:
0021   // constructor
0022   GEMInternalCluster(const GEMDetId& id1,
0023                      const GEMDetId& id2,
0024                      const GEMPadDigiCluster& cluster1,
0025                      const GEMPadDigiCluster& cluster2,
0026                      const unsigned delayGEMinOTMB,
0027                      const unsigned tmbL1aWindowSize);
0028 
0029   // empty object
0030   GEMInternalCluster();
0031 
0032   GEMDetId id1() const { return id1_; }
0033   GEMDetId id2() const { return id2_; }
0034   GEMPadDigiCluster cl1() const { return cl1_; }
0035   GEMPadDigiCluster cl2() const { return cl2_; }
0036   bool isMatchingLayer1() const { return isMatchingLayer1_; }
0037   bool isMatchingLayer2() const { return isMatchingLayer2_; }
0038 
0039   // setter for coincidence
0040   void set_coincidence(const bool isCoincidence) { isCoincidence_ = isCoincidence; }
0041 
0042   // setter for detIDs
0043   void set_matchingLayer1(const bool isMatching) { isMatchingLayer1_ = isMatching; }
0044   void set_matchingLayer2(const bool isMatching) { isMatchingLayer2_ = isMatching; }
0045 
0046   // an internal cluster is valid if at least one is valid
0047   bool isValid() const { return isValid_; }
0048 
0049   // return the centers of the pads
0050   GEMPadDigi mid1() const;
0051   GEMPadDigi mid2() const;
0052 
0053   // return the coincidence pad
0054   GEMCoPadDigi copad() const;
0055 
0056   int bx() const { return bx_; }
0057   int roll1() const { return id1_.roll(); }
0058   int roll2() const { return id2_.roll(); }
0059   int layer1_pad() const { return layer1_pad_; }
0060   int layer1_size() const { return layer1_size_; }
0061   int layer2_pad() const { return layer2_pad_; }
0062   int layer2_size() const { return layer2_size_; }
0063   int layer1_min_wg() const { return layer1_min_wg_; }
0064   int layer1_max_wg() const { return layer1_max_wg_; }
0065   int layer2_min_wg() const { return layer2_min_wg_; }
0066   int layer2_max_wg() const { return layer2_max_wg_; }
0067   bool isCoincidence() const { return isCoincidence_; }
0068 
0069   // return "key wiregroup" and "key half-strip" for a cluster
0070   // these are approximate numbers obviously for LCTs with lower quality
0071   unsigned getKeyWG() const { return (layer2_min_wg() + layer2_max_wg()) / 2.; }
0072   uint16_t getKeyStrip(int n = 2, bool isLayer2 = false) const;
0073   uint16_t getKeyStripME1a(int n = 2, bool isLayer2 = false) const;
0074 
0075   // first and last 1/8-strips
0076   int layer1_first_es() const { return layer1_first_es_; }
0077   int layer2_first_es() const { return layer2_first_es_; }
0078   int layer1_last_es() const { return layer1_last_es_; }
0079   int layer2_last_es() const { return layer2_last_es_; }
0080 
0081   int layer1_first_es_me1a() const { return layer1_first_es_me1a_; }
0082   int layer2_first_es_me1a() const { return layer2_first_es_me1a_; }
0083   int layer1_last_es_me1a() const { return layer1_last_es_me1a_; }
0084   int layer2_last_es_me1a() const { return layer2_last_es_me1a_; }
0085 
0086   // middle 1/8-strips (sum divided by two)
0087   int layer1_middle_es() const { return layer1_middle_es_; }
0088   int layer2_middle_es() const { return layer2_middle_es_; }
0089 
0090   int layer1_middle_es_me1a() const { return layer1_middle_es_me1a_; }
0091   int layer2_middle_es_me1a() const { return layer2_middle_es_me1a_; }
0092 
0093   // setters for first/last 1/8-strip
0094   void set_layer1_first_es(const int es) { layer1_first_es_ = es; }
0095   void set_layer2_first_es(const int es) { layer2_first_es_ = es; }
0096   void set_layer1_last_es(const int es) { layer1_last_es_ = es; }
0097   void set_layer2_last_es(const int es) { layer2_last_es_ = es; }
0098 
0099   void set_layer1_first_es_me1a(const int es) { layer1_first_es_me1a_ = es; }
0100   void set_layer2_first_es_me1a(const int es) { layer2_first_es_me1a_ = es; }
0101   void set_layer1_last_es_me1a(const int es) { layer1_last_es_me1a_ = es; }
0102   void set_layer2_last_es_me1a(const int es) { layer2_last_es_me1a_ = es; }
0103 
0104   // setters for middle 1/8-strip
0105   void set_layer1_middle_es(const int es) { layer1_middle_es_ = es; }
0106   void set_layer2_middle_es(const int es) { layer2_middle_es_ = es; }
0107   void set_layer1_middle_es_me1a(const int es) { layer1_middle_es_me1a_ = es; }
0108   void set_layer2_middle_es_me1a(const int es) { layer2_middle_es_me1a_ = es; }
0109 
0110   // set the corresponding wiregroup numbers
0111   void set_layer1_min_wg(const int wg) { layer1_min_wg_ = wg; }
0112   void set_layer1_max_wg(const int wg) { layer1_max_wg_ = wg; }
0113   void set_layer2_min_wg(const int wg) { layer2_min_wg_ = wg; }
0114   void set_layer2_max_wg(const int wg) { layer2_max_wg_ = wg; }
0115 
0116   bool has_cluster(const GEMPadDigiCluster& cluster) const;
0117 
0118   // equality operator: detid, cluster 1 and cluster 2
0119   bool operator==(const GEMInternalCluster& cluster) const;
0120 
0121 private:
0122   /*
0123     Detector id. For single clusters in layer 1 the GEMDetId in layer 1 is stored.
0124     Similarly, for single clusters in layer 2 the GEMDetId in layer 2 is stored.
0125     For coincidences the  GEMDetId both are stored.
0126   */
0127   GEMDetId id1_;
0128   GEMDetId id2_;
0129   GEMPadDigiCluster cl1_;
0130   GEMPadDigiCluster cl2_;
0131 
0132   // set matches to false first
0133   bool isMatchingLayer1_;
0134   bool isMatchingLayer2_;
0135 
0136   bool isValid_;
0137 
0138   // bunch crossing
0139   int bx_;
0140 
0141   // starting pads and sizes of the clusters in each layer
0142   // depending on the presence of a coincidence, layer 1, layer2, or both
0143   // can be filled
0144   int layer1_pad_;
0145   int layer1_size_;
0146   int layer2_pad_;
0147   int layer2_size_;
0148 
0149   // corresponding CSC 1/8-strip coordinates (es) of the cluster
0150   // in each layer (if applicable)
0151   int layer1_first_es_;
0152   int layer1_last_es_;
0153   int layer2_first_es_;
0154   int layer2_last_es_;
0155   // for ME1/a
0156   int layer1_first_es_me1a_;
0157   int layer1_last_es_me1a_;
0158   int layer2_first_es_me1a_;
0159   int layer2_last_es_me1a_;
0160 
0161   // middle CSC 1/8-strip
0162   int layer1_middle_es_;
0163   int layer2_middle_es_;
0164   // for ME1/a
0165   int layer1_middle_es_me1a_;
0166   int layer2_middle_es_me1a_;
0167 
0168   // corresponding min and max wiregroup
0169   int layer1_min_wg_;
0170   int layer1_max_wg_;
0171   int layer2_min_wg_;
0172   int layer2_max_wg_;
0173 
0174   // flag to signal if it is a coincidence
0175   bool isCoincidence_;
0176 };
0177 
0178 std::ostream& operator<<(std::ostream& os, const GEMInternalCluster& cl);
0179 
0180 #endif