1 #ifndef RecoTracker_MkFit_plugins_convertHits_h
2 #define RecoTracker_MkFit_plugins_convertHits_h
16 #include "Math/SVector.h"
17 #include "Math/SMatrix.h"
21 #include "mkFit/HitStructures.h"
24 template <
typename Traits,
typename HitCollection>
28 std::vector<TrackingRecHit const*>& clusterIndexToHit,
29 std::vector<float>& clusterChargeVec,
38 const auto& lastClusterRef =
hits.data().back().firstClusterRef();
39 clusterID = lastClusterRef.
id();
40 if (lastClusterRef.index() >= mkFitHits.size()) {
41 auto const size = lastClusterRef.index();
42 mkFitHits.resize(
size);
43 clusterIndexToHit.resize(
size,
nullptr);
44 if constexpr (Traits::applyCCC()) {
45 clusterChargeVec.resize(
size, -1.
f);
50 for (
const auto& detset :
hits) {
51 const DetId detid = detset.detId();
54 for (
const auto&
hit : detset) {
55 const auto charge = traits.clusterCharge(
hit, detid);
56 if (!traits.passCCC(
charge))
59 const auto& gpos =
hit.globalPosition();
61 const auto& gerr =
hit.globalPositionError();
63 err.At(0, 0) = gerr.cxx();
64 err.At(1, 1) = gerr.cyy();
65 err.At(2, 2) = gerr.czz();
66 err.At(0, 1) = gerr.cyx();
67 err.At(0, 2) = gerr.czx();
68 err.At(1, 2) = gerr.czy();
70 auto clusterRef =
hit.firstClusterRef();
71 if UNLIKELY (clusterRef.id() != clusterID) {
73 <<
"Input hit collection has Refs to many cluster collections. Last hit had Ref to product " << clusterID
74 <<
", but encountered Ref to product " << clusterRef.
id() <<
" on detid " << detid.
rawId();
76 const auto clusterIndex = clusterRef.index();
77 LogTrace(
"MkFitHitConverter") <<
"Adding hit detid " << detid.
rawId() <<
" subdet " << detid.
subdetId()
78 <<
" layer " << ttopo.
layer(detid) <<
" isStereo " << ttopo.
isStereo(detid)
80 <<
" index " << clusterIndex <<
" ilay " << ilay;
82 if UNLIKELY (clusterIndex >= mkFitHits.size()) {
83 mkFitHits.resize(clusterIndex + 1);
84 clusterIndexToHit.resize(clusterIndex + 1,
nullptr);
85 if constexpr (Traits::applyCCC()) {
86 clusterChargeVec.resize(clusterIndex + 1, -1.
f);
90 clusterIndexToHit[clusterIndex] = &
hit;
91 if constexpr (Traits::applyCCC()) {
92 clusterChargeVec[clusterIndex] =
charge;
96 traits.setDetails(mkFitHits[clusterIndex], *(
hit.cluster()), uniqueIdInLayer,
charge);