CMS 3D CMS Logo

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

#include <CSCGEMMotherboardME21.h>

Inheritance diagram for CSCGEMMotherboardME21:
CSCGEMMotherboard CSCUpgradeMotherboard CSCMotherboard

Public Member Functions

void clear ()
 
 CSCGEMMotherboardME21 (unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf)
 
 CSCGEMMotherboardME21 ()
 
std::vector< CSCCorrelatedLCTDigireadoutLCTs () const
 
void run (const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const GEMPadDigiCollection *gemPads) override
 
 ~CSCGEMMotherboardME21 () override
 
- Public Member Functions inherited from CSCGEMMotherboard
template<class S >
S bestMatchingPad (const CSCALCTDigi &alct1, const matches< S > &pads, enum CSCPart) const
 
template<class S >
S bestMatchingPad (const CSCCLCTDigi &clct, const matches< S > &pads, enum CSCPart part) const
 
template<class S >
S bestMatchingPad (const CSCALCTDigi &alct1, const CSCCLCTDigi &clct1, const matches< S > &pads, enum CSCPart part) const
 
void clear ()
 
 CSCGEMMotherboard (unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf)
 
 CSCGEMMotherboard ()
 
void run (const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const GEMPadDigiClusterCollection *gemPads)
 
void setGEMGeometry (const GEMGeometry *g)
 set CSC and GEM geometries for the matching needs More...
 
 ~CSCGEMMotherboard () override
 
- Public Member Functions inherited from CSCUpgradeMotherboard
template<class S >
bool compare (const S &p, const S &q) const
 
 CSCUpgradeMotherboard (unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf)
 
 CSCUpgradeMotherboard ()
 
void debugLUTs ()
 
template<class S >
void intersection (const S &d1, const S &d2, S &result) const
 
void setCSCGeometry (const CSCGeometry *g)
 
void setupGeometry ()
 
void sortLCTs (std::vector< CSCCorrelatedLCTDigi > &lcts, bool(*sorter)(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)) const
 
 ~CSCUpgradeMotherboard () override
 
- Public Member Functions inherited from CSCMotherboard
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)
 
void setCSCGeometry (const CSCGeometry *g)
 
virtual ~CSCMotherboard ()=default
 

Private Member Functions

void correlateLCTsGEM (CSCALCTDigi &bestALCT, CSCALCTDigi &secondALCT, CSCCLCTDigi &bestCLCT, CSCCLCTDigi &secondCLCT, const GEMPadDigiIds &pads, const GEMCoPadDigiIds &copads, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2, enum CSCPart p) const
 
const CSCGEMMotherboardLUTME21getLUT () const override
 

Private Attributes

LCTContainer allLCTs
 
bool buildLCTfromALCTandGEM_
 
bool buildLCTfromCLCTandGEM_
 
std::vector< CSCCLCTDigiclctV
 
bool dropLowQualityALCTsNoGEMs_
 
bool dropLowQualityCLCTsNoGEMs_
 
std::unique_ptr< CSCGEMMotherboardLUTME21tmbLUT_
 

Additional Inherited Members

- Public Types inherited from CSCGEMMotherboard
enum  Default_values { DEFAULT_MATCHING_VALUE = -99 }
 
