CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes
CSCCathodeLCTProcessor Class Reference

#include <CSCCathodeLCTProcessor.h>

Public Types

enum  CLCT_INDICES {
  CLCT_PATTERN, CLCT_BEND, CLCT_STRIP, CLCT_BX,
  CLCT_STRIP_TYPE, CLCT_QUALITY, CLCT_CFEB, CLCT_NUM_QUANTITIES = 7
}
 

Public Member Functions

void clear ()
 
 CSCCathodeLCTProcessor (unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf, const edm::ParameterSet &comm, const edm::ParameterSet &ctmb)
 
 CSCCathodeLCTProcessor ()
 
std::vector< CSCCLCTDigigetCLCTs ()
 
bool getDigis (const CSCComparatorDigiCollection *compdc)
 
void getDigis (const CSCComparatorDigiCollection *compdc, const CSCDetId &id)
 
std::vector< int > preTriggerBXs () const
 
std::vector< CSCCLCTPreTriggerDigipreTriggerDigis () const
 
std::vector< CSCCLCTPreTriggerDigipreTriggerDigisME1a ()
 
std::vector< CSCCLCTPreTriggerDigipreTriggerDigisME1b ()
 
std::vector< CSCCLCTDigireadoutCLCTs ()
 
std::vector< CSCCLCTDigireadoutCLCTsME1a ()
 
std::vector< CSCCLCTDigireadoutCLCTsME1b ()
 
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)
 
void setCSCGeometry (const CSCGeometry *g)
 

Public Attributes

CSCCLCTDigi bestCLCT [CSCConstants::MAX_CLCT_TBINS]
 
CSCCLCTDigi secondCLCT [CSCConstants::MAX_CLCT_TBINS]
 

Static Public Attributes

static const int pattern2007 [CSCConstants::NUM_CLCT_PATTERNS][CSCConstants::MAX_HALFSTRIPS_IN_PATTERN+2]
 
static const int pattern2007_offset [CSCConstants::MAX_HALFSTRIPS_IN_PATTERN]
 

Private Member Functions

void checkConfigParameters ()
 
void dumpConfigParams () const
 
void dumpDigis (const std::vector< int > strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips) const
 
std::vector< CSCCLCTDigifindLCTs (const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
 
std::vector< CSCCLCTDigifindLCTsSLHC (const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
 
void markBusyKeys (const int best_hstrip, const int best_patid, int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS])
 
bool preTrigger (const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int start_bx, int &first_bx)
 
bool ptnFinding (const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips, const unsigned int bx_time)
 
void pulseExtension (const std::vector< int > time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips, unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
 
void readComparatorDigis (std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
 
void setDefaultConfigParameters ()
 

Private Attributes

unsigned int alctClctOffset
 
unsigned int best_pid [CSCConstants::NUM_HALF_STRIPS_7CFEBS]
 
unsigned int clct_state_machine_zone
 
const CSCGeometrycsc_g
 
std::vector< CSCComparatorDigidigiV [CSCConstants::NUM_LAYERS]
 
bool disableME1a
 
unsigned int drift_delay
 
bool dynamic_state_machine_zone
 
int early_tbins
 
unsigned int fifo_pretrig
 
unsigned int fifo_tbins
 
int first_bx_corrected [CSCConstants::NUM_HALF_STRIPS_7CFEBS]
 
bool gangedME1a
 
unsigned int hit_persist
 
int infoV
 
bool isME11
 
bool ispretrig [CSCConstants::NUM_HALF_STRIPS_7CFEBS]
 
bool isSLHC
 
unsigned int min_separation
 
unsigned int nhits [CSCConstants::NUM_HALF_STRIPS_7CFEBS]
 
unsigned int nplanes_hit_pattern
 
unsigned int nplanes_hit_pretrig
 
int numStrips
 
unsigned int pid_thresh_pretrig
 
unsigned int pretrig_trig_zone
 
bool readout_earliest_2
 
int stagger [CSCConstants::NUM_LAYERS]
 
int start_bx_shift
 
unsigned int theChamber
 
const unsigned theEndcap
 
std::vector< int > thePreTriggerBXs
 
std::vector< CSCCLCTPreTriggerDigithePreTriggerDigis
 
unsigned int theRing
 
const unsigned theSector
 
const unsigned theStation
 
const unsigned theSubsector
 
const unsigned theTrigChamber
 
unsigned int tmb_l1a_window_size
 
bool use_corrected_bx
 
bool use_dead_time_zoning
 

Static Private Attributes

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.

The CathodeLCTs only come halfstrip flavors

Date
May 2001 Removed the card boundaries. Changed the Pretrigger to emulate the hardware electronic logic. Also changed the keylayer to be the 4th layer in a chamber instead of the 3rd layer from the interaction region. The code is a more realistic simulation of hardware LCT logic now. -Jason Mumford.
Author
Benn Tannenbaum UCLA 13 July 1999 benn@.nosp@m.phys.nosp@m.ics.u.nosp@m.cla..nosp@m.edu Numerous later improvements by Jason Mumford and Slava Valuev (see cvs in ORCA). Porting from ORCA by S. Valuev (Slava.nosp@m..Val.nosp@m.uev@c.nosp@m.ern..nosp@m.ch), May 2006.

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 44 of file CSCCathodeLCTProcessor.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

CSCCathodeLCTProcessor::CSCCathodeLCTProcessor ( unsigned  endcap,
unsigned  station,
unsigned  sector,
unsigned  subsector,
unsigned  chamber,
const edm::ParameterSet conf,
const edm::ParameterSet comm,
const edm::ParameterSet ctmb 
)

Normal constructor.

Definition at line 150 of file CSCCathodeLCTProcessor.cc.

References alctClctOffset, CSCTriggerNumbering::chamberFromTriggerLabels(), checkConfigParameters(), CSCConstants::CLCT_EMUL_TIME_OFFSET, clct_state_machine_zone, disableME1a, drift_delay, dumpConfigParams(), dynamic_state_machine_zone, early_tbins, edm::ParameterSet::existsAs(), fifo_pretrig, fifo_tbins, gangedME1a, edm::ParameterSet::getParameter(), hit_persist, infoV, isME11, isSLHC, min_separation, nplanes_hit_pattern, nplanes_hit_pretrig, CSCConstants::NUM_LAYERS, numStrips, pid_thresh_pretrig, pretrig_trig_zone, readout_earliest_2, CSCTriggerNumbering::ringFromTriggerLabels(), stagger, start_bx_shift, theChamber, thePreTriggerDigis, theRing, theSector, theStation, theSubsector, theTrigChamber, tmb_l1a_window_size, use_corrected_bx, and use_dead_time_zoning.

157  :
159  theSubsector(subsector), theTrigChamber(chamber) {
160  static std::atomic<bool> config_dumped{false};
161 
162  // CLCT configuration parameters.
163  fifo_tbins = conf.getParameter<unsigned int>("clctFifoTbins");
164  hit_persist = conf.getParameter<unsigned int>("clctHitPersist");
165  drift_delay = conf.getParameter<unsigned int>("clctDriftDelay");
167  conf.getParameter<unsigned int>("clctNplanesHitPretrig");
169  conf.getParameter<unsigned int>("clctNplanesHitPattern");
170 
171  // Not used yet.
172  fifo_pretrig = conf.getParameter<unsigned int>("clctFifoPretrig");
173 
174  // Flag for SLHC studies
175  isSLHC = comm.getParameter<bool>("isSLHC");
176 
177  // shift the BX from 7 to 8
178  // the unpacked real data CLCTs have central BX at bin 7
179  // however in simulation the central BX is bin 8
180  // to make a proper comparison with ALCTs we need
181  // CLCT and ALCT to have the central BX in the same bin
182  // this shift does not affect the readout of the CLCTs
183  // emulated CLCTs put in the event should be centered at bin 7 (as in data)
184  alctClctOffset = comm.getParameter<unsigned int>("alctClctOffset");
185 
186  // special configuration parameters for ME11 treatment
187  disableME1a = comm.getParameter<bool>("disableME1a");
188  gangedME1a = comm.getParameter<bool>("gangedME1a");
189 
191  conf.getParameter<unsigned int>("clctPidThreshPretrig");
193  conf.getParameter<unsigned int>("clctMinSeparation");
194 
195  start_bx_shift = conf.getParameter<int>("clctStartBxShift");
196 
197  if (isSLHC) {
198  // use of localized dead-time zones
199  use_dead_time_zoning = conf.existsAs<bool>("useDeadTimeZoning")?conf.getParameter<bool>("useDeadTimeZoning"):true;
200  clct_state_machine_zone = conf.existsAs<unsigned int>("clctStateMachineZone")?conf.getParameter<unsigned int>("clctStateMachineZone"):8;
201  dynamic_state_machine_zone = conf.existsAs<bool>("useDynamicStateMachineZone")?conf.getParameter<bool>("useDynamicStateMachineZone"):true;
202 
203  // how far away may trigger happen from pretrigger
204  pretrig_trig_zone = conf.existsAs<unsigned int>("clctPretriggerTriggerZone")?conf.getParameter<unsigned int>("clctPretriggerTriggerZone"):5;
205 
206  // whether to calculate bx as corrected_bx instead of pretrigger one
207  use_corrected_bx = conf.existsAs<bool>("clctUseCorrectedBx")?conf.getParameter<bool>("clctUseCorrectedBx"):true;
208  }
209 
210  // Motherboard parameters: common for all configurations.
211  tmb_l1a_window_size = // Common to CLCT and TMB
212  ctmb.getParameter<unsigned int>("tmbL1aWindowSize");
213 
214  // separate handle for early time bins
215  early_tbins = ctmb.getParameter<int>("tmbEarlyTbins");
216  if (early_tbins<0) early_tbins = fifo_pretrig - CSCConstants::CLCT_EMUL_TIME_OFFSET;
217 
218  // wether to readout only the earliest two LCTs in readout window
219  readout_earliest_2 = ctmb.getParameter<bool>("tmbReadoutEarliest2");
220 
221  // Verbosity level, set to 0 (no print) by default.
222  infoV = conf.getParameter<int>("verbosity");
223 
224  // Check and print configuration parameters.
226  if ((infoV > 0 || isSLHC) && !config_dumped) {
227  //std::cerr<<"**** CLCT constructor parameters dump ****"<<std::endl;
229  config_dumped = true;
230  }
231 
232  numStrips = 0; // Will be set later.
233  // Provisional, but should be OK for all stations except ME1.
234  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
235  if ((i_layer+1)%2 == 0) stagger[i_layer] = 0;
236  else stagger[i_layer] = 1;
237  }
238 
240 
243 
244  // trigger numbering doesn't distinguish between ME1a and ME1b chambers:
245  isME11 = (theStation == 1 && theRing == 1);
246 
247  thePreTriggerDigis.clear();
248 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:185
static int ringFromTriggerLabels(int station, int triggerCSCID)
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis
int stagger[CSCConstants::NUM_LAYERS]
static int chamberFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station, int TriggerCSCID)
CSCCathodeLCTProcessor::CSCCathodeLCTProcessor ( )

Default constructor. Used for testing.

Definition at line 250 of file CSCCathodeLCTProcessor.cc.

References checkConfigParameters(), clct_state_machine_zone, disableME1a, dumpConfigParams(), early_tbins, gangedME1a, infoV, isME11, isSLHC, CSCConstants::MAX_NUM_STRIPS, CSCConstants::NUM_LAYERS, numStrips, CSCTriggerNumbering::ringFromTriggerLabels(), setDefaultConfigParameters(), stagger, start_bx_shift, thePreTriggerDigis, theRing, theStation, theTrigChamber, and use_dead_time_zoning.

250  :
251  theEndcap(1), theStation(1), theSector(1),
253  // constructor for debugging.
254  static std::atomic<bool> config_dumped{false};
255 
256  // CLCT configuration parameters.
258  infoV = 2;
259 
260  isSLHC = false;
261  disableME1a = false;
262  gangedME1a = true;
263 
264  early_tbins = 4;
265 
266  start_bx_shift = 0;
267  use_dead_time_zoning = true;
269 
270  // Check and print configuration parameters.
272  if (!config_dumped) {
274  config_dumped = true;
275  }
276 
278  // Should be OK for all stations except ME1.
279  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
280  if ((i_layer+1)%2 == 0) stagger[i_layer] = 0;
281  else stagger[i_layer] = 1;
282  }
283 
285  isME11 = (theStation == 1 && theRing == 1);
286 
287  thePreTriggerDigis.clear();
288 }
static int ringFromTriggerLabels(int station, int triggerCSCID)
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis
int stagger[CSCConstants::NUM_LAYERS]

Member Function Documentation

void CSCCathodeLCTProcessor::checkConfigParameters ( )
private

Make sure that the parameter values are within the allowed range.

Definition at line 327 of file CSCCathodeLCTProcessor.cc.

