CMS 3D CMS Logo

LCTQualityControl.h
Go to the documentation of this file.
1 #ifndef L1Trigger_CSCTriggerPrimitives_LCTQualityControl_h
2 #define L1Trigger_CSCTriggerPrimitives_LCTQualityControl_h
3 
18 
19 #include <vector>
20 #include <algorithm>
21 
23 public:
24  // constructor
25  LCTQualityControl(unsigned endcap,
26  unsigned station,
27  unsigned sector,
28  unsigned subsector,
29  unsigned chamber,
31 
33  ~LCTQualityControl() override = default;
34 
35  // Check if the ALCT is valid
36  void checkValidReadout(const CSCALCTDigi& alct) const;
37  void checkValid(const CSCALCTDigi& alct, unsigned max_stubs = CSCConstants::MAX_ALCTS_PER_PROCESSOR) const;
38 
39  // Check if the CLCT is valid
40  void checkValid(const CSCCLCTDigi& lct, unsigned max_stubs = CSCConstants::MAX_CLCTS_PER_PROCESSOR) const;
41 
42  // Check if the LCT is valid - TMB version
43  void checkValid(const CSCCorrelatedLCTDigi& lct) const;
44 
45  // Check if the LCT is valid - MPC version
46  void checkValid(const CSCCorrelatedLCTDigi& lct, const unsigned station, const unsigned ring) const;
47 
48  void checkRange(int parameter, int min_value, int max_value, const std::string& comment, unsigned& errors) const;
49 
50  template <class T>
51  void reportErrors(const T& lct, const unsigned errors) const;
52 
53  // no more than 2 LCTs per BX in the readout
54  void checkMultiplicityBX(const std::vector<CSCALCTDigi>& alcts) const;
55  void checkMultiplicityBX(const std::vector<CSCCLCTDigi>& clcts) const;
56  void checkMultiplicityBX(const std::vector<CSCCorrelatedLCTDigi>& lcts) const;
57  template <class T>
58  void checkMultiplicityBX(const std::vector<T>& lcts, unsigned nLCT) const;
59 
60  // for Phase-1 patterns
61  int getSlopePhase1(unsigned pattern) const;
62 
63  /*
64  CSC max strip & max wire
65  Need to pass station and ring, because we want to reuse the LCTQualityControl in the
66  MPC where the station and ring are considered arguments, not data members.
67  */
68  unsigned get_csc_max_wiregroup(unsigned station, unsigned ring) const;
69  unsigned get_csc_max_halfstrip(unsigned station, unsigned ring) const;
70  unsigned get_csc_max_quartstrip(unsigned station, unsigned ring) const;
71  unsigned get_csc_max_eighthstrip(unsigned station, unsigned ring) const;
72 
73  // slope values
74  std::pair<int, int> get_csc_clct_min_max_slope() const;
75 
76  // CLCT min, max CFEB numbers
77  std::pair<unsigned, unsigned> get_csc_min_max_cfeb() const;
78 
79  // CSC min, max pattern
80  std::pair<unsigned, unsigned> get_csc_min_max_pattern() const;
81  std::pair<unsigned, unsigned> get_csc_min_max_pattern_run3() const;
82  std::pair<unsigned, unsigned> get_csc_lct_min_max_pattern() const;
83 
84  /*
85  CSC min, max quality
86  Need to pass station and ring for the LCT implementation, because we want to
87  reuse the LCTQualityControl in the MPC where the station and ring are considered
88  arguments, not data members.
89  */
90  std::pair<unsigned, unsigned> get_csc_alct_min_max_quality() const;
91  std::pair<unsigned, unsigned> get_csc_clct_min_max_quality() const;
92  std::pair<unsigned, unsigned> get_csc_lct_min_max_quality(unsigned station, unsigned ring) const;
93 
94 private:
95  // min number of layers for a CLCT
97 };
98 
99 template <class T>
100 void LCTQualityControl::checkMultiplicityBX(const std::vector<T>& collection, unsigned nLCT) const {
101  std::unordered_map<int, unsigned> freq;
102  // check each BX
103  for (const auto& p : collection) {
104  if (p.isValid()) {
105  freq[p.getBX()]++;
106 
107  // too many ALCTs, CLCTs or LCTs in this BX
108  if (freq[p.getBX()] > nLCT) {
109  edm::LogError("LCTQualityControl") << "Collection with more than " << nLCT << " in BX " << p.getBX();
110  break;
111  }
112  }
113  }
114 }
115 
116 #endif
unsigned nplanes_clct_hit_pattern
std::pair< unsigned, unsigned > get_csc_lct_min_max_quality(unsigned station, unsigned ring) const
std::pair< unsigned, unsigned > get_csc_min_max_pattern() const
void checkValid(const CSCALCTDigi &alct, unsigned max_stubs=CSCConstants::MAX_ALCTS_PER_PROCESSOR) const
std::pair< unsigned, unsigned > get_csc_min_max_pattern_run3() const
unsigned get_csc_max_halfstrip(unsigned station, unsigned ring) const
LCTQualityControl(unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, CSCBaseboard::Parameters &conf)
std::pair< unsigned, unsigned > get_csc_alct_min_max_quality() const
Log< level::Error, false > LogError
unsigned get_csc_max_eighthstrip(unsigned station, unsigned ring) const
const std::map< ValueQuantityType, double > min_value
~LCTQualityControl() override=default
std::pair< unsigned, unsigned > get_csc_min_max_cfeb() const
std::pair< unsigned, unsigned > get_csc_lct_min_max_pattern() const
unsigned get_csc_max_wiregroup(unsigned station, unsigned ring) const
void checkRange(int parameter, int min_value, int max_value, const std::string &comment, unsigned &errors) const
unsigned get_csc_max_quartstrip(unsigned station, unsigned ring) const
void reportErrors(const T &lct, const unsigned errors) const
int getSlopePhase1(unsigned pattern) const
void checkMultiplicityBX(const std::vector< CSCALCTDigi > &alcts) const
std::pair< int, int > get_csc_clct_min_max_slope() const
std::pair< unsigned, unsigned > get_csc_clct_min_max_quality() const
const std::map< ValueQuantityType, double > max_value
void checkValidReadout(const CSCALCTDigi &alct) const
Definition: errors.py:1
long double T