54 inline T r(
const T&
x,
const T&
y)
61 std::vector<TrkrDefs::cluskey>
out;
66 std::copy(
seed->begin_cluster_keys(),
seed->end_cluster_keys(), std::back_inserter(out));
177 auto trackmap = findNode::getClass<SvtxTrackMap>(topNode,
m_trackMapName);
178 auto clustermap = findNode::getClass<TrkrClusterContainer>(topNode,
"TRKR_CLUSTER");
179 auto geometry = findNode::getClass<ActsGeometry>(topNode,
"ActsGeometry");
180 auto vertexmap = findNode::getClass<GlobalVertexMap>(topNode,
"GlobalVertexMap");
181 auto alignmentmap = findNode::getClass<SvtxAlignmentStateMap>(topNode,
m_alignmentMapName);
182 auto hitmap = findNode::getClass<TrkrHitSetContainer>(topNode,
"TRKR_HITSET");
184 findNode::getClass<PHG4TpcCylinderGeomContainer>(topNode,
"CYLINDERCELLGEOM_SVTX");
185 auto mvtxGeom = findNode::getClass<PHG4CylinderGeomContainer>(topNode,
"CYLINDERGEOM_MVTX");
186 auto inttGeom = findNode::getClass<PHG4CylinderGeomContainer>(topNode,
"CYLINDERGEOM_INTT");
187 auto mmGeom = findNode::getClass<PHG4CylinderGeomContainer>(topNode,
"CYLINDERGEOM_MICROMEGAS_FULL");
190 mmGeom = findNode::getClass<PHG4CylinderGeomContainer>(topNode,
"CYLINDERGEOM_MICROMEGAS");
192 if (!trackmap or !clustermap or !geometry or !hitmap)
194 std::cout <<
"Missing node, can't continue" << std::endl;
197 auto gl1 = findNode::getClass<Gl1RawHit>(topNode,
"GL1RAWHIT");
200 m_bco = gl1->get_bco();
201 auto lbshift =
m_bco << 24;
206 m_bco = std::numeric_limits<uint64_t>::quiet_NaN();
207 m_bcotr = std::numeric_limits<uint64_t>::quiet_NaN();
211 std::cout <<
"Track map size is " << trackmap->size() << std::endl;
216 fillHitTree(hitmap, geometry, tpcGeom, mvtxGeom, inttGeom, mmGeom);
224 for (
const auto& [key, track] : *trackmap)
256 if (vertexit != vertexmap->end())
258 auto vertex = vertexit->second;
271 std::cout <<
"Track " << key <<
" has cluster/states"
277 std::vector<TrkrDefs::cluskey> keys;
282 keys.push_back(ckey);
301 if (alignmentmap and alignmentmap->find(key) != alignmentmap->end())
303 auto& statevec = alignmentmap->find(key)->second;
305 for (
auto&
state : statevec)
307 auto ckey =
state->get_cluster_key();
311 auto& globderivs =
state->get_global_derivative_matrix();
312 auto& locderivs =
state->get_local_derivative_matrix();
353 double zdriftlength = cluster->
getLocalY() * drift_velocity;
354 double surfCenterZ = 52.89;
355 double zloc = surfCenterZ - zdriftlength;
357 if (side == 0) zloc = -zloc;
366 std::vector<Acts::Vector3> clusPos;
370 for (
auto&
pos : clusPos)
372 xypoints.push_back(std::make_pair(
pos.x(),
pos.y()));
373 float clusr =
r(
pos.x(),
pos.y());
374 if (
pos.y() < 0) clusr *= -1;
375 rzpoints.push_back(std::make_pair(
pos.z(), clusr));
380 m_xyint = std::get<1>(xyparams);
382 m_rzint = std::get<1>(rzparams);
396 for (
auto iter = range.first; iter != range.second; ++iter)
398 auto key = iter->first;
407 m_adc = cluster->getAdc();
425 m_ladderzid = std::numeric_limits<int>::quiet_NaN();
429 m_side = std::numeric_limits<int>::quiet_NaN();
430 m_segtype = std::numeric_limits<int>::quiet_NaN();
431 m_tileid = std::numeric_limits<int>::quiet_NaN();
438 m_staveid = std::numeric_limits<int>::quiet_NaN();
439 m_chipid = std::numeric_limits<int>::quiet_NaN();
440 m_strobeid = std::numeric_limits<int>::quiet_NaN();
442 m_side = std::numeric_limits<int>::quiet_NaN();
443 m_segtype = std::numeric_limits<int>::quiet_NaN();
444 m_tileid = std::numeric_limits<int>::quiet_NaN();
450 m_staveid = std::numeric_limits<int>::quiet_NaN();
451 m_chipid = std::numeric_limits<int>::quiet_NaN();
452 m_strobeid = std::numeric_limits<int>::quiet_NaN();
453 m_ladderzid = std::numeric_limits<int>::quiet_NaN();
456 m_segtype = std::numeric_limits<int>::quiet_NaN();
457 m_tileid = std::numeric_limits<int>::quiet_NaN();
463 m_staveid = std::numeric_limits<int>::quiet_NaN();
464 m_chipid = std::numeric_limits<int>::quiet_NaN();
465 m_strobeid = std::numeric_limits<int>::quiet_NaN();
466 m_ladderzid = std::numeric_limits<int>::quiet_NaN();
470 m_side = std::numeric_limits<int>::quiet_NaN();
506 if (!tpcGeom or !mvtxGeom or !inttGeom or !mmGeom)
508 std::cout <<
PHWHERE <<
"missing hit map, can't continue with hit tree"
514 hitsetiter != all_hitsets.second;
531 m_ladderzid = std::numeric_limits<int>::quiet_NaN();
534 m_sector = std::numeric_limits<int>::quiet_NaN();
535 m_side = std::numeric_limits<int>::quiet_NaN();
536 m_segtype = std::numeric_limits<int>::quiet_NaN();
537 m_tileid = std::numeric_limits<int>::quiet_NaN();
546 m_staveid = std::numeric_limits<int>::quiet_NaN();
547 m_chipid = std::numeric_limits<int>::quiet_NaN();
548 m_strobeid = std::numeric_limits<int>::quiet_NaN();
549 m_sector = std::numeric_limits<int>::quiet_NaN();
550 m_side = std::numeric_limits<int>::quiet_NaN();
551 m_segtype = std::numeric_limits<int>::quiet_NaN();
552 m_tileid = std::numeric_limits<int>::quiet_NaN();
560 m_staveid = std::numeric_limits<int>::quiet_NaN();
561 m_chipid = std::numeric_limits<int>::quiet_NaN();
562 m_strobeid = std::numeric_limits<int>::quiet_NaN();
563 m_ladderzid = std::numeric_limits<int>::quiet_NaN();
566 m_segtype = std::numeric_limits<int>::quiet_NaN();
567 m_tileid = std::numeric_limits<int>::quiet_NaN();
576 m_staveid = std::numeric_limits<int>::quiet_NaN();
577 m_chipid = std::numeric_limits<int>::quiet_NaN();
578 m_strobeid = std::numeric_limits<int>::quiet_NaN();
579 m_ladderzid = std::numeric_limits<int>::quiet_NaN();
582 m_sector = std::numeric_limits<int>::quiet_NaN();
583 m_side = std::numeric_limits<int>::quiet_NaN();
591 auto hitrangei = hitset->
getHits();
593 hitr != hitrangei.second;
596 auto hitkey = hitr->first;
597 auto hit = hitr->second;
598 m_adc = hit->getAdc();
609 local.SetX(local_coords.X());
610 local.SetY(local_coords.Z());
612 auto glob = layergeom->get_world_from_local_coords(
surf, geometry, local);
617 m_segtype = std::numeric_limits<int>::quiet_NaN();
618 m_tileid = std::numeric_limits<int>::quiet_NaN();
619 m_strip = std::numeric_limits<int>::quiet_NaN();
620 m_hitpad = std::numeric_limits<int>::quiet_NaN();
621 m_hittbin = std::numeric_limits<int>::quiet_NaN();
629 double local_hit_loc[3] = {0, 0, 0};
633 local.SetX(local_hit_loc[1]);
634 local.SetY(local_hit_loc[2]);
635 auto glob = geom->get_world_from_local_coords(
surf, geometry, local);
639 m_segtype = std::numeric_limits<int>::quiet_NaN();
640 m_tileid = std::numeric_limits<int>::quiet_NaN();
641 m_strip = std::numeric_limits<int>::quiet_NaN();
642 m_hitpad = std::numeric_limits<int>::quiet_NaN();
643 m_hittbin = std::numeric_limits<int>::quiet_NaN();
648 m_row = std::numeric_limits<int>::quiet_NaN();
649 m_col = std::numeric_limits<int>::quiet_NaN();
650 m_segtype = std::numeric_limits<int>::quiet_NaN();
651 m_tileid = std::numeric_limits<int>::quiet_NaN();
652 m_strip = std::numeric_limits<int>::quiet_NaN();
659 auto radius = geoLayer->get_radius();
660 float AdcClockPeriod = 53.0;
662 unsigned short NTBins = (
unsigned short) geoLayer->get_zbins();
663 double tdriftmax = AdcClockPeriod * NTBins / 2.0;
677 const auto global_coord = layergeom->get_world_coordinates(
m_tileid, geometry,
m_strip);
681 m_row = std::numeric_limits<int>::quiet_NaN();
682 m_col = std::numeric_limits<int>::quiet_NaN();
683 m_segtype = std::numeric_limits<int>::quiet_NaN();
684 m_tileid = std::numeric_limits<int>::quiet_NaN();
685 m_hitpad = std::numeric_limits<int>::quiet_NaN();
686 m_hittbin = std::numeric_limits<int>::quiet_NaN();
700 auto clustermap = findNode::getClass<TrkrClusterContainer>(topNode,
"TRKR_CLUSTER");
701 auto geometry = findNode::getClass<ActsGeometry>(topNode,
"ActsGeometry");
704 TrkrCluster* cluster = clustermap->findCluster(ckey);
721 Acts::Vector3 clusglob = geometry->getGlobalPosition(ckey, cluster);
731 if (stateckey == ckey)
752 float clusr =
r(clusglob.x(), clusglob.y());
755 m_cluselx.push_back(sqrt(para_errors.first));
756 m_cluselz.push_back(sqrt(para_errors.second));
766 std::cout <<
"Track state/clus in layer "
768 << clusglob.transpose() << std::endl;
807 auto surf = geometry->maps().getSurface(ckey, cluster);
810 auto misaligncenter =
surf->center(geometry->geometry().getGeoContext());
811 auto misalignnorm = -1 *
surf->normal(geometry->geometry().getGeoContext());
812 auto misrot =
surf->transform(geometry->geometry().getGeoContext()).rotation();
813 auto result =
surf->globalToLocal(geometry->geometry().getGeoContext(),
817 float mgamma = atan2(-misrot(1, 0), misrot(0, 0));
818 float mbeta = -asin(misrot(0, 1));
819 float malpha = atan2(misrot(1, 1), misrot(2, 1));
823 auto idealcenter =
surf->center(geometry->geometry().getGeoContext());
824 auto idealnorm = -1 *
surf->normal(geometry->geometry().getGeoContext());
826 Acts::Vector3 ideal_glob =
surf->transform(geometry->geometry().getGeoContext()) * (ideal_local * Acts::UnitConstants::cm);
827 auto idealrot =
surf->transform(geometry->geometry().getGeoContext()).rotation();
837 float igamma = atan2(-idealrot(1, 0), idealrot(0, 0));
838 float ibeta = -asin(idealrot(0, 1));
839 float ialpha = atan2(idealrot(1, 1), idealrot(2, 1));
879 stateloc(0) = loct(0);
880 stateloc(1) = loct(1);
884 transformer.rotateSvtxTrackCovToActs(state);
913 float r1 =
r(x1, y1);
914 float r2 =
r(x2, y2);
915 if (y1 < 0) r1 *= -1;
916 if (y2 < 0) r2 *= -1;
925 float dot = surfnorm.dot(u);
929 float fac = -surfnorm.dot(w) / dot;
936 if (locstateres.ok())
966 m_hittree =
new TTree(
"hittree",
"A tree with all hits");
992 m_clustree =
new TTree(
"clustertree",
"A tree with all clusters");
1022 m_tree =
new TTree(
"residualtree",
"A tree with track, cluster, and state info");