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 CSCBaseboard

Public Member Functions

 CSCGEMMotherboardME21 (unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf)
 
 CSCGEMMotherboardME21 ()
 
std::vector< CSCCorrelatedLCTDigireadoutLCTs () const override
 
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) const
 
template<class S >
S bestMatchingPad (const CSCCLCTDigi &clct, const matches< S > &pads) const
 
template<class S >
S bestMatchingPad (const CSCALCTDigi &alct1, const CSCCLCTDigi &clct1, const matches< S > &pads) 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
void clear ()
 
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 ()
 
enum CSCPart getCSCPart (int keystrip) const
 
template<class S >
void intersection (const S &d1, const S &d2, S &result) const
 
std::vector< CSCCorrelatedLCTDigireadoutLCTs () const override
 
void run (const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc) override
 
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 () const
 
void setConfigParameters (const CSCDBL1TPParameters *conf)
 
 ~CSCMotherboard () override=default
 
- Public Member Functions inherited from CSCBaseboard
 CSCBaseboard (unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf)
 
 CSCBaseboard ()
 
std::string getCSCName () const
 
void setCSCGeometry (const CSCGeometry *g)
 
virtual ~CSCBaseboard ()=default
 

Private Member Functions

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

Private Attributes

bool buildLCTfromALCTandGEM_
 
bool buildLCTfromCLCTandGEM_
 
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< CSCAnodeLCTProcessoralctProc
 
std::unique_ptr< CSCCathodeLCTProcessorclctProc
 
- 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 > &) const
 
template<class T >
T bestMatchingPad (const CSCCLCTDigi &, const matches< T > &) const
 
template<class T >
T bestMatchingPad (const CSCALCTDigi &, const CSCCLCTDigi &, const matches< T > &) const
 
CSCCorrelatedLCTDigi constructLCTsGEM (const CSCALCTDigi &alct, const GEMCoPadDigi &gem, int i) const
 
CSCCorrelatedLCTDigi constructLCTsGEM (const CSCCLCTDigi &clct, const GEMCoPadDigi &gem, int i) const
 
CSCCorrelatedLCTDigi constructLCTsGEM (const CSCALCTDigi &alct, const CSCCLCTDigi &clct, const GEMCoPadDigi &gem, int i) const
 
CSCCorrelatedLCTDigi constructLCTsGEM (const CSCALCTDigi &alct, const CSCCLCTDigi &clct, const GEMPadDigi &gem, int i) const
 
CSCCorrelatedLCTDigi constructLCTsGEM (const CSCALCTDigi &alct, const CSCCLCTDigi &clct, const GEMPadDigi &gem1, const GEMCoPadDigi &gem2, int i) const
 
template<class T >
void correlateLCTsGEM (T &best, T &second, const GEMCoPadDigiIds &coPads, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2) const
 
template<class T >
void correlateLCTsGEM (const T &best, const T &second, const GEMCoPadDigi &, const GEMCoPadDigi &, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2) 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 par) 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, matches< T > &) const
 
template<class T >
void matchingPads (const CSCCLCTDigi &alct, matches< T > &) const
 
template<class S , class T >
void matchingPads (const S &d1, const S &d2, matches< T > &) const
 
template<class T >
void matchingPads (const CSCCLCTDigi &clct1, const CSCALCTDigi &alct1, matches< T > &) const
 
template<class T >
void matchingPads (const CSCCLCTDigi &clct1, const CSCCLCTDigi &clct2, const CSCALCTDigi &alct1, const CSCALCTDigi &alct2, 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 CSCUpgradeMotherboard
void correlateLCTs (const CSCALCTDigi &bestALCT, const CSCALCTDigi &secondALCT, const CSCCLCTDigi &bestCLCT, const CSCCLCTDigi &secondCLCT, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2) const
 
void setPrefIndex ()
 
- Protected Member Functions inherited from CSCMotherboard
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 clctPattern) const
 
