27 edm::LogInfo(
"CosmicTrackFinder")<<
"Minimum number of hits "<<theMinHits<<
" Cut on Chi2= "<<
chi2cut;
66 RHBuilder= theBuilder.
product();
71 theFitter=
new KFTrajectoryFitter(*thePropagator,
74 theFitter->setHitCloner(&hitCloner);
79 theSmoother->setHitCloner(&hitCloner);
89 vector<Trajectory> &trajoutput)
95 std::vector<Trajectory> trajSmooth;
96 std::vector<Trajectory>::iterator trajIter;
98 TrajectorySeedCollection::const_iterator
iseed;
100 for(iseed=collseed.begin();iseed!=collseed.end();iseed++){
107 vector<const TrackingRecHit*> allHits= SortHits(collstereo,collrphi,collmatched,collpixel,*iseed);
108 Trajectory startingTraj = createStartingTrajectory(*iseed);
109 AddHit(startingTraj,allHits);
110 for (trajIter=trajFit.begin(); trajIter!=trajFit.end();trajIter++){
111 trajSmooth=theSmoother->trajectories((*trajIter));
113 for (trajIter= trajSmooth.begin(); trajIter!=trajSmooth.end();trajIter++){
114 if((*trajIter).isValid()){
115 trajoutput.push_back((*trajIter));
120 delete thePropagator;
121 delete thePropagatorOp;
134 std::vector<TM> && seedMeas = seedMeasurements(seed);
140 std::vector<TrajectoryMeasurement>
143 std::vector<TrajectoryMeasurement>
result;
146 ihit != hitRange.second; ihit++) {
149 const GeomDet* hitGeomDet = (&(*tracker))->idToDet( ihit->geographicalId());
152 if (ihit == hitRange.second - 1) {
154 result.emplace_back(invalidState, updatedState, recHit);
157 result.emplace_back(invalidState, recHit);
169 vector<const TrackingRecHit*>
180 vector<const TrackingRecHit*> allHits;
186 for (ihit = hRange.first;
187 ihit != hRange.second; ihit++) {
188 yref=RHBuilder->build(&(*ihit))->globalPosition().y();
189 hits.push_back((RHBuilder->build(&(*ihit))));
190 LogDebug(
"CosmicTrackFinder")<<
"SEED HITS"<<RHBuilder->build(&(*ihit))->globalPosition();
195 for(ipix=collpixel.
data().begin();ipix!=collpixel.
data().end();ipix++){
196 float ych= RHBuilder->build(&(*ipix))->globalPosition().y();
197 if ((seed_plus && (ych<yref)) || (!(seed_plus) && (ych>yref)))
198 allHits.push_back(&(*ipix));
201 for(istrip=collrphi.
data().begin();istrip!=collrphi.
data().end();istrip++){
202 float ych= RHBuilder->build(&(*istrip))->globalPosition().y();
203 if ((seed_plus && (ych<yref)) || (!(seed_plus) && (ych>yref)))
204 allHits.push_back(&(*istrip));
207 for(istrip=collstereo.
data().begin();istrip!=collstereo.
data().end();istrip++){
208 float ych= RHBuilder->build(&(*istrip))->globalPosition().y();
209 if ((seed_plus && (ych<yref)) || (!(seed_plus) && (ych>yref)))
210 allHits.push_back(&(*istrip));
225 const GeomDet* gdet = (&(*tracker))->idToDet(
DetId(pState.detId()));
233 const vector<const TrackingRecHit*>&Hits){
237 unsigned int ibestdet;
239 for (
unsigned int icosmhit=0;icosmhit<Hits.size();icosmhit++){
240 GlobalPoint gphit=RHBuilder->build(Hits[icosmhit])->globalPosition();
241 unsigned int iraw= Hits[icosmhit]->geographicalId().rawId();
242 LogDebug(
"CosmicTrackFinder")<<
" HIT POSITION "<< gphit;
246 tracker->idToDet(Hits[icosmhit]->geographicalId())->surface());
254 LogDebug(
"CosmicTrackFinder") <<
"STATE PROPAGATED AT DET "<<iraw<<
" "<<prSt;
255 for(icosm2=icosmhit;icosm2<Hits.size();icosm2++){
257 if (iraw==Hits[icosm2]->geographicalId().rawId()){
259 float contr= theEstimator->estimate(prSt, *tmphit).second;
264 if (icosm2!=icosmhit) icosmhit++;
267 else icosm2=Hits.size();
271 LogDebug(
"CosmicTrackFinder")<<
"Chi2 contribution for hit at " 272 <<RHBuilder->build(Hits[ibestdet])->globalPosition()
277 GlobalVector ck=RHBuilder->build(Hits[ibestdet])->globalPosition()-
279 if ((
abs(ck.
x()/ck.
y())>2)||(
abs(ck.
z()/ck.
y())>2)) chi2min=300;
282 if (
abs(prLoc.
x()) < 25 &&
abs(prLoc.
y()) < 25 ){
284 TSOS UpdatedState= theUpdator->
update( prSt, *tmphitbestdet);
287 traj.
push(
TM(prSt,UpdatedState,RHBuilder->build(Hits[ibestdet])
290 "STATE UPDATED WITH HIT AT POSITION " 291 <<tmphitbestdet->globalPosition()
295 hits.push_back(tmphitbestdet);
297 }
else LogDebug(
"CosmicTrackFinder")<<
" Hits outside module surface "<< prLoc;
298 }
else LogDebug(
"CosmicTrackFinder")<<
" State can not be updated with hit at position " <<gphit;
299 }
else LogDebug(
"CosmicTrackFinder")<<
" State can not be propagated at det "<< iraw;
304 if ( qualityFilter( traj)){
307 tracker->idToDet((*
hits.begin())->geographicalId())->surface()).isValid()){
310 tracker->idToDet((*
hits.begin())->geographicalId())->surface());
312 trajFit = theFitter->fit(tmpseed,
hits, startingState );
325 unsigned int iid=(*hit)->hit()->geographicalId().rawId();
327 if(((iid>>0)&0x3)!=1) ngoodhits++;
332 if ( ngoodhits >= theMinHits) {
PropagationDirection direction() const
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
LocalPoint localPosition() const
GlobalPoint globalPosition() const
ConstRecHitContainer recHits() const
const Plane & surface() const
The nominal surface of the GeomDet.
void init(const edm::EventSetup &es, bool)
std::vector< TrajectoryMeasurement > seedMeasurements(const TrajectorySeed &seed) const
std::vector< TrajectorySeed > TrajectorySeedCollection
recHitContainer::const_iterator const_iterator
TrajectoryMeasurement const & lastMeasurement() const
void update(const LocalTrajectoryParameters &p, const SurfaceType &aSurface, const MagneticField *field, SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface)
data_type const * data(size_t cell) const
Abs< T >::type abs(const T &t)
std::pair< const_iterator, const_iterator > range
TSOS startingTSOS(const TrajectorySeed &seed) const
std::shared_ptr< TrackingRecHit const > RecHitPointer
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.
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)
bool qualityFilter(const Trajectory &traj)
TrajectoryStateOnSurface const & updatedState() const
Trajectory createStartingTrajectory(const TrajectorySeed &seed) const
CosmicTrajectoryBuilder(const edm::ParameterSet &conf)
~CosmicTrajectoryBuilder()
T const * product() const
void push(const TrajectoryMeasurement &tm)