38 theTrackerRecHitBuilderName = parameterSet.
getParameter<
string>(
"TrackerRecHitBuilder");
39 theMuonRecHitBuilderName = parameterSet.
getParameter<
string>(
"MuonRecHitBuilder");
41 theRPCInTheFit = parameterSet.
getParameter<
bool>(
"RefitRPCHits");
43 theCacheId_TC = theCacheId_GTG = theCacheId_MG = theCacheId_TRH = 0;
61 if ( newCacheId_TC != theCacheId_TC ){
62 LogTrace(metname) <<
"Tracking Component changed!";
63 theCacheId_TC = newCacheId_TC;
70 if ( newCacheId_GTG != theCacheId_GTG ) {
71 LogTrace(metname) <<
"GlobalTrackingGeometry changed!";
72 theCacheId_GTG = newCacheId_GTG;
78 if ( newCacheId_MG != theCacheId_MG ) {
79 LogTrace(metname) <<
"Magnetic Field changed!";
80 theCacheId_MG = newCacheId_MG;
86 if ( newCacheId_TRH != theCacheId_TRH ) {
87 theCacheId_TRH = newCacheId_TRH;
88 LogTrace(metname) <<
"TransientRecHitRecord changed!";
101 bool printout =
false;
109 if((*hit)->isValid())
110 if ( (*hit)->geographicalId().det() ==
DetId::Muon ){
111 if( (*hit)->geographicalId().subdetId() == 3 && !theRPCInTheFit){
112 LogTrace(
"Reco|TrackingTools|TrackTransformer") <<
"RPC Rec Hit discarged";
115 staHits.push_back(theMuonRecHitBuilder->build(&**
hit));
116 DetId hitId = staHits.back()->geographicalId();
117 GlobalPoint glbpoint = trackingGeometry()->idToDet(hitId)->position();
118 float gpy=glbpoint.
y();
119 float gpz=glbpoint.
z();
122 if (gpy > 0 && gpz > 0) quad1 =
true;
123 else if (gpy > 0 && gpz < 0) quad2 =
true;
124 else if (gpy < 0 && gpz < 0) quad3 =
true;
125 else if (gpy < 0 && gpz > 0) quad4 =
true;
129 if(staHits.empty())
return staHits;
131 if (quad1 && quad2)
return tkHits;
132 if (quad1 && quad3)
return tkHits;
133 if (quad1 && quad4)
return tkHits;
134 if (quad2 && quad3)
return tkHits;
135 if (quad2 && quad4)
return tkHits;
136 if (quad3 && quad4)
return tkHits;
139 bool doReverse = staHits.front()->globalPosition().y()>0 ?
true :
false;
141 if (quad1) doReverse = SlopeSum(staHits);
142 if (quad2) doReverse = SlopeSum(staHits);
143 if (quad3) doReverse = SlopeSum(staHits);
144 if (quad4) doReverse = SlopeSum(staHits);
146 reverse(staHits.begin(),staHits.end());
149 copy(staHits.begin(),staHits.end(),back_inserter(tkHits));
160 if (printout)
for(TransientTrackingRecHit::ConstRecHitContainer::const_iterator
hit = tkHits.begin();
161 hit !=tkHits.end(); ++
hit){
163 DetId hitId = (*hit)->geographicalId();
164 GlobalPoint glbpoint = trackingGeometry()->idToDet(hitId)->position();
177 LogTrace(
"TrackFitters") <<
" UNKNOWN MUON HIT TYPE ";
186 if(quad ==1) {
if (sumy < 0)
return theFitterOI;
else return theFitterIO;}
187 if(quad ==2) {
if (sumy < 0)
return theFitterOI;
else return theFitterIO;}
188 if(quad ==3) {
if (sumy > 0)
return theFitterOI;
else return theFitterIO;}
189 if(quad ==4) {
if (sumy > 0)
return theFitterOI;
else return theFitterIO;}
191 if(up)
return theFitterOI;
192 else return theFitterIO;
197 if(quad ==1){
if (sumy < 0)
return theSmootherOI;
else return theSmootherIO;}
198 if(quad ==2){
if (sumy < 0)
return theSmootherOI;
else return theSmootherIO;}
199 if(quad ==3){
if (sumy > 0)
return theSmootherOI;
else return theSmootherIO;}
200 if(quad ==4){
if (sumy > 0)
return theSmootherOI;
else return theSmootherIO;}
201 if(up)
return theSmootherOI;
202 else return theSmootherIO;
206 if(quad ==1) {
if (sumy > 0)
return thePropagatorOI;
else return thePropagatorIO;}
207 if(quad ==2) {
if (sumy > 0)
return thePropagatorOI;
else return thePropagatorIO;}
208 if(quad ==3) {
if (sumy < 0)
return thePropagatorOI;
else return thePropagatorIO;}
209 if(quad ==4) {
if (sumy < 0)
return thePropagatorOI;
else return thePropagatorIO;}
210 if(up)
return thePropagatorIO;
211 else return thePropagatorOI;
235 if((*hit)->isValid())
236 if ( (*hit)->geographicalId().det() ==
DetId::Muon ){
237 if( (*hit)->geographicalId().subdetId() == 3 && !theRPCInTheFit){
238 LogTrace(
"Reco|TrackingTools|TrackTransformer") <<
"RPC Rec Hit discarged";
241 staHits.push_back(theMuonRecHitBuilder->build(&**
hit));
242 DetId hitId = staHits.back()->geographicalId();
243 GlobalPoint glbpoint = trackingGeometry()->idToDet(hitId)->position();
244 float gpy=glbpoint.
y();
245 float gpz=glbpoint.
z();
248 if (gpy > 0 && gpz > 0) {quad1 =
true; quadrant = 1;}
249 else if (gpy > 0 && gpz < 0){quad2 =
true; quadrant = 2;}
250 else if (gpy < 0 && gpz < 0){quad3 =
true; quadrant = 3;}
251 else if (gpy < 0 && gpz > 0){quad4 =
true; quadrant = 4;}
252 else return vector<Trajectory>();
256 if(staHits.empty())
return vector<Trajectory>();
258 if (quad1 && quad2)
return vector<Trajectory>();
259 if (quad1 && quad3)
return vector<Trajectory>();
260 if (quad1 && quad4)
return vector<Trajectory>();
261 if (quad2 && quad3)
return vector<Trajectory>();
262 if (quad2 && quad4)
return vector<Trajectory>();
263 if (quad3 && quad4)
return vector<Trajectory>();
265 bool doReverse =
false;
267 if (quad1) doReverse = SlopeSum(staHits);
268 if (quad2) doReverse = SlopeSum(staHits);
269 if (quad3) doReverse = SlopeSum(staHits);
270 if (quad4) doReverse = SlopeSum(staHits);
274 reverse(staHits.begin(),staHits.end());
277 copy(staHits.begin(),staHits.end(),back_inserter(recHitsForReFit));
286 if(recHitsForReFit.size() < 2)
return vector<Trajectory>();
288 bool up = recHitsForReFit.back()->globalPosition().y()>0 ?
true :
false;
291 float sumdy = SumDy(recHitsForReFit);
298 LogTrace(metname) <<
"Prop Dir: " << propagationDirection <<
" FirstId " << innerId <<
" firstTSOS " << firstTSOS;
303 if(recHitsForReFit.front()->geographicalId() !=
DetId(innerId)){
304 LogTrace(metname)<<
"Propagation occurring"<<endl;
305 firstTSOS =
propagator(up, quadrant, sumdy)->propagate(firstTSOS, recHitsForReFit.front()->det()->surface());
306 LogTrace(metname)<<
"Final destination: " << recHitsForReFit.front()->det()->surface().position() << endl;
307 if(!firstTSOS.isValid()){
308 std::cout<<
"Propagation error! Dumping RecHits..."<<std::endl;
310 for(TransientTrackingRecHit::ConstRecHitContainer::const_iterator
hit = recHitsForReFit.begin();
311 hit !=recHitsForReFit.end(); ++
hit){
313 DetId hitId = (*hit)->geographicalId();
314 GlobalPoint glbpoint = trackingGeometry()->idToDet(hitId)->position();
322 LogTrace(metname)<<
"Propagation error!"<<endl;
323 return vector<Trajectory>();
328 vector<Trajectory> &&
trajectories = fitter(up, quadrant, sumdy)->fit(seed,recHitsForReFit,firstTSOS);
330 if(trajectories.empty()){
331 LogTrace(metname)<<
"No Track refitted!"<<endl;
332 return vector<Trajectory>();
335 Trajectory const & trajectoryBW = trajectories.front();
337 vector<Trajectory> && trajectoriesSM = smoother(up, quadrant, sumdy)->trajectories(trajectoryBW);
339 if(trajectoriesSM.empty()){
340 LogTrace(metname)<<
"No Track smoothed!"<<endl;
341 return vector<Trajectory>();
344 return trajectoriesSM;
359 std::vector<float> py;
360 std::vector<float> pz;
366 for(TransientTrackingRecHit::ConstRecHitContainer::const_iterator
hit = tkHits.begin();
367 hit !=tkHits.end(); ++
hit){
369 DetId hitId = (*hit)->geographicalId();
370 GlobalPoint glbpoint = trackingGeometry()->idToDet(hitId)->position();
373 float y2 = glbpoint.
y();
374 float z2 = glbpoint.
z();
385 if (fabs(dz) > 1
e-3) dslope = dy / dz;
403 if ( sumdz < 0) retval =
true;
419 std::vector<float> py;
420 std::vector<float> pz;
428 for(TransientTrackingRecHit::ConstRecHitContainer::const_iterator
hit = tkHits.begin();
429 hit !=tkHits.end(); ++
hit){
431 DetId hitId = (*hit)->geographicalId();
432 GlobalPoint glbpoint = trackingGeometry()->idToDet(hitId)->position();
435 float y2 = glbpoint.
y();
436 float z2 = glbpoint.
z();
447 if (fabs(dz) > 1
e-3) dslope = dy / dz;
T getParameter(std::string const &) const
const std::string metname
TrajectoryStateOnSurface innermostMeasurementState() const
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
TrajectoryStateOnSurface outermostMeasurementState() const
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
trackingRecHit_iterator recHitsEnd() const
last iterator to RecHits
std::vector< ConstRecHitPointer > ConstRecHitContainer
const Track & track() const
Detector det() const
get the detector field from this detid
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
trackingRecHit_iterator recHitsBegin() const
first iterator to RecHits
ParameterSet const & parameterSet(Provenance const &provenance)
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection