CMS 3D CMS Logo

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

#include <CSCMotherboard.h>

Inheritance diagram for CSCMotherboard:
CSCMotherboardME11 CSCUpgradeMotherboard CSCGEMMotherboard CSCMotherboardME3141 CSCGEMMotherboardME11 CSCGEMMotherboardME21

Public Member Functions

void clear ()
 
 CSCMotherboard (unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf)
 
 CSCMotherboard ()
 
std::vector< CSCCorrelatedLCTDigigetLCTs () const
 
std::vector< CSCCorrelatedLCTDigireadoutLCTs () const
 
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)
 
void setCSCGeometry (const CSCGeometry *g)
 
virtual ~CSCMotherboard ()=default
 

Public Attributes

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

Protected Types

enum  LCT_Quality {
  INVALID = 0, NO_CLCT = 1, NO_ALCT = 2, CLCT_LAYER_TRIGGER = 3,
  LOW_QUALITY = 4, MARGINAL_ANODE_CATHODE = 5, HQ_ANODE_MARGINAL_CATHODE = 6, HQ_CATHODE_MARGINAL_ANODE = 7,
  HQ_ACCEL_ALCT = 8, HQ_RESERVED_1 = 9, HQ_RESERVED_2 = 10, HQ_PATTERN_2_3 = 11,
  HQ_PATTERN_4_5 = 12, HQ_PATTERN_6_7 = 13, HQ_PATTERN_8_9 = 14, HQ_PATTERN_10 = 15
}
 

Protected Member Functions

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

Protected Attributes

unsigned int alct_trig_enable
 
bool clct_to_alct
 
unsigned int clct_trig_enable
 
const CSCGeometrycsc_g
 
bool drop_used_alcts
 
bool drop_used_clcts
 
int early_tbins
 
CSCCorrelatedLCTDigi firstLCT [CSCConstants::MAX_LCT_TBINS]
 
int infoV
 
bool isMTCC
 
bool isSLHC
 
bool isTMB07
 
unsigned int match_trig_enable
 
unsigned int match_trig_window_size
 
unsigned int mpc_block_me1a
 
bool readout_earliest_2
 
CSCCorrelatedLCTDigi secondLCT [CSCConstants::MAX_LCT_TBINS]
 
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 43 of file CSCMotherboard.h.

Member Enumeration Documentation

Enumerator
INVALID 
NO_CLCT 
NO_ALCT 
CLCT_LAYER_TRIGGER 
LOW_QUALITY 
MARGINAL_ANODE_CATHODE 
HQ_ANODE_MARGINAL_CATHODE 
HQ_CATHODE_MARGINAL_ANODE 
HQ_ACCEL_ALCT 
HQ_RESERVED_1 
HQ_RESERVED_2 
HQ_PATTERN_2_3 
HQ_PATTERN_4_5 
HQ_PATTERN_6_7 
HQ_PATTERN_8_9 
HQ_PATTERN_10 

Definition at line 169 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_to_alct, clct_trig_enable, drop_used_alcts, drop_used_clcts, dumpConfigParams(), early_tbins, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), infoV, isMTCC, isSLHC, isTMB07, 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 me3141tmbParams(conf.existsAs<edm::ParameterSet>("me3141tmbSLHC")?
102  conf.getParameter<edm::ParameterSet>("me3141tmbSLHC"):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 = me3141tmbParams;
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  // configuration handle for number of early time bins
140  early_tbins = tmbParams.getParameter<int>("tmbEarlyTbins");
141 
142  // whether to not reuse ALCTs that were used by previous matching CLCTs
143  drop_used_alcts = tmbParams.getParameter<bool>("tmbDropUsedAlcts");
144  drop_used_clcts = tmbParams.getParameter<bool>("tmbDropUsedClcts");
145 
146  clct_to_alct = tmbParams.getParameter<bool>("clctToAlct");
147 
148  // whether to readout only the earliest two LCTs in readout window
149  readout_earliest_2 = tmbParams.getParameter<bool>("tmbReadoutEarliest2");
150 
151  infoV = tmbParams.getParameter<int>("verbosity");
152 
153  alct.reset( new CSCAnodeLCTProcessor(endcap, station, sector, subsector, chamber, alctParams, commonParams) );
154  clct.reset( new CSCCathodeLCTProcessor(endcap, station, sector, subsector, chamber, clctParams, commonParams, tmbParams) );
155 
156  // Check and print configuration parameters.
158  if (infoV > 0 && !config_dumped) {
160  config_dumped = true;
161  }
162 
163  // test to make sure that what goes into a correlated LCT is also what
164  // comes back out.
165  // testLCT();
166 }
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
CSCMotherboard::CSCMotherboard ( )

Constructor for use during testing.

Definition at line 168 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.

168  :
169  theEndcap(1), theStation(1), theSector(1),
171  // Constructor used only for testing. -JM
172  static std::atomic<bool> config_dumped{false};
173 
174  isMTCC = false;
175  isTMB07 = true;
176 
177  early_tbins = 4;
178 
179  alct.reset( new CSCAnodeLCTProcessor() );
180  clct.reset( new CSCCathodeLCTProcessor() );
187 
188  infoV = 2;
189 
190  // Check and print configuration parameters.
192  if (infoV > 0 && !config_dumped) {
194  config_dumped = true;
195  }
196 }
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 231 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().

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

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

Referenced by CSCMotherboardME3141::clear(), CSCGEMMotherboardME21::clear(), CSCGEMMotherboardME11::clear(), CSCMotherboardME11::clear(), and run().

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

