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  const int nStrips,
125  PulseArray pulse);
126 
127  //--------------- Functions for post-2007 version of the firmware -----------
128  virtual std::vector<CSCCLCTDigi> findLCTs(
129  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
130 
131  /* Check all half-strip pattern envelopes simultaneously, on every clock cycle, for a matching pattern */
132  virtual bool preTrigger(const PulseArray pulse, const int start_bx, int& first_bx);
133 
134  /* For a given clock cycle, check each half-strip if a pattern matches */
135  bool patternFinding(const PulseArray pulse,
136  const int nStrips,
137  const unsigned int bx_time,
138  std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer> >& hits_in_patterns);
139 
140  // enum used in the comparator code logic
142 
143  void cleanComparatorContainer(CSCCLCTDigi& lct) const;
144 
145  /* Mark the half-strips around the best half-strip as busy */
146  void markBusyKeys(const int best_hstrip, const int best_patid, int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
147 
148  //--------------------------- Auxiliary methods -----------------------------
150  void dumpConfigParams() const;
151 
154  const int nStrips) const;
155 
156  // --------Functions for the comparator code algorith for Run-3 ---------//
157  //calculates the id based on location of hits
158  int calculateComparatorCode(const std::array<std::array<int, 3>, 6>& halfStripPattern) const;
159 
160  // sets the 1/4 and 1/8 strip bits given a floating point position offset
161  void assignPositionCC(const unsigned offset, std::tuple<uint16_t, bool, bool>& returnValue) const;
162 
163  // runs the CCLUT procedure
164  void runCCLUT(CSCCLCTDigi& digi) const;
165 
166  unsigned convertSlopeToRun2Pattern(const unsigned slope) const;
167  //--------------------------- Member variables -----------------------------
168 
169  /* best pattern Id for a given half-strip */
171 
172  /* number of layers hit on a given half-strip */
174 
176 
177  /* does a given half-strip have a pre-trigger? */
179 
180  // actual LUT used
182 
183  // we use these next ones to address the various bits inside the array that's
184  // used to make the cathode LCTs.
194  };
195 
196  /* number of strips used in this processor */
198 
199  /* Is the layer in the chamber staggered? */
201 
202  std::vector<CSCComparatorDigi> digiV[CSCConstants::NUM_LAYERS];
203  std::vector<int> thePreTriggerBXs;
204  std::vector<CSCCLCTPreTriggerDigi> thePreTriggerDigis;
205 
207  unsigned int fifo_tbins, fifo_pretrig; // only for test beam mode.
208  unsigned int hit_persist, drift_delay;
211  unsigned int tmb_l1a_window_size;
212 
215 
218 
221 
223  static const unsigned int def_fifo_tbins, def_fifo_pretrig;
224  static const unsigned int def_hit_persist, def_drift_delay;
225  static const unsigned int def_nplanes_hit_pretrig;
226  static const unsigned int def_nplanes_hit_pattern;
227  static const unsigned int def_pid_thresh_pretrig, def_min_separation;
228  static const unsigned int def_tmb_l1a_window_size;
229 
230  std::vector<std::string> positionLUTFiles_;
231  std::vector<std::string> slopeLUTFiles_;
232  std::vector<std::string> patternConversionLUTFiles_;
233 
234  /* quality control */
235  std::unique_ptr<LCTQualityControl> qualityControl_;
236 };
237 
238 #endif
CSCDBL1TPParameters
Definition: CSCDBL1TPParameters.h:14
CSCCathodeLCTProcessor::assignPositionCC
void assignPositionCC(const unsigned offset, std::tuple< uint16_t, bool, bool > &returnValue) const
Definition: CSCCathodeLCTProcessor.cc:1306
CSCCathodeLCTProcessor::qualityControl_
std::unique_ptr< LCTQualityControl > qualityControl_
Definition: CSCCathodeLCTProcessor.h:235
CSCCathodeLCTProcessor::markBusyKeys
void markBusyKeys(const int best_hstrip, const int best_patid, int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS])
Definition: CSCCathodeLCTProcessor.cc:1017
CSCComparatorCodeLUT.h
CSCCathodeLCTProcessor::stagger
int stagger[CSCConstants::NUM_LAYERS]
Definition: CSCCathodeLCTProcessor.h:200
CSCCathodeLCTProcessor::getSecondCLCT
CSCCLCTDigi getSecondCLCT(int bx) const
Definition: CSCCathodeLCTProcessor.cc:1263
CSCCathodeLCTProcessor
Definition: CSCCathodeLCTProcessor.h:44
CSCCathodeLCTProcessor::dumpConfigParams
void dumpConfigParams() const
Definition: CSCCathodeLCTProcessor.cc:1044
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:207
CSCCathodeLCTProcessor::dumpDigis
void dumpDigis(const std::vector< int > strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips) const
Definition: CSCCathodeLCTProcessor.cc:1063
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:447
CSCCathodeLCTProcessor::readoutCLCTs
std::vector< CSCCLCTDigi > readoutCLCTs(int nMaxCLCTs=CSCConstants::MAX_CLCTS_READOUT) const
Definition: CSCCathodeLCTProcessor.cc:1105
mps_check.array
array
Definition: mps_check.py:216
CSCCathodeLCTProcessor::CLCT_PATTERN
Definition: CSCCathodeLCTProcessor.h:186
CSCCathodeLCTProcessor::getDigis
bool getDigis(const CSCComparatorDigiCollection *compdc)
Definition: CSCCathodeLCTProcessor.cc:398
CSCCathodeLCTProcessor::def_nplanes_hit_pattern
static const unsigned int def_nplanes_hit_pattern
Definition: CSCCathodeLCTProcessor.h:226
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
CSCCathodeLCTProcessor::patternConversionLUTFiles_
std::vector< std::string > patternConversionLUTFiles_
Definition: CSCCathodeLCTProcessor.h:232
CSCCathodeLCTProcessor::def_drift_delay
static const unsigned int def_drift_delay
Definition: CSCCathodeLCTProcessor.h:224
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:217
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:223
CSCCathodeLCTProcessor::slopeLUTFiles_
std::vector< std::string > slopeLUTFiles_
Definition: CSCCathodeLCTProcessor.h:231
CSCCathodeLCTProcessor::thePreTriggerDigis
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis
Definition: CSCCathodeLCTProcessor.h:204
CSCCathodeLCTProcessor::readout_earliest_2
bool readout_earliest_2
Definition: CSCCathodeLCTProcessor.h:220
CSCCathodeLCTProcessor::INVALID_HALFSTRIP
Definition: CSCCathodeLCTProcessor.h:141
CSCCathodeLCTProcessor::getBestCLCT
CSCCLCTDigi getBestCLCT(int bx) const
Definition: CSCCathodeLCTProcessor.cc:1257
CSCCathodeLCTProcessor::pulseExtension
void pulseExtension(const std::vector< int > time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips, PulseArray pulse)
Definition: CSCCathodeLCTProcessor.cc:762
CSCCathodeLCTProcessor::ispretrig
bool ispretrig[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
Definition: CSCCathodeLCTProcessor.h:178
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:539
CSCConstants::NUM_LAYERS
Definition: CSCConstants.h:46
CSCCathodeLCTProcessor::first_bx_corrected
int first_bx_corrected[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
Definition: CSCCathodeLCTProcessor.h:175
CSCCathodeLCTProcessor::thePreTriggerBXs
std::vector< int > thePreTriggerBXs
Definition: CSCCathodeLCTProcessor.h:203
CSCCathodeLCTProcessor::def_fifo_pretrig
static const unsigned int def_fifo_pretrig
Definition: CSCCathodeLCTProcessor.h:223
CSCCathodeLCTProcessor::def_hit_persist
static const unsigned int def_hit_persist
Definition: CSCCathodeLCTProcessor.h:224
CSCCathodeLCTProcessor::preTrigger
virtual bool preTrigger(const PulseArray pulse, const int start_bx, int &first_bx)
Definition: CSCCathodeLCTProcessor.cc:808
CSCCathodeLCTProcessor::nhits
unsigned int nhits[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
Definition: CSCCathodeLCTProcessor.h:173
CSCCathodeLCTProcessor::def_min_separation
static const unsigned int def_min_separation
Definition: CSCCathodeLCTProcessor.h:227
CSCCathodeLCTProcessor::numStrips
int numStrips
Definition: CSCCathodeLCTProcessor.h:197
CSCCathodeLCTProcessor::convertSlopeToRun2Pattern
unsigned convertSlopeToRun2Pattern(const unsigned slope) const
Definition: CSCCathodeLCTProcessor.cc:1445
CSCCathodeLCTProcessor::CLCT_CFEB
Definition: CSCCathodeLCTProcessor.h:192
CSCCathodeLCTProcessor::run
std::vector< CSCCLCTDigi > run(const CSCComparatorDigiCollection *compdc)
Definition: CSCCathodeLCTProcessor.cc:211
CSCCathodeLCTProcessor::CLCT_STRIP
Definition: CSCCathodeLCTProcessor.h:188
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:187
CSCBaseboard
Definition: CSCBaseboard.h:15
CSCCathodeLCTProcessor::CLCT_QUALITY
Definition: CSCCathodeLCTProcessor.h:191
CSCCathodeLCTProcessor::secondCLCT
CSCCLCTDigi secondCLCT[CSCConstants::MAX_CLCT_TBINS]
Definition: CSCCathodeLCTProcessor.h:99
CSCCathodeLCTProcessor::digiV
std::vector< CSCComparatorDigi > digiV[CSCConstants::NUM_LAYERS]
Definition: CSCCathodeLCTProcessor.h:202
CSCDetId
Definition: CSCDetId.h:26
CSCCathodeLCTProcessor::cleanComparatorContainer
void cleanComparatorContainer(CSCCLCTDigi &lct) const
Definition: CSCCathodeLCTProcessor.cc:1030
CSCCathodeLCTProcessor::CLCT_INDICES
CLCT_INDICES
Definition: CSCCathodeLCTProcessor.h:185
CSCCathodeLCTProcessor::def_pid_thresh_pretrig
static const unsigned int def_pid_thresh_pretrig
Definition: CSCCathodeLCTProcessor.h:227
CSCCathodeLCTProcessor::positionLUTFiles_
std::vector< std::string > positionLUTFiles_
Definition: CSCCathodeLCTProcessor.h:230
CSCCathodeLCTProcessor::tmb_l1a_window_size
unsigned int tmb_l1a_window_size
Definition: CSCCathodeLCTProcessor.h:211
CSCCathodeLCTProcessor::readoutCLCTsME1a
std::vector< CSCCLCTDigi > readoutCLCTsME1a(int nMaxCLCTs=CSCConstants::MAX_CLCTS_READOUT) const
Definition: CSCCathodeLCTProcessor.cc:1194
CSCComparatorDigiCollection
CSCCathodeLCTProcessor::def_nplanes_hit_pretrig
static const unsigned int def_nplanes_hit_pretrig
Definition: CSCCathodeLCTProcessor.h:225
CSCCLCTPreTriggerDigi.h
CSCCathodeLCTProcessor::hit_persist
unsigned int hit_persist
Definition: CSCCathodeLCTProcessor.h:208
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:1271
CSCCathodeLCTProcessor::pid_thresh_pretrig
unsigned int pid_thresh_pretrig
Definition: CSCCathodeLCTProcessor.h:210
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:1207
CSCCathodeLCTProcessor::clear
void clear()
Definition: CSCCathodeLCTProcessor.cc:202
CSCCathodeLCTProcessor::setDefaultConfigParameters
void setDefaultConfigParameters()
Definition: CSCCathodeLCTProcessor.cc:138
me0TriggerPseudoDigis_cff.nStrips
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
Definition: me0TriggerPseudoDigis_cff.py:26
CSCCathodeLCTProcessor::preTriggerDigisME1b
std::vector< CSCCLCTPreTriggerDigi > preTriggerDigisME1b() const
Definition: CSCCathodeLCTProcessor.cc:1229
CSCCathodeLCTProcessor::def_tmb_l1a_window_size
static const unsigned int def_tmb_l1a_window_size
Definition: CSCCathodeLCTProcessor.h:228
CSCCathodeLCTProcessor::fifo_pretrig
unsigned int fifo_pretrig
Definition: CSCCathodeLCTProcessor.h:207
CSCCathodeLCTProcessor::best_pid
unsigned int best_pid[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
Definition: CSCCathodeLCTProcessor.h:170
CSCConstants::MAX_CLCTS_READOUT
Definition: CSCConstants.h:70
CSCCathodeLCTProcessor::CLCT_CompCode
CLCT_CompCode
Definition: CSCCathodeLCTProcessor.h:141
CSCCathodeLCTProcessor::start_bx_shift
int start_bx_shift
Definition: CSCCathodeLCTProcessor.h:214
CSCCathodeLCTProcessor::~CSCCathodeLCTProcessor
~CSCCathodeLCTProcessor() override=default
CSCCathodeLCTProcessor::preTriggerDigisME1a
std::vector< CSCCLCTPreTriggerDigi > preTriggerDigisME1a() const
Definition: CSCCathodeLCTProcessor.cc:1218
qcdUeDQM_cfi.quality
quality
Definition: qcdUeDQM_cfi.py:31
CSCCathodeLCTProcessor::CSCCathodeLCTProcessor
CSCCathodeLCTProcessor()
Definition: CSCCathodeLCTProcessor.cc:107
CSCCathodeLCTProcessor::patternFinding
bool patternFinding(const PulseArray pulse, const int nStrips, const unsigned int bx_time, std::map< int, std::map< int, CSCCLCTDigi::ComparatorContainer > > &hits_in_patterns)
Definition: CSCCathodeLCTProcessor.cc:870
CSCCathodeLCTProcessor::nplanes_hit_pretrig
unsigned int nplanes_hit_pretrig
Definition: CSCCathodeLCTProcessor.h:209
CSCCLCTDigi.h
CSCConstants::MAX_CLCT_TBINS
Definition: CSCConstants.h:63
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:210
genParticles_cff.map
map
Definition: genParticles_cff.py:11
CSCCathodeLCTProcessor::runCCLUT
void runCCLUT(CSCCLCTDigi &digi) const
Definition: CSCCathodeLCTProcessor.cc:1349
slope
static const double slope[3]
Definition: CastorTimeSlew.cc:6
ntuplemaker.time
time
Definition: ntuplemaker.py:310
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:1241
CSCCathodeLCTProcessor::checkConfigParameters
void checkConfigParameters()
Definition: CSCCathodeLCTProcessor.cc:172
CSCCathodeLCTProcessor::CLCT_STRIP_TYPE
Definition: CSCCathodeLCTProcessor.h:190
CSCCathodeLCTProcessor::drift_delay
unsigned int drift_delay
Definition: CSCCathodeLCTProcessor.h:208
CSCCathodeLCTProcessor::nplanes_hit_pattern
unsigned int nplanes_hit_pattern
Definition: CSCCathodeLCTProcessor.h:209
CSCCathodeLCTProcessor::CLCT_BX
Definition: CSCCathodeLCTProcessor.h:189
CSCCathodeLCTProcessor::clct_pattern_
CSCPatternBank::LCTPatterns clct_pattern_
Definition: CSCCathodeLCTProcessor.h:181
LCTQualityControl.h
CSCBaseboard.h
CSCCathodeLCTProcessor::CLCT_NUM_QUANTITIES
Definition: CSCCathodeLCTProcessor.h:193