CMS 3D CMS Logo

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

#include <CSCGEMMatcher.h>

Public Types

typedef std::vector< GEMInternalClusterGEMInternalClusters
 

Public Member Functions

void bestClusterLoc (const CSCALCTDigi &alct, const GEMInternalClusters &clusters, GEMInternalCluster &best) const
 
void bestClusterLoc (const CSCCLCTDigi &clct, const GEMInternalClusters &clusters, const CSCL1TPLookupTableME11ILT *lookupTableME11ILT, const CSCL1TPLookupTableME21ILT *lookupTableME21ILT, GEMInternalCluster &best) const
 
void bestClusterLoc (const CSCALCTDigi &alct, const CSCCLCTDigi &clct, const GEMInternalClusters &clusters, const CSCL1TPLookupTableME11ILT *lookupTableME11ILT, const CSCL1TPLookupTableME21ILT *lookupTableME21ILT, GEMInternalCluster &best) const
 
int calculateGEMCSCBending (const CSCCLCTDigi &clct, const GEMInternalCluster &cluster, const CSCL1TPLookupTableME11ILT *lookupTableME11ILT, const CSCL1TPLookupTableME21ILT *lookupTableME21ILT) const
 
 CSCGEMMatcher (int endcap, unsigned station, unsigned chamber, const edm::ParameterSet &tmbParams, const edm::ParameterSet &luts)
 
int matchedClusterDistES (const CSCCLCTDigi &clct, const GEMInternalCluster &cluster, const bool isLayer2, const bool ForceTotal, const CSCL1TPLookupTableME11ILT *lookupTableME11ILT, const CSCL1TPLookupTableME21ILT *lookupTableME21ILT) const
 
void matchingClustersLoc (const CSCALCTDigi &alct, const GEMInternalClusters &clusters, GEMInternalClusters &output) const
 
void matchingClustersLoc (const CSCCLCTDigi &clct, const GEMInternalClusters &clusters, GEMInternalClusters &output, bool ignoreALCTGEMmatch, const CSCL1TPLookupTableME11ILT *lookupTableME11ILT, const CSCL1TPLookupTableME21ILT *lookupTableME21ILT) const
 
void matchingClustersLoc (const CSCALCTDigi &alct, const CSCCLCTDigi &clct, const GEMInternalClusters &clusters, const CSCL1TPLookupTableME11ILT *lookupTableME11ILT, const CSCL1TPLookupTableME21ILT *lookupTableME21ILT, GEMInternalClusters &output) const
 

Private Member Functions

int CSCGEMSlopeCorrector (const bool isME1a, const int cscSlope, bool isLayer2, const CSCL1TPLookupTableME11ILT *lookupTableME11ILT, const CSCL1TPLookupTableME21ILT *lookupTableME21ILT) const
 
uint16_t mitigatedSlopeByConsistency (const CSCCLCTDigi &clct, const CSCL1TPLookupTableME11ILT *lookupTableME11ILT, const CSCL1TPLookupTableME21ILT *lookupTableME21ILT) const
 

Private Attributes

bool assign_gem_csc_bending_
 
unsigned chamber_
 
bool enable_match_gem_me1a_
 
bool enable_match_gem_me1b_
 
unsigned endcap_
 
bool isEven_
 
bool matchCLCTpropagation_
 
unsigned maxDeltaHsEven_
 
unsigned maxDeltaHsOdd_
 
unsigned maxDeltaWG_
 
bool mitigateSlopeByCosi_
 
unsigned ring_
 
unsigned station_
 

Detailed Description

Helper class to check if an ALCT or CLCT matches with a GEMInternalCluster

Author
Sven Dildick (Rice University) by Giovanni Mocellin (UC Davis)

Definition at line 25 of file CSCGEMMatcher.h.

Member Typedef Documentation

◆ GEMInternalClusters

Definition at line 27 of file CSCGEMMatcher.h.

Constructor & Destructor Documentation

◆ CSCGEMMatcher()

CSCGEMMatcher::CSCGEMMatcher ( int  endcap,
unsigned  station,
unsigned  chamber,
const edm::ParameterSet tmbParams,
const edm::ParameterSet luts 
)

Definition at line 11 of file CSCGEMMatcher.cc.

References assign_gem_csc_bending_, chamber_, enable_match_gem_me1a_, enable_match_gem_me1b_, isEven_, matchCLCTpropagation_, maxDeltaHsEven_, maxDeltaHsOdd_, maxDeltaWG_, and mitigateSlopeByCosi_.

14  isEven_ = (chamber_ % 2 == 0);
15 
16  enable_match_gem_me1a_ = tmbParams.getParameter<bool>("enableMatchGEMandME1a");
17  enable_match_gem_me1b_ = tmbParams.getParameter<bool>("enableMatchGEMandME1b");
18 
19  maxDeltaWG_ = tmbParams.getParameter<unsigned>("maxDeltaWG");
20  maxDeltaHsEven_ = tmbParams.getParameter<unsigned>("maxDeltaHsEven");
21  maxDeltaHsOdd_ = tmbParams.getParameter<unsigned>("maxDeltaHsOdd");
22 
23  matchCLCTpropagation_ = tmbParams.getParameter<bool>("matchCLCTpropagation");
24 
25  mitigateSlopeByCosi_ = tmbParams.getParameter<bool>("mitigateSlopeByCosi");
26  assign_gem_csc_bending_ = tmbParams.getParameter<bool>("assignGEMCSCBending");
27 }
unsigned maxDeltaHsOdd_
bool mitigateSlopeByCosi_
unsigned station_
bool assign_gem_csc_bending_
unsigned maxDeltaHsEven_
unsigned chamber_
bool enable_match_gem_me1b_
bool enable_match_gem_me1a_
unsigned endcap_
unsigned maxDeltaWG_
bool matchCLCTpropagation_

Member Function Documentation

◆ bestClusterLoc() [1/3]

