9typedef std::array<fp_t, 2>
pvec;
16 return { {
a[0]+b[0],
a[1]+b[1]} };
19 return { {
a[0]-b[0],
a[1]-b[1]} };
23 return { {
a[0]*scale,
a[1]*scale} };
27 return std::hypot(v[0], v[1]);
31 return { -v[1], v[0]};
35 return a[0]*b[1] -
a[1]*b[0];
41 return StatusCode::FAILURE;
46 return StatusCode::SUCCESS;
51 return StatusCode::SUCCESS;
59 for (
unsigned ihit1 = 0; ihit1 < hits.size(); ihit1++) {
60 std::shared_ptr<const FPGATrackSimHit> hit1 = hits[ihit1];
61 for (
unsigned ihit2 = ihit1+1; ihit2 < hits.size(); ihit2++) {
62 std::shared_ptr<const FPGATrackSimHit> hit2 = hits[ihit2];
63 ATH_MSG_DEBUG(
"Hits pair R: " << hit1->getR() <<
" " << hit2->getR());
65 const double radiusDifference = hit2->getR() - hit1->getR();
69 if ( hit1->getLayer() == hit2->getLayer() )
80 ATH_MSG_DEBUG(
"Creating road with threshold " << image(
x,
y).first <<
" hits " << image(
x,
y).second.size()
90 return StatusCode::SUCCESS;
95 const pvec p1 {{hit1->getX(), hit1->getY()}};
96 const pvec p2 {{hit2->getX(), hit2->getY()}};
97 const pvec halfDiff = (p2 - p1)*0.5;
104 const fp_t radius = 1.0/(0.6*qoverpt);
105 const fp_t scale = std::copysign( std::sqrt( std::pow(radius/halfLen, 2) - 1), radius );
107 const pvec center = p1 + halfDiff + rprime;
108 const fp_t d0 = (std::signbit(radius) ? -1.0 : 1.0)*(
length(center) - abs(radius));
114 if (xbefore == -1) xbefore =
x;
116 const int xmin = (xbefore <
x)? xbefore:
x;
117 const int xmax = (xbefore <
x)?
x: xbefore;
118 for (
int xinterpolated =
xmin; xinterpolated <=
xmax; ++xinterpolated) {
119 image(xinterpolated,
y).first++;
120 image(xinterpolated,
y).second.insert( hit1 );
121 image(xinterpolated,
y).second.insert( hit2 );
125 image(
x,
y).second.insert( hit1 );
126 image(
x,
y).second.insert( hit2 );
131 return StatusCode::SUCCESS;
136 std::vector<std::shared_ptr<const FPGATrackSimHit>> road_hits;
138 for (
const auto & hit : hits)
140 road_hits.push_back(hit);
141 hitLayers |= 1 << hit->getLayer();
145 sorted_hits.resize(8);
148 r.setHitLayers(hitLayers);
149 r.setHits(std::move(sorted_hits));
155 const int count = image(
x,
y).first;
156 const float d0 =
xtod0(
x);
164 const auto centerValue = image(
x,
y).first;
165 for (
int xaround = std::min(
x-1, 0); xaround <= std::max((
int)
m_imageSize_x-1,
x+1); xaround++ ) {
166 for (
int yaround = std::min(
y-1, 0); yaround <= std::max((
int)
m_imageSize_y-1,
y+1); yaround++ ) {
167 if ( image(xaround,yaround).first > centerValue )
176 TH2I
h((
"event"+std::to_string(
m_event )).c_str(),
"LLP Doublet Hough space;d_{0}[mm];q/pT [e/GeV]",
182 h.SetBinContent(
x+1,
y+1, image(
x,
y).first);
184 h.SaveAs((name()+
"_event_"+std::to_string(
m_event )+
".root").c_str(),
"");
#define ATH_CHECK
Evaluate an expression and check for errors.
std::vector< std::vector< std::shared_ptr< const FPGATrackSimHit > > > sortByLayer(Container const &hits)
Header file for AthHistogramAlgorithm.
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string