27 #include "Math/SVector.h"
28 #include "Math/SMatrix.h"
33 #include "LayerNumberConverter.h"
45 template <
typename HitCollection>
47 std::vector<mkfit::HitVec>& mkFitHits,
52 const mkfit::LayerNumberConverter& lnc)
const;
62 using SVector3 = ROOT::Math::SVector<float, 3>;
63 using SMatrixSym33 = ROOT::Math::SMatrix<float, 3, 3, ROOT::Math::MatRepSym<float, 3>>;
64 using SMatrixSym66 = ROOT::Math::SMatrix<float, 6, 6, ROOT::Math::MatRepSym<float, 6>>;
79 stripRphiRecHitToken_{
80 consumes<SiStripRecHit2DCollection>(iConfig.getParameter<
edm::InputTag>(
"stripRphiRecHits"))},
81 stripStereoRecHitToken_{
82 consumes<SiStripRecHit2DCollection>(iConfig.getParameter<
edm::InputTag>(
"stripStereoRecHits"))},
83 seedToken_{consumes<edm::View<TrajectorySeed>>(iConfig.getParameter<
edm::InputTag>(
"seeds"))},
84 ttrhBuilderToken_{esConsumes<TransientTrackingRecHitBuilder, TransientRecHitRecord>(
86 ttopoToken_{esConsumes<TrackerTopology, TrackerTopologyRcd>()},
87 mfToken_{esConsumes<MagneticField, IdealMagneticFieldRecord>()},
88 putToken_{produces<MkFitInputWrapper>()},
89 minGoodStripCharge_{static_cast<float>(
96 desc.
add(
"stripRphiRecHits",
edm::InputTag{
"siStripMatchedRecHits",
"rphiRecHit"});
97 desc.
add(
"stripStereoRecHits",
edm::InputTag{
"siStripMatchedRecHits",
"stereoRecHit"});
102 descCCC.
add<
double>(
"value");
103 desc.
add(
"minGoodStripCharge", descCCC);
105 descriptions.
add(
"mkFitInputConverterDefault", desc);
109 mkfit::LayerNumberConverter lnc{mkfit::TkLayout::phase1};
115 std::vector<mkfit::HitVec> mkFitHits(lnc.nLayers());
135 template <
typename HitCollection>
137 std::vector<mkfit::HitVec>& mkFitHits,
142 const mkfit::LayerNumberConverter& lnc)
const {
145 auto isPlusSide = [&ttopo](
const DetId& detid) {
152 lnc.convertLayerNumber(detid.subdetId(), ttopo.
layer(detid),
false, ttopo.
isStereo(detid), isPlusSide(detid));
154 const auto& lastClusterRef =
hits.data().back().firstClusterRef();
159 for (
const auto& detset :
hits) {
160 const DetId detid = detset.detId();
161 const auto subdet = detid.
subdetId();
162 const auto layer = ttopo.
layer(detid);
163 const auto isStereo = ttopo.
isStereo(detid);
164 const auto ilay = lnc.convertLayerNumber(subdet, layer,
false, isStereo, isPlusSide(detid));
167 for (
const auto&
hit : detset) {
171 const auto& gpos =
hit.globalPosition();
173 const auto& gerr =
hit.globalPositionError();
175 err.At(0, 0) = gerr.cxx();
176 err.At(1, 1) = gerr.cyy();
177 err.At(2, 2) = gerr.czz();
178 err.At(0, 1) = gerr.cyx();
179 err.At(0, 2) = gerr.czx();
180 err.At(1, 2) = gerr.czy();
182 LogTrace(
"MkFitInputConverter") <<
"Adding hit detid " << detid.
rawId() <<
" subdet " << subdet <<
" layer "
183 << layer <<
" isStereo " << isStereo <<
" zplus " << isPlusSide(detid) <<
" ilay "
187 hit.firstClusterRef().index(),
190 mkFitHits[ilay].emplace_back(
pos,
err, totalHits);
204 const auto hitRange =
seed.recHits();
205 const auto lastRecHit = ttrhBuilder.
build(&*(hitRange.second - 1));
208 const auto& gpos = stateGlobal.
position();
209 const auto& gmom = stateGlobal.momentum();
211 SVector3 mom(gmom.x(), gmom.y(), gmom.z());
213 const auto cartError = tsos.cartesianError();
214 const auto& cov = cartError.matrix();
216 for (
int i = 0;
i < 6; ++
i) {
217 for (
int j =
i;
j < 6; ++
j) {
222 mkfit::TrackState state(tsos.charge(),
pos, mom,
err);
223 state.convertFromCartesianToCCS();
224 ret.emplace_back(state, 0,
index, 0,
nullptr);
227 for (
auto iHit = hitRange.first; iHit != hitRange.second; ++iHit) {
229 throw cms::Exception(
"Assert") <<
"Encountered a seed with a hit which is not trackerHitRTTI::isFromDet()";
231 const auto& clusterRef = static_cast<const BaseTrackerRecHit&>(*iHit).firstClusterRef();
232 const auto& mkFitHit = hitIndexMap.
mkFitHit(clusterRef.id(), clusterRef.index());
233 ret.back().addHitIdx(mkFitHit.index(), mkFitHit.layer(), 0);