void CSCGEMMatcher::bestClusterLoc ( const CSCALCTDigi alct,
const GEMInternalClusters clusters,
GEMInternalCluster best 
) const

Definition at line 33 of file CSCGEMMatcher.cc.

References bsc_activity_cfg::clusters, CSCALCTDigi::isValid(), matchingClustersLoc(), and or.

35  {
36  if (!alct.isValid() or clusters.empty())
37  return;
38 
39  // match spatially
40  GEMInternalClusters clustersLoc;
41  matchingClustersLoc(alct, clusters, clustersLoc);
42 
43  // simply pick the first matching one
44  if (!clustersLoc.empty())
45  best = clustersLoc[0];
46 }
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:40
void matchingClustersLoc(const CSCALCTDigi &alct, const GEMInternalClusters &clusters, GEMInternalClusters &output) 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< GEMInternalCluster > GEMInternalClusters
Definition: CSCGEMMatcher.h:27

◆ bestClusterLoc() [2/3]

void CSCGEMMatcher::bestClusterLoc ( const CSCCLCTDigi clct,
const GEMInternalClusters clusters,
const CSCL1TPLookupTableME11ILT lookupTableME11ILT,
const CSCL1TPLookupTableME21ILT lookupTableME21ILT,
GEMInternalCluster best 
) const

Definition at line 48 of file CSCGEMMatcher.cc.

References bsc_activity_cfg::clusters, CSCCLCTDigi::isValid(), matchingClustersLoc(), and or.

52  {
53  if (!clct.isValid() or clusters.empty())
54  return;
55 
56  // match spatially
57  bool ignoreALCTGEMmatch = true;
58  GEMInternalClusters clustersLoc;
59  matchingClustersLoc(clct, clusters, clustersLoc, ignoreALCTGEMmatch, lookupTableME11ILT, lookupTableME21ILT);
60 
61  // the first matching one is also the closest in phi distance (to expected position, if extrapolating), by ordered list in CLCT matching
62  if (!clustersLoc.empty())
63  best = clustersLoc[0];
64 }
void matchingClustersLoc(const CSCALCTDigi &alct, const GEMInternalClusters &clusters, GEMInternalClusters &output) 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
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:50
std::vector< GEMInternalCluster > GEMInternalClusters
Definition: CSCGEMMatcher.h:27

◆ bestClusterLoc() [3/3]

void CSCGEMMatcher::bestClusterLoc ( const CSCALCTDigi alct,
const CSCCLCTDigi clct,
const GEMInternalClusters clusters,
const CSCL1TPLookupTableME11ILT lookupTableME11ILT,
const CSCL1TPLookupTableME21ILT lookupTableME21ILT,
GEMInternalCluster best 
) const

Definition at line 66 of file CSCGEMMatcher.cc.

References bsc_activity_cfg::clusters, CSCALCTDigi::isValid(), CSCCLCTDigi::isValid(), matchingClustersLoc(), and or.

71  {
72  if (!alct.isValid() or !clct.isValid() or clusters.empty())
73  return;
74 
75  // match spatially
76  GEMInternalClusters clustersLoc;
77  matchingClustersLoc(alct, clct, clusters, lookupTableME11ILT, lookupTableME21ILT, clustersLoc);
78 
79  // the first matching one is also the closest in phi distance (to expected position, if extrapolating), by ordered list in CLCT matching
80  if (!clustersLoc.empty()) {
81  best = clustersLoc[0];
82  if (best.isCoincidence() and !best.isMatchingLayer1() and best.isMatchingLayer2())
83  best.set_coincidence(false);
84  // std::cout << "\nGEM selected: " << best << "\n" << std::endl;
85  }
86 }
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:40
void matchingClustersLoc(const CSCALCTDigi &alct, const GEMInternalClusters &clusters, GEMInternalClusters &output) 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
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:50
std::vector< GEMInternalCluster > GEMInternalClusters
Definition: CSCGEMMatcher.h:27

◆ calculateGEMCSCBending()

int CSCGEMMatcher::calculateGEMCSCBending ( const CSCCLCTDigi clct,
const GEMInternalCluster cluster,
const CSCL1TPLookupTableME11ILT lookupTableME11ILT,
const CSCL1TPLookupTableME21ILT lookupTableME21ILT 
) const

Definition at line 442 of file CSCGEMMatcher.cc.

References funct::abs(), CSCL1TPLookupTableME11ILT::es_diff_slope_L1_ME11a_even(), CSCL1TPLookupTableME11ILT::es_diff_slope_L1_ME11a_odd(), CSCL1TPLookupTableME11ILT::es_diff_slope_L1_ME11b_even(), CSCL1TPLookupTableME11ILT::es_diff_slope_L1_ME11b_odd(), CSCL1TPLookupTableME21ILT::es_diff_slope_L1_ME21_even(), CSCL1TPLookupTableME21ILT::es_diff_slope_L1_ME21_odd(), CSCL1TPLookupTableME11ILT::es_diff_slope_L2_ME11a_even(), CSCL1TPLookupTableME11ILT::es_diff_slope_L2_ME11a_odd(), CSCL1TPLookupTableME11ILT::es_diff_slope_L2_ME11b_even(), CSCL1TPLookupTableME11ILT::es_diff_slope_L2_ME11b_odd(), CSCL1TPLookupTableME21ILT::es_diff_slope_L2_ME21_even(), CSCL1TPLookupTableME21ILT::es_diff_slope_L2_ME21_odd(), CSCCLCTDigi::getKeyStrip(), isEven_, GEMInternalCluster::isMatchingLayer1(), GEMInternalCluster::isMatchingLayer2(), matchedClusterDistES(), CSCConstants::MAX_HALF_STRIP_ME1B, conifer::pow(), and station_.

