44 h_zvtxseed_ =
new TH1F(
"h_zvtxseed",
"Zvertex Seed histogram", 200, -50, 50);
62 std::cout <<
"====================== InttVertexFinder::InitRun() =====================" << std::endl;
63 std::cout <<
" beamcenter " <<
xbeam_ <<
" " <<
ybeam_ << std::endl;
64 std::cout <<
"===========================================================================" << std::endl;
76 std::cout <<
PHWHERE <<
"DST Node missing doing nothing" << std::endl;
88 m_inttvertexmap = findNode::getClass<InttVertexMap>(inttNode,
"InttVertexMap");
93 inttNode->addNode(VertexMapNode);
103 std::cout <<
"Beginning process_event in InttVertexFinder" << std::endl;
106 m_tGeometry = findNode::getClass<ActsGeometry>(topNode,
"ActsGeometry");
109 std::cout <<
PHWHERE <<
"No ActsGeometry on node tree. Bailing." << std::endl;
114 m_clusterlist = findNode::getClass<TrkrClusterContainer>(topNode,
"TRKR_CLUSTER");
117 std::cout <<
PHWHERE <<
" ERROR: Can't find TRKR_CLUSTER." << std::endl;
123 double zcenter, zrms, zmean;
126 auto vertex = std::make_unique<InttVertexv1>();
132 std::cout <<
"intt vertex z " << zvertex << std::endl;
142 double* zcenter,
double* zrms,
double* zmean)
153 std::vector<ClustInfo>
clusters[8][2];
155 for (
unsigned int inttlayer = 0; inttlayer < 4; inttlayer++)
157 int inout = (inttlayer < 2) ? 0 : 1;
162 for (
auto clusIter = range.first; clusIter != range.second; ++clusIter)
164 const auto cluskey = clusIter->first;
165 const auto cluster = clusIter->second;
183 info.layer = inttlayer;
184 info.adc = cluster->getAdc();
185 info.pos = globalPos;
187 double phi = atan2(globalPos.y(), globalPos.x());
189 int iphi = (phi + M_PI) / M_PI / 4.;
197 clusters[iphi][inout].push_back(info);
205 std::vector<double> vz_array;
207 for (
auto& cluster : clusters)
209 for (
auto c1 = cluster[0].
begin(); c1 != cluster[0].end(); ++c1)
211 for (
auto &
c2 : cluster[1])
213 if (c1->adc < 40 ||
c2.adc < 40)
223 double p1_ang = atan2(p1.y(), p1.x());
224 double p2_ang = atan2(p2.y(), p2.x());
225 double d_ang = p2_ang - p1_ang;
227 if (fabs(d_ang) > 0.2)
234 double unorm = sqrt(u.x() * u.x() + u.y() * u.y());
241 double ux = u.x() / unorm;
242 double uy = u.y() / unorm;
243 double uz = u.z() / unorm;
248 double dca_p0 = p0.x() * uy - p0.y() * ux;
249 double len_p0 = p0.x() * ux + p0.y() * uy;
255 double vz = len_p0 * uz + p1.z();
257 if (fabs(d_ang) < 0.05 && fabs(dca_p0) < 1.0)
260 vz_array.push_back(vz);
267 double zvtx = -9999.;
269 double zcenter1 = -9999.;
270 double zmean1 = -9999.;
271 double zrms1 = -9999.;
272 if (vz_array.size() > 3)
283 double zmax = zcenter1 + zrms1;
284 double zmin = zcenter1 - zrms1;
288 for (
double vz : vz_array)
290 if (zmin <
vz &&
vz < zmax)
298 zvtx = zsum / zcount;
303 std::cout <<
"ZVTX: " << zvtx <<
" " << zcenter1 <<
" " << zmean1 <<
" " << zrms1 <<
" " << zbin << std::endl;
307 if (zcenter !=
nullptr)
315 if (zmean !=
nullptr)