9#include "GaudiKernel/MsgStream.h"
19 for (
unsigned int i = 0; i <
size(); i++) {
20 if (
m_hit[i]->getId() == hit->getId()) {
return true; }
30 double max_patternlength = 0;
32 if (
m_hit.size() >= 2) {
33 double pattern_length1 = 0, pattern_length2 = 0;
38 max_patternlength =
diff.mag();
40 for (
unsigned int i = 2; i <
m_hit.size(); i++) {
42 pattern_length1 =
diff.mag();
45 pattern_length2 =
diff.mag();
47 if (pattern_length1 <= max_patternlength && pattern_length2 <= max_patternlength) {
49 }
else if (pattern_length1 > max_patternlength && pattern_length1 >= pattern_length2) {
51 max_patternlength = pattern_length1;
52 }
else if (pattern_length2 > max_patternlength && pattern_length2 > pattern_length1) {
54 max_patternlength = pattern_length2;
59 if (log.level() <= MSG::VERBOSE) log << MSG::VERBOSE <<
"MuonHoughPattern::pattern_size <2" <<
endmsg;
62 return max_patternlength;
70 for (
unsigned int hitno = 0; hitno <
m_hit.size(); hitno++) {
94 if (log.level() <= MSG::VERBOSE) log << MSG::VERBOSE <<
"MuonHoughPattern::No pattern_Segment" <<
endmsg;
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() <<
" "
116 if (log.level() <= MSG::VERBOSE) log << MSG::VERBOSE <<
"MuonHoughPattern::no valid id_number" <<
endmsg;
132 if (log.level() <= MSG::VERBOSE) log << MSG::VERBOSE <<
"MuonHoughPattern::no valid id_number" <<
endmsg;
147 if (log.level() <= MSG::VERBOSE) log << MSG::VERBOSE <<
"MuonHoughPattern::no valid id_number" <<
endmsg;
161 if (log.level() <= MSG::VERBOSE) log << MSG::VERBOSE <<
"MuonHoughPattern::no valid id_number" <<
endmsg;
189 return {scphi.
cs * sctheta.
sn, scphi.
sn * sctheta.
sn, sctheta.
cs};
200 for (
unsigned int i = 0; i <
size(); i++) {
208 const double av_x = sum_x / (hitsno + 0.);
209 const double av_y = sum_y / (hitsno + 0.);
213 for (
unsigned int i = 0; i <
size(); 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);
221 if (x_offset * hitx + y_offset * hity < 0) {
sign = -1; }
223 if (y_offset < 0) {
sign = -1; }
225 sumx += weight *
sign * x_offset;
226 sumy += weight *
sign * y_offset;
230 double weight = av_x * av_x + av_y * av_y;
231 sumx +=
size() * weight * av_x;
232 sumy +=
size() * weight * av_y;
235 if (std::abs(sumx) < 0.000001 || std::abs(sumy) < 0.000001) {
return; }
237 double phi = std::atan2(sumy, sumx);
244 const double r0 = scphi.
apply(av_x, -av_y);
Scalar phi() const
phi method
void diff(const Jet &rJet1, const Jet &rJet2, std::map< std::string, double > varDiff)
Difference between jets - Non-Class function required by trigger.
unsigned int size() const
returns size of hitcontainer
double getHitx(unsigned int hitno) const
returns x position of hit hitno
double getHity(unsigned int hitno) const
returns y position of hit hitno
std::shared_ptr< MuonHoughHit > getHit(int hitno) const
returns Hit at position hitno
std::vector< std::shared_ptr< MuonHoughHit > > m_hit
vector of hits in container
bool empty() const
returns if hitcontainer is empty
MuonHoughHitContainer()=default
MuonHoughHitContainer does own its hits all added hits should be 'newed', except when m_ownhits==fals...
double getHitz() const
returns z position
static double signedDistanceToLine(double x0, double y0, double r0, double phi)
distance from (x0,y0) to the line (r0,phi), phi in rad
Amg::Vector3D getEPos() const
calulates 3d point closest to ip
void printHoughPattern() const
prints out info about hough pattern
void setERPhi(double erphi)
set r0 of pattern
void updateParametersRPhi(bool cosmics=false)
update parameters in rphi plane based on weighted fit
void resetTracksegment()
clear pattern
void setER(double er)
set radius in precision plane in mm
double calculateEZ() const
calculate estimated z-position of pattern
double patternLength() const
returns distance between first and last hit
double getER() const
returns radius in precision plane in mm
double getEAngle() const
returns angle in precision plane in rad
bool hitInHoughPattern(const std::shared_ptr< MuonHoughHit > &hit) const
returns if hit is in pattern
void setEAngle(double eangle)
set angle in precision plane in rad
Amg::Vector3D getEDir() const
calculates direction at point closest to ip
double m_etheta
theta in rad
void setEPhi(double ephi)
set phi of pattern
MuonHoughPattern(int id_number)
MuonHoughPattern does not own its hits (contrary to the default) MuonHoughHitContainer!
int m_id_number
id number of hough transform used to generate pattern
singleton-like access to IMessageSvc via open function and helper
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
Eigen::Matrix< double, 3, 1 > Vector3D
IMessageSvc * getMessageSvc(bool quiet=false)
@ hough_curved_at_a_cylinder
Helper to simultaneously calculate sin and cos of the same angle.
Helper to simultaneously calculate sin and cos of the same angle.
double apply(double a, double b) const