1 #ifndef RecoTracker_MkFit_plugins_convertHits_h 2 #define RecoTracker_MkFit_plugins_convertHits_h 16 #include "Math/SVector.h" 17 #include "Math/SMatrix.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) {
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);
ROOT::Math::SVector< float, 3 > SVector3
unsigned int uniqueIdInLayer(int layer, unsigned int detId) const
bool isStereo(const DetId &id) const
unsigned int layer(const DetId &id) const
edm::ProductID convertHits(const Traits &traits, const HitCollection &hits, mkfit::HitVec &mkFitHits, std::vector< TrackingRecHit const *> &clusterIndexToHit, std::vector< float > &clusterChargeVec, const TrackerTopology &ttopo, const TransientTrackingRecHitBuilder &ttrhBuilder, const MkFitGeometry &mkFitGeom)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
SeedingHitSet::ConstRecHitPointer Hit
std::vector< Hit > HitVec
constexpr uint32_t rawId() const
get the raw id
int mkFitLayerNumber(DetId detId) const
std::vector< Hit > HitCollection
ROOT::Math::SMatrix< float, 3, 3, ROOT::Math::MatRepSym< float, 3 > > SMatrixSym33