CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes
CSCUpgradeCathodeLCTProcessor Class Reference

#include <CSCUpgradeCathodeLCTProcessor.h>

Inheritance diagram for CSCUpgradeCathodeLCTProcessor:
CSCCathodeLCTProcessor CSCBaseboard

Public Member Functions

 CSCUpgradeCathodeLCTProcessor ()
 
 CSCUpgradeCathodeLCTProcessor (unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf)
 
- Public Member Functions inherited from CSCCathodeLCTProcessor
void clear ()
 
 CSCCathodeLCTProcessor ()
 
 CSCCathodeLCTProcessor (unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf)
 
CSCCLCTDigi getBestCLCT (int bx) const
 
std::vector< CSCCLCTDigigetCLCTs (unsigned nMaxCLCTs=CSCConstants::MAX_CLCTS_PER_PROCESSOR) const
 
CSCCLCTDigi getSecondCLCT (int bx) const
 
std::vector< int > preTriggerBXs () const
 
std::vector< CSCCLCTPreTriggerDigipreTriggerDigis () const
 
std::vector< CSCCLCTPreTriggerDigipreTriggerDigisME1a () const
 
std::vector< CSCCLCTPreTriggerDigipreTriggerDigisME1b () const
 
std::vector< CSCCLCTDigireadoutCLCTs (int nMaxCLCTs=CSCConstants::MAX_CLCTS_READOUT) const
 
std::vector< CSCCLCTDigireadoutCLCTsME1a (int nMaxCLCTs=CSCConstants::MAX_CLCTS_READOUT) const
 
std::vector< CSCCLCTDigireadoutCLCTsME1b (int nMaxCLCTs=CSCConstants::MAX_CLCTS_READOUT) const
 
std::vector< CSCCLCTDigirun (const CSCComparatorDigiCollection *compdc)
 
void run (const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
 
void setConfigParameters (const CSCDBL1TPParameters *conf)
 
 ~CSCCathodeLCTProcessor () override=default
 
- Public Member Functions inherited from CSCBaseboard
 CSCBaseboard ()
 
 CSCBaseboard (unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf)
 
std::string getCSCName () const
 
void setCSCGeometry (const CSCGeometry *g)
 
virtual ~CSCBaseboard ()=default
 

Protected Attributes

bool busyMap [CSCConstants::NUM_HALF_STRIPS_7CFEBS][CSCConstants::MAX_CLCT_TBINS]
 
- Protected Attributes inherited from CSCCathodeLCTProcessor
unsigned int best_pid [CSCConstants::NUM_HALF_STRIPS_7CFEBS]
 
CSCCLCTDigi bestCLCT [CSCConstants::MAX_CLCT_TBINS]
 
CSCPatternBank::LCTPatterns clct_pattern_ = {}
 
std::vector< CSCComparatorDigidigiV [CSCConstants::NUM_LAYERS]
 
unsigned int drift_delay
 
int early_tbins
 
unsigned int fifo_pretrig
 
unsigned int fifo_tbins
 
int first_bx_corrected [CSCConstants::NUM_HALF_STRIPS_7CFEBS]
 
unsigned int hit_persist
 
bool ispretrig [CSCConstants::NUM_HALF_STRIPS_7CFEBS]
 
std::array< std::unique_ptr< CSCComparatorCodeLUT >, 5 > lutpatconv_
 
std::array< std::unique_ptr< CSCComparatorCodeLUT >, 5 > lutpos_
 
std::array< std::unique_ptr< CSCComparatorCodeLUT >, 5 > lutslope_
 
unsigned int min_separation
 
unsigned int nhits [CSCConstants::NUM_HALF_STRIPS_7CFEBS]
 
unsigned int nplanes_hit_pattern
 
unsigned int nplanes_hit_pretrig
 
int numStrips
 
std::vector< std::string > patternConversionLUTFiles_
 
unsigned int pid_thresh_pretrig
 
std::vector< std::string > positionLUTFiles_
 
std::unique_ptr< LCTQualityControlqualityControl_
 
bool readout_earliest_2
 
CSCCLCTDigi secondCLCT [CSCConstants::MAX_CLCT_TBINS]
 
std::vector< std::string > slopeLUTFiles_
 
int stagger [CSCConstants::NUM_LAYERS]
 
int start_bx_shift
 
std::vector< int > thePreTriggerBXs
 
std::vector< CSCCLCTPreTriggerDigithePreTriggerDigis
 
unsigned int tmb_l1a_window_size
 
- Protected Attributes inherited from CSCBaseboard
edm::ParameterSet alctParams_
 
edm::ParameterSet clctParams_
 
edm::ParameterSet commonParams_
 
const CSCChambercscChamber_
 
const CSCGeometrycscGeometry_
 
CSCDetId cscId_
 
bool disableME1a_
 
bool enableAlctPhase2_
 
bool gangedME1a_
 
int infoV
 
bool isME11_
 
bool isME21_
 
bool isME31_
 
bool isME41_
 
bool runCCLUT_
 
bool runME11ILT_
 
bool runME11Up_
 
bool runME21ILT_
 
bool runME21Up_
 
bool runME31Up_
 
bool runME41Up_
 
bool runPhase2_
 
unsigned theChamber
 
std::string theCSCName_
 
const unsigned theEndcap
 
unsigned theRegion
 
unsigned theRing
 
const unsigned theSector
 
const unsigned theStation
 
const unsigned theSubsector
 
const unsigned theTrigChamber
 
edm::ParameterSet tmbParams_
 

Private Member Functions

std::vector< CSCCLCTDigifindLCTs (const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]) override
 