References def_drift_delay, def_fifo_pretrig, def_fifo_tbins, def_hit_persist, def_min_separation, def_nplanes_hit_pattern, def_nplanes_hit_pretrig, def_pid_thresh_pretrig, def_tmb_l1a_window_size, drift_delay, fifo_pretrig, fifo_tbins, hit_persist, infoV, min_separation, nplanes_hit_pattern, nplanes_hit_pretrig, CSCConstants::NUM_HALF_STRIPS_7CFEBS, pid_thresh_pretrig, and tmb_l1a_window_size.

Referenced by CSCCathodeLCTProcessor(), and setConfigParameters().

327  {
328  // Make sure that the parameter values are within the allowed range.
329 
330  // Max expected values.
331  static const unsigned int max_fifo_tbins = 1 << 5;
332  static const unsigned int max_fifo_pretrig = 1 << 5;
333  static const unsigned int max_hit_persist = 1 << 4;
334  static const unsigned int max_drift_delay = 1 << 2;
335  static const unsigned int max_nplanes_hit_pretrig = 1 << 3;
336  static const unsigned int max_nplanes_hit_pattern = 1 << 3;
337  static const unsigned int max_pid_thresh_pretrig = 1 << 4;
338  static const unsigned int max_min_separation = CSCConstants::NUM_HALF_STRIPS_7CFEBS;
339  static const unsigned int max_tmb_l1a_window_size = 1 << 4;
340 
341  // Checks.
342  if (fifo_tbins >= max_fifo_tbins) {
343  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorConfigError")
344  << "+++ Value of fifo_tbins, " << fifo_tbins
345  << ", exceeds max allowed, " << max_fifo_tbins-1 << " +++\n"
346  << "+++ Try to proceed with the default value, fifo_tbins="
347  << def_fifo_tbins << " +++\n";
349  }
350  if (fifo_pretrig >= max_fifo_pretrig) {
351  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorConfigError")
352  << "+++ Value of fifo_pretrig, " << fifo_pretrig
353  << ", exceeds max allowed, " << max_fifo_pretrig-1 << " +++\n"
354  << "+++ Try to proceed with the default value, fifo_pretrig="
355  << def_fifo_pretrig << " +++\n";
357  }
358  if (hit_persist >= max_hit_persist) {
359  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorConfigError")
360  << "+++ Value of hit_persist, " << hit_persist
361  << ", exceeds max allowed, " << max_hit_persist-1 << " +++\n"
362  << "+++ Try to proceed with the default value, hit_persist="
363  << def_hit_persist << " +++\n";
365  }
366  if (drift_delay >= max_drift_delay) {
367  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorConfigError")
368  << "+++ Value of drift_delay, " << drift_delay
369  << ", exceeds max allowed, " << max_drift_delay-1 << " +++\n"
370  << "+++ Try to proceed with the default value, drift_delay="
371  << def_drift_delay << " +++\n";
373  }
374  if (nplanes_hit_pretrig >= max_nplanes_hit_pretrig) {
375  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorConfigError")
376  << "+++ Value of nplanes_hit_pretrig, " << nplanes_hit_pretrig
377  << ", exceeds max allowed, " << max_nplanes_hit_pretrig-1 << " +++\n"
378  << "+++ Try to proceed with the default value, nplanes_hit_pretrig="
379  << def_nplanes_hit_pretrig << " +++\n";
381  }
382  if (nplanes_hit_pattern >= max_nplanes_hit_pattern) {
383  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorConfigError")
384  << "+++ Value of nplanes_hit_pattern, " << nplanes_hit_pattern
385  << ", exceeds max allowed, " << max_nplanes_hit_pattern-1 << " +++\n"
386  << "+++ Try to proceed with the default value, nplanes_hit_pattern="
387  << def_nplanes_hit_pattern << " +++\n";
389  }
390 
391  if (pid_thresh_pretrig >= max_pid_thresh_pretrig) {
392  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorConfigError")
393  << "+++ Value of pid_thresh_pretrig, " << pid_thresh_pretrig
394  << ", exceeds max allowed, " << max_pid_thresh_pretrig-1 << " +++\n"
395  << "+++ Try to proceed with the default value, pid_thresh_pretrig="
396  << def_pid_thresh_pretrig << " +++\n";
398  }
399  if (min_separation >= max_min_separation) {
400  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorConfigError")
401  << "+++ Value of min_separation, " << min_separation
402  << ", exceeds max allowed, " << max_min_separation-1 << " +++\n"
403  << "+++ Try to proceed with the default value, min_separation="
404  << def_min_separation << " +++\n";
406  }
407 
408  if (tmb_l1a_window_size >= max_tmb_l1a_window_size) {
409  if (infoV > 0) edm::LogError("L1CSCTPEmulatorConfigError")
410  << "+++ Value of tmb_l1a_window_size, " << tmb_l1a_window_size
411  << ", exceeds max allowed, " << max_tmb_l1a_window_size-1 << " +++\n"
412  << "+++ Try to proceed with the default value, tmb_l1a_window_size="
413  << def_tmb_l1a_window_size << " +++\n";
415  }
416 }
static const unsigned int def_drift_delay
static const unsigned int def_fifo_tbins
static const unsigned int def_min_separation
static const unsigned int def_nplanes_hit_pretrig
static const unsigned int def_pid_thresh_pretrig
static const unsigned int def_tmb_l1a_window_size
static const unsigned int def_nplanes_hit_pattern
static const unsigned int def_fifo_pretrig
static const unsigned int def_hit_persist
void CSCCathodeLCTProcessor::clear ( void  )

Clears the LCT containers.

Definition at line 418 of file CSCCathodeLCTProcessor.cc.

References bestCLCT, CSCCLCTDigi::clear(), CSCConstants::MAX_CLCT_TBINS, secondCLCT, thePreTriggerBXs, and thePreTriggerDigis.

418  {
419  thePreTriggerDigis.clear();
420  thePreTriggerBXs.clear();
421  for (int bx = 0; bx < CSCConstants::MAX_CLCT_TBINS; bx++) {
422  bestCLCT[bx].clear();
423  secondCLCT[bx].clear();
424  }
425 }
CSCCLCTDigi bestCLCT[CSCConstants::MAX_CLCT_TBINS]
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis
std::vector< int > thePreTriggerBXs
CSCCLCTDigi secondCLCT[CSCConstants::MAX_CLCT_TBINS]
void clear()
clear this CLCT
Definition: CSCCLCTDigi.cc:58
void CSCCathodeLCTProcessor::dumpConfigParams ( ) const
private

Dump CLCT configuration parameters.

Definition at line 1503 of file CSCCathodeLCTProcessor.cc.

References drift_delay, fifo_pretrig, fifo_tbins, hit_persist, LogDebug, min_separation, nplanes_hit_pattern, nplanes_hit_pretrig, and pid_thresh_pretrig.

Referenced by CSCCathodeLCTProcessor(), run(), and setConfigParameters().

1503  {
1504  std::ostringstream strm;
1505  strm << "\n";
1506  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
1507  strm << "+ CLCT configuration parameters: +\n";
1508  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
1509  strm << " fifo_tbins [total number of time bins in DAQ readout] = "
1510  << fifo_tbins << "\n";
1511  strm << " fifo_pretrig [start time of cathode raw hits in DAQ readout] = "
1512  << fifo_pretrig << "\n";
1513  strm << " hit_persist [duration of signal pulse, in 25 ns bins] = "
1514  << hit_persist << "\n";
1515  strm << " drift_delay [time after pre-trigger before TMB latches LCTs] = "
1516  << drift_delay << "\n";
1517  strm << " nplanes_hit_pretrig [min. number of layers hit for pre-trigger] = "
1518  << nplanes_hit_pretrig << "\n";
1519  strm << " nplanes_hit_pattern [min. number of layers hit for trigger] = "
1520  << nplanes_hit_pattern << "\n";
1521  strm << " pid_thresh_pretrig [lower threshold on pattern id] = "
1522  << pid_thresh_pretrig << "\n";
1523  strm << " min_separation [region of busy key strips] = "
1524  << min_separation << "\n";
1525  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
1526  LogDebug("CSCCathodeLCTProcessor") << strm.str();
1527  //std::cerr<<strm.str()<<std::endl;
1528 }
#define LogDebug(id)
void CSCCathodeLCTProcessor::dumpDigis ( const std::vector< int >  strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
const int  nStrips 
) const
private

Dump half-strip digis

Definition at line 1531 of file CSCCathodeLCTProcessor.cc.

References CSCDetId::chamberName(), TauDecayModes::dec, relativeConstraints::empty, LogDebug, LogTrace, CSCConstants::NUM_HALF_STRIPS_PER_CFEB, CSCConstants::NUM_LAYERS, digitizers_cfi::strip, theChamber, theEndcap, theRing, and theStation.

Referenced by findLCTs(), and findLCTsSLHC().