unsigned int findQuality (const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT) const
 
CSCALCTDigi getBXShiftedALCT (const CSCALCTDigi &) const
 
- 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
LCTContainer allLCTs
 
bool debug_luts
 
bool debug_matching
 
std::unique_ptr< CSCUpgradeMotherboardLUTGeneratorgenerator_
 
bool match_earliest_alct_only
 
bool match_earliest_clct_only
 
unsigned int max_lcts
 
int pref [CSCConstants::MAX_LCT_TBINS]
 
Parity theParity
 
unsigned int tmb_cross_bx_algo
 
- Protected Attributes inherited from CSCMotherboard
unsigned int alct_trig_enable
 
std::vector< CSCALCTDigialctV
 
bool clct_to_alct
 
unsigned int clct_trig_enable
 
std::vector< CSCCLCTDigiclctV
 
bool drop_used_alcts
 
bool drop_used_clcts
 
int early_tbins
 
CSCCorrelatedLCTDigi firstLCT [CSCConstants::MAX_LCT_TBINS]
 
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]
 
unsigned int tmb_l1a_window_size
 
- Protected Attributes inherited from CSCBaseboard
unsigned int alctClctOffset_
 
edm::ParameterSet alctParams_
 
edm::ParameterSet clctParams_
 
edm::ParameterSet commonParams_
 
const CSCChambercscChamber_
 
const CSCGeometrycscGeometry_
 
CSCDetId cscId_
 
bool disableME1a_
 
bool enableAlctSLHC_
 
bool gangedME1a_
 
int infoV
 
bool isME11_
 
bool isSLHC_
 
bool runME11ILT_
 
bool runME11Up_
 
bool runME21ILT_
 
bool runME21Up_
 
bool runME31Up_
 
bool runME41Up_
 
unsigned theChamber
 
std::string theCSCName_
 
const unsigned theEndcap
 
unsigned theRegion
 
unsigned theRing
 
const unsigned theSector
 
const unsigned theStation
 
const unsigned theSubsector
 
const unsigned theTrigChamber
 
edm::ParameterSet tmbParams_
 
- 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 3 of file CSCGEMMotherboardME21.cc.

References CSCBaseboard::isSLHC_, or, CSCBaseboard::runME21ILT_, and tmbLUT_.

7  : CSCGEMMotherboard(endcap, station, sector, subsector, chamber, conf)
8  , dropLowQualityCLCTsNoGEMs_(tmbParams_.getParameter<bool>("dropLowQualityCLCTsNoGEMs"))
9  , dropLowQualityALCTsNoGEMs_(tmbParams_.getParameter<bool>("dropLowQualityALCTsNoGEMs"))
10  , buildLCTfromALCTandGEM_(tmbParams_.getParameter<bool>("buildLCTfromALCTandGEM"))
11  , buildLCTfromCLCTandGEM_(tmbParams_.getParameter<bool>("buildLCTfromCLCTandGEM"))
12 {
13  if (!isSLHC_ or !runME21ILT_) edm::LogError("CSCGEMMotherboardME21|ConfigError")
14  << "+++ Upgrade CSCGEMMotherboardME21 constructed while isSLHC is not set! +++\n";
15 
16  // set LUTs
17  tmbLUT_.reset(new CSCGEMMotherboardLUTME21());
18 }
T getParameter(std::string const &) const
bool runME21ILT_
Definition: CSCBaseboard.h:92
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
std::unique_ptr< CSCGEMMotherboardLUTME21 > tmbLUT_
edm::ParameterSet tmbParams_
Definition: CSCBaseboard.h:61
CSCGEMMotherboardME21::CSCGEMMotherboardME21 ( )

Test destructor.

Definition at line 21 of file CSCGEMMotherboardME21.cc.

References CSCBaseboard::isSLHC_, or, and CSCBaseboard::runME21ILT_.

