CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
dtbayesam::CandidateGroup Class Reference

#include <CandidateGroup.h>

Public Member Functions

void addHit (DTPrimitive dthit, int lay, bool isGood)
 
DTPrimitivePtrs candHits () const
 
int candId () const
 
 CandidateGroup ()
 
 CandidateGroup (DTPatternPtr p)
 
int nhits () const
 
int nisGood () const
 
int nLayerDown () const
 
int nLayerhits () const
 
int nLayerUp () const
 
bool operator== (const CandidateGroup &cOther) const
 
bool operator> (const CandidateGroup &cOther) const
 
const DTPatternPtr pattern () const
 
qualitybits quality () const
 
void removeHit (DTPrimitive dthit)
 
void setCandId (int cId)
 
 ~CandidateGroup ()
 

Private Attributes

DTPrimitivePtrs candHits_
 
int candId_
 
int nhits_
 
int nisGood_
 
int nLayerDown_
 
int nLayerhits_
 
int nLayerUp_
 
DTPatternPtr pattern_
 
qualitybits quality_
 

Detailed Description

Definition at line 20 of file CandidateGroup.h.

Constructor & Destructor Documentation

◆ CandidateGroup() [1/2]

CandidateGroup::CandidateGroup ( )

Definition at line 20 of file CandidateGroup.cc.

20 {}

◆ CandidateGroup() [2/2]

CandidateGroup::CandidateGroup ( DTPatternPtr  p)

◆ ~CandidateGroup()

CandidateGroup::~CandidateGroup ( )

Definition at line 22 of file CandidateGroup.cc.

22 {}

Member Function Documentation

◆ addHit()

void CandidateGroup::addHit ( DTPrimitive  dthit,
int  lay,
bool  isGood 
)

Definition at line 24 of file CandidateGroup.cc.

References candHits_, nhits_, nisGood_, nLayerDown_, nLayerhits_, nLayerUp_, funct::pow(), and quality_.

24  {
25  //Add a hit, check if the hits layer was fired and if it wasn't add it to the fired layers
26  candHits_.push_back(std::make_shared<DTPrimitive>(dthit));
27  if (quality_ != (quality_ | qualitybits(std::pow(2, lay))))
28  nLayerhits_++;
29  if (isGood)
30  nisGood_++;
32  nhits_++;
33  if (lay <= 3)
34  nLayerDown_++;
35  if (lay >= 4)
36  nLayerUp_++;
37 }
std::bitset< 8 > qualitybits
DTPrimitivePtrs candHits_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ candHits()

DTPrimitivePtrs dtbayesam::CandidateGroup::candHits ( ) const
inline

Definition at line 38 of file CandidateGroup.h.

References candHits_.

38 { return candHits_; };
DTPrimitivePtrs candHits_

◆ candId()

int dtbayesam::CandidateGroup::candId ( ) const
inline

Definition at line 32 of file CandidateGroup.h.

References candId_.

Referenced by operator>().

32 { return candId_; };

◆ nhits()

int dtbayesam::CandidateGroup::nhits ( ) const
inline

Definition at line 33 of file CandidateGroup.h.

References nhits_.

Referenced by operator==(), and operator>().

33 { return nhits_; };

◆ nisGood()

int dtbayesam::CandidateGroup::nisGood ( ) const
inline

Definition at line 34 of file CandidateGroup.h.

References nisGood_.

Referenced by operator==(), and operator>().

34 { return nisGood_; };

◆ nLayerDown()

int dtbayesam::CandidateGroup::nLayerDown ( ) const
inline

Definition at line 37 of file CandidateGroup.h.

References nLayerDown_.

Referenced by operator==(), and operator>().

37 { return nLayerDown_; };

◆ nLayerhits()

int dtbayesam::CandidateGroup::nLayerhits ( ) const
inline

Definition at line 35 of file CandidateGroup.h.

References nLayerhits_.

Referenced by operator==(), and operator>().