Definition at line 698 of file CSCMotherboard.cc.

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

Referenced by CSCMotherboardME3141::correlateLCTs(), CSCMotherboardME11::correlateLCTs(), correlateLCTs(), and CSCGEMMotherboardME21::correlateLCTsGEM().

701  {
702  // CLCT pattern number
703  unsigned int pattern = encodePattern(cLCT.getPattern(), cLCT.getStripType());
704 
705  // LCT quality number
706  unsigned int quality = findQuality(aLCT, cLCT);
707 
708  // Bunch crossing: get it from cathode LCT if anode LCT is not there.
709  int bx = aLCT.isValid() ? aLCT.getBX() : cLCT.getBX();
710 
711  // construct correlated LCT
712  CSCCorrelatedLCTDigi thisLCT(trknmb, 1, quality, aLCT.getKeyWG(),
713  cLCT.getKeyStrip(), pattern, cLCT.getBend(),
714  bx, 0, 0, 0, theTrigChamber);
715  thisLCT.setType(type);
716  // make sure to shift the ALCT BX from 8 to 3!
717  thisLCT.setALCT(getBXShiftedALCT(aLCT));
718  thisLCT.setCLCT(cLCT);
719  return thisLCT;
720 }
type
Definition: HCALResponse.h:21
CSCALCTDigi getBXShiftedALCT(const CSCALCTDigi &) const
const unsigned theTrigChamber
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:30
int getStripType() const
return striptype
Definition: CSCCLCTDigi.h:48
int getBend() const
return bend
Definition: CSCCLCTDigi.h:54
int getBX() const
return BX
Definition: CSCCLCTDigi.h:72
int getBX() const
return BX - five low bits of BXN counter tagged by the ALCT
Definition: CSCALCTDigi.h:63
unsigned int findQuality(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT) const
int getPattern() const
return pattern
Definition: CSCCLCTDigi.h:42
unsigned int encodePattern(const int ptn, const int highPt) const
int getKeyStrip() const
Definition: CSCCLCTDigi.h:89
int getKeyWG() const
return key wire group
Definition: CSCALCTDigi.h:57
void CSCMotherboard::correlateLCTs ( const CSCALCTDigi bestALCT,
const CSCALCTDigi secondALCT,
const CSCCLCTDigi bestCLCT,
const CSCCLCTDigi secondCLCT,
int  type 
)
protected

Definition at line 639 of file CSCMotherboard.cc.

References alct_trig_enable, clct_trig_enable, constructLCTs(), firstLCT, CSCCorrelatedLCTDigi::getBX(), infoV, CSCCLCTDigi::isValid(), CSCALCTDigi::isValid(), match_trig_enable, CSCConstants::MAX_LCT_TBINS, and secondLCT.

Referenced by run().

644 {
645  CSCALCTDigi bestALCT = bALCT;
646  CSCALCTDigi secondALCT = sALCT;
647  CSCCLCTDigi bestCLCT = bCLCT;
648  CSCCLCTDigi secondCLCT = sCLCT;
649 
650  bool anodeBestValid = bestALCT.isValid();
651  bool anodeSecondValid = secondALCT.isValid();
652  bool cathodeBestValid = bestCLCT.isValid();
653  bool cathodeSecondValid = secondCLCT.isValid();
654 
655  if (anodeBestValid && !anodeSecondValid) secondALCT = bestALCT;
656  if (!anodeBestValid && anodeSecondValid) bestALCT = secondALCT;
657  if (cathodeBestValid && !cathodeSecondValid) secondCLCT = bestCLCT;
658  if (!cathodeBestValid && cathodeSecondValid) bestCLCT = secondCLCT;
659 
660  // ALCT-CLCT matching conditions are defined by "trig_enable" configuration
661  // parameters.
662  if ((alct_trig_enable && bestALCT.isValid()) ||
663  (clct_trig_enable && bestCLCT.isValid()) ||
664  (match_trig_enable && bestALCT.isValid() && bestCLCT.isValid())) {
665  const CSCCorrelatedLCTDigi& lct = constructLCTs(bestALCT, bestCLCT, type, 1);
666  int bx = lct.getBX();
667  if (bx >= 0 && bx < CSCConstants::MAX_LCT_TBINS) {
668  firstLCT[bx] = lct;
669  }
670  else {
671  if (infoV > 0) edm::LogWarning("L1CSCTPEmulatorOutOfTimeLCT")
672  << "+++ Bx of first LCT candidate, " << bx
673  << ", is not within the allowed range, [0-" << CSCConstants::MAX_LCT_TBINS-1
674  << "); skipping it... +++\n";
675  }
676  }
677 
678  if (((secondALCT != bestALCT) || (secondCLCT != bestCLCT)) &&
679  ((alct_trig_enable && secondALCT.isValid()) ||
680  (clct_trig_enable && secondCLCT.isValid()) ||
681  (match_trig_enable && secondALCT.isValid() && secondCLCT.isValid()))) {
682  const CSCCorrelatedLCTDigi& lct = constructLCTs(secondALCT, secondCLCT, type, 2);
683  int bx = lct.getBX();
684  if (bx >= 0 && bx < CSCConstants::MAX_LCT_TBINS) {
685  secondLCT[bx] = lct;
686  }
687  else {
688  if (infoV > 0) edm::LogWarning("L1CSCTPEmulatorOutOfTimeLCT")
689  << "+++ Bx of second LCT candidate, " << bx
690  << ", is not within the allowed range, [0-" << CSCConstants::MAX_LCT_TBINS-1
691  << "); skipping it... +++\n";
692  }
693  }
694 }
type
Definition: HCALResponse.h:21
unsigned int clct_trig_enable
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:30
CSCCorrelatedLCTDigi secondLCT[CSCConstants::MAX_LCT_TBINS]
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:30
unsigned int match_trig_enable
CSCCorrelatedLCTDigi constructLCTs(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT, int type, int trknmb) const
int getBX() const
return BX
unsigned int alct_trig_enable
CSCCorrelatedLCTDigi firstLCT[CSCConstants::MAX_LCT_TBINS]
void CSCMotherboard::dumpConfigParams ( ) const
protected