bool preTrigger (const PulseArray pulse, const int start_bx, int &first_bx) override
 

Private Attributes

unsigned int clct_state_machine_zone
 
unsigned int pretrig_trig_zone
 
bool use_corrected_bx
 
bool use_dead_time_zoning
 

Additional Inherited Members

- Protected Types inherited from CSCCathodeLCTProcessor
enum  CLCT_CompCode { INVALID_HALFSTRIP = 65535 }
 
enum  CLCT_INDICES {
  CLCT_PATTERN, CLCT_BEND, CLCT_STRIP, CLCT_BX,
  CLCT_STRIP_TYPE, CLCT_QUALITY, CLCT_CFEB, CLCT_NUM_QUANTITIES = 7
}
 
typedef unsigned int PulseArray[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]
 
- Protected Member Functions inherited from CSCCathodeLCTProcessor
void assignPositionCC (const unsigned offset, std::tuple< uint16_t, bool, bool > &returnValue) const
 
int calculateComparatorCode (const std::array< std::array< int, 3 >, 6 > &halfStripPattern) const
 
void checkConfigParameters ()
 
void cleanComparatorContainer (CSCCLCTDigi &lct) const
 
unsigned convertSlopeToRun2Pattern (const unsigned slope) const
 
void dumpConfigParams () const
 
void dumpDigis (const std::vector< int > strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips) const
 
bool getDigis (const CSCComparatorDigiCollection *compdc)
 
void getDigis (const CSCComparatorDigiCollection *compdc, const CSCDetId &id)
 
void markBusyKeys (const int best_hstrip, const int best_patid, int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS])
 
bool patternFinding (const PulseArray pulse, const int nStrips, const unsigned int bx_time, std::map< int, std::map< int, CSCCLCTDigi::ComparatorContainer > > &hits_in_patterns)
 
void pulseExtension (const std::vector< int > time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips, PulseArray pulse)
 
void readComparatorDigis (std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
 
void runCCLUT (CSCCLCTDigi &digi) const
 
void setDefaultConfigParameters ()
 
- Protected Member Functions inherited from CSCBaseboard
void checkConfigParameters (unsigned int &var, const unsigned int var_max, const unsigned int var_def, const std::string &var_str)
 
- Static Protected Attributes inherited from CSCCathodeLCTProcessor
static const unsigned int def_drift_delay = 2
 
static const unsigned int def_fifo_pretrig = 7
 
static const unsigned int def_fifo_tbins = 12
 
static const unsigned int def_hit_persist = 6
 
static const unsigned int def_min_separation = 10
 
static const unsigned int def_nplanes_hit_pattern = 4
 
static const unsigned int def_nplanes_hit_pretrig = 2
 
static const unsigned int def_pid_thresh_pretrig = 2
 
static const unsigned int def_tmb_l1a_window_size = 7
 

Detailed Description

This class simulates the functionality of the cathode LCT card. It is run by the MotherBoard and returns up to two CathodeLCTs. It can be run either in a test mode, where it is passed arrays of halfstrip times, or in normal mode where it determines the time and comparator information from the comparator digis.

Updates for high pileup running by Vadim Khotilovich (TAMU), December 2012

Updates for integrated local trigger with GEMs by Sven Dildick (TAMU) and Tao Huang (TAMU), April 2015

Removing usage of outdated class CSCTriggerGeometry by Sven Dildick (TAMU)

Definition at line 24 of file CSCUpgradeCathodeLCTProcessor.h.

Constructor & Destructor Documentation

◆ CSCUpgradeCathodeLCTProcessor() [1/2]

CSCUpgradeCathodeLCTProcessor::CSCUpgradeCathodeLCTProcessor ( unsigned  endcap,
unsigned  station,
unsigned  sector,
unsigned  subsector,
unsigned  chamber,
const edm::ParameterSet conf 
)

Normal constructor.

Definition at line 6 of file CSCUpgradeCathodeLCTProcessor.cc.

12  : CSCCathodeLCTProcessor(endcap, station, sector, subsector, chamber, conf) {
13  if (!runPhase2_)
14  edm::LogError("CSCUpgradeCathodeLCTProcessor|ConfigError")
15  << "+++ Upgrade CSCUpgradeCathodeLCTProcessor constructed while runPhase2_ is not set! +++\n";
16 
17  // use of localized dead-time zones
18  use_dead_time_zoning = clctParams_.getParameter<bool>("useDeadTimeZoning");
19  clct_state_machine_zone = clctParams_.getParameter<unsigned int>("clctStateMachineZone");
20 
21  // how far away may trigger happen from pretrigger
22  pretrig_trig_zone = clctParams_.getParameter<unsigned int>("clctPretriggerTriggerZone");
23 
24  // whether to calculate bx as corrected_bx instead of pretrigger one
25  use_corrected_bx = clctParams_.getParameter<bool>("clctUseCorrectedBx");
26 }

References clct_state_machine_zone, CSCBaseboard::clctParams_, edm::ParameterSet::getParameter(), pretrig_trig_zone, CSCBaseboard::runPhase2_, use_corrected_bx, and use_dead_time_zoning.

◆ CSCUpgradeCathodeLCTProcessor() [2/2]

CSCUpgradeCathodeLCTProcessor::CSCUpgradeCathodeLCTProcessor ( )

Default constructor. Used for testing.

Definition at line 28 of file CSCUpgradeCathodeLCTProcessor.cc.

29  if (!runPhase2_)
30  edm::LogError("CSCUpgradeCathodeLCTProcessor|ConfigError")
31  << "+++ Upgrade CSCUpgradeCathodeLCTProcessor constructed while runPhase2_ is not set! +++\n";
32 }

