ATLAS Offline Software
Public Types | Public Member Functions | Protected Attributes | Private Attributes | List of all members
MuonHoughPattern Class Reference

#include <MuonHoughPattern.h>

Inheritance diagram for MuonHoughPattern:
Collaboration diagram for MuonHoughPattern:

Public Types

using MuonHoughPatternCollection = DataVector< MuonHoughPattern >
 

Public Member Functions

 MuonHoughPattern (int id_number)
 MuonHoughPattern does not own its hits (contrary to the default) MuonHoughHitContainer! More...
 
virtual ~MuonHoughPattern ()=default
 destructor More...
 
void resetTracksegment ()
 clear pattern More...
 
bool hitInHoughPattern (const std::shared_ptr< MuonHoughHit > &hit) const
 returns if hit is in pattern More...
 
double calculateEZ () const
 calculate estimated z-position of pattern More...
 
double patternLength () const
 returns distance between first and last hit More...
 
void printHoughPattern () const
 prints out info about hough pattern More...
 
int getIdNumber () const
 returns id number of hough transform used to generate pattern More...
 
double getEPhi () const
 returns phi of pattern More...
 
double getERPhi () const
 returns r0/d0 of pattern More...
 
double getETheta () const
 returns theta of pattern More...
 
double getERTheta () const
 returns z0 of pattern More...
 
double getECurvature () const
 returns curvature of pattern More...
 
double getMaximumHistogram () const
 returns maximum of histogram used to generate pattern More...
 
void setEPhi (double ephi)
 set phi of pattern More...
 
void setERPhi (double erphi)
 set r0 of pattern More...
 
void setETheta (double etheta)
 set theta of pattern More...
 
void setERTheta (double ertheta)
 set z0 of pattern More...
 
void setECurvature (double curvature)
 set curvature of pattern More...
 
void setMaximumHistogram (double maximumhistogram)
 set maximum of histogram used to generate pattern More...
 
double getEAngle () const
 returns angle in precision plane in rad More...
 
double getER () const
 returns radius in precision plane in mm More...
 
void setEAngle (double eangle)
 set angle in precision plane in rad More...
 
void setER (double er)
 set radius in precision plane in mm More...
 
void setWhichSegment (bool which_segment)
 set which segment pattern is in, not in use More...
 
Amg::Vector3D getEPos () const
 calulates 3d point closest to ip More...
 
Amg::Vector3D getEDir () const
 calculates direction at point closest to ip More...
 
void updateParametersRPhi (bool cosmics=false)
 update parameters in rphi plane based on weighted fit More...
 
std::shared_ptr< MuonHoughHitgetHit (int hitno) const
 returns Hit at position hitno More...
 
const std::vector< std::shared_ptr< MuonHoughHit > > & getHits () const
 returns hit vector More...
 
void addHit (const std::shared_ptr< MuonHoughHit > &hit)
 add hit to container More...
 
void removeHit (unsigned int hitno)
 remove hit from container More...
 
int getHitId (unsigned int hitno) const
 returns hitid of hit hitno More...
 
double getHitx (unsigned int hitno) const
 returns x position of hit hitno More...
 
double getHity (unsigned int hitno) const
 returns y position of hit hitno More...
 
double getHitz (unsigned int hitno) const
 returns z position of hit hitno More...
 
double getRadius (unsigned int hitno) const
 returns radius of hit hitno More...
 
double getTheta (unsigned int hitno) const
 returns theta of hit hitno More...
 
double getPhi (unsigned int hitno) const
 returns phi of hit hitno More...
 
double getWeight (unsigned int hitno) const
 returns weight of hit hitno More...
 
double getOrigWeight (unsigned int hitno) const
 returns the orignal weight of hit hitno More...
 
bool getMeasuresPhi (unsigned int hitno) const
 returns if hit hitno measures phi More...
 
const Trk::PrepRawDatagetPrd (unsigned int hitno) const
 returns preprawdata pointer of hit hitno More...
 
std::string getWhichDetector (unsigned int hitno) const
 returns detectortechnology in string of hit hitno More...
 
MuonHough::DetectorTechnology getDetectorId (unsigned int hitno) const
 returns detectortechnology of hit hitno More...
 
unsigned int size () const
 returns size of hitcontainer More...
 
bool empty () const
 returns if hitcontainer is empty More...
 