445  {
446  const bool isME1a(station_ == 1 and clct.getKeyStrip() > CSCConstants::MAX_HALF_STRIP_ME1B);
447 
448  bool isLayer2 = false;
449  if (!cluster.isMatchingLayer1() and cluster.isMatchingLayer2())
450  isLayer2 = true;
451 
452  //ME1a necessitates a different treatment because of a different strip numbering scheme and strip width
453  const int SignedEighthStripDiff =
454  matchedClusterDistES(clct, cluster, isLayer2, true, lookupTableME11ILT, lookupTableME21ILT);
455  const unsigned eighthStripDiff = abs(SignedEighthStripDiff); //LUTs consider only absolute change
456 
457  //use LUTs to determine absolute slope, default 0
458  int slopeShift = 0;
459  if (station_ == 2) {
460  if (!isLayer2) {
461  if (isEven_)
462  slopeShift = lookupTableME21ILT->es_diff_slope_L1_ME21_even(eighthStripDiff);
463  else
464  slopeShift = lookupTableME21ILT->es_diff_slope_L1_ME21_odd(eighthStripDiff);
465  } else {
466  if (isEven_)
467  slopeShift = lookupTableME21ILT->es_diff_slope_L2_ME21_even(eighthStripDiff);
468  else
469  slopeShift = lookupTableME21ILT->es_diff_slope_L2_ME21_odd(eighthStripDiff);
470  }
471  } else if (station_ == 1) {
472  if (isME1a) { //is in ME1a
473  if (!isLayer2) {
474  if (isEven_)
475  slopeShift = lookupTableME11ILT->es_diff_slope_L1_ME11a_even(eighthStripDiff);
476  else
477  slopeShift = lookupTableME11ILT->es_diff_slope_L1_ME11a_odd(eighthStripDiff);
478  } else {
479  if (isEven_)
480  slopeShift = lookupTableME11ILT->es_diff_slope_L2_ME11a_even(eighthStripDiff);
481  else
482  slopeShift = lookupTableME11ILT->es_diff_slope_L2_ME11a_odd(eighthStripDiff);
483  }
484  } else {
485  if (!isLayer2) {
486  if (isEven_)
487  slopeShift = lookupTableME11ILT->es_diff_slope_L1_ME11b_even(eighthStripDiff);
488  else
489  slopeShift = lookupTableME11ILT->es_diff_slope_L1_ME11b_odd(eighthStripDiff);
490  } else {
491  if (isEven_)
492  slopeShift = lookupTableME11ILT->es_diff_slope_L2_ME11b_even(eighthStripDiff);
493  else
494  slopeShift = lookupTableME11ILT->es_diff_slope_L2_ME11b_odd(eighthStripDiff);
495  }
496  }
497  }
498 
499  //account for the sign of the difference
500  slopeShift *= pow(-1, std::signbit(SignedEighthStripDiff));
501 
502  return slopeShift;
503 }
unsigned es_diff_slope_L1_ME21_odd(unsigned es_diff) const
unsigned station_
unsigned es_diff_slope_L1_ME11a_even(unsigned es_diff) const
bool isMatchingLayer1() const
uint16_t getKeyStrip(const uint16_t n=2) const
Definition: CSCCLCTDigi.cc:107
unsigned es_diff_slope_L1_ME11b_even(unsigned es_diff) const
unsigned es_diff_slope_L2_ME11b_odd(unsigned es_diff) const
bool isMatchingLayer2() const
constexpr int pow(int x)
Definition: conifer.h:24
unsigned es_diff_slope_L1_ME11b_odd(unsigned es_diff) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int matchedClusterDistES(const CSCCLCTDigi &clct, const GEMInternalCluster &cluster, const bool isLayer2, const bool ForceTotal, const CSCL1TPLookupTableME11ILT *lookupTableME11ILT, const CSCL1TPLookupTableME21ILT *lookupTableME21ILT) const
unsigned es_diff_slope_L2_ME11a_even(unsigned es_diff) const
unsigned es_diff_slope_L2_ME21_odd(unsigned es_diff) const
unsigned es_diff_slope_L1_ME21_even(unsigned es_diff) const
unsigned es_diff_slope_L2_ME11b_even(unsigned es_diff) const
unsigned es_diff_slope_L2_ME21_even(unsigned es_diff) const
unsigned es_diff_slope_L1_ME11a_odd(unsigned es_diff) const
unsigned es_diff_slope_L2_ME11a_odd(unsigned es_diff) const

◆ CSCGEMSlopeCorrector()

int CSCGEMMatcher::CSCGEMSlopeCorrector ( const bool  isME1a,
const int  cscSlope,
bool  isLayer2,
const CSCL1TPLookupTableME11ILT lookupTableME11ILT,
const CSCL1TPLookupTableME21ILT lookupTableME21ILT 
) const
private

Definition at line 380 of file CSCGEMMatcher.cc.

References funct::abs(), chamber_, CSCL1TPLookupTableME11ILT::CSC_slope_corr_L1_ME11a_even(), CSCL1TPLookupTableME11ILT::CSC_slope_corr_L1_ME11a_odd(), CSCL1TPLookupTableME11ILT::CSC_slope_corr_L1_ME11b_even(), CSCL1TPLookupTableME11ILT::CSC_slope_corr_L1_ME11b_odd(), CSCL1TPLookupTableME21ILT::CSC_slope_corr_L1_ME21_even(), CSCL1TPLookupTableME21ILT::CSC_slope_corr_L1_ME21_odd(), CSCL1TPLookupTableME11ILT::CSC_slope_corr_L2_ME11a_even(), CSCL1TPLookupTableME11ILT::CSC_slope_corr_L2_ME11a_odd(), CSCL1TPLookupTableME11ILT::CSC_slope_corr_L2_ME11b_even(), CSCL1TPLookupTableME11ILT::CSC_slope_corr_L2_ME11b_odd(), CSCL1TPLookupTableME21ILT::CSC_slope_corr_L2_ME21_even(), CSCL1TPLookupTableME21ILT::CSC_slope_corr_L2_ME21_odd(), CSCL1TPLookupTableME11ILT::CSC_slope_cosi_corr_L1_ME11a_even(), CSCL1TPLookupTableME11ILT::CSC_slope_cosi_corr_L1_ME11a_odd(), CSCL1TPLookupTableME11ILT::CSC_slope_cosi_corr_L1_ME11b_even(), CSCL1TPLookupTableME11ILT::CSC_slope_cosi_corr_L1_ME11b_odd(), CSCL1TPLookupTableME21ILT::CSC_slope_cosi_corr_L1_ME21_even(), CSCL1TPLookupTableME21ILT::CSC_slope_cosi_corr_L1_ME21_odd(), mitigateSlopeByCosi_, conifer::pow(), and station_.