Dump TMB/MPC configuration parameters.

Definition at line 923 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().

923  {
924  std::ostringstream strm;
925  strm << "\n";
926  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
927  strm << "+ TMB configuration parameters: +\n";
928  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
929  strm << " mpc_block_me1a [block/not block triggers which come from ME1/A] = "
930  << mpc_block_me1a << "\n";
931  strm << " alct_trig_enable [allow ALCT-only triggers] = "
932  << alct_trig_enable << "\n";
933  strm << " clct_trig_enable [allow CLCT-only triggers] = "
934  << clct_trig_enable << "\n";
935  strm << " match_trig_enable [allow matched ALCT-CLCT triggers] = "
936  << match_trig_enable << "\n";
937  strm << " match_trig_window_size [ALCT-CLCT match window width, in 25 ns] = "
938  << match_trig_window_size << "\n";
939  strm << " tmb_l1a_window_size [L1Accept window width, in 25 ns bins] = "
940  << tmb_l1a_window_size << "\n";
941  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
942  LogDebug("CSCMotherboard") << strm.str();
943 }
#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 
) const
protected

Definition at line 724 of file CSCMotherboard.cc.

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

Referenced by constructLCTs(), CSCGEMMotherboard::constructLCTsGEM(), and testLCT().

725  {
726  const int kPatternBitWidth = 4;
727  unsigned int pattern;
728 
729  if (!isTMB07) {
730  // Cathode pattern number is a kPatternBitWidth-1 bit word.
731  pattern = (abs(ptn) & ((1<<(kPatternBitWidth-1))-1));
732 
733  // The pattern has the MSB (4th bit in the default version) set if it
734  // consists of half-strips.
735  if (stripType) {
736  pattern = pattern | (1<<(kPatternBitWidth-1));
737  }
738  }
739  else {
740  // In the TMB07 firmware, LCT pattern is just a 4-bit CLCT pattern.
741  pattern = (abs(ptn) & ((1<<kPatternBitWidth)-1));
742  }
743 
744  return pattern;
745 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned int CSCMotherboard::findQuality ( const CSCALCTDigi aLCT,
const CSCCLCTDigi cLCT 
) const
protected

Definition at line 750 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 jets_cff::quality.

Referenced by constructLCTs(), and testLCT().

751  {
752  unsigned int quality = 0;
753 
754  if (!isTMB07) {
755  bool isDistrip = (cLCT.getStripType() == 0);
756 
757  if (aLCT.isValid() && !(cLCT.isValid())) { // no CLCT
758  if (aLCT.getAccelerator()) {quality = 1;}
759  else {quality = 3;}
760  }
761  else if (!(aLCT.isValid()) && cLCT.isValid()) { // no ALCT
762  if (isDistrip) {quality = 4;}
763  else {quality = 5;}
764  }
765  else if (aLCT.isValid() && cLCT.isValid()) { // both ALCT and CLCT
766  if (aLCT.getAccelerator()) {quality = 2;} // accelerator muon
767  else { // collision muon
768  // CLCT quality is, in fact, the number of layers hit, so subtract 3
769  // to get quality analogous to ALCT one.
770  int sumQual = aLCT.getQuality() + (cLCT.getQuality()-3);
771  if (sumQual < 1 || sumQual > 6) {
772  if (infoV >= 0) edm::LogWarning("L1CSCTPEmulatorWrongValues")
773  << "+++ findQuality: sumQual = " << sumQual << "+++ \n";
774  }
775  if (isDistrip) { // distrip pattern
776  if (sumQual == 2) {quality = 6;}
777  else if (sumQual == 3) {quality = 7;}
778  else if (sumQual == 4) {quality = 8;}
779  else if (sumQual == 5) {quality = 9;}
780  else if (sumQual == 6) {quality = 10;}
781  }
782  else { // halfstrip pattern
783  if (sumQual == 2) {quality = 11;}
784  else if (sumQual == 3) {quality = 12;}
785  else if (sumQual == 4) {quality = 13;}
786  else if (sumQual == 5) {quality = 14;}
787  else if (sumQual == 6) {quality = 15;}
788  }
789  }
790  }
791  }
792 #ifdef OLD
793  else {
794  // Temporary definition, used until July 2008.
795  // First if statement is fictitious, just to help the CSC TF emulator
796  // handle such cases (one needs to make sure they will be accounted for
797  // in the new quality definition.
798  if (!(aLCT.isValid()) || !(cLCT.isValid())) {
799  if (aLCT.isValid() && !(cLCT.isValid())) quality = 1; // no CLCT
800  else if (!(aLCT.isValid()) && cLCT.isValid()) quality = 2; // no ALCT
801  else quality = 0; // both absent; should never happen.
802  }
803  else {
804  // Sum of ALCT and CLCT quality bits. CLCT quality is, in fact, the
805  // number of layers hit, so subtract 3 to put it to the same footing as
806  // the ALCT quality.
807  int sumQual = aLCT.getQuality() + (cLCT.getQuality()-3);
808  if (sumQual < 1 || sumQual > 6) {
809  if (infoV >= 0) edm::LogWarning("L1CSCTPEmulatorWrongValues")
810  << "+++ findQuality: Unexpected sumQual = " << sumQual << "+++\n";
811  }
812 
813  // LCT quality is basically the sum of ALCT and CLCT qualities, but split
814  // in two groups depending on the CLCT pattern id (higher quality for
815  // straighter patterns).
816  int offset = 0;
817  if (cLCT.getPattern() <= 7) offset = 4;
818  else offset = 9;
819  quality = offset + sumQual;
820  }
821  }
822 #endif
823  else {
824  // 2008 definition.
825  if (!(aLCT.isValid()) || !(cLCT.isValid())) {
826  if (aLCT.isValid() && !(cLCT.isValid())) quality = 1; // no CLCT
827  else if (!(aLCT.isValid()) && cLCT.isValid()) quality = 2; // no ALCT
828  else quality = 0; // both absent; should never happen.
829  }
830  else {
831  int pattern = cLCT.getPattern();
832  if (pattern == 1) quality = 3; // layer-trigger in CLCT
833  else {
834  // CLCT quality is the number of layers hit minus 3.
835  // CLCT quality is the number of layers hit.
836  bool a4 = (aLCT.getQuality() >= 1);
837  bool c4 = (cLCT.getQuality() >= 4);
838  // quality = 4; "reserved for low-quality muons in future"
839  if (!a4 && !c4) quality = 5; // marginal anode and cathode
840  else if ( a4 && !c4) quality = 6; // HQ anode, but marginal cathode
841  else if (!a4 && c4) quality = 7; // HQ cathode, but marginal anode
842  else if ( a4 && c4) {
843  if (aLCT.getAccelerator()) quality = 8; // HQ muon, but accel ALCT
844  else {
845  // quality = 9; "reserved for HQ muons with future patterns
846  // quality = 10; "reserved for HQ muons with future patterns
847  if (pattern == 2 || pattern == 3) quality = 11;
848  else if (pattern == 4 || pattern == 5) quality = 12;
849  else if (pattern == 6 || pattern == 7) quality = 13;
850  else if (pattern == 8 || pattern == 9) quality = 14;
851  else if (pattern == 10) quality = 15;
852  else {
853  if (infoV >= 0) edm::LogWarning("L1CSCTPEmulatorWrongValues")
854  << "+++ findQuality: Unexpected CLCT pattern id = "
855  << pattern << "+++\n";
856  }
857  }
858  }
859  }
860  }
861  }
862  return quality;
863 }
int getQuality() const
return quality of a pattern (number of layers hit!)
Definition: CSCCLCTDigi.h:36
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:30
int getStripType() const
return striptype
Definition: CSCCLCTDigi.h:48
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:30
int getQuality() const
return quality of a pattern
Definition: CSCALCTDigi.h:36
int getAccelerator() const
Definition: CSCALCTDigi.h:43
int getPattern() const
return pattern
Definition: CSCCLCTDigi.h:42
CSCALCTDigi CSCMotherboard::getBXShiftedALCT ( const CSCALCTDigi aLCT) const
protected

Definition at line 946 of file CSCMotherboard.cc.

References CSCALCTDigi::getBX(), CSCConstants::LCT_CENTRAL_BX, CSCALCTDigi::setBX(), and tmb_l1a_window_size.

Referenced by constructLCTs(), and CSCGEMMotherboard::constructLCTsGEM().

947 {
948  CSCALCTDigi aLCT_shifted = aLCT;
949  aLCT_shifted.setBX(aLCT_shifted.getBX() - (CSCConstants::LCT_CENTRAL_BX - tmb_l1a_window_size/2));
950  return aLCT_shifted;
951 }
unsigned int tmb_l1a_window_size
int getBX() const
return BX - five low bits of BXN counter tagged by the ALCT
Definition: CSCALCTDigi.h:63
void setBX(const int BX)
set BX
Definition: CSCALCTDigi.h:66
std::vector< CSCCorrelatedLCTDigi > CSCMotherboard::getLCTs ( ) const

Returns vector of all found correlated LCTs, if any.

Definition at line 620 of file CSCMotherboard.cc.

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

Referenced by readoutLCTs().

620  {
621  std::vector<CSCCorrelatedLCTDigi> tmpV;
622 
623  bool me11 = (theStation == 1 &&
625  theTrigChamber)==1);
626 
627  // Do not report LCTs found in ME1/A if mpc_block_me1/a is set.
628  for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++) {
629  if (firstLCT[bx].isValid())
630  if (!mpc_block_me1a || (!me11 || firstLCT[bx].getStrip() <= 127))
631  tmpV.push_back(firstLCT[bx]);
632  if (secondLCT[bx].isValid())
633  if (!mpc_block_me1a || (!me11 || secondLCT[bx].getStrip() <= 127))
634  tmpV.push_back(secondLCT[bx]);
635  }
636  return tmpV;
637 }
const unsigned theTrigChamber
CSCCorrelatedLCTDigi secondLCT[CSCConstants::MAX_LCT_TBINS]
static int ringFromTriggerLabels(int station, int triggerCSCID)
unsigned int mpc_block_me1a
const unsigned theStation
CSCCorrelatedLCTDigi firstLCT[CSCConstants::MAX_LCT_TBINS]
std::vector< CSCCorrelatedLCTDigi > CSCMotherboard::readoutLCTs ( ) const

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