- Static Public Member Functions inherited from CSCUpgradeMotherboard
static bool sortLCTsByGEMDphi (const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
 
static bool sortLCTsByQuality (const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
 
- Public Attributes inherited from CSCGEMMotherboard
std::unique_ptr< GEMCoPadProcessorcoPadProcessor
 
- Public Attributes inherited from CSCMotherboard
std::unique_ptr< CSCAnodeLCTProcessoralct
 
std::unique_ptr< CSCCathodeLCTProcessorclct
 
- Protected Types inherited from CSCMotherboard
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 inherited from CSCGEMMotherboard
template<class T >
T bestMatchingPad (const CSCALCTDigi &, const matches< T > &, enum CSCPart) const
 
template<class T >
T bestMatchingPad (const CSCCLCTDigi &, const matches< T > &, enum CSCPart) const
 
template<class T >
T bestMatchingPad (const CSCALCTDigi &, const CSCCLCTDigi &, const matches< T > &, enum CSCPart) const
 
CSCCorrelatedLCTDigi constructLCTsGEM (const CSCALCTDigi &alct, const GEMCoPadDigi &gem, enum CSCPart, int i) const
 
CSCCorrelatedLCTDigi constructLCTsGEM (const CSCCLCTDigi &clct, const GEMCoPadDigi &gem, enum CSCPart, int i) const
 
CSCCorrelatedLCTDigi constructLCTsGEM (const CSCALCTDigi &alct, const CSCCLCTDigi &clct, const GEMCoPadDigi &gem, enum CSCPart p, int i) const
 
CSCCorrelatedLCTDigi constructLCTsGEM (const CSCALCTDigi &alct, const CSCCLCTDigi &clct, const GEMPadDigi &gem, enum CSCPart p, int i) const
 
CSCCorrelatedLCTDigi constructLCTsGEM (const CSCALCTDigi &alct, const CSCCLCTDigi &clct, const GEMPadDigi &gem1, const GEMCoPadDigi &gem2, enum CSCPart p, int i) const
 
template<class T >
void correlateLCTsGEM (T &best, T &second, const GEMCoPadDigiIds &coPads, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2, enum CSCPart) const
 
template<class T >
void correlateLCTsGEM (const T &best, const T &second, const GEMCoPadDigi &, const GEMCoPadDigi &, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2, enum CSCPart) const
 
unsigned int findQualityGEM (const CSCALCTDigi &, const CSCCLCTDigi &, int gemlayer) const
 
int getBX (const GEMPadDigi &p) const
 
int getBX (const GEMCoPadDigi &p) const
 
float getPad (const GEMPadDigi &) const
 
float getPad (const GEMCoPadDigi &) const
 
float getPad (const CSCCLCTDigi &, enum CSCPart part) const
 
int getRoll (const GEMPadDigiId &p) const
 
int getRoll (const GEMCoPadDigiId &p) const
 
int getRoll (const CSCALCTDigi &) const
 
bool isGEMDetId (unsigned int) const
 
bool isPadInOverlap (int roll) const
 
template<class T >
void matchingPads (const CSCALCTDigi &alct, enum CSCPart part, matches< T > &) const
 
template<class T >
void matchingPads (const CSCCLCTDigi &alct, enum CSCPart part, matches< T > &) const
 
template<class S , class T >
void matchingPads (const S &d1, const S &d2, enum CSCPart part, matches< T > &) const
 
template<class T >
void matchingPads (const CSCCLCTDigi &clct1, const CSCALCTDigi &alct1, enum CSCPart part, matches< T > &) const
 
template<class T >
void matchingPads (const CSCCLCTDigi &clct1, const CSCCLCTDigi &clct2, const CSCALCTDigi &alct1, const CSCALCTDigi &alct2, enum CSCPart part, matches< T > &) const
 
void printGEMTriggerCoPads (int bx_start, int bx_stop, enum CSCPart)
 
void printGEMTriggerPads (int bx_start, int bx_stop, enum CSCPart)
 
void retrieveGEMCoPads ()
 
void retrieveGEMPads (const GEMPadDigiCollection *pads, unsigned id)
 
void setupGeometry ()
 
- Protected Member Functions inherited from CSCMotherboard
void checkConfigParameters ()
 
CSCCorrelatedLCTDigi constructLCTs (const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT, int type) const
 
void correlateLCTs (CSCALCTDigi &bestALCT, CSCALCTDigi &secondALCT, CSCCLCTDigi &bestCLCT, CSCCLCTDigi &secondCLCT)
 
void dumpConfigParams () const
 
unsigned int encodePattern (const int ptn, const int highPt) const
 
unsigned int findQuality (const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT) const
 
void testLCT ()
 
- Protected Attributes inherited from CSCGEMMotherboard
GEMCoPadDigiIdsBX coPads_
 
bool doLCTGhostBustingWithGEMs_
 
const GEMGeometrygem_g
 
std::vector< GEMCoPadDigigemCoPadV
 
bool gemGeometryAvailable
 
unsigned gemId
 
int maxDeltaBXCoPad_
 
int maxDeltaBXPad_
 
int maxDeltaPadL1_
 
int maxDeltaPadL2_
 
GEMPadDigiIdsBX pads_
 
bool promoteALCTGEMpattern_
 
bool promoteALCTGEMquality_
 
bool promoteCLCTGEMquality_
 
bool useOldLCTDataFormat_
 
- Protected Attributes inherited from CSCUpgradeMotherboard
std::vector< CSCALCTDigialctV
 
bool clct_to_alct
 
edm::ParameterSet commonParams_
 
const CSCGeometrycsc_g
 
const CSCChambercscChamber
 
bool debug_luts
 
bool debug_matching
 
bool drop_used_clcts
 
std::unique_ptr< CSCUpgradeMotherboardLUTGeneratorgenerator_
 
bool match_earliest_alct_only
 
bool match_earliest_clct_only
 
unsigned int max_lcts
 
Parity par
 
int pref [CSCConstants::MAX_LCT_TBINS]
 
unsigned theChamber
 
unsigned theRegion
 
unsigned int tmb_cross_bx_algo
 
edm::ParameterSet tmbParams_
 
- Protected Attributes inherited from CSCMotherboard
unsigned int alct_trig_enable
 
unsigned int clct_trig_enable
 
const CSCGeometrycsc_g
 
bool drop_used_alcts
 
int early_tbins
 
CSCCorrelatedLCTDigi firstLCT [CSCConstants::MAX_LCT_TBINS]
 
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 [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 inherited from CSCMotherboard
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

Extended CSCMotherboard for ME21 TMB upgrade

Author
Sven Dildick March 2014

Based on CSCMotherboard code

Definition at line 16 of file CSCGEMMotherboardME21.h.

Constructor & Destructor Documentation

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

Normal constructor.

Definition at line 6 of file CSCGEMMotherboardME21.cc.

References tmbLUT_.

10  : CSCGEMMotherboard(endcap, station, sector, subsector, chamber, conf)
12  , dropLowQualityCLCTsNoGEMs_(tmbParams_.getParameter<bool>("dropLowQualityCLCTsNoGEMs"))
13  , dropLowQualityALCTsNoGEMs_(tmbParams_.getParameter<bool>("dropLowQualityALCTsNoGEMs"))
14  , buildLCTfromALCTandGEM_(tmbParams_.getParameter<bool>("buildLCTfromALCTandGEM"))
15  , buildLCTfromCLCTandGEM_(tmbParams_.getParameter<bool>("buildLCTfromCLCTandGEM"))
16 {
17  // set LUTs
18  tmbLUT_.reset(new CSCGEMMotherboardLUTME21());
19 }
T getParameter(std::string const &) const
unsigned int match_trig_window_size
std::unique_ptr< CSCGEMMotherboardLUTME21 > tmbLUT_
edm::ParameterSet tmbParams_
CSCGEMMotherboardME21::CSCGEMMotherboardME21 ( )

Test destructor.

Definition at line 22 of file CSCGEMMotherboardME21.cc.

CSCGEMMotherboardME21::~CSCGEMMotherboardME21 ( )
override

Default destructor.

Definition at line 29 of file CSCGEMMotherboardME21.cc.

30 {
31 }

Member Function Documentation

void CSCGEMMotherboardME21::clear ( void  )

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

Definition at line 34 of file CSCGEMMotherboardME21.cc.

References allLCTs, CSCGEMMotherboard::clear(), CSCMotherboard::clear(), mps_fire::i, CSCMotherboard::match_trig_window_size, CSCConstants::MAX_LCT_TBINS, and CSCConstants::MAX_LCTS_PER_CSC.

Referenced by run().

35 {
38 
39  for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++) {
40  for (unsigned int mbx = 0; mbx < match_trig_window_size; mbx++) {
41  for (int i=0;i<CSCConstants::MAX_LCTS_PER_CSC;i++) {
42  allLCTs(bx,mbx,i).clear();
43  }
44  }
45  }
46 }
unsigned int match_trig_window_size
void CSCGEMMotherboardME21::correlateLCTsGEM ( CSCALCTDigi bestALCT,
CSCALCTDigi secondALCT,
CSCCLCTDigi bestCLCT,
CSCCLCTDigi secondCLCT,
const GEMPadDigiIds pads,
const GEMCoPadDigiIds copads,
CSCCorrelatedLCTDigi lct1,
CSCCorrelatedLCTDigi lct2,
enum CSCPart  p 
) const
private

Definition at line 369 of file CSCGEMMotherboardME21.cc.

References CSCCorrelatedLCTDigi::ALCTCLCT, CSCALCTDigi::clear(), CSCCLCTDigi::clear(), CSCMotherboard::constructLCTs(), CSCGEMMotherboard::constructLCTsGEM(), GEMPadDigi::isValid(), GEMCoPadDigi::isValid(), CSCCorrelatedLCTDigi::isValid(), or, AlCaHLTBitMon_ParallelJobs::p, and CSCCorrelatedLCTDigi::setTrknmb().

Referenced by run().

373 {
374  // assume that always anodeBestValid and cathodeBestValid
375  if (secondALCT == bestALCT) secondALCT.clear();
376  if (secondCLCT == bestCLCT) secondCLCT.clear();
377 
378  if (!copads.empty() or !pads.empty()){
379 
380  // check matching copads
381  const GEMCoPadDigi& bb_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, bestCLCT, copads, p);
382  const GEMCoPadDigi& bs_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, secondCLCT, copads, p);
383  const GEMCoPadDigi& sb_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, bestCLCT, copads, p);
384  const GEMCoPadDigi& ss_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, secondCLCT, copads, p);
385 
386  // check matching pads
387  const GEMPadDigi& bb_pad = bestMatchingPad<GEMPadDigi>(bestALCT, bestCLCT, pads, p);
388  const GEMPadDigi& bs_pad = bestMatchingPad<GEMPadDigi>(bestALCT, secondCLCT, pads, p);
389  const GEMPadDigi& sb_pad = bestMatchingPad<GEMPadDigi>(secondALCT, bestCLCT, pads, p);
390  const GEMPadDigi& ss_pad = bestMatchingPad<GEMPadDigi>(secondALCT, secondCLCT, pads, p);
391 
392  // evaluate possible combinations
393  const bool ok_bb_copad = bestALCT.isValid() and bestCLCT.isValid() and bb_copad.isValid();
394  const bool ok_bs_copad = bestALCT.isValid() and secondCLCT.isValid() and bs_copad.isValid();
395  const bool ok_sb_copad = secondALCT.isValid() and bestCLCT.isValid() and sb_copad.isValid();
396  const bool ok_ss_copad = secondALCT.isValid() and secondCLCT.isValid() and ss_copad.isValid();
397 
398  const bool ok_bb_pad = (not ok_bb_copad) and bestALCT.isValid() and bestCLCT.isValid() and bb_pad.isValid();
399  const bool ok_bs_pad = (not ok_bs_copad) and bestALCT.isValid() and secondCLCT.isValid() and bs_pad.isValid();
400  const bool ok_sb_pad = (not ok_sb_copad) and secondALCT.isValid() and bestCLCT.isValid() and sb_pad.isValid();
401  const bool ok_ss_pad = (not ok_ss_copad) and secondALCT.isValid() and secondCLCT.isValid() and ss_pad.isValid();
402 
403  // possible cases with copad
404  if (ok_bb_copad or ok_ss_copad){
405  if (ok_bb_copad) lct1 = constructLCTsGEM(bestALCT, bestCLCT, bb_copad, p, 1);
406  if (ok_ss_copad) lct2 = constructLCTsGEM(secondALCT, secondCLCT, ss_copad, p, 2);
407  }
408  else if(ok_bs_copad or ok_sb_copad){
409  if (ok_bs_copad) lct1 = constructLCTsGEM(bestALCT, secondCLCT, bs_copad, p, 1);
410  if (ok_sb_copad) lct2 = constructLCTsGEM(secondALCT, bestCLCT, sb_copad, p, 2);
411  }
412 
413  // done processing?
414  if (lct1.isValid() and lct2.isValid()) return;
415 
416  // possible cases with pad
417  if ((ok_bb_pad or ok_ss_pad) and not (ok_bs_copad or ok_sb_copad)){
418  if (ok_bb_pad) lct1 = constructLCTsGEM(bestALCT, bestCLCT, bb_pad, p, 1);
419  if (ok_ss_pad) lct2 = constructLCTsGEM(secondALCT, secondCLCT, ss_pad, p, 2);
420  }
421  else if((ok_bs_pad or ok_sb_pad) and not (ok_bb_copad or ok_ss_copad)){
422  if (ok_bs_pad) lct1 = constructLCTsGEM(bestALCT, secondCLCT, bs_pad, p, 1);
423  if (ok_sb_pad) lct2 = constructLCTsGEM(secondALCT, bestCLCT, sb_pad, p, 2);
424  }
425  } else {
426  // run without gems - happens in less than 0.04% of the time
427  lct1 = constructLCTs(bestALCT, bestCLCT, CSCCorrelatedLCTDigi::ALCTCLCT);
428  lct1.setTrknmb(1);
429 
430  lct2 = constructLCTs(secondALCT, secondCLCT, CSCCorrelatedLCTDigi::ALCTCLCT);
431  lct2.setTrknmb(2);
432  }
433 }
bool isValid() const
Definition: GEMPadDigi.cc:48
CSCCorrelatedLCTDigi constructLCTsGEM(const CSCALCTDigi &alct, const GEMCoPadDigi &gem, enum CSCPart, int i) const
void clear()
clear this ALCT
Definition: CSCALCTDigi.cc:35
bool isValid() const
Definition: GEMCoPadDigi.cc:32
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
bool isValid() const
return valid pattern bit
void clear()
clear this CLCT
Definition: CSCCLCTDigi.cc:58
CSCCorrelatedLCTDigi constructLCTs(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT, int type) const
void setTrknmb(const uint16_t number)
Set track number (1,2) after sorting LCTs.
const CSCGEMMotherboardLUTME21* CSCGEMMotherboardME21::getLUT ( ) const
inlineoverrideprivatevirtual