Referenced by matchedClusterDistES().

384  {
385  int SlopeShift = 0;
386  int SlopeSign = pow(-1, std::signbit(cscSlope));
387 
388  //account for slope mitigation by cosi, if opted-in
389  if (mitigateSlopeByCosi_) {
390  if (station_ == 1) {
391  if (chamber_ % 2 == 0)
392  SlopeShift = isME1a ? lookupTableME11ILT->CSC_slope_cosi_corr_L1_ME11a_even(std::abs(cscSlope))
393  : lookupTableME11ILT->CSC_slope_cosi_corr_L1_ME11b_even(std::abs(cscSlope));
394  else
395  SlopeShift = isME1a ? lookupTableME11ILT->CSC_slope_cosi_corr_L1_ME11a_odd(std::abs(cscSlope))
396  : lookupTableME11ILT->CSC_slope_cosi_corr_L1_ME11b_odd(std::abs(cscSlope));
397  } else if (station_ == 2) {
398  if (chamber_ % 2 == 0)
399  SlopeShift = lookupTableME21ILT->CSC_slope_cosi_corr_L1_ME21_even(std::abs(cscSlope));
400  else
401  SlopeShift = lookupTableME21ILT->CSC_slope_cosi_corr_L1_ME21_odd(std::abs(cscSlope));
402  }
403  } else { //account for slope without mitigation, if opted out
404  if (station_ == 1) {
405  if (!isLayer2) {
406  if (chamber_ % 2 == 0)
407  SlopeShift = isME1a ? lookupTableME11ILT->CSC_slope_corr_L1_ME11a_even(std::abs(cscSlope))
408  : lookupTableME11ILT->CSC_slope_corr_L1_ME11b_even(std::abs(cscSlope));
409  else
410  SlopeShift = isME1a ? lookupTableME11ILT->CSC_slope_corr_L1_ME11a_odd(std::abs(cscSlope))
411  : lookupTableME11ILT->CSC_slope_corr_L1_ME11b_odd(std::abs(cscSlope));
412  } else {
413  if (chamber_ % 2 == 0)
414  SlopeShift = isME1a ? lookupTableME11ILT->CSC_slope_corr_L2_ME11a_even(std::abs(cscSlope))
415  : lookupTableME11ILT->CSC_slope_corr_L2_ME11b_even(std::abs(cscSlope));
416  else
417  SlopeShift = isME1a ? lookupTableME11ILT->CSC_slope_corr_L2_ME11a_odd(std::abs(cscSlope))
418  : lookupTableME11ILT->CSC_slope_corr_L2_ME11b_odd(std::abs(cscSlope));
419  }
420  } else if (station_ == 2) {
421  if (!isLayer2) {
422  if (chamber_ % 2 == 0)
423  SlopeShift = lookupTableME21ILT->CSC_slope_corr_L1_ME21_even(std::abs(cscSlope));
424  else
425  SlopeShift = lookupTableME21ILT->CSC_slope_corr_L1_ME21_odd(std::abs(cscSlope));
426  } else {
427  if (chamber_ % 2 == 0)
428  SlopeShift = lookupTableME21ILT->CSC_slope_corr_L2_ME21_even(std::abs(cscSlope));
429  else
430  SlopeShift = lookupTableME21ILT->CSC_slope_corr_L2_ME21_odd(std::abs(cscSlope));
431  }
432  }
433  }
434  return std::round(SlopeShift * SlopeSign);
435 }
bool mitigateSlopeByCosi_
unsigned station_
unsigned CSC_slope_corr_L1_ME11a_even(unsigned channel) const
unsigned CSC_slope_corr_L2_ME11b_even(unsigned channel) const
unsigned CSC_slope_corr_L2_ME21_even(unsigned slope) const
constexpr int pow(int x)
Definition: conifer.h:24
unsigned CSC_slope_corr_L2_ME11a_even(unsigned channel) const
unsigned CSC_slope_cosi_corr_L1_ME11b_even(unsigned channel) const
unsigned CSC_slope_cosi_corr_L1_ME11a_even(unsigned channel) const
unsigned CSC_slope_corr_L2_ME11a_odd(unsigned channel) const
unsigned CSC_slope_corr_L1_ME21_even(unsigned slope) const
unsigned chamber_
unsigned CSC_slope_corr_L1_ME11b_odd(unsigned channel) const
unsigned CSC_slope_cosi_corr_L1_ME11a_odd(unsigned channel) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned CSC_slope_corr_L1_ME11a_odd(unsigned channel) const
unsigned CSC_slope_cosi_corr_L1_ME21_odd(unsigned slope) const
unsigned CSC_slope_corr_L1_ME21_odd(unsigned slope) const
unsigned CSC_slope_corr_L2_ME21_odd(unsigned slope) const
unsigned CSC_slope_cosi_corr_L1_ME21_even(unsigned slope) const
unsigned CSC_slope_corr_L1_ME11b_even(unsigned channel) const
unsigned CSC_slope_corr_L2_ME11b_odd(unsigned channel) const
unsigned CSC_slope_cosi_corr_L1_ME11b_odd(unsigned channel) const

◆ matchedClusterDistES()

int CSCGEMMatcher::matchedClusterDistES ( const CSCCLCTDigi clct,
const GEMInternalCluster cluster,
const bool  isLayer2,
const bool  ForceTotal,
const CSCL1TPLookupTableME11ILT lookupTableME11ILT,
const CSCL1TPLookupTableME21ILT lookupTableME21ILT 
) const

