58 if(theRescaleErrorFlag)
73 double chi2,
int granularity): theMaxChi2(chi2),
74 theGranularity(granularity),
75 theFitDirection(fitDirection){
93 pair<bool,TrajectoryStateOnSurface>
98 const std::string
metname =
"Muon|RecoMuon|MuonTrajectoryUpdator";
118 sort(recHitsForFit,detLayer);
122 LogTrace(metname)<<
"Number of rechits for the fit: "<<recHitsForFit.size()<<endl;
124 TransientTrackingRecHit::ConstRecHitContainer::iterator recHit;
125 for(recHit = recHitsForFit.begin(); recHit != recHitsForFit.end(); ++recHit ) {
126 if ((*recHit)->isValid() ) {
130 *recHit, propagator);
132 if ( propagatedTSOS.
isValid() ) {
133 pair<bool,double> thisChi2 =
estimator()->
estimate(propagatedTSOS, *((*recHit).get()));
135 LogTrace(metname) <<
"Estimation for Kalman Fit. Chi2: " << thisChi2.second;
138 bool wantIncludeThisHit =
true;
140 (*recHit)->geographicalId().det() ==
DetId::Muon &&
142 wantIncludeThisHit =
false;
143 LogTrace(metname) <<
"This is an RPC hit and the present configuration is such that it will be excluded from the fit";
150 if (thisChi2.first) {
152 if (wantIncludeThisHit) {
155 <<
" Kalman Start" <<
"\n" <<
"\n";
156 LogTrace(metname) <<
" Meas. Position : " << (**recHit).globalPosition() <<
"\n"
170 <<
" Fit position radius : "
172 <<
"filter updated" << endl;
176 LogTrace(metname) <<
"\n\n Kalman End" <<
"\n" <<
"\n";
179 *recHit, thisChi2.second, detLayer,
182 trajectory.
push(updatedMeasurement, thisChi2.second);
185 LogTrace(metname) <<
" Compatible RecHit with good chi2 but made with RPC when it was decided to not include it in the fit"
186 <<
" --> trajectory NOT updated, invalid RecHit added." << endl;
189 invalidRhPtr->invalidateHit();
190 TrajectoryMeasurement invalidRhMeasurement(propagatedTSOS, propagatedTSOS, invalidRhPtr.get(), thisChi2.second, detLayer);
191 trajectory.
push(invalidRhMeasurement, thisChi2.second);
196 LogTrace(metname) <<
" Compatible RecHit with too large chi2"
197 <<
" --> trajectory NOT updated, invalid RecHit added." << endl;
200 invalidRhPtr->invalidateHit();
201 TrajectoryMeasurement invalidRhMeasurement(propagatedTSOS, propagatedTSOS, invalidRhPtr.get(), thisChi2.second, detLayer);
202 trajectory.
push(invalidRhMeasurement, thisChi2.second);
208 recHitsForFit.clear();
209 return pair<bool,TrajectoryStateOnSurface>(updated,lastUpdatedTSOS);
220 if( current->geographicalId() == mother->geographicalId() )
224 propagator->
propagate(state, current->det()->surface());
233 const double &chi2,
const DetLayer *detLayer,
236 recHit,chi2,detLayer);
263 LogError(
"Muon|RecoMuon|MuonTrajectoryUpdator") <<
"MuonTrajectoryUpdator::sort: Wrong propagation direction!!";
272 LogError(
"Muon|RecoMuon|MuonTrajectoryUpdator") <<
"MuonTrajectoryUpdator::sort: Wrong propagation direction!!";
void rescaleError(double factor)
T getParameter(std::string const &) const
Ordering along decreasing radius (for DT rechits)
const MeasurementEstimator * estimator() const
accasso at the propagator
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TransientTrackingRecHit &hit) const =0
const std::string metname
void makeFirstTime()
reset the theFirstTSOSFlag
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TransientTrackingRecHit &) const =0
Ordering along increasing zed (for CSC rechits)
NavigationDirection fitDirection()
get the fit direction
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
GlobalPoint globalPosition() const
ConstRecHitPointer recHit() const
virtual ~MuonTrajectoryUpdator()
Destructor.
TrajectoryStateOnSurface propagateState(const TrajectoryStateOnSurface &state, const TrajectoryMeasurement *measurement, const TransientTrackingRecHit::ConstRecHitPointer ¤t, const Propagator *propagator) const
MuonTrajectoryUpdator(const edm::ParameterSet &par, NavigationDirection fitDirection)
Constructor from Propagator and Parameter set.
static TransientTrackingRecHit::ConstRecHitContainer breakInSubRecHits(TransientTrackingRecHit::ConstRecHitPointer, int granularity)
takes a muon rechit and returns its sub-rechits given a certain granularity
void sort(TransientTrackingRecHit::ConstRecHitContainer &, const DetLayer *)
std::string dumpTSOS(const TrajectoryStateOnSurface &tsos) const
TrajectoryMeasurement updateMeasurement(const TrajectoryStateOnSurface &propagatedTSOS, const TrajectoryStateOnSurface &lastUpdatedTSOS, const TransientTrackingRecHit::ConstRecHitPointer &recHit, const double &chi2, const DetLayer *detLayer, const TrajectoryMeasurement *initialMeasurement)
Return the trajectory measurement. It handles both the fw and the bw propagation. ...
double theMaxChi2
the max chi2 allowed
const DetLayer * layer() const
TrajectoryStateOnSurface predictedState() const
tuple Chi2MeasurementEstimator
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
std::vector< ConstRecHitPointer > ConstRecHitContainer
Ordering along increasing radius (for DT rechits)
const TrajectoryStateUpdator * measurementUpdator() const
TrajectoryStateUpdator * theUpdator
virtual std::pair< bool, TrajectoryStateOnSurface > update(const TrajectoryMeasurement *measurement, Trajectory &trajectory, const Propagator *propagator)
update the Trajectory with the TrajectoryMeasurement
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
Ordering along decreasing zed (for CSC rechits)
void push(const TrajectoryMeasurement &tm)
GlobalVector globalDirection() const
MeasurementEstimator * theEstimator