File indexing completed on 2024-04-06 12:19:34
0001 #ifndef L1Trigger_CSCTriggerPrimitives_CSCCathodeLCTProcessor_h
0002 #define L1Trigger_CSCTriggerPrimitives_CSCCathodeLCTProcessor_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 #include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h"
0034 #include "DataFormats/CSCDigi/interface/CSCCLCTDigi.h"
0035 #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigi.h"
0036 #include "DataFormats/CSCDigi/interface/CSCShowerDigi.h"
0037 #include "L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h"
0038 #include "L1Trigger/CSCTriggerPrimitives/interface/LCTQualityControl.h"
0039 #include "L1Trigger/CSCTriggerPrimitives/interface/ComparatorCodeLUT.h"
0040 #include "L1Trigger/CSCTriggerPrimitives/interface/PulseArray.h"
0041
0042 #include <vector>
0043
0044 class CSCCathodeLCTProcessor : public CSCBaseboard {
0045 public:
0046
0047 CSCCathodeLCTProcessor(unsigned endcap,
0048 unsigned station,
0049 unsigned sector,
0050 unsigned subsector,
0051 unsigned chamber,
0052 CSCBaseboard::Parameters& conf);
0053
0054
0055 ~CSCCathodeLCTProcessor() override = default;
0056
0057
0058 void setConfigParameters(const CSCDBL1TPParameters* conf);
0059
0060
0061 void clear();
0062
0063
0064
0065 std::vector<CSCCLCTDigi> run(const CSCComparatorDigiCollection* compdc,
0066 const CSCChamber* chamber,
0067 const CSCL1TPLookupTableCCLUT* lookupTable);
0068
0069
0070
0071 void run(const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER],
0072 const CSCL1TPLookupTableCCLUT* lookupTable);
0073
0074
0075 std::vector<CSCCLCTDigi> readoutCLCTs() const;
0076
0077
0078 std::vector<CSCCLCTDigi> getCLCTs() const;
0079
0080
0081
0082 CSCCLCTDigi getBestCLCT(int bx) const;
0083 CSCCLCTDigi getSecondCLCT(int bx) const;
0084
0085
0086 bool getLocalShowerFlag(int bx) const;
0087
0088 std::vector<int> preTriggerBXs() const { return thePreTriggerBXs; }
0089
0090
0091 std::vector<CSCCLCTPreTriggerDigi> preTriggerDigis() const { return thePreTriggerDigis; }
0092
0093
0094
0095
0096
0097 std::vector<CSCShowerDigi> getAllShower() const;
0098
0099
0100 std::vector<CSCShowerDigi> readoutShower() const;
0101
0102 protected:
0103
0104 CSCCLCTDigi bestCLCT[CSCConstants::MAX_CLCT_TBINS];
0105
0106
0107 CSCCLCTDigi secondCLCT[CSCConstants::MAX_CLCT_TBINS];
0108
0109 CSCShowerDigi cathode_showers_[CSCConstants::MAX_CLCT_TBINS];
0110
0111
0112
0113 bool localShowerFlag[CSCConstants::MAX_CLCT_TBINS];
0114
0115
0116 bool getDigis(const CSCComparatorDigiCollection* compdc);
0117 void getDigis(const CSCComparatorDigiCollection* compdc, const CSCDetId& id);
0118
0119
0120 void setDefaultConfigParameters();
0121
0122
0123 void checkConfigParameters();
0124
0125
0126
0127
0128
0129 void readComparatorDigis(
0130 std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]);
0131 void pulseExtension(
0132 const std::vector<int> time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]);
0133
0134
0135 virtual std::vector<CSCCLCTDigi> findLCTs(
0136 const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER],
0137 const CSCL1TPLookupTableCCLUT* lookupTable);
0138
0139
0140
0141 virtual bool preTrigger(const int start_bx, int& first_bx);
0142
0143
0144
0145 bool patternFinding(const unsigned int bx_time,
0146 std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer> >& hits_in_patterns);
0147
0148 void cleanComparatorContainer(CSCCLCTDigi& lct) const;
0149
0150
0151 void markBusyKeys(const int best_hstrip,
0152 const int best_patid,
0153 int quality[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]);
0154
0155
0156 CSCCLCTDigi constructCLCT(const int bx,
0157 const unsigned halfstrip_withstagger,
0158 const CSCCLCTDigi::ComparatorContainer& hits,
0159 const CSCL1TPLookupTableCCLUT* lookupTable);
0160
0161
0162 CSCCLCTPreTriggerDigi constructPreCLCT(const int bx, const unsigned halfstrip, const unsigned index) const;
0163
0164
0165 void clearPreTriggers();
0166
0167
0168 void dumpConfigParams() const;
0169
0170
0171 void dumpDigis(
0172 const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) const;
0173
0174
0175 void checkLocalShower(
0176 int zone,
0177 const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]);
0178
0179 void encodeHighMultiplicityBits();
0180
0181
0182
0183 PulseArray pulse_;
0184
0185
0186 unsigned int best_pid[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER];
0187
0188
0189 unsigned int nhits[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER];
0190
0191
0192 bool ispretrig_[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER];
0193
0194
0195 CSCPatternBank::LCTPatterns clct_pattern_ = {};
0196
0197
0198 int numStrips_;
0199 int numCFEBs_;
0200 int numHalfStrips_;
0201
0202
0203 int stagger[CSCConstants::NUM_LAYERS];
0204
0205 std::vector<CSCComparatorDigi> digiV[CSCConstants::NUM_LAYERS];
0206 std::vector<int> thePreTriggerBXs;
0207 std::vector<CSCCLCTPreTriggerDigi> thePreTriggerDigis;
0208
0209
0210 std::vector<unsigned> thresholds_;
0211 unsigned showerNumTBins_;
0212 unsigned minLayersCentralTBin_;
0213 unsigned minbx_readout_;
0214 unsigned maxbx_readout_;
0215
0216 bool peakCheck_;
0217
0218
0219 unsigned int fifo_tbins, fifo_pretrig;
0220 unsigned int hit_persist, drift_delay;
0221 unsigned int nplanes_hit_pretrig, nplanes_hit_pattern;
0222 unsigned int pid_thresh_pretrig, min_separation;
0223 unsigned int tmb_l1a_window_size;
0224
0225
0226 int start_bx_shift;
0227
0228
0229 int localShowerZone;
0230
0231
0232 int localShowerThresh;
0233
0234
0235 int early_tbins;
0236
0237
0238 bool readout_earliest_2;
0239
0240
0241 static const unsigned int def_fifo_tbins, def_fifo_pretrig;
0242 static const unsigned int def_hit_persist, def_drift_delay;
0243 static const unsigned int def_nplanes_hit_pretrig;
0244 static const unsigned int def_nplanes_hit_pattern;
0245 static const unsigned int def_pid_thresh_pretrig, def_min_separation;
0246 static const unsigned int def_tmb_l1a_window_size;
0247
0248
0249 std::unique_ptr<LCTQualityControl> qualityControl_;
0250
0251
0252 std::unique_ptr<ComparatorCodeLUT> cclut_;
0253 };
0254
0255 #endif