Definition at line 242 of file CSCGEMMatcher.cc.

References haddnano::cl, CSCGEMSlopeCorrector(), CSCCLCTDigi::getBend(), CSCCLCTDigi::getKeyStrip(), CSCCLCTDigi::getSlope(), matchCLCTpropagation_, CSCConstants::MAX_HALF_STRIP_ME1B, mitigatedSlopeByConsistency(), mitigateSlopeByCosi_, conifer::pow(), and station_.

Referenced by calculateGEMCSCBending(), and matchingClustersLoc().

247  {
248  const bool isME1a(station_ == 1 and clct.getKeyStrip() > CSCConstants::MAX_HALF_STRIP_ME1B);
249 
250  int cl_es = isME1a ? cl.getKeyStripME1a(8, isLayer2) : cl.getKeyStrip(8, isLayer2);
251 
252  int eighthStripDiff = cl_es - clct.getKeyStrip(8);
253 
254  if (matchCLCTpropagation_ and !ForceTotal) { //modification of DeltaStrip by CLCT slope
255  int SlopeShift = 0;
256  uint16_t baseSlope = -1;
257  baseSlope = mitigateSlopeByCosi_ ? mitigatedSlopeByConsistency(clct, lookupTableME11ILT, lookupTableME21ILT)
258  : clct.getSlope();
259 
260  int clctSlope = pow(-1, clct.getBend()) * baseSlope;
261 
262  SlopeShift = CSCGEMSlopeCorrector(isME1a, clctSlope, isLayer2, lookupTableME11ILT, lookupTableME21ILT);
263  eighthStripDiff -= SlopeShift;
264  }
265 
266  return eighthStripDiff;
267 }
bool mitigateSlopeByCosi_
unsigned station_
uint16_t getKeyStrip(const uint16_t n=2) const
Definition: CSCCLCTDigi.cc:107
constexpr int pow(int x)
Definition: conifer.h:24
uint16_t mitigatedSlopeByConsistency(const CSCCLCTDigi &clct, const CSCL1TPLookupTableME11ILT *lookupTableME11ILT, const CSCL1TPLookupTableME21ILT *lookupTableME21ILT) const
uint16_t getBend() const
Definition: CSCCLCTDigi.h:93
int CSCGEMSlopeCorrector(const bool isME1a, const int cscSlope, bool isLayer2, const CSCL1TPLookupTableME11ILT *lookupTableME11ILT, const CSCL1TPLookupTableME21ILT *lookupTableME21ILT) const
bool matchCLCTpropagation_

◆ matchingClustersLoc() [1/3]

void CSCGEMMatcher::matchingClustersLoc ( const CSCALCTDigi alct,
const GEMInternalClusters clusters,
GEMInternalClusters output 
) const

Definition at line 93 of file CSCGEMMatcher.cc.

References haddnano::cl, bsc_activity_cfg::clusters, CSCALCTDigi::getKeyWG(), CSCALCTDigi::isValid(), SiStripPI::max, maxDeltaWG_, SiStripPI::min, CSCConstants::NUM_WIREGROUPS_ME11, CSCConstants::NUM_WIREGROUPS_ME21, or, and station_.

Referenced by bestClusterLoc(), and matchingClustersLoc().

95  {
96  if (!alct.isValid() or clusters.empty())
97  return;
98 
99  int number_of_wg = 0;
100  if (station_ == 1)
101  number_of_wg = CSCConstants::NUM_WIREGROUPS_ME11;
102  else if (station_ == 2)
103  number_of_wg = CSCConstants::NUM_WIREGROUPS_ME21;
104 
105  // select clusters matched in wiregroup
106 
107  for (const auto& cl : clusters) {
108  // std::cout << "GEM cluster: " << cl << std::endl;
109  bool isMatchedLayer1 = false;
110  bool isMatchedLayer2 = false;
111 
112  if (cl.id1().layer() == 1) { // cluster has valid layer 1
113  int min_wg = std::max(0, int(cl.layer1_min_wg() - maxDeltaWG_));
114  int max_wg = std::min(number_of_wg - 1, int(cl.layer1_max_wg() + maxDeltaWG_));
115  if (min_wg <= alct.getKeyWG() and alct.getKeyWG() <= max_wg)
116  isMatchedLayer1 = true;
117  }
118  if (cl.id2().layer() == 2) { // cluster has valid layer 2
119  int min_wg = std::max(0, int(cl.layer2_min_wg() - maxDeltaWG_));
120  int max_wg = std::min(number_of_wg - 1, int(cl.layer2_max_wg() + maxDeltaWG_));
121  if (min_wg <= alct.getKeyWG() and alct.getKeyWG() <= max_wg)
122  isMatchedLayer2 = true;
123  }
124 
125  // std::cout << "ALCT-GEM matching L1-L2: " << isMatchedLayer1 << " " << isMatchedLayer2 << std::endl;
126 
127  if (isMatchedLayer1 or isMatchedLayer2) {
128  output.push_back(cl);
129  if (isMatchedLayer1)
130  output.back().set_matchingLayer1(true);
131  if (isMatchedLayer2)
132  output.back().set_matchingLayer2(true);
133  }
134  }
135 }
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:40
unsigned station_
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
uint16_t getKeyWG() const
return key wire group
Definition: CSCALCTDigi.h:67
Definition: output.py:1
unsigned maxDeltaWG_

◆ matchingClustersLoc() [2/3]

void CSCGEMMatcher::matchingClustersLoc ( const CSCCLCTDigi clct,
const GEMInternalClusters clusters,
GEMInternalClusters output,
bool  ignoreALCTGEMmatch,
const CSCL1TPLookupTableME11ILT lookupTableME11ILT,
const CSCL1TPLookupTableME21ILT lookupTableME21ILT 
) const

Definition at line 138 of file CSCGEMMatcher.cc.