void reserve (int size)
 allocates memory for hitvector More...
 
int getRPChitno () const
 returns number of rpc hits in container More...
 
int getRPCetahitno () const
 returns number of rpc eta hits in container More...
 
int getMDThitno () const
 returns number of mdt hits in container More...
 
int getCSChitno () const
 returns number of csc hits in container More...
 
int getTGChitno () const
 returns number of tgc hits in container More...
 

Protected Attributes

std::vector< std::shared_ptr< MuonHoughHit > > m_hit
 vector of hits in container More...
 

Private Attributes

int m_id_number {-1}
 id number of hough transform used to generate pattern More...
 
bool m_whichsegment {false}
 which segment is pattern created in, not relevant if split search is off 0 lower segment, 1 uppersegment More...
 
double m_ephi {-M_PI_2}
 phi in rad More...
 
double m_erphi {0.}
 r0 in mm More...
 
double m_etheta {M_PI_2}
 theta in rad More...
 
double m_ertheta {0.}
 z0 in mm More...
 
double m_ecurvature {1.}
 curvature of pattern in rz plane in mm More...
 
double m_maximumhistogram {0.}
 maximum of histogram More...
 

Detailed Description

Definition at line 17 of file MuonHoughPattern.h.

Member Typedef Documentation

◆ MuonHoughPatternCollection

Definition at line 90 of file MuonHoughPattern.h.

Constructor & Destructor Documentation

◆ MuonHoughPattern()

MuonHoughPattern::MuonHoughPattern ( int  id_number)

MuonHoughPattern does not own its hits (contrary to the default) MuonHoughHitContainer!

constructor

Definition at line 11 of file MuonHoughPattern.cxx.

11 : MuonHoughHitContainer(), m_id_number(id_number) {}

◆ ~MuonHoughPattern()

virtual MuonHoughPattern::~MuonHoughPattern ( )
virtualdefault

destructor

Member Function Documentation

◆ addHit()

void MuonHoughHitContainer::addHit ( const std::shared_ptr< MuonHoughHit > &  hit)
inherited

add hit to container

Definition at line 8 of file MuonHoughHitContainer.cxx.

8  {
9  if (hit->getId() == -1) { hit->setId(size()); }
10  m_hit.push_back(hit);
11 }

◆ calculateEZ()

double MuonHoughPattern::calculateEZ ( ) const

calculate estimated z-position of pattern

Definition at line 65 of file MuonHoughPattern.cxx.

65  {
66  double ez = 0;
67  double count = 0;
68  // double r0 = m_erphi;
69 
70  for (unsigned int hitno = 0; hitno < m_hit.size(); hitno++) {
71  // for each hit the distance from the hit to x,y line through (0,0) in the xy plane is calcualted and then distance*cos(theta) gives
72  // z_hit - z
73 
75 
76  double z = getHit(hitno)->getHitz() -
77  (distance * std::cos(m_etheta) / std::sin(m_etheta)); // distance * sin (m_etheta) = L // - sign correct?
78  // hough correction in here?
79 
80  // straight line fitter?
81 
82  ez += z;
83  count++;
84  }
85 
86  ez = ez / count;
87 
88  return ez;
89 }

◆ empty()

bool MuonHoughHitContainer::empty ( ) const
inlineinherited

returns if hitcontainer is empty

Definition at line 105 of file MuonHoughHitContainer.h.

105 { return m_hit.empty(); }

◆ getCSChitno()

int MuonHoughHitContainer::getCSChitno ( ) const
inherited

returns number of csc hits in container

Definition at line 37 of file MuonHoughHitContainer.cxx.

37  {
38  int cschitno = 0;
39  for (unsigned int i = 0; i < m_hit.size(); i++) { cschitno += getDetectorId(i) == MuonHough::CSC; }
40  return cschitno;
41 }

◆ getDetectorId()

MuonHough::DetectorTechnology MuonHoughHitContainer::getDetectorId ( unsigned int  hitno) const
inlineinherited

returns detectortechnology of hit hitno

Definition at line 107 of file MuonHoughHitContainer.h.

107 { return m_hit[hitno]->getDetectorId(); }

◆ getEAngle()

double MuonHoughPattern::getEAngle ( ) const

returns angle in precision plane in rad

Definition at line 105 of file MuonHoughPattern.cxx.

