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, and AlgoMuon::setEta().

Referenced by ~GhostBusterPreferRefDt().

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