73 vector<Trajectory> &trajoutput) {
74 std::vector<Trajectory> trajSmooth;
75 std::vector<Trajectory>::iterator trajIter;
77 TrajectorySeedCollection::const_iterator
iseed;
86 vector<const TrackingRecHit *> allHits =
SortHits(collstereo, collrphi, collmatched, collpixel, *
iseed);
88 AddHit(startingTraj, allHits);
89 for (trajIter =
trajFit.begin(); trajIter !=
trajFit.end(); trajIter++) {
92 for (trajIter = trajSmooth.begin(); trajIter != trajSmooth.end(); trajIter++) {
93 if ((*trajIter).isValid()) {
94 trajoutput.push_back((*trajIter));
113 for (
auto &
i : seedMeas)
119 std::vector<TrajectoryMeasurement>
result;
120 auto const &hitRange =
seed.recHits();
121 for (
auto ihit = hitRange.begin(); ihit != hitRange.end(); ihit++) {
124 const GeomDet *hitGeomDet = (&(*tracker))->idToDet(ihit->geographicalId());
127 if (ihit == hitRange.end() - 1) {
129 result.emplace_back(invalidState, updatedState,
recHit);
146 vector<const TrackingRecHit *> allHits;
157 for (ipix = collpixel.
data().begin(); ipix != collpixel.
data().end(); ipix++) {
160 allHits.push_back(&(*ipix));
163 for (istrip = collrphi.
data().begin(); istrip != collrphi.
data().end(); istrip++) {
166 allHits.push_back(&(*istrip));
169 for (istrip = collstereo.
data().begin(); istrip != collstereo.
data().end(); istrip++) {
172 allHits.push_back(&(*istrip));
185 const GeomDet *gdet = (&(*tracker))->idToDet(
DetId(pState.detId()));
192 unsigned int ibestdet;
194 for (
unsigned int icosmhit = 0; icosmhit < Hits.size(); icosmhit++) {
196 unsigned int iraw = Hits[icosmhit]->geographicalId().rawId();
197 LogDebug(
"CosmicTrackFinder") <<
" HIT POSITION " << gphit;
209 LogDebug(
"CosmicTrackFinder") <<
"STATE PROPAGATED AT DET " << iraw <<
" " << prSt;
210 for (icosm2 = icosmhit; icosm2 < Hits.size(); icosm2++) {
211 if (iraw == Hits[icosm2]->geographicalId().rawId()) {
213 float contr =
theEstimator->estimate(prSt, *tmphit).second;
214 if (contr < chi2min) {
218 if (icosm2 != icosmhit)
222 icosm2 = Hits.size();
226 LogDebug(
"CosmicTrackFinder") <<
"Chi2 contribution for hit at " 227 <<
RHBuilder->
build(Hits[ibestdet])->globalPosition() <<
" is " << chi2min;
233 if ((
abs(ck.
x() / ck.
y()) > 2) || (
abs(ck.
z() / ck.
y()) > 2))
237 if (
abs(prLoc.
x()) < 25 &&
abs(prLoc.
y()) < 25) {
242 LogDebug(
"CosmicTrackFinder") <<
"STATE UPDATED WITH HIT AT POSITION " << tmphitbestdet->globalPosition()
245 hits.push_back(tmphitbestdet);
248 LogDebug(
"CosmicTrackFinder") <<
" Hits outside module surface " << prLoc;
250 LogDebug(
"CosmicTrackFinder") <<
" State can not be updated with hit at position " << gphit;
252 LogDebug(
"CosmicTrackFinder") <<
" State can not be propagated at det " << iraw;
274 unsigned int iid = (*hit)->hit()->geographicalId().rawId();
276 if (((iid >> 0) & 0x3) != 1)
void AddHit(Trajectory &traj, const std::vector< const TrackingRecHit *> &Hits)
KFTrajectoryFitter * theFitter
KFTrajectorySmoother * theSmoother
CosmicTrajectoryBuilder(const edm::ParameterSet &conf, edm::ConsumesCollector iC)
T getParameter(std::string const &) const
const MagneticField * magfield
virtual TrajectoryContainer trajectories(const Trajectory &traj) const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
Trajectory createStartingTrajectory(const TrajectorySeed &seed) const
LocalPoint localPosition() const
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerToken_
PropagatorWithMaterial * thePropagatorOp
data_type const * data(size_t cell) const
const TrackerGeometry * tracker
std::vector< Trajectory > trajFit
TrajectoryMeasurement const & lastMeasurement() const
T getUntrackedParameter(std::string const &, T const &) const
void init(const edm::EventSetup &es, bool)
const TransientTrackingRecHitBuilder * RHBuilder
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > builderToken_
GlobalPoint globalPosition() const
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
std::vector< TrajectorySeed > TrajectorySeedCollection
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
ConstRecHitContainer recHits() const
Abs< T >::type abs(const T &t)
std::vector< TrajectoryMeasurement > seedMeasurements(const TrajectorySeed &seed) const
const TrackerGeomDet * idToDet(DetId) const override
std::shared_ptr< TrackingRecHit const > RecHitPointer
Log< level::Info, false > LogInfo
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
TSOS startingTSOS(const TrajectorySeed &seed) const
const Plane & surface() const
The nominal surface of the GeomDet.
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
void run(const TrajectorySeedCollection &collseed, const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const SiPixelRecHitCollection &collpixel, const edm::EventSetup &es, edm::Event &e, std::vector< Trajectory > &trajoutput)
Runs the algorithm.
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
PropagatorWithMaterial * thePropagator
TrajectoryStateOnSurface const & updatedState() const
std::vector< const TrackingRecHit * > SortHits(const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const SiPixelRecHitCollection &collpixel, const TrajectorySeed &seed)
Chi2MeasurementEstimator * theEstimator
TrajectoryMeasurement const & firstMeasurement() const
bool qualityFilter(const Trajectory &traj)
void setHitCloner(TkCloner const *hc) override
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
TransientTrackingRecHit::RecHitContainer hits
~CosmicTrajectoryBuilder()
void push(const TrajectoryMeasurement &tm)