21 inline constexpr
T r(
T &
x,
T &
y)
47 m_seeds = findNode::getClass<TrackSeedContainer>(topNode,
"SvtxTrackSeedContainer");
50 std::cout <<
PHWHERE <<
"No track seed container, cannot continue" << std::endl;
54 m_siliconSeeds = findNode::getClass<TrackSeedContainer>(topNode,
"SiliconTrackSeedContainer");
55 m_tpcSeeds = findNode::getClass<TrackSeedContainer>(topNode,
"TpcTrackSeedContainer");
58 std::cout <<
PHWHERE <<
"Missing seed container, exiting." << std::endl;
62 m_geometry = findNode::getClass<ActsGeometry>(topNode,
"ActsGeometry");
65 std::cout <<
PHWHERE <<
"no acts geometry, can't continue" << std::endl;
69 m_clusterMap = findNode::getClass<TrkrClusterContainer>(topNode,
"TRKR_CLUSTER");
72 std::cout <<
PHWHERE <<
"no cluster map, can't continue" << std::endl;
84 std::cout <<
"Seed container size " <<
m_seeds->
size() << std::endl;
94 unsigned int tpcid1 = track1->get_tpc_seed_index();
95 unsigned int siid1 = track1->get_silicon_seed_index();
99 for (
auto tr2it = tr1it; tr2it !=
m_seeds->
end();
105 for (
auto &
pos : globTr1.second)
107 float clusr =
r(
pos.x(),
pos.y());
108 if (
pos.y() < 0) clusr *= -1;
109 tr1_rz_pts.push_back(std::make_pair(
pos.z(), clusr));
110 tr1_xy_pts.push_back(std::make_pair(
pos.x(),
pos.y()));
115 float tr1xyslope = std::get<0>(xyTr1Params);
116 float tr1rzslope = std::get<0>(rzTr1Params);
119 if (fabs(tr1rzslope) < 0.005)
129 auto track2 = *tr2it;
135 unsigned int tpcid2 = track2->get_tpc_seed_index();
136 unsigned int siid2 = track2->get_silicon_seed_index();
143 for (
auto &
pos : globTr2.second)
145 float clusr =
r(
pos.x(),
pos.y());
146 if (
pos.y() < 0) clusr *= -1;
147 tr2_rz_pts.push_back(std::make_pair(
pos.z(), clusr));
148 tr2_xy_pts.push_back(std::make_pair(
pos.x(),
pos.y()));
154 float tr2xyslope = std::get<0>(xyTr2Params);
156 float tr2rzslope = std::get<0>(rzTr2Params);
158 std::vector<TrkrDefs::cluskey> ckeyUnion;
159 std::set_intersection(globTr1.first.begin(), globTr1.first.end(),
160 globTr2.first.begin(), globTr2.first.end(), std::back_inserter(ckeyUnion));
164 (ckeyUnion.size() > 10) or
166 (fabs(tr1xyslope - tr2xyslope) < 0.5 &&
168 fabs(tr1rzslope - tr2rzslope * -1) < 0.5))
172 std::cout <<
"Combining tr" <<
m_seeds->
index(tr1it) <<
" with sil/tpc " << tpcid1
173 <<
", " << siid1 <<
" with tr "
174 <<
m_seeds->
index(tr2it) <<
" with sil/tpc " << tpcid2 <<
", "
175 << siid2 <<
" with slopes "
176 << tr1xyslope <<
", " << tr2xyslope <<
", "
177 << tr1rzslope <<
", " << tr2rzslope <<
" and ckey union "
178 << ckeyUnion.size() << std::endl;
181 for (
auto &key : globTr2.first)
183 globTr1.first.push_back(key);
185 for (
auto &
pos : globTr2.second)
187 globTr1.second.push_back(
pos);
191 if (silseed1 && silseed2)
206 std::cout <<
"Seed container size to finish " <<
m_seeds->
size() << std::endl;
212 std::cout << std::endl;
213 unsigned int tpcid1 =
seed->get_tpc_seed_index();
214 unsigned int siid1 =
seed->get_silicon_seed_index();
220 silseed1->identify();
225 std::cout <<
"nullptr seed was removed" << std::endl;
236 for (
const auto &
pos : glob.second)
238 float clusr =
r(
pos.x(),
pos.y());
239 if (
pos.y() < 0) clusr *= -1;
241 if (fabs(clusr) > 80.)
continue;
242 tr_rz_pts.push_back(std::make_pair(
pos.z(), clusr));
243 tr_xy_pts.push_back(std::make_pair(
pos.x(),
pos.y()));
249 for (
int i = 0;
i < glob.first.size();
i++)
251 auto &
pos = glob.second[
i];
252 float clusr =
r(
pos.x(),
pos.y());
253 if (
pos.y() < 0) clusr *= -1;
255 if (fabs(clusr) > 80.)
continue;
256 float perpxyslope = -1. / std::get<0>(xyParams);
257 float perpxyint =
pos.y() - perpxyslope *
pos.x();
258 float perprzslope = -1. / std::get<0>(rzParams);
259 float perprzint = clusr - perprzslope *
pos.z();
261 float pcax = (perpxyint - std::get<1>(xyParams)) / (std::get<0>(xyParams) - perpxyslope);
262 float pcay = std::get<0>(xyParams) * pcax + std::get<1>(xyParams);
264 float pcaz = (perprzint - std::get<1>(rzParams)) / (std::get<0>(rzParams) - perprzslope);
265 float pcar = std::get<0>(rzParams) * pcaz + std::get<1>(rzParams);
266 float dcax = pcax -
pos.x();
267 float dcay = pcay -
pos.y();
268 float dcar = pcar - clusr;
269 float dcaz = pcaz -
pos.z();
272 if (dcaxy > 1. || dcarz > 1.)
287 std::cout <<
"adding " << *
it <<
" with pos " << glob.transpose() << std::endl;
296 std::vector<TrkrDefs::cluskey> ckeys;
303 ckeys.push_back(key);