1532 {
1533  LogDebug("CSCCathodeLCTProcessor")
1535  << " strip type: half-strip, nStrips " << nStrips;
1536 
1537  std::ostringstream strstrm;
1538  for (int i_strip = 0; i_strip < nStrips; i_strip++) {
1539  if (i_strip%10 == 0) {
1540  if (i_strip < 100) strstrm << i_strip/10;
1541  else strstrm << (i_strip-100)/10;
1542  }
1543  else strstrm << " ";
1544  if ((i_strip+1)%CSCConstants::NUM_HALF_STRIPS_PER_CFEB == 0) strstrm << " ";
1545  }
1546  strstrm << "\n";
1547  for (int i_strip = 0; i_strip < nStrips; i_strip++) {
1548  strstrm << i_strip%10;
1549  if ((i_strip+1)%CSCConstants::NUM_HALF_STRIPS_PER_CFEB == 0) strstrm << " ";
1550  }
1551  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
1552  strstrm << "\n";
1553  for (int i_strip = 0; i_strip < nStrips; i_strip++) {
1554  if (!strip[i_layer][i_strip].empty()) {
1555  std::vector<int> bx_times = strip[i_layer][i_strip];
1556  // Dump only the first in time.
1557  strstrm << std::hex << bx_times[0] << std::dec;
1558  }
1559  else {
1560  strstrm << "-";
1561  }
1562  if ((i_strip+1)%CSCConstants::NUM_HALF_STRIPS_PER_CFEB == 0) strstrm << " ";
1563  }
1564  }
1565  LogTrace("CSCCathodeLCTProcessor") << strstrm.str();
1566 }
#define LogDebug(id)
#define LogTrace(id)
std::string chamberName() const
Definition: CSCDetId.cc:71
std::vector< CSCCLCTDigi > CSCCathodeLCTProcessor::findLCTs ( const std::vector< int >  halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
private

Definition at line 790 of file CSCCathodeLCTProcessor.cc.

References best_pid, CLCT_BEND, CLCT_BX, CLCT_CFEB, CLCT_NUM_QUANTITIES, CLCT_PATTERN, CLCT_QUALITY, CLCT_STRIP, CLCT_STRIP_TYPE, drift_delay, dumpDigis(), fifo_tbins, infoV, CSCConstants::KEY_CLCT_LAYER, LogTrace, markBusyKeys(), CSCConstants::MAX_CLCTS_PER_PROCESSOR, CSCConstants::MAX_HALFSTRIPS_IN_PATTERN, nhits, nplanes_hit_pattern, CSCConstants::NUM_HALF_STRIPS_7CFEBS, CSCConstants::NUM_HALF_STRIPS_PER_CFEB, CSCConstants::NUM_LAYERS, numStrips, pattern2007, preTrigger(), ptnFinding(), pulse(), pulseExtension(), jets_cff::quality, stagger, start_bx_shift, and thePreTriggerBXs.

Referenced by run().

790  {
791  std::vector<CSCCLCTDigi> lctList;
792 
793  // Max. number of half-strips for this chamber.
794  const int maxHalfStrips = 2*numStrips + 1;
795 
796  if (infoV > 1) dumpDigis(halfstrip, maxHalfStrips);
797 
798  // 2 possible LCTs per CSC x 7 LCT quantities
801 
802  // Fire half-strip one-shots for hit_persist bx's (4 bx's by default).
803  pulseExtension(halfstrip, maxHalfStrips, pulse);
804 
805  unsigned int start_bx = start_bx_shift;
806  // Stop drift_delay bx's short of fifo_tbins since at later bx's we will
807  // not have a full set of hits to start pattern search anyway.
808  unsigned int stop_bx = fifo_tbins - drift_delay;
809  // Allow for more than one pass over the hits in the time window.
810  while (start_bx < stop_bx) {
811  // All half-strip pattern envelopes are evaluated simultaneously, on every
812  // clock cycle.
813  int first_bx = 999;
814  bool pre_trig = preTrigger(pulse, start_bx, first_bx);
815 
816  // If any of half-strip envelopes has enough layers hit in it, TMB
817  // will pre-trigger.
818  if (pre_trig) {
819  thePreTriggerBXs.push_back(first_bx);
820  if (infoV > 1) LogTrace("CSCCathodeLCTProcessor")
821  << "..... pretrigger at bx = " << first_bx
822  << "; waiting drift delay .....";
823 
824  // TMB latches LCTs drift_delay clocks after pretrigger.
825  int latch_bx = first_bx + drift_delay;
826  bool hits_in_time = ptnFinding(pulse, maxHalfStrips, latch_bx);
827  if (infoV > 1) {
828  if (hits_in_time) {
829  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER-1];
830  hstrip < maxHalfStrips; hstrip++) {
831  if (nhits[hstrip] > 0) {
832  LogTrace("CSCCathodeLCTProcessor")
833  << " bx = " << std::setw(2) << latch_bx << " --->"
834  << " halfstrip = " << std::setw(3) << hstrip
835  << " best pid = " << std::setw(2) << best_pid[hstrip]
836  << " nhits = " << nhits[hstrip];
837  }
838  }
839  }
840  }
841  // The pattern finder runs continuously, so another pre-trigger
842  // could occur already at the next bx.
843  start_bx = first_bx + 1;
844 
845  // Quality for sorting.
848  for (int ilct = 0; ilct < CSCConstants::MAX_CLCTS_PER_PROCESSOR; ilct++) {
849  best_halfstrip[ilct] = -1;
850  best_quality[ilct] = 0;
851  }
852 
853  // Calculate quality from pattern id and number of hits, and
854  // simultaneously select best-quality LCT.
855  if (hits_in_time) {
856  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER-1];
857  hstrip < maxHalfStrips; hstrip++) {
858  // The bend-direction bit pid[0] is ignored (left and right
859  // bends have equal quality).
860  quality[hstrip] = (best_pid[hstrip] & 14) | (nhits[hstrip] << 5);
861  if (quality[hstrip] > best_quality[0]) {
862  best_halfstrip[0] = hstrip;
863  best_quality[0] = quality[hstrip];
864  }
865  if (infoV > 1 && quality[hstrip] > 0) {
866  LogTrace("CSCCathodeLCTProcessor")
867  << " 1st CLCT: halfstrip = " << std::setw(3) << hstrip
868  << " quality = " << std::setw(3) << quality[hstrip]
869  << " nhits = " << std::setw(3) << nhits[hstrip]
870  << " pid = " << std::setw(3) << best_pid[hstrip]
871  << " best halfstrip = " << std::setw(3) << best_halfstrip[0]
872  << " best quality = " << std::setw(3) << best_quality[0];
873  }
874  }
875  }
876 
877  // If 1st best CLCT is found, look for the 2nd best.
878  if (best_halfstrip[0] >= 0) {
879  // Mark keys near best CLCT as busy by setting their quality to
880  // zero, and repeat the search.
881  markBusyKeys(best_halfstrip[0], best_pid[best_halfstrip[0]], quality);
882 
883  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER-1];
884  hstrip < maxHalfStrips; hstrip++) {
885  if (quality[hstrip] > best_quality[1]) {
886  best_halfstrip[1] = hstrip;
887  best_quality[1] = quality[hstrip];
888  }
889  if (infoV > 1 && quality[hstrip] > 0) {
890  LogTrace("CSCCathodeLCTProcessor")
891  << " 2nd CLCT: halfstrip = " << std::setw(3) << hstrip
892  << " quality = " << std::setw(3) << quality[hstrip]
893  << " nhits = " << std::setw(3) << nhits[hstrip]
894  << " pid = " << std::setw(3) << best_pid[hstrip]
895  << " best halfstrip = " << std::setw(3) << best_halfstrip[1]
896  << " best quality = " << std::setw(3) << best_quality[1];
897  }
898  }
899 
900  // Pattern finder.
901  bool ptn_trig = false;
902  for (int ilct = 0; ilct < CSCConstants::MAX_CLCTS_PER_PROCESSOR; ilct++) {
903  int best_hs = best_halfstrip[ilct];
904  if (best_hs >= 0 && nhits[best_hs] >= nplanes_hit_pattern) {
905  ptn_trig = true;
906  keystrip_data[ilct][CLCT_PATTERN] = best_pid[best_hs];
907  keystrip_data[ilct][CLCT_BEND] =
909  // Remove stagger if any.
910  keystrip_data[ilct][CLCT_STRIP] =
912  keystrip_data[ilct][CLCT_BX] = first_bx;
913  keystrip_data[ilct][CLCT_STRIP_TYPE] = 1; // obsolete
914  keystrip_data[ilct][CLCT_QUALITY] = nhits[best_hs];
915  keystrip_data[ilct][CLCT_CFEB] =
917  int halfstrip_in_cfeb = keystrip_data[ilct][CLCT_STRIP] -
919 
920  if (infoV > 1) LogTrace("CSCCathodeLCTProcessor")
921  << " Final selection: ilct " << ilct
922  << " key halfstrip " << keystrip_data[ilct][CLCT_STRIP]
923  << " quality " << keystrip_data[ilct][CLCT_QUALITY]
924  << " pattern " << keystrip_data[ilct][CLCT_PATTERN]
925  << " bx " << keystrip_data[ilct][CLCT_BX];
926 
927  CSCCLCTDigi thisLCT(1, keystrip_data[ilct][CLCT_QUALITY],
928  keystrip_data[ilct][CLCT_PATTERN],
929  keystrip_data[ilct][CLCT_STRIP_TYPE],
930  keystrip_data[ilct][CLCT_BEND],
931  halfstrip_in_cfeb,
932  keystrip_data[ilct][CLCT_CFEB],
933  keystrip_data[ilct][CLCT_BX]);
934  lctList.push_back(thisLCT);
935  }
936  }
937 
938  if (ptn_trig) {
939  // Once there was a trigger, CLCT pre-trigger state machine
940  // checks the number of hits that lie on a pattern template
941  // at every bx, and waits for it to drop below threshold.
942  // The search for CLCTs resumes only when the number of hits
943  // drops below threshold.
944  start_bx = fifo_tbins;
945  // Stop checking drift_delay bx's short of fifo_tbins since
946  // at later bx's we won't have a full set of hits for a
947  // pattern search anyway.
948  unsigned int stop_time = fifo_tbins - drift_delay;
949  for (unsigned int bx = latch_bx + 1; bx < stop_time; bx++) {
950  bool return_to_idle = true;
951  bool hits_in_time = ptnFinding(pulse, maxHalfStrips, bx);
952  if (hits_in_time) {
953  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER-1];
954  hstrip < maxHalfStrips; hstrip++) {
955  if (nhits[hstrip] >= nplanes_hit_pattern) {
956  if (infoV > 1) LogTrace("CSCCathodeLCTProcessor")
957  << " State machine busy at bx = " << bx;
958  return_to_idle = false;
959  break;
960  }
961  }
962  }
963  if (return_to_idle) {
964  if (infoV > 1) LogTrace("CSCCathodeLCTProcessor")
965  << " State machine returns to idle state at bx = " << bx;
966  start_bx = bx;
967  break;
968  }
969  }
970  }
971  }
972  }
973  else {
974  start_bx = first_bx + 1; // no dead time
975  }
976  }
977 
978  return lctList;
979 } // findLCTs -- TMB-07 version.
void dumpDigis(const std::vector< int > strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips) const
bool preTrigger(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int start_bx, int &first_bx)
unsigned int best_pid[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
void markBusyKeys(const int best_hstrip, const int best_patid, int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS])
static const int pattern2007[CSCConstants::NUM_CLCT_PATTERNS][CSCConstants::MAX_HALFSTRIPS_IN_PATTERN+2]
#define LogTrace(id)
bool ptnFinding(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips, const unsigned int bx_time)
double pulse(double x, double y, double z, double t)
std::vector< int > thePreTriggerBXs
int stagger[CSCConstants::NUM_LAYERS]
unsigned int nhits[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
void pulseExtension(const std::vector< int > time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips, unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
std::vector< CSCCLCTDigi > CSCCathodeLCTProcessor::findLCTsSLHC ( const std::vector< int >  halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
private

Definition at line 1241 of file CSCCathodeLCTProcessor.cc.

References best_pid, CLCT_BEND, CLCT_BX, CLCT_CFEB, CLCT_NUM_QUANTITIES, CLCT_PATTERN, CLCT_QUALITY, clct_state_machine_zone, CLCT_STRIP, CLCT_STRIP_TYPE, drift_delay, dumpDigis(), dynamic_state_machine_zone, fifo_tbins, first_bx_corrected, mps_fire::i, infoV, ispretrig, CSCConstants::KEY_CLCT_LAYER, LogTrace, markBusyKeys(), CSCConstants::MAX_CLCT_TBINS, CSCConstants::MAX_CLCTS_PER_PROCESSOR, CSCConstants::MAX_HALFSTRIPS_IN_PATTERN, nhits, nplanes_hit_pattern, CSCConstants::NUM_HALF_STRIPS_7CFEBS, CSCConstants::NUM_HALF_STRIPS_PER_CFEB, CSCConstants::NUM_LAYERS, numStrips, pattern2007, pretrig_trig_zone, preTrigger(), ptnFinding(), pulse(), pulseExtension(), jets_cff::quality, CSCCLCTDigi::setFullBX(), stagger, start_bx_shift, and use_corrected_bx.

Referenced by run().

1242 {
1243  std::vector<CSCCLCTDigi> lctList;
1244 
1245  // Max. number of half-strips for this chamber.
1246  const int maxHalfStrips = 2 * numStrips + 1;
1247 
1248  if (infoV > 1) dumpDigis(halfstrip, maxHalfStrips);
1249 
1250  // keeps dead-time zones around key halfstrips of triggered CLCTs
1252  for (int i = 0; i < CSCConstants::NUM_HALF_STRIPS_7CFEBS; i++)
1253  for (int j = 0; j < CSCConstants::MAX_CLCT_TBINS; j++)
1254  busyMap[i][j] = false;
1255 
1256  std::vector<CSCCLCTDigi> lctListBX;
1257 
1259 
1260  // Fire half-strip one-shots for hit_persist bx's (4 bx's by default).
1261  pulseExtension(halfstrip, maxHalfStrips, pulse);
1262 
1263  unsigned int start_bx = start_bx_shift;
1264  // Stop drift_delay bx's short of fifo_tbins since at later bx's we will
1265  // not have a full set of hits to start pattern search anyway.
1266  unsigned int stop_bx = fifo_tbins - drift_delay;
1267 
1268  // Allow for more than one pass over the hits in the time window.
1269  // Do search in every BX
1270  while (start_bx < stop_bx)
1271  {
1272  lctListBX.clear();
1273 
1274  // All half-strip pattern envelopes are evaluated simultaneously, on every clock cycle.
1275  int first_bx = 999;
1276  bool pre_trig = preTrigger(pulse, start_bx, first_bx);
1277 
1278  // If any of half-strip envelopes has enough layers hit in it, TMB
1279  // will pre-trigger.
1280  if (pre_trig)
1281  {
1282  if (infoV > 1)
1283  LogTrace("CSCCathodeLCTProcessor") << "..... pretrigger at bx = " << first_bx << "; waiting drift delay .....";
1284 
1285  // TMB latches LCTs drift_delay clocks after pretrigger.
1286  int latch_bx = first_bx + drift_delay;
1287  bool hits_in_time = ptnFinding(pulse, maxHalfStrips, latch_bx);
1288  if (infoV > 1)
1289  {
1290  if (hits_in_time)
1291  {
1292  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < maxHalfStrips; hstrip++)
1293  {
1294  if (nhits[hstrip] > 0)
1295  {
1296  LogTrace("CSCCathodeLCTProcessor") << " bx = " << std::setw(2) << latch_bx << " --->" << " halfstrip = "
1297  << std::setw(3) << hstrip << " best pid = " << std::setw(2) << best_pid[hstrip] << " nhits = " << nhits[hstrip];
1298  }
1299  }
1300  }
1301  }
1302  // The pattern finder runs continuously, so another pre-trigger
1303  // could occur already at the next bx.
1304  start_bx = first_bx + 1;
1305 
1306  // 2 possible LCTs per CSC x 7 LCT quantities per BX
1307  int keystrip_data[CSCConstants::MAX_CLCTS_PER_PROCESSOR][CLCT_NUM_QUANTITIES] = {{0}};
1308 
1309  // Quality for sorting.
1312  for (int ilct = 0; ilct < CSCConstants::MAX_CLCTS_PER_PROCESSOR; ilct++)
1313  {
1314  best_halfstrip[ilct] = -1;
1315  best_quality[ilct] = 0;
1316  }
1317 
1318  bool pretrig_zone[CSCConstants::NUM_HALF_STRIPS_7CFEBS];
1319 
1320  // Calculate quality from pattern id and number of hits, and
1321  // simultaneously select best-quality LCT.
1322  if (hits_in_time)
1323  {
1324  // first, mark half-strip zones around pretriggers
1325  // that happened at the current first_bx
1326  for (int hstrip = 0; hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS; hstrip++)
1327  pretrig_zone[hstrip] = false;
1328  for (int hstrip = 0; hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS; hstrip++)
1329  {
1330  if (ispretrig[hstrip])
1331  {
1332  int min_hs = hstrip - pretrig_trig_zone;
1333  int max_hs = hstrip + pretrig_trig_zone;
1334  if (min_hs < 0)
1335  min_hs = 0;
1336  if (max_hs > CSCConstants::NUM_HALF_STRIPS_7CFEBS - 1)
1337  max_hs = CSCConstants::NUM_HALF_STRIPS_7CFEBS - 1;
1338  for (int hs = min_hs; hs <= max_hs; hs++)
1339  pretrig_zone[hs] = true;
1340  if (infoV > 1)
1341  LogTrace("CSCCathodeLCTProcessor") << " marked pretrigger halfstrip zone [" << min_hs << "," << max_hs << "]";
1342  }
1343  }
1344 
1345  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < maxHalfStrips; hstrip++)
1346  {
1347  // The bend-direction bit pid[0] is ignored (left and right bends have equal quality).
1348  quality[hstrip] = (best_pid[hstrip] & 14) | (nhits[hstrip] << 5);
1349  // do not consider halfstrips:
1350  // - out of pretrigger-trigger zones
1351  // - in busy zones from previous trigger
1352  if (quality[hstrip] > best_quality[0] &&
1353  pretrig_zone[hstrip] &&
1354  !busyMap[hstrip][first_bx] )
1355  {
1356  best_halfstrip[0] = hstrip;
1357  best_quality[0] = quality[hstrip];
1358  if (infoV > 1)
1359  {
1360  LogTrace("CSCCathodeLCTProcessor") << " 1st CLCT: halfstrip = " << std::setw(3) << hstrip << " quality = "
1361  << std::setw(3) << quality[hstrip] << " best halfstrip = " << std::setw(3) << best_halfstrip[0]
1362  << " best quality = " << std::setw(3) << best_quality[0];
1363  }
1364  }
1365  }
1366  }
1367 
1368  // If 1st best CLCT is found, look for the 2nd best.
1369  if (best_halfstrip[0] >= 0)
1370  {
1371  // Mark keys near best CLCT as busy by setting their quality to zero, and repeat the search.
1372  markBusyKeys(best_halfstrip[0], best_pid[best_halfstrip[0]], quality);
1373 
1374  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < maxHalfStrips; hstrip++)
1375  {
1376  if (quality[hstrip] > best_quality[1] &&
1377  pretrig_zone[hstrip] &&
1378  !busyMap[hstrip][first_bx] )
1379  {
1380  best_halfstrip[1] = hstrip;
1381  best_quality[1] = quality[hstrip];
1382  if (infoV > 1)
1383  {
1384  LogTrace("CSCCathodeLCTProcessor") << " 2nd CLCT: halfstrip = " << std::setw(3) << hstrip << " quality = "
1385  << std::setw(3) << quality[hstrip] << " best halfstrip = " << std::setw(3) << best_halfstrip[1]
1386  << " best quality = " << std::setw(3) << best_quality[1];
1387  }
1388  }
1389  }
1390 
1391  // Pattern finder.
1392  bool ptn_trig = false;
1393  for (int ilct = 0; ilct < CSCConstants::MAX_CLCTS_PER_PROCESSOR; ilct++)
1394  {
1395  int best_hs = best_halfstrip[ilct];
1396  if (best_hs >= 0 && nhits[best_hs] >= nplanes_hit_pattern)
1397  {
1398  int bx = first_bx;
1399  int fbx = first_bx_corrected[best_hs];
1400  if (use_corrected_bx) {
1401  bx = fbx;
1402  fbx = first_bx;
1403  }
1404  ptn_trig = true;
1405  keystrip_data[ilct][CLCT_PATTERN] = best_pid[best_hs];
1406  keystrip_data[ilct][CLCT_BEND] = pattern2007[best_pid[best_hs]][CSCConstants::MAX_HALFSTRIPS_IN_PATTERN];
1407  // Remove stagger if any.
1408  keystrip_data[ilct][CLCT_STRIP] = best_hs - stagger[CSCConstants::KEY_CLCT_LAYER - 1];
1409  keystrip_data[ilct][CLCT_BX] = bx;
1410  keystrip_data[ilct][CLCT_STRIP_TYPE] = 1; // obsolete
1411  keystrip_data[ilct][CLCT_QUALITY] = nhits[best_hs];
1412  keystrip_data[ilct][CLCT_CFEB] = keystrip_data[ilct][CLCT_STRIP] / CSCConstants::NUM_HALF_STRIPS_PER_CFEB;
1413  int halfstrip_in_cfeb = keystrip_data[ilct][CLCT_STRIP] - CSCConstants::NUM_HALF_STRIPS_PER_CFEB * keystrip_data[ilct][CLCT_CFEB];
1414 
1415  if (infoV > 1)
1416  LogTrace("CSCCathodeLCTProcessor") << " Final selection: ilct " << ilct << " key halfstrip "
1417  << keystrip_data[ilct][CLCT_STRIP] << " quality " << keystrip_data[ilct][CLCT_QUALITY] << " pattern "
1418  << keystrip_data[ilct][CLCT_PATTERN] << " bx " << keystrip_data[ilct][CLCT_BX];
1419 
1420  CSCCLCTDigi thisLCT(1, keystrip_data[ilct][CLCT_QUALITY], keystrip_data[ilct][CLCT_PATTERN],
1421  keystrip_data[ilct][CLCT_STRIP_TYPE], keystrip_data[ilct][CLCT_BEND], halfstrip_in_cfeb,
1422  keystrip_data[ilct][CLCT_CFEB], keystrip_data[ilct][CLCT_BX]);
1423  thisLCT.setFullBX(fbx);
1424  lctList.push_back(thisLCT);
1425  lctListBX.push_back(thisLCT);
1426  }
1427  }
1428 
1429  // state-machine
1430  if (ptn_trig)
1431  {
1432  // Once there was a trigger, CLCT pre-trigger state machine checks the number of hits
1433  // that lie on a key halfstrip pattern template at every bx, and waits for it to drop below threshold.
1434  // During that time no CLCTs could be found with its key halfstrip in the area of
1435  // [clct_key-clct_state_machine_zone, clct_key+clct_state_machine_zone]
1436  // starting from first_bx+1.
1437  // The search for CLCTs resumes only when the number of hits on key halfstrip drops below threshold.
1438  for (unsigned int ilct = 0; ilct < lctListBX.size(); ilct++)
1439  {
1440  int key_hstrip = lctListBX[ilct].getKeyStrip() + stagger[CSCConstants::KEY_CLCT_LAYER - 1];
1441 
1442  int delta_hs = clct_state_machine_zone;
1444  delta_hs = pattern2007[lctListBX[ilct].getPattern()][CSCConstants::MAX_HALFSTRIPS_IN_PATTERN + 1] - 1;
1445 
1446  int min_hstrip = key_hstrip - delta_hs;
1447  int max_hstrip = key_hstrip + delta_hs;
1448 
1449  if (min_hstrip < stagger[CSCConstants::KEY_CLCT_LAYER - 1])
1450  min_hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1];
1451  if (max_hstrip > maxHalfStrips)
1452  max_hstrip = maxHalfStrips;
1453 
1454  if (infoV > 2)
1455  LogTrace("CSCCathodeLCTProcessor") << " marking post-trigger zone after bx=" << lctListBX[ilct].getBX() << " ["
1456  << min_hstrip << "," << max_hstrip << "]";
1457 
1458  // Stop checking drift_delay bx's short of fifo_tbins since
1459  // at later bx's we won't have a full set of hits for a
1460  // pattern search anyway.
1461  //int stop_time = fifo_tbins - drift_delay;
1462  // -- no, need to extend busyMap over fifo_tbins - drift_delay
1463  for (size_t bx = first_bx + 1; bx < fifo_tbins; bx++)
1464  {
1465  bool busy_bx = false;
1466  if (bx <= (size_t)latch_bx)
1467  busy_bx = true; // always busy before drift time
1468  if (!busy_bx)
1469  {
1470  bool hits_in_time = ptnFinding(pulse, maxHalfStrips, bx);
1471  if (hits_in_time && nhits[key_hstrip] >= nplanes_hit_pattern)
1472  busy_bx = true;
1473  if (infoV > 2)
1474  LogTrace("CSCCathodeLCTProcessor") << " at bx=" << bx << " hits_in_time=" << hits_in_time << " nhits="
1475  << nhits[key_hstrip];
1476  }
1477  if (infoV > 2)
1478  LogTrace("CSCCathodeLCTProcessor") << " at bx=" << bx << " busy=" << busy_bx;
1479  if (busy_bx)
1480  for (int hstrip = min_hstrip; hstrip <= max_hstrip; hstrip++)
1481  busyMap[hstrip][bx] = true;
1482  else
1483  break;
1484  }
1485  }
1486  } // if (ptn_trig)
1487  }
1488  }
1489  else
1490  {
1491  start_bx = first_bx + 1; // no dead time
1492  }
1493  }
1494 
1495  return lctList;
1496 } // findLCTs -- SLHC version.
void dumpDigis(const std::vector< int > strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips) const
bool ispretrig[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
int first_bx_corrected[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
bool preTrigger(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int start_bx, int &first_bx)
unsigned int best_pid[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
void markBusyKeys(const int best_hstrip, const int best_patid, int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS])
static const int pattern2007[CSCConstants::NUM_CLCT_PATTERNS][CSCConstants::MAX_HALFSTRIPS_IN_PATTERN+2]
#define LogTrace(id)
bool ptnFinding(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips, const unsigned int bx_time)
double pulse(double x, double y, double z, double t)
int stagger[CSCConstants::NUM_LAYERS]
unsigned int nhits[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
void pulseExtension(const std::vector< int > time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips, unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
std::vector< CSCCLCTDigi > CSCCathodeLCTProcessor::getCLCTs ( )

Returns vector of all found CLCTs, if any.

Definition at line 1700 of file CSCCathodeLCTProcessor.cc.

References bestCLCT, CSCConstants::MAX_CLCT_TBINS, and secondCLCT.

Referenced by readoutCLCTs(), and run().

1700  {
1701  std::vector<CSCCLCTDigi> tmpV;
1702  for (int bx = 0; bx < CSCConstants::MAX_CLCT_TBINS; bx++) {
1703  if (bestCLCT[bx].isValid()) tmpV.push_back(bestCLCT[bx]);
1704  if (secondCLCT[bx].isValid()) tmpV.push_back(secondCLCT[bx]);
1705  }
1706  return tmpV;
1707 }
CSCCLCTDigi bestCLCT[CSCConstants::MAX_CLCT_TBINS]
CSCCLCTDigi secondCLCT[CSCConstants::MAX_CLCT_TBINS]
bool CSCCathodeLCTProcessor::getDigis ( const CSCComparatorDigiCollection compdc)

Access routines to comparator digis.

Definition at line 626 of file CSCCathodeLCTProcessor.cc.

References CSCDetId::chamberName(), digiV, disableME1a, relativeConstraints::empty, infoV, LogTrace, CSCConstants::NUM_LAYERS, theChamber, theEndcap, theRing, theSector, theStation, theSubsector, and theTrigChamber.

Referenced by run(), and setCSCGeometry().

626  {
627  bool noDigis = true;
628 
629  // Loop over layers and save comparator digis on each one into digiV[layer].
630  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
631  digiV[i_layer].clear();
632 
633  CSCDetId detid(theEndcap, theStation, theRing, theChamber, i_layer+1);
634  getDigis(compdc, detid);
635 
636  if (theStation == 1 && theRing == 1 && !disableME1a) {
637  CSCDetId detid_me1a(theEndcap, theStation, 4, theChamber, i_layer+1);
638  getDigis(compdc, detid_me1a);
639  }
640 
641  if (!digiV[i_layer].empty()) {
642  noDigis = false;
643  if (infoV > 1) {
644  LogTrace("CSCCathodeLCTProcessor")
645  << "found " << digiV[i_layer].size()
646  << " comparator digi(s) in layer " << i_layer << " of " <<
647  detid.chamberName() << " (trig. sector " << theSector
648  << " subsector " << theSubsector << " id " << theTrigChamber << ")";
649  }
650  }
651  }
652 
653  return noDigis;
654 }
bool getDigis(const CSCComparatorDigiCollection *compdc)
#define LogTrace(id)
std::vector< CSCComparatorDigi > digiV[CSCConstants::NUM_LAYERS]
void CSCCathodeLCTProcessor::getDigis ( const CSCComparatorDigiCollection compdc,
const CSCDetId id 
)

Definition at line 656 of file CSCCathodeLCTProcessor.cc.

References digiV, disableME1a, gangedME1a, and relativeConstraints::ring.

658 {
659  const bool me1a = (id.station() == 1) && (id.ring() == 4);
660  const CSCComparatorDigiCollection::Range rcompd = compdc->get(id);
661  for (CSCComparatorDigiCollection::const_iterator digiIt = rcompd.first;
662  digiIt != rcompd.second; ++digiIt) {
663  const unsigned int origStrip = digiIt->getStrip();
664  const unsigned int maxStripsME1a = gangedME1a ? 16 : 48;
665  // this special case can only be reached in MC
666  // in real data, the comparator digis have always ring==1
667  if (me1a && origStrip <= maxStripsME1a && !disableME1a) {
668  // Move ME1/A comparators from CFEB=0 to CFEB=4 if this has not
669  // been done already.
670  CSCComparatorDigi digi_corr(origStrip+64,
671  digiIt->getComparator(),
672  digiIt->getTimeBinWord());
673  digiV[id.layer()-1].push_back(digi_corr);
674  }
675  else {
676  digiV[id.layer()-1].push_back(*digiIt);
677  }
678  }
679 }
std::vector< CSCComparatorDigi >::const_iterator const_iterator
std::vector< CSCComparatorDigi > digiV[CSCConstants::NUM_LAYERS]
std::pair< const_iterator, const_iterator > Range
void CSCCathodeLCTProcessor::markBusyKeys ( const int  best_hstrip,
const int  best_patid,
int  quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS] 
)
private

Definition at line 1217 of file CSCCathodeLCTProcessor.cc.

References min_separation, and jets_cff::quality.

Referenced by findLCTs(), and findLCTsSLHC().

1219  {
1220  int nspan = min_separation;
1221  int pspan = min_separation;
1222 
1223  // if dynamic spacing is enabled, separation is defined by pattern width
1224  //if (dynamic_spacing)
1225  // nspan = pspan = pattern2007[best_patid][CSCConstants::MAX_HALFSTRIPS_IN_PATTERN+1]-1;
1226 
1227  for (int hstrip = best_hstrip-nspan; hstrip <= best_hstrip+pspan; hstrip++) {
1228  if (hstrip >= 0 && hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS) {
1229  quality[hstrip] = 0;
1230  }
1231  }
1232 } // markBusyKeys -- TMB-07 version.
bool CSCCathodeLCTProcessor::preTrigger ( const unsigned int  pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
const int  start_bx,
int &  first_bx 
)
private

Definition at line 1031 of file CSCCathodeLCTProcessor.cc.

References best_pid, fifo_tbins, infoV, ispretrig, CSCConstants::KEY_CLCT_LAYER, LogTrace, CSCConstants::MAX_HALFSTRIPS_IN_PATTERN, nhits, nplanes_hit_pretrig, numStrips, pattern2007, pid_thresh_pretrig, ptnFinding(), pulse(), stagger, and thePreTriggerDigis.

Referenced by findLCTs(), and findLCTsSLHC().

1033  {
1034  if (infoV > 1) LogTrace("CSCCathodeLCTProcessor")
1035  << "....................PreTrigger...........................";
1036 
1037  // Max. number of half-strips for this chamber.
1038  const int nStrips = 2*numStrips + 1;
1039 
1040  int nPreTriggers = 0;
1041 
1042  bool pre_trig = false;
1043  // Now do a loop over bx times to see (if/when) track goes over threshold
1044  for (unsigned int bx_time = start_bx; bx_time < fifo_tbins; bx_time++) {
1045  // For any given bunch-crossing, start at the lowest keystrip and look for
1046  // the number of separate layers in the pattern for that keystrip that have
1047  // pulses at that bunch-crossing time. Do the same for the next keystrip,
1048  // etc. Then do the entire process again for the next bunch-crossing, etc
1049  // until you find a pre-trigger.
1050  bool hits_in_time = ptnFinding(pulse, nStrips, bx_time);
1051  if (hits_in_time) {
1052  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER-1];
1053  hstrip < nStrips; hstrip++) {
1054  if (infoV > 1) {
1055  if (nhits[hstrip] > 0) {
1056  LogTrace("CSCCathodeLCTProcessor")
1057  << " bx = " << std::setw(2) << bx_time << " --->"
1058  << " halfstrip = " << std::setw(3) << hstrip
1059  << " best pid = " << std::setw(2) << best_pid[hstrip]
1060  << " nhits = " << nhits[hstrip];
1061  }
1062  }
1063  ispretrig[hstrip] = false;
1064  if (nhits[hstrip] >= nplanes_hit_pretrig &&
1065  best_pid[hstrip] >= pid_thresh_pretrig) {
1066  pre_trig = true;
1067  ispretrig[hstrip] = true;
1068 
1069  // write each pre-trigger to output
1070  nPreTriggers++;
1072  thePreTriggerDigis.push_back(CSCCLCTPreTriggerDigi(1, nhits[hstrip], best_pid[hstrip],
1073  1, bend, hstrip%32, hstrip/32, bx_time, nPreTriggers, 0));
1074 
1075  }
1076  }
1077 
1078  if (pre_trig) {
1079  first_bx = bx_time; // bx at time of pretrigger
1080  return true;
1081  }
1082  }
1083  } // end loop over bx times
1084 
1085  if (infoV > 1) LogTrace("CSCCathodeLCTProcessor") <<
1086  "no pretrigger, returning \n";
1087  first_bx = fifo_tbins;
1088  return false;
1089 } // preTrigger -- TMB-07 version.
bool ispretrig[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
unsigned int best_pid[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
static const int pattern2007[CSCConstants::NUM_CLCT_PATTERNS][CSCConstants::MAX_HALFSTRIPS_IN_PATTERN+2]
#define LogTrace(id)
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis
bool ptnFinding(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips, const unsigned int bx_time)
double pulse(double x, double y, double z, double t)
int stagger[CSCConstants::NUM_LAYERS]
unsigned int nhits[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
std::vector<int> CSCCathodeLCTProcessor::preTriggerBXs ( ) const
inline

Definition at line 93 of file CSCCathodeLCTProcessor.h.

References thePreTriggerBXs.

93 {return thePreTriggerBXs;}
std::vector< int > thePreTriggerBXs
std::vector<CSCCLCTPreTriggerDigi> CSCCathodeLCTProcessor::preTriggerDigis ( ) const
inline

Definition at line 95 of file CSCCathodeLCTProcessor.h.

References preTriggerDigisME1a(), preTriggerDigisME1b(), and thePreTriggerDigis.

Referenced by preTriggerDigisME1a(), and preTriggerDigisME1b().

95 {return thePreTriggerDigis; }
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis
std::vector< CSCCLCTPreTriggerDigi > CSCCathodeLCTProcessor::preTriggerDigisME1a ( )

read out CLCTs in ME1a , ME1b

Definition at line 1675 of file CSCCathodeLCTProcessor.cc.

References or, preTriggerDigis(), theRing, and theStation.

Referenced by preTriggerDigis().

1675  {
1676  std::vector<CSCCLCTPreTriggerDigi> tmpV;
1677  if (not (theStation == 1 and (theRing == 1 or theRing == 4)) )
1678  return tmpV;
1679  std::vector<CSCCLCTPreTriggerDigi> allPretriggerdigis = preTriggerDigis();
1680  for (auto preclct : allPretriggerdigis)
1681  if (preclct.getCFEB() >= 4 )
1682  tmpV.push_back(preclct);
1683  return tmpV;
1684 }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
std::vector< CSCCLCTPreTriggerDigi > preTriggerDigis() const
std::vector< CSCCLCTPreTriggerDigi > CSCCathodeLCTProcessor::preTriggerDigisME1b ( )

Definition at line 1687 of file CSCCathodeLCTProcessor.cc.

References or, preTriggerDigis(), theRing, and theStation.

Referenced by preTriggerDigis().

1687  {
1688  std::vector<CSCCLCTPreTriggerDigi> tmpV;
1689  if (not (theStation == 1 and (theRing == 1 or theRing == 4)) )
1690  return tmpV;
1691  std::vector<CSCCLCTPreTriggerDigi> allPretriggerdigis = preTriggerDigis();
1692  for (auto preclct : allPretriggerdigis)
1693  if (preclct.getCFEB() < 4 )
1694  tmpV.push_back(preclct);
1695  return tmpV;
1696 }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
std::vector< CSCCLCTPreTriggerDigi > preTriggerDigis() const
bool CSCCathodeLCTProcessor::ptnFinding ( const unsigned int  pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
const int  nStrips,
const unsigned int  bx_time 
)
private

Definition at line 1093 of file CSCCathodeLCTProcessor.cc.

References best_pid, fifo_tbins, first_bx_corrected, hit_persist, infoV, CSCConstants::KEY_CLCT_LAYER, LogTrace, CSCConstants::MAX_HALFSTRIPS_IN_PATTERN, nhits, nplanes_hit_pretrig, CSCConstants::NUM_CLCT_PATTERNS, CSCConstants::NUM_LAYERS, pattern2007, pattern2007_offset, sysUtil::pid, pid_thresh_pretrig, pulse(), and stagger.

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

1096 {
1097  if (bx_time >= fifo_tbins) return false;
1098 
1099  // This loop is a quick check of a number of layers hit at bx_time: since
1100  // most of the time it is 0, this check helps to speed-up the execution
1101  // substantially.
1102  unsigned int layers_hit = 0;
1103  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++)
1104  {
1105  for (int i_hstrip = 0; i_hstrip < nStrips; i_hstrip++)
1106  {
1107  if (((pulse[i_layer][i_hstrip] >> bx_time) & 1) == 1)
1108  {
1109  layers_hit++;
1110  break;
1111  }
1112  }
1113  }
1114  if (layers_hit < nplanes_hit_pretrig) return false;
1115 
1116  for (int key_hstrip = 0; key_hstrip < nStrips; key_hstrip++)
1117  {
1118  best_pid[key_hstrip] = 0;
1119  nhits[key_hstrip] = 0;
1120  first_bx_corrected[key_hstrip] = -999;
1121  }
1122 
1123  // Loop over candidate key strips.
1124  bool hit_layer[CSCConstants::NUM_LAYERS];
1125  for (int key_hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; key_hstrip < nStrips; key_hstrip++)
1126  {
1127  // Loop over patterns and look for hits matching each pattern.
1128  for (unsigned int pid = CSCConstants::NUM_CLCT_PATTERNS - 1; pid >= pid_thresh_pretrig; pid--)
1129  {
1130  layers_hit = 0;
1131  for (int ilayer = 0; ilayer < CSCConstants::NUM_LAYERS; ilayer++)
1132  hit_layer[ilayer] = false;
1133 
1134  double num_pattern_hits=0., times_sum=0.;
1135  std::multiset<int> mset_for_median;
1136  mset_for_median.clear();
1137 
1138  // Loop over halfstrips in trigger pattern mask and calculate the
1139  // "absolute" halfstrip number for each.
1140  for (int strip_num = 0; strip_num < CSCConstants::MAX_HALFSTRIPS_IN_PATTERN; strip_num++)
1141  {
1142  int this_layer = pattern2007[pid][strip_num];
1143  if (this_layer >= 0 && this_layer < CSCConstants::NUM_LAYERS)
1144  {
1145  int this_strip = pattern2007_offset[strip_num] + key_hstrip;
1146  if (this_strip >= 0 && this_strip < nStrips) {
1147  if (infoV > 3) LogTrace("CSCCathodeLCTProcessor")
1148  << " In ptnFinding: key_strip = " << key_hstrip
1149  << " pid = " << pid << " strip_num = " << strip_num
1150  << " layer = " << this_layer << " strip = " << this_strip;
1151  // Determine if "one shot" is high at this bx_time
1152  if (((pulse[this_layer][this_strip] >> bx_time) & 1) == 1)
1153  {
1154  if (hit_layer[this_layer] == false)
1155  {
1156  hit_layer[this_layer] = true;
1157  layers_hit++; // determines number of layers hit
1158  }
1159 
1160  // find at what bx did pulse on this halsfstrip&layer have started
1161  // use hit_pesrist constraint on how far back we can go
1162  int first_bx_layer = bx_time;
1163  for (unsigned int dbx = 0; dbx < hit_persist; dbx++)
1164  {
1165  if (((pulse[this_layer][this_strip] >> (first_bx_layer - 1)) & 1) == 1)
1166  first_bx_layer--;
1167  else
1168  break;
1169  }
1170  times_sum += (double) first_bx_layer;
1171  num_pattern_hits += 1.;
1172  mset_for_median.insert(first_bx_layer);
1173  if (infoV > 2)
1174  LogTrace("CSCCathodeLCTProcessor") << " 1st bx in layer: " << first_bx_layer << " sum bx: " << times_sum
1175  << " #pat. hits: " << num_pattern_hits;
1176  }
1177  }
1178  }
1179  } // end loop over strips in pretrigger pattern
1180 
1181  if (layers_hit > nhits[key_hstrip])
1182  {
1183  best_pid[key_hstrip] = pid;
1184  nhits[key_hstrip] = layers_hit;
1185 
1186  // calculate median
1187  const int sz = mset_for_median.size();
1188  if (sz>0){
1189  std::multiset<int>::iterator im = mset_for_median.begin();
1190  if (sz>1) std::advance(im,sz/2-1);
1191  if (sz==1) first_bx_corrected[key_hstrip] = *im;
1192  else if ((sz % 2) == 1) first_bx_corrected[key_hstrip] = *(++im);
1193  else first_bx_corrected[key_hstrip] = ((*im) + (*(++im)))/2;
1194 
1195 #if defined(EDM_ML_DEBUG)
1196  //LogTrace only ever prints if EDM_ML_DEBUG is defined
1197  if (infoV > 1) {
1198  auto lt = LogTrace("CSCCathodeLCTProcessor")
1199  <<"bx="<<bx_time<<" bx_cor="<< first_bx_corrected[key_hstrip]<<" bxset=";
1200  for (im = mset_for_median.begin(); im != mset_for_median.end(); im++) {
1201  lt<<" "<<*im;
1202  }
1203  }
1204 #endif
1205  }
1206  // Do not loop over the other (worse) patterns if max. numbers of
1207  // hits is found.
1208  if (nhits[key_hstrip] == CSCConstants::NUM_LAYERS) break;
1209  }
1210  } // end loop over pid
1211  } // end loop over candidate key strips
1212  return true;
1213 } // ptnFinding -- TMB-07 version.
int first_bx_corrected[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
static const int pattern2007_offset[CSCConstants::MAX_HALFSTRIPS_IN_PATTERN]
unsigned int best_pid[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
static const int pattern2007[CSCConstants::NUM_CLCT_PATTERNS][CSCConstants::MAX_HALFSTRIPS_IN_PATTERN+2]
#define LogTrace(id)
double pulse(double x, double y, double z, double t)
int stagger[CSCConstants::NUM_LAYERS]
unsigned int nhits[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
void CSCCathodeLCTProcessor::pulseExtension ( const std::vector< int >  time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
const int  nStrips,
unsigned int  pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS] 
)
private

Definition at line 983 of file CSCCathodeLCTProcessor.cc.

References relativeConstraints::empty, hit_persist, mps_fire::i, infoV, CSCConstants::NUM_LAYERS, pulse(), start_bx_shift, and ntuplemaker::time.

Referenced by findLCTs(), and findLCTsSLHC().

986  {
987 
988  static const unsigned int bits_in_pulse = 8*sizeof(pulse[0][0]);
989 
990  // Clear pulse array. This array will be used as a bit representation of
991  // hit times. For example: if strip[1][2] has a value of 3, then 1 shifted
992  // left 3 will be bit pattern of pulse[1][2]. This would make the pattern
993  // look like 0000000000001000. Then add on additional bits to signify
994  // the duration of a signal (hit_persist, formerly bx_width) to simulate
995  // the TMB's drift delay. So for the same pulse[1][2] with a hit_persist
996  // of 3 would look like 0000000000111000. This is similating the digital
997  // one-shot in the TMB.
998  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++)
999  for (int i_strip = 0; i_strip < nStrips; i_strip++)
1000  pulse[i_layer][i_strip] = 0;
1001 
1002  // Loop over all layers and halfstrips.
1003  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
1004  for (int i_strip = 0; i_strip < nStrips; i_strip++) {
1005  // If there is a hit, simulate digital one-shot persistence starting
1006  // in the bx of the initial hit. Fill this into pulse[][].
1007  if (!time[i_layer][i_strip].empty()) {
1008  std::vector<int> bx_times = time[i_layer][i_strip];
1009  for (unsigned int i = 0; i < bx_times.size(); i++) {
1010  // Check that min and max times are within the allowed range.
1011  if (bx_times[i] < 0 || bx_times[i] + hit_persist >= bits_in_pulse) {
1012  if (infoV > 0) edm::LogWarning("L1CSCTPEmulatorOutOfTimeDigi")
1013  << "+++ BX time of comparator digi (halfstrip = " << i_strip
1014  << " layer = " << i_layer << ") bx = " << bx_times[i]
1015  << " is not within the range (0-" << bits_in_pulse
1016  << "] allowed for pulse extension. Skip this digi! +++\n";
1017  continue;
1018  }
1019  if (bx_times[i] >= start_bx_shift) {
1020  for (unsigned int bx = bx_times[i]; bx < bx_times[i] + hit_persist; ++bx)
1021  pulse[i_layer][i_strip] = pulse[i_layer][i_strip] | (1 << bx);
1022  }
1023  }
1024  }
1025  }
1026  }
1027 } // pulseExtension.
double pulse(double x, double y, double z, double t)
void CSCCathodeLCTProcessor::readComparatorDigis ( std::vector< int >  halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
private

Definition at line 681 of file CSCCathodeLCTProcessor.cc.

References begin, digiV, fifo_tbins, hit_persist, mps_fire::i, infoV, LogTrace, CSCConstants::NUM_LAYERS, numStrips, stagger, theChamber, theRing, and theStation.

Referenced by run().

682  {
683  // Single-argument version for TMB07 (halfstrip-only) firmware.
684  // Takes the comparator & time info and stuffs it into halfstrip vector.
685  // Multiple hits on the same strip are allowed.
686 
687  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
688  int i_digi = 0; // digi counter, for dumps.
689  for (std::vector<CSCComparatorDigi>::iterator pld = digiV[i_layer].begin();
690  pld != digiV[i_layer].end(); pld++, i_digi++) {
691  // Dump raw digi info.
692  if (infoV > 1) {
693  std::ostringstream strstrm;
694  strstrm << "Comparator digi: comparator = " << pld->getComparator()
695  << " strip #" << pld->getStrip()
696  << " time bins on:";
697  std::vector<int> bx_times = pld->getTimeBinsOn();
698  for (unsigned int tbin = 0; tbin < bx_times.size(); tbin++)
699  strstrm << " " << bx_times[tbin];
700  LogTrace("CSCCathodeLCTProcessor") << strstrm.str();
701  }
702 
703  // Get comparator: 0/1 for left/right halfstrip for each comparator
704  // that fired.
705  int thisComparator = pld->getComparator();
706  if (thisComparator != 0 && thisComparator != 1) {
707  if (infoV >= 0) edm::LogWarning("L1CSCTPEmulatorWrongInput")
708  << "+++ station "<< theStation<<" ring "<< theRing<<" chamber "<< theChamber
709  << " Found comparator digi with wrong comparator value = "
710  << thisComparator << "; skipping it... +++\n";
711  continue;
712  }
713 
714  // Get strip number.
715  int thisStrip = pld->getStrip() - 1; // count from 0
716  if (thisStrip < 0 || thisStrip >= numStrips) {
717  if (infoV >= 0) edm::LogWarning("L1CSCTPEmulatorWrongInput")
718  << "+++ station "<< theStation<<" ring "<< theRing<<" chamber "<< theChamber
719  <<" Found comparator digi with wrong strip number = "
720  << thisStrip
721  << " (max strips = " << numStrips << "); skipping it... +++\n";
722  continue;
723  }
724  // 2*strip: convert strip to 1/2 strip
725  // comp : comparator output
726  // stagger: stagger for this layer
727  int thisHalfstrip = 2*thisStrip + thisComparator + stagger[i_layer];
728  if (thisHalfstrip >= 2*numStrips + 1) {
729  if (infoV >= 0) edm::LogWarning("L1CSCTPEmulatorWrongInput")
730  << "+++ station "<< theStation<<" ring "<< theRing<<" chamber "<< theChamber
731  << " Found wrong halfstrip number = " << thisHalfstrip
732  << "; skipping this digi... +++\n";
733  continue;
734  }
735 
736  // Get bx times on this digi and check that they are within the bounds.
737  std::vector<int> bx_times = pld->getTimeBinsOn();
738  for (unsigned int i = 0; i < bx_times.size(); i++) {
739  // Total number of time bins in DAQ readout is given by fifo_tbins,
740  // which thus determines the maximum length of time interval.
741  //
742  // In TMB07 version, better data-emulator agreement is
743  // achieved when hits in the first 2 time bins are excluded.
744  // As of May 2009, the reasons for this are not fully
745  // understood yet (the work is on-going).
746  if (bx_times[i] > 1 && bx_times[i] < static_cast<int>(fifo_tbins)) {
747 
748  if (i == 0 || (i > 0 && bx_times[i]-bx_times[i-1] >=
749  static_cast<int>(hit_persist))) {
750  // A later hit on the same strip is ignored during the
751  // number of clocks defined by the "hit_persist" parameter
752  // (i.e., 6 bx's by default).
753  if (infoV > 1) LogTrace("CSCCathodeLCTProcessor")
754  << "Comp digi: layer " << i_layer+1
755  << " digi #" << i_digi+1
756  << " strip " << thisStrip
757  << " halfstrip " << thisHalfstrip
758  << " time " << bx_times[i]
759  << " comparator " << thisComparator
760  << " stagger " << stagger[i_layer];
761  halfstrip[i_layer][thisHalfstrip].push_back(bx_times[i]);
762  }
763  else if (i > 0) {
764  if (infoV > 1) LogTrace("CSCCathodeLCTProcessor")
765  << "+++ station "<< theStation<<" ring "<< theRing<<" chamber "<< theChamber
766  << " Skipping comparator digi: strip = " << thisStrip
767  << ", layer = " << i_layer+1 << ", bx = " << bx_times[i]
768  << ", bx of previous hit = " << bx_times[i-1];
769  }
770  }
771  else {
772  if (infoV > 1) LogTrace("CSCCathodeLCTProcessor")
773  << "+++ station "<< theStation<<" ring "<< theRing<<" chamber "<< theChamber
774  << "+++ Skipping comparator digi: strip = " << thisStrip
775  << ", layer = " << i_layer+1 << ", bx = " << bx_times[i] << " +++";
776  }
777  }
778  }
779  }
780 }
#define LogTrace(id)
int stagger[CSCConstants::NUM_LAYERS]
#define begin
Definition: vmac.h:32
std::vector< CSCComparatorDigi > digiV[CSCConstants::NUM_LAYERS]
std::vector< CSCCLCTDigi > CSCCathodeLCTProcessor::readoutCLCTs ( )

Returns vector of CLCTs in the read-out time window, if any.

Definition at line 1570 of file CSCCathodeLCTProcessor.cc.

References early_tbins, getCLCTs(), infoV, LogDebug, CSCConstants::MAX_CLCT_TBINS, readout_earliest_2, and tmb_l1a_window_size.

Referenced by readoutCLCTsME1a(), and readoutCLCTsME1b().

1570  {
1571  std::vector<CSCCLCTDigi> tmpV;
1572 
1573  // The start time of the L1A*CLCT coincidence window should be
1574  // related to the fifo_pretrig parameter, but I am not completely
1575  // sure how. For now, just choose it such that the window is
1576  // centered at bx=7. This may need further tweaking if the value of
1577  // tmb_l1a_window_size changes.
1578 
1579  // The number of CLCT bins in the read-out is given by the
1580  // tmb_l1a_window_size parameter, but made even by setting the LSB
1581  // of tmb_l1a_window_size to 0.
1582  //
1583  static std::atomic<int> lct_bins;
1585  static std::atomic<int> late_tbins;
1586  late_tbins = early_tbins + lct_bins;
1587 
1588  static std::atomic<int> ifois{0};
1589  if (ifois == 0) {
1590  if (infoV >= 0 && early_tbins < 0) {
1591  edm::LogWarning("L1CSCTPEmulatorSuspiciousParameters")
1592  << "+++ early_tbins = " << early_tbins
1593  << "; in-time CLCTs are not getting read-out!!! +++" << "\n";
1594  }
1595 
1596  if (late_tbins > CSCConstants::MAX_CLCT_TBINS-1) {
1597  if (infoV >= 0) edm::LogWarning("L1CSCTPEmulatorSuspiciousParameters")
1598  << "+++ Allowed range of time bins, [0-" << late_tbins
1599  << "] exceeds max allowed, " << CSCConstants::MAX_CLCT_TBINS-1 << " +++\n"
1600  << "+++ Set late_tbins to max allowed +++\n";
1601  late_tbins = CSCConstants::MAX_CLCT_TBINS-1;
1602  }
1603  ifois = 1;
1604  }
1605 
1606  // Start from the vector of all found CLCTs and select those within
1607  // the CLCT*L1A coincidence window.
1608  int bx_readout = -1;
1609  std::vector<CSCCLCTDigi> all_lcts = getCLCTs();
1610  for (std::vector <CSCCLCTDigi>::const_iterator plct = all_lcts.begin();
1611  plct != all_lcts.end(); plct++) {
1612  if (!plct->isValid()) continue;
1613 
1614  int bx = (*plct).getBX();
1615  // Skip CLCTs found too early relative to L1Accept.
1616  if (bx <= early_tbins) {
1617  if (infoV > 1) LogDebug("CSCCathodeLCTProcessor")
1618  << " Do not report CLCT on key halfstrip " << plct->getKeyStrip()
1619  << ": found at bx " << bx << ", whereas the earliest allowed bx is "
1620  << early_tbins+1;
1621  continue;
1622  }
1623 
1624  // Skip CLCTs found too late relative to L1Accept.
1625  if (bx > late_tbins) {
1626  if (infoV > 1) LogDebug("CSCCathodeLCTProcessor")
1627  << " Do not report CLCT on key halfstrip " << plct->getKeyStrip()
1628  << ": found at bx " << bx << ", whereas the latest allowed bx is "
1629  << late_tbins;
1630  continue;
1631  }
1632 
1633  // If (readout_earliest_2) take only CLCTs in the earliest bx in the read-out window:
1634  // in digi->raw step, LCTs have to be packed into the TMB header, and
1635  // currently there is room just for two.
1636  if (readout_earliest_2) {
1637  if (bx_readout == -1 || bx == bx_readout) {
1638  tmpV.push_back(*plct);
1639  if (bx_readout == -1) bx_readout = bx;
1640  }
1641  }
1642  else tmpV.push_back(*plct);
1643  }
1644  return tmpV;
1645 }
#define LogDebug(id)
std::vector< CSCCLCTDigi > getCLCTs()
std::vector< CSCCLCTDigi > CSCCathodeLCTProcessor::readoutCLCTsME1a ( )

read out CLCTs in ME1a , ME1b

Definition at line 1649 of file CSCCathodeLCTProcessor.cc.

References or, readoutCLCTs(), theRing, and theStation.

1649  {
1650  std::vector<CSCCLCTDigi> tmpV;
1651  if (not (theStation == 1 and (theRing == 1 or theRing == 4)) )
1652  return tmpV;
1653  std::vector<CSCCLCTDigi> allCLCTs = readoutCLCTs();
1654  for (auto clct : allCLCTs)
1655  if (clct.getCFEB() >= 4 )
1656  tmpV.push_back(clct);
1657  return tmpV;
1658 }
std::vector< CSCCLCTDigi > readoutCLCTs()
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
std::vector< CSCCLCTDigi > CSCCathodeLCTProcessor::readoutCLCTsME1b ( )

Definition at line 1663 of file CSCCathodeLCTProcessor.cc.

References or, readoutCLCTs(), theRing, and theStation.

1663  {
1664  std::vector<CSCCLCTDigi> tmpV;
1665  if (not (theStation == 1 and (theRing == 1 or theRing == 4)) )
1666  return tmpV;
1667  std::vector<CSCCLCTDigi> allCLCTs = readoutCLCTs();
1668  for (auto clct : allCLCTs)
1669  if (clct.getCFEB() < 4 )
1670  tmpV.push_back(clct);
1671  return tmpV;
1672 }
std::vector< CSCCLCTDigi > readoutCLCTs()
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
std::vector< CSCCLCTDigi > CSCCathodeLCTProcessor::run ( const CSCComparatorDigiCollection compdc)

Runs the LCT processor code. Called in normal running – gets info from a collection of comparator digis.

Definition at line 428 of file CSCCathodeLCTProcessor.cc.

References alctClctOffset, relativeConstraints::chamber, CSCGeometry::chamber(), CSCTriggerNumbering::chamberFromTriggerLabels(), CSCDetId::chamberName(), csc_g, disableME1a, dumpConfigParams(), relativeConstraints::empty, gangedME1a, getCLCTs(), getDigis(), infoV, isME11, isSLHC, CSCConstants::MAX_NUM_STRIPS, CSCConstants::MAX_NUM_STRIPS_7CFEBS, nplanes_hit_pretrig, CSCConstants::NUM_HALF_STRIPS_7CFEBS, CSCConstants::NUM_LAYERS, numStrips, AlCaHLTBitMon_ParallelJobs::p, readComparatorDigis(), relativeConstraints::ring, CSCTriggerNumbering::ringFromTriggerLabels(), stagger, theChamber, theEndcap, theRing, theSector, theStation, theSubsector, and theTrigChamber.

Referenced by setCSCGeometry().

429 {
430  // This is the version of the run() function that is called when running
431  // over the entire detector. It gets the comparator & timing info from the
432  // comparator digis and then passes them on to another run() function.
433 
434  // clear(); // redundant; called by L1MuCSCMotherboard.
435 
436  static std::atomic<bool> config_dumped{false};
437  if ((infoV > 0 || isSLHC) && !config_dumped) {
438  //std::cerr<<"**** CLCT run parameters dump ****"<<std::endl;
440  config_dumped = true;
441  }
442 
443  // Get the number of strips and stagger of layers for the given chamber.
444  // Do it only once per chamber.
445  if (numStrips == 0) {
448  CSCDetId detid(theEndcap, theStation, ring, chid, 0);
449  const auto& chamber = csc_g->chamber(detid);
450 
451  if (chamber) {
452  numStrips = chamber->layer(1)->geometry()->numberOfStrips();
453  // ME1/a is known to the readout hardware as strips 65-80 of ME1/1.
454  // Still need to decide whether we do any special adjustments to
455  // reconstruct LCTs in this region (3:1 ganged strips); for now, we
456  // simply allow for hits in ME1/a and apply standard reconstruction
457  // to them.
458  // For SLHC ME1/1 is set to have 4 CFEBs in ME1/b and 3 CFEBs in ME1/a
459  if (isME11) {
460  if (theRing == 4) {
461  if (infoV >= 0) {
462  edm::LogError("L1CSCTPEmulatorSetupError")
463  << "+++ Invalid ring number for this processor " << theRing
464  << " was set in the config."
465  << " +++\n"
466  << "+++ CSC geometry looks garbled; no emulation possible +++\n";
467  }
468  }
471  if (disableME1a && theRing == 1 ) numStrips = 64;
472  }
473 
475  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorSetupError")
476  << "+++ Number of strips, " << numStrips
477  << " found in " << detid.chamberName()
478  << " (sector " << theSector << " subsector " << theSubsector
479  << " trig id. " << theTrigChamber << ")"
480  << " exceeds max expected, " << CSCConstants::MAX_NUM_STRIPS_7CFEBS
481  << " +++\n"
482  << "+++ CSC geometry looks garbled; no emulation possible +++\n";
483  numStrips = -1;
484  }
485  // The strips for a given layer may be offset from the adjacent layers.
486  // This was done in order to improve resolution. We need to find the
487  // 'staggering' for each layer and make necessary conversions in our
488  // arrays. -JM
489  // In the TMB-07 firmware, half-strips in odd layers (layers are
490  // counted as ly0-ly5) are shifted by -1 half-strip, whereas in
491  // the previous firmware versions half-strips in even layers
492  // were shifted by +1 half-strip. This difference is due to a
493  // change from ly3 to ly2 in the choice of the key layer, and
494  // the intention to keep half-strips in the key layer unchanged.
495  // In the emulator, we use the old way for both cases, to avoid
496  // negative half-strip numbers. This will necessitate a
497  // subtraction of 1 half-strip for TMB-07 later on. -SV.
498  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
499  stagger[i_layer] =
500  (chamber->layer(i_layer+1)->geometry()->stagger() + 1) / 2;
501  }
502  }
503  else {
504  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorConfigError")
506  << " (sector " << theSector << " subsector " << theSubsector
507  << " trig id. " << theTrigChamber << ")"
508  << " is not defined in current geometry! +++\n"
509  << "+++ CSC geometry looks garbled; no emulation possible +++\n";
510  numStrips = -1;
511  }
512  }
513 
514  if (numStrips < 0) {
515  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorConfigError")
517  << " (sector " << theSector << " subsector " << theSubsector
518  << " trig id. " << theTrigChamber << "):"
519  << " numStrips = " << numStrips << "; CLCT emulation skipped! +++";
520  std::vector<CSCCLCTDigi> emptyV;
521  return emptyV;
522  }
523 
524  // Get comparator digis in this chamber.
525  bool noDigis = getDigis(compdc);
526 
527  if (!noDigis) {
528  // Get halfstrip times from comparator digis.
529  std::vector<int>
531  readComparatorDigis(halfstrip);
532 
533  // Pass arrays of halfstrips on to another run() doing the
534  // LCT search.
535  // If the number of layers containing digis is smaller than that
536  // required to trigger, quit right away. (If LCT-based digi suppression
537  // is implemented one day, this condition will have to be changed
538  // to the number of planes required to pre-trigger.)
539  unsigned int layersHit = 0;
540  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
541  for (int i_hstrip = 0; i_hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS;
542  i_hstrip++) {
543  if (!halfstrip[i_layer][i_hstrip].empty()) {layersHit++; break;}
544  }
545  }
546  // Run the algorithm only if the probability for the pre-trigger
547  // to fire is not null. (Pre-trigger decisions are used for the
548  // strip read-out conditions in DigiToRaw.)
549  if (layersHit >= nplanes_hit_pretrig) run(halfstrip);
550  }
551 
552  // Return vector of CLCTs.
553  std::vector<CSCCLCTDigi> tmpV = getCLCTs();
554 
555  // shift the BX from 7 to 8
556  // the unpacked real data CLCTs have central BX at bin 7
557  // however in simulation the central BX is bin 8
558  // to make a proper comparison with ALCTs we need
559  // CLCT and ALCT to have the central BX in the same bin
560  // this shift does not affect the readout of the CLCTs
561  // emulated CLCTs put in the event should be centered at bin 7 (as in data)
562  for (auto& p : tmpV){
563  p.setBX(p.getBX() + alctClctOffset);
564  }
565 
566  return tmpV;
567 }
static int ringFromTriggerLabels(int station, int triggerCSCID)
void readComparatorDigis(std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
bool getDigis(const CSCComparatorDigiCollection *compdc)
std::string chamberName() const
Definition: CSCDetId.cc:71
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
Definition: CSCGeometry.cc:133
int stagger[CSCConstants::NUM_LAYERS]
std::vector< CSCCLCTDigi > run(const CSCComparatorDigiCollection *compdc)
static int chamberFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station, int TriggerCSCID)
std::vector< CSCCLCTDigi > getCLCTs()
void CSCCathodeLCTProcessor::run ( const std::vector< int >  halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])