References CSCBaseboard::runPhase2_.

Member Function Documentation

◆ findLCTs()

std::vector< CSCCLCTDigi > CSCUpgradeCathodeLCTProcessor::findLCTs ( const std::vector< int >  halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
overrideprivatevirtual

busyMap[hstrip][latch_bx] )

busyMap[hstrip][latch_bx] )

Reimplemented from CSCCathodeLCTProcessor.

Definition at line 140 of file CSCUpgradeCathodeLCTProcessor.cc.

141  {
142  // run the original algorithm in case we do not use dead time zoning
143  if (runPhase2_ and !use_dead_time_zoning) {
144  return CSCCathodeLCTProcessor::findLCTs(halfstrip);
145  }
146 
147  std::vector<CSCCLCTDigi> lctList;
148 
149  // Max. number of half-strips for this chamber.
150  const int maxHalfStrips = 2 * numStrips + 1;
151 
152  // initialize the ispretrig before doing pretriggering
153  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < maxHalfStrips; hstrip++) {
154  ispretrig[hstrip] = false;
155  }
156 
157  if (infoV > 1)
158  dumpDigis(halfstrip, maxHalfStrips);
159 
160  // keeps dead-time zones around key halfstrips of triggered CLCTs
161  for (int i = 0; i < CSCConstants::NUM_HALF_STRIPS_7CFEBS; i++) {
162  for (int j = 0; j < CSCConstants::MAX_CLCT_TBINS; j++) {
163  busyMap[i][j] = false;
164  }
165  }
166 
167  std::vector<CSCCLCTDigi> lctListBX;
168 
170 
171  // Fire half-strip one-shots for hit_persist bx's (4 bx's by default).
172  pulseExtension(halfstrip, maxHalfStrips, pulse);
173 
174  unsigned int start_bx = start_bx_shift;
175  // Stop drift_delay bx's short of fifo_tbins since at later bx's we will
176  // not have a full set of hits to start pattern search anyway.
177  unsigned int stop_bx = fifo_tbins - drift_delay;
178 
179  // Allow for more than one pass over the hits in the time window.
180  // Do search in every BX
181  while (start_bx < stop_bx) {
182  lctListBX.clear();
183 
184  // All half-strip pattern envelopes are evaluated simultaneously, on every clock cycle.
185  int first_bx = 999;
186  bool pre_trig = CSCUpgradeCathodeLCTProcessor::preTrigger(pulse, start_bx, first_bx);
187 
188  // If any of half-strip envelopes has enough layers hit in it, TMB
189  // will pre-trigger.
190  if (pre_trig) {
191  if (infoV > 1)
192  LogTrace("CSCUpgradeCathodeLCTProcessor")
193  << "..... pretrigger at bx = " << first_bx << "; waiting drift delay .....";
194 
195  // TMB latches LCTs drift_delay clocks after pretrigger.
196  int latch_bx = first_bx + drift_delay;
197 
198  std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer> > hits_in_patterns;
199  hits_in_patterns.clear();
200 
201  bool hits_in_time = patternFinding(pulse, maxHalfStrips, latch_bx, hits_in_patterns);
202  if (infoV > 1) {
203  if (hits_in_time) {
204  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < maxHalfStrips; hstrip++) {
205  if (nhits[hstrip] > 0) {
206  LogTrace("CSCUpgradeCathodeLCTProcessor")
207  << " bx = " << std::setw(2) << latch_bx << " --->"
208  << " halfstrip = " << std::setw(3) << hstrip << " best pid = " << std::setw(2) << best_pid[hstrip]
209  << " nhits = " << nhits[hstrip];
210  }
211  }
212  }
213  }
214 
215  // 2 possible LCTs per CSC x 7 LCT quantities per BX
217 
218  // Quality for sorting.
221  for (int ilct = 0; ilct < CSCConstants::MAX_CLCTS_PER_PROCESSOR; ilct++) {
222  best_halfstrip[ilct] = -1;
223  best_quality[ilct] = 0;
224  }
225 
226  bool pretrig_zone[CSCConstants::NUM_HALF_STRIPS_7CFEBS];
227 
228  // Calculate quality from pattern id and number of hits, and
229  // simultaneously select best-quality LCT.
230  if (hits_in_time) {
231  // first, mark half-strip zones around pretriggers
232  // that happened at the current first_bx
233  for (int hstrip = 0; hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS; hstrip++)
234  pretrig_zone[hstrip] = false;
235  for (int hstrip = 0; hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS; hstrip++) {
236  if (ispretrig[hstrip]) {
237  int min_hs = hstrip - pretrig_trig_zone;
238  int max_hs = hstrip + pretrig_trig_zone;
239  if (min_hs < 0)
240  min_hs = 0;
241  if (max_hs > CSCConstants::NUM_HALF_STRIPS_7CFEBS - 1)
243  for (int hs = min_hs; hs <= max_hs; hs++)
244  pretrig_zone[hs] = true;
245  if (infoV > 1)
246  LogTrace("CSCUpgradeCathodeLCTProcessor")
247  << " marked pretrigger halfstrip zone [" << min_hs << "," << max_hs << "]";
248  }
249  }
250 
251  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < maxHalfStrips; hstrip++) {
252  // The bend-direction bit pid[0] is ignored (left and right bends have equal quality).
253  quality[hstrip] = (best_pid[hstrip] & 14) | (nhits[hstrip] << 5);
254  // do not consider halfstrips:
255  // - out of pretrigger-trigger zones
256  // - in busy zones from previous trigger
257  if (quality[hstrip] > best_quality[0] && pretrig_zone[hstrip] && !busyMap[hstrip][first_bx])
259  {
260  best_halfstrip[0] = hstrip;
261  best_quality[0] = quality[hstrip];
262  if (infoV > 1) {
263  LogTrace("CSCUpgradeCathodeLCTProcessor")
264  << " 1st CLCT: halfstrip = " << std::setw(3) << hstrip << " quality = " << std::setw(3)
265  << quality[hstrip] << " best halfstrip = " << std::setw(3) << best_halfstrip[0]
266  << " best quality = " << std::setw(3) << best_quality[0];
267  }
268  }
269  }
270  }
271 
272  // If 1st best CLCT is found, look for the 2nd best.
273  if (best_halfstrip[0] >= 0) {
274  // Mark keys near best CLCT as busy by setting their quality to zero, and repeat the search.
275  markBusyKeys(best_halfstrip[0], best_pid[best_halfstrip[0]], quality);
276 
277  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < maxHalfStrips; hstrip++) {
278  if (quality[hstrip] > best_quality[1] && pretrig_zone[hstrip] && !busyMap[hstrip][first_bx])
280  {
281  best_halfstrip[1] = hstrip;
282  best_quality[1] = quality[hstrip];
283  if (infoV > 1) {
284  LogTrace("CSCUpgradeCathodeLCTProcessor")
285  << " 2nd CLCT: halfstrip = " << std::setw(3) << hstrip << " quality = " << std::setw(3)
286  << quality[hstrip] << " best halfstrip = " << std::setw(3) << best_halfstrip[1]
287  << " best quality = " << std::setw(3) << best_quality[1];
288  }
289  }
290  }
291 
292  // Pattern finder.
293  //bool ptn_trig = false;
294  for (int ilct = 0; ilct < CSCConstants::MAX_CLCTS_PER_PROCESSOR; ilct++) {
295  int best_hs = best_halfstrip[ilct];
296  if (best_hs >= 0 && nhits[best_hs] >= nplanes_hit_pattern) {
297  int bx = first_bx;
298  int fbx = first_bx_corrected[best_hs];
299  if (use_corrected_bx) {
300  bx = fbx;
301  fbx = first_bx;
302  }
303  //ptn_trig = true;
304  keystrip_data[ilct][CLCT_PATTERN] = best_pid[best_hs];
305  keystrip_data[ilct][CLCT_BEND] =
307  // Remove stagger if any.
308  keystrip_data[ilct][CLCT_STRIP] = best_hs - stagger[CSCConstants::KEY_CLCT_LAYER - 1];
309  keystrip_data[ilct][CLCT_BX] = bx;
310  keystrip_data[ilct][CLCT_STRIP_TYPE] = 1; // obsolete
311  keystrip_data[ilct][CLCT_QUALITY] = nhits[best_hs];
312  keystrip_data[ilct][CLCT_CFEB] = keystrip_data[ilct][CLCT_STRIP] / CSCConstants::NUM_HALF_STRIPS_PER_CFEB;
313  int halfstrip_in_cfeb = keystrip_data[ilct][CLCT_STRIP] -
314  CSCConstants::NUM_HALF_STRIPS_PER_CFEB * keystrip_data[ilct][CLCT_CFEB];
315 
316  CSCCLCTDigi thisLCT(1,
317  keystrip_data[ilct][CLCT_QUALITY],
318  keystrip_data[ilct][CLCT_PATTERN],
319  keystrip_data[ilct][CLCT_STRIP_TYPE],
320  keystrip_data[ilct][CLCT_BEND],
321  halfstrip_in_cfeb,
322  keystrip_data[ilct][CLCT_CFEB],
323  keystrip_data[ilct][CLCT_BX]);
324  if (infoV > 1) {
325  LogTrace("CSCCathodeLCTProcessor") << " Final selection: ilct " << ilct << " " << thisLCT << std::endl;
326  }
327  thisLCT.setFullBX(fbx);
328 
329  // get the comparator hits for this pattern
330  const auto& compHits = hits_in_patterns[best_hs][keystrip_data[ilct][CLCT_PATTERN]];
331 
332  // set the hit collection
333  thisLCT.setHits(compHits);
334 
335  // do the CCLUT procedures
336  if (runCCLUT_) {
337  runCCLUT(thisLCT);
338  }
339 
340  // purge the comparator digi collection from the obsolete "65535" entries...
341  cleanComparatorContainer(thisLCT);
342 
343  // put the CLCT into the collection
344  lctList.push_back(thisLCT);
345  lctListBX.push_back(thisLCT);
346  }
347  }
348 
349  } //find CLCT, end of best_halfstrip[0] >= 0
350  } //pre_trig
351  // The pattern finder runs continuously, so another pre-trigger
352  // could occur already at the next bx.
353  start_bx = first_bx + 1;
354  }
355 
356  return lctList;
357 } // findLCTs -- Phase2 version.

