89 theTrackMatcher(0),theLayerMeasurements(0),theTrackTransformer(0),theRegionBuilder(0), theService(service),theGlbRefitter(0) {
185 if ( (muonRecHits.size() > 1) &&
186 ( muonRecHits.front()->globalPosition().mag() >
187 muonRecHits.back()->globalPosition().mag() ) ) {
191 for ( CandidateContainer::const_iterator it = tkTrajs.begin(); it != tkTrajs.end(); it++ ) {
194 LogTrace(
theCategory)<<
" Track p and pT " << (*it)->trackerTrack()->p() <<
" " << (*it)->trackerTrack()->pt();
195 if( (*it)->trackerTrack()->p() <
thePCut || (*it)->trackerTrack()->pt() <
thePtCut )
continue;
198 if ((*it)->trackerTrack().isNonnull()) {
206 if ( fabs((*it)->trackerTrack()->eta()) > 0.95 && fabs((*it)->trackerTrack()->eta()) < 1.15 && (*it)->trackerTrack()->pt() < 60 ) {
214 if ( recHitDir ==
outToIn ) reverse(trackerRecHits.begin(),trackerRecHits.end());
220 if((*it)->trackerTrack()->seedRef().isAvailable()) tmpSeed = (*it)->trackerTrack()->seedRef();
222 if ( !innerTsos.isValid() ) {
227 innerTsos.rescaleError(100.);
229 TC refitted0,refitted1;
234 if ( ! ((*it)->trackerTrajectory() && (*it)->trackerTrajectory()->isValid()) ) {
236 if (!refitted0.empty()) tkTrajectory =
new Trajectory(*(refitted0.begin()));
238 }
else tkTrajectory = (*it)->trackerTrajectory();
239 if (tkTrajectory) tkTrajectory->
setSeedRef(tmpSeed);
243 allRecHits.insert(allRecHits.end(), muonRecHits.begin(),muonRecHits.end());
245 LogTrace(
theCategory)<<
" This track-sta refitted to " << refitted1.size() <<
" trajectories";
248 if (!refitted1.empty()) glbTrajectory1 =
new Trajectory(*(refitted1.begin()));
250 if (glbTrajectory1) glbTrajectory1->
setSeedRef(tmpSeed);
253 if(glbTrajectory1 && tkTrajectory) finalTrajectory =
new MuonCandidate(glbTrajectory1, (*it)->muonTrack(), (*it)->trackerTrack(),
254 tkTrajectory?
new Trajectory(*tkTrajectory) : 0);
256 if ( finalTrajectory )
257 refittedResult.push_back(finalTrajectory);
259 if(tkTrajectory)
delete tkTrajectory;
265 if ( refittedResult.size() > 0 ) tmpCand = *(refittedResult.begin());
266 double minProb = 9999;
268 for (CandidateContainer::const_iterator iter=refittedResult.begin(); iter != refittedResult.end(); iter++) {
270 LogTrace(
theCategory)<<
" refitted-track-sta with pT " << (*iter)->trackerTrack()->pt() <<
" has probability " <<
prob;
272 if (prob < minProb) {
281 for (CandidateContainer::const_iterator it = refittedResult.begin(); it != refittedResult.end(); ++it) {
282 if ( (*it)->trajectory() )
delete (*it)->
trajectory();
283 if ( (*it)->trackerTrajectory() )
delete (*it)->trackerTrajectory();
284 if ( *it )
delete (*it);
286 refittedResult.clear();
288 return selectedResult;
296 vector<GlobalTrajectoryBuilderBase::TrackCand>
298 const vector<TrackCand>& tkTs) {
309 double deltaR_max = 1.0;
311 for ( vector<TrackCand>::const_iterator is = tkTs.begin(); is != tkTs.end(); ++is ) {
316 double deltaR_tmp =
deltaR(static_cast<double>(regionOfInterest.direction().eta()),
317 static_cast<double>(regionOfInterest.direction().phi()),
318 is->second->eta(), is->second->phi());
322 if (deltaR_tmp < deltaR_max) {
324 result.push_back(tmpCand);
342 fabs(region1->etaRange().max() - region1->etaRange().mean()));
347 region1->originRBound(),
348 region1->originZBound(),
350 region1->phiMargin());
379 for (ConstRecHitContainer::const_iterator ir = hits.begin(); ir != hits.end(); ir++ ) {
380 if ( !(*ir)->isValid() ) {
388 <<
"r = " <<
sqrt(pos.
x() * pos.
x() + pos.
y() * pos.
y())
389 <<
" z = " << pos.
z()
390 <<
" dimension = " << (*ir)->dimension()
391 <<
" " << (*ir)->det()->geographicalId().det()
392 <<
" " << (*ir)->det()->subDetector();
404 if ( !recHits.empty() ) {
405 ConstRecHitContainer::const_iterator frontHit = recHits.begin();
406 ConstRecHitContainer::const_iterator backHit = recHits.end() - 1;
407 while ( !(*frontHit)->isValid() && frontHit != backHit ) {frontHit++;}
408 while ( !(*backHit)->isValid() && backHit != frontHit ) {backHit--;}
410 double rFirst = (*frontHit)->globalPosition().mag();
411 double rLast = (*backHit) ->globalPosition().mag();
413 if ( rFirst < rLast )
return inToOut;
414 else if (rFirst > rLast)
return outToIn;
436 for (ConstRecHitContainer::const_iterator
i = all.begin();
i != all.end();
i++) {
437 if ( !(*i)->isValid() )
continue;
442 hits.push_back((*i).get());
444 if ( nTEC > 1 )
return all;
457 double scl_y)
const {
460 ConstRecHitContainer::iterator lone_tec;
462 for ( ConstRecHitContainer::iterator
i = all.begin();
i != all.end();
i++) {
463 if ( !(*i)->isValid() )
continue;
470 if ( (
i+1) != all.end() && (*(
i+1))->isValid() &&
481 int hitDet = (*lone_tec)->hit()->geographicalId().det();
482 int hitSubDet = (*lone_tec)->hit()->geographicalId().subdetId();
483 if ( nTEC == 1 && (*lone_tec)->hit()->isValid() &&
487 const SiStripRecHit2D* strip =
dynamic_cast<const SiStripRecHit2D*
>((*lone_tec)->hit());
488 const TSiStripRecHit2DLocalPos* Tstrip =
dynamic_cast<const TSiStripRecHit2DLocalPos*
>((*lone_tec).get());
489 if (strip && Tstrip->det() && Tstrip) {
491 if ((*lone_tec)->detUnit()) {
498 LocalError scaledError(rotError.
xx() * scl_x * scl_x, 0, rotError.
yy() * scl_y * scl_y);
499 error = scaledError.
rotate(-angle);
501 if (strip->cluster().isNonnull()) {
505 SiStripRecHit2D* st =
new SiStripRecHit2D(pos,error,
506 (*lone_tec)->geographicalId().rawId(),
508 *lone_tec = mtt_rechit->
build((*lone_tec)->det(),st);
511 SiStripRecHit2D* st =
new SiStripRecHit2D(pos,error,
512 (*lone_tec)->geographicalId().rawId(),
513 strip->cluster_regional());
514 *lone_tec = mtt_rechit->
build((*lone_tec)->det(),st);
537 if((*hit)->isValid()) {
538 DetId recoid = (*hit)->geographicalId();
541 if (!ttrhit->hit()->hasPositionAndError()){
546 <<
"Could not get a tsos on the hit surface. We will miss a tracking hit.";
551 result.push_back(preciseHit);
553 result.push_back(ttrhit);
556 if ( (*hit)->geographicalId().subdetId() == 3 && !
theRPCInTheFit) {
const reco::TrackRef muonTrack() const
return muon track
RectangularEtaPhiTrackingRegion * region(const reco::TrackRef &) const
define tracking region
std::vector< Trajectory > TC
T getParameter(std::string const &) const
MuonCandidate::CandidateContainer CandidateContainer
void printHits(const ConstRecHitContainer &) const
print all RecHits of a trajectory
T getUntrackedParameter(std::string const &, T const &) const
ConstRecHitContainer selectTrackerHits(const ConstRecHitContainer &) const
select tracker hits; exclude some tracker hits in the global trajectory
virtual void setEvent(const edm::Event &)
pass the Event to the algo at each event
GlobalMuonRefitter * theGlbRefitter
std::pair< const Trajectory *, reco::TrackRef > TrackCand
virtual float stripAngle(float strip) const =0
GlobalTrajectoryBuilderBase(const edm::ParameterSet &, const MuonServiceProxy *)
constructor with Parameter Set and MuonServiceProxy
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
float LnChiSquaredProbability(double chiSquared, double nrDOF)
virtual void setEvent(const edm::Event &)
pass the Event to the algo at each event
const TrackerTopology * tTopo_
void setServices(const edm::EventSetup &)
set the services needed by the TrackTransformer
std::vector< TrackCand > chooseRegionalTrackerTracks(const TrackCand &, const std::vector< TrackCand > &)
choose tracker tracks within region of interest
virtual float strip(const LocalPoint &) const =0
const reco::TrackRef trackerTrack() const
return tracker track
std::string theTrackerPropagatorName
void fixTEC(ConstRecHitContainer &all, double scl_x, double scl_y) const
rescale errors of outermost TEC RecHit
double trackProbability(const Trajectory &) const
calculate chi2 probability (-ln(P))
TrackTransformer * theTrackTransformer
virtual ~GlobalTrajectoryBuilderBase()
destructor
Trajectory * trackerTrajectory() const
return tracker trajectory
std::string theMuonRecHitBuilderName
TransientTrackingRecHit::ConstRecHitContainer getTransientRecHits(const reco::Track &) const
get transient RecHits of a Track
const MuonServiceProxy * theService
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
std::vector< MuonCandidate * > CandidateContainer
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::string theTrackerRecHitBuilderName
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
double deltaR(double eta1, double eta2, double phi1, double phi2)
std::vector< ConstRecHitPointer > ConstRecHitContainer
virtual void setEvent(const edm::Event &)
pass the Event to the algo at each event
int ndof(bool bon=true) const
GlobalMuonTrackMatcher * theTrackMatcher
T const * product() const
MuonTrajectoryBuilder::CandidateContainer build(const TrackCand &, MuonTrajectoryBuilder::CandidateContainer &) const
build combined trajectory from sta Track and tracker RecHits
void setSeedRef(const edm::RefToBase< TrajectorySeed > &seedRef)
RectangularEtaPhiTrackingRegion defineRegionOfInterest(const reco::TrackRef &) const
define region of interest with tracker
tuple GlobalMuonTrackMatcher
RefitDirection checkRecHitsOrdering(const ConstRecHitContainer &) const
This does nothing now.
const edm::Event * theEvent
unsigned long long theCacheId_TRH
MuonTrackingRegionBuilder * theRegionBuilder
Trajectory * trajectory() const
return trajectory
LocalError rotate(float x, float y) const
Return a new LocalError, rotated by an angle defined by the direction (x,y)
Detector det() const
get the detector field from this detid
static RecHitPointer build(const GeomDet *geom, const TrackingRecHit *rh)
FIXME virtual ConstMuonRecHitContainer specificTransientHits() const;.
std::vector< Trajectory > refit(const reco::Track &globalTrack, const int theMuonHitsOption, const TrackerTopology *tTopo) const
build combined trajectory from sta Track and tracker RecHits
edm::ESHandle< TransientTrackingRecHitBuilder > theTrackerRecHitBuilder
double chiSquared() const
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.