Called in test mode and by the run(compdc) function; does the actual LCT finding.

Definition at line 569 of file CSCCathodeLCTProcessor.cc.

References bestCLCT, CSCDetId::chamberName(), findLCTs(), findLCTsSLHC(), infoV, isME11, isSLHC, LogDebug, CSCConstants::MAX_CLCT_TBINS, secondCLCT, CSCCLCTDigi::setTrknmb(), theChamber, theEndcap, theRing, theSector, theStation, theSubsector, theTrigChamber, and use_dead_time_zoning.

570 {
571  // This version of the run() function can either be called in a standalone
572  // test, being passed the halfstrip times, or called by the
573  // run() function above. It uses the findLCTs() method to find vectors
574  // of LCT candidates. These candidates are sorted and the best two per bx
575  // are returned.
576  std::vector<CSCCLCTDigi> CLCTlist;
577 
578  // Upgrade version for ME11 with better dead-time handling
579  if (isSLHC && isME11 && use_dead_time_zoning) CLCTlist = findLCTsSLHC(halfstrip);
580  // TMB07 version of the CLCT algorithm.
581  else CLCTlist = findLCTs(halfstrip);
582 
583  // LCT sorting.
584  if (CLCTlist.size() > 1)
585  sort(CLCTlist.begin(), CLCTlist.end(), std::greater<CSCCLCTDigi>());
586 
587  // Take the best two candidates per bx.
588  for (std::vector<CSCCLCTDigi>::const_iterator plct = CLCTlist.begin();
589  plct != CLCTlist.end(); plct++) {
590  int bx = plct->getBX();
591  if (bx >= CSCConstants::MAX_CLCT_TBINS) {
592  if (infoV > 0) edm::LogWarning("L1CSCTPEmulatorOutOfTimeCLCT")
593  << "+++ Bx of CLCT candidate, " << bx << ", exceeds max allowed, "
594  << CSCConstants::MAX_CLCT_TBINS-1 << "; skipping it... +++\n";
595  continue;
596  }
597 
598  if (!bestCLCT[bx].isValid()) bestCLCT[bx] = *plct;
599  else if (!secondCLCT[bx].isValid()) {
600  secondCLCT[bx] = *plct;
601  }
602  }
603 
604  for (int bx = 0; bx < CSCConstants::MAX_CLCT_TBINS; bx++) {
605  if (bestCLCT[bx].isValid()) {
606  bestCLCT[bx].setTrknmb(1);
607  if (infoV > 0) LogDebug("CSCCathodeLCTProcessor")
608  << bestCLCT[bx] << " found in " <<
610  << " (sector " << theSector << " subsector " << theSubsector
611  << " trig id. " << theTrigChamber << ")" << "\n";
612  }
613  if (secondCLCT[bx].isValid()) {
614  secondCLCT[bx].setTrknmb(2);
615  if (infoV > 0) LogDebug("CSCCathodeLCTProcessor")
616  << secondCLCT[bx] << " found in " <<
618  << " (sector " << theSector << " subsector " << theSubsector
619  << " trig id. " << theTrigChamber << ")" << "\n";
620  }
621  }
622  // Now that we have our best CLCTs, they get correlated with the best
623  // ALCTs and then get sent to the MotherBoard. -JM
624 }
#define LogDebug(id)
CSCCLCTDigi bestCLCT[CSCConstants::MAX_CLCT_TBINS]
std::vector< CSCCLCTDigi > findLCTs(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
std::string chamberName() const
Definition: CSCDetId.cc:71
CSCCLCTDigi secondCLCT[CSCConstants::MAX_CLCT_TBINS]
std::vector< CSCCLCTDigi > findLCTsSLHC(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
void setTrknmb(const uint16_t number)
Set track number (1,2) after sorting CLCTs.
Definition: CSCCLCTDigi.h:95
void CSCCathodeLCTProcessor::setConfigParameters ( const CSCDBL1TPParameters conf)

Sets configuration parameters obtained via EventSetup mechanism.

Definition at line 305 of file CSCCathodeLCTProcessor.cc.

References checkConfigParameters(), CSCDBL1TPParameters::clctDriftDelay(), CSCDBL1TPParameters::clctFifoPretrig(), CSCDBL1TPParameters::clctFifoTbins(), CSCDBL1TPParameters::clctHitPersist(), CSCDBL1TPParameters::clctMinSeparation(), CSCDBL1TPParameters::clctNplanesHitPattern(), CSCDBL1TPParameters::clctNplanesHitPretrig(), CSCDBL1TPParameters::clctPidThreshPretrig(), drift_delay, dumpConfigParams(), fifo_pretrig, fifo_tbins, hit_persist, min_separation, nplanes_hit_pattern, nplanes_hit_pretrig, and pid_thresh_pretrig.

306 {
307  static std::atomic<bool> config_dumped{false};
308 
309  fifo_tbins = conf->clctFifoTbins();
310  fifo_pretrig = conf->clctFifoPretrig();
311  hit_persist = conf->clctHitPersist();
312  drift_delay = conf->clctDriftDelay();
317 
318  // Check and print configuration parameters.
320  if (!config_dumped) {
321  //std::cerr<<"**** CLCT setConfigParams parameters dump ****"<<std::endl;
323  config_dumped = true;
324  }
325 }
unsigned int clctHitPersist() const
unsigned int clctNplanesHitPattern() const
unsigned int clctMinSeparation() const
unsigned int clctNplanesHitPretrig() const
unsigned int clctDriftDelay() const
unsigned int clctPidThreshPretrig() const
unsigned int clctFifoPretrig() const
unsigned int clctFifoTbins() const
void CSCCathodeLCTProcessor::setCSCGeometry ( const CSCGeometry g)
inline

Definition at line 63 of file CSCCathodeLCTProcessor.h.

References csc_g, g, getDigis(), CSCConstants::NUM_HALF_STRIPS_7CFEBS, CSCConstants::NUM_LAYERS, and run().

63 { csc_g = g; }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
void CSCCathodeLCTProcessor::setDefaultConfigParameters ( )
private

Set default values for configuration parameters.

Definition at line 290 of file CSCCathodeLCTProcessor.cc.

References def_drift_delay, def_fifo_pretrig, def_fifo_tbins, def_hit_persist, def_min_separation, def_nplanes_hit_pattern, def_nplanes_hit_pretrig, def_pid_thresh_pretrig, def_tmb_l1a_window_size, drift_delay, fifo_pretrig, fifo_tbins, hit_persist, min_separation, nplanes_hit_pattern, nplanes_hit_pretrig, pid_thresh_pretrig, and tmb_l1a_window_size.

Referenced by CSCCathodeLCTProcessor().

291 {
292  // Set default values for configuration parameters.
302 }
static const unsigned int def_drift_delay
static const unsigned int def_fifo_tbins
static const unsigned int def_min_separation
static const unsigned int def_nplanes_hit_pretrig
static const unsigned int def_pid_thresh_pretrig
static const unsigned int def_tmb_l1a_window_size
static const unsigned int def_nplanes_hit_pattern
static const unsigned int def_fifo_pretrig
static const unsigned int def_hit_persist

Member Data Documentation

unsigned int CSCCathodeLCTProcessor::alctClctOffset
private

Offset between ALCT and CLCT in simulation. This is important when ALCTs (at BX0=8) and CLCTs (at BX0=7) are correlated in the trigger motherboard.

Definition at line 150 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), and run().

unsigned int CSCCathodeLCTProcessor::best_pid[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
private

Definition at line 211 of file CSCCathodeLCTProcessor.h.

Referenced by findLCTs(), findLCTsSLHC(), preTrigger(), and ptnFinding().

CSCCLCTDigi CSCCathodeLCTProcessor::bestCLCT[CSCConstants::MAX_CLCT_TBINS]

Best LCT in this chamber, as found by the processor.

Definition at line 78 of file CSCCathodeLCTProcessor.h.

Referenced by clear(), getCLCTs(), and run().

unsigned int CSCCathodeLCTProcessor::clct_state_machine_zone
private

Definition at line 170 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), and findLCTsSLHC().

const CSCGeometry* CSCCathodeLCTProcessor::csc_g
private

Definition at line 130 of file CSCCathodeLCTProcessor.h.

Referenced by run(), and setCSCGeometry().

const unsigned int CSCCathodeLCTProcessor::def_drift_delay = 2
staticprivate

Definition at line 184 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

const unsigned int CSCCathodeLCTProcessor::def_fifo_pretrig = 7
staticprivate

Definition at line 183 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

const unsigned int CSCCathodeLCTProcessor::def_fifo_tbins = 12
staticprivate

Default values of configuration parameters.

Definition at line 183 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

const unsigned int CSCCathodeLCTProcessor::def_hit_persist = 6
staticprivate

Definition at line 184 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

const unsigned int CSCCathodeLCTProcessor::def_min_separation = 10
staticprivate

Definition at line 187 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

const unsigned int CSCCathodeLCTProcessor::def_nplanes_hit_pattern = 4
staticprivate

Definition at line 186 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

const unsigned int CSCCathodeLCTProcessor::def_nplanes_hit_pretrig = 2
staticprivate

Definition at line 185 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

const unsigned int CSCCathodeLCTProcessor::def_pid_thresh_pretrig = 2
staticprivate

Definition at line 187 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

const unsigned int CSCCathodeLCTProcessor::def_tmb_l1a_window_size = 7
staticprivate

Definition at line 188 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

std::vector<CSCComparatorDigi> CSCCathodeLCTProcessor::digiV[CSCConstants::NUM_LAYERS]
private

Definition at line 140 of file CSCCathodeLCTProcessor.h.

Referenced by getDigis(), and readComparatorDigis().

bool CSCCathodeLCTProcessor::disableME1a
private

VK: special configuration parameters for ME1a treatment

Definition at line 163 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), getDigis(), and run().