References CSCCathodeLCTProcessor::best_pid, busyMap, l1GtPatternGenerator_cfi::bx, CSCCathodeLCTProcessor::CLCT_BEND, CSCCathodeLCTProcessor::CLCT_BX, CSCCathodeLCTProcessor::CLCT_CFEB, CSCCathodeLCTProcessor::CLCT_NUM_QUANTITIES, CSCCathodeLCTProcessor::CLCT_PATTERN, CSCCathodeLCTProcessor::clct_pattern_, CSCConstants::CLCT_PATTERN_WIDTH, CSCCathodeLCTProcessor::CLCT_QUALITY, CSCCathodeLCTProcessor::CLCT_STRIP, CSCCathodeLCTProcessor::CLCT_STRIP_TYPE, CSCCathodeLCTProcessor::cleanComparatorContainer(), CSCCathodeLCTProcessor::drift_delay, CSCCathodeLCTProcessor::dumpDigis(), CSCCathodeLCTProcessor::fifo_tbins, CSCCathodeLCTProcessor::findLCTs(), CSCCathodeLCTProcessor::first_bx_corrected, mps_fire::i, CSCBaseboard::infoV, CSCCathodeLCTProcessor::ispretrig, dqmiolumiharvest::j, CSCConstants::KEY_CLCT_LAYER, LogTrace, CSCCathodeLCTProcessor::markBusyKeys(), CSCConstants::MAX_CLCT_TBINS, CSCConstants::MAX_CLCTS_PER_PROCESSOR, CSCCathodeLCTProcessor::nhits, CSCCathodeLCTProcessor::nplanes_hit_pattern, CSCConstants::NUM_HALF_STRIPS_7CFEBS, CSCConstants::NUM_HALF_STRIPS_PER_CFEB, CSCConstants::NUM_LAYERS, CSCCathodeLCTProcessor::numStrips, CSCCathodeLCTProcessor::patternFinding(), pretrig_trig_zone, preTrigger(), pulse(), CSCCathodeLCTProcessor::pulseExtension(), qcdUeDQM_cfi::quality, CSCCathodeLCTProcessor::runCCLUT(), CSCBaseboard::runCCLUT_, CSCBaseboard::runPhase2_, CSCCLCTDigi::setFullBX(), CSCCLCTDigi::setHits(), CSCCathodeLCTProcessor::stagger, CSCCathodeLCTProcessor::start_bx_shift, use_corrected_bx, and use_dead_time_zoning.

