CMS 3D CMS Logo

CSCCathodeLCTProcessor.h
Go to the documentation of this file.
1 #ifndef L1Trigger_CSCTriggerPrimitives_CSCCathodeLCTProcessor_h
2 #define L1Trigger_CSCTriggerPrimitives_CSCCathodeLCTProcessor_h
3 
39 
40 #include <vector>
41 #include <array>
42 #include <string>
43 
45 public:
48  unsigned station,
49  unsigned sector,
50  unsigned subsector,
51  unsigned chamber,
52  const edm::ParameterSet& conf);
53 
56 
58  ~CSCCathodeLCTProcessor() override = default;
59 
61  void setConfigParameters(const CSCDBL1TPParameters* conf);
62 
64  void clear();
65 
68  std::vector<CSCCLCTDigi> run(const CSCComparatorDigiCollection* compdc);
69 
72  void run(const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
73 
75  std::vector<CSCCLCTDigi> readoutCLCTs(int nMaxCLCTs = CSCConstants::MAX_CLCTS_READOUT) const;
76  std::vector<CSCCLCTDigi> readoutCLCTsME1a(int nMaxCLCTs = CSCConstants::MAX_CLCTS_READOUT) const;
77  std::vector<CSCCLCTDigi> readoutCLCTsME1b(int nMaxCLCTs = CSCConstants::MAX_CLCTS_READOUT) const;
78 
80  std::vector<CSCCLCTDigi> getCLCTs(unsigned nMaxCLCTs = CSCConstants::MAX_CLCTS_PER_PROCESSOR) const;
81 
84  CSCCLCTDigi getBestCLCT(int bx) const;
85  CSCCLCTDigi getSecondCLCT(int bx) const;
86 
87  std::vector<int> preTriggerBXs() const { return thePreTriggerBXs; }
88 
90  std::vector<CSCCLCTPreTriggerDigi> preTriggerDigis() const { return thePreTriggerDigis; }
91  std::vector<CSCCLCTPreTriggerDigi> preTriggerDigisME1a() const;
92  std::vector<CSCCLCTPreTriggerDigi> preTriggerDigisME1b() const;
93 
94 protected:
97 
100 
101  // unique pointers to the luts
102  std::array<std::unique_ptr<CSCComparatorCodeLUT>, 5> lutpos_;
103  std::array<std::unique_ptr<CSCComparatorCodeLUT>, 5> lutslope_;
104  std::array<std::unique_ptr<CSCComparatorCodeLUT>, 5> lutpatconv_;
105 
107  bool getDigis(const CSCComparatorDigiCollection* compdc);
108  void getDigis(const CSCComparatorDigiCollection* compdc, const CSCDetId& id);
109 
112 
114  void checkConfigParameters();
115 
117 
118  //---------------- Methods common to all firmware versions ------------------
119  // Single-argument version for TMB07 (halfstrip-only) firmware.
120  // Takes the comparator & time info and stuffs it into halfstrip vector.
121  // Multiple hits on the same strip are allowed.
124  PulseArray pulse);
125 
126  //--------------- Functions for post-2007 version of the firmware -----------
127  virtual std::vector<CSCCLCTDigi> findLCTs(
128  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
129 
130  /* Check all half-strip pattern envelopes simultaneously, on every clock cycle, for a matching pattern */
131  virtual bool preTrigger(const PulseArray pulse, const int start_bx, int& first_bx);
132 
133  /* For a given clock cycle, check each half-strip if a pattern matches */
134  bool patternFinding(const PulseArray pulse,
135  const unsigned int bx_time,
136  std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer> >& hits_in_patterns);
137 
138  // enum used in the comparator code logic
140 
141  void cleanComparatorContainer(CSCCLCTDigi& lct) const;
142 
143  /* Mark the half-strips around the best half-strip as busy */
144  void markBusyKeys(const int best_hstrip, const int best_patid, int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
145 
146  //--------------------------- Auxiliary methods -----------------------------
148  void dumpConfigParams() const;
149 
152 
153  // --------Functions for the comparator code algorith for Run-3 ---------//
154  //calculates the id based on location of hits
155  int calculateComparatorCode(const std::array<std::array<int, 3>, 6>& halfStripPattern) const;
156 
157  // sets the 1/4 and 1/8 strip bits given a floating point position offset
158  void assignPositionCC(const unsigned offset, std::tuple<int16_t, bool, bool>& returnValue) const;
159 
160  // runs the CCLUT procedure
161  void runCCLUT(CSCCLCTDigi& digi) const;
162 
163  unsigned convertSlopeToRun2Pattern(const unsigned slope) const;
164  //--------------------------- Member variables -----------------------------
165 
166  /* best pattern Id for a given half-strip */
168 
169  /* number of layers hit on a given half-strip */
171 
173 
174  /* does a given half-strip have a pre-trigger? */
176 
177  // actual LUT used
179 
180  // we use these next ones to address the various bits inside the array that's
181  // used to make the cathode LCTs.
191  };
192 
193  /* number of strips used in this processor */
197 
198  /* Is the layer in the chamber staggered? */
200 
201  std::vector<CSCComparatorDigi> digiV[CSCConstants::NUM_LAYERS];
202  std::vector<int> thePreTriggerBXs;
203  std::vector<CSCCLCTPreTriggerDigi> thePreTriggerDigis;
204 
206  unsigned int fifo_tbins, fifo_pretrig; // only for test beam mode.
207  unsigned int hit_persist, drift_delay;
210  unsigned int tmb_l1a_window_size;
211 
214 
217 
220 
222  static const unsigned int def_fifo_tbins, def_fifo_pretrig;
223  static const unsigned int def_hit_persist, def_drift_delay;
224  static const unsigned int def_nplanes_hit_pretrig;
225  static const unsigned int def_nplanes_hit_pattern;
226  static const unsigned int def_pid_thresh_pretrig, def_min_separation;
227  static const unsigned int def_tmb_l1a_window_size;
228 
229  std::vector<std::string> positionLUTFiles_;
230  std::vector<std::string> slopeLUTFiles_;
231  std::vector<std::string> patternConversionLUTFiles_;
232 
233  /* quality control */
234  std::unique_ptr<LCTQualityControl> qualityControl_;
235 };
236 
237 #endif
CSCDBL1TPParameters
Definition: CSCDBL1TPParameters.h:14
CSCCathodeLCTProcessor::qualityControl_
std::unique_ptr< LCTQualityControl > qualityControl_
Definition: CSCCathodeLCTProcessor.h:234
CSCCathodeLCTProcessor::markBusyKeys
void markBusyKeys(const int best_hstrip, const int best_patid, int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS])
Definition: CSCCathodeLCTProcessor.cc:1016
CSCComparatorCodeLUT.h
CSCCathodeLCTProcessor::numStrips_
int numStrips_
Definition: CSCCathodeLCTProcessor.h:194
CSCCathodeLCTProcessor::assignPositionCC
void assignPositionCC(const unsigned offset, std::tuple< int16_t, bool, bool > &returnValue) const
Definition: CSCCathodeLCTProcessor.cc:1304
CSCCathodeLCTProcessor::stagger
int stagger[CSCConstants::NUM_LAYERS]
Definition: CSCCathodeLCTProcessor.h:199
CSCCathodeLCTProcessor::getSecondCLCT
CSCCLCTDigi getSecondCLCT(int bx) const
Definition: CSCCathodeLCTProcessor.cc:1261
CSCCathodeLCTProcessor
Definition: CSCCathodeLCTProcessor.h:44
CSCCathodeLCTProcessor::dumpConfigParams
void dumpConfigParams() const
Definition: CSCCathodeLCTProcessor.cc:1043
relativeConstraints.station
station
Definition: relativeConstraints.py:67
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
CSCCathodeLCTProcessor::fifo_tbins
unsigned int fifo_tbins
Definition: CSCCathodeLCTProcessor.h:206
CSCCathodeLCTProcessor::dumpDigis
void dumpDigis(const std::vector< int > strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]) const
Definition: CSCCathodeLCTProcessor.cc:1062
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
pulse
double pulse(double x, double y, double z, double t)
Definition: SiStripPulseShape.cc:49
CSCCathodeLCTProcessor::readComparatorDigis
void readComparatorDigis(std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
Definition: CSCCathodeLCTProcessor.cc:455
protons_cff.time
time
Definition: protons_cff.py:39
CSCCathodeLCTProcessor::readoutCLCTs
std::vector< CSCCLCTDigi > readoutCLCTs(int nMaxCLCTs=CSCConstants::MAX_CLCTS_READOUT) const
Definition: CSCCathodeLCTProcessor.cc:1103
mps_check.array
array
Definition: mps_check.py:216
CSCCathodeLCTProcessor::CLCT_PATTERN
Definition: CSCCathodeLCTProcessor.h:183
CSCCathodeLCTProcessor::getDigis
bool getDigis(const CSCComparatorDigiCollection *compdc)
Definition: CSCCathodeLCTProcessor.cc:406
CSCCathodeLCTProcessor::def_nplanes_hit_pattern
static const unsigned int def_nplanes_hit_pattern
Definition: CSCCathodeLCTProcessor.h:225
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
CSCCathodeLCTProcessor::patternConversionLUTFiles_
std::vector< std::string > patternConversionLUTFiles_
Definition: CSCCathodeLCTProcessor.h:231
CSCCathodeLCTProcessor::patternFinding
bool patternFinding(const PulseArray pulse, const unsigned int bx_time, std::map< int, std::map< int, CSCCLCTDigi::ComparatorContainer > > &hits_in_patterns)
Definition: CSCCathodeLCTProcessor.cc:870
CSCCathodeLCTProcessor::def_drift_delay
static const unsigned int def_drift_delay
Definition: CSCCathodeLCTProcessor.h:223
CSCCLCTDigi
Definition: CSCCLCTDigi.h:17
CSCConstants::MAX_CLCTS_PER_PROCESSOR
Definition: CSCConstants.h:69
CSCCathodeLCTProcessor::lutslope_
std::array< std::unique_ptr< CSCComparatorCodeLUT >, 5 > lutslope_
Definition: CSCCathodeLCTProcessor.h:103
CSCCathodeLCTProcessor::early_tbins
int early_tbins
Definition: CSCCathodeLCTProcessor.h:216
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:109
CSCCathodeLCTProcessor::setConfigParameters
void setConfigParameters(const CSCDBL1TPParameters *conf)
Definition: CSCCathodeLCTProcessor.cc:152
CSCCathodeLCTProcessor::def_fifo_tbins
static const unsigned int def_fifo_tbins
Definition: CSCCathodeLCTProcessor.h:222
CSCCathodeLCTProcessor::slopeLUTFiles_
std::vector< std::string > slopeLUTFiles_
Definition: CSCCathodeLCTProcessor.h:230
CSCCathodeLCTProcessor::thePreTriggerDigis
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis
Definition: CSCCathodeLCTProcessor.h:203
CSCCathodeLCTProcessor::readout_earliest_2
bool readout_earliest_2
Definition: CSCCathodeLCTProcessor.h:219
CSCCathodeLCTProcessor::INVALID_HALFSTRIP
Definition: CSCCathodeLCTProcessor.h:139
CSCCathodeLCTProcessor::getBestCLCT
CSCCLCTDigi getBestCLCT(int bx) const
Definition: CSCCathodeLCTProcessor.cc:1255
CSCCathodeLCTProcessor::ispretrig
bool ispretrig[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
Definition: CSCCathodeLCTProcessor.h:175
CSCCathodeLCTProcessor::lutpos_
std::array< std::unique_ptr< CSCComparatorCodeLUT >, 5 > lutpos_
Definition: CSCCathodeLCTProcessor.h:102
CSCCathodeLCTProcessor::bestCLCT
CSCCLCTDigi bestCLCT[CSCConstants::MAX_CLCT_TBINS]
Definition: CSCCathodeLCTProcessor.h:96
CSCCathodeLCTProcessor::findLCTs
virtual std::vector< CSCCLCTDigi > findLCTs(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
Definition: CSCCathodeLCTProcessor.cc:547
CSCCathodeLCTProcessor::numHalfStrips_
int numHalfStrips_
Definition: CSCCathodeLCTProcessor.h:196
CSCConstants::NUM_LAYERS
Definition: CSCConstants.h:46
CSCCathodeLCTProcessor::first_bx_corrected
int first_bx_corrected[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
Definition: CSCCathodeLCTProcessor.h:172
CSCCathodeLCTProcessor::thePreTriggerBXs
std::vector< int > thePreTriggerBXs
Definition: CSCCathodeLCTProcessor.h:202
CSCCathodeLCTProcessor::def_fifo_pretrig
static const unsigned int def_fifo_pretrig
Definition: CSCCathodeLCTProcessor.h:222
CSCCathodeLCTProcessor::def_hit_persist
static const unsigned int def_hit_persist
Definition: CSCCathodeLCTProcessor.h:223
CSCCathodeLCTProcessor::preTrigger
virtual bool preTrigger(const PulseArray pulse, const int start_bx, int &first_bx)
Definition: CSCCathodeLCTProcessor.cc:811
CSCCathodeLCTProcessor::nhits
unsigned int nhits[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
Definition: CSCCathodeLCTProcessor.h:170
CSCCathodeLCTProcessor::def_min_separation
static const unsigned int def_min_separation
Definition: CSCCathodeLCTProcessor.h:226
CSCCathodeLCTProcessor::convertSlopeToRun2Pattern
unsigned convertSlopeToRun2Pattern(const unsigned slope) const
Definition: CSCCathodeLCTProcessor.cc:1456
CSCCathodeLCTProcessor::CLCT_CFEB
Definition: CSCCathodeLCTProcessor.h:189
CSCCathodeLCTProcessor::run
std::vector< CSCCLCTDigi > run(const CSCComparatorDigiCollection *compdc)
Definition: CSCCathodeLCTProcessor.cc:211
CSCCathodeLCTProcessor::CLCT_STRIP
Definition: CSCCathodeLCTProcessor.h:185
edm::ParameterSet
Definition: ParameterSet.h:47
CSCCathodeLCTProcessor::preTriggerDigis
std::vector< CSCCLCTPreTriggerDigi > preTriggerDigis() const
Definition: CSCCathodeLCTProcessor.h:90
CSCCathodeLCTProcessor::preTriggerBXs
std::vector< int > preTriggerBXs() const
Definition: CSCCathodeLCTProcessor.h:87
CSCCathodeLCTProcessor::lutpatconv_
std::array< std::unique_ptr< CSCComparatorCodeLUT >, 5 > lutpatconv_
Definition: CSCCathodeLCTProcessor.h:104
CSCCathodeLCTProcessor::CLCT_BEND
Definition: CSCCathodeLCTProcessor.h:184
CSCBaseboard
Definition: CSCBaseboard.h:14
CSCCathodeLCTProcessor::CLCT_QUALITY
Definition: CSCCathodeLCTProcessor.h:188
CSCCathodeLCTProcessor::secondCLCT
CSCCLCTDigi secondCLCT[CSCConstants::MAX_CLCT_TBINS]
Definition: CSCCathodeLCTProcessor.h:99
CSCCathodeLCTProcessor::digiV
std::vector< CSCComparatorDigi > digiV[CSCConstants::NUM_LAYERS]
Definition: CSCCathodeLCTProcessor.h:201
CSCDetId
Definition: CSCDetId.h:26
CSCCathodeLCTProcessor::cleanComparatorContainer
void cleanComparatorContainer(CSCCLCTDigi &lct) const
Definition: CSCCathodeLCTProcessor.cc:1029
CSCCathodeLCTProcessor::CLCT_INDICES
CLCT_INDICES
Definition: CSCCathodeLCTProcessor.h:182
CSCCathodeLCTProcessor::def_pid_thresh_pretrig
static const unsigned int def_pid_thresh_pretrig
Definition: CSCCathodeLCTProcessor.h:226
CSCCathodeLCTProcessor::positionLUTFiles_
std::vector< std::string > positionLUTFiles_
Definition: CSCCathodeLCTProcessor.h:229
CSCCathodeLCTProcessor::tmb_l1a_window_size
unsigned int tmb_l1a_window_size
Definition: CSCCathodeLCTProcessor.h:210
CSCCathodeLCTProcessor::readoutCLCTsME1a
std::vector< CSCCLCTDigi > readoutCLCTsME1a(int nMaxCLCTs=CSCConstants::MAX_CLCTS_READOUT) const
Definition: CSCCathodeLCTProcessor.cc:1192
CSCComparatorDigiCollection
CSCCathodeLCTProcessor::def_nplanes_hit_pretrig
static const unsigned int def_nplanes_hit_pretrig
Definition: CSCCathodeLCTProcessor.h:224
CSCCLCTPreTriggerDigi.h
CSCCathodeLCTProcessor::hit_persist
unsigned int hit_persist
Definition: CSCCathodeLCTProcessor.h:207
CSCPatternBank::LCTPatterns
std::vector< LCTPattern > LCTPatterns
Definition: CSCPatternBank.h:15
CSCCathodeLCTProcessor::calculateComparatorCode
int calculateComparatorCode(const std::array< std::array< int, 3 >, 6 > &halfStripPattern) const
Definition: CSCCathodeLCTProcessor.cc:1269
CSCCathodeLCTProcessor::pid_thresh_pretrig
unsigned int pid_thresh_pretrig
Definition: CSCCathodeLCTProcessor.h:209
CSCCathodeLCTProcessor::PulseArray
unsigned int PulseArray[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]
Definition: CSCCathodeLCTProcessor.h:116
CSCCathodeLCTProcessor::readoutCLCTsME1b
std::vector< CSCCLCTDigi > readoutCLCTsME1b(int nMaxCLCTs=CSCConstants::MAX_CLCTS_READOUT) const
Definition: CSCCathodeLCTProcessor.cc:1205
CSCCathodeLCTProcessor::clear
void clear()
Definition: CSCCathodeLCTProcessor.cc:202
CSCCathodeLCTProcessor::setDefaultConfigParameters
void setDefaultConfigParameters()
Definition: CSCCathodeLCTProcessor.cc:138
CSCCathodeLCTProcessor::preTriggerDigisME1b
std::vector< CSCCLCTPreTriggerDigi > preTriggerDigisME1b() const
Definition: CSCCathodeLCTProcessor.cc:1227
CSCCathodeLCTProcessor::def_tmb_l1a_window_size
static const unsigned int def_tmb_l1a_window_size
Definition: CSCCathodeLCTProcessor.h:227
CSCCathodeLCTProcessor::fifo_pretrig
unsigned int fifo_pretrig
Definition: CSCCathodeLCTProcessor.h:206
CSCCathodeLCTProcessor::best_pid
unsigned int best_pid[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
Definition: CSCCathodeLCTProcessor.h:167
CSCConstants::MAX_CLCTS_READOUT
Definition: CSCConstants.h:70
CSCCathodeLCTProcessor::CLCT_CompCode
CLCT_CompCode
Definition: CSCCathodeLCTProcessor.h:139
CSCCathodeLCTProcessor::start_bx_shift
int start_bx_shift
Definition: CSCCathodeLCTProcessor.h:213
CSCCathodeLCTProcessor::~CSCCathodeLCTProcessor
~CSCCathodeLCTProcessor() override=default
CSCCathodeLCTProcessor::preTriggerDigisME1a
std::vector< CSCCLCTPreTriggerDigi > preTriggerDigisME1a() const
Definition: CSCCathodeLCTProcessor.cc:1216
CSCCathodeLCTProcessor::CSCCathodeLCTProcessor
CSCCathodeLCTProcessor()
Definition: CSCCathodeLCTProcessor.cc:107
CSCCathodeLCTProcessor::pulseExtension
void pulseExtension(const std::vector< int > time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], PulseArray pulse)
Definition: CSCCathodeLCTProcessor.cc:767
CSCCathodeLCTProcessor::nplanes_hit_pretrig
unsigned int nplanes_hit_pretrig
Definition: CSCCathodeLCTProcessor.h:208
CSCCLCTDigi.h
CSCConstants::MAX_CLCT_TBINS
Definition: CSCConstants.h:63
CSCCathodeLCTProcessor::numCFEBs_
int numCFEBs_
Definition: CSCCathodeLCTProcessor.h:195
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
CSCComparatorDigiCollection.h
CSCConstants::NUM_HALF_STRIPS_7CFEBS
Definition: CSCConstants.h:28
CSCCathodeLCTProcessor::min_separation
unsigned int min_separation
Definition: CSCCathodeLCTProcessor.h:209
genParticles_cff.map
map
Definition: genParticles_cff.py:11
CSCCathodeLCTProcessor::runCCLUT
void runCCLUT(CSCCLCTDigi &digi) const
Definition: CSCCathodeLCTProcessor.cc:1347
slope
static const double slope[3]
Definition: CastorTimeSlew.cc:6
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
CSCCathodeLCTProcessor::getCLCTs
std::vector< CSCCLCTDigi > getCLCTs(unsigned nMaxCLCTs=CSCConstants::MAX_CLCTS_PER_PROCESSOR) const
Definition: CSCCathodeLCTProcessor.cc:1239
CSCCathodeLCTProcessor::checkConfigParameters
void checkConfigParameters()
Definition: CSCCathodeLCTProcessor.cc:172
CSCCathodeLCTProcessor::CLCT_STRIP_TYPE
Definition: CSCCathodeLCTProcessor.h:187
CSCCathodeLCTProcessor::drift_delay
unsigned int drift_delay
Definition: CSCCathodeLCTProcessor.h:207
CSCCathodeLCTProcessor::nplanes_hit_pattern
unsigned int nplanes_hit_pattern
Definition: CSCCathodeLCTProcessor.h:208
CSCCathodeLCTProcessor::CLCT_BX
Definition: CSCCathodeLCTProcessor.h:186
CSCCathodeLCTProcessor::clct_pattern_
CSCPatternBank::LCTPatterns clct_pattern_
Definition: CSCCathodeLCTProcessor.h:178
LCTQualityControl.h
CSCBaseboard.h
CSCCathodeLCTProcessor::CLCT_NUM_QUANTITIES
Definition: CSCCathodeLCTProcessor.h:190