79 theLayerMeasurements(0),theTrackTransformer(0),theRegionBuilder(0), theService(service),theGlbRefitter(0) {
176 if ( (muonRecHits.size() > 1) &&
177 ( muonRecHits.front()->globalPosition().mag() >
178 muonRecHits.back()->globalPosition().mag() ) ) {
182 for (
auto&& it: tkTrajs){
184 LogTrace(
theCategory)<<
" Track p and pT " << it->trackerTrack()->p() <<
" " << it->trackerTrack()->pt();
185 if( it->trackerTrack()->p() <
thePCut || it->trackerTrack()->pt() <
thePtCut )
continue;
190 if (it->trackerTrack().isNonnull()) {
198 if (
std::abs(it->trackerTrack()->eta()) > 0.95 &&
std::abs(it->trackerTrack()->eta()) < 1.15 && it->trackerTrack()->pt() < 60 ) {
206 if ( recHitDir ==
outToIn ) reverse(trackerRecHits.begin(),trackerRecHits.end());
212 if(it->trackerTrack()->seedRef().isAvailable()) tmpSeed = it->trackerTrack()->seedRef();
214 if ( !innerTsos.isValid() ) {
219 innerTsos.rescaleError(100.);
221 TC refitted0,refitted1;
226 if ( ! (it->trackerTrajectory() && it->trackerTrajectory()->isValid()) ) {
228 if (!refitted0.empty()) tkTrajectory =
new Trajectory(*(refitted0.begin()));
230 }
else tkTrajectory = it->trackerTrajectory();
231 if (tkTrajectory) tkTrajectory->
setSeedRef(tmpSeed);
235 allRecHits.insert(allRecHits.end(), muonRecHits.begin(),muonRecHits.end());
237 LogTrace(
theCategory)<<
" This track-sta refitted to " << refitted1.size() <<
" trajectories";
240 if (!refitted1.empty()) glbTrajectory1 =
new Trajectory(*(refitted1.begin()));
242 if (glbTrajectory1) glbTrajectory1->
setSeedRef(tmpSeed);
245 if(glbTrajectory1 && tkTrajectory) finalTrajectory =
new MuonCandidate(glbTrajectory1, it->muonTrack(), it->trackerTrack(),
246 tkTrajectory?
new Trajectory(*tkTrajectory) : 0);
248 if ( finalTrajectory ) refittedResult.push_back(finalTrajectory);
249 if(tkTrajectory)
delete tkTrajectory;
254 if(it->trackerTrack()->seedRef().isAvailable()) tmpSeed = it->trackerTrack()->seedRef();
258 if ( ! (it->trackerTrajectory() && it->trackerTrajectory()->isValid()) ) {
260 if (!refitted0.empty()){
261 tkTrajectory =
new Trajectory(*(refitted0.begin()));
265 else tkTrajectory = it->trackerTrajectory();
266 if (tkTrajectory) tkTrajectory->
setSeedRef(tmpSeed);
269 if (finalTrajectory) refittedResult.push_back(finalTrajectory);
270 if(tkTrajectory)
delete tkTrajectory;
277 if ( refittedResult.size() > 0 ) tmpCand = *(refittedResult.begin());
280 for (
auto&& iter: refittedResult){
282 LogTrace(
theCategory)<<
" refitted-track-sta with pT " << iter->trackerTrack()->pt() <<
" has probability " << prob;
284 if (prob < minProb) {
293 for (
auto&& it: refittedResult){
294 if ( it->trajectory() )
delete it->
trajectory();
295 if ( it->trackerTrajectory() )
delete it->trackerTrajectory();
298 refittedResult.clear();
300 return selectedResult;
308 std::vector<GlobalTrajectoryBuilderBase::TrackCand>
310 const std::vector<TrackCand>& tkTs) {
319 std::vector<TrackCand>
result;
321 double deltaR_max = 1.0;
323 for (
auto&& is: tkTs){
325 static_cast<double>(regionOfInterest.
direction().
phi()),
326 is.second->eta(), is.second->phi());
330 if (deltaR_tmp < deltaR_max) {
332 result.push_back(tmpCand);
387 for (
auto&& ir: hits){
388 if ( !ir->isValid() ) {
396 <<
"r = " <<
sqrt(pos.
x() * pos.
x() + pos.
y() * pos.
y())
397 <<
" z = " << pos.
z()
398 <<
" dimension = " << ir->dimension()
399 <<
" " << ir->det()->geographicalId().det()
400 <<
" " << ir->det()->subDetector();
412 if ( !recHits.empty() ) {
413 ConstRecHitContainer::const_iterator frontHit = recHits.begin();
414 ConstRecHitContainer::const_iterator backHit = recHits.end() - 1;
415 while ( !(*frontHit)->isValid() && frontHit != backHit ) {frontHit++;}
416 while ( !(*backHit)->isValid() && backHit != frontHit ) {backHit--;}
418 double rFirst = (*frontHit)->globalPosition().mag();
419 double rLast = (*backHit) ->globalPosition().mag();
421 if ( rFirst < rLast )
return inToOut;
422 else if (rFirst > rLast)
return outToIn;
445 if ( !
i->isValid() )
continue;
452 if ( nTEC > 1 )
return all;
465 double scl_y)
const {
468 ConstRecHitContainer::iterator lone_tec;
470 for ( ConstRecHitContainer::iterator
i = all.begin();
i != all.end();
i++) {
471 if ( !(*i)->isValid() )
continue;
478 if ( (
i+1) != all.end() && (*(
i+1))->isValid() &&
489 int hitDet = (*lone_tec)->hit()->geographicalId().det();
490 int hitSubDet = (*lone_tec)->hit()->geographicalId().subdetId();
491 if ( nTEC == 1 && (*lone_tec)->hit()->isValid() &&
496 if (strip && strip->
det() ) {
498 if ((*lone_tec)->detUnit()) {
505 LocalError scaledError(rotError.
xx() * scl_x * scl_x, 0, rotError.
yy() * scl_y * scl_y);
506 error = scaledError.
rotate(-angle);
538 auto hitCloner = tkbuilder->
cloner();
540 if((*hit)->isValid()) {
541 DetId recoid = (*hit)->geographicalId();
543 if (!(*hit)->hasPositionAndError()){
548 <<
"Could not get a tsos on the hit surface. We will miss a tracking hit.";
552 auto h = (**hit).cloneForFit(*tkbuilder->geometry()->idToDet( (**hit).geographicalId() ) );
553 result.emplace_back(hitCloner.makeShared(
h,predTsos));
555 result.push_back((*hit)->cloneSH());
558 if ( (*hit)->geographicalId().subdetId() == 3 && !
theRPCInTheFit) {
const reco::TrackRef muonTrack() const
return muon track
const TrackerTopology * theTopo
RectangularEtaPhiTrackingRegion * region(const reco::TrackRef &) const
Define tracking region.
std::vector< Trajectory > TC
float originRBound() const
bounds the particle vertex in the transverse plane
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
const edm::EventSetup & eventSetup() const
get the whole EventSetup
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
GlobalPoint const & origin() const
std::pair< const Trajectory *, reco::TrackRef > TrackCand
virtual float stripAngle(float strip) const =0
CaloTopology const * topology(0)
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
TkClonerImpl cloner() const
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
tuple MuonTrackingRegionBuilder
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
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
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
GlobalVector const & direction() const
the direction around which region is constructed
double trackProbability(const Trajectory &) const
calculate chi2 probability (-ln(P))
TrackTransformer * theTrackTransformer
virtual LocalError localPositionError() const
const GeomDet * det() const
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
Abs< T >::type abs(const T &t)
ClusterRef cluster() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
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
float originZBound() const
bounds the particle vertex in the longitudinal plane
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
std::vector< ConstRecHitPointer > ConstRecHitContainer
GlobalTrajectoryBuilderBase(const edm::ParameterSet &, const MuonServiceProxy *, edm::ConsumesCollector &)
constructor with Parameter Set and MuonServiceProxy
double deltaR(double eta1, double eta2, double phi1, double phi2)
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
float ptMin() const
minimal pt of interest
void setSeedRef(const edm::RefToBase< TrajectorySeed > &seedRef)
RectangularEtaPhiTrackingRegion defineRegionOfInterest(const reco::TrackRef &) const
define region of interest with tracker
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
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 LocalPoint localPosition() const
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< Propagator > propagator(std::string propagatorName) const
get the propagator
edm::ESHandle< TransientTrackingRecHitBuilder > theTrackerRecHitBuilder
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
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