105  {
106  double eangle = 0;
107  switch (m_id_number) {
108  case MuonHough::hough_xy: eangle = m_ephi; break;
109  case MuonHough::hough_rz:
113  case MuonHough::hough_curved_at_a_cylinder: eangle = m_etheta; break;
114  default:
115  MsgStream log(Athena::getMessageSvc(), "MuonHoughPattern::getEAngle");
116  if (log.level() <= MSG::VERBOSE) log << MSG::VERBOSE << "MuonHoughPattern::no valid id_number" << endmsg;
117  }
118  return eangle;
119 }

◆ getECurvature()

double MuonHoughPattern::getECurvature ( ) const
inline

returns curvature of pattern

Definition at line 120 of file MuonHoughPattern.h.

120 { return m_ecurvature; }

◆ getEDir()

Amg::Vector3D MuonHoughPattern::getEDir ( ) const

calculates direction at point closest to ip

Definition at line 185 of file MuonHoughPattern.cxx.

185  {
187  CxxUtils::sincos scphi(m_ephi);
188  CxxUtils::sincos sctheta(m_etheta);
189  return {scphi.cs * sctheta.sn, scphi.sn * sctheta.sn, sctheta.cs};
190 }

◆ getEPhi()

double MuonHoughPattern::getEPhi ( ) const
inline

returns phi of pattern

Definition at line 116 of file MuonHoughPattern.h.

116 { return m_ephi; }

◆ getEPos()

Amg::Vector3D MuonHoughPattern::getEPos ( ) const

calulates 3d point closest to ip

Definition at line 165 of file MuonHoughPattern.cxx.

165  {
166  // similar to StandardAlgs::shortestPointOfLineToOrigin3D
167 
168  // should be maybe really shortest point, but
169 
170  // problem is that there is no starting point on the line (well this calc. pos could be available)
171 
173 
174  pos[0] = m_erphi * std::sin(m_ephi);
175  pos[1] = -m_erphi * std::cos(m_ephi);
176 
177  if (m_etheta != 0) {
178  pos[2] = m_ertheta / std::sin(m_etheta);
179  } else {
180  pos[2] = 0;
181  }
182  return pos;
183 }

◆ getER()

double MuonHoughPattern::getER ( ) const

returns radius in precision plane in mm

Definition at line 121 of file MuonHoughPattern.cxx.

121  {
122  double er = 0;
123  switch (m_id_number) {
124  case MuonHough::hough_xy: er = m_erphi; break;
125  case MuonHough::hough_rz:
130  default:
131  MsgStream log(Athena::getMessageSvc(), "MuonHoughPattern::getER");
132  if (log.level() <= MSG::VERBOSE) log << MSG::VERBOSE << "MuonHoughPattern::no valid id_number" << endmsg;
133  }
134  return er;
135 }

◆ getERPhi()

double MuonHoughPattern::getERPhi ( ) const
inline

returns r0/d0 of pattern

Definition at line 117 of file MuonHoughPattern.h.

117 { return m_erphi; }

◆ getERTheta()

double MuonHoughPattern::getERTheta ( ) const
inline

returns z0 of pattern

Definition at line 119 of file MuonHoughPattern.h.

119 { return m_ertheta; }

◆ getETheta()

double MuonHoughPattern::getETheta ( ) const
inline

returns theta of pattern

Definition at line 118 of file MuonHoughPattern.h.

118 { return m_etheta; }

◆ getHit()

std::shared_ptr< MuonHoughHit > MuonHoughHitContainer::getHit ( int  hitno) const
inlineinherited

returns Hit at position hitno

Definition at line 91 of file MuonHoughHitContainer.h.

91 { return m_hit.at(hitno); }

◆ getHitId()

int MuonHoughHitContainer::getHitId ( unsigned int  hitno) const
inlineinherited

returns hitid of hit hitno

Definition at line 93 of file MuonHoughHitContainer.h.

93 { return m_hit[hitno]->getId(); }

◆ getHits()

const std::vector< std::shared_ptr< MuonHoughHit > > & MuonHoughHitContainer::getHits ( ) const
inlineinherited

returns hit vector

Definition at line 92 of file MuonHoughHitContainer.h.

92 { return m_hit; }

◆ getHitx()

double MuonHoughHitContainer::getHitx ( unsigned int  hitno) const
inlineinherited