23 {
24  if (!isSLHC_ or !runME21ILT_) edm::LogError("CSCGEMMotherboardME21|ConfigError")
25  << "+++ Upgrade CSCGEMMotherboardME21 constructed while isSLHC is not set! +++\n";
26 }
bool runME21ILT_
Definition: CSCBaseboard.h:92
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
CSCGEMMotherboardME21::~CSCGEMMotherboardME21 ( )
override

Default destructor.

Definition at line 29 of file CSCGEMMotherboardME21.cc.

30 {
31 }

Member Function Documentation

void CSCGEMMotherboardME21::correlateLCTsGEM ( const CSCALCTDigi bestALCT,
const CSCALCTDigi secondALCT,
const CSCCLCTDigi bestCLCT,
const CSCCLCTDigi secondCLCT,
const GEMPadDigiIds pads,
const GEMCoPadDigiIds copads,
CSCCorrelatedLCTDigi lct1,
CSCCorrelatedLCTDigi lct2 
) const
private

Definition at line 355 of file CSCGEMMotherboardME21.cc.

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

Referenced by run().

363 {
364  CSCALCTDigi bestALCT = bALCT;
365  CSCALCTDigi secondALCT = sALCT;
366  CSCCLCTDigi bestCLCT = bCLCT;
367  CSCCLCTDigi secondCLCT = sCLCT;
368 
369  // assume that always anodeBestValid and cathodeBestValid
370  if (secondALCT == bestALCT) secondALCT.clear();
371  if (secondCLCT == bestCLCT) secondCLCT.clear();
372 
373  const bool ok_bb = bestALCT.isValid() and bestCLCT.isValid();
374  const bool ok_bs = bestALCT.isValid() and secondCLCT.isValid();
375  const bool ok_sb = secondALCT.isValid() and bestCLCT.isValid();
376  const bool ok_ss = secondALCT.isValid() and secondCLCT.isValid();
377 
378  if (!copads.empty() or !pads.empty()){
379 
380  // check matching copads
381  const GEMCoPadDigi& bb_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, bestCLCT, copads);
382  const GEMCoPadDigi& bs_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, secondCLCT, copads);
383  const GEMCoPadDigi& sb_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, bestCLCT, copads);
384  const GEMCoPadDigi& ss_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, secondCLCT, copads);
385 
386  // check matching pads
387  const GEMPadDigi& bb_pad = bestMatchingPad<GEMPadDigi>(bestALCT, bestCLCT, pads);
388  const GEMPadDigi& bs_pad = bestMatchingPad<GEMPadDigi>(bestALCT, secondCLCT, pads);
389  const GEMPadDigi& sb_pad = bestMatchingPad<GEMPadDigi>(secondALCT, bestCLCT, pads);
390  const GEMPadDigi& ss_pad = bestMatchingPad<GEMPadDigi>(secondALCT, secondCLCT, pads);
391 
392  // evaluate possible combinations
393  const bool ok_bb_copad = ok_bb and bb_copad.isValid();
394  const bool ok_bs_copad = ok_bs and bs_copad.isValid();
395  const bool ok_sb_copad = ok_sb and sb_copad.isValid();
396  const bool ok_ss_copad = ok_ss and ss_copad.isValid();
397 
398  const bool ok_bb_pad = (not ok_bb_copad) and ok_bb and bb_pad.isValid();
399  const bool ok_bs_pad = (not ok_bs_copad) and ok_bs and bs_pad.isValid();
400  const bool ok_sb_pad = (not ok_sb_copad) and ok_sb and sb_pad.isValid();
401  const bool ok_ss_pad = (not ok_ss_copad) and ok_ss 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, 1);
406  if (ok_ss_copad) lct2 = constructLCTsGEM(secondALCT, secondCLCT, ss_copad, 2);
407  }
408  else if(ok_bs_copad or ok_sb_copad){
409  if (ok_bs_copad) lct1 = constructLCTsGEM(bestALCT, secondCLCT, bs_copad, 1);
410  if (ok_sb_copad) lct2 = constructLCTsGEM(secondALCT, bestCLCT, sb_copad, 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, 1);
419  if (ok_ss_pad) lct2 = constructLCTsGEM(secondALCT, secondCLCT, ss_pad, 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, 1);
423  if (ok_sb_pad) lct2 = constructLCTsGEM(secondALCT, bestCLCT, sb_pad, 2);
424  }
425  } else {
426  // run without gems - happens in less than 0.04% of the time
427  if (ok_bb) lct1 = constructLCTs(bestALCT, bestCLCT, CSCCorrelatedLCTDigi::ALCTCLCT, 1);
428  if (ok_ss) lct2 = constructLCTs(secondALCT, secondCLCT, CSCCorrelatedLCTDigi::ALCTCLCT, 2);
429  }
430 }
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:30
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
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:30
CSCCorrelatedLCTDigi constructLCTs(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT, int type, int trknmb) const
CSCCorrelatedLCTDigi constructLCTsGEM(const CSCALCTDigi &alct, const GEMCoPadDigi &gem, int i) const
bool isValid() const
return valid pattern bit
void clear()
clear this CLCT
Definition: CSCCLCTDigi.cc:58
const CSCGEMMotherboardLUTME21* CSCGEMMotherboardME21::getLUT ( ) const
inlineoverrideprivatevirtual

