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);
153 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());
162 bool foundPair=
false;
164 if (std::abs(hit_in.getGPhi()-hit_out.getGPhi()) <
m_phiwindow) {
171 std::vector<int> nextmod = entry.first;
173 auto entry2 =
m_map.find(nextmod);
174 if (entry2!=
m_map.end()) {
175 for (
const auto & hit_in : entry2->second.first) {
176 if (std::abs(hit_in.getGPhi()-hit_out.getGPhi()) <
m_phiwindow) {
187 std::vector<int> nextphimod = entry.first;
189 auto entry3 =
m_map.find(nextphimod);
190 if (entry3!=
m_map.end()) {
191 for (
const auto & hit_in : entry3->second.first) {
192 if (std::abs(hit_in.getGPhi()-hit_out.getGPhi()) <
m_phiwindow) {
204 std::vector<int> next2mod = entry.first;
207 auto entry4 =
m_map.find(next2mod);
208 if (entry4!=
m_map.end()) {
209 for (
const auto & hit_in : entry4->second.first) {
210 if (std::abs(hit_in.getGPhi()-hit_out.getGPhi()) <
m_phiwindow) {
223 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());
236 return StatusCode::SUCCESS;
242 bool foundPair =
false;
264 float r = TMath::Sqrt(
x*
x +
y*
y);
265 ATH_MSG_DEBUG(
"Spacepoint x = " <<
x <<
", y = " <<
y <<
", z = " <<
z <<
", r = " <<
r);
276 new_truth.
add(truth_in);
277 new_truth.
add(truth_out);
316 sp.setClusterEquiv(hit_in);
317 sp.push_backHitList(hit_in);
318 sp.push_backHitList(hit_out);
319 spacepoints.push_back(
sp);
328 float r_sp = (hit_in.
getR() + hit_out.
getR()) / 2.0;;
329 float z_sp = (hit_in.
getZ() + hit_out.
getZ()) / 2.0;;
331 float delta_phi_local = (hit_in.
getGPhi() - hit_out.
getGPhi()) * r_sp;
335 static const float stereo_angle = 0.026;
336 z_sp += delta_phi_local/tan(stereo_angle)/2.0;
340 static const float stereo_angle = 0.020;
341 r_sp += delta_phi_local/tan(stereo_angle)/2.0;
346 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};
349 float r_limited = std::max(r_sp,r_bounds[hit_in.
getEtaModule()]);
350 r_limited = std::min(r_sp,r_bounds[hit_in.
getEtaModule()+1]);
351 if (r_sp!=r_limited) {
352 ATH_MSG_WARNING(
"Spacepoint location not in module boundary: r_sp=" << r_sp
358 float r_limited = std::max(r_sp,r_bounds[hit_in.
getEtaModule()+1]-window);
359 r_limited = std::min(r_sp,r_bounds[hit_in.
getEtaModule()+1]+window);
360 if (r_sp!=r_limited) {
361 ATH_MSG_WARNING(
"Crossing spacepoint location too far from module boundary: r_sp=" << r_sp
362 <<
" not in [" << r_bounds[hit_in.
getEtaModule()+1]-window <<
"," << r_bounds[hit_in.
getEtaModule()+1]+window <<
"]");
370 x = r_sp*cos(phi_sp);
371 y = r_sp*sin(phi_sp);
382 hit.
setX(pos[0] * std::cos(pos[1]));
383 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 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)