returns x position of hit hitno

Definition at line 94 of file MuonHoughHitContainer.h.

94 { return m_hit[hitno]->getHitx(); }

◆ getHity()

double MuonHoughHitContainer::getHity ( unsigned int  hitno) const
inlineinherited

returns y position of hit hitno

Definition at line 95 of file MuonHoughHitContainer.h.

95 { return m_hit[hitno]->getHity(); }

◆ getHitz()

double MuonHoughHitContainer::getHitz ( unsigned int  hitno) const
inlineinherited

returns z position of hit hitno

Definition at line 96 of file MuonHoughHitContainer.h.

96 { return m_hit[hitno]->getHitz(); }

◆ getIdNumber()

int MuonHoughPattern::getIdNumber ( ) const
inline

returns id number of hough transform used to generate pattern

Definition at line 114 of file MuonHoughPattern.h.

114 { return m_id_number; }

◆ getMaximumHistogram()

double MuonHoughPattern::getMaximumHistogram ( ) const
inline

returns maximum of histogram used to generate pattern

Definition at line 121 of file MuonHoughPattern.h.

121 { return m_maximumhistogram; }

◆ getMDThitno()

int MuonHoughHitContainer::getMDThitno ( ) const
inherited

returns number of mdt hits in container

Definition at line 25 of file MuonHoughHitContainer.cxx.

25  {
26  int mdthitno = 0;
27  for (unsigned int i = 0; i < m_hit.size(); i++) { mdthitno += getDetectorId(i) == MuonHough::MDT; }
28  return mdthitno;
29 }

◆ getMeasuresPhi()

bool MuonHoughHitContainer::getMeasuresPhi ( unsigned int  hitno) const
inlineinherited

returns if hit hitno measures phi

Definition at line 109 of file MuonHoughHitContainer.h.

109 { return m_hit[hitno]->getMeasuresPhi(); }

◆ getOrigWeight()

double MuonHoughHitContainer::getOrigWeight ( unsigned int  hitno) const
inlineinherited

returns the orignal weight of hit hitno

Definition at line 102 of file MuonHoughHitContainer.h.

102 { return m_hit[hitno]->getOrigWeight(); }

◆ getPhi()

double MuonHoughHitContainer::getPhi ( unsigned int  hitno) const
inlineinherited

returns phi of hit hitno

Definition at line 100 of file MuonHoughHitContainer.h.

100 { return m_hit[hitno]->getPhi(); }

◆ getPrd()

const Trk::PrepRawData * MuonHoughHitContainer::getPrd ( unsigned int  hitno) const
inlineinherited

returns preprawdata pointer of hit hitno

Definition at line 110 of file MuonHoughHitContainer.h.

110 { return m_hit[hitno]->getPrd(); }

◆ getRadius()

double MuonHoughHitContainer::getRadius ( unsigned int  hitno) const
inlineinherited

returns radius of hit hitno

Definition at line 97 of file MuonHoughHitContainer.h.

97 { return m_hit[hitno]->getRadius(); }

◆ getRPCetahitno()

int MuonHoughHitContainer::getRPCetahitno ( ) const
inherited

returns number of rpc eta hits in container

Definition at line 31 of file MuonHoughHitContainer.cxx.

31  {
32  int rpchitno = 0;
33  for (unsigned int i = 0; i < m_hit.size(); i++) { rpchitno += getDetectorId(i) == MuonHough::RPC && !getMeasuresPhi(i); }
34  return rpchitno;
35 }

◆ getRPChitno()

int MuonHoughHitContainer::getRPChitno ( ) const
inherited

returns number of rpc hits in container

Definition at line 19 of file MuonHoughHitContainer.cxx.

19  {
20  int rpchitno = 0;
21  for (unsigned int i = 0; i < m_hit.size(); i++) { rpchitno += getDetectorId(i) == MuonHough::RPC; }
22  return rpchitno;
23 }

◆ getTGChitno()

int MuonHoughHitContainer::getTGChitno ( ) const
inherited

returns number of tgc hits in container

Definition at line 43 of file MuonHoughHitContainer.cxx.

43  {
44  int tgchitno = 0;
45  for (unsigned int i = 0; i < m_hit.size(); i++) { tgchitno += getDetectorId(i) == MuonHough::TGC; }
46  return tgchitno;
47 }