◆ preTrigger()

bool CSCUpgradeCathodeLCTProcessor::preTrigger ( const PulseArray  pulse,
const int  start_bx,
int &  first_bx 
)
overrideprivatevirtual

Reimplemented from CSCCathodeLCTProcessor.

Definition at line 39 of file CSCUpgradeCathodeLCTProcessor.cc.

39  {
41  return CSCCathodeLCTProcessor::preTrigger(pulse, start_bx, first_bx);
42  }
43 
44  if (infoV > 1)
45  LogTrace("CSCUpgradeCathodeLCTProcessor")
46  << "....................PreTrigger, Phase2 version with localized dead time zone...........................";
47 
48  // Max. number of half-strips for this chamber.
49  const int nStrips = 2 * numStrips + 1;
50 
51  int nPreTriggers = 0;
52 
53  bool pre_trig = false;
54  int delta_hs = clct_state_machine_zone; //dead time zone
55 
56  // Now do a loop over bx times to see (if/when) track goes over threshold
57  for (unsigned int bx_time = start_bx; bx_time < fifo_tbins; bx_time++) {
58  // For any given bunch-crossing, start at the lowest keystrip and look for
59  // the number of separate layers in the pattern for that keystrip that have
60  // pulses at that bunch-crossing time. Do the same for the next keystrip,
61  // etc. Then do the entire process again for the next bunch-crossing, etc
62  // until you find a pre-trigger.
63  std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer> > hits_in_patterns;
64  hits_in_patterns.clear();
65 
66  bool hits_in_time = patternFinding(pulse, nStrips, bx_time, hits_in_patterns);
67  if (hits_in_time) {
68  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < nStrips; hstrip++) {
69  if (infoV > 1) {
70  if (nhits[hstrip] > 0) {
71  LogTrace("CSCUpgradeCathodeLCTProcessor")
72  << " bx = " << std::setw(2) << bx_time << " --->"
73  << " halfstrip = " << std::setw(3) << hstrip << " best pid = " << std::setw(2) << best_pid[hstrip]
74  << " nhits = " << nhits[hstrip];
75  }
76  }
77  //ispretrig[hstrip] = false; it is initialzed in findLCT
78  if (nhits[hstrip] >= nplanes_hit_pretrig && best_pid[hstrip] >= pid_thresh_pretrig &&
79  !busyMap[hstrip][bx_time]) {
80  pre_trig = true;
81  ispretrig[hstrip] = true;
82 
83  // write each pre-trigger to output
84  nPreTriggers++;
85  const int bend =
87  const int halfstrip = hstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB;
88  const int cfeb = hstrip / CSCConstants::NUM_HALF_STRIPS_PER_CFEB;
90  1, nhits[hstrip], best_pid[hstrip], 1, bend, halfstrip, cfeb, bx_time, nPreTriggers, 0));
91 
92  } else if (nhits[hstrip] >= nplanes_hit_pretrig &&
93  best_pid[hstrip] >= pid_thresh_pretrig) { //busy zone, keep pretriggering,ignore this
94  ispretrig[hstrip] = true;
95  if (infoV > 1)
96  LogTrace("CSCUpgradeCathodeLCTProcessor")
97  << " halfstrip " << std::setw(3) << hstrip << " in dead zone and is pretriggerred";
98  } else if (nhits[hstrip] < nplanes_hit_pretrig || best_pid[hstrip] < pid_thresh_pretrig) {
99  // not pretriggered anyone, release dead zone
100  ispretrig[hstrip] = false;
101  }
102  } // find all pretriggers
103 
104  //update dead zone
105  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < nStrips; hstrip++) {
106  if (ispretrig[hstrip]) {
107  int min_hstrip = hstrip - delta_hs; //only fixed localized dead time zone is implemented
108  int max_hstrip = hstrip + delta_hs;
109  if (min_hstrip < stagger[CSCConstants::KEY_CLCT_LAYER - 1])
110  min_hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1];
111  if (max_hstrip >= nStrips)
112  max_hstrip = nStrips - 1;
113  for (int hs = min_hstrip; hs <= max_hstrip; hs++)
114  busyMap[hs][bx_time + 1] = true;
115  if (infoV > 1)
116  LogTrace("CSCUpgradeCathodeLCTProcessor")
117  << " marked zone around pretriggerred halfstrip " << hstrip << " as dead zone for pretriggering at bx"
118  << bx_time + 1 << " halfstrip: [" << min_hstrip << "," << max_hstrip << "]";
119  }
120  }
121  if (pre_trig) {
122  first_bx = bx_time; // bx at time of pretrigger
123  return true;
124  }
125  } else //no pattern found, remove all dead time zone
126  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < nStrips; hstrip++) {
127  if (ispretrig[hstrip])
128  ispretrig[hstrip] = false; //dead zone is gone by default
129  }
130 
131  } // end loop over bx times
132 
133  if (infoV > 1)
134  LogTrace("CSCUpgradeCathodeLCTProcessor") << "no pretrigger, returning \n";
135  first_bx = fifo_tbins;
136  return false;
137 } // preTrigger -- Phase2 version.