Definition at line 545 of file CSCMotherboard.cc.

References early_tbins, getLCTs(), infoV, LogDebug, CSCConstants::MAX_LCT_TBINS, readout_earliest_2, and tmb_l1a_window_size.

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

545  {
546  std::vector<CSCCorrelatedLCTDigi> tmpV;
547 
548  // The start time of the L1A*LCT coincidence window should be related
549  // to the fifo_pretrig parameter, but I am not completely sure how.
550  // Just choose it such that the window is centered at bx=7. This may
551  // need further tweaking if the value of tmb_l1a_window_size changes.
552  //static int early_tbins = 4;
553 
554  // Empirical correction to match 2009 collision data (firmware change?)
555  int lct_bins = tmb_l1a_window_size;
556  int late_tbins = early_tbins + lct_bins;
557 
558  int ifois = 0;
559  if (ifois == 0) {
560  if (infoV >= 0 && early_tbins < 0) {
561  edm::LogWarning("L1CSCTPEmulatorSuspiciousParameters")
562  << "+++ early_tbins = " << early_tbins
563  << "; in-time LCTs are not getting read-out!!! +++" << "\n";
564  }
565 
566  if (late_tbins > CSCConstants::MAX_LCT_TBINS-1) {
567  if (infoV >= 0) edm::LogWarning("L1CSCTPEmulatorSuspiciousParameters")
568  << "+++ Allowed range of time bins, [0-" << late_tbins
569  << "] exceeds max allowed, " << CSCConstants::MAX_LCT_TBINS-1 << " +++\n"
570  << "+++ Set late_tbins to max allowed +++\n";
571  late_tbins = CSCConstants::MAX_LCT_TBINS-1;
572  }
573  ifois = 1;
574  }
575 
576  // Start from the vector of all found correlated LCTs and select
577  // those within the LCT*L1A coincidence window.
578  int bx_readout = -1;
579  const std::vector<CSCCorrelatedLCTDigi>& all_lcts = getLCTs();
580  for (auto plct = all_lcts.begin(); plct != all_lcts.end(); plct++) {
581  if (!plct->isValid()) continue;
582 
583  int bx = (*plct).getBX();
584  // Skip LCTs found too early relative to L1Accept.
585  if (bx <= early_tbins) {
586  if (infoV > 1) LogDebug("CSCMotherboard")
587  << " Do not report correlated LCT on key halfstrip "
588  << plct->getStrip() << " and key wire " << plct->getKeyWG()
589  << ": found at bx " << bx << ", whereas the earliest allowed bx is "
590  << early_tbins+1;
591  continue;
592  }
593 
594  // Skip LCTs found too late relative to L1Accept.
595  if (bx > late_tbins) {
596  if (infoV > 1) LogDebug("CSCMotherboard")
597  << " Do not report correlated LCT on key halfstrip "
598  << plct->getStrip() << " and key wire " << plct->getKeyWG()
599  << ": found at bx " << bx << ", whereas the latest allowed bx is "
600  << late_tbins;
601  continue;
602  }
603 
604  // If (readout_earliest_2) take only LCTs in the earliest bx in the read-out window:
605  // in digi->raw step, LCTs have to be packed into the TMB header, and
606  // currently there is room just for two.
607  if (readout_earliest_2) {
608  if (bx_readout == -1 || bx == bx_readout) {
609  tmpV.push_back(*plct);
610  if (bx_readout == -1) bx_readout = bx;
611  }
612  }
613  // if readout_earliest_2 == false, save all LCTs
614  else tmpV.push_back(*plct);
615  }
616  return tmpV;
617 }
#define LogDebug(id)
std::vector< CSCCorrelatedLCTDigi > getLCTs() const
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 293 of file CSCMotherboard.cc.

