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

 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) 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
 
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
 
std::vector< CSCCorrelatedLCTDigireadoutLCTs () const
 
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 (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 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
 
const CSCChambercscChamber
 
bool debug_luts
 
bool debug_matching
 
bool disableME1a
 
bool gangedME1a
 
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
 
- Protected Attributes inherited from CSCMotherboard
unsigned int alct_trig_enable
 
unsigned int alctClctOffset
 
edm::ParameterSet alctParams_
 
std::vector< CSCALCTDigialctV
 
bool clct_to_alct
 
unsigned int clct_trig_enable
 
edm::ParameterSet clctParams_
 
std::vector< CSCCLCTDigiclctV
 
edm::ParameterSet commonParams_
 
const CSCGeometrycsc_g
 
bool drop_used_alcts
 
bool drop_used_clcts
 
int early_tbins
 
CSCCorrelatedLCTDigi firstLCT [CSCConstants::MAX_LCT_TBINS]
 
int infoV
 
bool isSLHC_
 
unsigned int match_trig_enable
 
unsigned int match_trig_window_size
 
unsigned int mpc_block_me1a
 
bool readout_earliest_2
 
bool runME11ILT_
 
bool runME21ILT_
 
bool runME3141ILT_
 
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
 
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 CSCMotherboard::isSLHC_, or, CSCMotherboard::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
edm::ParameterSet tmbParams_
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_
CSCGEMMotherboardME21::CSCGEMMotherboardME21 ( )

Test destructor.

Definition at line 21 of file CSCGEMMotherboardME21.cc.

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

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

373 {
374  CSCALCTDigi bestALCT = bALCT;
375  CSCALCTDigi secondALCT = sALCT;
376  CSCCLCTDigi bestCLCT = bCLCT;
377  CSCCLCTDigi secondCLCT = sCLCT;
378 
379  // assume that always anodeBestValid and cathodeBestValid
380  if (secondALCT == bestALCT) secondALCT.clear();
381  if (secondCLCT == bestCLCT) secondCLCT.clear();
382 
383  const bool ok_bb = bestALCT.isValid() and bestCLCT.isValid();
384  const bool ok_bs = bestALCT.isValid() and secondCLCT.isValid();
385  const bool ok_sb = secondALCT.isValid() and bestCLCT.isValid();
386  const bool ok_ss = secondALCT.isValid() and secondCLCT.isValid();
387 
388  if (!copads.empty() or !pads.empty()){
389 
390  // check matching copads
391  const GEMCoPadDigi& bb_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, bestCLCT, copads);
392  const GEMCoPadDigi& bs_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, secondCLCT, copads);
393  const GEMCoPadDigi& sb_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, bestCLCT, copads);
394  const GEMCoPadDigi& ss_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, secondCLCT, copads);
395 
396  // check matching pads
397  const GEMPadDigi& bb_pad = bestMatchingPad<GEMPadDigi>(bestALCT, bestCLCT, pads);
398  const GEMPadDigi& bs_pad = bestMatchingPad<GEMPadDigi>(bestALCT, secondCLCT, pads);
399  const GEMPadDigi& sb_pad = bestMatchingPad<GEMPadDigi>(secondALCT, bestCLCT, pads);
400  const GEMPadDigi& ss_pad = bestMatchingPad<GEMPadDigi>(secondALCT, secondCLCT, pads);
401 
402  // evaluate possible combinations
403  const bool ok_bb_copad = ok_bb and bb_copad.isValid();
404  const bool ok_bs_copad = ok_bs and bs_copad.isValid();
405  const bool ok_sb_copad = ok_sb and sb_copad.isValid();
406  const bool ok_ss_copad = ok_ss and ss_copad.isValid();
407 
408  const bool ok_bb_pad = (not ok_bb_copad) and ok_bb and bb_pad.isValid();
409  const bool ok_bs_pad = (not ok_bs_copad) and ok_bs and bs_pad.isValid();
410  const bool ok_sb_pad = (not ok_sb_copad) and ok_sb and sb_pad.isValid();
411  const bool ok_ss_pad = (not ok_ss_copad) and ok_ss and ss_pad.isValid();
412 
413  // possible cases with copad
414  if (ok_bb_copad or ok_ss_copad){
415  if (ok_bb_copad) lct1 = constructLCTsGEM(bestALCT, bestCLCT, bb_copad, 1);
416  if (ok_ss_copad) lct2 = constructLCTsGEM(secondALCT, secondCLCT, ss_copad, 2);
417  }
418  else if(ok_bs_copad or ok_sb_copad){
419  if (ok_bs_copad) lct1 = constructLCTsGEM(bestALCT, secondCLCT, bs_copad, 1);
420  if (ok_sb_copad) lct2 = constructLCTsGEM(secondALCT, bestCLCT, sb_copad, 2);
421  }
422 
423  // done processing?
424  if (lct1.isValid() and lct2.isValid()) return;
425 
426  // possible cases with pad
427  if ((ok_bb_pad or ok_ss_pad) and not (ok_bs_copad or ok_sb_copad)){
428  if (ok_bb_pad) lct1 = constructLCTsGEM(bestALCT, bestCLCT, bb_pad, 1);
429  if (ok_ss_pad) lct2 = constructLCTsGEM(secondALCT, secondCLCT, ss_pad, 2);
430  }
431  else if((ok_bs_pad or ok_sb_pad) and not (ok_bb_copad or ok_ss_copad)){
432  if (ok_bs_pad) lct1 = constructLCTsGEM(bestALCT, secondCLCT, bs_pad, 1);
433  if (ok_sb_pad) lct2 = constructLCTsGEM(secondALCT, bestCLCT, sb_pad, 2);
434  }
435  } else {
436  // run without gems - happens in less than 0.04% of the time
437  if (ok_bb) lct1 = constructLCTs(bestALCT, bestCLCT, CSCCorrelatedLCTDigi::ALCTCLCT, 1);
438  if (ok_ss) lct2 = constructLCTs(secondALCT, secondCLCT, CSCCorrelatedLCTDigi::ALCTCLCT, 2);
439  }
440 }
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

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

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