92 theTrackMatcher(0),theLayerMeasurements(0),theTrackTransformer(0),theRegionBuilder(0), theService(service),theGlbRefitter(0) {
183 if ( (muonRecHits.size() > 1) &&
184 ( muonRecHits.front()->globalPosition().mag() >
185 muonRecHits.back()->globalPosition().mag() ) ) {
189 for ( CandidateContainer::const_iterator it = tkTrajs.begin(); it != tkTrajs.end(); it++ ) {
192 LogTrace(
theCategory)<<
" Track p and pT " << (*it)->trackerTrack()->p() <<
" " << (*it)->trackerTrack()->pt();
193 if( (*it)->trackerTrack()->p() <
thePCut || (*it)->trackerTrack()->pt() <
thePtCut )
continue;
196 if ((*it)->trackerTrack().isNonnull()) {
204 if ( fabs((*it)->trackerTrack()->eta()) > 0.95 && fabs((*it)->trackerTrack()->eta()) < 1.15 && (*it)->trackerTrack()->pt() < 60 ) {
212 if ( recHitDir ==
outToIn ) reverse(trackerRecHits.begin(),trackerRecHits.end());
218 if((*it)->trackerTrack()->seedRef().isAvailable()) tmpSeed = (*it)->trackerTrack()->seedRef();
220 if ( !innerTsos.isValid() ) {
225 innerTsos.rescaleError(100.);
227 TC refitted0,refitted1;
232 if ( ! ((*it)->trackerTrajectory() && (*it)->trackerTrajectory()->isValid()) ) {
234 if (!refitted0.empty()) tkTrajectory =
new Trajectory(*(refitted0.begin()));
236 }
else tkTrajectory = (*it)->trackerTrajectory();
237 if (tkTrajectory) tkTrajectory->
setSeedRef(tmpSeed);
241 allRecHits.insert(allRecHits.end(), muonRecHits.begin(),muonRecHits.end());
243 LogTrace(
theCategory)<<
" This track-sta refitted to " << refitted1.size() <<
" trajectories";
246 if (!refitted1.empty()) glbTrajectory1 =
new Trajectory(*(refitted1.begin()));
248 if (glbTrajectory1) glbTrajectory1->
setSeedRef(tmpSeed);
251 if(glbTrajectory1 && tkTrajectory) finalTrajectory =
new MuonCandidate(glbTrajectory1, (*it)->muonTrack(), (*it)->trackerTrack(),
252 tkTrajectory?
new Trajectory(*tkTrajectory) : 0);
254 if ( finalTrajectory )
255 refittedResult.push_back(finalTrajectory);
257 if(tkTrajectory)
delete tkTrajectory;
263 if ( refittedResult.size() > 0 ) tmpCand = *(refittedResult.begin());
264 double minProb = 9999;
266 for (CandidateContainer::const_iterator iter=refittedResult.begin(); iter != refittedResult.end(); iter++) {
268 LogTrace(
theCategory)<<
" refitted-track-sta with pT " << (*iter)->trackerTrack()->pt() <<
" has probability " << prob;
270 if (prob < minProb) {
279 for (CandidateContainer::const_iterator it = refittedResult.begin(); it != refittedResult.end(); ++it) {
280 if ( (*it)->trajectory() )
delete (*it)->
trajectory();
281 if ( (*it)->trackerTrajectory() )
delete (*it)->trackerTrajectory();
282 if ( *it )
delete (*it);
284 refittedResult.clear();
286 return selectedResult;
294 vector<GlobalTrajectoryBuilderBase::TrackCand>
296 const vector<TrackCand>& tkTs) {
307 double deltaR_max = 1.0;
309 for ( vector<TrackCand>::const_iterator is = tkTs.begin(); is != tkTs.end(); ++is ) {
315 static_cast<double>(regionOfInterest.
direction().
phi()),
316 is->second->eta(), is->second->phi());
320 if (deltaR_tmp < deltaR_max) {
322 result.push_back(tmpCand);
377 for (ConstRecHitContainer::const_iterator ir = hits.begin(); ir != hits.end(); ir++ ) {
378 if ( !(*ir)->isValid() ) {
386 <<
"r = " <<
sqrt(pos.
x() * pos.
x() + pos.
y() * pos.
y())
387 <<
" z = " << pos.
z()
388 <<
" dimension = " << (*ir)->dimension()
389 <<
" " << (*ir)->det()->geographicalId().det()
390 <<
" " << (*ir)->det()->subDetector();
402 if ( !recHits.empty() ) {
403 ConstRecHitContainer::const_iterator frontHit = recHits.begin();
404 ConstRecHitContainer::const_iterator backHit = recHits.end() - 1;
405 while ( !(*frontHit)->isValid() && frontHit != backHit ) {frontHit++;}
406 while ( !(*backHit)->isValid() && backHit != frontHit ) {backHit--;}
408 double rFirst = (*frontHit)->globalPosition().mag();
409 double rLast = (*backHit) ->globalPosition().mag();
411 if ( rFirst < rLast )
return inToOut;
412 else if (rFirst > rLast)
return outToIn;
434 for (ConstRecHitContainer::const_iterator
i = all.begin();
i != all.end();
i++) {
435 if ( !(*i)->isValid() )
continue;
440 hits.push_back((*i).get());
442 if ( nTEC > 1 )
return all;
455 double scl_y)
const {
458 ConstRecHitContainer::iterator lone_tec;
460 for ( ConstRecHitContainer::iterator
i = all.begin();
i != all.end();
i++) {
461 if ( !(*i)->isValid() )
continue;
468 if ( (
i+1) != all.end() && (*(
i+1))->isValid() &&
479 int hitDet = (*lone_tec)->hit()->geographicalId().det();
480 int hitSubDet = (*lone_tec)->hit()->geographicalId().subdetId();
481 if ( nTEC == 1 && (*lone_tec)->hit()->isValid() &&
485 const SiStripRecHit2D*
strip =
dynamic_cast<const SiStripRecHit2D*
>((*lone_tec)->hit());
486 const TSiStripRecHit2DLocalPos* Tstrip =
dynamic_cast<const TSiStripRecHit2DLocalPos*
>((*lone_tec).get());
487 if (strip && Tstrip->det() && Tstrip) {
489 if ((*lone_tec)->detUnit()) {
496 LocalError scaledError(rotError.
xx() * scl_x * scl_x, 0, rotError.
yy() * scl_y * scl_y);
497 error = scaledError.
rotate(-angle);
499 if (strip->cluster().isNonnull()) {
503 SiStripRecHit2D* st =
new SiStripRecHit2D(pos,error,
504 (*lone_tec)->geographicalId().rawId(),
506 *lone_tec = mtt_rechit->
build((*lone_tec)->det(),st);
509 SiStripRecHit2D* st =
new SiStripRecHit2D(pos,error,
510 (*lone_tec)->geographicalId().rawId(),
511 strip->cluster_regional());
512 *lone_tec = mtt_rechit->
build((*lone_tec)->det(),st);
535 if((*hit)->isValid()) {
536 DetId recoid = (*hit)->geographicalId();
539 if (!ttrhit->hit()->hasPositionAndError()){
544 <<
"Could not get a tsos on the hit surface. We will miss a tracking hit.";
549 result.push_back(preciseHit);
551 result.push_back(ttrhit);
554 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)
const Margin & phiMargin() const
virtual void setEvent(const edm::Event &)
pass the Event to the algo at each event
Geom::Phi< T > phi() const
virtual GlobalPoint origin() const
virtual GlobalVector direction() const
the direction around which region is constructed
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
virtual float ptMin() const
minimal pt of interest
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
MuonTrajectoryBuilder::CandidateContainer build(const TrackCand &, MuonTrajectoryBuilder::CandidateContainer &) const
build combined trajectory from sta Track and tracker RecHits
std::vector< Trajectory > refit(const reco::Track &globalTrack, const int theMuonHitsOption) 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
virtual float originZBound() const
bounds the particle vertex in the longitudinal plane
static RecHitPointer build(const GeomDet *geom, const TrackingRecHit *rh)
FIXME virtual ConstMuonRecHitContainer specificTransientHits() const;.
edm::ESHandle< TransientTrackingRecHitBuilder > theTrackerRecHitBuilder
double chiSquared() const
virtual float originRBound() const
bounds the particle vertex in the transverse plane
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.
const Range & etaRange() const
allowed eta range [eta_min, eta_max] interval