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 }
34 
35 class CSCGeometry;
36 class CSCChamber;
37 
39 {
40 public:
41 
44  class LCTContainer {
45  public:
46  // constructor
47  LCTContainer(unsigned int trig_window_size);
48 
49  // access the LCT in a particular ALCT BX, a particular CLCT matched BX
50  // and particular LCT number
51  CSCCorrelatedLCTDigi& operator()(int bx, int match_bx, int lct);
52 
53  // get the matching LCTs for a certain ALCT BX
54  void getTimeMatched(const int bx, std::vector<CSCCorrelatedLCTDigi>&) const;
55 
56  // get all LCTs in the 16 BX readout window
57  void getMatched(std::vector<CSCCorrelatedLCTDigi>&) const;
58 
59  // array with stored LCTs
61 
62  // matching trigger window
63  const unsigned int match_trig_window_size;
64  };
65 
66  // standard constructor
67  CSCUpgradeMotherboard(unsigned endcap, unsigned station, unsigned sector,
68  unsigned subsector, unsigned chamber,
69  const edm::ParameterSet& conf);
70 
71  //Default constructor for testing
73 
74  ~CSCUpgradeMotherboard() override;
75 
76  // Compare two matches of type <ID,DIGI>
77  // The template is match<GEMPadDigi> or match<GEMCoPadDigi>
78  template <class S>
79  bool compare(const S& p, const S& q) const;
80 
81  // Get the common matches of type <ID,DIGI>. Could be more than 1
82  // The template is matches<GEMPadDigi> or matches<GEMCoPadDigi>
83  template <class S>
84  void intersection(const S& d1, const S& d2, S& result) const;
85 
87  static bool sortLCTsByQuality(const CSCCorrelatedLCTDigi&,
88  const CSCCorrelatedLCTDigi&);
89  static bool sortLCTsByGEMDphi(const CSCCorrelatedLCTDigi&,
90  const CSCCorrelatedLCTDigi&);
91  // generic sorting function
92  // provide an LCT collection and a sorting function
93  void sortLCTs(std::vector<CSCCorrelatedLCTDigi>& lcts,
94  bool (*sorter)(const CSCCorrelatedLCTDigi&,
95  const CSCCorrelatedLCTDigi&)) const;
96 
97  // functions to setup geometry and LUTs
98  void setCSCGeometry(const CSCGeometry *g) { csc_g = g; }
99  void setupGeometry();
100  void debugLUTs();
101 
102  protected:
103 
105  unsigned theRegion;
106  unsigned theChamber;
108 
111 
114 
115  std::vector<CSCALCTDigi> alctV;
116 
117  std::unique_ptr<CSCUpgradeMotherboardLUTGenerator> generator_;
118 
121 
124 
128 
132 
133  unsigned int tmb_cross_bx_algo;
134 
136  unsigned int max_lcts;
137 
138  // debug gem matching
140 
141  // check look-up-tables
143 };
144 
145 template <class S>
146 bool CSCUpgradeMotherboard::compare(const S& p, const S& q) const
147 {
148  return (p.first == q.first) and (p.second == q.second);
149 }
150 
151 template <class S>
152 void CSCUpgradeMotherboard::intersection(const S& d1, const S& d2, S& result) const
153 {
154  for (const auto& p: d1){
155  for (const auto& q: d2){
156  if (compare(p,q)){
157  result.push_back(p);
158  }
159  }
160  }
161  }
162 
163 #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]
void setCSCGeometry(const CSCGeometry *g)
const CSCChamber * cscChamber
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
std::vector< CSCALCTDigi > alctV
void sortLCTs(std::vector< CSCCorrelatedLCTDigi > &lcts, bool(*sorter)(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)) const
LCTContainer(unsigned int trig_window_size)
const CSCGeometry * csc_g
edm::ParameterSet commonParams_
CSCCorrelatedLCTDigi data[CSCConstants::MAX_LCT_TBINS][15][2]
static bool sortLCTsByGEMDphi(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
void getTimeMatched(const int bx, std::vector< CSCCorrelatedLCTDigi > &) const
edm::ParameterSet tmbParams_
CSCCorrelatedLCTDigi & operator()(int bx, int match_bx, int lct)
void getMatched(std::vector< CSCCorrelatedLCTDigi > &) const
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