◆ getTheta()

double MuonHoughHitContainer::getTheta ( unsigned int  hitno) const
inlineinherited

returns theta of hit hitno

Definition at line 99 of file MuonHoughHitContainer.h.

99 { return m_hit[hitno]->getTheta(); }

◆ getWeight()

double MuonHoughHitContainer::getWeight ( unsigned int  hitno) const
inlineinherited

returns weight of hit hitno

Definition at line 101 of file MuonHoughHitContainer.h.

101 { return m_hit[hitno]->getWeight(); }

◆ getWhichDetector()

std::string MuonHoughHitContainer::getWhichDetector ( unsigned int  hitno) const
inlineinherited

returns detectortechnology in string of hit hitno

Definition at line 108 of file MuonHoughHitContainer.h.

108 { return m_hit[hitno]->getWhichDetector(); }

◆ hitInHoughPattern()

bool MuonHoughPattern::hitInHoughPattern ( const std::shared_ptr< MuonHoughHit > &  hit) const

returns if hit is in pattern

Definition at line 17 of file MuonHoughPattern.cxx.

18 {
19  for (unsigned int i = 0; i < size(); i++) {
20  if (m_hit[i]->getId() == hit->getId()) { return true; }
21  }
22 
23  return false;
24 }

◆ patternLength()

double MuonHoughPattern::patternLength ( ) const

returns distance between first and last hit

Definition at line 26 of file MuonHoughPattern.cxx.

26  {
27  // takes the first 2 hits and calculates distance and then takes next hit, and calculates from previous 2 hits which 2 are farthest
28  // away, etc.. also possible to calculate point closest to IP and determine if left/ right to pattern, app. just as fast.
29 
30  double max_patternlength = 0;
31 
32  if (m_hit.size() >= 2) {
33  double pattern_length1 = 0, pattern_length2 = 0;
34  int hitno1 = 0;
35  int hitno2 = 1;
36 
37  Amg::Vector3D diff = m_hit[hitno1]->getPosition() - m_hit[hitno2]->getPosition();
38  max_patternlength = diff.mag();
39 
40  for (unsigned int i = 2; i < m_hit.size(); i++) {
41  diff = m_hit[hitno1]->getPosition() - m_hit[i]->getPosition();
42  pattern_length1 = diff.mag();
43 
44  diff = m_hit[hitno2]->getPosition() - m_hit[i]->getPosition();
45  pattern_length2 = diff.mag();
46 
47  if (pattern_length1 <= max_patternlength && pattern_length2 <= max_patternlength) {
48  // nothing happens..
49  } else if (pattern_length1 > max_patternlength && pattern_length1 >= pattern_length2) {
50  hitno2 = i;
51  max_patternlength = pattern_length1;
52  } else if (pattern_length2 > max_patternlength && pattern_length2 > pattern_length1) {
53  hitno1 = i;
54  max_patternlength = pattern_length2;
55  }
56  }
57  } else {
58  MsgStream log(Athena::getMessageSvc(), "MuonHoughPattern::patternLength");
59  if (log.level() <= MSG::VERBOSE) log << MSG::VERBOSE << "MuonHoughPattern::pattern_size <2" << endmsg;
60  }
61 
62  return max_patternlength;
63 }

◆ printHoughPattern()

void MuonHoughPattern::printHoughPattern ( ) const

prints out info about hough pattern

Definition at line 91 of file MuonHoughPattern.cxx.

91  {
92  MsgStream log(Athena::getMessageSvc(), "MuonHoughPattern::printHoughPattern");
93  if (m_hit.empty()) {
94  if (log.level() <= MSG::VERBOSE) log << MSG::VERBOSE << "MuonHoughPattern::No pattern_Segment" << endmsg;
95  }
96 
97  if (log.level() <= MSG::VERBOSE) log << MSG::VERBOSE << "MuonHoughPattern::Size of MuonHoughPattern: " << m_hit.size() << endmsg;
98  for (unsigned int i = 0; i < m_hit.size(); i++) {
99  if (log.level() <= MSG::VERBOSE)
100  log << MSG::VERBOSE << m_hit[i]->getHitx() << " " << m_hit[i]->getHity() << " " << m_hit[i]->getHitz() << " "
101  << m_hit[i]->getId() << endmsg;
102  }
103 }

