#include <RecoMuon/GlobalTrackingTools/interface/GlobalTrajectoryBuilderBase.h>
It tries to reconstruct the corresponding track in the tracker and performs matching between the reconstructed tracks in the muon system and the tracker.
Definition at line 48 of file GlobalTrajectoryBuilderBase.h.
typedef MuonTransientTrackingRecHit::ConstMuonRecHitContainer GlobalTrajectoryBuilderBase::ConstMuonRecHitContainer |
Definition at line 60 of file GlobalTrajectoryBuilderBase.h.
typedef MuonTransientTrackingRecHit::ConstMuonRecHitPointer GlobalTrajectoryBuilderBase::ConstMuonRecHitPointer |
Definition at line 58 of file GlobalTrajectoryBuilderBase.h.
typedef TransientTrackingRecHit::ConstRecHitContainer GlobalTrajectoryBuilderBase::ConstRecHitContainer |
Definition at line 53 of file GlobalTrajectoryBuilderBase.h.
Definition at line 55 of file GlobalTrajectoryBuilderBase.h.
typedef MuonTransientTrackingRecHit::MuonRecHitContainer GlobalTrajectoryBuilderBase::MuonRecHitContainer |
Definition at line 59 of file GlobalTrajectoryBuilderBase.h.
typedef MuonTransientTrackingRecHit::MuonRecHitPointer GlobalTrajectoryBuilderBase::MuonRecHitPointer |
Definition at line 57 of file GlobalTrajectoryBuilderBase.h.
Definition at line 52 of file GlobalTrajectoryBuilderBase.h.
Definition at line 54 of file GlobalTrajectoryBuilderBase.h.
typedef std::vector<Trajectory> GlobalTrajectoryBuilderBase::TC |
Definition at line 62 of file GlobalTrajectoryBuilderBase.h.
typedef TC::const_iterator GlobalTrajectoryBuilderBase::TI |
Definition at line 63 of file GlobalTrajectoryBuilderBase.h.
enum GlobalTrajectoryBuilderBase::RefitDirection [protected] |
GlobalTrajectoryBuilderBase::GlobalTrajectoryBuilderBase | ( | const edm::ParameterSet & | par, | |
const MuonServiceProxy * | service | |||
) |
constructor with Parameter Set and MuonServiceProxy
Definition at line 84 of file GlobalTrajectoryBuilderBase.cc.
References edm::ParameterSet::addParameter(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), theCacheId_TRH, theCategory, theCSCChi2Cut, theDTChi2Cut, theHitThreshold, theKFFitterName, theLayerMeasurements, theMuonHitsOption, theMuonRecHitBuilderName, theProbCut, thePtCut, theRegionBuilder, theRPCChi2Cut, theRPCInTheFit, theService, theTkTrajsAvailableFlag, theTrackerPropagatorName, theTrackerRecHitBuilderName, theTrackMatcher, and theTrackTransformer.
00085 : 00086 theService(service) { 00087 00088 theCategory = par.getUntrackedParameter<string>("Category", "Muon|RecoMuon|GlobalMuon|GlobalTrajectoryBuilderBase"); 00089 00090 theLayerMeasurements = new MuonDetLayerMeasurements(par.getParameter<InputTag>("DTRecSegmentLabel"), 00091 par.getParameter<InputTag>("CSCRecSegmentLabel"), 00092 par.getParameter<InputTag>("RPCRecSegmentLabel")); 00093 00094 string MatcherOutPropagator = par.getParameter<string>("MatcherOutPropagator"); 00095 string TransformerOutPropagator = par.getParameter<string>("TransformerOutPropagator"); 00096 00097 ParameterSet trackMatcherPSet = par.getParameter<ParameterSet>("GlobalMuonTrackMatcher"); 00098 trackMatcherPSet.addParameter<string>("Propagator",MatcherOutPropagator); 00099 theTrackMatcher = new GlobalMuonTrackMatcher(trackMatcherPSet,theService); 00100 00101 theTrackerPropagatorName = par.getParameter<string>("TrackerPropagator"); 00102 00103 ParameterSet trackTransformerPSet = par.getParameter<ParameterSet>("TrackTransformer"); 00104 trackTransformerPSet.addParameter<string>("Propagator",TransformerOutPropagator); 00105 theTrackTransformer = new TrackTransformer(trackTransformerPSet); 00106 00107 ParameterSet regionBuilderPSet = par.getParameter<ParameterSet>("MuonTrackingRegionBuilder"); 00108 regionBuilderPSet.addParameter<bool>("RegionalSeedFlag",false); 00109 00110 theRegionBuilder = new MuonTrackingRegionBuilder(regionBuilderPSet,theService); 00111 00112 theTrackerRecHitBuilderName = par.getParameter<string>("TrackerRecHitBuilder"); 00113 theMuonRecHitBuilderName = par.getParameter<string>("MuonRecHitBuilder"); 00114 00115 theRPCInTheFit = par.getParameter<bool>("RefitRPCHits"); 00116 00117 theMuonHitsOption = par.getParameter<int>("MuonHitsOption"); 00118 thePtCut = par.getParameter<double>("PtCut"); 00119 theProbCut = par.getParameter<double>("Chi2ProbabilityCut"); 00120 theHitThreshold = par.getParameter<int>("HitThreshold"); 00121 theDTChi2Cut = par.getParameter<double>("Chi2CutDT"); 00122 theCSCChi2Cut = par.getParameter<double>("Chi2CutCSC"); 00123 theRPCChi2Cut = par.getParameter<double>("Chi2CutRPC"); 00124 theKFFitterName = par.getParameter<string>("KFFitter"); 00125 theTkTrajsAvailableFlag = true; 00126 00127 theCacheId_TRH = 0; 00128 00129 }
GlobalTrajectoryBuilderBase::~GlobalTrajectoryBuilderBase | ( | ) | [virtual] |
destructor
Definition at line 135 of file GlobalTrajectoryBuilderBase.cc.
References theLayerMeasurements, theRegionBuilder, theTrackMatcher, and theTrackTransformer.
00135 { 00136 00137 if (theTrackMatcher) delete theTrackMatcher; 00138 if (theLayerMeasurements) delete theLayerMeasurements; 00139 if (theRegionBuilder) delete theRegionBuilder; 00140 if (theTrackTransformer) delete theTrackTransformer; 00141 00142 }
if TrackCand has only a TrackRef, attempt to add Trajectory*
Definition at line 813 of file GlobalTrajectoryBuilderBase.cc.
References LogTrace, Trajectory::setSeedRef(), theCategory, theTkTrajsAvailableFlag, theTrackTransformer, and TrackTransformer::transform().
Referenced by L3MuonTrajectoryBuilder::trajectories(), FastL3MuonTrajectoryBuilder::trajectories(), and GlobalMuonTrajectoryBuilder::trajectories().
00813 { 00814 00815 if ( candIn.first == 0 ) { 00816 theTkTrajsAvailableFlag = false; 00817 LogTrace(theCategory) << "Making new trajectory from TrackRef " << (*candIn.second).pt(); 00818 00819 TC staTrajs = theTrackTransformer->transform(*(candIn.second)); 00820 if (staTrajs.empty()) { 00821 LogTrace(theCategory) << "Transformer: Add Traj failed!"; 00822 candIn = TrackCand(0,candIn.second); 00823 } else { 00824 Trajectory * tmpTrajectory = new Trajectory(staTrajs.front()); 00825 tmpTrajectory->setSeedRef(candIn.second->seedRef()); 00826 candIn = TrackCand(tmpTrajectory,candIn.second); 00827 } 00828 } 00829 }
MuonTrajectoryBuilder::CandidateContainer GlobalTrajectoryBuilderBase::build | ( | const TrackCand & | , | |
MuonTrajectoryBuilder::CandidateContainer & | ||||
) | const [protected] |
build combined trajectory from sta Track and tracker RecHits
Referenced by L3MuonTrajectoryBuilder::trajectories(), FastL3MuonTrajectoryBuilder::trajectories(), and GlobalMuonTrajectoryBuilder::trajectories().
void GlobalTrajectoryBuilderBase::checkMuonHits | ( | const reco::Track & | muon, | |
ConstRecHitContainer & | all, | |||
ConstRecHitContainer & | first, | |||
std::vector< int > & | hits | |||
) | const [protected] |
check muon RecHits, calculate chamber occupancy and select hits to be used in the final fit
Definition at line 403 of file GlobalTrajectoryBuilderBase.cc.
References alongMomentum, MuonSubdetId::CSC, MuonSubdetId::DT, getTransientRecHits(), i, LogTrace, muonGeometry::mag(), DetId::rawId(), MuonDetLayerMeasurements::recHits(), MuonSubdetId::RPC, RPCDetId::station(), DTChamberId::station(), CSCDetId::station(), theCategory, theLayerMeasurements, theMuonHitsOption, theService, and track.
00406 { 00407 00408 int dethits[4]; 00409 for ( int i=0; i<4; i++ ) hits[i]=dethits[i]=0; 00410 00411 reco::TransientTrack track(muon,&*(theService->magneticField()),theService->trackingGeometry()); 00412 TransientTrackingRecHit::ConstRecHitContainer muonRecHits = getTransientRecHits(track); 00413 00414 // all.assign(muonRecHits.begin(),muonRecHits.end()); //FIXME: should use this 00415 00416 // loop through all muon hits and calculate the maximum # of hits in each chamber 00417 for (ConstRecHitContainer::const_iterator imrh = muonRecHits.begin(); imrh != muonRecHits.end(); imrh++ ) { 00418 00419 if ( (*imrh != 0 ) && !(*imrh)->isValid() ) continue; 00420 00421 if ( theMuonHitsOption == 3 || theMuonHitsOption == 4 || theMuonHitsOption == 5 ) { 00422 00423 int station = 0; 00424 int detRecHits = 0; 00425 00426 DetId id = (*imrh)->geographicalId(); 00427 const DetLayer* layer = theService->detLayerGeometry()->idToLayer(id); 00428 MuonRecHitContainer dRecHits = theLayerMeasurements->recHits(layer); 00429 // get station of hit if it is in DT 00430 if ( id.subdetId() == MuonSubdetId::DT ) { 00431 DTChamberId did(id.rawId()); 00432 station = did.station(); 00433 float coneSize = 10.0; 00434 00435 bool hitUnique = false; 00436 ConstRecHitContainer all2dRecHits; 00437 for (MuonRecHitContainer::const_iterator ir = dRecHits.begin(); ir != dRecHits.end(); ir++ ) { 00438 if ( (**ir).dimension() == 2 ) { 00439 hitUnique = true; 00440 if ( all2dRecHits.size() > 0 ) { 00441 for (ConstRecHitContainer::const_iterator iir = all2dRecHits.begin(); iir != all2dRecHits.end(); iir++ ) 00442 if (((*iir)->localPosition()-(*ir)->localPosition()).mag()<0.01) hitUnique = false; 00443 } //end of if ( all2dRecHits.size() > 0 ) 00444 if ( hitUnique ) all2dRecHits.push_back((*ir).get()); //FIXME!! 00445 } else { 00446 ConstRecHitContainer sRecHits = (**ir).transientHits(); 00447 for (ConstRecHitContainer::const_iterator iir = sRecHits.begin(); iir != sRecHits.end(); iir++ ) { 00448 if ( (*iir)->dimension() == 2 ) { 00449 hitUnique = true; 00450 if ( !all2dRecHits.empty() ) { 00451 for (ConstRecHitContainer::const_iterator iiir = all2dRecHits.begin(); iiir != all2dRecHits.end(); iiir++ ) 00452 if (((*iiir)->localPosition()-(*iir)->localPosition()).mag()<0.01) hitUnique = false; 00453 }//end of if ( all2dRecHits.size() > 0 ) 00454 }//end of if ( (*iir).dimension() == 2 ) 00455 if ( hitUnique ) 00456 all2dRecHits.push_back(*iir); 00457 break; 00458 }//end of for sRecHits 00459 }// end of else 00460 }// end of for loop over dRecHits 00461 for (ConstRecHitContainer::const_iterator ir = all2dRecHits.begin(); ir != all2dRecHits.end(); ir++ ) { 00462 double rhitDistance = ((*ir)->localPosition()-(**imrh).localPosition()).mag(); 00463 if ( rhitDistance < coneSize ) detRecHits++; 00464 LogTrace(theCategory) << " Station " << station << " DT "<<(*ir)->dimension()<<" " << (*ir)->localPosition() 00465 << " Distance: "<< rhitDistance<<" recHits: "<< detRecHits; 00466 }// end of for all2dRecHits 00467 }// end of if DT 00468 // get station of hit if it is in CSC 00469 else if ( id.subdetId() == MuonSubdetId::CSC ) { 00470 CSCDetId did(id.rawId()); 00471 station = did.station(); 00472 00473 float coneSize = 10.0; 00474 00475 for (MuonRecHitContainer::const_iterator ir = dRecHits.begin(); ir != dRecHits.end(); ir++ ) { 00476 double rhitDistance = ((**ir).localPosition()-(**imrh).localPosition()).mag(); 00477 if ( rhitDistance < coneSize ) detRecHits++; 00478 LogTrace(theCategory) << " Station " << station << " CSC "<<(**ir).dimension()<<" "<<(**ir).localPosition() 00479 << " Distance: "<< rhitDistance<<" recHits: "<<detRecHits; 00480 } 00481 } 00482 // get station of hit if it is in RPC 00483 else if ( id.subdetId() == MuonSubdetId::RPC ) { 00484 RPCDetId rpcid(id.rawId()); 00485 station = rpcid.station(); 00486 float coneSize = 100.0; 00487 for (MuonRecHitContainer::const_iterator ir = dRecHits.begin(); ir != dRecHits.end(); ir++ ) { 00488 double rhitDistance = ((**ir).localPosition()-(**imrh).localPosition()).mag(); 00489 if ( rhitDistance < coneSize ) detRecHits++; 00490 LogTrace(theCategory)<<" Station "<<station<<" RPC "<<(**ir).dimension()<<" "<< (**ir).localPosition() 00491 <<" Distance: "<<rhitDistance<<" recHits: "<<detRecHits; 00492 } 00493 } 00494 else { 00495 LogError(theCategory)<<" Wrong Hit Type "; 00496 continue; 00497 } 00498 00499 if ( (station > 0) && (station < 5) ) { 00500 int detHits = dRecHits.size(); 00501 dethits[station-1] += detHits; 00502 if ( detRecHits > hits[station-1] ) hits[station-1] = detRecHits; 00503 } 00504 } //end of if option 3, 4, 5 00505 00506 all.push_back((*imrh).get()); //FIXME: may need fast assignment on above 00507 00508 } // end of loop over muon rechits 00509 if ( theMuonHitsOption == 3 || theMuonHitsOption == 4 || theMuonHitsOption == 5 ) { 00510 for ( int i = 0; i < 4; i++ ) { 00511 LogTrace(theCategory) <<"Station "<<i+1<<": "<<hits[i]<<" "<<dethits[i]; 00512 } 00513 } 00514 00515 // 00516 // check order of muon measurements 00517 // 00518 LogTrace(theCategory) << "CheckMuonHits "<<all.size(); 00519 00520 if ( (all.size() > 1) && 00521 ( all.front()->globalPosition().mag() > 00522 all.back()->globalPosition().mag() ) ) { 00523 LogTrace(theCategory)<< "reverse order: "; 00524 stable_sort(all.begin(),all.end(),RecHitLessByDet(alongMomentum)); 00525 } 00526 00527 stable_sort(all.begin(),all.end(),ComparatorInOut()); 00528 00529 int station1 = -999; 00530 int station2 = -999; 00531 for (ConstRecHitContainer::const_iterator ihit = all.begin(); ihit != all.end(); ihit++ ) { 00532 00533 if ( !(*ihit)->isValid() ) continue; 00534 station1 = -999; station2 = -999; 00535 // store muon hits one at a time. 00536 first.push_back(*ihit); 00537 00538 ConstMuonRecHitPointer immrh = dynamic_cast<const MuonTransientTrackingRecHit*>((*ihit).get()); //FIXME 00539 DetId id = immrh->geographicalId(); 00540 00541 // get station of 1st hit if it is in DT 00542 if ( (*immrh).isDT() ) { 00543 DTChamberId did(id.rawId()); 00544 station1 = did.station(); 00545 } 00546 // otherwise get station of 1st hit if it is in CSC 00547 else if ( (*immrh).isCSC() ) { 00548 CSCDetId did(id.rawId()); 00549 station1 = did.station(); 00550 } 00551 // check next RecHit 00552 ConstRecHitContainer::const_iterator nexthit(ihit); 00553 nexthit++; 00554 00555 if ( ( nexthit != all.end()) && (*nexthit)->isValid() ) { 00556 00557 ConstMuonRecHitPointer immrh2 = dynamic_cast<const MuonTransientTrackingRecHit*>((*nexthit).get()); 00558 DetId id2 = immrh2->geographicalId(); 00559 00560 // get station of 1st hit if it is in DT 00561 if ( (*immrh2).isDT() ) { 00562 DTChamberId did2(id2.rawId()); 00563 station2 = did2.station(); 00564 } 00565 // otherwise get station of 1st hit if it is in CSC 00566 else if ( (*immrh2).isCSC() ) { 00567 CSCDetId did2(id2.rawId()); 00568 station2 = did2.station(); 00569 } 00570 00571 // 1st hit is in station 1 and second hit is in a different station 00572 // or an rpc (if station = -999 it could be an rpc hit) 00573 if ( (station1 != -999) && ((station2 == -999) || (station2 > station1)) ) { 00574 LogTrace(theCategory) << "checkMuonHits:"; 00575 LogTrace(theCategory) << " station 1 = "<<station1 00576 <<", r = "<< (*ihit)->globalPosition().perp() 00577 <<", z = "<< (*ihit)->globalPosition().z() << ", "; 00578 00579 LogTrace(theCategory) << " station 2 = " << station2 00580 <<", r = "<<(*(nexthit))->globalPosition().perp() 00581 <<", z = "<<(*(nexthit))->globalPosition().z() << ", "; 00582 return; 00583 } 00584 } 00585 else if ( (nexthit == all.end()) && (station1 != -999) ) { 00586 LogTrace(theCategory) << "checkMuonHits:"; 00587 LogTrace(theCategory) << " station 1 = "<< station1 00588 << ", r = " << (*ihit)->globalPosition().perp() 00589 << ", z = " << (*ihit)->globalPosition().z() << ", "; 00590 return; 00591 } 00592 } 00593 // if none of the above is satisfied, return blank vector 00594 first.clear(); 00595 00596 return; 00597 00598 }
RefitDirection GlobalTrajectoryBuilderBase::checkRecHitsOrdering | ( | const ConstRecHitContainer & | ) | const [protected] |
std::vector<TrackCand> GlobalTrajectoryBuilderBase::chooseRegionalTrackerTracks | ( | const TrackCand & | , | |
const std::vector< TrackCand > & | ||||
) | [protected] |
choose tracker tracks within region of interest
Referenced by GlobalMuonTrajectoryBuilder::makeTkCandCollection().
const Trajectory * GlobalTrajectoryBuilderBase::chooseTrajectory | ( | const std::vector< Trajectory * > & | t, | |
int | muonHitsOption | |||
) | const [protected] |
choose final trajectory
Definition at line 681 of file GlobalTrajectoryBuilderBase.cc.
References lat::endl(), i, LogTrace, theCategory, theProbCut, and trackProbability().
00682 { 00683 00684 Trajectory* result = 0; 00685 00686 if ( muonHitsOption == 0 ) { 00687 if (t[0]) result = t[0]; 00688 return result; 00689 } else if ( muonHitsOption == 1 ) { 00690 if (t[1]) result = t[1]; 00691 return result; 00692 } else if ( muonHitsOption == 2 ) { 00693 if (t[2]) result = t[2]; 00694 return result; 00695 } else if ( muonHitsOption == 3 ) { 00696 if (t[3]) result = t[3]; 00697 return result; 00698 } else if ( muonHitsOption == 4 ) { 00699 double prob0 = ( t[0] ) ? trackProbability(*t[0]) : 0.0; 00700 double prob1 = ( t[1] ) ? trackProbability(*t[1]) : 0.0; 00701 double prob2 = ( t[2] ) ? trackProbability(*t[2]) : 0.0; 00702 double prob3 = ( t[3] ) ? trackProbability(*t[3]) : 0.0; 00703 00704 LogTrace(theCategory) << "Probabilities: " << prob0 << " " << prob1 << " " << prob2 << " " << prob3 << endl; 00705 00706 if ( t[1] ) result = t[1]; 00707 if ( (t[1] == 0) && t[3] ) result = t[3]; 00708 00709 if ( t[1] && t[3] && ( (prob1 - prob3) > 0.05 ) ) result = t[3]; 00710 00711 if ( t[0] && t[2] && fabs(prob2 - prob0) > theProbCut ) { 00712 LogTrace(theCategory) << "select Tracker only: -log(prob) = " << prob0 << endl; 00713 result = t[0]; 00714 return result; 00715 } 00716 00717 if ( (t[1] == 0) && (t[3] == 0) && t[2] ) result = t[2]; 00718 00719 Trajectory* tmin = 0; 00720 double probmin = 0.0; 00721 if ( t[1] && t[3] ) { 00722 probmin = prob3; tmin = t[3]; 00723 if ( prob1 < prob3 ) { probmin = prob1; tmin = t[1]; } 00724 } 00725 else if ( (t[3] == 0) && t[1] ) { 00726 probmin = prob1; tmin = t[1]; 00727 } 00728 else if ( (t[1] == 0) && t[3] ) { 00729 probmin = prob3; tmin = t[3]; 00730 } 00731 00732 if ( tmin && t[2] && ( (probmin - prob2) > 3.5 ) ) { 00733 result = t[2]; 00734 } 00735 00736 } else if ( muonHitsOption == 5 ) { 00737 00738 double prob[4]; 00739 int chosen=3; 00740 for (int i=0;i<4;i++) 00741 prob[i] = (t[i]) ? trackProbability(*t[i]) : 0.0; 00742 00743 if (!t[3]) 00744 if (t[2]) chosen=2; else 00745 if (t[1]) chosen=1; else 00746 if (t[0]) chosen=0; 00747 00748 if ( t[0] && t[3] && ((prob[3]-prob[0]) > 48.) ) chosen=0; 00749 if ( t[0] && t[1] && ((prob[1]-prob[0]) < 3.) ) chosen=1; 00750 if ( t[2] && ((prob[chosen]-prob[2]) > 9.) ) chosen=2; 00751 00752 LogTrace(theCategory) << "Chosen Trajectory " << chosen; 00753 00754 result=t[chosen]; 00755 } 00756 else { 00757 LogTrace(theCategory) << "Wrong Hits Option in Choosing Trajectory "; 00758 } 00759 return result; 00760 00761 }
RectangularEtaPhiTrackingRegion GlobalTrajectoryBuilderBase::defineRegionOfInterest | ( | const reco::TrackRef & | staTrack | ) | const [protected] |
define region of interest with tracker
Definition at line 379 of file GlobalTrajectoryBuilderBase.cc.
References TrackingRegionBase::direction(), RectangularEtaPhiTrackingRegion::etaRange(), TrackingRegionBase::origin(), TrackingRegionBase::originRBound(), TrackingRegionBase::originZBound(), RectangularEtaPhiTrackingRegion::phiMargin(), TrackingRegionBase::ptMin(), MuonTrackingRegionBuilder::region(), and theRegionBuilder.
Referenced by L3MuonTrajectoryBuilder::makeTkCandCollection().
00379 { 00380 00381 RectangularEtaPhiTrackingRegion* region1 = theRegionBuilder->region(staTrack); 00382 00383 TkTrackingRegionsMargin<float> etaMargin(fabs(region1->etaRange().min() - region1->etaRange().mean()), 00384 fabs(region1->etaRange().max() - region1->etaRange().mean())); 00385 00386 RectangularEtaPhiTrackingRegion region2(region1->direction(), 00387 region1->origin(), 00388 region1->ptMin(), 00389 region1->originRBound(), 00390 region1->originZBound(), 00391 etaMargin, 00392 region1->phiMargin()); 00393 00394 delete region1; 00395 return region2; 00396 00397 }
TransientTrackingRecHit::ConstRecHitContainer GlobalTrajectoryBuilderBase::getTransientRecHits | ( | const reco::TransientTrack & | track | ) | const [protected] |
Definition at line 957 of file GlobalTrajectoryBuilderBase.cc.
References LogDebug, DetId::Muon, reco::TransientTrack::recHitsBegin(), reco::TransientTrack::recHitsEnd(), theCategory, theMuonRecHitBuilder, theRPCInTheFit, theTrackerRecHitBuilder, and DetId::Tracker.
Referenced by checkMuonHits().
00957 { 00958 TransientTrackingRecHit::ConstRecHitContainer result; 00959 00960 for (trackingRecHit_iterator hit = track.recHitsBegin(); hit != track.recHitsEnd(); ++hit) 00961 if((*hit)->isValid()) 00962 if ( (*hit)->geographicalId().det() == DetId::Tracker ) 00963 result.push_back(theTrackerRecHitBuilder->build(&**hit)); 00964 else if ( (*hit)->geographicalId().det() == DetId::Muon ){ 00965 if( (*hit)->geographicalId().subdetId() == 3 && !theRPCInTheFit){ 00966 LogDebug(theCategory) << "RPC Rec Hit discarged"; 00967 continue; 00968 } 00969 result.push_back(theMuonRecHitBuilder->build(&**hit)); 00970 } 00971 00972 return result; 00973 }
vector< Trajectory > GlobalTrajectoryBuilderBase::glbTrajectory | ( | const TrajectorySeed & | seed, | |
const ConstRecHitContainer & | trackerhits, | |||
const ConstRecHitContainer & | muonhits, | |||
const TrajectoryStateOnSurface & | firstPredTsos | |||
) | const [protected] |
build a global trajectory from tracker and muon hits
Definition at line 904 of file GlobalTrajectoryBuilderBase.cc.
References alongMomentum, checkRecHitsOrdering(), oppositeToMomentum, outToIn, TrajectoryStateOnSurface::rescaleError(), TrajectorySeed::startingState(), and theKFFitter.
00907 { 00908 00909 ConstRecHitContainer hits = tkhits; 00910 hits.insert(hits.end(), muonhits.begin(), muonhits.end()); 00911 00912 if ( hits.empty() ) return vector<Trajectory>(); 00913 00914 PTrajectoryStateOnDet PTSOD = seed.startingState(); 00915 00916 edm::OwnVector<TrackingRecHit> garbage2; 00917 00918 RefitDirection recHitDir = checkRecHitsOrdering(hits); 00919 PropagationDirection refitDir = (recHitDir == outToIn) ? oppositeToMomentum : alongMomentum ; 00920 TrajectorySeed newSeed(PTSOD,garbage2,refitDir); 00921 00922 TrajectoryStateOnSurface firstTsos = firstPredTsos; 00923 firstTsos.rescaleError(10.); 00924 00925 vector<Trajectory> theTrajs = theKFFitter->fit(newSeed,hits,firstTsos); 00926 00927 return theTrajs; 00928 00929 }
virtual std::vector<TrackCand> GlobalTrajectoryBuilderBase::makeTkCandCollection | ( | const TrackCand & | ) | [protected, pure virtual] |
make a TrackCand collection using tracker Track, Trajectory information
Implemented in FastL3MuonTrajectoryBuilder, GlobalMuonTrajectoryBuilder, and L3MuonTrajectoryBuilder.
void GlobalTrajectoryBuilderBase::printHits | ( | const ConstRecHitContainer & | hits | ) | const [protected] |
print all RecHits of a trajectory
Definition at line 787 of file GlobalTrajectoryBuilderBase.cc.
References LogTrace, funct::sqrt(), theCategory, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
00787 { 00788 00789 LogTrace(theCategory) << "Used RecHits: " << hits.size(); 00790 for (ConstRecHitContainer::const_iterator ir = hits.begin(); ir != hits.end(); ir++ ) { 00791 if ( !(*ir)->isValid() ) { 00792 LogTrace(theCategory) << "invalid RecHit"; 00793 continue; 00794 } 00795 00796 const GlobalPoint& pos = (*ir)->globalPosition(); 00797 00798 LogTrace(theCategory) 00799 << "r = " << sqrt(pos.x() * pos.x() + pos.y() * pos.y()) 00800 << " z = " << pos.z() 00801 << " dimension = " << (*ir)->dimension() 00802 << " " << (*ir)->det()->geographicalId().det() 00803 << " " << (*ir)->det()->subDetector(); 00804 00805 } 00806 00807 }
vector< Trajectory > GlobalTrajectoryBuilderBase::refitTrajectory | ( | const Trajectory & | tkTraj | ) | const [protected] |
refit a trajectory
Definition at line 865 of file GlobalTrajectoryBuilderBase.cc.
References alongMomentum, checkRecHitsOrdering(), Trajectory::direction(), Trajectory::firstMeasurement(), inToOut, Trajectory::lastMeasurement(), oppositeToMomentum, Trajectory::recHits(), TrajectoryStateOnSurface::rescaleError(), Trajectory::seedRef(), theKFFitter, and TrajectoryMeasurement::updatedState().
Referenced by L3MuonTrajectoryBuilder::trajectories(), and FastL3MuonTrajectoryBuilder::trajectories().
00865 { 00866 00867 // this is the only way to get a TrajectorySeed with settable propagation direction 00868 PTrajectoryStateOnDet garbage1; 00869 edm::OwnVector<TrackingRecHit> garbage2; 00870 00871 ConstRecHitContainer trackerRecHits = tkTraj.recHits(); 00872 00873 RefitDirection recHitDir = checkRecHitsOrdering(trackerRecHits); 00874 // force the rechits to be ordered from outside-in 00875 if ( recHitDir == inToOut ) reverse(trackerRecHits.begin(),trackerRecHits.end()); 00876 00877 // force the refit direction to be opposite to momentum due to the rechit ordering 00878 PropagationDirection refitDir = oppositeToMomentum; 00879 00880 TrajectorySeed seed(garbage1,garbage2,refitDir); 00881 00882 // take the outermost state as the initial state for refitting 00883 TrajectoryMeasurement outerTM = (tkTraj.direction() == alongMomentum) ? tkTraj.lastMeasurement() : tkTraj.firstMeasurement(); 00884 TrajectoryStateOnSurface outerTsos = outerTM.updatedState(); 00885 outerTsos.rescaleError(100.); 00886 00887 vector<Trajectory> refitted1 = theKFFitter->fit(seed,trackerRecHits,outerTsos); 00888 00889 if ( !refitted1.empty() ) { 00890 for (vector<Trajectory>::iterator nit = refitted1.begin(); nit != refitted1.end(); ++nit) { 00891 (*nit).setSeedRef(tkTraj.seedRef()); 00892 } 00893 } 00894 00895 return refitted1; 00896 00897 }
GlobalTrajectoryBuilderBase::ConstRecHitContainer GlobalTrajectoryBuilderBase::selectMuonHits | ( | const Trajectory & | traj, | |
const std::vector< int > & | hits | |||
) | const [protected] |
select muon hits compatible with trajectory; check hits in chambers with showers
Definition at line 606 of file GlobalTrajectoryBuilderBase.cc.
References lat::endl(), keep, LogTrace, Trajectory::measurements(), DetId::Muon, RPCDetId::station(), CSCDetId::station(), DTChamberId::station(), theCategory, theCSCChi2Cut, theDTChi2Cut, theHitThreshold, theRPCChi2Cut, and dimuonsSequences_cff::threshold.
00607 { 00608 00609 ConstRecHitContainer muonRecHits; 00610 const double globalChi2Cut = 200.0; 00611 00612 vector<TrajectoryMeasurement> muonMeasurements = traj.measurements(); 00613 00614 // loop through all muon hits and skip hits with bad chi2 in chambers with high occupancy 00615 for (vector<TrajectoryMeasurement>::const_iterator im = muonMeasurements.begin(); im != muonMeasurements.end(); im++ ) { 00616 00617 if ( !(*im).recHit()->isValid() ) continue; 00618 if ( (*im).recHit()->det()->geographicalId().det() != DetId::Muon ) continue; 00619 ConstMuonRecHitPointer immrh = dynamic_cast<const MuonTransientTrackingRecHit*>((*im).recHit().get()); 00620 00621 DetId id = immrh->geographicalId(); 00622 int station = 0; 00623 int threshold = 0; 00624 double chi2Cut = 0.0; 00625 00626 // get station of hit if it is in DT 00627 if ( (*immrh).isDT() ) { 00628 DTChamberId did(id.rawId()); 00629 station = did.station(); 00630 threshold = theHitThreshold; 00631 chi2Cut = theDTChi2Cut; 00632 } 00633 // get station of hit if it is in CSC 00634 else if ( (*immrh).isCSC() ) { 00635 CSCDetId did(id.rawId()); 00636 station = did.station(); 00637 threshold = theHitThreshold; 00638 chi2Cut = theCSCChi2Cut; 00639 } 00640 // get station of hit if it is in RPC 00641 else if ( (*immrh).isRPC() ) { 00642 RPCDetId rpcid(id.rawId()); 00643 station = rpcid.station(); 00644 threshold = theHitThreshold; 00645 chi2Cut = theRPCChi2Cut; 00646 } 00647 else { 00648 continue; 00649 } 00650 00651 double chi2ndf = (*im).estimate()/(*im).recHit()->dimension(); 00652 00653 bool keep = true; 00654 if ( (station > 0) && (station < 5) ) { 00655 if ( hits[station-1] > threshold ) keep = false; 00656 } 00657 00658 if ( (keep || ( chi2ndf < chi2Cut )) && ( chi2ndf < globalChi2Cut ) ) { 00659 muonRecHits.push_back((*im).recHit()); 00660 } else { 00661 LogTrace(theCategory) 00662 << "Skip hit: " << id.det() << " " << station << ", " 00663 << chi2ndf << " (" << chi2Cut << " chi2 threshold) " 00664 << hits[station-1] << endl; 00665 } 00666 00667 } 00668 00669 // check order of rechits 00670 reverse(muonRecHits.begin(),muonRecHits.end()); 00671 00672 return muonRecHits; 00673 00674 }
GlobalTrajectoryBuilderBase::ConstRecHitContainer GlobalTrajectoryBuilderBase::selectTrackerHits | ( | const ConstRecHitContainer & | all | ) | const [protected] |
select tracker hits; exclude some tracker hits in the global trajectory
Definition at line 936 of file GlobalTrajectoryBuilderBase.cc.
References i, StripSubdetector::TEC, and DetId::Tracker.
00936 { 00937 00938 int nTEC(0); 00939 00940 ConstRecHitContainer hits; 00941 for (ConstRecHitContainer::const_iterator i = all.begin(); i != all.end(); i++) { 00942 if( !(*i)->isValid() ) continue; 00943 if ( (*i)->det()->geographicalId().det() == DetId::Tracker && 00944 (*i)->det()->geographicalId().subdetId() == StripSubdetector::TEC) { 00945 nTEC++; 00946 } else { 00947 hits.push_back((*i).get()); 00948 } 00949 if ( nTEC > 1 ) return all; 00950 } 00951 00952 return hits; 00953 00954 }
const MuonServiceProxy* GlobalTrajectoryBuilderBase::service | ( | ) | const [inline, protected] |
Definition at line 138 of file GlobalTrajectoryBuilderBase.h.
References theService.
Referenced by L3MuonTrajectoryBuilder::L3MuonTrajectoryBuilder(), and L3MuonTrajectoryBuilder::setEvent().
00138 { return theService; }
void GlobalTrajectoryBuilderBase::setEvent | ( | const edm::Event & | event | ) | [virtual] |
pass the Event to the algo at each event
Implements MuonTrajectoryBuilder.
Reimplemented in FastL3MuonTrajectoryBuilder, GlobalMuonTrajectoryBuilder, and L3MuonTrajectoryBuilder.
Definition at line 148 of file GlobalTrajectoryBuilderBase.cc.
References LogDebug, MuonDetLayerMeasurements::setEvent(), MuonTrackingRegionBuilder::setEvent(), TrackTransformer::setServices(), theCacheId_TRH, theCategory, theEvent, theKFFitter, theKFFitterName, theLayerMeasurements, theMuonRecHitBuilder, theMuonRecHitBuilderName, theRegionBuilder, theService, theTrackerRecHitBuilder, theTrackerRecHitBuilderName, and theTrackTransformer.
Referenced by L3MuonTrajectoryBuilder::setEvent(), FastL3MuonTrajectoryBuilder::setEvent(), and GlobalMuonTrajectoryBuilder::setEvent().
00148 { 00149 00150 theEvent = &event; 00151 theLayerMeasurements->setEvent(event); 00152 theService->eventSetup().get<TrackingComponentsRecord>().get(theKFFitterName,theKFFitter); 00153 theTrackTransformer->setServices(theService->eventSetup()); 00154 theRegionBuilder->setEvent(event); 00155 00156 unsigned long long newCacheId_TRH = theService->eventSetup().get<TransientRecHitRecord>().cacheIdentifier(); 00157 if ( newCacheId_TRH != theCacheId_TRH ) { 00158 LogDebug(theCategory) << "TransientRecHitRecord changed!"; 00159 theCacheId_TRH = newCacheId_TRH; 00160 theService->eventSetup().get<TransientRecHitRecord>().get(theTrackerRecHitBuilderName,theTrackerRecHitBuilder); 00161 theService->eventSetup().get<TransientRecHitRecord>().get(theMuonRecHitBuilderName,theMuonRecHitBuilder); 00162 00163 } 00164 00165 }
GlobalMuonTrackMatcher* GlobalTrajectoryBuilderBase::trackMatcher | ( | ) | const [inline, protected] |
Definition at line 135 of file GlobalTrajectoryBuilderBase.h.
References theTrackMatcher.
Referenced by L3MuonTrajectoryBuilder::trajectories(), FastL3MuonTrajectoryBuilder::trajectories(), and GlobalMuonTrajectoryBuilder::trajectories().
00135 { return theTrackMatcher; }
double GlobalTrajectoryBuilderBase::trackProbability | ( | const Trajectory & | track | ) | const [protected] |
calculate chi2 probability (-ln(P))
Definition at line 768 of file GlobalTrajectoryBuilderBase.cc.
References Trajectory::chiSquared(), i, LnChiSquaredProbability(), max, and Trajectory::recHits().
Referenced by chooseTrajectory().
00768 { 00769 00770 int nDOF = 0; 00771 ConstRecHitContainer rechits = track.recHits(); 00772 for ( ConstRecHitContainer::const_iterator i = rechits.begin(); i != rechits.end(); ++i ) { 00773 if ((*i)->isValid()) nDOF += (*i)->dimension(); 00774 } 00775 00776 nDOF = max(nDOF - 5, 0); 00777 double prob = -LnChiSquaredProbability(track.chiSquared(), nDOF); 00778 00779 return prob; 00780 00781 }
MuonTrajectoryBuilder::TrajectoryContainer GlobalTrajectoryBuilderBase::trajectories | ( | const TrajectorySeed & | ) | [inline, virtual] |
dummy implementation, unused in this class
Implements MuonTrajectoryBuilder.
Definition at line 74 of file GlobalTrajectoryBuilderBase.h.
00074 { return MuonTrajectoryBuilder::TrajectoryContainer(); }
unsigned long long GlobalTrajectoryBuilderBase::theCacheId_TRH [private] |
Definition at line 192 of file GlobalTrajectoryBuilderBase.h.
Referenced by GlobalTrajectoryBuilderBase(), and setEvent().
std::string GlobalTrajectoryBuilderBase::theCategory [protected] |
Definition at line 179 of file GlobalTrajectoryBuilderBase.h.
Referenced by addTraj(), checkMuonHits(), chooseTrajectory(), getTransientRecHits(), GlobalTrajectoryBuilderBase(), printHits(), selectMuonHits(), and setEvent().
float GlobalTrajectoryBuilderBase::theCSCChi2Cut [private] |
Definition at line 199 of file GlobalTrajectoryBuilderBase.h.
Referenced by GlobalTrajectoryBuilderBase(), and selectMuonHits().
float GlobalTrajectoryBuilderBase::theDTChi2Cut [private] |
Definition at line 198 of file GlobalTrajectoryBuilderBase.h.
Referenced by GlobalTrajectoryBuilderBase(), and selectMuonHits().
const edm::Event* GlobalTrajectoryBuilderBase::theEvent [private] |
Reimplemented in FastL3MuonTrajectoryBuilder.
Definition at line 204 of file GlobalTrajectoryBuilderBase.h.
Referenced by setEvent().
Definition at line 197 of file GlobalTrajectoryBuilderBase.h.
Referenced by GlobalTrajectoryBuilderBase(), and selectMuonHits().
Definition at line 190 of file GlobalTrajectoryBuilderBase.h.
Referenced by glbTrajectory(), refitTrajectory(), and setEvent().
std::string GlobalTrajectoryBuilderBase::theKFFitterName [private] |
Definition at line 201 of file GlobalTrajectoryBuilderBase.h.
Referenced by GlobalTrajectoryBuilderBase(), and setEvent().
Definition at line 186 of file GlobalTrajectoryBuilderBase.h.
Referenced by checkMuonHits(), GlobalTrajectoryBuilderBase(), setEvent(), and ~GlobalTrajectoryBuilderBase().
Definition at line 195 of file GlobalTrajectoryBuilderBase.h.
Referenced by checkMuonHits(), and GlobalTrajectoryBuilderBase().
edm::ESHandle<TransientTrackingRecHitBuilder> GlobalTrajectoryBuilderBase::theMuonRecHitBuilder [private] |
Definition at line 210 of file GlobalTrajectoryBuilderBase.h.
Referenced by getTransientRecHits(), and setEvent().
std::string GlobalTrajectoryBuilderBase::theMuonRecHitBuilderName [private] |
Definition at line 209 of file GlobalTrajectoryBuilderBase.h.
Referenced by GlobalTrajectoryBuilderBase(), and setEvent().
float GlobalTrajectoryBuilderBase::theProbCut [private] |
Definition at line 196 of file GlobalTrajectoryBuilderBase.h.
Referenced by chooseTrajectory(), and GlobalTrajectoryBuilderBase().
float GlobalTrajectoryBuilderBase::thePtCut [protected] |
Definition at line 181 of file GlobalTrajectoryBuilderBase.h.
Referenced by GlobalTrajectoryBuilderBase(), L3MuonTrajectoryBuilder::trajectories(), FastL3MuonTrajectoryBuilder::trajectories(), and GlobalMuonTrajectoryBuilder::trajectories().
Definition at line 188 of file GlobalTrajectoryBuilderBase.h.
Referenced by defineRegionOfInterest(), GlobalTrajectoryBuilderBase(), setEvent(), and ~GlobalTrajectoryBuilderBase().
float GlobalTrajectoryBuilderBase::theRPCChi2Cut [private] |
Definition at line 200 of file GlobalTrajectoryBuilderBase.h.
Referenced by GlobalTrajectoryBuilderBase(), and selectMuonHits().
Definition at line 193 of file GlobalTrajectoryBuilderBase.h.
Referenced by getTransientRecHits(), and GlobalTrajectoryBuilderBase().
const MuonServiceProxy* GlobalTrajectoryBuilderBase::theService [private] |
Definition at line 189 of file GlobalTrajectoryBuilderBase.h.
Referenced by checkMuonHits(), GlobalTrajectoryBuilderBase(), service(), and setEvent().
Reimplemented in FastL3MuonTrajectoryBuilder, and GlobalMuonTrajectoryBuilder.
Definition at line 180 of file GlobalTrajectoryBuilderBase.h.
Referenced by addTraj(), and GlobalTrajectoryBuilderBase().
std::string GlobalTrajectoryBuilderBase::theTrackerPropagatorName [private] |
Definition at line 202 of file GlobalTrajectoryBuilderBase.h.
Referenced by GlobalTrajectoryBuilderBase().
edm::ESHandle<TransientTrackingRecHitBuilder> GlobalTrajectoryBuilderBase::theTrackerRecHitBuilder [private] |
Definition at line 207 of file GlobalTrajectoryBuilderBase.h.
Referenced by getTransientRecHits(), and setEvent().
std::string GlobalTrajectoryBuilderBase::theTrackerRecHitBuilderName [private] |
Definition at line 206 of file GlobalTrajectoryBuilderBase.h.
Referenced by GlobalTrajectoryBuilderBase(), and setEvent().
Definition at line 185 of file GlobalTrajectoryBuilderBase.h.
Referenced by GlobalTrajectoryBuilderBase(), trackMatcher(), and ~GlobalTrajectoryBuilderBase().
Definition at line 187 of file GlobalTrajectoryBuilderBase.h.
Referenced by addTraj(), GlobalTrajectoryBuilderBase(), setEvent(), and ~GlobalTrajectoryBuilderBase().