CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes
CSCMotherboard Class Reference

#include <CSCMotherboard.h>

Inheritance diagram for CSCMotherboard:
CSCMotherboardME11 CSCMotherboardME11GEM CSCMotherboardME21GEM CSCMotherboardME3141RPC CSCUpgradeMotherboard CSCGEMMotherboard

Public Member Functions

void clear ()
 
 CSCMotherboard (unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf)
 
 CSCMotherboard ()
 
std::vector< CSCCorrelatedLCTDigigetLCTs ()
 
std::vector< CSCCorrelatedLCTDigireadoutLCTs ()
 
void run (const std::vector< int > w_time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES], const std::vector< int > hs_times[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const std::vector< int > ds_times[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
 
void run (const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc)
 
void setConfigParameters (const CSCDBL1TPParameters *conf)
 
virtual ~CSCMotherboard ()=default
 

Public Attributes

std::unique_ptr< CSCAnodeLCTProcessoralct
 
std::unique_ptr< CSCCathodeLCTProcessorclct
 

Protected Types

enum  { MAX_LCT_BINS = 16 }
 

Protected Member Functions

void checkConfigParameters ()
 
CSCCorrelatedLCTDigi constructLCTs (const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT, int)
 
void correlateLCTs (CSCALCTDigi bestALCT, CSCALCTDigi secondALCT, CSCCLCTDigi bestCLCT, CSCCLCTDigi secondCLCT)
 
void dumpConfigParams () const
 
unsigned int encodePattern (const int ptn, const int highPt)
 
unsigned int findQuality (const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT)
 
void testLCT ()
 

Static Protected Member Functions

static bool sortByGEMDphi (const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
 
static bool sortByQuality (const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
 

Protected Attributes

unsigned int alct_trig_enable
 
unsigned int clct_trig_enable
 
bool drop_used_alcts
 
int early_tbins
 
CSCCorrelatedLCTDigi firstLCT [MAX_LCT_BINS]
 
int infoV
 
bool isMTCC
 
bool isSLHC
 
bool isTMB07
 
int lct_central_bx
 
unsigned int match_trig_enable
 
unsigned int match_trig_window_size
 
unsigned int mpc_block_me1a
 
bool readout_earliest_2
 
CSCCorrelatedLCTDigi secondLCT [MAX_LCT_BINS]
 
const unsigned theEndcap
 
unsigned theRing
 
const unsigned theSector
 
const unsigned theStation
 
const unsigned theSubsector
 
const unsigned theTrigChamber
 
unsigned int tmb_l1a_window_size
 

Static Protected Attributes

static const unsigned int def_alct_trig_enable = 0
 
static const unsigned int def_clct_trig_enable = 0
 
static const unsigned int def_match_trig_enable = 1
 
static const unsigned int def_match_trig_window_size = 7
 
static const unsigned int def_mpc_block_me1a = 1
 
static const unsigned int def_tmb_l1a_window_size = 7
 

Detailed Description

Correlates anode and cathode LCTs from the same chamber.

When the Trigger MotherBoard (TMB) is instantiated it instantiates an ALCT and CLCT board. The MotherBoard takes up to two LCTs from each anode and cathode LCT card and combines them into a single Correlated LCT. The output is up to two Correlated LCTs.

It can be run in either a test mode, where the arguments are a collection of wire times and arrays of halfstrip and distrip times, or for general use, with wire digi and comparator digi collections as arguments. In the latter mode, the wire & strip info is passed on the LCTProcessors, where it is decoded and converted into a convenient form. After running the anode and cathode LCTProcessors, TMB correlates the anode and cathode LCTs. At present, it simply matches the best CLCT with the best ALCT; perhaps a better algorithm will be determined in the future. The MotherBoard then determines a few more numbers (such as quality and pattern) from the ALCT and CLCT information, and constructs two correlated LCT "digis".

Author
Benn Tannenbaum 28 August 1999 benn@.nosp@m.phys.nosp@m.ics.u.nosp@m.cla..nosp@m.edu

Based on code by Nick Wisniewski (nw@it.nosp@m.s.ca.nosp@m.ltech.nosp@m..edu) and a framework by Darin Acosta (acost.nosp@m.a@ph.nosp@m.ys.uf.nosp@m.l.ed.nosp@m.u).

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.

Definition at line 41 of file CSCMotherboard.h.

Member Enumeration Documentation

anonymous enum
protected

Maximum number of time bins.

Enumerator
MAX_LCT_BINS 

Definition at line 131 of file CSCMotherboard.h.

Constructor & Destructor Documentation

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

Normal constructor.

Definition at line 50 of file CSCMotherboard.cc.

References alct, alct_trig_enable, checkConfigParameters(), clct, clct_trig_enable, drop_used_alcts, dumpConfigParams(), early_tbins, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), infoV, isMTCC, isSLHC, isTMB07, lct_central_bx, match_trig_enable, match_trig_window_size, mpc_block_me1a, or, readout_earliest_2, CSCTriggerNumbering::ringFromTriggerLabels(), theRing, theStation, theTrigChamber, and tmb_l1a_window_size.

53  :
55  theSubsector(subsector), theTrigChamber(chamber) {
56 
58 
59  // Normal constructor. -JM
60  // Pass ALCT, CLCT, and common parameters on to ALCT and CLCT processors.
61  static std::atomic<bool> config_dumped{false};
62 
63  // Some configuration parameters and some details of the emulator
64  // algorithms depend on whether we want to emulate the trigger logic
65  // used in TB/MTCC or its idealized version (the latter was used in MC
66  // studies since early ORCA days until (and including) CMSSW_2_1_X).
67  edm::ParameterSet commonParams =
68  conf.getParameter<edm::ParameterSet>("commonParam");
69  isMTCC = commonParams.getParameter<bool>("isMTCC");
70 
71  // Switch for a new (2007) version of the TMB firmware.
72  isTMB07 = commonParams.getParameter<bool>("isTMB07");
73 
74  // is it (non-upgrade algorithm) run along with upgrade one?
75  isSLHC = commonParams.getParameter<bool>("isSLHC");
76 
77  // Choose the appropriate set of configuration parameters depending on
78  // isTMB07 and isMTCC flags.
79  // Starting with CMSSW_3_1_X, these settings are overwritten by the
80  // ones delivered by the EventSetup mechanism.
81  edm::ParameterSet alctParams, clctParams;
82  if (isTMB07) {
83  alctParams = conf.getParameter<edm::ParameterSet>("alctParam07");
84  clctParams = conf.getParameter<edm::ParameterSet>("clctParam07");
85  }
86  else if (isMTCC) {
87  alctParams = conf.getParameter<edm::ParameterSet>("alctParamMTCC");
88  clctParams = conf.getParameter<edm::ParameterSet>("clctParamMTCC");
89  }
90  else {
91  alctParams = conf.getParameter<edm::ParameterSet>("alctParamOldMC");
92  clctParams = conf.getParameter<edm::ParameterSet>("clctParamOldMC");
93  }
94 
95  // Motherboard parameters:
96  edm::ParameterSet tmbParams = conf.getParameter<edm::ParameterSet>("tmbParam");
97  const edm::ParameterSet me11tmbGemParams(conf.existsAs<edm::ParameterSet>("me11tmbSLHCGEM")?
98  conf.getParameter<edm::ParameterSet>("me11tmbSLHCGEM"):edm::ParameterSet());
99  const edm::ParameterSet me21tmbGemParams(conf.existsAs<edm::ParameterSet>("me21tmbSLHCGEM")?
100  conf.getParameter<edm::ParameterSet>("me21tmbSLHCGEM"):edm::ParameterSet());
101  const edm::ParameterSet me3141tmbRpcParams(conf.existsAs<edm::ParameterSet>("me3141tmbSLHCRPC")?
102  conf.getParameter<edm::ParameterSet>("me3141tmbSLHCRPC"):edm::ParameterSet());
103 
104  const bool runME11ILT(commonParams.existsAs<bool>("runME11ILT")?commonParams.getParameter<bool>("runME11ILT"):false);
105  const bool runME21ILT(commonParams.existsAs<bool>("runME21ILT")?commonParams.getParameter<bool>("runME21ILT"):false);
106  const bool runME3141ILT(commonParams.existsAs<bool>("runME3141ILT")?commonParams.getParameter<bool>("runME3141ILT"):false);
107 
108  // run upgrade TMBs for all MEX/1 stations
109  if (isSLHC and theRing == 1){
110  if (theStation == 1) {
111  tmbParams = conf.getParameter<edm::ParameterSet>("tmbSLHC");
112  alctParams = conf.getParameter<edm::ParameterSet>("alctSLHC");
113  clctParams = conf.getParameter<edm::ParameterSet>("clctSLHC");
114  if (runME11ILT) {
115  tmbParams = me11tmbGemParams;
116  }
117  }
118  else if (theStation == 2 and runME21ILT) {
119  tmbParams = me21tmbGemParams;
120  alctParams = conf.getParameter<edm::ParameterSet>("alctSLHCME21");
121  clctParams = conf.getParameter<edm::ParameterSet>("clctSLHCME21");
122  }
123  else if ((theStation == 3 or theStation == 4) and runME3141ILT) {
124  tmbParams = me3141tmbRpcParams;
125  alctParams = conf.getParameter<edm::ParameterSet>("alctSLHCME3141");
126  clctParams = conf.getParameter<edm::ParameterSet>("clctSLHCME3141");
127  }
128  }
129 
130  mpc_block_me1a = tmbParams.getParameter<unsigned int>("mpcBlockMe1a");
131  alct_trig_enable = tmbParams.getParameter<unsigned int>("alctTrigEnable");
132  clct_trig_enable = tmbParams.getParameter<unsigned int>("clctTrigEnable");
133  match_trig_enable = tmbParams.getParameter<unsigned int>("matchTrigEnable");
135  tmbParams.getParameter<unsigned int>("matchTrigWindowSize");
136  tmb_l1a_window_size = // Common to CLCT and TMB
137  tmbParams.getParameter<unsigned int>("tmbL1aWindowSize");
138 
139  lct_central_bx = 6;
140 
141  // configuration handle for number of early time bins
142  early_tbins = tmbParams.getParameter<int>("tmbEarlyTbins");
143 
144  // whether to not reuse ALCTs that were used by previous matching CLCTs
145  drop_used_alcts = tmbParams.getParameter<bool>("tmbDropUsedAlcts");
146 
147  // whether to readout only the earliest two LCTs in readout window
148  readout_earliest_2 = tmbParams.getParameter<bool>("tmbReadoutEarliest2");
149 
150  infoV = tmbParams.getParameter<int>("verbosity");
151 
152  alct.reset( new CSCAnodeLCTProcessor(endcap, station, sector, subsector, chamber, alctParams, commonParams) );
153  clct.reset( new CSCCathodeLCTProcessor(endcap, station, sector, subsector, chamber, clctParams, commonParams, tmbParams) );
154 
155  //if (theStation==1 && CSCTriggerNumbering::ringFromTriggerLabels(theStation, theTrigChamber)==2) infoV = 3;
156 
157  // Check and print configuration parameters.
159  if (infoV > 0 && !config_dumped) {
161  config_dumped = true;
162  }
163 
164  // test to make sure that what goes into a correlated LCT is also what
165  // comes back out.
166  // testLCT();
167 }
T getParameter(std::string const &) const
const unsigned theSector
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
unsigned int clct_trig_enable
unsigned int match_trig_window_size
const unsigned theTrigChamber
const unsigned theEndcap
static int ringFromTriggerLabels(int station, int triggerCSCID)
unsigned int mpc_block_me1a
const unsigned theStation
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
const unsigned theSubsector
unsigned int tmb_l1a_window_size
void checkConfigParameters()
unsigned int match_trig_enable
unsigned int alct_trig_enable
std::unique_ptr< CSCAnodeLCTProcessor > alct
void dumpConfigParams() const
std::unique_ptr< CSCCathodeLCTProcessor > clct
unsigned theRing
CSCMotherboard::CSCMotherboard ( )

Constructor for use during testing.

Definition at line 169 of file CSCMotherboard.cc.

References alct, alct_trig_enable, checkConfigParameters(), clct, clct_trig_enable, def_alct_trig_enable, def_clct_trig_enable, def_match_trig_enable, def_match_trig_window_size, def_mpc_block_me1a, def_tmb_l1a_window_size, dumpConfigParams(), early_tbins, infoV, isMTCC, isTMB07, match_trig_enable, match_trig_window_size, mpc_block_me1a, and tmb_l1a_window_size.

169  :
170  theEndcap(1), theStation(1), theSector(1),
172  // Constructor used only for testing. -JM
173  static std::atomic<bool> config_dumped{false};
174 
175  isMTCC = false;
176  isTMB07 = true;
177 
178  early_tbins = 4;
179 
180  alct.reset( new CSCAnodeLCTProcessor() );
181  clct.reset( new CSCCathodeLCTProcessor() );
188 
189  infoV = 2;
190 
191  // Check and print configuration parameters.
193  if (infoV > 0 && !config_dumped) {
195  config_dumped = true;
196  }
197 }
const unsigned theSector
unsigned int clct_trig_enable
unsigned int match_trig_window_size
const unsigned theTrigChamber
static const unsigned int def_alct_trig_enable
const unsigned theEndcap
static const unsigned int def_mpc_block_me1a
static const unsigned int def_clct_trig_enable
unsigned int mpc_block_me1a
const unsigned theStation
static const unsigned int def_tmb_l1a_window_size
const unsigned theSubsector
unsigned int tmb_l1a_window_size
void checkConfigParameters()
unsigned int match_trig_enable
static const unsigned int def_match_trig_window_size
unsigned int alct_trig_enable
std::unique_ptr< CSCAnodeLCTProcessor > alct
void dumpConfigParams() const
std::unique_ptr< CSCCathodeLCTProcessor > clct
static const unsigned int def_match_trig_enable
virtual CSCMotherboard::~CSCMotherboard ( )
virtualdefault

Default destructor.

Member Function Documentation

void CSCMotherboard::checkConfigParameters ( )
protected

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

Definition at line 232 of file CSCMotherboard.cc.

References alct_trig_enable, clct_trig_enable, def_alct_trig_enable, def_clct_trig_enable, def_match_trig_enable, def_match_trig_window_size, def_mpc_block_me1a, def_tmb_l1a_window_size, infoV, match_trig_enable, match_trig_window_size, mpc_block_me1a, and tmb_l1a_window_size.

Referenced by CSCMotherboard(), and setConfigParameters().

232  {
233  // Make sure that the parameter values are within the allowed range.
234 
235  // Max expected values.
236  static const unsigned int max_mpc_block_me1a = 1 << 1;
237  static const unsigned int max_alct_trig_enable = 1 << 1;
238  static const unsigned int max_clct_trig_enable = 1 << 1;
239  static const unsigned int max_match_trig_enable = 1 << 1;
240  static const unsigned int max_match_trig_window_size = 1 << 4;
241  static const unsigned int max_tmb_l1a_window_size = 1 << 4;
242 
243  // Checks.
244  if (mpc_block_me1a >= max_mpc_block_me1a) {
245  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorConfigError")
246  << "+++ Value of mpc_block_me1a, " << mpc_block_me1a
247  << ", exceeds max allowed, " << max_mpc_block_me1a-1 << " +++\n"
248  << "+++ Try to proceed with the default value, mpc_block_me1a="
249  << def_mpc_block_me1a << " +++\n";
251  }
252  if (alct_trig_enable >= max_alct_trig_enable) {
253  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorConfigError")
254  << "+++ Value of alct_trig_enable, " << alct_trig_enable
255  << ", exceeds max allowed, " << max_alct_trig_enable-1 << " +++\n"
256  << "+++ Try to proceed with the default value, alct_trig_enable="
257  << def_alct_trig_enable << " +++\n";
259  }
260  if (clct_trig_enable >= max_clct_trig_enable) {
261  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorConfigError")
262  << "+++ Value of clct_trig_enable, " << clct_trig_enable
263  << ", exceeds max allowed, " << max_clct_trig_enable-1 << " +++\n"
264  << "+++ Try to proceed with the default value, clct_trig_enable="
265  << def_clct_trig_enable << " +++\n";
267  }
268  if (match_trig_enable >= max_match_trig_enable) {
269  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorConfigError")
270  << "+++ Value of match_trig_enable, " << match_trig_enable
271  << ", exceeds max allowed, " << max_match_trig_enable-1 << " +++\n"
272  << "+++ Try to proceed with the default value, match_trig_enable="
273  << def_match_trig_enable << " +++\n";
275  }
276  if (match_trig_window_size >= max_match_trig_window_size) {
277  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorConfigError")
278  << "+++ Value of match_trig_window_size, " << match_trig_window_size
279  << ", exceeds max allowed, " << max_match_trig_window_size-1 << " +++\n"
280  << "+++ Try to proceed with the default value, match_trig_window_size="
281  << def_match_trig_window_size << " +++\n";
283  }
284  if (tmb_l1a_window_size >= max_tmb_l1a_window_size) {
285  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorConfigError")
286  << "+++ Value of tmb_l1a_window_size, " << tmb_l1a_window_size
287  << ", exceeds max allowed, " << max_tmb_l1a_window_size-1 << " +++\n"
288  << "+++ Try to proceed with the default value, tmb_l1a_window_size="
289  << def_tmb_l1a_window_size << " +++\n";
291  }
292 }
unsigned int clct_trig_enable
unsigned int match_trig_window_size
static const unsigned int def_alct_trig_enable
static const unsigned int def_mpc_block_me1a
static const unsigned int def_clct_trig_enable
unsigned int mpc_block_me1a
static const unsigned int def_tmb_l1a_window_size
unsigned int tmb_l1a_window_size
unsigned int match_trig_enable
static const unsigned int def_match_trig_window_size
unsigned int alct_trig_enable
static const unsigned int def_match_trig_enable
void CSCMotherboard::clear ( void  )

Clears correlated LCT and passes clear signal on to cathode and anode LCT processors.

Definition at line 199 of file CSCMotherboard.cc.

References alct, clct, CSCCorrelatedLCTDigi::clear(), firstLCT, MAX_LCT_BINS, and secondLCT.

Referenced by CSCMotherboardME21GEM::clear(), CSCMotherboardME11::clear(), CSCMotherboardME3141RPC::clear(), CSCMotherboardME11GEM::clear(), and run().

199  {
200  if (alct) alct->clear();
201  if (clct) clct->clear();
202  for (int bx = 0; bx < MAX_LCT_BINS; bx++) {
203  firstLCT[bx].clear();
204  secondLCT[bx].clear();
205  }
206 }
CSCCorrelatedLCTDigi secondLCT[MAX_LCT_BINS]
CSCCorrelatedLCTDigi firstLCT[MAX_LCT_BINS]
std::unique_ptr< CSCAnodeLCTProcessor > alct
std::unique_ptr< CSCCathodeLCTProcessor > clct
CSCCorrelatedLCTDigi CSCMotherboard::constructLCTs ( const CSCALCTDigi aLCT,
const CSCCLCTDigi cLCT,
int  type 
)
protected

Definition at line 597 of file CSCMotherboard.cc.

References encodePattern(), findQuality(), CSCCLCTDigi::getBend(), CSCALCTDigi::getBX(), CSCCLCTDigi::getBX(), CSCCLCTDigi::getKeyStrip(), CSCALCTDigi::getKeyWG(), CSCCLCTDigi::getPattern(), CSCCLCTDigi::getStripType(), CSCALCTDigi::isValid(), listBenchmarks::pattern, btvTracks_cfi::quality, CSCCorrelatedLCTDigi::setType(), and theTrigChamber.

Referenced by CSCMotherboardME11::correlateLCTs(), and correlateLCTs().

599  {
600  // CLCT pattern number
601  unsigned int pattern = encodePattern(cLCT.getPattern(), cLCT.getStripType());
602 
603  // LCT quality number
604  unsigned int quality = findQuality(aLCT, cLCT);
605 
606  // Bunch crossing: get it from cathode LCT if anode LCT is not there.
607  int bx = aLCT.isValid() ? aLCT.getBX() : cLCT.getBX();
608 
609  // construct correlated LCT; temporarily assign track number of 0.
610  int trknmb = 0;
611  CSCCorrelatedLCTDigi thisLCT(trknmb, 1, quality, aLCT.getKeyWG(),
612  cLCT.getKeyStrip(), pattern, cLCT.getBend(),
613  bx, 0, 0, 0, theTrigChamber);
614  thisLCT.setType(type);
615  thisLCT.setALCT(aLCT);
616  thisLCT.setCLCT(cLCT);
617  return thisLCT;
618 }
type
Definition: HCALResponse.h:21
const unsigned theTrigChamber
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:30
unsigned int findQuality(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT)
int getStripType() const
return striptype
Definition: CSCCLCTDigi.h:39
int getBend() const
return bend
Definition: CSCCLCTDigi.h:42
int getBX() const
return BX
Definition: CSCCLCTDigi.h:51
unsigned int encodePattern(const int ptn, const int highPt)
int getBX() const
return BX - five low bits of BXN counter tagged by the ALCT
Definition: CSCALCTDigi.h:48
int getPattern() const
return pattern
Definition: CSCCLCTDigi.h:36
int getKeyStrip() const
Definition: CSCCLCTDigi.h:65
int getKeyWG() const
return key wire group
Definition: CSCALCTDigi.h:45
void CSCMotherboard::correlateLCTs ( CSCALCTDigi  bestALCT,
CSCALCTDigi  secondALCT,
CSCCLCTDigi  bestCLCT,
CSCCLCTDigi  secondCLCT 
)
protected

Definition at line 542 of file CSCMotherboard.cc.

References alct_trig_enable, clct_trig_enable, CSCCorrelatedLCTDigi::CLCTALCT, constructLCTs(), firstLCT, CSCCorrelatedLCTDigi::getBX(), infoV, CSCCLCTDigi::isValid(), CSCALCTDigi::isValid(), match_trig_enable, MAX_LCT_BINS, secondLCT, and CSCCorrelatedLCTDigi::setTrknmb().

Referenced by run().

545  {
546 
547  bool anodeBestValid = bestALCT.isValid();
548  bool anodeSecondValid = secondALCT.isValid();
549  bool cathodeBestValid = bestCLCT.isValid();
550  bool cathodeSecondValid = secondCLCT.isValid();
551 
552  if (anodeBestValid && !anodeSecondValid) secondALCT = bestALCT;
553  if (!anodeBestValid && anodeSecondValid) bestALCT = secondALCT;
554  if (cathodeBestValid && !cathodeSecondValid) secondCLCT = bestCLCT;
555  if (!cathodeBestValid && cathodeSecondValid) bestCLCT = secondCLCT;
556 
557  // ALCT-CLCT matching conditions are defined by "trig_enable" configuration
558  // parameters.
559  if ((alct_trig_enable && bestALCT.isValid()) ||
560  (clct_trig_enable && bestCLCT.isValid()) ||
561  (match_trig_enable && bestALCT.isValid() && bestCLCT.isValid())) {
563  int bx = lct.getBX();
564  if (bx >= 0 && bx < MAX_LCT_BINS) {
565  firstLCT[bx] = lct;
566  firstLCT[bx].setTrknmb(1);
567  }
568  else {
569  if (infoV > 0) edm::LogWarning("L1CSCTPEmulatorOutOfTimeLCT")
570  << "+++ Bx of first LCT candidate, " << bx
571  << ", is not within the allowed range, [0-" << MAX_LCT_BINS-1
572  << "); skipping it... +++\n";
573  }
574  }
575 
576  if (((secondALCT != bestALCT) || (secondCLCT != bestCLCT)) &&
577  ((alct_trig_enable && secondALCT.isValid()) ||
578  (clct_trig_enable && secondCLCT.isValid()) ||
579  (match_trig_enable && secondALCT.isValid() && secondCLCT.isValid()))) {
581  int bx = lct.getBX();
582  if (bx >= 0 && bx < MAX_LCT_BINS) {
583  secondLCT[bx] = lct;
584  secondLCT[bx].setTrknmb(2);
585  }
586  else {
587  if (infoV > 0) edm::LogWarning("L1CSCTPEmulatorOutOfTimeLCT")
588  << "+++ Bx of second LCT candidate, " << bx
589  << ", is not within the allowed range, [0-" << MAX_LCT_BINS-1
590  << "); skipping it... +++\n";
591  }
592  }
593 }
unsigned int clct_trig_enable
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:30
CSCCorrelatedLCTDigi secondLCT[MAX_LCT_BINS]
CSCCorrelatedLCTDigi constructLCTs(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT, int)
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:30
unsigned int match_trig_enable
int getBX() const
return BX
CSCCorrelatedLCTDigi firstLCT[MAX_LCT_BINS]
unsigned int alct_trig_enable
void setTrknmb(const uint16_t number)
Set track number (1,2) after sorting LCTs.
void CSCMotherboard::dumpConfigParams ( ) const
protected

Dump TMB/MPC configuration parameters.

Definition at line 821 of file CSCMotherboard.cc.

References alct_trig_enable, clct_trig_enable, LogDebug, match_trig_enable, match_trig_window_size, mpc_block_me1a, and tmb_l1a_window_size.

Referenced by CSCMotherboard(), and setConfigParameters().

821  {
822  std::ostringstream strm;
823  strm << "\n";
824  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
825  strm << "+ TMB configuration parameters: +\n";
826  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
827  strm << " mpc_block_me1a [block/not block triggers which come from ME1/A] = "
828  << mpc_block_me1a << "\n";
829  strm << " alct_trig_enable [allow ALCT-only triggers] = "
830  << alct_trig_enable << "\n";
831  strm << " clct_trig_enable [allow CLCT-only triggers] = "
832  << clct_trig_enable << "\n";
833  strm << " match_trig_enable [allow matched ALCT-CLCT triggers] = "
834  << match_trig_enable << "\n";
835  strm << " match_trig_window_size [ALCT-CLCT match window width, in 25 ns] = "
836  << match_trig_window_size << "\n";
837  strm << " tmb_l1a_window_size [L1Accept window width, in 25 ns bins] = "
838  << tmb_l1a_window_size << "\n";
839  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
840  LogDebug("CSCMotherboard") << strm.str();
841 }
#define LogDebug(id)
unsigned int clct_trig_enable
unsigned int match_trig_window_size
unsigned int mpc_block_me1a
unsigned int tmb_l1a_window_size
unsigned int match_trig_enable
unsigned int alct_trig_enable
unsigned int CSCMotherboard::encodePattern ( const int  ptn,
const int  highPt 
)
protected

Definition at line 622 of file CSCMotherboard.cc.

References funct::abs(), isTMB07, and listBenchmarks::pattern.

Referenced by constructLCTs(), CSCMotherboardME21GEM::constructLCTsGEM(), CSCGEMMotherboard::constructLCTsGEM(), CSCMotherboardME11GEM::constructLCTsGEM(), CSCMotherboardME3141RPC::constructLCTsRPC(), and testLCT().

623  {
624  const int kPatternBitWidth = 4;
625  unsigned int pattern;
626 
627  if (!isTMB07) {
628  // Cathode pattern number is a kPatternBitWidth-1 bit word.
629  pattern = (abs(ptn) & ((1<<(kPatternBitWidth-1))-1));
630 
631  // The pattern has the MSB (4th bit in the default version) set if it
632  // consists of half-strips.
633  if (stripType) {
634  pattern = pattern | (1<<(kPatternBitWidth-1));
635  }
636  }
637  else {
638  // In the TMB07 firmware, LCT pattern is just a 4-bit CLCT pattern.
639  pattern = (abs(ptn) & ((1<<kPatternBitWidth)-1));
640  }
641 
642  return pattern;
643 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned int CSCMotherboard::findQuality ( const CSCALCTDigi aLCT,
const CSCCLCTDigi cLCT 
)
protected

Definition at line 648 of file CSCMotherboard.cc.

References CSCALCTDigi::getAccelerator(), CSCCLCTDigi::getPattern(), CSCCLCTDigi::getQuality(), CSCALCTDigi::getQuality(), CSCCLCTDigi::getStripType(), infoV, isTMB07, CSCALCTDigi::isValid(), CSCCLCTDigi::isValid(), PFRecoTauDiscriminationByIsolation_cfi::offset, listBenchmarks::pattern, and btvTracks_cfi::quality.

Referenced by constructLCTs(), and testLCT().

649  {
650  unsigned int quality = 0;
651 
652  if (!isTMB07) {
653  bool isDistrip = (cLCT.getStripType() == 0);
654 
655  if (aLCT.isValid() && !(cLCT.isValid())) { // no CLCT
656  if (aLCT.getAccelerator()) {quality = 1;}
657  else {quality = 3;}
658  }
659  else if (!(aLCT.isValid()) && cLCT.isValid()) { // no ALCT
660  if (isDistrip) {quality = 4;}
661  else {quality = 5;}
662  }
663  else if (aLCT.isValid() && cLCT.isValid()) { // both ALCT and CLCT
664  if (aLCT.getAccelerator()) {quality = 2;} // accelerator muon
665  else { // collision muon
666  // CLCT quality is, in fact, the number of layers hit, so subtract 3
667  // to get quality analogous to ALCT one.
668  int sumQual = aLCT.getQuality() + (cLCT.getQuality()-3);
669  if (sumQual < 1 || sumQual > 6) {
670  if (infoV >= 0) edm::LogWarning("L1CSCTPEmulatorWrongValues")
671  << "+++ findQuality: sumQual = " << sumQual << "+++ \n";
672  }
673  if (isDistrip) { // distrip pattern
674  if (sumQual == 2) {quality = 6;}
675  else if (sumQual == 3) {quality = 7;}
676  else if (sumQual == 4) {quality = 8;}
677  else if (sumQual == 5) {quality = 9;}
678  else if (sumQual == 6) {quality = 10;}
679  }
680  else { // halfstrip pattern
681  if (sumQual == 2) {quality = 11;}
682  else if (sumQual == 3) {quality = 12;}
683  else if (sumQual == 4) {quality = 13;}
684  else if (sumQual == 5) {quality = 14;}
685  else if (sumQual == 6) {quality = 15;}
686  }
687  }
688  }
689  }
690 #ifdef OLD
691  else {
692  // Temporary definition, used until July 2008.
693  // First if statement is fictitious, just to help the CSC TF emulator
694  // handle such cases (one needs to make sure they will be accounted for
695  // in the new quality definition.
696  if (!(aLCT.isValid()) || !(cLCT.isValid())) {
697  if (aLCT.isValid() && !(cLCT.isValid())) quality = 1; // no CLCT
698  else if (!(aLCT.isValid()) && cLCT.isValid()) quality = 2; // no ALCT
699  else quality = 0; // both absent; should never happen.
700  }
701  else {
702  // Sum of ALCT and CLCT quality bits. CLCT quality is, in fact, the
703  // number of layers hit, so subtract 3 to put it to the same footing as
704  // the ALCT quality.
705  int sumQual = aLCT.getQuality() + (cLCT.getQuality()-3);
706  if (sumQual < 1 || sumQual > 6) {
707  if (infoV >= 0) edm::LogWarning("L1CSCTPEmulatorWrongValues")
708  << "+++ findQuality: Unexpected sumQual = " << sumQual << "+++\n";
709  }
710 
711  // LCT quality is basically the sum of ALCT and CLCT qualities, but split
712  // in two groups depending on the CLCT pattern id (higher quality for
713  // straighter patterns).
714  int offset = 0;
715  if (cLCT.getPattern() <= 7) offset = 4;
716  else offset = 9;
717  quality = offset + sumQual;
718  }
719  }
720 #endif
721  else {
722  // 2008 definition.
723  if (!(aLCT.isValid()) || !(cLCT.isValid())) {
724  if (aLCT.isValid() && !(cLCT.isValid())) quality = 1; // no CLCT
725  else if (!(aLCT.isValid()) && cLCT.isValid()) quality = 2; // no ALCT
726  else quality = 0; // both absent; should never happen.
727  }
728  else {
729  int pattern = cLCT.getPattern();
730  if (pattern == 1) quality = 3; // layer-trigger in CLCT
731  else {
732  // CLCT quality is the number of layers hit minus 3.
733  // CLCT quality is the number of layers hit.
734  bool a4 = (aLCT.getQuality() >= 1);
735  bool c4 = (cLCT.getQuality() >= 4);
736  // quality = 4; "reserved for low-quality muons in future"
737  if (!a4 && !c4) quality = 5; // marginal anode and cathode
738  else if ( a4 && !c4) quality = 6; // HQ anode, but marginal cathode
739  else if (!a4 && c4) quality = 7; // HQ cathode, but marginal anode
740  else if ( a4 && c4) {
741  if (aLCT.getAccelerator()) quality = 8; // HQ muon, but accel ALCT
742  else {
743  // quality = 9; "reserved for HQ muons with future patterns
744  // quality = 10; "reserved for HQ muons with future patterns
745  if (pattern == 2 || pattern == 3) quality = 11;
746  else if (pattern == 4 || pattern == 5) quality = 12;
747  else if (pattern == 6 || pattern == 7) quality = 13;
748  else if (pattern == 8 || pattern == 9) quality = 14;
749  else if (pattern == 10) quality = 15;
750  else {
751  if (infoV >= 0) edm::LogWarning("L1CSCTPEmulatorWrongValues")
752  << "+++ findQuality: Unexpected CLCT pattern id = "
753  << pattern << "+++\n";
754  }
755  }
756  }
757  }
758  }
759  }
760  return quality;
761 }
int getQuality() const
return quality of a pattern (number of layers hit!)
Definition: CSCCLCTDigi.h:33
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:30
int getStripType() const
return striptype
Definition: CSCCLCTDigi.h:39
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:30
int getQuality() const
return quality of a pattern
Definition: CSCALCTDigi.h:33
int getAccelerator() const
Definition: CSCALCTDigi.h:37
int getPattern() const
return pattern
Definition: CSCCLCTDigi.h:36
std::vector< CSCCorrelatedLCTDigi > CSCMotherboard::getLCTs ( )

Returns vector of all found correlated LCTs, if any.

Definition at line 523 of file CSCMotherboard.cc.

References firstLCT, MAX_LCT_BINS, mpc_block_me1a, CSCTriggerNumbering::ringFromTriggerLabels(), secondLCT, theStation, and theTrigChamber.

Referenced by readoutLCTs().

523  {
524  std::vector<CSCCorrelatedLCTDigi> tmpV;
525 
526  bool me11 = (theStation == 1 &&
528  theTrigChamber)==1);
529 
530  // Do not report LCTs found in ME1/A if mpc_block_me1/a is set.
531  for (int bx = 0; bx < MAX_LCT_BINS; bx++) {
532  if (firstLCT[bx].isValid())
533  if (!mpc_block_me1a || (!me11 || firstLCT[bx].getStrip() <= 127))
534  tmpV.push_back(firstLCT[bx]);
535  if (secondLCT[bx].isValid())
536  if (!mpc_block_me1a || (!me11 || secondLCT[bx].getStrip() <= 127))
537  tmpV.push_back(secondLCT[bx]);
538  }
539  return tmpV;
540 }
const unsigned theTrigChamber
static int ringFromTriggerLabels(int station, int triggerCSCID)
unsigned int mpc_block_me1a
const unsigned theStation
CSCCorrelatedLCTDigi secondLCT[MAX_LCT_BINS]
CSCCorrelatedLCTDigi firstLCT[MAX_LCT_BINS]
std::vector< CSCCorrelatedLCTDigi > CSCMotherboard::readoutLCTs ( )

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

Definition at line 447 of file CSCMotherboard.cc.

References early_tbins, getLCTs(), infoV, LogDebug, MAX_LCT_BINS, readout_earliest_2, and tmb_l1a_window_size.

Referenced by CSCTriggerPrimitivesBuilder::build(), CSCMotherboardME11::readoutLCTs1a(), CSCMotherboardME11GEM::readoutLCTs1a(), CSCMotherboardME11::readoutLCTs1b(), and CSCMotherboardME11GEM::readoutLCTs1b().

447  {
448  std::vector<CSCCorrelatedLCTDigi> tmpV;
449 
450  // The start time of the L1A*LCT coincidence window should be related
451  // to the fifo_pretrig parameter, but I am not completely sure how.
452  // Just choose it such that the window is centered at bx=7. This may
453  // need further tweaking if the value of tmb_l1a_window_size changes.
454  //static int early_tbins = 4;
455 
456  // Empirical correction to match 2009 collision data (firmware change?)
457  int lct_bins = tmb_l1a_window_size;
458  int late_tbins = early_tbins + lct_bins;
459 
460  int ifois = 0;
461  if (ifois == 0) {
462  if (infoV >= 0 && early_tbins < 0) {
463  edm::LogWarning("L1CSCTPEmulatorSuspiciousParameters")
464  << "+++ early_tbins = " << early_tbins
465  << "; in-time LCTs are not getting read-out!!! +++" << "\n";
466  }
467 
468  if (late_tbins > MAX_LCT_BINS-1) {
469  if (infoV >= 0) edm::LogWarning("L1CSCTPEmulatorSuspiciousParameters")
470  << "+++ Allowed range of time bins, [0-" << late_tbins
471  << "] exceeds max allowed, " << MAX_LCT_BINS-1 << " +++\n"
472  << "+++ Set late_tbins to max allowed +++\n";
473  late_tbins = MAX_LCT_BINS-1;
474  }
475  ifois = 1;
476  }
477 
478  // Start from the vector of all found correlated LCTs and select
479  // those within the LCT*L1A coincidence window.
480  int bx_readout = -1;
481  std::vector<CSCCorrelatedLCTDigi> all_lcts = getLCTs();
482  for (std::vector <CSCCorrelatedLCTDigi>::const_iterator plct =
483  all_lcts.begin(); plct != all_lcts.end(); plct++) {
484  if (!plct->isValid()) continue;
485 
486  int bx = (*plct).getBX();
487  // Skip LCTs found too early relative to L1Accept.
488  if (bx <= early_tbins) {
489  if (infoV > 1) LogDebug("CSCMotherboard")
490  << " Do not report correlated LCT on key halfstrip "
491  << plct->getStrip() << " and key wire " << plct->getKeyWG()
492  << ": found at bx " << bx << ", whereas the earliest allowed bx is "
493  << early_tbins+1;
494  continue;
495  }
496 
497  // Skip LCTs found too late relative to L1Accept.
498  if (bx > late_tbins) {
499  if (infoV > 1) LogDebug("CSCMotherboard")
500  << " Do not report correlated LCT on key halfstrip "
501  << plct->getStrip() << " and key wire " << plct->getKeyWG()
502  << ": found at bx " << bx << ", whereas the latest allowed bx is "
503  << late_tbins;
504  continue;
505  }
506 
507  // If (readout_earliest_2) take only LCTs in the earliest bx in the read-out window:
508  // in digi->raw step, LCTs have to be packed into the TMB header, and
509  // currently there is room just for two.
510  if (readout_earliest_2) {
511  if (bx_readout == -1 || bx == bx_readout) {
512  tmpV.push_back(*plct);
513  if (bx_readout == -1) bx_readout = bx;
514  }
515  }
516  // if readout_earliest_2 == false, save all LCTs
517  else tmpV.push_back(*plct);
518  }
519  return tmpV;
520 }
#define LogDebug(id)
std::vector< CSCCorrelatedLCTDigi > getLCTs()
unsigned int tmb_l1a_window_size
void CSCMotherboard::run ( const std::vector< int >  w_time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES],
const std::vector< int >  hs_times[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
const std::vector< int >  ds_times[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS] 
)

Test version of run function.

Definition at line 294 of file CSCMotherboard.cc.

References alct, clct, clear(), correlateLCTs(), isSLHC, match_trig_window_size, CSCAnodeLCTProcessor::MAX_ALCT_BINS, and CSCCathodeLCTProcessor::MAX_CLCT_BINS.

Referenced by CSCTriggerPrimitivesBuilder::build().

297  {
298  // Debug version. -JM
299  clear();
300  alct->run(w_times); // run anode LCT
301  clct->run(hs_times, ds_times); // run cathodeLCT
302 
303  int bx_alct_matched = 0;
304  for (int bx_clct = 0; bx_clct < CSCCathodeLCTProcessor::MAX_CLCT_BINS;
305  bx_clct++) {
306  if (clct->bestCLCT[bx_clct].isValid()) {
307  bool is_matched = false;
308  int bx_alct_start = bx_clct - match_trig_window_size/2;
309  int bx_alct_stop = bx_clct + match_trig_window_size/2;
310  // Empirical correction to match 2009 collision data (firmware change?)
311  if (!isSLHC) bx_alct_stop += match_trig_window_size%2;
312 
313  for (int bx_alct = bx_alct_start; bx_alct <= bx_alct_stop; bx_alct++) {
314  if (bx_alct < 0 || bx_alct >= CSCAnodeLCTProcessor::MAX_ALCT_BINS)
315  continue;
316  if (alct->bestALCT[bx_alct].isValid()) {
317  correlateLCTs(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
318  clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct]);
319  is_matched = true;
320  bx_alct_matched = bx_alct;
321  break;
322  }
323  }
324  // No ALCT within the match time interval found: report CLCT-only LCT
325  // (use dummy ALCTs).
326  if (!is_matched) {
327  correlateLCTs(alct->bestALCT[bx_clct], alct->secondALCT[bx_clct],
328  clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct]);
329  }
330  }
331  // No valid CLCTs; attempt to make ALCT-only LCT (use dummy CLCTs).
332  else {
333  int bx_alct = bx_clct - match_trig_window_size/2;
334  if (bx_alct >= 0 && bx_alct > bx_alct_matched) {
335  if (alct->bestALCT[bx_alct].isValid()) {
336  correlateLCTs(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
337  clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct]);
338  }
339  }
340  }
341  }
342 }
unsigned int match_trig_window_size
void correlateLCTs(CSCALCTDigi bestALCT, CSCALCTDigi secondALCT, CSCCLCTDigi bestCLCT, CSCCLCTDigi secondCLCT)
std::unique_ptr< CSCAnodeLCTProcessor > alct
std::unique_ptr< CSCCathodeLCTProcessor > clct
void CSCMotherboard::run ( const CSCWireDigiCollection wiredc,
const CSCComparatorDigiCollection compdc 
)

Run function for normal usage. Runs cathode and anode LCT processors, takes results and correlates into CorrelatedLCT.

Definition at line 345 of file CSCMotherboard.cc.

References a, alct, clct, clear(), correlateLCTs(), drop_used_alcts, firstLCT, infoV, isSLHC, LogDebug, LogTrace, match_trig_window_size, CSCAnodeLCTProcessor::MAX_ALCT_BINS, CSCCathodeLCTProcessor::MAX_CLCT_BINS, MAX_LCT_BINS, and secondLCT.

346  {
347  clear();
348  if (alct && clct) {
349  {
350  std::vector<CSCALCTDigi> alctV = alct->run(wiredc); // run anodeLCT
351  }
352  {
353  std::vector<CSCCLCTDigi> clctV = clct->run(compdc); // run cathodeLCT
354  }
355 
356  int used_alct_mask[20];
357  for (int a=0;a<20;++a) used_alct_mask[a]=0;
358 
359  int bx_alct_matched = 0; // bx of last matched ALCT
360  for (int bx_clct = 0; bx_clct < CSCCathodeLCTProcessor::MAX_CLCT_BINS;
361  bx_clct++) {
362  // There should be at least one valid ALCT or CLCT for a
363  // correlated LCT to be formed. Decision on whether to reject
364  // non-complete LCTs (and if yes of which type) is made further
365  // upstream.
366  if (clct->bestCLCT[bx_clct].isValid()) {
367  // Look for ALCTs within the match-time window. The window is
368  // centered at the CLCT bx; therefore, we make an assumption
369  // that anode and cathode hits are perfectly synchronized. This
370  // is always true for MC, but only an approximation when the
371  // data is analyzed (which works fairly good as long as wide
372  // windows are used). To get rid of this assumption, one would
373  // need to access "full BX" words, which are not readily
374  // available.
375  bool is_matched = false;
376  int bx_alct_start = bx_clct - match_trig_window_size/2;
377  int bx_alct_stop = bx_clct + match_trig_window_size/2;
378  // Empirical correction to match 2009 collision data (firmware change?)
379  // (but don't do it for SLHC case, assume it would not be there)
380  if (!isSLHC) bx_alct_stop += match_trig_window_size%2;
381 
382  for (int bx_alct = bx_alct_start; bx_alct <= bx_alct_stop; bx_alct++) {
383  if (bx_alct < 0 || bx_alct >= CSCAnodeLCTProcessor::MAX_ALCT_BINS)
384  continue;
385  // default: do not reuse ALCTs that were used with previous CLCTs
386  if (drop_used_alcts && used_alct_mask[bx_alct]) continue;
387  if (alct->bestALCT[bx_alct].isValid()) {
388  if (infoV > 1) LogTrace("CSCMotherboard")
389  << "Successful ALCT-CLCT match: bx_clct = " << bx_clct
390  << "; match window: [" << bx_alct_start << "; " << bx_alct_stop
391  << "]; bx_alct = " << bx_alct;
392  correlateLCTs(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
393  clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct]);
394  used_alct_mask[bx_alct] += 1;
395  is_matched = true;
396  bx_alct_matched = bx_alct;
397  break;
398  }
399  }
400  // No ALCT within the match time interval found: report CLCT-only LCT
401  // (use dummy ALCTs).
402  if (!is_matched) {
403  if (infoV > 1) LogTrace("CSCMotherboard")
404  << "Unsuccessful ALCT-CLCT match (CLCT only): bx_clct = "
405  << bx_clct << "; match window: [" << bx_alct_start
406  << "; " << bx_alct_stop << "]";
407  correlateLCTs(alct->bestALCT[bx_clct], alct->secondALCT[bx_clct],
408  clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct]);
409  }
410  }
411  // No valid CLCTs; attempt to make ALCT-only LCT. Use only ALCTs
412  // which have zeroth chance to be matched at later cathode times.
413  // (I am not entirely sure this perfectly matches the firmware logic.)
414  // Use dummy CLCTs.
415  else {
416  int bx_alct = bx_clct - match_trig_window_size/2;
417  if (bx_alct >= 0 && bx_alct > bx_alct_matched) {
418  if (alct->bestALCT[bx_alct].isValid()) {
419  if (infoV > 1) LogTrace("CSCMotherboard")
420  << "Unsuccessful ALCT-CLCT match (ALCT only): bx_alct = "
421  << bx_alct;
422  correlateLCTs(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
423  clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct]);
424  }
425  }
426  }
427  }
428 
429  if (infoV > 0) {
430  for (int bx = 0; bx < MAX_LCT_BINS; bx++) {
431  if (firstLCT[bx].isValid())
432  LogDebug("CSCMotherboard") << firstLCT[bx];
433  if (secondLCT[bx].isValid())
434  LogDebug("CSCMotherboard") << secondLCT[bx];
435  }
436  }
437  }
438  else {
439  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorSetupError")
440  << "+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
441  }
442 }
#define LogDebug(id)
unsigned int match_trig_window_size
void correlateLCTs(CSCALCTDigi bestALCT, CSCALCTDigi secondALCT, CSCCLCTDigi bestCLCT, CSCCLCTDigi secondCLCT)
CSCCorrelatedLCTDigi secondLCT[MAX_LCT_BINS]
#define LogTrace(id)
CSCCorrelatedLCTDigi firstLCT[MAX_LCT_BINS]
std::unique_ptr< CSCAnodeLCTProcessor > alct
double a
Definition: hdecay.h:121
std::unique_ptr< CSCCathodeLCTProcessor > clct
void CSCMotherboard::setConfigParameters ( const CSCDBL1TPParameters conf)

Set configuration parameters obtained via EventSetup mechanism.

Definition at line 209 of file CSCMotherboard.cc.

References alct, alct_trig_enable, checkConfigParameters(), clct, clct_trig_enable, dumpConfigParams(), match_trig_enable, match_trig_window_size, mpc_block_me1a, tmb_l1a_window_size, CSCDBL1TPParameters::tmbAlctTrigEnable(), CSCDBL1TPParameters::tmbClctTrigEnable(), CSCDBL1TPParameters::tmbMatchTrigEnable(), CSCDBL1TPParameters::tmbMatchTrigWindowSize(), CSCDBL1TPParameters::tmbMpcBlockMe1a(), and CSCDBL1TPParameters::tmbTmbL1aWindowSize().

209  {
210  static std::atomic<bool> config_dumped{false};
211 
212  // Config. parameters for the TMB itself.
219 
220  // Config. paramteres for ALCT and CLCT processors.
221  alct->setConfigParameters(conf);
222  clct->setConfigParameters(conf);
223 
224  // Check and print configuration parameters.
226  if (!config_dumped) {
228  config_dumped = true;
229  }
230 }
unsigned int clct_trig_enable
unsigned int match_trig_window_size
unsigned int tmbClctTrigEnable() const
unsigned int mpc_block_me1a
unsigned int tmbTmbL1aWindowSize() const
unsigned int tmbMatchTrigWindowSize() const
unsigned int tmbAlctTrigEnable() const
unsigned int tmb_l1a_window_size
void checkConfigParameters()
unsigned int match_trig_enable
unsigned int tmbMpcBlockMe1a() const
unsigned int alct_trig_enable
std::unique_ptr< CSCAnodeLCTProcessor > alct
void dumpConfigParams() const
std::unique_ptr< CSCCathodeLCTProcessor > clct
unsigned int tmbMatchTrigEnable() const
bool CSCMotherboard::sortByGEMDphi ( const CSCCorrelatedLCTDigi lct1,
const CSCCorrelatedLCTDigi lct2 
)
staticprotected

Definition at line 851 of file CSCMotherboard.cc.

Referenced by CSCMotherboardME11GEM::sortLCTsByGEMDPhi(), and CSCMotherboardME21GEM::sortLCTsByGEMDPhi().

852 {
853  // return lct1.getGEMDPhi() < lct2.getGEMDPhi();
854  return true;
855 }
bool CSCMotherboard::sortByQuality ( const CSCCorrelatedLCTDigi lct1,
const CSCCorrelatedLCTDigi lct2 
)
staticprotected

Definition at line 845 of file CSCMotherboard.cc.

References CSCCorrelatedLCTDigi::getQuality().

Referenced by CSCMotherboardME11GEM::sortLCTsByQuality(), CSCMotherboardME3141RPC::sortLCTsByQuality(), and CSCMotherboardME21GEM::sortLCTsByQuality().

846 {
847  return lct1.getQuality() > lct2.getQuality();
848 }
int getQuality() const
return the 4 bit Correlated LCT Quality
void CSCMotherboard::testLCT ( )
protected

Definition at line 763 of file CSCMotherboard.cc.

References encodePattern(), findQuality(), CSCCLCTDigi::getBend(), CSCALCTDigi::getBX(), CSCCLCTDigi::getKeyStrip(), CSCALCTDigi::getKeyWG(), CSCCLCTDigi::getPattern(), CSCCLCTDigi::getStripType(), LogTrace, listBenchmarks::pattern, btvTracks_cfi::quality, and digi_MixPreMix_cfi::strip.

763  {
764  unsigned int lctPattern, lctQuality;
765  for (int pattern = 0; pattern < 8; pattern++) {
766  for (int bend = 0; bend < 2; bend++) {
767  for (int cfeb = 0; cfeb < 5; cfeb++) {
768  for (int strip = 0; strip < 32; strip++) {
769  for (int bx = 0; bx < 7; bx++) {
770  for (int stripType = 0; stripType < 2; stripType++) {
771  for (int quality = 3; quality < 7; quality++) {
772  CSCCLCTDigi cLCT(1, quality, pattern, stripType, bend,
773  strip, cfeb, bx);
774  lctPattern = encodePattern(cLCT.getPattern(),
775  cLCT.getStripType());
776  for (int aQuality = 0; aQuality < 4; aQuality++) {
777  for (int wireGroup = 0; wireGroup < 120; wireGroup++) {
778  for (int abx = 0; abx < 7; abx++) {
779  CSCALCTDigi aLCT(1, aQuality, 0, 1, wireGroup, abx);
780  lctQuality = findQuality(aLCT, cLCT);
782  thisLCT(0, 1, lctQuality, aLCT.getKeyWG(),
783  cLCT.getKeyStrip(), lctPattern, cLCT.getBend(),
784  aLCT.getBX());
785  if (lctPattern != static_cast<unsigned int>(thisLCT.getPattern()) )
786  LogTrace("CSCMotherboard")
787  << "pattern mismatch: " << lctPattern
788  << " " << thisLCT.getPattern();
789  if (bend != thisLCT.getBend())
790  LogTrace("CSCMotherboard")
791  << "bend mismatch: " << bend
792  << " " << thisLCT.getBend();
793  int key_strip = 32*cfeb + strip;
794  if (key_strip != thisLCT.getStrip())
795  LogTrace("CSCMotherboard")
796  << "strip mismatch: " << key_strip
797  << " " << thisLCT.getStrip();
798  if (wireGroup != thisLCT.getKeyWG())
799  LogTrace("CSCMotherboard")
800  << "wire group mismatch: " << wireGroup
801  << " " << thisLCT.getKeyWG();
802  if (abx != thisLCT.getBX())
803  LogTrace("CSCMotherboard")
804  << "bx mismatch: " << abx << " " << thisLCT.getBX();
805  if (lctQuality != static_cast<unsigned int>(thisLCT.getQuality()))
806  LogTrace("CSCMotherboard")
807  << "quality mismatch: " << lctQuality
808  << " " << thisLCT.getQuality();
809  }
810  }
811  }
812  }
813  }
814  }
815  }
816  }
817  }
818  }
819 }
unsigned int findQuality(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT)
unsigned int encodePattern(const int ptn, const int highPt)
#define LogTrace(id)

Member Data Documentation

std::unique_ptr<CSCAnodeLCTProcessor> CSCMotherboard::alct
unsigned int CSCMotherboard::alct_trig_enable
protected
std::unique_ptr<CSCCathodeLCTProcessor> CSCMotherboard::clct
unsigned int CSCMotherboard::clct_trig_enable
protected
const unsigned int CSCMotherboard::def_alct_trig_enable = 0
staticprotected

Definition at line 126 of file CSCMotherboard.h.

Referenced by checkConfigParameters(), and CSCMotherboard().

const unsigned int CSCMotherboard::def_clct_trig_enable = 0
staticprotected

Definition at line 126 of file CSCMotherboard.h.

Referenced by checkConfigParameters(), and CSCMotherboard().

const unsigned int CSCMotherboard::def_match_trig_enable = 1
staticprotected

Definition at line 127 of file CSCMotherboard.h.

Referenced by checkConfigParameters(), and CSCMotherboard().

const unsigned int CSCMotherboard::def_match_trig_window_size = 7
staticprotected

Definition at line 127 of file CSCMotherboard.h.

Referenced by checkConfigParameters(), and CSCMotherboard().

const unsigned int CSCMotherboard::def_mpc_block_me1a = 1
staticprotected

Default values of configuration parameters.

Definition at line 125 of file CSCMotherboard.h.

Referenced by checkConfigParameters(), and CSCMotherboard().

const unsigned int CSCMotherboard::def_tmb_l1a_window_size = 7
staticprotected

Definition at line 128 of file CSCMotherboard.h.

Referenced by checkConfigParameters(), and CSCMotherboard().

bool CSCMotherboard::drop_used_alcts
protected

SLHC: whether to not reuse ALCTs that were used by previous matching CLCTs

Definition at line 116 of file CSCMotherboard.h.

Referenced by CSCMotherboard(), CSCMotherboardME11::run(), and run().

int CSCMotherboard::early_tbins
protected

SLHC: separate handle for early time bins

Definition at line 119 of file CSCMotherboard.h.

Referenced by CSCMotherboard(), CSCMotherboardME11::readoutLCTs(), readoutLCTs(), and CSCMotherboardME11GEM::readoutLCTs().

CSCCorrelatedLCTDigi CSCMotherboard::firstLCT[MAX_LCT_BINS]
protected

Container for first correlated LCT.

Definition at line 134 of file CSCMotherboard.h.

Referenced by clear(), correlateLCTs(), getLCTs(), and run().

int CSCMotherboard::infoV
protected
bool CSCMotherboard::isMTCC
protected