unsigned int CSCCathodeLCTProcessor::drift_delay
private
bool CSCCathodeLCTProcessor::dynamic_state_machine_zone
private

Definition at line 171 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), and findLCTsSLHC().

int CSCCathodeLCTProcessor::early_tbins
private

VK: separate handle for early time bins

Definition at line 166 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), and readoutCLCTs().

unsigned int CSCCathodeLCTProcessor::fifo_pretrig
private
unsigned int CSCCathodeLCTProcessor::fifo_tbins
private
int CSCCathodeLCTProcessor::first_bx_corrected[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
private

Definition at line 213 of file CSCCathodeLCTProcessor.h.

Referenced by findLCTsSLHC(), and ptnFinding().

bool CSCCathodeLCTProcessor::gangedME1a
private

Definition at line 163 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), getDigis(), and run().

unsigned int CSCCathodeLCTProcessor::hit_persist
private
int CSCCathodeLCTProcessor::infoV
private

Verbosity level: 0: no print (default). 1: print only CLCTs found. 2: info at every step of the algorithm. 3: add special-purpose prints.

Definition at line 121 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), CSCCathodeLCTProcessor(), findLCTs(), findLCTsSLHC(), getDigis(), preTrigger(), ptnFinding(), pulseExtension(), readComparatorDigis(), readoutCLCTs(), and run().

