73 vector<Trajectory> &trajoutput) {
74 std::vector<Trajectory> trajSmooth;
75 std::vector<Trajectory>::iterator trajIter;
77 TrajectorySeedCollection::const_iterator
iseed;
79 for (iseed = collseed.begin(); iseed != collseed.end(); 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);
131 result.emplace_back(invalidState, recHit);
146 vector<const TrackingRecHit *> allHits;
150 for (
auto const &recHit : seed.
recHits()) {
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)
PropagationDirection direction() const
KFTrajectoryFitter * theFitter
KFTrajectorySmoother * theSmoother
T getUntrackedParameter(std::string const &, T const &) const
CosmicTrajectoryBuilder(const edm::ParameterSet &conf, edm::ConsumesCollector iC)
const MagneticField * magfield
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerToken_
LocalPoint localPosition() const
PropagatorWithMaterial * thePropagatorOp
GlobalPoint globalPosition() const
ConstRecHitContainer recHits() const
const TrackerGeometry * tracker
std::vector< Trajectory > trajFit
const Plane & surface() const
The nominal surface of the GeomDet.
virtual TrajectoryContainer trajectories(const Trajectory &traj) const
void init(const edm::EventSetup &es, bool)
const TransientTrackingRecHitBuilder * RHBuilder
bool getData(T &iHolder) const
std::vector< TrajectoryMeasurement > seedMeasurements(const TrajectorySeed &seed) const
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > builderToken_
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
TrajectoryMeasurement const & lastMeasurement() const
data_type const * data(size_t cell) const
Abs< T >::type abs(const T &t)
TSOS startingTSOS(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
RecHitRange recHits() const
TrajectoryMeasurement const & firstMeasurement() const
PTrajectoryStateOnDet const & startingState() const
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.
T getParameter(std::string const &) const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
PropagatorWithMaterial * thePropagator
std::vector< const TrackingRecHit * > SortHits(const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const SiPixelRecHitCollection &collpixel, const TrajectorySeed &seed)
void AddHit(Trajectory &traj, const std::vector< const TrackingRecHit * > &Hits)
Chi2MeasurementEstimator * theEstimator
bool qualityFilter(const Trajectory &traj)
void setHitCloner(TkCloner const *hc) override
TrajectoryStateOnSurface const & updatedState() const
Trajectory createStartingTrajectory(const TrajectorySeed &seed) const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
TransientTrackingRecHit::RecHitContainer hits
~CosmicTrajectoryBuilder()
void push(const TrajectoryMeasurement &tm)
tuple Chi2MeasurementEstimator