17 declareInterface<FPGATrackSimSpacePointsToolI>(
this);
30 return StatusCode::SUCCESS;
36 ATH_MSG_INFO(
"-----------------------------------------");
44 ATH_MSG_INFO(
"-----------------------------------------");
45 return StatusCode::SUCCESS;
50 for (
int i = 0;
i <
header.nTowers(); ++
i)
53 std::vector<FPGATrackSimHit>
hits = tower.
hits();
54 if (
hits.empty())
continue;
61 return StatusCode::SUCCESS;
71 for (
auto hit :
hits) {
76 ATH_MSG_DEBUG(
"Pixel hit z = " << hit.getZ() <<
", r = " << hit.getR() <<
", phi = " << hit.getGPhi());
81 std::vector<int> module_desc(4);
83 module_desc[0] = (
int)hit.getDetectorZone();
84 module_desc[1] = hit.getPhysLayer()/2;
85 unsigned side = hit.getPhysLayer()%2;
86 module_desc[2] = hit.getPhiModule();
87 module_desc[3] = hit.getEtaModule();
90 m_map[module_desc].first.push_back(hit);
92 m_map[module_desc].second.push_back(hit);
95 ATH_MSG_DEBUG(
"Running spacepoints default tool over " << strip_hits <<
" strip hits.");
97 return StatusCode::SUCCESS;
109 std::vector<FPGATrackSimHit>& hits_inner =
entry.second.first;
110 std::vector<FPGATrackSimHit>& hits_outer =
entry.second.second;
112 for (
auto hit_in : hits_inner) {
113 int startsize = spacepoints.size();
114 bool foundPair =
searchForMatch(hit_in,hits_outer,tower,spacepoints);
118 std::vector<int> nextmod =
entry.first;
120 auto entry2 =
m_map.find(nextmod);
121 if (entry2!=
m_map.end()) {
122 foundPair =
searchForMatch(hit_in,entry2->second.second,tower,spacepoints);
130 std::vector<int> nextphimod =
entry.first;
132 auto entry3 =
m_map.find(nextphimod);
133 if (entry3!=
m_map.end()) {
134 foundPair =
searchForMatch(hit_in,entry3->second.second,tower,spacepoints);
142 std::vector<int> next2mod =
entry.first;
145 auto entry4 =
m_map.find(next2mod);
146 if (entry4!=
m_map.end()) {
147 foundPair =
searchForMatch(hit_in,entry4->second.second,tower,spacepoints);
156 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());
165 bool foundPair=
false;
167 if (abs(hit_in.getGPhi()-hit_out.getGPhi()) <
m_phiwindow) {
174 std::vector<int> nextmod =
entry.first;
176 auto entry2 =
m_map.find(nextmod);
177 if (entry2!=
m_map.end()) {
178 for (
auto hit_in : entry2->second.first) {
179 if (abs(hit_in.getGPhi()-hit_out.getGPhi()) <
m_phiwindow) {
190 std::vector<int> nextphimod =
entry.first;
192 auto entry3 =
m_map.find(nextphimod);
193 if (entry3!=
m_map.end()) {
194 for (
auto hit_in : entry3->second.first) {
195 if (abs(hit_in.getGPhi()-hit_out.getGPhi()) <
m_phiwindow) {
207 std::vector<int> next2mod =
entry.first;
210 auto entry4 =
m_map.find(next2mod);
211 if (entry4!=
m_map.end()) {
212 for (
auto hit_in : entry4->second.first) {
213 if (abs(hit_in.getGPhi()-hit_out.getGPhi()) <
m_phiwindow) {
226 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());
239 return StatusCode::SUCCESS;
245 bool foundPair =
false;
267 float r = TMath::Sqrt(
x*
x +
y*
y);
268 ATH_MSG_DEBUG(
"Spacepoint x = " <<
x <<
", y = " <<
y <<
", z = " <<
z <<
", r = " <<
r);
279 new_truth.
add(truth_in);
280 new_truth.
add(truth_out);
327 spacepoints.push_back(sp);
336 float r_sp = (hit_in.
getR() + hit_out.
getR()) / 2.0;;
337 float z_sp = (hit_in.
getZ() + hit_out.
getZ()) / 2.0;;
339 float delta_phi_local = (hit_in.
getGPhi() - hit_out.
getGPhi()) * r_sp;
343 static const float stereo_angle = 0.026;
344 z_sp += delta_phi_local/
tan(stereo_angle)/2.0;
348 static const float stereo_angle = 0.020;
349 r_sp += delta_phi_local/
tan(stereo_angle)/2.0;
354 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 if (r_sp!=r_limited) {
360 ATH_MSG_WARNING(
"Spacepoint location not in module boundary: r_sp=" << r_sp
368 if (r_sp!=r_limited) {
369 ATH_MSG_WARNING(
"Crossing spacepoint location too far from module boundary: r_sp=" << r_sp
370 <<
" not in [" << r_bounds[hit_in.
getEtaModule()+1]-window <<
"," << r_bounds[hit_in.
getEtaModule()+1]+window <<
"]");
378 x = r_sp*
cos(phi_sp);
379 y = r_sp*
sin(phi_sp);