Flag for MTCC data.

Definition at line 99 of file CSCMotherboard.h.

Referenced by CSCMotherboard().

bool CSCMotherboard::isSLHC
protected
bool CSCMotherboard::isTMB07
protected

Flag for new (2007) version of TMB firmware.

Definition at line 102 of file CSCMotherboard.h.

Referenced by CSCMotherboard(), encodePattern(), findQuality(), and CSCMotherboardME3141RPC::findQualityRPC().

int CSCMotherboard::lct_central_bx
protected
unsigned int CSCMotherboard::match_trig_enable
protected
unsigned int CSCMotherboard::match_trig_window_size
protected
unsigned int CSCMotherboard::mpc_block_me1a
protected
bool CSCMotherboard::readout_earliest_2
protected

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

Definition at line 122 of file CSCMotherboard.h.

Referenced by CSCMotherboard(), CSCMotherboardME11::readoutLCTs(), readoutLCTs(), and CSCMotherboardME11GEM::readoutLCTs().

CSCCorrelatedLCTDigi CSCMotherboard::secondLCT[MAX_LCT_BINS]
protected

Container for second correlated LCT.

Definition at line 137 of file CSCMotherboard.h.

Referenced by clear(), correlateLCTs(), CSCGEMMotherboard::correlateLCTsGEM(), getLCTs(), and run().

const unsigned CSCMotherboard::theEndcap
protected
unsigned CSCMotherboard::theRing
protected

Definition at line 96 of file CSCMotherboard.h.

Referenced by CSCMotherboard().

const unsigned CSCMotherboard::theSector
protected
const unsigned CSCMotherboard::theStation
protected
const unsigned CSCMotherboard::theSubsector
protected
const unsigned CSCMotherboard::theTrigChamber
protected
unsigned int CSCMotherboard::tmb_l1a_window_size
protected