Implements CSCGEMMotherboard.

Definition at line 43 of file CSCGEMMotherboardME21.h.

References tmbLUT_.

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

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

Reimplemented from CSCMotherboard.

Definition at line 345 of file CSCGEMMotherboardME21.cc.

References CSCUpgradeMotherboard::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().

346 {
347  std::vector<CSCCorrelatedLCTDigi> result;
348  allLCTs.getMatched(result);
351  return result;
352 }
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 35 of file CSCGEMMotherboardME21.cc.

References funct::abs(), CSCBaseboard::alctClctOffset_, CSCMotherboard::alctProc, CSCMotherboard::alctV, CSCUpgradeMotherboard::allLCTs, buildLCTfromALCTandGEM_, buildLCTfromCLCTandGEM_, EnergyCorrector::c, CSCMotherboard::clctProc, CSCMotherboard::clctV, CSCGEMMotherboard::clear(), CSCUpgradeMotherboard::LCTContainer::clear(), CSCGEMMotherboard::coPadProcessor, CSCGEMMotherboard::coPads_, correlateLCTsGEM(), CSCGEMMotherboard::correlateLCTsGEM(), CSCBaseboard::cscGeometry_, CSCBaseboard::cscId_, CSCUpgradeMotherboard::debug_matching, CSCUpgradeMotherboard::debugLUTs(), CSCMotherboard::drop_used_clcts, dropLowQualityCLCTsNoGEMs_, plotBeamSpotDB::first, CSCGEMMotherboard::gem_g, CSCGEMMotherboard::gemCoPadV, CSCGEMMotherboard::gemGeometryAvailable, CSCGEMMotherboard::gemId, mps_fire::i, CSCBaseboard::infoV, CSCConstants::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().

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

Member Data Documentation

bool CSCGEMMotherboardME21::buildLCTfromALCTandGEM_
private

Definition at line 62 of file CSCGEMMotherboardME21.h.

Referenced by run().

bool CSCGEMMotherboardME21::buildLCTfromCLCTandGEM_
private

Definition at line 63 of file CSCGEMMotherboardME21.h.

Referenced by run().

bool CSCGEMMotherboardME21::dropLowQualityALCTsNoGEMs_
private

Definition at line 59 of file CSCGEMMotherboardME21.h.

bool CSCGEMMotherboardME21::dropLowQualityCLCTsNoGEMs_
private

Definition at line 58 of file CSCGEMMotherboardME21.h.

Referenced by run().

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

Definition at line 44 of file CSCGEMMotherboardME21.h.

Referenced by CSCGEMMotherboardME21(), and getLUT().