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 ( OMTFConfiguration omtfConfig)
inline

Definition at line 20 of file GhostBusterPreferRefDt.h.

20 :omtfConfig(omtfConfig) {};
const OMTFConfiguration * omtfConfig
GhostBusterPreferRefDt::~GhostBusterPreferRefDt ( )
inlineoverride

Definition at line 22 of file GhostBusterPreferRefDt.h.

References ALCARECOTkAlJpsiMuMu_cff::charge, and select().

22 {};

Member Function Documentation

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

Implements IGhostBuster.

Definition at line 19 of file GhostBusterPreferRefDt.cc.

References a, funct::abs(), AlgoMuon::AlgoMuon(), b, alignBH_cfg::fixed, AlgoMuon::getDisc(), AlgoMuon::getPatternNumber(), AlgoMuon::getQ(), AlgoMuon::getRefHitNumber(), AlgoMuon::getRefLayer(), RPCpg::mu, GetRecoTauVFromDQM_MC_cff::next, AlgoMuon::setEta(), and jetUpdater_cfi::sort.

Referenced by ~GhostBusterPreferRefDt().

19  {
20 
21  // sorting within GB.
22  auto customLess = [&](const AlgoMuon& a, const AlgoMuon& b)->bool {
23  // protect against access violation
24  if(a.getRefLayer() == -1 || b.getRefLayer() == -1)
25  return false;
26  int aRefLayerLogicNum = omtfConfig->getRefToLogicNumber()[a.getRefLayer()];
27  int bRefLayerLogicNum = omtfConfig->getRefToLogicNumber()[b.getRefLayer()];
28  if(a.getQ() > b.getQ())
29  return false;
30  else if(a.getQ()==b.getQ() && aRefLayerLogicNum < bRefLayerLogicNum) {
31  return false;
32  }
33  else if (a.getQ()==b.getQ() && aRefLayerLogicNum == bRefLayerLogicNum && a.getDisc() > b.getDisc() )
34  return false;
35  else if (a.getQ()==b.getQ() && aRefLayerLogicNum == bRefLayerLogicNum && a.getDisc() == b.getDisc() && a.getPatternNumber() > b.getPatternNumber() )
36  return false;
37  else if (a.getQ()==b.getQ() && aRefLayerLogicNum == bRefLayerLogicNum && a.getDisc() == b.getDisc() && 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)) ) it1->fixedEta=it2->getEta();
60  }
61  }
62  }
63  if (killIt != refHitCleanCandsFixedEta.end()) refHitCleanCandsFixedEta.erase(killIt);
64  }
65 
66  // fill outgoing collection
67  std::vector<AlgoMuon> refHitCleanCands;
68  for (const auto & mu : refHitCleanCandsFixedEta) {
69  AlgoMuon fixed = mu;
70  fixed.setEta(mu.fixedEta);
71  refHitCleanCands.push_back(fixed);
72  }
73 
74  refHitCleanCands.resize( 3, AlgoMuon(0,999,9999,0,0,0,0,0) );
75 /*
76  std::stringstream myStr;
77  bool hasCandidates = false;
78  for(unsigned int iRefHit=0;iRefHit<refHitCleanCands.size();++iRefHit){
79  if(refHitCleanCands[iRefHit].getQ()){
80  hasCandidates=true;
81  break;
82  }
83  }
84  for(unsigned int iRefHit=0;iRefHit<refHitCleanCands.size();++iRefHit){
85  if(refHitCleanCands[iRefHit].getQ()) myStr<<"Ref hit: "<<iRefHit<<" "<<refHitCleanCands[iRefHit]<<std::endl;
86  }
87  if(hasCandidates) edm::LogInfo("OMTF Sorter")<<myStr.str();
88 */
89 
90  return refHitCleanCands;
91 }
int getQ() const
Definition: AlgoMuon.h:25
unsigned int fwVersion() const
unsigned int getRefHitNumber() const
Definition: AlgoMuon.h:31
int getDisc() const
Definition: AlgoMuon.h:20
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const int mu
Definition: Constants.h:22
int getRefLayer() const
Definition: AlgoMuon.h:23
const OMTFConfiguration * omtfConfig
double b
Definition: hdecay.h:120
void setEta(int eta)
Definition: AlgoMuon.h:35
const std::vector< int > & getRefToLogicNumber() const
double a
Definition: hdecay.h:121
unsigned int getPatternNumber() const
Definition: AlgoMuon.h:30

Member Data Documentation

const OMTFConfiguration* GhostBusterPreferRefDt::omtfConfig
private

Definition at line 18 of file GhostBusterPreferRefDt.h.