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 (DTPattern *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 DTPatternpattern () 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_
 
DTPatternpattern_
 
qualitybits quality_
 

Detailed Description

Definition at line 17 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 ( DTPattern p)

Definition at line 11 of file CandidateGroup.cc.

11  {
12  nhits_ = 0;
13  nLayerhits_ = 0;
14  nisGood_ = 0;
15  nLayerDown_ = 0;
16  nLayerUp_ = 0;
17  pattern_ = p;
18 }

References nhits_, nisGood_, nLayerDown_, nLayerhits_, nLayerUp_, AlCaHLTBitMon_ParallelJobs::p, and pattern_.

◆ ~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.

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 }

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

◆ candHits()

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

Definition at line 35 of file CandidateGroup.h.

35 { return candHits_; };

References candHits_.

◆ candId()

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

Definition at line 29 of file CandidateGroup.h.

29 { return candId_; };

References candId_.

Referenced by operator>().

◆ nhits()

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

Definition at line 30 of file CandidateGroup.h.

30 { return nhits_; };

References nhits_.

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

◆ nisGood()

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

Definition at line 31 of file CandidateGroup.h.

31 { return nisGood_; };

References nisGood_.

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

◆ nLayerDown()

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

Definition at line 34 of file CandidateGroup.h.

34 { return nLayerDown_; };

References nLayerDown_.

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

◆ nLayerhits()

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

Definition at line 32 of file CandidateGroup.h.

32 { return nLayerhits_; };

References nLayerhits_.

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

◆ nLayerUp()

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

Definition at line 33 of file CandidateGroup.h.

33 { return nLayerUp_; };

References nLayerUp_.

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

◆ operator==()

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

Definition at line 103 of file CandidateGroup.cc.

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 }

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

◆ operator>()

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

Definition at line 67 of file CandidateGroup.cc.

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 }

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

◆ pattern()

const DTPattern* dtbayesam::CandidateGroup::pattern ( void  ) const
inline

Definition at line 37 of file CandidateGroup.h.

37 { return pattern_; };

References pattern_.

Referenced by operator>().

◆ quality()

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

Definition at line 36 of file CandidateGroup.h.

36 { return quality_; };

References quality_.

◆ removeHit()

void CandidateGroup::removeHit ( DTPrimitive  dthit)

Definition at line 39 of file CandidateGroup.cc.

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 }

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

◆ setCandId()

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

Definition at line 40 of file CandidateGroup.h.

40 { candId_ = cId; };

References candId_.

Member Data Documentation

◆ candHits_

DTPrimitivePtrs dtbayesam::CandidateGroup::candHits_
private

Definition at line 47 of file CandidateGroup.h.

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

◆ candId_

int dtbayesam::CandidateGroup::candId_
private

Definition at line 55 of file CandidateGroup.h.

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

◆ nhits_

int dtbayesam::CandidateGroup::nhits_
private

Definition at line 49 of file CandidateGroup.h.

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

◆ nisGood_

int dtbayesam::CandidateGroup::nisGood_
private

Definition at line 53 of file CandidateGroup.h.

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

◆ nLayerDown_

int dtbayesam::CandidateGroup::nLayerDown_
private

Definition at line 52 of file CandidateGroup.h.

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

◆ nLayerhits_

int dtbayesam::CandidateGroup::nLayerhits_
private

Definition at line 50 of file CandidateGroup.h.

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

◆ nLayerUp_

int dtbayesam::CandidateGroup::nLayerUp_
private

Definition at line 51 of file CandidateGroup.h.

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

◆ pattern_

DTPattern* dtbayesam::CandidateGroup::pattern_
private

Definition at line 54 of file CandidateGroup.h.

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

◆ quality_

qualitybits dtbayesam::CandidateGroup::quality_
private

Definition at line 48 of file CandidateGroup.h.

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

DTPattern::latHitIn
int latHitIn(int slId, int chId, int allowedVariance) const
Definition: DTPattern.cc:38
dtbayesam::CandidateGroup::candHits_
DTPrimitivePtrs candHits_
Definition: CandidateGroup.h:47
dtbayesam::qualitybits
std::bitset< 8 > qualitybits
Definition: CandidateGroup.h:15
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
dtbayesam::CandidateGroup::nhits_
int nhits_
Definition: CandidateGroup.h:49
DTPrimitive::channelId
const int channelId() const
Definition: DTprimitive.h:34
dtbayesam::CandidateGroup::nLayerDown
int nLayerDown() const
Definition: CandidateGroup.h:34
dtbayesam::CandidateGroup::nLayerUp
int nLayerUp() const
Definition: CandidateGroup.h:33
dtbayesam::CandidateGroup::nhits
int nhits() const
Definition: CandidateGroup.h:30
DTPrimitive::layerId
const int layerId() const
Definition: DTprimitive.h:35
dtbayesam::CandidateGroup::nLayerDown_
int nLayerDown_
Definition: CandidateGroup.h:52
dtbayesam::CandidateGroup::pattern
const DTPattern * pattern() const
Definition: CandidateGroup.h:37
dtbayesam::CandidateGroup::candId_
int candId_
Definition: CandidateGroup.h:55
dtbayesam::CandidateGroup::quality_
qualitybits quality_
Definition: CandidateGroup.h:48
dtbayesam::CandidateGroup::candId
int candId() const
Definition: CandidateGroup.h:29
dtbayesam::CandidateGroup::nisGood
int nisGood() const
Definition: CandidateGroup.h:31
dtbayesam::CandidateGroup::nLayerhits
int nLayerhits() const
Definition: CandidateGroup.h:32
dtbayesam::CandidateGroup::nisGood_
int nisGood_
Definition: CandidateGroup.h:53
dtbayesam::CandidateGroup::pattern_
DTPattern * pattern_
Definition: CandidateGroup.h:54
DTPattern::genHits
const std::vector< RefDTPatternHit > & genHits() const
Definition: DTPattern.h:43
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
dtbayesam::CandidateGroup::nLayerhits_
int nLayerhits_
Definition: CandidateGroup.h:50
DTPrimitivePtrs
std::vector< DTPrimitivePtr > DTPrimitivePtrs
Definition: DTprimitive.h:55
dtbayesam::CandidateGroup::nLayerUp_
int nLayerUp_
Definition: CandidateGroup.h:51