28 const std::vector<Trajectory>& theTrajectoryCollection,
36 edm::LogInfo(
"TrackProducer") <<
"Number of Trajectories: " << theTrajectoryCollection.size() <<
"\n";
38 for (std::vector<Trajectory>::const_iterator
i=theTrajectoryCollection.begin();
i!=theTrajectoryCollection.end() ;
i++)
49 LogDebug(
"DAFTrackProducerAlgorithm") <<
"About to build the trajectory for the first round...";
52 std::vector<Trajectory> vtraj;
55 LogDebug(
"DAFTrackProducerAlgorithm") <<
"done" << std::endl;
56 LogDebug(
"DAFTrackProducerAlgorithm") <<
"after the first round found " << vtraj.size() <<
" trajectories" << std::endl;
58 if (vtraj.size() != 0){
61 std::pair<TransientTrackingRecHit::RecHitContainer, TrajectoryStateOnSurface> hits =
collectHits(vtraj, measurementCollector);
62 fit(hits, theFitter, vtraj);
66 LogDebug(
"DAFTrackProducerAlgorithm") <<
"Seed direction is " << vtraj.front().seed().direction()
67 <<
" Traj direction is " << vtraj.front().direction();
68 std::pair<TransientTrackingRecHit::RecHitContainer, TrajectoryStateOnSurface> curiterationhits =
updateHits(vtraj,updator,*ian);
69 fit(curiterationhits, theFitter, vtraj);
71 LogDebug(
"DAFTrackProducerAlgorithm") <<
"done annealing value " << (*ian) <<
" with " << vtraj.size() <<
" trajectories";
73 LogDebug(
"DAFTrackProducerAlgorithm") <<
"number of trajectories after annealing value " << (*ian) <<
" annealing step " << vtraj.size();
75 LogDebug(
"DAFTrackProducerAlgorithm") <<
"Ended annealing program with " << vtraj.size() <<
" trajectories" << std::endl;
96 LogDebug(
"DAFTrackProducerAlgorithm") <<
"Rejecting trajectory with " << vtraj.front().foundHits()<<
" hits";
100 else LogDebug(
"DAFTrackProducerAlgorithm") <<
"Rejecting empty trajectory" << std::endl;
105 LogDebug(
"TrackProducer") <<
"Number of Tracks found: " << cont <<
"\n";
108 std::pair<TransientTrackingRecHit::RecHitContainer, TrajectoryStateOnSurface>
112 std::vector<TrajectoryMeasurement> collectedmeas = measurementCollector->
recHits(vtraj.front());
114 for (std::vector<TrajectoryMeasurement>::const_iterator iter = collectedmeas.begin(); iter!=collectedmeas.end(); iter++){
115 hits.push_back(iter->recHit());
120 std::pair<TransientTrackingRecHit::RecHitContainer, TrajectoryStateOnSurface>
123 double annealing)
const {
125 std::vector<TrajectoryMeasurement> vmeas = vtraj.front().measurements();
126 std::vector<TrajectoryMeasurement>::reverse_iterator imeas;
127 for (imeas = vmeas.rbegin(); imeas != vmeas.rend(); imeas++){
129 hits.push_back(updated);
136 std::vector<Trajectory>& vtraj)
const {
139 vtraj.
front().seed().direction()),
142 vtraj.reserve(newVec.size());
144 LogDebug(
"DAFTrackProducerAlgorithm") <<
"swapped!" << std::endl;
160 LogDebug(
"DAFTrackProducerAlgorithm") <<
" FITTER FOUND "<< vtraj.size() <<
" TRAJECTORIES" << std::endl;;
163 if (vtraj.size() != 0){
178 if (tscbl.
isValid()==
false)
return false;
195 algoResults.push_back(aProduct);
204 if (input.empty())
return;
208 std::vector<TrajectoryMeasurement> vtm = input[0].measurements();
213 for (std::vector<TrajectoryMeasurement>::reverse_iterator tm=vtm.rbegin(); tm!=vtm.rend();tm++){
215 if (tm->recHit()->isValid()) {
218 for (TransientTrackingRecHit::ConstRecHitContainer::iterator rechit = components.begin(); rechit != components.end(); rechit++){
220 if ((*rechit)->weight()>1
e-6) {ngoodhits++; isGood =
true;
break;}
222 if (isGood) hits.push_back(tm->recHit()->clone(tm->updatedState()));
225 hits.push_back(tm->recHit()->clone(tm->updatedState()));
230 LogDebug(
"DAFTrackProducerAlgorithm") <<
"Original number of valid hits " << input[0].foundHits() <<
"; after filtering " << ngoodhits;
232 if (ngoodhits>input[0].foundHits())
edm::LogError(
"DAFTrackProducerAlgorithm") <<
"Something wrong: the number of good hits from DAFTrackProducerAlgorithm::filter " << ngoodhits <<
" is higher than the original one " << input[0].foundHits();
234 if (ngoodhits < minhits)
return;
237 LogDebug(
"DAFTrackProducerAlgorithm") <<
"starting tsos for final refitting " << curstartingTSOS ;
242 input.
front().seed().direction()),
245 LogDebug(
"DAFTrackProducerAlgorithm") <<
"After filtering " << output.size() <<
" trajectories";
250 if (vtraj.empty())
return 0;
252 const std::vector<TrajectoryMeasurement>& meas = vtraj.front().measurements();
253 for (std::vector<TrajectoryMeasurement>::const_iterator iter = meas.begin(); iter != meas.end(); iter++){
254 if (iter->recHit()->isValid()){
256 TransientTrackingRecHit::ConstRecHitContainer::const_iterator iter2;
257 for (iter2 = components.begin(); iter2 != components.end(); iter2++){
258 if ((*iter2)->isValid())ndof+=((*iter2)->dimension())*(*iter2)->weight();
T getParameter(std::string const &) const
std::pair< Trajectory *, std::pair< reco::Track *, PropagationDirection > > AlgoProduct
static RecHitPointer build(const GeomDet *geom, Type type=TrackingRecHit::missing, const DetLayer *layer=0)
float calculateNdof(const std::vector< Trajectory > &vtraj) const
TrackCharge charge() const
const CurvilinearTrajectoryError & curvilinearError() const
void runWithCandidate(const TrackingGeometry *, const MagneticField *, const std::vector< Trajectory > &, const TrajectoryFitter *, const TransientTrackingRecHitBuilder *, const MultiRecHitCollector *measurementTracker, const SiTrackerMultiRecHitUpdator *, const reco::BeamSpot &, AlgoProductCollection &) const
Run the Final Fit taking TrackCandidates as input.
const std::vector< double > & getAnnealingProgram() const
std::vector< ConstRecHitPointer > RecHitContainer
virtual TransientTrackingRecHit::RecHitPointer update(TransientTrackingRecHit::ConstRecHitPointer original, TrajectoryStateOnSurface tsos, double annealing=1.) const
PropagationDirection const & direction() const
void filter(const TrajectoryFitter *fitter, std::vector< Trajectory > &input, int minhits, std::vector< Trajectory > &output) const
FreeTrajectoryState * freeState(bool withErrors=true) const
std::vector< AlgoProduct > AlgoProductCollection
bool buildTrack(const std::vector< Trajectory > &, AlgoProductCollection &algoResults, float, const reco::BeamSpot &) const
Construct Tracks to be put in the event.
TrajectoryMeasurement const & lastMeasurement() const
virtual std::vector< TrajectoryMeasurement > recHits(const Trajectory &) const =0
std::pair< TransientTrackingRecHit::RecHitContainer, TrajectoryStateOnSurface > updateHits(const std::vector< Trajectory > &vtraj, const SiTrackerMultiRecHitUpdator *updator, double annealing) const
std::pair< TransientTrackingRecHit::RecHitContainer, TrajectoryStateOnSurface > collectHits(const std::vector< Trajectory > &vtraj, const MultiRecHitCollector *measurementCollector) const
TrajectoryStateOnSurface updatedState() const
GlobalVector momentum() const
FTS const & trackStateAtPCA() const
std::vector< ConstRecHitPointer > ConstRecHitContainer
GlobalPoint position() const
TrajectoryMeasurement const & firstMeasurement() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
virtual std::vector< Trajectory > fit(const Trajectory &) const =0
void fit(const std::pair< TransientTrackingRecHit::RecHitContainer, TrajectoryStateOnSurface > &hits, const TrajectoryFitter *theFitter, std::vector< Trajectory > &vtraj) const
accomplishes the fitting-smoothing step for each annealing value
double chiSquared() const