Implements CSCGEMMotherboard.

Definition at line 47 of file CSCGEMMotherboardME21.h.

References tmbLUT_.

47 {return tmbLUT_.get();}
std::unique_ptr< CSCGEMMotherboardLUTME21 > tmbLUT_
std::vector< CSCCorrelatedLCTDigi > CSCGEMMotherboardME21::readoutLCTs ( ) const

Definition at line 359 of file CSCGEMMotherboardME21.cc.

References allLCTs, CSCUpgradeMotherboard::LCTContainer::getMatched(), mps_fire::result, CSCUpgradeMotherboard::sortLCTs(), CSCUpgradeMotherboard::sortLCTsByGEMDphi(), CSCUpgradeMotherboard::sortLCTsByQuality(), and CSCUpgradeMotherboard::tmb_cross_bx_algo.

Referenced by CSCTriggerPrimitivesBuilder::build(), and run().

360 {
361  std::vector<CSCCorrelatedLCTDigi> result;
362  allLCTs.getMatched(result);
365  return result;
366 }
static bool sortLCTsByQuality(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
void sortLCTs(std::vector< CSCCorrelatedLCTDigi > &lcts, bool(*sorter)(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)) const
static bool sortLCTsByGEMDphi(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
void getMatched(std::vector< CSCCorrelatedLCTDigi > &) const
void CSCGEMMotherboardME21::run ( const CSCWireDigiCollection wiredc,
const CSCComparatorDigiCollection compdc,
const GEMPadDigiCollection gemPads 
)
overridevirtual

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

Implements CSCGEMMotherboard.

Definition at line 49 of file CSCGEMMotherboardME21.cc.

References funct::abs(), CSCMotherboard::alct, CSCUpgradeMotherboard::alctV, allLCTs, buildLCTfromALCTandGEM_, buildLCTfromCLCTandGEM_, EnergyCorrector::c, CSCMotherboard::clct, clctV, clear(), CSCGEMMotherboard::coPadProcessor, CSCGEMMotherboard::coPads_, correlateLCTsGEM(), CSCGEMMotherboard::correlateLCTsGEM(), CSCUpgradeMotherboard::csc_g, CSCUpgradeMotherboard::cscChamber, CSCUpgradeMotherboard::debug_matching, CSCUpgradeMotherboard::debugLUTs(), CSCUpgradeMotherboard::drop_used_clcts, dropLowQualityCLCTsNoGEMs_, plotBeamSpotDB::first, CSCGEMMotherboard::gem_g, CSCGEMMotherboard::gemCoPadV, CSCGEMMotherboard::gemGeometryAvailable, CSCGEMMotherboard::gemId, mps_fire::i, CSCChamber::id(), CSCMotherboard::infoV, CSCMotherboard::lct_central_bx, LogDebug, LogTrace, CSCUpgradeMotherboard::match_earliest_clct_only, CSCMotherboard::match_trig_window_size, CSCConstants::MAX_ALCT_TBINS, CSCConstants::MAX_CLCT_TBINS, CSCConstants::MAX_LCT_TBINS, CSCConstants::MAX_LCTS_PER_CSC, CSCGEMMotherboard::maxDeltaBXCoPad_, ME21, gen::n, or, AlCaHLTBitMon_ParallelJobs::p, CSCGEMMotherboard::pads_, CSCUpgradeMotherboard::pref, CSCGEMMotherboard::printGEMTriggerCoPads(), CSCGEMMotherboard::printGEMTriggerPads(), jets_cff::quality, readoutLCTs(), CSCGEMMotherboard::retrieveGEMCoPads(), CSCGEMMotherboard::retrieveGEMPads(), CSCGEMMotherboard::setupGeometry(), and CSCUpgradeMotherboard::tmb_cross_bx_algo.

Referenced by CSCTriggerPrimitivesBuilder::build().

52 {
53  clear();
54  setupGeometry();
55  debugLUTs();
56 
57  if (gem_g != nullptr) {
58  if (infoV >= 0) edm::LogInfo("L1CSCTPEmulatorSetupInfo")
59  << "+++ run() called for GEM-CSC integrated trigger! +++ \n";
60  gemGeometryAvailable = true;
61  }
62 
63  // check for GEM geometry
64  if (not gemGeometryAvailable){
65  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorSetupError")
66  << "+++ run() called for GEM-CSC integrated trigger without valid GEM geometry! +++ \n";
67  return;
68  }
69  gemCoPadV = coPadProcessor->run(gemPads); // run copad processor in GE1/1
70 
71  if (!( alct and clct))
72  {
73  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorSetupError")
74  << "+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
75  return;
76  }
77 
78  alct->setCSCGeometry(csc_g);
79  clct->setCSCGeometry(csc_g);
80 
81  alctV = alct->run(wiredc); // run anodeLCT
82  clctV = clct->run(compdc); // run cathodeLCT
83 
84  // if there are no ALCTs and no CLCTs, it does not make sense to run this TMB
85  if (alctV.empty() and clctV.empty()) return;
86 
87  int used_clct_mask[20];
88  for (int c=0;c<20;++c) used_clct_mask[c]=0;
89 
90  // retrieve pads and copads in a certain BX window for this CSC
91 
92  retrieveGEMPads(gemPads, gemId);
94 
95  const bool hasPads(!pads_.empty());
96  const bool hasCoPads(!coPads_.empty());
97 
98  // ALCT centric matching
99  for (int bx_alct = 0; bx_alct < CSCConstants::MAX_ALCT_TBINS; bx_alct++)
100  {
101  if (alct->bestALCT[bx_alct].isValid())
102  {
103  const int bx_clct_start(bx_alct - match_trig_window_size/2);
104  const int bx_clct_stop(bx_alct + match_trig_window_size/2);
105  const int bx_copad_start(bx_alct - maxDeltaBXCoPad_);
106  const int bx_copad_stop(bx_alct + maxDeltaBXCoPad_);
107 
108  if (debug_matching){
109  LogTrace("CSCGEMCMotherboardME21") << "========================================================================" << std::endl;
110  LogTrace("CSCGEMCMotherboardME21") << "ALCT-CLCT matching in ME2/1 chamber: " << cscChamber->id() << std::endl;
111  LogTrace("CSCGEMCMotherboardME21") << "------------------------------------------------------------------------" << std::endl;
112  LogTrace("CSCGEMCMotherboardME21") << "+++ Best ALCT Details: ";
113  alct->bestALCT[bx_alct].print();
114  LogTrace("CSCGEMCMotherboardME21") << "+++ Second ALCT Details: ";
115  alct->secondALCT[bx_alct].print();
116 
117  printGEMTriggerPads(bx_clct_start, bx_clct_stop, CSCPart::ME21);
118  printGEMTriggerCoPads(bx_clct_start, bx_clct_stop, CSCPart::ME21);
119 
120  LogTrace("CSCGEMCMotherboardME21") << "------------------------------------------------------------------------" << std::endl;
121  LogTrace("CSCGEMCMotherboardME21") << "Attempt ALCT-CLCT matching in ME2/1 in bx range: [" << bx_clct_start << "," << bx_clct_stop << "]" << std::endl;
122  }
123 
124  // ALCT-to-CLCT
125  int nSuccessFulMatches = 0;
126  for (int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++)
127  {
128  if (bx_clct < 0 or bx_clct >= CSCConstants::MAX_CLCT_TBINS) continue;
129  if (drop_used_clcts and used_clct_mask[bx_clct]) continue;
130  if (clct->bestCLCT[bx_clct].isValid())
131  {
132  // clct quality
133  const int quality(clct->bestCLCT[bx_clct].getQuality());
134  // low quality ALCT
135  const bool lowQualityALCT(alct->bestALCT[bx_alct].getQuality() == 0);
136  // low quality ALCT or CLCT
137  const bool lowQuality(quality<4 or lowQualityALCT);
138  if (debug_matching) LogTrace("CSCGEMCMotherboardME21") << "++Valid ME21 CLCT: " << clct->bestCLCT[bx_clct] << std::endl;
139 
140  // pick the pad that corresponds
141  matches<GEMPadDigi> mPads;
142  matchingPads<GEMPadDigi>(clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
143  alct->bestALCT[bx_alct], alct->secondALCT[bx_alct], ME21, mPads);
144  matches<GEMCoPadDigi> mCoPads;
145  matchingPads<GEMCoPadDigi>(clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
146  alct->bestALCT[bx_alct], alct->secondALCT[bx_alct], ME21, mCoPads);
147 
148  if (dropLowQualityCLCTsNoGEMs_ and lowQuality and hasPads){
149  int nFound(mPads.size());
150  const bool clctInEdge(clct->bestCLCT[bx_clct].getKeyStrip() < 5 or clct->bestCLCT[bx_clct].getKeyStrip() > 155);
151  if (clctInEdge){
152  if (debug_matching) LogTrace("CSCGEMCMotherboardME21") << "\tInfo: low quality CLCT in CSC chamber edge, don't care about GEM pads" << std::endl;
153  }
154  else {
155  if (nFound != 0){
156  if (debug_matching) LogTrace("CSCGEMCMotherboardME21") << "\tInfo: low quality CLCT with " << nFound << " matching GEM trigger pads" << std::endl;
157  }
158  else {
159  if (debug_matching) LogTrace("CSCGEMCMotherboardME21") << "\tWarning: low quality CLCT without matching GEM trigger pad" << std::endl;
160  continue;
161  }
162  }
163  }
164 
165  ++nSuccessFulMatches;
166 
167  int mbx = bx_clct-bx_clct_start;
168  correlateLCTsGEM(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
169  clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
170  mPads, mCoPads,
171  allLCTs(bx_alct,mbx,0), allLCTs(bx_alct,mbx,1), CSCPart::ME21);
172  if (debug_matching) {
173  // if (infoV > 1) LogTrace("CSCMotherboard")
174  LogTrace("CSCGEMCMotherboardME21") << "Successful ALCT-CLCT match in ME21: bx_alct = " << bx_alct
175  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop
176  << "]; bx_clct = " << bx_clct << std::endl;
177  LogTrace("CSCGEMCMotherboardME21") << "+++ Best CLCT Details: ";
178  clct->bestCLCT[bx_clct].print();
179  LogTrace("CSCGEMCMotherboardME21") << "+++ Second CLCT Details: ";
180  clct->secondCLCT[bx_clct].print();
181  }
182  if (allLCTs(bx_alct,mbx,0).isValid()) {
183  used_clct_mask[bx_clct] += 1;
184  if (match_earliest_clct_only) break;
185  }
186  }
187  }
188 
189  // ALCT-to-GEM matching
190  int nSuccessFulGEMMatches = 0;
191  if (nSuccessFulMatches==0 and buildLCTfromALCTandGEM_){
192  if (debug_matching) LogTrace("CSCGEMCMotherboardME21") << "++No valid ALCT-CLCT matches in ME21" << std::endl;
193  for (int bx_gem = bx_copad_start; bx_gem <= bx_copad_stop; bx_gem++) {
194  if (not hasCoPads) {
195  continue;
196  }
197 
198  // find the best matching copad
199  matches<GEMCoPadDigi> copads;
200  matchingPads<CSCALCTDigi, GEMCoPadDigi>(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct], ME21, copads);
201 
202  if (debug_matching) LogTrace("CSCGEMCMotherboardME21") << "\t++Number of matching GEM CoPads in BX " << bx_alct << " : "<< copads.size() << std::endl;
203  if (copads.empty()) {
204  continue;
205  }
206 
207  CSCGEMMotherboard::correlateLCTsGEM(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
208  copads, allLCTs(bx_alct,0,0), allLCTs(bx_alct,0,1), CSCPart::ME21);
209  if (allLCTs(bx_alct,0,0).isValid()) {
210  ++nSuccessFulGEMMatches;
211  if (match_earliest_clct_only) break;
212  }
213  if (debug_matching) {
214  LogTrace("CSCGEMCMotherboardME21") << "Successful ALCT-GEM CoPad match in ME21: bx_alct = " << bx_alct << std::endl << std::endl;
215  LogTrace("CSCGEMCMotherboardME21") << "------------------------------------------------------------------------" << std::endl << std::endl;
216  }
217  }
218  }
219 
220  if (debug_matching) {
221  LogTrace("CSCGEMCMotherboardME21") << "========================================================================" << std::endl;
222  LogTrace("CSCGEMCMotherboardME21") << "Summary: " << std::endl;
223  if (nSuccessFulMatches>1)
224  LogTrace("CSCGEMCMotherboardME21") << "Too many successful ALCT-CLCT matches in ME21: " << nSuccessFulMatches
225  << ", CSCDetId " << cscChamber->id()
226  << ", bx_alct = " << bx_alct
227  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop << "]" << std::endl;
228  else if (nSuccessFulMatches==1)
229  LogTrace("CSCGEMCMotherboardME21") << "1 successful ALCT-CLCT match in ME21: "
230  << " CSCDetId " << cscChamber->id()
231  << ", bx_alct = " << bx_alct
232  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop << "]" << std::endl;
233  else if (nSuccessFulGEMMatches==1)
234  LogTrace("CSCGEMCMotherboardME21") << "1 successful ALCT-GEM match in ME21: "
235  << " CSCDetId " << cscChamber->id()
236  << ", bx_alct = " << bx_alct
237  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop << "]" << std::endl;
238  else
239  LogTrace("CSCGEMCMotherboardME21") << "Unsuccessful ALCT-CLCT match in ME21: "
240  << "CSCDetId " << cscChamber->id()
241  << ", bx_alct = " << bx_alct
242  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop << "]" << std::endl;
243  }
244  }
245  // at this point we have invalid ALCTs --> try GEM pad matching
246  else{
247  auto coPads(coPads_[bx_alct]);
248  if (!coPads.empty() and buildLCTfromCLCTandGEM_) {
249  const int bx_clct_start(bx_alct - match_trig_window_size/2);
250  const int bx_clct_stop(bx_alct + match_trig_window_size/2);
251 
252  if (debug_matching){
253  LogTrace("CSCGEMCMotherboardME21") << "========================================================================" << std::endl;
254  LogTrace("CSCGEMCMotherboardME21") <<"GEM-CLCT matching in ME2/1 chamber: "<< cscChamber->id()<< "in bx:"<<bx_alct<<std::endl;
255  LogTrace("CSCGEMCMotherboardME21") << "------------------------------------------------------------------------" << std::endl;
256  }
257  // GEM-to-CLCT
258  int nSuccessFulMatches = 0;
259  for (int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++)
260  {
261  if (bx_clct < 0 or bx_clct >= CSCConstants::MAX_CLCT_TBINS) continue;
262  if (drop_used_clcts and used_clct_mask[bx_clct]) continue;
263  if (clct->bestCLCT[bx_clct].isValid())
264  {
265  const int quality(clct->bestCLCT[bx_clct].getQuality());
266  // only use high-Q stubs for the time being
267  if (quality < 4) continue;
268 
269  ++nSuccessFulMatches;
270 
271  int mbx = std::abs(clct->bestCLCT[bx_clct].getBX()-bx_alct);
272  int bx_gem = (coPads[0].second).bx(1)+lct_central_bx;
273  CSCGEMMotherboard::correlateLCTsGEM(clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct], coPads,
274  allLCTs(bx_gem,mbx,0), allLCTs(bx_gem,mbx,1), CSCPart::ME21);
275  if (debug_matching) {
276  // if (infoV > 1) LogTrace("CSCGEMMotherboardME21")
277  LogTrace("CSCGEMCMotherboardME21") << "Successful GEM-CLCT match in ME21: bx_alct = " << bx_alct <<std::endl;
278  //<< "; match window: [" << bx_clct_start << "; " << bx_clct_stop
279  //<< "]; bx_clct = " << bx_clct << std::endl;
280  LogTrace("CSCGEMCMotherboardME21") << "+++ Best CLCT Details: ";
281  clct->bestCLCT[bx_clct].print();
282  LogTrace("CSCGEMCMotherboardME21") << "+++ Second CLCT Details: ";
283  clct->secondCLCT[bx_clct].print();
284  }
285  if (allLCTs(bx_gem,mbx,0).isValid()) {
286  used_clct_mask[bx_gem] += 1;
287  if (match_earliest_clct_only) break;
288  }
289  }
290  }
291  }
292  }
293  }
294  // reduction of nLCTs per each BX
295  for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++)
296  {
297  // counting
298  unsigned int n=0;
299  for (unsigned int mbx = 0; mbx < match_trig_window_size; mbx++)
300  for (int i=0;i<CSCConstants::MAX_LCTS_PER_CSC;i++)
301  {
302  int cbx = bx + mbx - match_trig_window_size/2;
303  if (allLCTs(bx,mbx,i).isValid())
304  {
305  ++n;
306  if (infoV > 0) LogDebug("CSCGEMMotherboardME21")
307  << "LCT"<<i+1<<" "<<bx<<"/"<<cbx<<": "<<allLCTs(bx,mbx,i)<<std::endl;
308  }
309  }
310 
311  // some simple cross-bx sorting algorithms
312  if (tmb_cross_bx_algo == 1 and (n>2))
313  {
314  n=0;
315  for (unsigned int mbx = 0; mbx < match_trig_window_size; mbx++)
316  for (int i=0;i<CSCConstants::MAX_LCTS_PER_CSC;i++)
317  {
318  if (allLCTs(bx,pref[mbx],i).isValid())
319  {
320  n++;
321  if (n>2) allLCTs(bx,pref[mbx],i).clear();
322  }
323  }
324 
325  n=0;
326  for (unsigned int mbx = 0; mbx < match_trig_window_size; mbx++)
327  for (int i=0;i<CSCConstants::MAX_LCTS_PER_CSC;i++)
328  {
329  int cbx = bx + mbx - match_trig_window_size/2;
330  if (allLCTs(bx,mbx,i).isValid())
331  {
332  n++;
333  if (infoV > 0) LogDebug("CSCGEMMotherboardME21")
334  << "LCT"<<i+1<<" "<<bx<<"/"<<cbx<<": "<<allLCTs(bx,mbx,i)<< std::endl;
335  }
336  }
337  if (infoV > 0 and n>0) LogDebug("CSCGEMMotherboardME21")
338  <<"bx "<<bx<<" nnLCT:"<<n<<" "<<n<<std::endl;
339  } // x-bx sorting
340  }
341 
342  bool first = true;
343  unsigned int n=0;
344  for (const auto& p : readoutLCTs()) {
345  if (debug_matching and first){
346  LogTrace("CSCGEMCMotherboardME21") << "========================================================================" << std::endl;
347  LogTrace("CSCGEMCMotherboardME21") << "Counting the final LCTs" << std::endl;
348  LogTrace("CSCGEMCMotherboardME21") << "========================================================================" << std::endl;
349  first = false;
350  LogTrace("CSCGEMCMotherboardME21") << "tmb_cross_bx_algo: " << tmb_cross_bx_algo << std::endl;
351  }
352  n++;
353  if (debug_matching)
354  LogTrace("CSCGEMCMotherboardME21") << "LCT "<<n<<" " << p <<std::endl;
355  }
356 }
#define LogDebug(id)
void retrieveGEMPads(const GEMPadDigiCollection *pads, unsigned id)
unsigned int match_trig_window_size
CSCDetId id() const
Get the (concrete) DetId.
Definition: CSCChamber.h:37
GEMCoPadDigiIdsBX coPads_
int pref[CSCConstants::MAX_LCT_TBINS]
const CSCChamber * cscChamber
std::vector< GEMCoPadDigi > gemCoPadV
std::vector< CSCALCTDigi > alctV
std::unique_ptr< GEMCoPadProcessor > coPadProcessor
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< 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
void correlateLCTsGEM(T &best, T &second, const GEMCoPadDigiIds &coPads, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2, enum CSCPart) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void printGEMTriggerCoPads(int bx_start, int bx_stop, enum CSCPart)
void correlateLCTsGEM(CSCALCTDigi &bestALCT, CSCALCTDigi &secondALCT, CSCCLCTDigi &bestCLCT, CSCCLCTDigi &secondCLCT, const GEMPadDigiIds &pads, const GEMCoPadDigiIds &copads, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2, enum CSCPart p) const
#define LogTrace(id)
std::vector< CSCCorrelatedLCTDigi > readoutLCTs() const
GEMPadDigiIdsBX pads_
std::unique_ptr< CSCAnodeLCTProcessor > alct
std::vector< CSCCLCTDigi > clctV
std::unique_ptr< CSCCathodeLCTProcessor > clct
const GEMGeometry * gem_g
void printGEMTriggerPads(int bx_start, int bx_stop, enum CSCPart)