References funct::abs(), haddnano::cl, GetRecoTauVFromDQM_MC_cff::cl2, bsc_activity_cfg::clusters, enable_match_gem_me1a_, enable_match_gem_me1b_, CSCCLCTDigi::getKeyStrip(), isEven_, CSCCLCTDigi::isValid(), matchedClusterDistES(), CSCConstants::MAX_HALF_STRIP_ME1B, maxDeltaHsEven_, maxDeltaHsOdd_, or, jetUpdater_cfi::sort, and station_.

143  {
144  if (!clct.isValid() or clusters.empty())
145  return;
146 
148  return;
149 
150  const bool isME1a(station_ == 1 and clct.getKeyStrip() > CSCConstants::MAX_HALF_STRIP_ME1B);
151 
152  //determine window size
153  unsigned eighthStripCut = isEven_ ? 4 * maxDeltaHsEven_ : 4 * maxDeltaHsOdd_; // Cut in 1/8 = 4 * cut in 1/2
154 
155  for (const auto& cl : clusters) {
156  // std::cout << "GEM cluster: " << cl << std::endl;
157  // if (!ignoreALCTGEMmatch) std::cout << "IN CLCT-GEM => ALCT-GEM matching L1-L2: " << cl.isMatchingLayer1() << " " << cl.isMatchingLayer2() << std::endl;
158 
159  bool isMatchedLayer1 = false;
160  bool isMatchedLayer2 = false;
161 
162  if (cl.id1().layer() == 1) { // cluster has valid layer 1
163  if ((station_ == 1 and enable_match_gem_me1a_ and
164  ((isME1a and cl.roll1() == 8) or (!isME1a and cl.roll1() < 8))) or
165  (station_ == 1 and !enable_match_gem_me1a_ and !isME1a) or (station_ == 2)) {
166  constexpr bool isLayer2 = false;
167  unsigned distanceES =
168  abs(matchedClusterDistES(clct, cl, isLayer2, false, lookupTableME11ILT, lookupTableME21ILT));
169  if (distanceES <= eighthStripCut)
170  isMatchedLayer1 = true;
171  }
172  }
173  if (cl.id2().layer() == 2) { // cluster has valid layer 2
174  if ((station_ == 1 and enable_match_gem_me1a_ and
175  ((isME1a and cl.roll2() == 8) or (!isME1a and cl.roll2() < 8))) or
176  (station_ == 1 and !enable_match_gem_me1a_ and !isME1a) or (station_ == 2)) {
177  constexpr bool isLayer2 = true;
178  unsigned distanceES =
179  abs(matchedClusterDistES(clct, cl, isLayer2, false, lookupTableME11ILT, lookupTableME21ILT));
180  if (distanceES <= eighthStripCut)
181  isMatchedLayer2 = true;
182  }
183  }
184 
185  // std::cout << "CLCT-GEM matching L1-L2: " << isMatchedLayer1 << " " << isMatchedLayer2 << std::endl;
186 
187  if (((ignoreALCTGEMmatch or cl.isMatchingLayer1()) and isMatchedLayer1) or
188  ((ignoreALCTGEMmatch or cl.isMatchingLayer2()) and isMatchedLayer2)) {
189  output.push_back(cl);
190  output.back().set_matchingLayer1(false);
191  output.back().set_matchingLayer2(false);
192  if ((ignoreALCTGEMmatch or cl.isMatchingLayer1()) and isMatchedLayer1)
193  output.back().set_matchingLayer1(true);
194  if ((ignoreALCTGEMmatch or cl.isMatchingLayer2()) and isMatchedLayer2)
195  output.back().set_matchingLayer2(true);
196  }
197  }
198 
199  // Sorting of matching cluster prefers copads and ordering by smallest relative distance
200  std::sort(
201  output.begin(),
202  output.end(),
203  [clct, lookupTableME11ILT, lookupTableME21ILT, this](const GEMInternalCluster cl1,
204  const GEMInternalCluster cl2) -> bool {
205  if (cl1.isCoincidence() and !cl2.isCoincidence())
206  return cl1.isCoincidence();
207  else if ((cl1.isCoincidence() and cl2.isCoincidence()) or (!cl1.isCoincidence() and !cl2.isCoincidence())) {
208  bool cl1_isLayer2 = !cl1.isMatchingLayer1() and cl1.isMatchingLayer2();
209  bool cl2_isLayer2 = !cl2.isMatchingLayer1() and cl2.isMatchingLayer2();
210  unsigned cl1_distanceES =
211  abs(matchedClusterDistES(clct, cl1, cl1_isLayer2, false, lookupTableME11ILT, lookupTableME21ILT));
212  unsigned cl2_distanceES =
213  abs(matchedClusterDistES(clct, cl2, cl2_isLayer2, false, lookupTableME11ILT, lookupTableME21ILT));
214  return cl1_distanceES < cl2_distanceES;
215  } else
216  return false;
217  });
218 }
unsigned maxDeltaHsOdd_
unsigned station_
uint16_t getKeyStrip(const uint16_t n=2) const
Definition: CSCCLCTDigi.cc:107
unsigned maxDeltaHsEven_
bool enable_match_gem_me1b_
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
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:50
bool enable_match_gem_me1a_
int matchedClusterDistES(const CSCCLCTDigi &clct, const GEMInternalCluster &cluster, const bool isLayer2, const bool ForceTotal, const CSCL1TPLookupTableME11ILT *lookupTableME11ILT, const CSCL1TPLookupTableME21ILT *lookupTableME21ILT) const
Definition: output.py:1

◆ matchingClustersLoc() [3/3]

void CSCGEMMatcher::matchingClustersLoc ( const CSCALCTDigi alct,
const CSCCLCTDigi clct,
const GEMInternalClusters clusters,
const CSCL1TPLookupTableME11ILT lookupTableME11ILT,
const CSCL1TPLookupTableME21ILT lookupTableME21ILT,
GEMInternalClusters output 
) const

Definition at line 220 of file CSCGEMMatcher.cc.