References trklet::bend(), CSCCathodeLCTProcessor::best_pid, busyMap, CSCCathodeLCTProcessor::clct_pattern_, CSCConstants::CLCT_PATTERN_WIDTH, clct_state_machine_zone, CSCCathodeLCTProcessor::fifo_tbins, CSCBaseboard::infoV, CSCCathodeLCTProcessor::ispretrig, CSCConstants::KEY_CLCT_LAYER, LogTrace, CSCCathodeLCTProcessor::nhits, CSCCathodeLCTProcessor::nplanes_hit_pretrig, me0TriggerPseudoDigis_cff::nStrips, CSCConstants::NUM_HALF_STRIPS_PER_CFEB, CSCConstants::NUM_LAYERS, CSCCathodeLCTProcessor::numStrips, CSCCathodeLCTProcessor::patternFinding(), CSCCathodeLCTProcessor::pid_thresh_pretrig, CSCCathodeLCTProcessor::preTrigger(), pulse(), CSCBaseboard::runPhase2_, CSCCathodeLCTProcessor::stagger, CSCCathodeLCTProcessor::thePreTriggerDigis, and use_dead_time_zoning.

Referenced by findLCTs().

Member Data Documentation

◆ busyMap

bool CSCUpgradeCathodeLCTProcessor::busyMap[CSCConstants::NUM_HALF_STRIPS_7CFEBS][CSCConstants::MAX_CLCT_TBINS]
protected