Member Data Documentation

LCTContainer CSCGEMMotherboardME21::allLCTs
private

for the case when more than 2 LCTs/BX are allowed; maximum match window = 15

Definition at line 60 of file CSCGEMMotherboardME21.h.

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

bool CSCGEMMotherboardME21::buildLCTfromALCTandGEM_
private

Definition at line 70 of file CSCGEMMotherboardME21.h.

Referenced by run().

bool CSCGEMMotherboardME21::buildLCTfromCLCTandGEM_
private

Definition at line 71 of file CSCGEMMotherboardME21.h.

Referenced by run().

std::vector<CSCCLCTDigi> CSCGEMMotherboardME21::clctV
private

Definition at line 63 of file CSCGEMMotherboardME21.h.

Referenced by run().

bool CSCGEMMotherboardME21::dropLowQualityALCTsNoGEMs_
private

Definition at line 67 of file CSCGEMMotherboardME21.h.

bool CSCGEMMotherboardME21::dropLowQualityCLCTsNoGEMs_
private

Definition at line 66 of file CSCGEMMotherboardME21.h.

Referenced by run().

std::unique_ptr<CSCGEMMotherboardLUTME21> CSCGEMMotherboardME21::tmbLUT_
private

Definition at line 48 of file CSCGEMMotherboardME21.h.

Referenced by CSCGEMMotherboardME21(), and getLUT().