File indexing completed on 2024-04-06 12:19:35
0001 #ifndef L1Trigger_CSCTriggerPrimitives_LCTQualityControl_h
0002 #define L1Trigger_CSCTriggerPrimitives_LCTQualityControl_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include "DataFormats/CSCDigi/interface/CSCCLCTDigi.h"
0015 #include "DataFormats/CSCDigi/interface/CSCALCTDigi.h"
0016 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h"
0017 #include "L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h"
0018
0019 #include <vector>
0020 #include <algorithm>
0021
0022 class LCTQualityControl : public CSCBaseboard {
0023 public:
0024
0025 LCTQualityControl(unsigned endcap,
0026 unsigned station,
0027 unsigned sector,
0028 unsigned subsector,
0029 unsigned chamber,
0030 CSCBaseboard::Parameters& conf);
0031
0032
0033 ~LCTQualityControl() override = default;
0034
0035
0036 void checkValidReadout(const CSCALCTDigi& alct) const;
0037 void checkValid(const CSCALCTDigi& alct, unsigned max_stubs = CSCConstants::MAX_ALCTS_PER_PROCESSOR) const;
0038
0039
0040 void checkValid(const CSCCLCTDigi& lct, unsigned max_stubs = CSCConstants::MAX_CLCTS_PER_PROCESSOR) const;
0041
0042
0043 void checkValid(const CSCCorrelatedLCTDigi& lct) const;
0044
0045
0046 void checkValid(const CSCCorrelatedLCTDigi& lct, const unsigned station, const unsigned ring) const;
0047
0048 void checkRange(int parameter, int min_value, int max_value, const std::string& comment, unsigned& errors) const;
0049
0050 template <class T>
0051 void reportErrors(const T& lct, const unsigned errors) const;
0052
0053
0054 void checkMultiplicityBX(const std::vector<CSCALCTDigi>& alcts) const;
0055 void checkMultiplicityBX(const std::vector<CSCCLCTDigi>& clcts) const;
0056 void checkMultiplicityBX(const std::vector<CSCCorrelatedLCTDigi>& lcts) const;
0057 template <class T>
0058 void checkMultiplicityBX(const std::vector<T>& lcts, unsigned nLCT) const;
0059
0060
0061 int getSlopePhase1(unsigned pattern) const;
0062
0063
0064
0065
0066
0067
0068 unsigned get_csc_max_wiregroup(unsigned station, unsigned ring) const;
0069 unsigned get_csc_max_halfstrip(unsigned station, unsigned ring) const;
0070 unsigned get_csc_max_quartstrip(unsigned station, unsigned ring) const;
0071 unsigned get_csc_max_eighthstrip(unsigned station, unsigned ring) const;
0072
0073
0074 std::pair<int, int> get_csc_clct_min_max_slope() const;
0075
0076
0077 std::pair<unsigned, unsigned> get_csc_min_max_cfeb() const;
0078
0079
0080 std::pair<unsigned, unsigned> get_csc_min_max_pattern() const;
0081 std::pair<unsigned, unsigned> get_csc_min_max_pattern_run3() const;
0082 std::pair<unsigned, unsigned> get_csc_lct_min_max_pattern() const;
0083
0084
0085
0086
0087
0088
0089
0090 std::pair<unsigned, unsigned> get_csc_alct_min_max_quality() const;
0091 std::pair<unsigned, unsigned> get_csc_clct_min_max_quality() const;
0092 std::pair<unsigned, unsigned> get_csc_lct_min_max_quality(unsigned station, unsigned ring) const;
0093
0094 private:
0095
0096 unsigned nplanes_clct_hit_pattern;
0097 };
0098
0099 template <class T>
0100 void LCTQualityControl::checkMultiplicityBX(const std::vector<T>& collection, unsigned nLCT) const {
0101 std::unordered_map<int, unsigned> freq;
0102
0103 for (const auto& p : collection) {
0104 if (p.isValid()) {
0105 freq[p.getBX()]++;
0106
0107
0108 if (freq[p.getBX()] > nLCT) {
0109 edm::LogError("LCTQualityControl") << "Collection with more than " << nLCT << " in BX " << p.getBX();
0110 break;
0111 }
0112 }
0113 }
0114 }
0115
0116 #endif