bool CSCCathodeLCTProcessor::isME11
private

Definition at line 135 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), and run().

bool CSCCathodeLCTProcessor::ispretrig[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
private

Definition at line 218 of file CSCCathodeLCTProcessor.h.

Referenced by findLCTsSLHC(), and preTrigger().

bool CSCCathodeLCTProcessor::isSLHC
private

Flag for SLHC studies.

Definition at line 145 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), and run().

unsigned int CSCCathodeLCTProcessor::min_separation
private
unsigned int CSCCathodeLCTProcessor::nhits[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
private

Definition at line 212 of file CSCCathodeLCTProcessor.h.

Referenced by findLCTs(), findLCTsSLHC(), preTrigger(), and ptnFinding().

unsigned int CSCCathodeLCTProcessor::nplanes_hit_pattern
private
unsigned int CSCCathodeLCTProcessor::nplanes_hit_pretrig
private
int CSCCathodeLCTProcessor::numStrips
private
const int CSCCathodeLCTProcessor::pattern2007
static

Definition at line 103 of file CSCCathodeLCTProcessor.h.

Referenced by findLCTs(), findLCTsSLHC(), preTrigger(), and ptnFinding().

const int CSCCathodeLCTProcessor::pattern2007_offset
static
Initial value:
=
{ -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5,
-2, -1, 0, 1, 2,
0,
-2, -1, 0, 1, 2,
-4, -3, -2, -1, 0, 1, 2, 3, 4,
-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 }

Pre-defined patterns.

Definition at line 102 of file CSCCathodeLCTProcessor.h.

Referenced by ptnFinding().

unsigned int CSCCathodeLCTProcessor::pid_thresh_pretrig
private
unsigned int CSCCathodeLCTProcessor::pretrig_trig_zone
private

VK: allow triggers only in +-pretrig_trig_zone around pretriggers

Definition at line 174 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), and findLCTsSLHC().

