CMS 3D CMS Logo

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

#include <GhostBusterPreferRefDt.h>

Inheritance diagram for GhostBusterPreferRefDt:
IGhostBuster

Public Member Functions

 GhostBusterPreferRefDt (OMTFConfiguration *omtfConfig)
 
std::vector< AlgoMuonselect (std::vector< AlgoMuon > refHitCands, int charge=0) override
 
 ~GhostBusterPreferRefDt () override
 
- Public Member Functions inherited from IGhostBuster
virtual ~IGhostBuster ()
 

Private Attributes

const OMTFConfigurationomtfConfig
 

Detailed Description

Definition at line 16 of file GhostBusterPreferRefDt.h.

Constructor & Destructor Documentation

◆ GhostBusterPreferRefDt()

GhostBusterPreferRefDt::GhostBusterPreferRefDt ( OMTFConfiguration omtfConfig)
inline

Definition at line 21 of file GhostBusterPreferRefDt.h.

◆ ~GhostBusterPreferRefDt()

GhostBusterPreferRefDt::~GhostBusterPreferRefDt ( )
inlineoverride

Definition at line 23 of file GhostBusterPreferRefDt.h.

23 {};

Member Function Documentation

◆ select()

std::vector< AlgoMuon > GhostBusterPreferRefDt::select ( std::vector< AlgoMuon refHitCands,
int  charge = 0 
)
overridevirtual

Implements IGhostBuster.

Definition at line 19 of file GhostBusterPreferRefDt.cc.

19  {
20  // sorting within GB.
21  auto customLess = [&](const AlgoMuon& a, const AlgoMuon& b) -> bool {
22  // protect against access violation
23  if (a.getRefLayer() == -1 || b.getRefLayer() == -1)
24  return false;
25  int aRefLayerLogicNum = omtfConfig->getRefToLogicNumber()[a.getRefLayer()];
26  int bRefLayerLogicNum = omtfConfig->getRefToLogicNumber()[b.getRefLayer()];
27  if (a.getQ() > b.getQ())
28  return false;
29  else if (a.getQ() == b.getQ() && aRefLayerLogicNum < bRefLayerLogicNum) {
30  return false;
31  } else if (a.getQ() == b.getQ() && aRefLayerLogicNum == bRefLayerLogicNum && a.getDisc() > b.getDisc())
32  return false;
33  else if (a.getQ() == b.getQ() && aRefLayerLogicNum == bRefLayerLogicNum && a.getDisc() == b.getDisc() &&
34  a.getPatternNumber() > b.getPatternNumber())
35  return false;
36  else if (a.getQ() == b.getQ() && aRefLayerLogicNum == bRefLayerLogicNum && a.getDisc() == b.getDisc() &&
37  a.getPatternNumber() == b.getPatternNumber() && a.getRefHitNumber() < b.getRefHitNumber())
38  return false;
39  else
40  return true;
41  };
42 
43  std::sort(muonsIN.rbegin(), muonsIN.rend(), customLess);
44 
45  // actual GhostBusting. Overwrite eta in case of no DT info.
46  std::vector<AlgoMuonEtaFix> refHitCleanCandsFixedEta;
47  for (const auto& muIN : muonsIN) {
48  refHitCleanCandsFixedEta.push_back(muIN);
49  auto killIt = refHitCleanCandsFixedEta.end();
50 
51  //do not accept candidates with similar phi (any charge combination)
52  //veto window 5 degree in GMT scale is 5/360*576=8 units
53  for (auto it1 = refHitCleanCandsFixedEta.begin(); it1 != refHitCleanCandsFixedEta.end(); ++it1) {
54  for (auto it2 = std::next(it1); it2 != refHitCleanCandsFixedEta.end(); ++it2) {
55  if (std::abs(phiGMT(it1->getPhi()) - phiGMT(it2->getPhi())) < 8) {
56  killIt = it2;
57  if ((omtfConfig->fwVersion() >= 6) &&
58  ((abs(it1->getEta()) == 75 || abs(it1->getEta()) == 79 || abs(it1->getEta()) == 92)) &&
59  ((abs(it2->getEta()) != 75 && abs(it2->getEta()) != 79 && abs(it2->getEta()) != 92)))
60  it1->fixedEta = it2->getEta();
61  }
62  }
63  }
64  if (killIt != refHitCleanCandsFixedEta.end())
65  refHitCleanCandsFixedEta.erase(killIt);
66  }
67 
68  // fill outgoing collection
69  std::vector<AlgoMuon> refHitCleanCands;
70  for (const auto& mu : refHitCleanCandsFixedEta) {
71  AlgoMuon fixed = mu;
72  fixed.setEta(mu.fixedEta);
73  refHitCleanCands.push_back(fixed);
74  }
75 
76  refHitCleanCands.resize(3, AlgoMuon(0, 999, 9999, 0, 0, 0, 0, 0));
77  /*
78  std::stringstream myStr;
79  bool hasCandidates = false;
80  for(unsigned int iRefHit=0;iRefHit<refHitCleanCands.size();++iRefHit){
81  if(refHitCleanCands[iRefHit].getQ()){
82  hasCandidates=true;
83  break;
84  }
85  }
86  for(unsigned int iRefHit=0;iRefHit<refHitCleanCands.size();++iRefHit){
87  if(refHitCleanCands[iRefHit].getQ()) myStr<<"Ref hit: "<<iRefHit<<" "<<refHitCleanCands[iRefHit]<<std::endl;
88  }
89  if(hasCandidates) edm::LogInfo("OMTF Sorter")<<myStr.str();
90 */
91 
92  return refHitCleanCands;
93 }

References a, funct::abs(), b, alignBH_cfg::fixed, OMTFConfiguration::fwVersion(), OMTFConfiguration::getRefToLogicNumber(), amptDefaultParameters_cff::mu, GetRecoTauVFromDQM_MC_cff::next, and omtfConfig.

Member Data Documentation

◆ omtfConfig

const OMTFConfiguration* GhostBusterPreferRefDt::omtfConfig
private

Definition at line 18 of file GhostBusterPreferRefDt.h.

Referenced by select().

alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
OMTFConfiguration::fwVersion
unsigned int fwVersion() const
Definition: OMTFConfiguration.h:81
b
double b
Definition: hdecay.h:118
AlgoMuon
Definition: AlgoMuon.h:6
a
double a
Definition: hdecay.h:119
OMTFConfiguration::getRefToLogicNumber
const std::vector< int > & getRefToLogicNumber() const
Definition: OMTFConfiguration.h:105
GhostBusterPreferRefDt::omtfConfig
const OMTFConfiguration * omtfConfig
Definition: GhostBusterPreferRefDt.h:18
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GetRecoTauVFromDQM_MC_cff.next
next
Definition: GetRecoTauVFromDQM_MC_cff.py:31