93 theTrackMatcher(0),theLayerMeasurements(0),theTrackTransformer(0),theRegionBuilder(0), theService(service),theGlbRefitter(0) {
189 if ( (muonRecHits.size() > 1) &&
190 ( muonRecHits.front()->globalPosition().mag() >
191 muonRecHits.back()->globalPosition().mag() ) ) {
195 for ( CandidateContainer::const_iterator it = tkTrajs.begin(); it != tkTrajs.end(); it++ ) {
198 LogTrace(
theCategory)<<
" Track p and pT " << (*it)->trackerTrack()->p() <<
" " << (*it)->trackerTrack()->pt();
199 if( (*it)->trackerTrack()->p() <
thePCut || (*it)->trackerTrack()->pt() <
thePtCut )
continue;
202 if ((*it)->trackerTrack().isNonnull()) {
210 if ( fabs((*it)->trackerTrack()->eta()) > 0.95 && fabs((*it)->trackerTrack()->eta()) < 1.15 && (*it)->trackerTrack()->pt() < 60 ) {
218 if ( recHitDir ==
outToIn ) reverse(trackerRecHits.begin(),trackerRecHits.end());
224 if((*it)->trackerTrack()->seedRef().isAvailable()) tmpSeed = (*it)->trackerTrack()->seedRef();
226 if ( !innerTsos.isValid() ) {
231 innerTsos.rescaleError(100.);
233 TC refitted0,refitted1;
238 if ( ! ((*it)->trackerTrajectory() && (*it)->trackerTrajectory()->isValid()) ) {
240 if (!refitted0.empty()) tkTrajectory =
new Trajectory(*(refitted0.begin()));
242 }
else tkTrajectory = (*it)->trackerTrajectory();
243 if (tkTrajectory) tkTrajectory->
setSeedRef(tmpSeed);
247 allRecHits.insert(allRecHits.end(), muonRecHits.begin(),muonRecHits.end());
249 LogTrace(
theCategory)<<
" This track-sta refitted to " << refitted1.size() <<
" trajectories";
252 if (!refitted1.empty()) glbTrajectory1 =
new Trajectory(*(refitted1.begin()));
254 if (glbTrajectory1) glbTrajectory1->
setSeedRef(tmpSeed);
257 if(glbTrajectory1 && tkTrajectory) finalTrajectory =
new MuonCandidate(glbTrajectory1, (*it)->muonTrack(), (*it)->trackerTrack(),
258 tkTrajectory?
new Trajectory(*tkTrajectory) : 0);
260 if ( finalTrajectory )
261 refittedResult.push_back(finalTrajectory);
263 if(tkTrajectory)
delete tkTrajectory;
269 if ( refittedResult.size() > 0 ) tmpCand = *(refittedResult.begin());
270 double minProb = 9999;
272 for (CandidateContainer::const_iterator iter=refittedResult.begin(); iter != refittedResult.end(); iter++) {
274 LogTrace(
theCategory)<<
" refitted-track-sta with pT " << (*iter)->trackerTrack()->pt() <<
" has probability " <<
prob;
276 if (prob < minProb) {
285 for (CandidateContainer::const_iterator it = refittedResult.begin(); it != refittedResult.end(); ++it) {
286 if ( (*it)->trajectory() )
delete (*it)->
trajectory();
287 if ( (*it)->trackerTrajectory() )
delete (*it)->trackerTrajectory();
288 if ( *it )
delete (*it);
290 refittedResult.clear();
292 return selectedResult;
300 vector<GlobalTrajectoryBuilderBase::TrackCand>
302 const vector<TrackCand>& tkTs) {
313 double deltaR_max = 1.0;
315 for ( vector<TrackCand>::const_iterator is = tkTs.begin(); is != tkTs.end(); ++is ) {
320 double deltaR_tmp =
deltaR(static_cast<double>(regionOfInterest.direction().eta()),
321 static_cast<double>(regionOfInterest.direction().phi()),
322 is->second->eta(), is->second->phi());
326 if (deltaR_tmp < deltaR_max) {
328 result.push_back(tmpCand);
346 fabs(region1->etaRange().max() - region1->etaRange().mean()));
351 region1->originRBound(),
352 region1->originZBound(),
354 region1->phiMargin());
383 for (ConstRecHitContainer::const_iterator ir = hits.begin(); ir != hits.end(); ir++ ) {
384 if ( !(*ir)->isValid() ) {
392 <<
"r = " <<
sqrt(pos.
x() * pos.
x() + pos.
y() * pos.
y())
393 <<
" z = " << pos.
z()
394 <<
" dimension = " << (*ir)->dimension()
395 <<
" " << (*ir)->det()->geographicalId().det()
396 <<
" " << (*ir)->det()->subDetector();
408 if ( !recHits.empty() ) {
409 ConstRecHitContainer::const_iterator frontHit = recHits.begin();
410 ConstRecHitContainer::const_iterator backHit = recHits.end() - 1;
411 while ( !(*frontHit)->isValid() && frontHit != backHit ) {frontHit++;}
412 while ( !(*backHit)->isValid() && backHit != frontHit ) {backHit--;}
414 double rFirst = (*frontHit)->globalPosition().mag();
415 double rLast = (*backHit) ->globalPosition().mag();
417 if ( rFirst < rLast )
return inToOut;
418 else if (rFirst > rLast)
return outToIn;
440 for (ConstRecHitContainer::const_iterator
i = all.begin();
i != all.end();
i++) {
441 if ( !(*i)->isValid() )
continue;
446 hits.push_back((*i).get());
448 if ( nTEC > 1 )
return all;
461 double scl_y)
const {
464 ConstRecHitContainer::iterator lone_tec;
466 for ( ConstRecHitContainer::iterator
i = all.begin();
i != all.end();
i++) {
467 if ( !(*i)->isValid() )
continue;
474 if ( (
i+1) != all.end() && (*(
i+1))->isValid() &&
485 int hitDet = (*lone_tec)->hit()->geographicalId().det();
486 int hitSubDet = (*lone_tec)->hit()->geographicalId().subdetId();
487 if ( nTEC == 1 && (*lone_tec)->hit()->isValid() &&
491 const SiStripRecHit2D* strip =
dynamic_cast<const SiStripRecHit2D*
>((*lone_tec)->hit());
492 const TSiStripRecHit2DLocalPos* Tstrip =
dynamic_cast<const TSiStripRecHit2DLocalPos*
>((*lone_tec).get());
493 if (strip && Tstrip->det() && Tstrip) {
495 if ((*lone_tec)->detUnit()) {
502 LocalError scaledError(rotError.
xx() * scl_x * scl_x, 0, rotError.
yy() * scl_y * scl_y);
503 error = scaledError.
rotate(-angle);
505 if (strip->cluster().isNonnull()) {
509 SiStripRecHit2D* st =
new SiStripRecHit2D(pos,error,
510 (*lone_tec)->geographicalId().rawId(),
512 *lone_tec = mtt_rechit->
build((*lone_tec)->det(),st);
515 SiStripRecHit2D* st =
new SiStripRecHit2D(pos,error,
516 (*lone_tec)->geographicalId().rawId(),
517 strip->cluster_regional());
518 *lone_tec = mtt_rechit->
build((*lone_tec)->det(),st);
541 if((*hit)->isValid()) {
542 DetId recoid = (*hit)->geographicalId();
545 if (!ttrhit->hit()->hasPositionAndError()){
550 <<
"Could not get a tsos on the hit surface. We will miss a tracking hit.";
555 result.push_back(preciseHit);
557 result.push_back(ttrhit);
560 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.