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);
350 std::abs(region1->etaRange().max() - region1->etaRange().mean()));
355 region1->originRBound(),
356 region1->originZBound(),
358 region1->phiMargin());
386 for (
auto&& ir: hits){
387 if ( !ir->isValid() ) {
395 <<
"r = " <<
sqrt(pos.
x() * pos.
x() + pos.
y() * pos.
y())
396 <<
" z = " << pos.
z()
397 <<
" dimension = " << ir->dimension()
398 <<
" " << ir->det()->geographicalId().det()
399 <<
" " << ir->det()->subDetector();
411 if ( !recHits.empty() ) {
412 ConstRecHitContainer::const_iterator frontHit = recHits.begin();
413 ConstRecHitContainer::const_iterator backHit = recHits.end() - 1;
414 while ( !(*frontHit)->isValid() && frontHit != backHit ) {frontHit++;}
415 while ( !(*backHit)->isValid() && backHit != frontHit ) {backHit--;}
417 double rFirst = (*frontHit)->globalPosition().mag();
418 double rLast = (*backHit) ->globalPosition().mag();
420 if ( rFirst < rLast )
return inToOut;
421 else if (rFirst > rLast)
return outToIn;
444 if ( !
i->isValid() )
continue;
451 if ( nTEC > 1 )
return all;
464 double scl_y)
const {
467 ConstRecHitContainer::iterator lone_tec;
469 for ( ConstRecHitContainer::iterator
i = all.begin();
i != all.end();
i++) {
470 if ( !(*i)->isValid() )
continue;
477 if ( (
i+1) != all.end() && (*(
i+1))->isValid() &&
488 int hitDet = (*lone_tec)->hit()->geographicalId().det();
489 int hitSubDet = (*lone_tec)->hit()->geographicalId().subdetId();
490 if ( nTEC == 1 && (*lone_tec)->hit()->isValid() &&
495 if (strip && strip->
det() ) {
497 if ((*lone_tec)->detUnit()) {
504 LocalError scaledError(rotError.
xx() * scl_x * scl_x, 0, rotError.
yy() * scl_y * scl_y);
505 error = scaledError.
rotate(-angle);
537 auto hitCloner = tkbuilder->
cloner();
539 if((*hit)->isValid()) {
540 DetId recoid = (*hit)->geographicalId();
542 if (!(*hit)->hasPositionAndError()){
547 <<
"Could not get a tsos on the hit surface. We will miss a tracking hit.";
551 auto h = (**hit).cloneForFit(*tkbuilder->geometry()->idToDet( (**hit).geographicalId() ) );
552 result.emplace_back(hitCloner.makeShared(
h,predTsos));
554 result.push_back((*hit)->cloneSH());
557 if ( (*hit)->geographicalId().subdetId() == 3 && !
theRPCInTheFit) {
const reco::TrackRef muonTrack() const
return muon track
const TrackerTopology * theTopo
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
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
std::pair< const Trajectory *, reco::TrackRef > TrackCand
virtual float stripAngle(float strip) const =0
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
CaloTopology const * topology(0)
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
TkClonerImpl cloner() const
float LnChiSquaredProbability(double chiSquared, double nrDOF)
virtual void setEvent(const edm::Event &)
Pass the Event to the algo at each event.
Geom::Phi< T > phi() const
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
std::unique_ptr< RectangularEtaPhiTrackingRegion > region(const reco::TrackRef &) const
Define tracking region.
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
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)
tuple MuonTrackingRegionBuilder
ClusterRef cluster() const
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
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
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
virtual LocalError localPositionError() const final
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
virtual LocalPoint localPosition() const final
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.