47 template <
typename TrackerTraits>
76 template <
typename TrackerTraits>
79 tokenTrack_(consumes(iConfig.getParameter<
edm::
InputTag>(
"trackSrc"))),
84 minNumberOfHits_(iConfig.getParameter<
int>(
"minNumberOfHits")),
94 produces<TrackingRecHitCollection>();
95 produces<reco::TrackExtraCollection>();
99 produces<reco::TrackCollection>();
100 produces<IndToEdm>();
103 template <
typename TrackerTraits>
109 desc.add<
int>(
"minNumberOfHits", 0);
114 template <
typename TrackerTraits>
129 std::cout <<
"Converting soa helix in reco tracks" << std::endl;
132 auto indToEdmP = std::make_unique<IndToEdm>();
133 auto &indToEdm = *indToEdmP;
135 auto const &idealField = iSetup.
getData(idealMagneticFieldToken_);
139 auto const &httopo = iSetup.
getData(ttTopoToken_);
141 const auto &bsh =
iEvent.get(tBeamSpot_);
144 auto const &rechits =
iEvent.get(cpuHits_);
145 std::vector<TrackingRecHit const *> hitmap;
146 auto const &rcs = rechits.data();
147 auto const nhits = rcs.size();
149 hitmap.resize(
nhits,
nullptr);
151 auto const &hitsModuleStart =
iEvent.get(hmsToken_);
153 for (
auto const &
hit : rcs) {
155 auto const detI = thit.
det()->
index();
156 auto const &clus = thit.firstClusterRef();
158 auto const idx = hitsModuleStart[detI] + clus.pixelCluster().originalId();
159 if (
idx >= hitmap.size())
160 hitmap.resize(
idx + 256,
nullptr);
166 std::vector<const TrackingRecHit *>
hits;
169 auto const &tsoa =
iEvent.get(tokenTrack_);
170 auto const *
quality = tsoa.view().quality();
171 auto const &hitIndices = tsoa.view().hitIndices();
172 auto nTracks = tsoa.view().nTracks();
179 std::vector<int32_t> sortIdxs(
nTracks);
180 std::iota(sortIdxs.begin(), sortIdxs.end(), 0);
182 std::sort(sortIdxs.begin(), sortIdxs.end(), [&](int32_t
const i1, int32_t
const i2) {
184 return tsoa.view()[
i1].pt() > tsoa.view()[
i2].pt();
190 indToEdm.resize(sortIdxs.size(), -1);
191 for (
const auto &
it : sortIdxs) {
198 if (
nHits < minNumberOfHits_)
204 auto b = hitIndices.begin(
it);
205 for (
int iHit = 0; iHit <
nHits; ++iHit)
206 hits[iHit] = hitmap[*(
b + iHit)];
209 float chi2 = tsoa.view()[
it].chi2();
219 for (
int i = 0;
i < 5; ++
i)
220 for (
int j =
i;
j < 5; ++
j)
221 m(
i,
j) = ocov(
i,
j);
244 auto tkq = recoQuality[
int(
q)];
245 track->setQuality(tkq);
253 track->setQuality(tkq);
258 std::cout <<
"processed " <<
nt <<
" good tuples " <<
tracks.size() <<
" out of " << indToEdm.size() << std::endl;
PixelTrackProducerFromSoAAlpaka(const edm::ParameterSet &iConfig)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
Eigen::Matrix< double, 5, 5 > Matrix5d
const edm::EDGetTokenT< reco::BeamSpot > tBeamSpot_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
pixelTrack::Quality const minQuality_
Quality qualityByName(std::string const &name)
void storeTracks(Ev &ev, const TWH &tracksWithHits, const TrackerTopology &ttopo)
~PixelTrackProducerFromSoAAlpaka() override=default
TrackQuality
track quality
Sin< T >::type sin(const T &t)
Eigen::Matrix< double, 5, 1 > Vector5d
const edm::EDGetTokenT< HMSstorage > hmsToken_
void transformToPerigeePlane(VI5 const &ip, MI5 const &icov, VO5 &op, MO5 &ocov)
const GeomDet * det() const
void produce(edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
const edm::EDGetTokenT< SiPixelRecHitCollectionNew > cpuHits_
LocalVector momentum() const
Momentum vector in the local frame.
Cos< T >::type cos(const T &t)
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE constexpr float phi(ConstView const &tracks, int32_t i)
def template(fileName, svg, replaceme="REPLACEME")
#define DEFINE_FWK_MODULE(type)
int32_t const minNumberOfHits_
TrackCharge charge() const
Charge (-1, 0 or 1)
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttTopoToken_
std::vector< TrackWithRecHits > TracksWithRecHits
std::vector< uint32_t > IndToEdm
const edm::EDGetTokenT< TrackSoAHost > tokenTrack_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > idealMagneticFieldToken_
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits
LocalPoint position() const
Local x and y position coordinates.
std::vector< uint32_t > HMSstorage