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, GEMInternalCluster &best) const
 
void bestClusterLoc (const CSCALCTDigi &alct, const CSCCLCTDigi &clct, const GEMInternalClusters &clusters, GEMInternalCluster &best) const
 
int calculateGEMCSCBending (const CSCCLCTDigi &clct, const GEMInternalCluster &cluster) 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
 
void matchingClustersLoc (const CSCALCTDigi &alct, const GEMInternalClusters &clusters, GEMInternalClusters &output) const
 
void matchingClustersLoc (const CSCCLCTDigi &clct, const GEMInternalClusters &clusters, GEMInternalClusters &output, bool ignoreALCTGEMmatch) const
 
void matchingClustersLoc (const CSCALCTDigi &alct, const CSCCLCTDigi &clct, const GEMInternalClusters &clusters, GEMInternalClusters &output) const
 
void setESLookupTables (const CSCL1TPLookupTableME11ILT *conf)
 
void setESLookupTables (const CSCL1TPLookupTableME21ILT *conf)
 

Private Member Functions

int CSCGEMSlopeCorrector (const bool isME1a, const int cscSlope, bool isLayer2) const
 
uint16_t mitigatedSlopeByConsistency (const CSCCLCTDigi &clct) const
 

Private Attributes

bool assign_gem_csc_bending_
 
unsigned chamber_
 
bool enable_match_gem_me1a_
 
bool enable_match_gem_me1b_
 
unsigned endcap_
 
bool isEven_
 
const CSCL1TPLookupTableME11ILTlookupTableME11ILT_
 
const CSCL1TPLookupTableME21ILTlookupTableME21ILT_
 
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_
Definition: CSCGEMMatcher.h:92
bool assign_gem_csc_bending_
unsigned maxDeltaHsEven_
unsigned chamber_
Definition: CSCGEMMatcher.h:94
bool enable_match_gem_me1b_
Definition: CSCGEMMatcher.h:99
bool enable_match_gem_me1a_
Definition: CSCGEMMatcher.h:98
unsigned endcap_
Definition: CSCGEMMatcher.h:91
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 37 of file CSCGEMMatcher.cc.

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

39  {
40  if (!alct.isValid() or clusters.empty())
41  return;
42 
43  // match spatially
44  GEMInternalClusters clustersLoc;
45  matchingClustersLoc(alct, clusters, clustersLoc);
46 
47  // simply pick the first matching one
48  if (!clustersLoc.empty())
49  best = clustersLoc[0];
50 }
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,
GEMInternalCluster best 
) const

Definition at line 52 of file CSCGEMMatcher.cc.

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

54  {
55  if (!clct.isValid() or clusters.empty())
56  return;
57 
58  // match spatially
59  bool ignoreALCTGEMmatch = true;
60  GEMInternalClusters clustersLoc;
61  matchingClustersLoc(clct, clusters, clustersLoc, ignoreALCTGEMmatch);
62 
63  // the first matching one is also the closest in phi distance (to expected position, if extrapolating), by ordered list in CLCT matching
64  if (!clustersLoc.empty())
65  best = clustersLoc[0];
66 }
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,
GEMInternalCluster best 
) const

Definition at line 68 of file CSCGEMMatcher.cc.

References bsc_activity_cfg::clusters, GEMInternalCluster::isCoincidence(), GEMInternalCluster::isMatchingLayer1(), GEMInternalCluster::isMatchingLayer2(), CSCALCTDigi::isValid(), CSCCLCTDigi::isValid(), matchingClustersLoc(), or, and GEMInternalCluster::set_coincidence().

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, 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 isCoincidence() const
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:40
void set_coincidence(const bool isCoincidence)
bool isMatchingLayer1() const
bool isMatchingLayer2() const
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

Definition at line 422 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(), lookupTableME11ILT_, lookupTableME21ILT_, matchedClusterDistES(), CSCConstants::MAX_HALF_STRIP_ME1B, funct::pow(), and station_.