Definition at line 39 of file CSCUpgradeCathodeLCTProcessor.h.

Referenced by findLCTs(), and preTrigger().

◆ clct_state_machine_zone

unsigned int CSCUpgradeCathodeLCTProcessor::clct_state_machine_zone
private

Definition at line 44 of file CSCUpgradeCathodeLCTProcessor.h.

Referenced by CSCUpgradeCathodeLCTProcessor(), and preTrigger().

◆ pretrig_trig_zone

unsigned int CSCUpgradeCathodeLCTProcessor::pretrig_trig_zone
private

VK: allow triggers only in +-pretrig_trig_zone around pretriggers

Definition at line 47 of file CSCUpgradeCathodeLCTProcessor.h.

Referenced by CSCUpgradeCathodeLCTProcessor(), and findLCTs().

◆ use_corrected_bx

bool CSCUpgradeCathodeLCTProcessor::use_corrected_bx
private

VK: whether to use corrected_bx instead of pretrigger BX

Definition at line 50 of file CSCUpgradeCathodeLCTProcessor.h.

Referenced by CSCUpgradeCathodeLCTProcessor(), and findLCTs().

◆ use_dead_time_zoning

bool CSCUpgradeCathodeLCTProcessor::use_dead_time_zoning
private

VK: use of localized dead-time zones

Definition at line 43 of file CSCUpgradeCathodeLCTProcessor.h.

Referenced by CSCUpgradeCathodeLCTProcessor(), findLCTs(), and preTrigger().