References alct, CSCCorrelatedLCTDigi::ALCTONLY, clct, CSCCorrelatedLCTDigi::CLCTALCT, CSCCorrelatedLCTDigi::CLCTONLY, clear(), correlateLCTs(), csc_g, isSLHC, match_trig_window_size, CSCConstants::MAX_ALCT_TBINS, and CSCConstants::MAX_CLCT_TBINS.

Referenced by CSCTriggerPrimitivesBuilder::build().

296  {
297  // Debug version. -JM
298  clear();
299 
300  // set geometry
301  alct->setCSCGeometry(csc_g);
302  clct->setCSCGeometry(csc_g);
303 
304  alct->run(w_times); // run anode LCT
305  clct->run(hs_times, ds_times); // run cathodeLCT
306 
307  int bx_alct_matched = 0;
308  for (int bx_clct = 0; bx_clct < CSCConstants::MAX_CLCT_TBINS;
309  bx_clct++) {
310  if (clct->bestCLCT[bx_clct].isValid()) {
311  bool is_matched = false;
312  int bx_alct_start = bx_clct - match_trig_window_size/2;
313  int bx_alct_stop = bx_clct + match_trig_window_size/2;
314  // Empirical correction to match 2009 collision data (firmware change?)
315  if (!isSLHC) bx_alct_stop += match_trig_window_size%2;
316 
317  for (int bx_alct = bx_alct_start; bx_alct <= bx_alct_stop; bx_alct++) {
318  if (bx_alct < 0 || bx_alct >= CSCConstants::MAX_ALCT_TBINS)
319  continue;
320  if (alct->bestALCT[bx_alct].isValid()) {
321  correlateLCTs(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
322  clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
324  is_matched = true;
325  bx_alct_matched = bx_alct;
326  break;
327  }
328  }
329  // No ALCT within the match time interval found: report CLCT-only LCT
330  // (use dummy ALCTs).
331  if (!is_matched) {
332  correlateLCTs(alct->bestALCT[bx_clct], alct->secondALCT[bx_clct],
333  clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
335  }
336  }
337  // No valid CLCTs; attempt to make ALCT-only LCT (use dummy CLCTs).
338  else {
339  int bx_alct = bx_clct - match_trig_window_size/2;
340  if (bx_alct >= 0 && bx_alct > bx_alct_matched) {
341  if (alct->bestALCT[bx_alct].isValid()) {
342  correlateLCTs(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
343  clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
345  }
346  }
347  }
348  }
349 }
unsigned int match_trig_window_size
void correlateLCTs(const CSCALCTDigi &bestALCT, const CSCALCTDigi &secondALCT, const CSCCLCTDigi &bestCLCT, const CSCCLCTDigi &secondCLCT, int type)
const CSCGeometry * csc_g
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 352 of file CSCMotherboard.cc.

References a, alct, CSCCorrelatedLCTDigi::ALCTCLCT, CSCCorrelatedLCTDigi::ALCTONLY, clct, clct_to_alct, CSCCorrelatedLCTDigi::CLCTALCT, CSCCorrelatedLCTDigi::CLCTONLY, clear(), correlateLCTs(), csc_g, drop_used_alcts, drop_used_clcts, firstLCT, infoV, isSLHC, LogDebug, LogTrace, match_trig_window_size, CSCConstants::MAX_ALCT_TBINS, CSCConstants::MAX_CLCT_TBINS, CSCConstants::MAX_LCT_TBINS, and secondLCT.

353  {
354  clear();
355 
356  // set geometry
357  alct->setCSCGeometry(csc_g);
358  clct->setCSCGeometry(csc_g);
359 
360  if (alct && clct) {
361  {
362  const std::vector<CSCALCTDigi>& alctV = alct->run(wiredc); // run anodeLCT
363  }
364  {
365  const std::vector<CSCCLCTDigi>& clctV = clct->run(compdc); // run cathodeLCT
366  }
367 
368  // CLCT-centric matching
369  if (clct_to_alct){
370  int used_alct_mask[20];
371  for (int a=0;a<20;++a) used_alct_mask[a]=0;
372 
373  int bx_alct_matched = 0; // bx of last matched ALCT
374  for (int bx_clct = 0; bx_clct < CSCConstants::MAX_CLCT_TBINS;
375  bx_clct++) {
376  // There should be at least one valid ALCT or CLCT for a
377  // correlated LCT to be formed. Decision on whether to reject
378  // non-complete LCTs (and if yes of which type) is made further
379  // upstream.
380  if (clct->bestCLCT[bx_clct].isValid()) {
381  // Look for ALCTs within the match-time window. The window is
382  // centered at the CLCT bx; therefore, we make an assumption
383  // that anode and cathode hits are perfectly synchronized. This
384  // is always true for MC, but only an approximation when the
385  // data is analyzed (which works fairly good as long as wide
386  // windows are used). To get rid of this assumption, one would
387  // need to access "full BX" words, which are not readily
388  // available.
389  bool is_matched = false;
390  int bx_alct_start = bx_clct - match_trig_window_size/2;
391  int bx_alct_stop = bx_clct + match_trig_window_size/2;
392  // Empirical correction to match 2009 collision data (firmware change?)
393  // (but don't do it for SLHC case, assume it would not be there)
394  if (!isSLHC) bx_alct_stop += match_trig_window_size%2;
395 
396  for (int bx_alct = bx_alct_start; bx_alct <= bx_alct_stop; bx_alct++) {
397  if (bx_alct < 0 || bx_alct >= CSCConstants::MAX_ALCT_TBINS)
398  continue;
399  // default: do not reuse ALCTs that were used with previous CLCTs
400  if (drop_used_alcts && used_alct_mask[bx_alct]) continue;
401  if (alct->bestALCT[bx_alct].isValid()) {
402  if (infoV > 1) LogTrace("CSCMotherboard")
403  << "Successful ALCT-CLCT match: bx_clct = " << bx_clct
404  << "; match window: [" << bx_alct_start << "; " << bx_alct_stop
405  << "]; bx_alct = " << bx_alct;
406  correlateLCTs(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
407  clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
409  used_alct_mask[bx_alct] += 1;
410  is_matched = true;
411  bx_alct_matched = bx_alct;
412  break;
413  }
414  }
415  // No ALCT within the match time interval found: report CLCT-only LCT
416  // (use dummy ALCTs).
417  if (!is_matched) {
418  if (infoV > 1) LogTrace("CSCMotherboard")
419  << "Unsuccessful ALCT-CLCT match (CLCT only): bx_clct = "
420  << bx_clct << "; match window: [" << bx_alct_start
421  << "; " << bx_alct_stop << "]";
422  correlateLCTs(alct->bestALCT[bx_clct], alct->secondALCT[bx_clct],
423  clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
425  }
426  }
427  // No valid CLCTs; attempt to make ALCT-only LCT. Use only ALCTs
428  // which have zeroth chance to be matched at later cathode times.
429  // (I am not entirely sure this perfectly matches the firmware logic.)
430  // Use dummy CLCTs.
431  else {
432  int bx_alct = bx_clct - match_trig_window_size/2;
433  if (bx_alct >= 0 && bx_alct > bx_alct_matched) {
434  if (alct->bestALCT[bx_alct].isValid()) {
435  if (infoV > 1) LogTrace("CSCMotherboard")
436  << "Unsuccessful ALCT-CLCT match (ALCT only): bx_alct = "
437  << bx_alct;
438  correlateLCTs(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
439  clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
441  }
442  }
443  }
444  }
445  }
446  // ALCT-centric matching
447  else {
448  int used_clct_mask[20];
449  for (int a=0;a<20;++a) used_clct_mask[a]=0;
450 
451  int bx_clct_matched = 0; // bx of last matched CLCT
452  for (int bx_alct = 0; bx_alct < CSCConstants::MAX_ALCT_TBINS;
453  bx_alct++) {
454  // There should be at least one valid CLCT or ALCT for a
455  // correlated LCT to be formed. Decision on whether to reject
456  // non-complete LCTs (and if yes of which type) is made further
457  // upstream.
458  if (alct->bestALCT[bx_alct].isValid()) {
459  // Look for CLCTs within the match-time window. The window is
460  // centered at the ALCT bx; therefore, we make an assumption
461  // that anode and cathode hits are perfectly synchronized. This
462  // is always true for MC, but only an approximation when the
463  // data is analyzed (which works fairly good as long as wide
464  // windows are used). To get rid of this assumption, one would
465  // need to access "full BX" words, which are not readily
466  // available.
467  bool is_matched = false;
468  int bx_clct_start = bx_alct - match_trig_window_size/2;
469  int bx_clct_stop = bx_alct + match_trig_window_size/2;
470  // Empirical correction to match 2009 collision data (firmware change?)
471  // (but don't do it for SLHC case, assume it would not be there)
472  if (!isSLHC) bx_clct_stop += match_trig_window_size%2;
473 
474  for (int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
475  if (bx_clct < 0 || bx_clct >= CSCConstants::MAX_CLCT_TBINS)
476  continue;
477  // default: do not reuse CLCTs that were used with previous ALCTs
478  if (drop_used_clcts && used_clct_mask[bx_clct]) continue;
479  if (clct->bestCLCT[bx_clct].isValid()) {
480  if (infoV > 1) LogTrace("CSCMotherboard")
481  << "Successful CLCT-ALCT match: bx_alct = " << bx_alct
482  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop
483  << "]; bx_clct = " << bx_clct;
484  correlateLCTs(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
485  clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
487  used_clct_mask[bx_clct] += 1;
488  is_matched = true;
489  bx_clct_matched = bx_clct;
490  break;
491  }
492  }
493  // No CLCT within the match time interval found: report ALCT-only LCT
494  // (use dummy CLCTs).
495  if (!is_matched) {
496  if (infoV > 1) LogTrace("CSCMotherboard")
497  << "Unsuccessful CLCT-ALCT match (ALCT only): bx_alct = "
498  << bx_alct << "; match window: [" << bx_clct_start
499  << "; " << bx_clct_stop << "]";
500  correlateLCTs(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
501  clct->bestCLCT[bx_alct], clct->secondCLCT[bx_alct],
503  }
504  }
505  // No valid ALCTs; attempt to make CLCT-only LCT. Use only CLCTs
506  // which have zeroth chance to be matched at later cathode times.
507  // (I am not entirely sure this perfectly matches the firmware logic.)
508  // Use dummy ALCTs.
509  else {
510  int bx_clct = bx_alct - match_trig_window_size/2;
511  if (bx_clct >= 0 && bx_clct > bx_clct_matched) {
512  if (clct->bestCLCT[bx_clct].isValid()) {
513  if (infoV > 1) LogTrace("CSCMotherboard")
514  << "Unsuccessful CLCT-ALCT match (CLCT only): bx_clct = "
515  << bx_clct;
516  correlateLCTs(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
517  clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
519  }
520  }
521  }
522  }
523  }
524 
525  // Debug first and second LCTs
526  if (infoV > 0) {
527  for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++) {
528  if (firstLCT[bx].isValid())
529  LogDebug("CSCMotherboard") << firstLCT[bx];
530  if (secondLCT[bx].isValid())
531  LogDebug("CSCMotherboard") << secondLCT[bx];
532  }
533  }
534  }
535  // No valid ALCT and/or CLCT processor
536  else {
537  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorSetupError")
538  << "+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
539  }
540 }
#define LogDebug(id)
unsigned int match_trig_window_size
void correlateLCTs(const CSCALCTDigi &bestALCT, const CSCALCTDigi &secondALCT, const CSCCLCTDigi &bestCLCT, const CSCCLCTDigi &secondCLCT, int type)
CSCCorrelatedLCTDigi secondLCT[CSCConstants::MAX_LCT_TBINS]
const CSCGeometry * csc_g
#define LogTrace(id)
std::unique_ptr< CSCAnodeLCTProcessor > alct
double a
Definition: hdecay.h:121
std::unique_ptr< CSCCathodeLCTProcessor > clct
CSCCorrelatedLCTDigi firstLCT[CSCConstants::MAX_LCT_TBINS]
void CSCMotherboard::setConfigParameters ( const CSCDBL1TPParameters conf)

Set configuration parameters obtained via EventSetup mechanism.

Definition at line 208 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().

208  {
209  static std::atomic<bool> config_dumped{false};
210 
211  // Config. parameters for the TMB itself.
218 
219  // Config. paramteres for ALCT and CLCT processors.
220  alct->setConfigParameters(conf);
221  clct->setConfigParameters(conf);
222 
223  // Check and print configuration parameters.
225  if (!config_dumped) {
227  config_dumped = true;
228  }
229 }
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
void CSCMotherboard::setCSCGeometry ( const CSCGeometry g)
inline

Definition at line 79 of file CSCMotherboard.h.

References csc_g, and g.

Referenced by CSCTriggerPrimitivesBuilder::build().

79 { csc_g = g; }
const CSCGeometry * csc_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 CSCMotherboard::testLCT ( )
protected

Definition at line 865 of file CSCMotherboard.cc.

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

865  {
866  unsigned int lctPattern, lctQuality;
867  for (int pattern = 0; pattern < 8; pattern++) {
868  for (int bend = 0; bend < 2; bend++) {
869  for (int cfeb = 0; cfeb < 5; cfeb++) {
870  for (int strip = 0; strip < 32; strip++) {
871  for (int bx = 0; bx < 7; bx++) {
872  for (int stripType = 0; stripType < 2; stripType++) {
873  for (int quality = 3; quality < 7; quality++) {
874  CSCCLCTDigi cLCT(1, quality, pattern, stripType, bend,
875  strip, cfeb, bx);
876  lctPattern = encodePattern(cLCT.getPattern(),
877  cLCT.getStripType());
878  for (int aQuality = 0; aQuality < 4; aQuality++) {
879  for (int wireGroup = 0; wireGroup < 120; wireGroup++) {
880  for (int abx = 0; abx < 7; abx++) {
881  CSCALCTDigi aLCT(1, aQuality, 0, 1, wireGroup, abx);
882  lctQuality = findQuality(aLCT, cLCT);
884  thisLCT(0, 1, lctQuality, aLCT.getKeyWG(),
885  cLCT.getKeyStrip(), lctPattern, cLCT.getBend(),
886  aLCT.getBX());
887  if (lctPattern != static_cast<unsigned int>(thisLCT.getPattern()) )
888  LogTrace("CSCMotherboard")
889  << "pattern mismatch: " << lctPattern
890  << " " << thisLCT.getPattern();
891  if (bend != thisLCT.getBend())
892  LogTrace("CSCMotherboard")
893  << "bend mismatch: " << bend
894  << " " << thisLCT.getBend();
895  int key_strip = 32*cfeb + strip;
896  if (key_strip != thisLCT.getStrip())
897  LogTrace("CSCMotherboard")
898  << "strip mismatch: " << key_strip
899  << " " << thisLCT.getStrip();
900  if (wireGroup != thisLCT.getKeyWG())
901  LogTrace("CSCMotherboard")
902  << "wire group mismatch: " << wireGroup
903  << " " << thisLCT.getKeyWG();
904  if (abx != thisLCT.getBX())
905  LogTrace("CSCMotherboard")
906  << "bx mismatch: " << abx << " " << thisLCT.getBX();
907  if (lctQuality != static_cast<unsigned int>(thisLCT.getQuality()))
908  LogTrace("CSCMotherboard")
909  << "quality mismatch: " << lctQuality
910  << " " << thisLCT.getQuality();
911  }
912  }
913  }
914  }
915  }
916  }
917  }
918  }
919  }
920  }
921 }
#define LogTrace(id)
unsigned int findQuality(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT) const
unsigned int encodePattern(const int ptn, const int highPt) const

Member Data Documentation

std::unique_ptr<CSCAnodeLCTProcessor> CSCMotherboard::alct
unsigned int CSCMotherboard::alct_trig_enable
protected
std::unique_ptr<CSCCathodeLCTProcessor> CSCMotherboard::clct
bool CSCMotherboard::clct_to_alct
protected

if true: use regular CLCT-to-ALCT matching in TMB if false: do ALCT-to-CLCT matching

Definition at line 135 of file CSCMotherboard.h.

Referenced by CSCMotherboard(), and run().

unsigned int CSCMotherboard::clct_trig_enable
protected
const CSCGeometry* CSCMotherboard::csc_g
protected

Definition at line 105 of file CSCMotherboard.h.

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

const unsigned int CSCMotherboard::def_alct_trig_enable = 0
staticprotected

Definition at line 139 of file CSCMotherboard.h.

Referenced by checkConfigParameters(), and CSCMotherboard().

const unsigned int CSCMotherboard::def_clct_trig_enable = 0
staticprotected

Definition at line 139 of file CSCMotherboard.h.

Referenced by checkConfigParameters(), and CSCMotherboard().

const unsigned int CSCMotherboard::def_match_trig_enable = 1
staticprotected

Definition at line 140 of file CSCMotherboard.h.

Referenced by checkConfigParameters(), and CSCMotherboard().

const unsigned int CSCMotherboard::def_match_trig_window_size = 7
staticprotected

Definition at line 140 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 138 of file CSCMotherboard.h.

Referenced by checkConfigParameters(), and CSCMotherboard().

const unsigned int CSCMotherboard::def_tmb_l1a_window_size = 7
staticprotected

Definition at line 141 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 122 of file CSCMotherboard.h.

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

bool CSCMotherboard::drop_used_clcts
protected

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

Definition at line 125 of file CSCMotherboard.h.

Referenced by CSCMotherboard(), and run().

int CSCMotherboard::early_tbins
protected

SLHC: separate handle for early time bins

Definition at line 128 of file CSCMotherboard.h.

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

CSCCorrelatedLCTDigi CSCMotherboard::firstLCT[CSCConstants::MAX_LCT_TBINS]
protected

Container for first correlated LCT.

Definition at line 144 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 108 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 111 of file CSCMotherboard.h.

Referenced by CSCMotherboard(), encodePattern(), and findQuality().

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 131 of file CSCMotherboard.h.

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

CSCCorrelatedLCTDigi CSCMotherboard::secondLCT[CSCConstants::MAX_LCT_TBINS]
protected

Container for second correlated LCT.

Definition at line 147 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 103 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