422  {
423  const bool isME1a(station_ == 1 and clct.getKeyStrip() > CSCConstants::MAX_HALF_STRIP_ME1B);
424 
425  bool isLayer2 = false;
426  if (!cluster.isMatchingLayer1() and cluster.isMatchingLayer2())
427  isLayer2 = true;
428 
429  //ME1a necessitates a different treatment because of a different strip numbering scheme and strip width
430  const int SignedEighthStripDiff = matchedClusterDistES(clct, cluster, isLayer2, true);
431  const unsigned eighthStripDiff = abs(SignedEighthStripDiff); //LUTs consider only absolute change
432 
433  //use LUTs to determine absolute slope, default 0
434  int slopeShift = 0;
435  if (station_ == 2) {
436  if (!isLayer2) {
437  if (isEven_)
438  slopeShift = lookupTableME21ILT_->es_diff_slope_L1_ME21_even(eighthStripDiff);
439  else
440  slopeShift = lookupTableME21ILT_->es_diff_slope_L1_ME21_odd(eighthStripDiff);
441  } else {
442  if (isEven_)
443  slopeShift = lookupTableME21ILT_->es_diff_slope_L2_ME21_even(eighthStripDiff);
444  else
445  slopeShift = lookupTableME21ILT_->es_diff_slope_L2_ME21_odd(eighthStripDiff);
446  }
447  } else if (station_ == 1) {
448  if (isME1a) { //is in ME1a
449  if (!isLayer2) {
450  if (isEven_)
451  slopeShift = lookupTableME11ILT_->es_diff_slope_L1_ME11a_even(eighthStripDiff);
452  else
453  slopeShift = lookupTableME11ILT_->es_diff_slope_L1_ME11a_odd(eighthStripDiff);
454  } else {
455  if (isEven_)
456  slopeShift = lookupTableME11ILT_->es_diff_slope_L2_ME11a_even(eighthStripDiff);
457  else
458  slopeShift = lookupTableME11ILT_->es_diff_slope_L2_ME11a_odd(eighthStripDiff);
459  }
460  } else {
461  if (!isLayer2) {
462  if (isEven_)
463  slopeShift = lookupTableME11ILT_->es_diff_slope_L1_ME11b_even(eighthStripDiff);
464  else
465  slopeShift = lookupTableME11ILT_->es_diff_slope_L1_ME11b_odd(eighthStripDiff);
466  } else {
467  if (isEven_)
468  slopeShift = lookupTableME11ILT_->es_diff_slope_L2_ME11b_even(eighthStripDiff);
469  else
470  slopeShift = lookupTableME11ILT_->es_diff_slope_L2_ME11b_odd(eighthStripDiff);
471  }
472  }
473  }
474 
475  //account for the sign of the difference
476  slopeShift *= pow(-1, std::signbit(SignedEighthStripDiff));
477 
478  return slopeShift;
479 }
unsigned es_diff_slope_L1_ME21_odd(unsigned es_diff) const
unsigned station_
Definition: CSCGEMMatcher.h:92
unsigned es_diff_slope_L1_ME11a_even(unsigned es_diff) const
bool isMatchingLayer1() const
int matchedClusterDistES(const CSCCLCTDigi &clct, const GEMInternalCluster &cluster, const bool isLayer2, const bool ForceTotal) 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
unsigned es_diff_slope_L1_ME11b_odd(unsigned es_diff) const
const CSCL1TPLookupTableME11ILT * lookupTableME11ILT_
Definition: CSCGEMMatcher.h:82
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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
const CSCL1TPLookupTableME21ILT * lookupTableME21ILT_
Definition: CSCGEMMatcher.h:83
unsigned es_diff_slope_L2_ME11a_odd(unsigned es_diff) const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ CSCGEMSlopeCorrector()

int CSCGEMMatcher::CSCGEMSlopeCorrector ( const bool  isME1a,
const int  cscSlope,
bool  isLayer2 
) const
private

Definition at line 364 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(), lookupTableME11ILT_, lookupTableME21ILT_, mitigateSlopeByCosi_, funct::pow(), and station_.

Referenced by matchedClusterDistES().