◆ removeHit()

void MuonHoughHitContainer::removeHit ( unsigned int  hitno)
inherited

remove hit from container

Definition at line 13 of file MuonHoughHitContainer.cxx.

13  {
14  if (hitno >= m_hit.size()) { throw std::runtime_error("MuonHoughHitContainer::range error!"); }
15 
16  m_hit.erase(m_hit.begin() + hitno);
17 }

◆ reserve()

void MuonHoughHitContainer::reserve ( int  size)
inlineinherited

allocates memory for hitvector

Definition at line 106 of file MuonHoughHitContainer.h.

106 { m_hit.reserve(size); }

◆ resetTracksegment()

void MuonHoughPattern::resetTracksegment ( )

clear pattern

Definition at line 13 of file MuonHoughPattern.cxx.

13  {
14  m_hit.clear();
15 }

◆ setEAngle()

void MuonHoughPattern::setEAngle ( double  eangle)

set angle in precision plane in rad

Definition at line 137 of file MuonHoughPattern.cxx.

137  {
138  switch (m_id_number) {
139  case MuonHough::hough_xy: m_ephi = eangle; break;
140  case MuonHough::hough_rz:
144  case MuonHough::hough_curved_at_a_cylinder: m_etheta = eangle; break;
145  default:
146  MsgStream log(Athena::getMessageSvc(), "MuonHoughPattern::setEAngle");
147  if (log.level() <= MSG::VERBOSE) log << MSG::VERBOSE << "MuonHoughPattern::no valid id_number" << endmsg;
148  }
149 }

◆ setECurvature()

void MuonHoughPattern::setECurvature ( double  curvature)
inline

set curvature of pattern

Definition at line 127 of file MuonHoughPattern.h.

127 { m_ecurvature = ecurvature; }

◆ setEPhi()

void MuonHoughPattern::setEPhi ( double  ephi)
inline

set phi of pattern

Definition at line 123 of file MuonHoughPattern.h.

123 { m_ephi = ephi; }

◆ setER()

void MuonHoughPattern::setER ( double  er)

set radius in precision plane in mm

Definition at line 151 of file MuonHoughPattern.cxx.

151  {
152  switch (m_id_number) {
153  case MuonHough::hough_xy: m_erphi = er; break;
154  case MuonHough::hough_rz:
159  default:
160  MsgStream log(Athena::getMessageSvc(), "MuonHoughPattern::setER");
161  if (log.level() <= MSG::VERBOSE) log << MSG::VERBOSE << "MuonHoughPattern::no valid id_number" << endmsg;
162  }
163 }

◆ setERPhi()

void MuonHoughPattern::setERPhi ( double  erphi)
inline

set r0 of pattern

Definition at line 124 of file MuonHoughPattern.h.

124 { m_erphi = erphi; }

◆ setERTheta()

void MuonHoughPattern::setERTheta ( double  ertheta)
inline

set z0 of pattern

Definition at line 126 of file MuonHoughPattern.h.

126 { m_ertheta = ertheta; }

◆ setETheta()

void MuonHoughPattern::setETheta ( double  etheta)
inline

set theta of pattern

Definition at line 125 of file MuonHoughPattern.h.

125 { m_etheta = etheta; }

◆ setMaximumHistogram()

void MuonHoughPattern::setMaximumHistogram ( double  maximumhistogram)
inline

set maximum of histogram used to generate pattern

Definition at line 128 of file MuonHoughPattern.h.

128 { m_maximumhistogram = maximumhistogram; }

◆ setWhichSegment()

void MuonHoughPattern::setWhichSegment ( bool  which_segment)
inline

set which segment pattern is in, not in use

Definition at line 130 of file MuonHoughPattern.h.

130 { m_whichsegment = which_segment; }

◆ size()

unsigned int MuonHoughHitContainer::size ( ) const
inlineinherited

returns size of hitcontainer

Definition at line 104 of file MuonHoughHitContainer.h.

104 { return m_hit.size(); }

◆ updateParametersRPhi()

void MuonHoughPattern::updateParametersRPhi ( bool  cosmics = false)

update parameters in rphi plane based on weighted fit

Definition at line 192 of file MuonHoughPattern.cxx.

