27 return StatusCode::SUCCESS;
33 ATH_MSG_INFO(
"-----------------------------------------");
41 ATH_MSG_INFO(
"-----------------------------------------");
42 return StatusCode::SUCCESS;
47 for (
int i = 0; i <
header.nTowers(); ++i)
50 std::vector<FPGATrackSimHit> hits = tower.
hits();
51 if (hits.empty())
continue;
58 return StatusCode::SUCCESS;
68 for (
const auto & hit : hits) {
73 ATH_MSG_DEBUG(
"Pixel hit z = " << hit.getZ() <<
", r = " << hit.getR() <<
", phi = " << hit.getGPhi());
78 std::vector<int> module_desc(4);
80 module_desc[0] = (int)hit.getDetectorZone();
81 module_desc[1] = hit.getPhysLayer()/2;
82 unsigned side = hit.getPhysLayer()%2;
83 module_desc[2] = hit.getPhiModule();
84 module_desc[3] = hit.getEtaModule();
87 m_map[module_desc].first.push_back(hit);
89 m_map[module_desc].second.push_back(hit);
92 ATH_MSG_DEBUG(
"Running spacepoints default tool over " << strip_hits <<
" strip hits.");
94 return StatusCode::SUCCESS;
103 for (
auto entry :
m_map)
106 std::vector<FPGATrackSimHit>& hits_inner = entry.second.first;
107 std::vector<FPGATrackSimHit>& hits_outer = entry.second.second;
109 for (
auto hit_in : hits_inner) {
110 int startsize = spacepoints.size();
111 bool foundPair =
searchForMatch(hit_in,hits_outer,tower,spacepoints);
115 std::vector<int> nextmod = entry.first;
117 auto entry2 =
m_map.find(nextmod);
118 if (entry2!=
m_map.end()) {
119 foundPair =
searchForMatch(hit_in,entry2->second.second,tower,spacepoints);
127 std::vector<int> nextphimod = entry.first;
129 auto entry3 =
m_map.find(nextphimod);
130 if (entry3!=
m_map.end()) {
131 foundPair =
searchForMatch(hit_in,entry3->second.second,tower,spacepoints);
139 std::vector<int> next2mod = entry.first;
142 auto entry4 =
m_map.find(next2mod);
143 if (entry4!=
m_map.end()) {
144 foundPair =
searchForMatch(hit_in,entry4->second.second,tower,spacepoints);
157 spacepoints.push_back(std::move(unpairedCluster));
158 ATH_MSG_DEBUG(
"Unpaired hit z = " << hit_in.getZ() <<
", r = " << hit_in.getR() <<
", phi = " << hit_in.getGPhi() <<
", phi module = " << hit_in.getPhiModule() <<
", eta module = " << hit_in.getEtaModule());
167 bool foundPair=
false;
169 if (std::abs(hit_in.getGPhi()-hit_out.getGPhi()) <
m_phiwindow) {
176 std::vector<int> nextmod = entry.first;
178 auto entry2 =
m_map.find(nextmod);
179 if (entry2!=
m_map.end()) {
180 for (
const auto & hit_in : entry2->second.first) {
181 if (std::abs(hit_in.getGPhi()-hit_out.getGPhi()) <
m_phiwindow) {
192 std::vector<int> nextphimod = entry.first;
194 auto entry3 =
m_map.find(nextphimod);
195 if (entry3!=
m_map.end()) {
196 for (
const auto & hit_in : entry3->second.first) {
197 if (std::abs(hit_in.getGPhi()-hit_out.getGPhi()) <
m_phiwindow) {
209 std::vector<int> next2mod = entry.first;
212 auto entry4 =
m_map.find(next2mod);
213 if (entry4!=
m_map.end()) {
214 for (
const auto & hit_in : entry4->second.first) {
215 if (std::abs(hit_in.getGPhi()-hit_out.getGPhi()) <
m_phiwindow) {
232 spacepoints.push_back(std::move(unpairedCluster));
233 ATH_MSG_DEBUG(
"Unpaired hit z = " << hit_out.getZ() <<
", r = " << hit_out.getR() <<
", phi = " << hit_out.getGPhi() <<
", phi module = " << hit_out.getPhiModule() <<
", eta module = " << hit_out.getEtaModule());
246 return StatusCode::SUCCESS;
252 bool foundPair =
false;
274 float r = TMath::Sqrt(
x*
x +
y*
y);
275 ATH_MSG_DEBUG(
"Spacepoint x = " <<
x <<
", y = " <<
y <<
", z = " <<
z <<
", r = " <<
r);
286 new_truth.
add(truth_in);
287 new_truth.
add(truth_out);
326 sp.setClusterEquiv(hit_in);
327 sp.push_backHitList(hit_in);
329 spacepoints.push_back(std::move(
sp));
338 float r_sp = (hit_in.
getR() + hit_out.
getR()) / 2.0;;
339 float z_sp = (hit_in.
getZ() + hit_out.
getZ()) / 2.0;;
341 float delta_phi_local = (hit_in.
getGPhi() - hit_out.
getGPhi()) * r_sp;
345 static const float stereo_angle = 0.026;
346 z_sp += delta_phi_local/tan(stereo_angle)/2.0;
350 static const float stereo_angle = 0.020;
351 r_sp += delta_phi_local/tan(stereo_angle)/2.0;
356 float r_bounds[19] = {394.0, 415.5, 442.0, 472.4, 498.85, 521.45, 547.05, 566.65, 591.0, 621.8, 654.7, 683.9, 710.2, 739.4, 784.2, 838.8, 887.6, 937.7, 967.8};
359 float r_limited = std::max(r_sp,r_bounds[hit_in.
getEtaModule()]);
360 r_limited = std::min(r_sp,r_bounds[hit_in.
getEtaModule()+1]);
361 if (r_sp!=r_limited) {
362 ATH_MSG_WARNING(
"Spacepoint location not in module boundary: r_sp=" << r_sp
368 float r_limited = std::max(r_sp,r_bounds[hit_in.
getEtaModule()+1]-window);
369 r_limited = std::min(r_sp,r_bounds[hit_in.
getEtaModule()+1]+window);
370 if (r_sp!=r_limited) {
371 ATH_MSG_WARNING(
"Crossing spacepoint location too far from module boundary: r_sp=" << r_sp
372 <<
" not in [" << r_bounds[hit_in.
getEtaModule()+1]-window <<
"," << r_bounds[hit_in.
getEtaModule()+1]+window <<
"]");
380 x = r_sp*cos(phi_sp);
381 y = r_sp*sin(phi_sp);
392 hit.
setX(pos[0] * std::cos(pos[1]));
393 hit.
setY(pos[0] * std::sin(pos[1]));
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
: FPGATrackSim-specific class to represent an hit in the detector.
void setClusterEquiv(const FPGATrackSimHit &input)
void push_backHitList(const FPGATrackSimHit &input)
void makeSpacepoint(float x, float y, float z, float window, FPGATrackSimHit &other, FPGATrackSimMultiTruth &new_truth)
int getEtaModule(bool old=false) const
unsigned getPhiModule() const
int getCluster1ID() const
void setCluster2ID(int v)
const FPGATrackSimMultiTruth & getTruth() const
void add(const FPGATrackSimMultiTruth::Barcode &code, const FPGATrackSimMultiTruth::Weight &weight)