CMS 3D CMS Logo

CSCUpgradeMotherboard.h
Go to the documentation of this file.
1 #ifndef L1Trigger_CSCTriggerPrimitives_CSCUpgradeMotherboard_h
2 #define L1Trigger_CSCTriggerPrimitives_CSCUpgradeMotherboard_h
3 
17 
18 // generic container type
19 namespace {
20 
21  // first: raw detid, second: digi
22  template <class T>
23  using match = std::pair<unsigned int, T>;
24 
25  // vector of template above
26  template <class T>
27  using matches = std::vector<std::pair<unsigned int, T> >;
28 
29  // first: BX number, second: vector of template above
30  template <class T>
31  using matchesBX = std::map<int, std::vector<std::pair<unsigned int, T> > >;
32 
33 } // namespace
34 
36 public:
37  // standard constructor
39  unsigned station,
40  unsigned sector,
41  unsigned subsector,
42  unsigned chamber,
43  const edm::ParameterSet& conf);
44 
45  //Default constructor for testing
47 
48  ~CSCUpgradeMotherboard() override;
49 
50  // Empty the LCT container
51  void clear();
52 
53  // Compare two matches of type <ID,DIGI>
54  // The template is match<GEMPadDigi> or match<GEMCoPadDigi>
55  template <class S>
56  bool compare(const S& p, const S& q) const;
57 
58  // Get the common matches of type <ID,DIGI>. Could be more than 1
59  // The template is matches<GEMPadDigi> or matches<GEMCoPadDigi>
60  template <class S>
61  void intersection(const S& d1, const S& d2, S& result) const;
62 
66  // generic sorting function
67  // provide an LCT collection and a sorting function
68  void sortLCTs(std::vector<CSCCorrelatedLCTDigi>& lcts,
69  bool (*sorter)(const CSCCorrelatedLCTDigi&, const CSCCorrelatedLCTDigi&)) const;
70 
72  enum CSCPart getCSCPart(int keystrip) const;
73 
74  // functions to setup geometry and LUTs
75  void setupGeometry();
76  void debugLUTs();
77 
78  // run TMB with GEM pad clusters as input
79  void run(const CSCWireDigiCollection* wiredc, const CSCComparatorDigiCollection* compdc) override;
80 
81  /* readout the two best LCTs in this CSC */
82  std::vector<CSCCorrelatedLCTDigi> readoutLCTs() const override;
83 
84 protected:
85  void correlateLCTs(const CSCALCTDigi& bestALCT,
86  const CSCALCTDigi& secondALCT,
87  const CSCCLCTDigi& bestCLCT,
88  const CSCCLCTDigi& secondCLCT,
90  CSCCorrelatedLCTDigi& lct2) const;
91 
93 
94  void setPrefIndex();
95 
99 
100  std::unique_ptr<CSCUpgradeMotherboardLUTGenerator> generator_;
101 
104 
107 
108  /* type of algorithm to sort the stubs */
109  unsigned int tmb_cross_bx_algo;
110 
112  unsigned int max_lcts;
113 
114  // debug gem matching
116 
117  // check look-up-tables
119 };
120 
121 template <class S>
122 bool CSCUpgradeMotherboard::compare(const S& p, const S& q) const {
123  return (p.first == q.first) and (p.second == q.second);
124 }
125 
126 template <class S>
127 void CSCUpgradeMotherboard::intersection(const S& d1, const S& d2, S& result) const {
128  for (const auto& p : d1) {
129  for (const auto& q : d2) {
130  if (compare(p, q)) {
131  result.push_back(p);
132  }
133  }
134  }
135 }
136 
137 #endif
std::unique_ptr< CSCUpgradeMotherboardLUTGenerator > generator_
bool compare(const S &p, const S &q) const
static bool sortLCTsByQuality(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
int pref[CSCConstants::MAX_LCT_TBINS]
static bool sortLCTsByGEMDphi(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
void correlateLCTs(const CSCALCTDigi &bestALCT, const CSCALCTDigi &secondALCT, const CSCCLCTDigi &bestCLCT, const CSCCLCTDigi &secondCLCT, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2) const
std::vector< CSCCorrelatedLCTDigi > readoutLCTs() const override
void intersection(const S &d1, const S &d2, S &result) const
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc) override
enum CSCPart getCSCPart(int keystrip) const
void sortLCTs(std::vector< CSCCorrelatedLCTDigi > &lcts, bool(*sorter)(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)) const