192  {
193  if (empty()) return;
194 
195  double sum_x = 0.;
196  double sum_y = 0.;
197 
198  int hitsno = size();
199 
200  for (unsigned int i = 0; i < size(); i++) {
201  sum_x += getHitx(i); //*getOrigWeight(i);
202  sum_y += getHity(i); //*getOrigWeight(i);
203  }
204 
205  // adding interaction point constraint:
206  if (!cosmics || size() == 1) hitsno += size();
207 
208  const double av_x = sum_x / (hitsno + 0.);
209  const double av_y = sum_y / (hitsno + 0.);
210 
211  double sumx = 0.;
212  double sumy = 0.;
213  for (unsigned int i = 0; i < size(); i++) {
214  double hitx = getHitx(i);
215  double hity = getHity(i);
216  double x_offset = hitx - av_x;
217  double y_offset = hity - av_y;
218  double weight = (x_offset * x_offset + y_offset * y_offset); //*getOrigWeight(i);
219  int sign = 1;
220  if (!cosmics) {
221  if (x_offset * hitx + y_offset * hity < 0) { sign = -1; }
222  } else {
223  if (y_offset < 0) { sign = -1; } // assume cosmic muon comes from above
224  }
225  sumx += weight * sign * x_offset;
226  sumy += weight * sign * y_offset;
227  }
228  // adding interaction point (count size)
229  if (!cosmics) {
230  double weight = av_x * av_x + av_y * av_y;
231  sumx += size() * weight * av_x;
232  sumy += size() * weight * av_y;
233  }
234 
235  if (std::abs(sumx) < 0.000001 || std::abs(sumy) < 0.000001) { return; }
236 
237  double phi = std::atan2(sumy, sumx);
238  if (cosmics) {
239  if (phi > 0) phi -= M_PI; // phi between 0,-Pi for cosmics!
240  }
241 
242  CxxUtils::sincos scphi(phi);
243 
244  const double r0 = scphi.apply(av_x, -av_y);
245 
246  setEPhi(phi);
247  setERPhi(r0);
248 }

Member Data Documentation

◆ m_ecurvature

double MuonHoughPattern::m_ecurvature {1.}
private

curvature of pattern in rz plane in mm

Definition at line 109 of file MuonHoughPattern.h.

◆ m_ephi

double MuonHoughPattern::m_ephi {-M_PI_2}
private

phi in rad

Definition at line 101 of file MuonHoughPattern.h.

◆ m_erphi

double MuonHoughPattern::m_erphi {0.}
private

r0 in mm

Definition at line 103 of file MuonHoughPattern.h.

◆ m_ertheta

double MuonHoughPattern::m_ertheta {0.}
private

z0 in mm

Definition at line 107 of file MuonHoughPattern.h.

◆ m_etheta

double MuonHoughPattern::m_etheta {M_PI_2}
private

theta in rad

Definition at line 105 of file MuonHoughPattern.h.

◆ m_hit

std::vector<std::shared_ptr<MuonHoughHit> > MuonHoughHitContainer::m_hit
protectedinherited

vector of hits in container

Definition at line 86 of file MuonHoughHitContainer.h.

◆ m_id_number

int MuonHoughPattern::m_id_number {-1}
private

id number of hough transform used to generate pattern

Definition at line 94 of file MuonHoughPattern.h.

◆ m_maximumhistogram

double MuonHoughPattern::m_maximumhistogram {0.}
private

maximum of histogram

Definition at line 111 of file MuonHoughPattern.h.

◆ m_whichsegment

bool MuonHoughPattern::m_whichsegment {false}
private

which segment is pattern created in, not relevant if split search is off 0 lower segment, 1 uppersegment

Definition at line 98 of file MuonHoughPattern.h.