364  {
365  int SlopeShift = 0;
366  int SlopeSign = pow(-1, std::signbit(cscSlope));
367 
368  //account for slope mitigation by cosi, if opted-in
369  if (mitigateSlopeByCosi_) {
370  if (station_ == 1) {
371  if (chamber_ % 2 == 0)
372  SlopeShift = isME1a ? lookupTableME11ILT_->CSC_slope_cosi_corr_L1_ME11a_even(std::abs(cscSlope))
374  else
375  SlopeShift = isME1a ? lookupTableME11ILT_->CSC_slope_cosi_corr_L1_ME11a_odd(std::abs(cscSlope))
377  } else if (station_ == 2) {
378  if (chamber_ % 2 == 0)
380  else
382  }
383  } else { //account for slope without mitigation, if opted out
384  if (station_ == 1) {
385  if (!isLayer2) {
386  if (chamber_ % 2 == 0)
387  SlopeShift = isME1a ? lookupTableME11ILT_->CSC_slope_corr_L1_ME11a_even(std::abs(cscSlope))
389  else
390  SlopeShift = isME1a ? lookupTableME11ILT_->CSC_slope_corr_L1_ME11a_odd(std::abs(cscSlope))
392  } else {
393  if (chamber_ % 2 == 0)
394  SlopeShift = isME1a ? lookupTableME11ILT_->CSC_slope_corr_L2_ME11a_even(std::abs(cscSlope))
396  else
397  SlopeShift = isME1a ? lookupTableME11ILT_->CSC_slope_corr_L2_ME11a_odd(std::abs(cscSlope))
399  }
400  } else if (station_ == 2) {
401  if (!isLayer2) {
402  if (chamber_ % 2 == 0)
404  else
406  } else {
407  if (chamber_ % 2 == 0)
409  else
411  }
412  }
413  }
414  return std::round(SlopeShift * SlopeSign);
415 }
bool mitigateSlopeByCosi_
unsigned station_
Definition: CSCGEMMatcher.h:92
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
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_
Definition: CSCGEMMatcher.h:94
unsigned CSC_slope_corr_L1_ME11b_odd(unsigned channel) const
const CSCL1TPLookupTableME11ILT * lookupTableME11ILT_
Definition: CSCGEMMatcher.h:82
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
const CSCL1TPLookupTableME21ILT * lookupTableME21ILT_
Definition: CSCGEMMatcher.h:83
unsigned CSC_slope_corr_L1_ME11b_even(unsigned channel) const
unsigned CSC_slope_corr_L2_ME11b_odd(unsigned channel) const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
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

Definition at line 231 of file CSCGEMMatcher.cc.

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

Referenced by calculateGEMCSCBending(), and matchingClustersLoc().

234  {
235  const bool isME1a(station_ == 1 and clct.getKeyStrip() > CSCConstants::MAX_HALF_STRIP_ME1B);
236 
237  int cl_es = isME1a ? cl.getKeyStripME1a(8, isLayer2) : cl.getKeyStrip(8, isLayer2);
238 
239  int eighthStripDiff = cl_es - clct.getKeyStrip(8);
240 
241  if (matchCLCTpropagation_ and !ForceTotal) { //modification of DeltaStrip by CLCT slope
242  int SlopeShift = 0;
243  uint16_t baseSlope = -1;
244  baseSlope = mitigateSlopeByCosi_ ? mitigatedSlopeByConsistency(clct) : clct.getSlope();
245 
246  int clctSlope = pow(-1, clct.getBend()) * baseSlope;
247 
248  SlopeShift = CSCGEMSlopeCorrector(isME1a, clctSlope, isLayer2);
249  eighthStripDiff -= SlopeShift;
250  }
251 
252  return eighthStripDiff;
253 }
bool mitigateSlopeByCosi_
unsigned station_
Definition: CSCGEMMatcher.h:92
uint16_t getKeyStrip(const uint16_t n=2) const
Definition: CSCCLCTDigi.cc:107
uint16_t getBend() const
Definition: CSCCLCTDigi.h:93
int CSCGEMSlopeCorrector(const bool isME1a, const int cscSlope, bool isLayer2) const
bool matchCLCTpropagation_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
uint16_t mitigatedSlopeByConsistency(const CSCCLCTDigi &clct) const

◆ 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, convertSQLitetoXML_cfg::output, 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_
Definition: CSCGEMMatcher.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
uint16_t getKeyWG() const
return key wire group
Definition: CSCALCTDigi.h:67
unsigned maxDeltaWG_

◆ matchingClustersLoc() [2/3]

