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 numCFEBs_
 
int numHalfStrips_
 
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< int16_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
 
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 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], 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 137 of file CSCUpgradeCathodeLCTProcessor.cc.

138  {
139  // run the original algorithm in case we do not use dead time zoning
140  if (runPhase2_ and !use_dead_time_zoning) {
141  return CSCCathodeLCTProcessor::findLCTs(halfstrip);
142  }
143 
144  std::vector<CSCCLCTDigi> lctList;
145 
146  // initialize the ispretrig before doing pretriggering
147  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < numHalfStrips_; hstrip++) {
148  ispretrig[hstrip] = false;
149  }
150 
151  if (infoV > 1)
152  dumpDigis(halfstrip);
153 
154  // keeps dead-time zones around key halfstrips of triggered CLCTs
155  for (int i = 0; i < CSCConstants::NUM_HALF_STRIPS_7CFEBS; i++) {
156  for (int j = 0; j < CSCConstants::MAX_CLCT_TBINS; j++) {
157  busyMap[i][j] = false;
158  }
159  }
160 
161  std::vector<CSCCLCTDigi> lctListBX;
162 
164 
165  // Fire half-strip one-shots for hit_persist bx's (4 bx's by default).
166  pulseExtension(halfstrip, pulse);
167 
168  unsigned int start_bx = start_bx_shift;
169  // Stop drift_delay bx's short of fifo_tbins since at later bx's we will
170  // not have a full set of hits to start pattern search anyway.
171  unsigned int stop_bx = fifo_tbins - drift_delay;
172 
173  // Allow for more than one pass over the hits in the time window.
174  // Do search in every BX
175  while (start_bx < stop_bx) {
176  lctListBX.clear();
177 
178  // All half-strip pattern envelopes are evaluated simultaneously, on every clock cycle.
179  int first_bx = 999;
180  bool pre_trig = CSCUpgradeCathodeLCTProcessor::preTrigger(pulse, start_bx, first_bx);
181 
182  // If any of half-strip envelopes has enough layers hit in it, TMB
183  // will pre-trigger.
184  if (pre_trig) {
185  if (infoV > 1)
186  LogTrace("CSCUpgradeCathodeLCTProcessor")
187  << "..... pretrigger at bx = " << first_bx << "; waiting drift delay .....";
188 
189  // TMB latches LCTs drift_delay clocks after pretrigger.
190  int latch_bx = first_bx + drift_delay;
191 
192  std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer> > hits_in_patterns;
193  hits_in_patterns.clear();
194 
195  bool hits_in_time = patternFinding(pulse, latch_bx, hits_in_patterns);
196  if (infoV > 1) {
197  if (hits_in_time) {
198  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < numHalfStrips_; hstrip++) {
199  if (nhits[hstrip] > 0) {
200  LogTrace("CSCUpgradeCathodeLCTProcessor")
201  << " bx = " << std::setw(2) << latch_bx << " --->"
202  << " halfstrip = " << std::setw(3) << hstrip << " best pid = " << std::setw(2) << best_pid[hstrip]
203  << " nhits = " << nhits[hstrip];
204  }
205  }
206  }
207  }
208 
209  // 2 possible LCTs per CSC x 7 LCT quantities per BX
211 
212  // Quality for sorting.
215  for (int ilct = 0; ilct < CSCConstants::MAX_CLCTS_PER_PROCESSOR; ilct++) {
216  best_halfstrip[ilct] = -1;
217  best_quality[ilct] = 0;
218  }
219 
220  bool pretrig_zone[CSCConstants::NUM_HALF_STRIPS_7CFEBS];
221 
222  // Calculate quality from pattern id and number of hits, and
223  // simultaneously select best-quality LCT.
224  if (hits_in_time) {
225  // first, mark half-strip zones around pretriggers
226  // that happened at the current first_bx
227  for (int hstrip = 0; hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS; hstrip++)
228  pretrig_zone[hstrip] = false;
229  for (int hstrip = 0; hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS; hstrip++) {
230  if (ispretrig[hstrip]) {
231  int min_hs = hstrip - pretrig_trig_zone;
232  int max_hs = hstrip + pretrig_trig_zone;
233  if (min_hs < 0)
234  min_hs = 0;
235  if (max_hs > CSCConstants::NUM_HALF_STRIPS_7CFEBS - 1)
237  for (int hs = min_hs; hs <= max_hs; hs++)
238  pretrig_zone[hs] = true;
239  if (infoV > 1)
240  LogTrace("CSCUpgradeCathodeLCTProcessor")
241  << " marked pretrigger halfstrip zone [" << min_hs << "," << max_hs << "]";
242  }
243  }
244 
245  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < numHalfStrips_; hstrip++) {
246  // The bend-direction bit pid[0] is ignored (left and right bends have equal quality).
247  quality[hstrip] = (best_pid[hstrip] & 14) | (nhits[hstrip] << 5);
248  // do not consider halfstrips:
249  // - out of pretrigger-trigger zones
250  // - in busy zones from previous trigger
251  if (quality[hstrip] > best_quality[0] && pretrig_zone[hstrip] && !busyMap[hstrip][first_bx])
253  {
254  best_halfstrip[0] = hstrip;
255  best_quality[0] = quality[hstrip];
256  if (infoV > 1) {
257  LogTrace("CSCUpgradeCathodeLCTProcessor")
258  << " 1st CLCT: halfstrip = " << std::setw(3) << hstrip << " quality = " << std::setw(3)
259  << quality[hstrip] << " best halfstrip = " << std::setw(3) << best_halfstrip[0]
260  << " best quality = " << std::setw(3) << best_quality[0];
261  }
262  }
263  }
264  }
265 
266  // If 1st best CLCT is found, look for the 2nd best.
267  if (best_halfstrip[0] >= 0) {
268  // Mark keys near best CLCT as busy by setting their quality to zero, and repeat the search.
269  markBusyKeys(best_halfstrip[0], best_pid[best_halfstrip[0]], quality);
270 
271  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < numHalfStrips_; hstrip++) {
272  if (quality[hstrip] > best_quality[1] && pretrig_zone[hstrip] && !busyMap[hstrip][first_bx])
274  {
275  best_halfstrip[1] = hstrip;
276  best_quality[1] = quality[hstrip];
277  if (infoV > 1) {
278  LogTrace("CSCUpgradeCathodeLCTProcessor")
279  << " 2nd CLCT: halfstrip = " << std::setw(3) << hstrip << " quality = " << std::setw(3)
280  << quality[hstrip] << " best halfstrip = " << std::setw(3) << best_halfstrip[1]
281  << " best quality = " << std::setw(3) << best_quality[1];
282  }
283  }
284  }
285 
286  // Pattern finder.
287  //bool ptn_trig = false;
288  for (int ilct = 0; ilct < CSCConstants::MAX_CLCTS_PER_PROCESSOR; ilct++) {
289  int best_hs = best_halfstrip[ilct];
290  if (best_hs >= 0 && nhits[best_hs] >= nplanes_hit_pattern) {
291  int bx = first_bx;
292  int fbx = first_bx_corrected[best_hs];
293  if (use_corrected_bx) {
294  bx = fbx;
295  fbx = first_bx;
296  }
297  //ptn_trig = true;
298  keystrip_data[ilct][CLCT_PATTERN] = best_pid[best_hs];
299  keystrip_data[ilct][CLCT_BEND] =
301  // Remove stagger if any.
302  keystrip_data[ilct][CLCT_STRIP] = best_hs - stagger[CSCConstants::KEY_CLCT_LAYER - 1];
303  keystrip_data[ilct][CLCT_BX] = bx;
304  keystrip_data[ilct][CLCT_STRIP_TYPE] = 1; // obsolete
305  keystrip_data[ilct][CLCT_QUALITY] = nhits[best_hs];
306  keystrip_data[ilct][CLCT_CFEB] = keystrip_data[ilct][CLCT_STRIP] / CSCConstants::NUM_HALF_STRIPS_PER_CFEB;
307  int halfstrip_in_cfeb = keystrip_data[ilct][CLCT_STRIP] -
308  CSCConstants::NUM_HALF_STRIPS_PER_CFEB * keystrip_data[ilct][CLCT_CFEB];
309 
310  CSCCLCTDigi thisLCT(1,
311  keystrip_data[ilct][CLCT_QUALITY],
312  keystrip_data[ilct][CLCT_PATTERN],
313  keystrip_data[ilct][CLCT_STRIP_TYPE],
314  keystrip_data[ilct][CLCT_BEND],
315  halfstrip_in_cfeb,
316  keystrip_data[ilct][CLCT_CFEB],
317  keystrip_data[ilct][CLCT_BX]);
318  if (infoV > 1) {
319  LogTrace("CSCCathodeLCTProcessor") << " Final selection: ilct " << ilct << " " << thisLCT << std::endl;
320  }
321  thisLCT.setFullBX(fbx);
322 
323  // get the comparator hits for this pattern
324  const auto& compHits = hits_in_patterns[best_hs][keystrip_data[ilct][CLCT_PATTERN]];
325 
326  // set the hit collection
327  thisLCT.setHits(compHits);
328 
329  // do the CCLUT procedures
330  if (runCCLUT_) {
331  runCCLUT(thisLCT);
332  }
333 
334  // purge the comparator digi collection from the obsolete "65535" entries...
335  cleanComparatorContainer(thisLCT);
336 
337  // put the CLCT into the collection
338  lctList.push_back(thisLCT);
339  lctListBX.push_back(thisLCT);
340  }
341  }
342 
343  } //find CLCT, end of best_halfstrip[0] >= 0
344  } //pre_trig
345  // The pattern finder runs continuously, so another pre-trigger
346  // could occur already at the next bx.
347  start_bx = first_bx + 1;
348  }
349 
350  return lctList;
351 } // 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::numHalfStrips_, CSCCathodeLCTProcessor::patternFinding(), pretrig_trig_zone, preTrigger(), pulse(), CSCCathodeLCTProcessor::pulseExtension(), 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  int nPreTriggers = 0;
49 
50  bool pre_trig = false;
51  int delta_hs = clct_state_machine_zone; //dead time zone
52 
53  // Now do a loop over bx times to see (if/when) track goes over threshold
54  for (unsigned int bx_time = start_bx; bx_time < fifo_tbins; bx_time++) {
55  // For any given bunch-crossing, start at the lowest keystrip and look for
56  // the number of separate layers in the pattern for that keystrip that have
57  // pulses at that bunch-crossing time. Do the same for the next keystrip,
58  // etc. Then do the entire process again for the next bunch-crossing, etc
59  // until you find a pre-trigger.
60  std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer> > hits_in_patterns;
61  hits_in_patterns.clear();
62 
63  bool hits_in_time = patternFinding(pulse, bx_time, hits_in_patterns);
64  if (hits_in_time) {
65  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < numHalfStrips_; hstrip++) {
66  if (infoV > 1) {
67  if (nhits[hstrip] > 0) {
68  LogTrace("CSCUpgradeCathodeLCTProcessor")
69  << " bx = " << std::setw(2) << bx_time << " --->"
70  << " halfstrip = " << std::setw(3) << hstrip << " best pid = " << std::setw(2) << best_pid[hstrip]
71  << " nhits = " << nhits[hstrip];
72  }
73  }
74  //ispretrig[hstrip] = false; it is initialzed in findLCT
75  if (nhits[hstrip] >= nplanes_hit_pretrig && best_pid[hstrip] >= pid_thresh_pretrig &&
76  !busyMap[hstrip][bx_time]) {
77  pre_trig = true;
78  ispretrig[hstrip] = true;
79 
80  // write each pre-trigger to output
81  nPreTriggers++;
82  const int bend =
84  const int halfstrip = hstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB;
85  const int cfeb = hstrip / CSCConstants::NUM_HALF_STRIPS_PER_CFEB;
87  1, nhits[hstrip], best_pid[hstrip], 1, bend, halfstrip, cfeb, bx_time, nPreTriggers, 0));
88 
89  } else if (nhits[hstrip] >= nplanes_hit_pretrig &&
90  best_pid[hstrip] >= pid_thresh_pretrig) { //busy zone, keep pretriggering,ignore this
91  ispretrig[hstrip] = true;
92  if (infoV > 1)
93  LogTrace("CSCUpgradeCathodeLCTProcessor")
94  << " halfstrip " << std::setw(3) << hstrip << " in dead zone and is pretriggerred";
95  } else if (nhits[hstrip] < nplanes_hit_pretrig || best_pid[hstrip] < pid_thresh_pretrig) {
96  // not pretriggered anyone, release dead zone
97  ispretrig[hstrip] = false;
98  }
99  } // find all pretriggers
100 
101  //update dead zone
102  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < numHalfStrips_; hstrip++) {
103  if (ispretrig[hstrip]) {
104  int min_hstrip = hstrip - delta_hs; //only fixed localized dead time zone is implemented
105  int max_hstrip = hstrip + delta_hs;
106  if (min_hstrip < stagger[CSCConstants::KEY_CLCT_LAYER - 1])
107  min_hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1];
108  if (max_hstrip >= numHalfStrips_)
109  max_hstrip = numHalfStrips_ - 1;
110  for (int hs = min_hstrip; hs <= max_hstrip; hs++)
111  busyMap[hs][bx_time + 1] = true;
112  if (infoV > 1)
113  LogTrace("CSCUpgradeCathodeLCTProcessor")
114  << " marked zone around pretriggerred halfstrip " << hstrip << " as dead zone for pretriggering at bx"
115  << bx_time + 1 << " halfstrip: [" << min_hstrip << "," << max_hstrip << "]";
116  }
117  }
118  if (pre_trig) {
119  first_bx = bx_time; // bx at time of pretrigger
120  return true;
121  }
122  } else //no pattern found, remove all dead time zone
123  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < numHalfStrips_; hstrip++) {
124  if (ispretrig[hstrip])
125  ispretrig[hstrip] = false; //dead zone is gone by default
126  }
127 
128  } // end loop over bx times
129 
130  if (infoV > 1)
131  LogTrace("CSCUpgradeCathodeLCTProcessor") << "no pretrigger, returning \n";
132  first_bx = fifo_tbins;
133  return false;
134 } // 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, CSCConstants::NUM_HALF_STRIPS_PER_CFEB, CSCConstants::NUM_LAYERS, CSCCathodeLCTProcessor::numHalfStrips_, 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:1016
mps_fire.i
i
Definition: mps_fire.py:428
CSCBaseboard::clctParams_
edm::ParameterSet clctParams_
Definition: CSCBaseboard.h:78
CSCCathodeLCTProcessor::stagger
int stagger[CSCConstants::NUM_LAYERS]
Definition: CSCCathodeLCTProcessor.h:199
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:206
CSCUpgradeCathodeLCTProcessor::preTrigger
bool preTrigger(const PulseArray pulse, const int start_bx, int &first_bx) override
Definition: CSCUpgradeCathodeLCTProcessor.cc:39
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::CLCT_PATTERN
Definition: CSCCathodeLCTProcessor.h:183
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
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
CSCCLCTDigi
Definition: CSCCLCTDigi.h:17
CSCConstants::MAX_CLCTS_PER_PROCESSOR
Definition: CSCConstants.h:69
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:109
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:203
CSCCathodeLCTProcessor::ispretrig
bool ispretrig[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
Definition: CSCCathodeLCTProcessor.h:175
CSCCathodeLCTProcessor::findLCTs
virtual std::vector< CSCCLCTDigi > findLCTs(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
Definition: CSCCathodeLCTProcessor.cc:547
CSCUpgradeCathodeLCTProcessor::use_dead_time_zoning
bool use_dead_time_zoning
Definition: CSCUpgradeCathodeLCTProcessor.h:43
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
CSCCLCTPreTriggerDigi
Definition: CSCCLCTPreTriggerDigi.h:15
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
CSCBaseboard::runPhase2_
bool runPhase2_
Definition: CSCBaseboard.h:84
CSCCathodeLCTProcessor::CLCT_CFEB
Definition: CSCCathodeLCTProcessor.h:189
CSCCathodeLCTProcessor::CLCT_STRIP
Definition: CSCCathodeLCTProcessor.h:185
CSCCathodeLCTProcessor::CLCT_BEND
Definition: CSCCathodeLCTProcessor.h:184
CSCCathodeLCTProcessor::CLCT_QUALITY
Definition: CSCCathodeLCTProcessor.h:188
CSCCathodeLCTProcessor::cleanComparatorContainer
void cleanComparatorContainer(CSCCLCTDigi &lct) const
Definition: CSCCathodeLCTProcessor.cc:1029
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:209
CSCCathodeLCTProcessor::best_pid
unsigned int best_pid[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
Definition: CSCCathodeLCTProcessor.h:167
CSCCathodeLCTProcessor::start_bx_shift
int start_bx_shift
Definition: CSCCathodeLCTProcessor.h:213
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
trklet::bend
double bend(double r, double rinv, double stripPitch)
Definition: Util.h:166
CSCUpgradeCathodeLCTProcessor::use_corrected_bx
bool use_corrected_bx
Definition: CSCUpgradeCathodeLCTProcessor.h:50
CSCCathodeLCTProcessor::nplanes_hit_pretrig
unsigned int nplanes_hit_pretrig
Definition: CSCCathodeLCTProcessor.h:208
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:234
CSCCathodeLCTProcessor::runCCLUT
void runCCLUT(CSCCLCTDigi &digi) const
Definition: CSCCathodeLCTProcessor.cc:1347
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: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
CSCBaseboard::runCCLUT_
bool runCCLUT_
Definition: CSCBaseboard.h:102
CSCCathodeLCTProcessor::clct_pattern_
CSCPatternBank::LCTPatterns clct_pattern_
Definition: CSCCathodeLCTProcessor.h:178
CSCCathodeLCTProcessor::CLCT_NUM_QUANTITIES
Definition: CSCCathodeLCTProcessor.h:190
CSCBaseboard::infoV
int infoV
Definition: CSCBaseboard.h:63