bool CSCCathodeLCTProcessor::readout_earliest_2
private

VK: whether to readout only the earliest two LCTs in readout window

Definition at line 180 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), and readoutCLCTs().

CSCCLCTDigi CSCCathodeLCTProcessor::secondCLCT[CSCConstants::MAX_CLCT_TBINS]

Second best LCT in this chamber, as found by the processor.

Definition at line 81 of file CSCCathodeLCTProcessor.h.

Referenced by clear(), getCLCTs(), and run().

int CSCCathodeLCTProcessor::stagger[CSCConstants::NUM_LAYERS]
private
int CSCCathodeLCTProcessor::start_bx_shift
private

VK: some quick and dirty fix to reduce CLCT deadtime

Definition at line 160 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), findLCTs(), findLCTsSLHC(), and pulseExtension().

unsigned int CSCCathodeLCTProcessor::theChamber
private
const unsigned CSCCathodeLCTProcessor::theEndcap
private

Chamber id (trigger-type labels).

Definition at line 124 of file CSCCathodeLCTProcessor.h.

Referenced by dumpDigis(), getDigis(), and run().

std::vector<int> CSCCathodeLCTProcessor::thePreTriggerBXs
private

Definition at line 141 of file CSCCathodeLCTProcessor.h.

Referenced by clear(), findLCTs(), and preTriggerBXs().

std::vector<CSCCLCTPreTriggerDigi> CSCCathodeLCTProcessor::thePreTriggerDigis
private
unsigned int CSCCathodeLCTProcessor::theRing
private
const unsigned CSCCathodeLCTProcessor::theSector
private

Definition at line 126 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), getDigis(), and run().

const unsigned CSCCathodeLCTProcessor::theStation
private
const unsigned CSCCathodeLCTProcessor::theSubsector
private

Definition at line 127 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), getDigis(), and run().

const unsigned CSCCathodeLCTProcessor::theTrigChamber
private

Definition at line 128 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), getDigis(), and run().

unsigned int CSCCathodeLCTProcessor::tmb_l1a_window_size
private
bool CSCCathodeLCTProcessor::use_corrected_bx
private

VK: whether to use corrected_bx instead of pretrigger BX

Definition at line 177 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), and findLCTsSLHC().

bool CSCCathodeLCTProcessor::use_dead_time_zoning
private

VK: use of localized dead-time zones

Definition at line 169 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), and run().