void CSCGEMMatcher::matchingClustersLoc ( const CSCCLCTDigi clct,
const GEMInternalClusters clusters,
GEMInternalClusters output,
bool  ignoreALCTGEMmatch 
) 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, convertSQLitetoXML_cfg::output, jetUpdater_cfi::sort, and station_.

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

◆ matchingClustersLoc() [3/3]

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

Definition at line 211 of file CSCGEMMatcher.cc.

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

214  {
215  // both need to be valid
216  if (!alct.isValid() or !clct.isValid() or clusters.empty())
217  return;
218 
219  // get the single matches
220  bool ignoreALCTGEMmatch = false;
221  GEMInternalClusters alctClusters;
222  matchingClustersLoc(alct, clusters, alctClusters);
223  matchingClustersLoc(clct, alctClusters, output, ignoreALCTGEMmatch);
224 }
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

◆ mitigatedSlopeByConsistency()

uint16_t CSCGEMMatcher::mitigatedSlopeByConsistency ( const CSCCLCTDigi clct) const
private

Definition at line 260 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, phase1PixelTopology::layer, lookupTableME11ILT_, lookupTableME21ILT_, CSCConstants::MAX_HALF_STRIP_ME1B, position, and station_.

Referenced by matchedClusterDistES().

260  {
261  const bool isME1a(station_ == 1 and clct.getKeyStrip() > CSCConstants::MAX_HALF_STRIP_ME1B);
262 
263  // extract hit values from CLCT hit matrix
264  std::vector<std::vector<uint16_t>> CLCTHitMatrix = clct.getHits();
265  int CLCTHits[6] = {-1, -1, -1, -1, -1, -1};
266 
267  for (unsigned layer = 0; layer < CLCTHitMatrix.size(); ++layer) {
268  for (unsigned position = 0; position < CLCTHitMatrix.at(layer).size(); ++position) {
269  const uint16_t value = CLCTHitMatrix.at(layer).at(position);
270  if (value != 0 && value != 65535) {
271  CLCTHits[layer] = (int)value;
272  break;
273  }
274  }
275  }
276 
277  //Debugging
278  //std::cout<<"CLCT Hits = "<<CLCTHits[0]<<", "<<CLCTHits[1]<<", "<<CLCTHits[2]<<", "<<CLCTHits[3]<<", "<<CLCTHits[4]<<", "<<CLCTHits[5]<<std::endl;
279 
280  //calculate slope consistency
281  float MinMaxPairDifferences[2] = {999., -999.};
282  for (unsigned First = 0; First < 5; ++First) {
283  //skip empty layers
284  if (CLCTHits[First] == -1)
285  continue;
286  for (unsigned Second = First + 1; Second < 6; ++Second) {
287  //skip empty layers
288  if (CLCTHits[Second] == -1)
289  continue;
290  float PairDifference = (CLCTHits[First] - CLCTHits[Second]) / (float)(Second - First);
291  if (PairDifference < MinMaxPairDifferences[0])
292  MinMaxPairDifferences[0] = PairDifference;
293  if (PairDifference > MinMaxPairDifferences[1])
294  MinMaxPairDifferences[1] = PairDifference;
295  }
296  }
297 
298  //calculate consistency of slope indicator: cosi
299  uint16_t cosi = std::ceil(std::abs(MinMaxPairDifferences[1] - MinMaxPairDifferences[0]));
300  //Debugging
301  //std::cout<<"COSI = "<<cosi<<std::endl;
302 
303  //disambiguate cosi cases
304 
305  //extremely inconsistent track, deprecate slope
306  if (cosi > 3)
307  return 0;
308  //consistent slope, do not change
309  else if (cosi < 2)
310  return clct.getSlope();
311  //need to look up in table 2->1
312  else if (cosi == 2) {
313  if (station_ == 1) {
314  if (isME1a) {
315  if (chamber_ % 2 == 0)
317  else
319  } else {
320  if (chamber_ % 2 == 0)
322  else
324  }
325  } else {
326  if (chamber_ % 2 == 0)
328  else
330  }
331  }
332  //need to look up in table 3->1
333  else if (cosi == 3) {
334  if (station_ == 1) {
335  if (isME1a) {
336  if (chamber_ % 2 == 0)
338  else
340  } else {
341  if (chamber_ % 2 == 0)
343  else
345  }
346  } else {
347  if (chamber_ % 2 == 0)
349  else
351  }
352  }
353  //just to avoid compiler errors an error code
354  else {
355  return 999;
356  }
357 }
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_
Definition: CSCGEMMatcher.h:92
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
constexpr std::array< uint8_t, layerIndexSize > layer
unsigned CSC_slope_cosi_2to1_L1_ME11b_odd(unsigned channel) const
unsigned chamber_
Definition: CSCGEMMatcher.h:94
unsigned CSC_slope_cosi_2to1_L1_ME11a_even(unsigned channel) const
const CSCL1TPLookupTableME11ILT * lookupTableME11ILT_
Definition: CSCGEMMatcher.h:82
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
const CSCL1TPLookupTableME21ILT * lookupTableME21ILT_
Definition: CSCGEMMatcher.h:83
unsigned CSC_slope_cosi_3to1_L1_ME21_even(unsigned slope) const
unsigned CSC_slope_cosi_3to1_L1_ME11b_even(unsigned channel) const