The documentation for this class was generated from the following files:
MuonHoughPattern::setERPhi
void setERPhi(double erphi)
set r0 of pattern
Definition: MuonHoughPattern.h:124
MuonHoughHitContainer::MuonHoughHitContainer
MuonHoughHitContainer()=default
MuonHoughHitContainer does own its hits all added hits should be 'newed', except when m_ownhits==fals...
MuonHoughPattern::m_ephi
double m_ephi
phi in rad
Definition: MuonHoughPattern.h:101
MuonHoughMathUtils::signedDistanceToLine
static double signedDistanceToLine(double x0, double y0, double r0, double phi)
distance from (x0,y0) to the line (r0,phi), phi in rad
Definition: MuonHoughMathUtils.cxx:31
MuonHough::hough_rzcosmics
@ hough_rzcosmics
Definition: MuonHoughPattern.h:14
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
MuonHough::hough_rz_mdt
@ hough_rz_mdt
Definition: MuonHoughPattern.h:14
MuonHough::CSC
@ CSC
Definition: MuonHoughHit.h:17
MuonHoughHitContainer::getMeasuresPhi
bool getMeasuresPhi(unsigned int hitno) const
returns if hit hitno measures phi
Definition: MuonHoughHitContainer.h:109
MuonHoughPattern::m_etheta
double m_etheta
theta in rad
Definition: MuonHoughPattern.h:105
MuonHoughHitContainer::getHit
std::shared_ptr< MuonHoughHit > getHit(int hitno) const
returns Hit at position hitno
Definition: MuonHoughHitContainer.h:91
MuonHough::hough_rz_rpc
@ hough_rz_rpc
Definition: MuonHoughPattern.h:14
M_PI
#define M_PI
Definition: ActiveFraction.h:11
MuonHoughPattern::setEPhi
void setEPhi(double ephi)
set phi of pattern
Definition: MuonHoughPattern.h:123
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
cosmics
Definition: cosmics.py:1
MuonHoughHitContainer::m_hit
std::vector< std::shared_ptr< MuonHoughHit > > m_hit
vector of hits in container
Definition: MuonHoughHitContainer.h:86
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
MuonHoughHit::setId
void setId(int id)
set id
Definition: MuonHoughHit.h:178
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
MuonHoughPattern::m_ertheta
double m_ertheta
z0 in mm
Definition: MuonHoughPattern.h:107
MuonHough::hough_xy
@ hough_xy
Definition: MuonHoughPattern.h:14
lumiFormat.i
int i
Definition: lumiFormat.py:85
z
#define z
MuonHoughHitContainer::size
unsigned int size() const
returns size of hitcontainer
Definition: MuonHoughHitContainer.h:104
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
MuonHoughPattern::m_id_number
int m_id_number
id number of hough transform used to generate pattern
Definition: MuonHoughPattern.h:94
MuonHoughHitContainer::getHity
double getHity(unsigned int hitno) const
returns y position of hit hitno
Definition: MuonHoughHitContainer.h:95
TRT_PAI_physicsConstants::r0
const double r0
electron radius{cm}
Definition: TRT_PAI_physicsConstants.h:20
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
MuonHough::hough_curved_at_a_cylinder
@ hough_curved_at_a_cylinder
Definition: MuonHoughPattern.h:14
MuonHoughPattern::m_maximumhistogram
double m_maximumhistogram
maximum of histogram
Definition: MuonHoughPattern.h:111
MuonHoughPattern::m_whichsegment
bool m_whichsegment
which segment is pattern created in, not relevant if split search is off 0 lower segment,...
Definition: MuonHoughPattern.h:98
MuonHough::RPC
@ RPC
Definition: MuonHoughHit.h:17
MuonHoughPattern::m_erphi
double m_erphi
r0 in mm
Definition: MuonHoughPattern.h:103
MuonHoughHitContainer::getDetectorId
MuonHough::DetectorTechnology getDetectorId(unsigned int hitno) const
returns detectortechnology of hit hitno
Definition: MuonHoughHitContainer.h:107
MuonHough::TGC
@ TGC
Definition: MuonHoughHit.h:17
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
MuonHoughHitContainer::empty
bool empty() const
returns if hitcontainer is empty
Definition: MuonHoughHitContainer.h:105
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
CxxUtils::sincos
Helper to simultaneously calculate sin and cos of the same angle.
Definition: sincos.h:76
MuonHoughPattern::m_ecurvature
double m_ecurvature
curvature of pattern in rz plane in mm
Definition: MuonHoughPattern.h:109
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
MuonHoughHitContainer::getHitx
double getHitx(unsigned int hitno) const
returns x position of hit hitno
Definition: MuonHoughHitContainer.h:94
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
MuonHough::MDT
@ MDT
Definition: MuonHoughHit.h:17
MuonHoughHit::getId
int getId() const
returns id
Definition: MuonHoughHit.h:156
MuonHough::hough_rz
@ hough_rz
Definition: MuonHoughPattern.h:14