CSCCathodeLCTProcessor::markBusyKeys
void markBusyKeys(const int best_hstrip, const int best_patid, int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS])
Definition: CSCCathodeLCTProcessor.cc:1017
mps_fire.i
i
Definition: mps_fire.py:428
CSCBaseboard::clctParams_
edm::ParameterSet clctParams_
Definition: CSCBaseboard.h:79
CSCCathodeLCTProcessor::stagger
int stagger[CSCConstants::NUM_LAYERS]
Definition: CSCCathodeLCTProcessor.h:200
CSCUpgradeCathodeLCTProcessor::pretrig_trig_zone
unsigned int pretrig_trig_zone
Definition: CSCUpgradeCathodeLCTProcessor.h:47
relativeConstraints.station
station
Definition: relativeConstraints.py:67
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
CSCUpgradeCathodeLCTProcessor::preTrigger
bool preTrigger(const PulseArray pulse, const int start_bx, int &first_bx) override
Definition: CSCUpgradeCathodeLCTProcessor.cc:39
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::CLCT_PATTERN
Definition: CSCCathodeLCTProcessor.h:186
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
CSCCLCTDigi
Definition: CSCCLCTDigi.h:17
CSCConstants::MAX_CLCTS_PER_PROCESSOR
Definition: CSCConstants.h:69
CSCUpgradeCathodeLCTProcessor::busyMap
bool busyMap[CSCConstants::NUM_HALF_STRIPS_7CFEBS][CSCConstants::MAX_CLCT_TBINS]
Definition: CSCUpgradeCathodeLCTProcessor.h:39
CSCCathodeLCTProcessor::thePreTriggerDigis
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis
Definition: CSCCathodeLCTProcessor.h:204
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::findLCTs
virtual std::vector< CSCCLCTDigi > findLCTs(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
Definition: CSCCathodeLCTProcessor.cc:539
CSCUpgradeCathodeLCTProcessor::use_dead_time_zoning
bool use_dead_time_zoning
Definition: CSCUpgradeCathodeLCTProcessor.h:43
CSCConstants::NUM_LAYERS
Definition: CSCConstants.h:46
CSCCathodeLCTProcessor::first_bx_corrected
int first_bx_corrected[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
Definition: CSCCathodeLCTProcessor.h:175
CSCCLCTPreTriggerDigi
Definition: CSCCLCTPreTriggerDigi.h:15
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
CSCBaseboard::runPhase2_
bool runPhase2_
Definition: CSCBaseboard.h:85
CSCCathodeLCTProcessor::numStrips
int numStrips
Definition: CSCCathodeLCTProcessor.h:197
CSCCathodeLCTProcessor::CLCT_CFEB
Definition: CSCCathodeLCTProcessor.h:192
CSCCathodeLCTProcessor::CLCT_STRIP
Definition: CSCCathodeLCTProcessor.h:188
CSCCathodeLCTProcessor::CLCT_BEND
Definition: CSCCathodeLCTProcessor.h:187
CSCCathodeLCTProcessor::CLCT_QUALITY
Definition: CSCCathodeLCTProcessor.h:191
CSCCathodeLCTProcessor::cleanComparatorContainer
void cleanComparatorContainer(CSCCLCTDigi &lct) const
Definition: CSCCathodeLCTProcessor.cc:1030
CSCUpgradeCathodeLCTProcessor::clct_state_machine_zone
unsigned int clct_state_machine_zone
Definition: CSCUpgradeCathodeLCTProcessor.h:44
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
CSCCathodeLCTProcessor::pid_thresh_pretrig
unsigned int pid_thresh_pretrig
Definition: CSCCathodeLCTProcessor.h:210
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::best_pid
unsigned int best_pid[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
Definition: CSCCathodeLCTProcessor.h:170
CSCCathodeLCTProcessor::start_bx_shift
int start_bx_shift
Definition: CSCCathodeLCTProcessor.h:214
qcdUeDQM_cfi.quality
quality
Definition: qcdUeDQM_cfi.py:31
CSCCathodeLCTProcessor::CSCCathodeLCTProcessor
CSCCathodeLCTProcessor()
Definition: CSCCathodeLCTProcessor.cc:107
trklet::bend
double bend(double r, double rinv, double stripPitch)
Definition: Util.h:160
CSCUpgradeCathodeLCTProcessor::use_corrected_bx
bool use_corrected_bx
Definition: CSCUpgradeCathodeLCTProcessor.h:50
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
CSCConstants::KEY_CLCT_LAYER
Definition: CSCConstants.h:46
CSCConstants::MAX_CLCT_TBINS
Definition: CSCConstants.h:63
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CSCConstants::NUM_HALF_STRIPS_7CFEBS
Definition: CSCConstants.h:28
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
CSCCathodeLCTProcessor::runCCLUT
void runCCLUT(CSCCLCTDigi &digi) const
Definition: CSCCathodeLCTProcessor.cc:1349
CSCConstants::CLCT_PATTERN_WIDTH
Definition: CSCConstants.h:53
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
CSCConstants::NUM_HALF_STRIPS_PER_CFEB
Definition: CSCConstants.h:32
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
CSCBaseboard::runCCLUT_
bool runCCLUT_
Definition: CSCBaseboard.h:103
CSCCathodeLCTProcessor::clct_pattern_
CSCPatternBank::LCTPatterns clct_pattern_
Definition: CSCCathodeLCTProcessor.h:181
CSCCathodeLCTProcessor::CLCT_NUM_QUANTITIES
Definition: CSCCathodeLCTProcessor.h:193
CSCBaseboard::infoV
int infoV
Definition: CSCBaseboard.h:64