References bsc_activity_cfg::clusters, CSCALCTDigi::isValid(), CSCCLCTDigi::isValid(), matchingClustersLoc(), and or.

225  {
226  // both need to be valid
227  if (!alct.isValid() or !clct.isValid() or clusters.empty())
228  return;
229 
230  // get the single matches
231  bool ignoreALCTGEMmatch = false;
232  GEMInternalClusters alctClusters;
233  matchingClustersLoc(alct, clusters, alctClusters);
234  matchingClustersLoc(clct, alctClusters, output, ignoreALCTGEMmatch, lookupTableME11ILT, lookupTableME21ILT);
235 }
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:40
void matchingClustersLoc(const CSCALCTDigi &alct, const GEMInternalClusters &clusters, GEMInternalClusters &output) 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
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:50
std::vector< GEMInternalCluster > GEMInternalClusters
Definition: CSCGEMMatcher.h:27
Definition: output.py:1

◆ mitigatedSlopeByConsistency()

uint16_t CSCGEMMatcher::mitigatedSlopeByConsistency ( const CSCCLCTDigi clct,
const CSCL1TPLookupTableME11ILT lookupTableME11ILT,
const CSCL1TPLookupTableME21ILT lookupTableME21ILT 
) const
private

Definition at line 274 of file CSCGEMMatcher.cc.

References funct::abs(), reco::ceil(), chamber_, CSCL1TPLookupTableME11ILT::CSC_slope_cosi_2to1_L1_ME11a_even(), CSCL1TPLookupTableME11ILT::CSC_slope_cosi_2to1_L1_ME11a_odd(), CSCL1TPLookupTableME11ILT::CSC_slope_cosi_2to1_L1_ME11b_even(), CSCL1TPLookupTableME11ILT::CSC_slope_cosi_2to1_L1_ME11b_odd(), CSCL1TPLookupTableME21ILT::CSC_slope_cosi_2to1_L1_ME21_even(), CSCL1TPLookupTableME21ILT::CSC_slope_cosi_2to1_L1_ME21_odd(), CSCL1TPLookupTableME11ILT::CSC_slope_cosi_3to1_L1_ME11a_even(), CSCL1TPLookupTableME11ILT::CSC_slope_cosi_3to1_L1_ME11a_odd(), CSCL1TPLookupTableME11ILT::CSC_slope_cosi_3to1_L1_ME11b_even(), CSCL1TPLookupTableME11ILT::CSC_slope_cosi_3to1_L1_ME11b_odd(), CSCL1TPLookupTableME21ILT::CSC_slope_cosi_3to1_L1_ME21_even(), CSCL1TPLookupTableME21ILT::CSC_slope_cosi_3to1_L1_ME21_odd(), CSCCLCTDigi::getHits(), CSCCLCTDigi::getKeyStrip(), CSCCLCTDigi::getSlope(), createfilelist::int, nano_mu_digi_cff::layer, CSCConstants::MAX_HALF_STRIP_ME1B, position, and station_.

Referenced by matchedClusterDistES().