35 { return nLayerhits_; };

◆ nLayerUp()

int dtbayesam::CandidateGroup::nLayerUp ( ) const
inline

Definition at line 36 of file CandidateGroup.h.

References nLayerUp_.

Referenced by operator==(), and operator>().

36 { return nLayerUp_; };

◆ operator==()

bool CandidateGroup::operator== ( const CandidateGroup cOther) const

Definition at line 103 of file CandidateGroup.cc.

References nhits(), nhits_, nisGood(), nisGood_, nLayerDown(), nLayerDown_, nLayerhits(), nLayerhits_, nLayerUp(), and nLayerUp_.

103  {
104  //First number of good hits
105  if (nisGood_ != cOther.nisGood())
106  return false;
107  //First quality_ is number of layers fired
108  else if (nLayerhits_ != cOther.nLayerhits())
109  return false;
110  //Then number of matched hits (if multiple hits in a layer is better)
111  else if (nhits_ != cOther.nhits())
112  return false;
113  //Balanced quality_, prefer 3+2 over 4+1 for example
114  else if ((nLayerUp_ - nLayerDown_) != (cOther.nLayerUp() - cOther.nLayerDown()))
115  return false;
116  //Last, patterns with less gen hits are better matched
117  return true;
118 }

◆ operator>()

bool CandidateGroup::operator> ( const CandidateGroup cOther) const

Definition at line 67 of file CandidateGroup.cc.

References candId(), candId_, nhits(), nhits_, nisGood(), nisGood_, nLayerDown(), nLayerDown_, nLayerhits(), nLayerhits_, nLayerUp(), nLayerUp_, pattern(), and pattern_.

67  {
68  //First number of good (in pattern) matched hits
69  if (nisGood_ > cOther.nisGood())
70  return true;
71  else if (nisGood_ < cOther.nisGood())
72  return false;
73  //Tehn quality_ is number of layers fired
74  else if (nLayerhits_ > cOther.nLayerhits())
75  return true;
76  else if (nLayerhits_ < cOther.nLayerhits())
77  return false;
78  //Then number of matched hits (if multiple hits in a layer is better)
79  else if (nhits_ > cOther.nhits())
80  return true;
81  else if (nhits_ < cOther.nhits())
82  return false;
83  //Balanced quality_, prefer 3+2 over 4+1 for example
84  else if ((nLayerUp_ - nLayerDown_) > (cOther.nLayerUp() - cOther.nLayerDown()))
85  return true;
86  else if ((nLayerUp_ - nLayerDown_) < (cOther.nLayerUp() - cOther.nLayerDown()))
87  return false;
88  //Last, patterns with less gen hits are better matched
89  else if (pattern_->genHits().size() < (cOther.pattern()->genHits().size()))
90  return true;
91  else if (pattern_->genHits().size() > (cOther.pattern()->genHits().size()))
92  return false;
93  //For a total order relation we need this additional dummy
94  else if (candId_ < cOther.candId())
95  return true;
96  else if (candId_ > cOther.candId())
97  return false;
98 
99  //If we are here, they are basically equal so it doesn't matter who goes first
100  return true;
101 }
const DTPatternPtr pattern() const

◆ pattern()

const DTPatternPtr dtbayesam::CandidateGroup::pattern ( void  ) const
inline

Definition at line 40 of file CandidateGroup.h.

References pattern_.

Referenced by operator>().

40 { return pattern_; };

◆ quality()

qualitybits dtbayesam::CandidateGroup::quality ( void  ) const
inline

Definition at line 39 of file CandidateGroup.h.

References quality_.

39 { return quality_; };

◆ removeHit()

void CandidateGroup::removeHit ( DTPrimitive  dthit)

Definition at line 39 of file CandidateGroup.cc.

References candHits_, DTPrimitive::channelId(), DTPrimitive::layerId(), nhits_, nisGood_, nLayerDown_, nLayerhits_, nLayerUp_, pattern_, funct::pow(), and quality_.

