32 string refitDirectionName = parameterSet.
getParameter<
string>(
"RefitDirection");
35 theFitterName = parameterSet.
getParameter<
string>(
"Fitter");
36 theSmootherName = parameterSet.
getParameter<
string>(
"Smoother");
37 thePropagatorName = parameterSet.
getParameter<
string>(
"Propagator");
39 theTrackerRecHitBuilderName = parameterSet.
getParameter<
string>(
"TrackerRecHitBuilder");
40 theMuonRecHitBuilderName = parameterSet.
getParameter<
string>(
"MuonRecHitBuilder");
42 theRPCInTheFit = parameterSet.
getParameter<
bool>(
"RefitRPCHits");
43 theDoPredictionsOnly = parameterSet.
getParameter<
bool>(
"DoPredictionsOnly");
45 theCacheId_TC = theCacheId_GTG = theCacheId_MG = theCacheId_TRH = 0;
60 theFitter = aFitter->clone();
61 theSmoother.reset(aSmoother->clone());
65 if ( newCacheId_TC != theCacheId_TC ){
66 LogTrace(metname) <<
"Tracking Component changed!";
67 theCacheId_TC = newCacheId_TC;
73 if ( newCacheId_GTG != theCacheId_GTG ) {
74 LogTrace(metname) <<
"GlobalTrackingGeometry changed!";
75 theCacheId_GTG = newCacheId_GTG;
81 if ( newCacheId_MG != theCacheId_MG ) {
82 LogTrace(metname) <<
"Magnetic Field changed!";
83 theCacheId_MG = newCacheId_MG;
89 if ( newCacheId_TRH != theCacheId_TRH ) {
90 theCacheId_TRH = newCacheId_TRH;
91 LogTrace(metname) <<
"TransientRecHitRecord changed!";
94 hitCloner =
static_cast<TkTransientTrackingRecHitBuilder
const *
>(theTrackerRecHitBuilder.product())->cloner();
96 theFitter->setHitCloner(&hitCloner);
97 theSmoother->setHitCloner(&hitCloner);
111 auto tkbuilder =
static_cast<TkTransientTrackingRecHitBuilder
const *
>(theTrackerRecHitBuilder.product());
115 if((*hit)->isValid()) {
117 result.emplace_back((**hit).cloneForFit(*tkbuilder->geometry()->idToDet( (**hit).geographicalId() ) ) );
118 }
else if ( (*hit)->geographicalId().det() ==
DetId::Muon ){
119 if( (*hit)->geographicalId().subdetId() == 3 && !theRPCInTheFit){
120 LogTrace(
"Reco|TrackingTools|TrackTransformer") <<
"RPC Rec Hit discarged";
123 result.push_back(theMuonRecHitBuilder->build(&**
hit));
135 if (!recHits.empty()){
139 double rFirst = first.
mag();
140 double rLast = last.
mag();
144 LogDebug(
"Reco|TrackingTools|TrackTransformer") <<
"Impossible to determine the rechits order" <<endl;
149 LogDebug(
"Reco|TrackingTools|TrackTransformer") <<
"Impossible to determine the rechits order" <<endl;
174 return transform(track, recHitsForReFit);
185 if(recHitsForReFit.size() < 2)
return vector<Trajectory>();
219 LogTrace(metname) <<
"RH order (0-insideOut, 1-outsideIn): " << recHitsOrder;
230 LogTrace(metname) <<
"P (0-insideOut, 1-outsideIn): " <<
p;
231 LogTrace(metname) <<
"FD (0-OM, 1-AM, 2-ANY): " << propagationDirection;
236 if(theRefitDirection.propagationDirection() !=
anyDirection){
239 reverse(recHitsForReFit.begin(),recHitsForReFit.end());}
244 if(theRefitDirection.geometricalDirection() != recHitsOrder) reverse(recHitsForReFit.begin(),recHitsForReFit.end());
251 if(theRefitDirection.propagationDirection() !=
anyDirection){
268 LogTrace(metname)<<
"Error wrong initial state!"<<endl;
269 return vector<Trajectory>();
274 if(recHitsForReFit.front()->geographicalId() !=
DetId(innerId)){
275 LogTrace(metname)<<
"Propagation occured"<<endl;
276 firstTSOS = propagator()->propagate(firstTSOS, recHitsForReFit.front()->det()->
surface());
278 LogTrace(metname)<<
"Propagation error!"<<endl;
279 return vector<Trajectory>();
283 if(theDoPredictionsOnly){
286 for(TransientTrackingRecHit::ConstRecHitContainer::const_iterator ihit = recHitsForReFit.begin();
287 ihit != recHitsForReFit.end(); ++ihit ) {
288 predTSOS = propagator()->propagate(predTSOS, (*ihit)->det()->
surface());
291 return vector<Trajectory>(1, aTraj);
295 vector<Trajectory> trajectories = theFitter->fit(seed,recHitsForReFit,firstTSOS);
297 if(trajectories.empty()){
298 LogTrace(metname)<<
"No Track refitted!"<<endl;
299 return vector<Trajectory>();
302 Trajectory trajectoryBW = trajectories.front();
304 vector<Trajectory> trajectoriesSM = theSmoother->trajectories(trajectoryBW);
306 if(trajectoriesSM.empty()){
307 LogTrace(metname)<<
"No Track smoothed!"<<endl;
308 return vector<Trajectory>();
311 return trajectoriesSM;
T getParameter(std::string const &) const
const std::string metname
Global3DPoint GlobalPoint
GlobalPoint globalPosition() const
static int position[TOTALCHAMBERS][3]
TrajectoryStateOnSurface innermostMeasurementState() const
const SurfaceType & surface() const
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
TrajectoryStateOnSurface outermostMeasurementState() const
trackingRecHit_iterator recHitsEnd() const
last iterator to RecHits
std::vector< ConstRecHitPointer > ConstRecHitContainer
const Track & track() const
GlobalVector globalMomentum() const
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
void push(const TrajectoryMeasurement &tm)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
trackingRecHit_iterator recHitsBegin() const
first iterator to RecHits
ParameterSet const & parameterSet(Provenance const &provenance)