◆ setESLookupTables() [1/2]

void CSCGEMMatcher::setESLookupTables ( const CSCL1TPLookupTableME11ILT conf)

Definition at line 29 of file CSCGEMMatcher.cc.

References lookupTableME11ILT_.

29 { lookupTableME11ILT_ = conf; }
const CSCL1TPLookupTableME11ILT * lookupTableME11ILT_
Definition: CSCGEMMatcher.h:82

◆ setESLookupTables() [2/2]

void CSCGEMMatcher::setESLookupTables ( const CSCL1TPLookupTableME21ILT conf)

Definition at line 31 of file CSCGEMMatcher.cc.

References lookupTableME21ILT_.

31 { lookupTableME21ILT_ = conf; }
const CSCL1TPLookupTableME21ILT * lookupTableME21ILT_
Definition: CSCGEMMatcher.h:83

Member Data Documentation

◆ assign_gem_csc_bending_

bool CSCGEMMatcher::assign_gem_csc_bending_
private

Definition at line 109 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 98 of file CSCGEMMatcher.h.

Referenced by CSCGEMMatcher(), and matchingClustersLoc().

◆ enable_match_gem_me1b_

bool CSCGEMMatcher::enable_match_gem_me1b_
private

Definition at line 99 of file CSCGEMMatcher.h.

Referenced by CSCGEMMatcher(), and matchingClustersLoc().

◆ endcap_

unsigned CSCGEMMatcher::endcap_
private

Definition at line 91 of file CSCGEMMatcher.h.

◆ isEven_

bool CSCGEMMatcher::isEven_
private

Definition at line 95 of file CSCGEMMatcher.h.

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

◆ lookupTableME11ILT_

const CSCL1TPLookupTableME11ILT* CSCGEMMatcher::lookupTableME11ILT_
private

◆ lookupTableME21ILT_

const CSCL1TPLookupTableME21ILT* CSCGEMMatcher::lookupTableME21ILT_
private

◆ matchCLCTpropagation_

bool CSCGEMMatcher::matchCLCTpropagation_
private

Definition at line 102 of file CSCGEMMatcher.h.

Referenced by CSCGEMMatcher(), and matchedClusterDistES().

◆ maxDeltaHsEven_

unsigned CSCGEMMatcher::maxDeltaHsEven_
private

Definition at line 106 of file CSCGEMMatcher.h.

Referenced by CSCGEMMatcher(), and matchingClustersLoc().

◆ maxDeltaHsOdd_

unsigned CSCGEMMatcher::maxDeltaHsOdd_
private

Definition at line 107 of file CSCGEMMatcher.h.

Referenced by CSCGEMMatcher(), and matchingClustersLoc().

◆ maxDeltaWG_

unsigned CSCGEMMatcher::maxDeltaWG_
private

Definition at line 105 of file CSCGEMMatcher.h.

Referenced by CSCGEMMatcher(), and matchingClustersLoc().

◆ mitigateSlopeByCosi_

bool CSCGEMMatcher::mitigateSlopeByCosi_
private

Definition at line 110 of file CSCGEMMatcher.h.

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

◆ ring_

unsigned CSCGEMMatcher::ring_
private

Definition at line 93 of file CSCGEMMatcher.h.

◆ station_

unsigned CSCGEMMatcher::station_
private