Definition at line 46 of file OutsideInMuonSeeder.cc.
OutsideInMuonSeeder::OutsideInMuonSeeder | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 99 of file OutsideInMuonSeeder.cc.
References measurementTrackerName_, and updatorName_.
: src_(iConfig.getParameter<edm::InputTag>("src")), selector_(iConfig.existsAs<std::string>("cut") ? iConfig.getParameter<std::string>("cut") : "", true), layersToTry_(iConfig.getParameter<int32_t>("layersToTry")), hitsToTry_(iConfig.getParameter<int32_t>("hitsToTry")), fromVertex_(iConfig.getParameter<bool>("fromVertex")), errorRescaling_(iConfig.getParameter<double>("errorRescaleFactor")), trackerPropagatorName_(iConfig.getParameter<std::string>("trackerPropagator")), muonPropagatorName_(iConfig.getParameter<std::string>("muonPropagator")), estimatorName_(iConfig.getParameter<std::string>("hitCollector")), minEtaForTEC_(iConfig.getParameter<double>("minEtaForTEC")), maxEtaForTOB_(iConfig.getParameter<double>("maxEtaForTOB")), debug_(iConfig.getUntrackedParameter<bool>("debug",false)), dummyPlane_(Plane::build(Plane::PositionType(), Plane::RotationType())) { produces<std::vector<TrajectorySeed> >(); measurementTrackerName_ = ""; updatorName_ = "KFUpdator"; }
virtual OutsideInMuonSeeder::~OutsideInMuonSeeder | ( | ) | [inline, virtual] |
Definition at line 49 of file OutsideInMuonSeeder.cc.
{ }
void OutsideInMuonSeeder::doDebug | ( | const reco::Track & | tk | ) | const [private] |
Definition at line 243 of file OutsideInMuonSeeder.cc.
References alongMomentum, gather_cfg::cout, TrackingRecHit::geographicalId(), geometry_, TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), i, trajectoryStateTransform::innerStateOnSurface(), TrackingRecHit::isValid(), TrajectoryStateOnSurface::isValid(), magfield_, muonPropagator_, DetId::rawId(), reco::Track::recHit(), reco::Track::recHitsSize(), and GeomDet::surface().
Referenced by produce().
{ TrajectoryStateOnSurface tsos = trajectoryStateTransform::innerStateOnSurface(tk, *geometry_, &*magfield_); muonPropagator_->setPropagationDirection(alongMomentum); for (unsigned int i = 0; i < tk.recHitsSize(); ++i) { const TrackingRecHit *hit = &*tk.recHit(i); const GeomDet *det = geometry_->idToDet(hit->geographicalId()); if (det == 0) continue; if (i != 0) tsos = muonPropagator_->propagate(tsos, det->surface()); if (!tsos.isValid()) continue; std::cout << " state " << i << " at x = " << tsos.globalPosition() << ", p = " << tsos.globalMomentum() << std::endl; if (hit->isValid()) { std::cout << " valid rechit on detid " << hit->geographicalId().rawId() << std::endl; } else { std::cout << " invalid rechit on detid " << hit->geographicalId().rawId() << std::endl; } } }
int OutsideInMuonSeeder::doLayer | ( | const GeometricSearchDet & | layer, |
const TrajectoryStateOnSurface & | state, | ||
std::vector< TrajectorySeed > & | out | ||
) | const [private] |
Definition at line 197 of file OutsideInMuonSeeder.cc.
References dtNoiseDBValidation_cfg::cerr, GeometricSearchDet::compatibleDetsV(), gather_cfg::cout, debug_, errorRescaling_, estimator_, MeasurementDet::fastMeasurements(), newFWLiteAna::found, TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), hitsToTry_, TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localError(), measurementTracker_, muonPropagator_, oppositeToMomentum, trajectoryStateTransform::persistentState(), LocalTrajectoryError::positionError(), edm::OwnVector< T, P >::push_back(), TrajectoryStateOnSurface::rescaleError(), python::multivaluedict::sort(), mathSSE::sqrt(), trackerPropagator_, updator_, LocalError::xx(), and LocalError::yy().
Referenced by produce().
{ TrajectoryStateOnSurface onLayer(state); onLayer.rescaleError(errorRescaling_); std::vector< GeometricSearchDet::DetWithState > dets; layer.compatibleDetsV(onLayer, *muonPropagator_, *estimator_, dets); if (debug_) { std::cout << "Query on layer around x = " << onLayer.globalPosition() << " with local pos error " << sqrt(onLayer.localError().positionError().xx()) << " , " << sqrt(onLayer.localError().positionError().yy()) << " , " << " returned " << dets.size() << " compatible detectors" << std::endl; } std::vector<TrajectoryMeasurement> meas; for (std::vector<GeometricSearchDet::DetWithState>::const_iterator it = dets.begin(), ed = dets.end(); it != ed; ++it) { const MeasurementDet *det = measurementTracker_->idToDet(it->first->geographicalId()); if (det == 0) { std::cerr << "BOGUS detid " << it->first->geographicalId().rawId() << std::endl; continue; } if (!it->second.isValid()) continue; std::vector < TrajectoryMeasurement > mymeas = det->fastMeasurements(it->second, state, *trackerPropagator_, *estimator_); if (debug_) std::cout << "Query on detector " << it->first->geographicalId().rawId() << " returned " << mymeas.size() << " measurements." << std::endl; for (std::vector<TrajectoryMeasurement>::const_iterator it2 = mymeas.begin(), ed2 = mymeas.end(); it2 != ed2; ++it2) { if (it2->recHit()->isValid()) meas.push_back(*it2); } } int found = 0; std::sort(meas.begin(), meas.end(), TrajMeasLessEstim()); for (std::vector<TrajectoryMeasurement>::const_iterator it2 = meas.begin(), ed2 = meas.end(); it2 != ed2; ++it2) { if (debug_) { std::cout << " inspecting Hit with chi2 = " << it2->estimate() << std::endl; std::cout << " track state " << it2->forwardPredictedState().globalPosition() << std::endl; std::cout << " rechit position " << it2->recHit()->globalPosition() << std::endl; } TrajectoryStateOnSurface updated = updator_->update(it2->forwardPredictedState(), *it2->recHit()); if (updated.isValid()) { if (debug_) std::cout << " --> updated state: x = " << updated.globalPosition() << ", p = " << updated.globalMomentum() << std::endl; edm::OwnVector<TrackingRecHit> seedHits; seedHits.push_back(*it2->recHit()->hit()); PTrajectoryStateOnDet const & pstate = trajectoryStateTransform::persistentState(updated, it2->recHit()->geographicalId().rawId()); TrajectorySeed seed(pstate, std::move(seedHits), oppositeToMomentum); out.push_back(seed); found++; if (found == hitsToTry_) break; } } return found; }
void OutsideInMuonSeeder::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 120 of file OutsideInMuonSeeder.cc.
References abs, alongMomentum, gather_cfg::cout, debug_, doDebug(), doLayer(), dummyPlane_, estimator_, estimatorName_, reco::LeafCandidate::eta(), reco::TrackBase::eta(), newFWLiteAna::found, fromVertex_, geometry_, edm::EventSetup::get(), edm::Event::getByLabel(), trajectoryStateTransform::initialFreeState(), trajectoryStateTransform::innerStateOnSurface(), reco::Muon::innerTrack(), layersToTry_, magfield_, maxEtaForTOB_, measurementTracker_, minEtaForTEC_, RPCpg::mu, muonPropagator_, muonPropagatorName_, oppositeToMomentum, dbtoconf::out, reco::Muon::outerTrack(), reco::LeafCandidate::phi(), FreeTrajectoryState::position(), edm::ESHandle< T >::product(), reco::LeafCandidate::pt(), edm::Event::put(), selector_, alcazmumu_cfi::src, src_, evf::utils::state, trackerPropagator_, trackerPropagatorName_, updator_, and updatorName_.
{ using namespace edm; using namespace std; iSetup.get<IdealMagneticFieldRecord>().get(magfield_); iSetup.get<TrackingComponentsRecord>().get(trackerPropagatorName_, trackerPropagator_); iSetup.get<TrackingComponentsRecord>().get(muonPropagatorName_, muonPropagator_); iSetup.get<GlobalTrackingGeometryRecord>().get(geometry_); iSetup.get<CkfComponentsRecord>().get(measurementTracker_); iSetup.get<TrackingComponentsRecord>().get(estimatorName_,estimator_); iSetup.get<TrackingComponentsRecord>().get(updatorName_,updator_); measurementTracker_->update(iEvent); Handle<View<reco::Muon> > src; iEvent.getByLabel(src_, src); auto_ptr<vector<TrajectorySeed> > out(new vector<TrajectorySeed>()); for (View<reco::Muon>::const_iterator it = src->begin(), ed = src->end(); it != ed; ++it) { const reco::Muon &mu = *it; if (mu.outerTrack().isNull() || !selector_(mu)) continue; if (debug_ && mu.innerTrack().isNonnull()) doDebug(*mu.innerTrack()); muonPropagator_->setPropagationDirection(fromVertex_ ? alongMomentum : oppositeToMomentum); trackerPropagator_->setPropagationDirection(alongMomentum); int sizeBefore = out->size(); if (debug_) std::cout << "\n\n\nSeeding for muon of pt " << mu.pt() << ", eta " << mu.eta() << ", phi " << mu.phi() << std::endl; const reco::Track &tk = *mu.outerTrack(); TrajectoryStateOnSurface state; if (fromVertex_) { FreeTrajectoryState fstate = trajectoryStateTransform::initialFreeState(tk, magfield_.product()); dummyPlane_->move(fstate.position() - dummyPlane_->position()); state = TrajectoryStateOnSurface(fstate, *dummyPlane_); } else { state = trajectoryStateTransform::innerStateOnSurface(tk, *geometry_, magfield_.product()); } if (std::abs(tk.eta()) < maxEtaForTOB_) { std::vector< BarrelDetLayer * > const & tob = measurementTracker_->geometricSearchTracker()->tobLayers(); int iLayer = 6, found = 0; for (std::vector<BarrelDetLayer *>::const_reverse_iterator it = tob.rbegin(), ed = tob.rend(); it != ed; ++it, --iLayer) { if (debug_) std::cout << "\n ==== Trying TOB " << iLayer << " ====" << std::endl; if (doLayer(**it, state, *out)) { if (++found == layersToTry_) break; } } } if (tk.eta() > minEtaForTEC_) { int iLayer = 9, found = 0; std::vector< ForwardDetLayer * > const & tec = measurementTracker_->geometricSearchTracker()->posTecLayers(); for (std::vector<ForwardDetLayer *>::const_reverse_iterator it = tec.rbegin(), ed = tec.rend(); it != ed; ++it, --iLayer) { if (debug_) std::cout << "\n ==== Trying TEC " << +iLayer << " ====" << std::endl; if (doLayer(**it, state, *out)) { if (++found == layersToTry_) break; } } } if (tk.eta() < -minEtaForTEC_) { int iLayer = 9, found = 0; std::vector< ForwardDetLayer * > const & tec = measurementTracker_->geometricSearchTracker()->negTecLayers(); for (std::vector<ForwardDetLayer *>::const_reverse_iterator it = tec.rbegin(), ed = tec.rend(); it != ed; ++it, --iLayer) { if (debug_) std::cout << "\n ==== Trying TEC " << -iLayer << " ====" << std::endl; if (doLayer(**it, state, *out)) { if (++found == layersToTry_) break; } } } if (debug_) std::cout << "Outcome of seeding for muon of pt " << mu.pt() << ", eta " << mu.eta() << ", phi " << mu.phi() << ": found " << (out->size() - sizeBefore) << " seeds."<< std::endl; } iEvent.put(out); }
bool OutsideInMuonSeeder::debug_ [private] |
Dump deug information.
Definition at line 89 of file OutsideInMuonSeeder.cc.
Surface used to make a TSOS at the PCA to the beamline.
Definition at line 92 of file OutsideInMuonSeeder.cc.
Referenced by produce().
double OutsideInMuonSeeder::errorRescaling_ [private] |
How much to rescale errors from STA.
Definition at line 70 of file OutsideInMuonSeeder.cc.
Referenced by doLayer().
Definition at line 85 of file OutsideInMuonSeeder.cc.
std::string OutsideInMuonSeeder::estimatorName_ [private] |
Definition at line 75 of file OutsideInMuonSeeder.cc.
Referenced by produce().
bool OutsideInMuonSeeder::fromVertex_ [private] |
Definition at line 83 of file OutsideInMuonSeeder.cc.
int OutsideInMuonSeeder::hitsToTry_ [private] |
How many hits to try on same layer.
Definition at line 64 of file OutsideInMuonSeeder.cc.
Referenced by doLayer().
int OutsideInMuonSeeder::layersToTry_ [private] |
How many layers to try.
Definition at line 61 of file OutsideInMuonSeeder.cc.
Referenced by produce().
Definition at line 80 of file OutsideInMuonSeeder.cc.
double OutsideInMuonSeeder::maxEtaForTOB_ [private] |
Definition at line 78 of file OutsideInMuonSeeder.cc.
Referenced by produce().
edm::ESHandle<MeasurementTracker> OutsideInMuonSeeder::measurementTracker_ [private] |
Definition at line 84 of file OutsideInMuonSeeder.cc.
std::string OutsideInMuonSeeder::measurementTrackerName_ [private] |
Definition at line 74 of file OutsideInMuonSeeder.cc.
Referenced by OutsideInMuonSeeder().
double OutsideInMuonSeeder::minEtaForTEC_ [private] |
Definition at line 78 of file OutsideInMuonSeeder.cc.
Referenced by produce().
Definition at line 81 of file OutsideInMuonSeeder.cc.
std::string OutsideInMuonSeeder::muonPropagatorName_ [private] |
Definition at line 73 of file OutsideInMuonSeeder.cc.
Referenced by produce().
edm::InputTag OutsideInMuonSeeder::src_ [private] |
Labels for input collections.
Definition at line 55 of file OutsideInMuonSeeder.cc.
Referenced by produce().
Definition at line 82 of file OutsideInMuonSeeder.cc.
std::string OutsideInMuonSeeder::trackerPropagatorName_ [private] |
Definition at line 72 of file OutsideInMuonSeeder.cc.
Referenced by produce().
Definition at line 86 of file OutsideInMuonSeeder.cc.
std::string OutsideInMuonSeeder::updatorName_ [private] |
Definition at line 76 of file OutsideInMuonSeeder.cc.
Referenced by OutsideInMuonSeeder(), and produce().