276  {
277  const bool isME1a(station_ == 1 and clct.getKeyStrip() > CSCConstants::MAX_HALF_STRIP_ME1B);
278 
279  // extract hit values from CLCT hit matrix
280  std::vector<std::vector<uint16_t>> CLCTHitMatrix = clct.getHits();
281  int CLCTHits[6] = {-1, -1, -1, -1, -1, -1};
282 
283  for (unsigned layer = 0; layer < CLCTHitMatrix.size(); ++layer) {
284  for (unsigned position = 0; position < CLCTHitMatrix.at(layer).size(); ++position) {
285  const uint16_t value = CLCTHitMatrix.at(layer).at(position);
286  if (value != 0 && value != 65535) {
287  CLCTHits[layer] = (int)value;
288  break;
289  }
290  }
291  }
292 
293  //Debugging
294  //std::cout<<"CLCT Hits = "<<CLCTHits[0]<<", "<<CLCTHits[1]<<", "<<CLCTHits[2]<<", "<<CLCTHits[3]<<", "<<CLCTHits[4]<<", "<<CLCTHits[5]<<std::endl;
295 
296  //calculate slope consistency
297  float MinMaxPairDifferences[2] = {999., -999.};
298  for (unsigned First = 0; First < 5; ++First) {
299  //skip empty layers
300  if (CLCTHits[First] == -1)
301  continue;
302  for (unsigned Second = First + 1; Second < 6; ++Second) {
303  //skip empty layers
304  if (CLCTHits[Second] == -1)
305  continue;
306  float PairDifference = (CLCTHits[First] - CLCTHits[Second]) / (float)(Second - First);
307  if (PairDifference < MinMaxPairDifferences[0])
308  MinMaxPairDifferences[0] = PairDifference;
309  if (PairDifference > MinMaxPairDifferences[1])
310  MinMaxPairDifferences[1] = PairDifference;
311  }
312  }
313 
314  //calculate consistency of slope indicator: cosi
315  uint16_t cosi = std::ceil(std::abs(MinMaxPairDifferences[1] - MinMaxPairDifferences[0]));
316  //Debugging
317  //std::cout<<"COSI = "<<cosi<<std::endl;
318 
319  //disambiguate cosi cases
320 
321  //extremely inconsistent track, deprecate slope
322  if (cosi > 3)
323  return 0;
324  //consistent slope, do not change
325  else if (cosi < 2)
326  return clct.getSlope();
327  //need to look up in table 2->1
328  else if (cosi == 2) {
329  if (station_ == 1) {
330  if (isME1a) {
331  if (chamber_ % 2 == 0)
332  return lookupTableME11ILT->CSC_slope_cosi_2to1_L1_ME11a_even(clct.getSlope());
333  else
334  return lookupTableME11ILT->CSC_slope_cosi_2to1_L1_ME11a_odd(clct.getSlope());
335  } else {
336  if (chamber_ % 2 == 0)
337  return lookupTableME11ILT->CSC_slope_cosi_2to1_L1_ME11b_even(clct.getSlope());
338  else
339  return lookupTableME11ILT->CSC_slope_cosi_2to1_L1_ME11b_odd(clct.getSlope());
340  }
341  } else {
342  if (chamber_ % 2 == 0)
343  return lookupTableME21ILT->CSC_slope_cosi_2to1_L1_ME21_even(clct.getSlope());
344  else
345  return lookupTableME21ILT->CSC_slope_cosi_2to1_L1_ME21_odd(clct.getSlope());
346  }
347  }
348  //need to look up in table 3->1
349  else if (cosi == 3) {
350  if (station_ == 1) {
351  if (isME1a) {
352  if (chamber_ % 2 == 0)
353  return lookupTableME11ILT->CSC_slope_cosi_3to1_L1_ME11a_even(clct.getSlope());
354  else
355  return lookupTableME11ILT->CSC_slope_cosi_3to1_L1_ME11a_odd(clct.getSlope());
356  } else {
357  if (chamber_ % 2 == 0)
358  return lookupTableME11ILT->CSC_slope_cosi_3to1_L1_ME11b_even(clct.getSlope());
359  else
360  return lookupTableME11ILT->CSC_slope_cosi_3to1_L1_ME11b_odd(clct.getSlope());
361  }
362  } else {
363  if (chamber_ % 2 == 0)
364  return lookupTableME21ILT->CSC_slope_cosi_3to1_L1_ME21_even(clct.getSlope());
365  else
366  return lookupTableME21ILT->CSC_slope_cosi_3to1_L1_ME21_odd(clct.getSlope());
367  }
368  }
369  //just to avoid compiler errors an error code
370  else {
371  return 999;
372  }
373 }
constexpr int32_t ceil(float num)
unsigned CSC_slope_cosi_2to1_L1_ME21_odd(unsigned slope) const
unsigned CSC_slope_cosi_2to1_L1_ME21_even(unsigned slope) const
unsigned station_
unsigned CSC_slope_cosi_3to1_L1_ME11b_odd(unsigned channel) const
uint16_t getKeyStrip(const uint16_t n=2) const
Definition: CSCCLCTDigi.cc:107
unsigned CSC_slope_cosi_3to1_L1_ME11a_even(unsigned channel) const
unsigned CSC_slope_cosi_2to1_L1_ME11b_even(unsigned channel) const
unsigned CSC_slope_cosi_2to1_L1_ME11b_odd(unsigned channel) const
unsigned chamber_
unsigned CSC_slope_cosi_2to1_L1_ME11a_even(unsigned channel) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: value.py:1
unsigned CSC_slope_cosi_3to1_L1_ME21_odd(unsigned slope) const
unsigned CSC_slope_cosi_3to1_L1_ME11a_odd(unsigned channel) const
unsigned CSC_slope_cosi_2to1_L1_ME11a_odd(unsigned channel) const
const ComparatorContainer & getHits() const
Definition: CSCCLCTDigi.h:176
static int position[264][3]
Definition: ReadPGInfo.cc:289
uint16_t getSlope() const
return the slope
Definition: CSCCLCTDigi.h:74
unsigned CSC_slope_cosi_3to1_L1_ME21_even(unsigned slope) const
unsigned CSC_slope_cosi_3to1_L1_ME11b_even(unsigned channel) const

Member Data Documentation

◆ assign_gem_csc_bending_

bool CSCGEMMatcher::assign_gem_csc_bending_
private

Definition at line 123 of file CSCGEMMatcher.h.

Referenced by CSCGEMMatcher().

◆ chamber_

unsigned CSCGEMMatcher::chamber_
private

◆ enable_match_gem_me1a_

bool CSCGEMMatcher::enable_match_gem_me1a_
private

Definition at line 112 of file CSCGEMMatcher.h.

Referenced by CSCGEMMatcher(), and matchingClustersLoc().

◆ enable_match_gem_me1b_

bool CSCGEMMatcher::enable_match_gem_me1b_
private

Definition at line 113 of file CSCGEMMatcher.h.

Referenced by CSCGEMMatcher(), and matchingClustersLoc().

◆ endcap_

unsigned CSCGEMMatcher::endcap_
private

Definition at line 105 of file CSCGEMMatcher.h.

◆ isEven_

bool CSCGEMMatcher::isEven_
private

Definition at line 109 of file CSCGEMMatcher.h.

Referenced by calculateGEMCSCBending(), CSCGEMMatcher(), and matchingClustersLoc().

◆ matchCLCTpropagation_

bool CSCGEMMatcher::matchCLCTpropagation_
private

Definition at line 116 of file CSCGEMMatcher.h.

Referenced by CSCGEMMatcher(), and matchedClusterDistES().

◆ maxDeltaHsEven_

unsigned CSCGEMMatcher::maxDeltaHsEven_
private

Definition at line 120 of file CSCGEMMatcher.h.

Referenced by CSCGEMMatcher(), and matchingClustersLoc().

◆ maxDeltaHsOdd_

unsigned CSCGEMMatcher::maxDeltaHsOdd_
private

Definition at line 121 of file CSCGEMMatcher.h.

Referenced by CSCGEMMatcher(), and matchingClustersLoc().

◆ maxDeltaWG_

unsigned CSCGEMMatcher::maxDeltaWG_
private

Definition at line 119 of file CSCGEMMatcher.h.

Referenced by CSCGEMMatcher(), and matchingClustersLoc().

◆ mitigateSlopeByCosi_

bool CSCGEMMatcher::mitigateSlopeByCosi_
private

Definition at line 124 of file CSCGEMMatcher.h.

Referenced by CSCGEMMatcher(), CSCGEMSlopeCorrector(), and matchedClusterDistES().

◆ ring_

unsigned CSCGEMMatcher::ring_
private

Definition at line 107 of file CSCGEMMatcher.h.

◆ station_

unsigned CSCGEMMatcher::station_
private