39  {
40  //Add a hit, check if the hits layer was fired and if it wasn't add it to the fired layers
41  DTPrimitivePtrs tempHits;
42  nhits_ = 0;
43  nLayerDown_ = 0;
44  nLayerUp_ = 0;
45  nLayerhits_ = 0;
46  nisGood_ = 0;
47  quality_ = qualitybits("00000000");
48  for (auto dt_it = candHits_.begin(); dt_it != candHits_.end(); dt_it++) {
49  if (dthit.layerId() == (*dt_it)->layerId() && dthit.channelId() == (*dt_it)->channelId()) {
50  } else {
51  if (pattern_->latHitIn((*dt_it)->layerId(), (*dt_it)->channelId(), 0) > -5)
52  nisGood_++;
53  if (quality_ != (quality_ | qualitybits(std::pow(2, (*dt_it)->layerId()))))
54  nLayerhits_++;
55  quality_ = quality_ | qualitybits(std::pow(2, (*dt_it)->layerId()));
56  nhits_++;
57  if ((*dt_it)->layerId() <= 3)
58  nLayerDown_++;
59  else if ((*dt_it)->layerId() >= 4)
60  nLayerUp_++;
61  tempHits.push_back(*dt_it);
62  }
63  }
64  candHits_ = tempHits;
65 }
std::vector< DTPrimitivePtr > DTPrimitivePtrs
Definition: DTprimitive.h:60
const int channelId() const
Definition: DTprimitive.h:34
std::bitset< 8 > qualitybits
DTPrimitivePtrs candHits_
const int layerId() const
Definition: DTprimitive.h:35
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ setCandId()

void dtbayesam::CandidateGroup::setCandId ( int  cId)
inline

Definition at line 43 of file CandidateGroup.h.

References candId_.

43 { candId_ = cId; };

Member Data Documentation

◆ candHits_

DTPrimitivePtrs dtbayesam::CandidateGroup::candHits_
private

Definition at line 50 of file CandidateGroup.h.

Referenced by addHit(), candHits(), and removeHit().

◆ candId_

int dtbayesam::CandidateGroup::candId_
private

Definition at line 58 of file CandidateGroup.h.

Referenced by candId(), operator>(), and setCandId().

◆ nhits_

int dtbayesam::CandidateGroup::nhits_
private

Definition at line 52 of file CandidateGroup.h.

Referenced by addHit(), CandidateGroup(), nhits(), operator==(), operator>(), and removeHit().

◆ nisGood_

int dtbayesam::CandidateGroup::nisGood_
private

Definition at line 56 of file CandidateGroup.h.

Referenced by addHit(), CandidateGroup(), nisGood(), operator==(), operator>(), and removeHit().

◆ nLayerDown_

int dtbayesam::CandidateGroup::nLayerDown_
private

Definition at line 55 of file CandidateGroup.h.

Referenced by addHit(), CandidateGroup(), nLayerDown(), operator==(), operator>(), and removeHit().

◆ nLayerhits_

int dtbayesam::CandidateGroup::nLayerhits_
private

Definition at line 53 of file CandidateGroup.h.

Referenced by addHit(), CandidateGroup(), nLayerhits(), operator==(), operator>(), and removeHit().

◆ nLayerUp_

int dtbayesam::CandidateGroup::nLayerUp_
private

Definition at line 54 of file CandidateGroup.h.

Referenced by addHit(), CandidateGroup(), nLayerUp(), operator==(), operator>(), and removeHit().

◆ pattern_

DTPatternPtr dtbayesam::CandidateGroup::pattern_
private

Definition at line 57 of file CandidateGroup.h.

Referenced by CandidateGroup(), operator>(), pattern(), and removeHit().

◆ quality_

qualitybits dtbayesam::CandidateGroup::quality_
private

Definition at line 51 of file CandidateGroup.h.

Referenced by addHit(), quality(), and removeHit().