88 std::vector<TrajectorySeed> &
out,
99 layersToTry_(iConfig.getParameter<int32_t>(
"layersToTry")),
100 hitsToTry_(iConfig.getParameter<int32_t>(
"hitsToTry")),
112 produces<std::vector<TrajectorySeed> >();
137 auto out = std::make_unique<std::vector<TrajectorySeed>>();
139 for (
auto const &
mu : *src) {
150 int sizeBefore =
out->size();
151 if (
debug_)
LogDebug(
"OutsideInMuonSeeder") <<
"\n\n\nSeeding for muon of pt " <<
mu.pt() <<
", eta " <<
mu.eta() <<
", phi " <<
mu.phi() << std::endl;
159 std::vector< BarrelDetLayer const* >
const & tob = measurementTracker->geometricSearchTracker()->tobLayers();
161 int iLayer = tob.size();
162 if(iLayer==0)
LogError(
"OutsideInMuonSeeder") <<
"TOB has no layers." ;
164 for (
auto it = tob.rbegin(), ed = tob.rend(); it != ed; ++it, --iLayer) {
165 if (
debug_)
LogDebug(
"OutsideInMuonSeeder") <<
"\n ==== Trying TOB " << iLayer <<
" ====" << std::endl;
167 *(pmuon_cloned.get()),
168 *(ptracker_cloned.get()),
169 *measurementTracker)) {
176 measurementTracker->geometricSearchTracker()->posTidLayers() : measurementTracker->geometricSearchTracker()->posTecLayers();
178 LogDebug(
"OutsideInMuonSeeder") <<
"\n We are using the Phase2 Outer Tracker (defined as a TID+). ";
180 LogTrace(
"OutsideInMuonSeeder") <<
"\n ==== TEC+ tot layers " << forwLayers.size() <<
" ====" << std::endl;
182 int iLayer = forwLayers.size();
183 if(iLayer==0)
LogError(
"OutsideInMuonSeeder") <<
"TEC+ has no layers." ;
185 if (
debug_)
LogDebug(
"OutsideInMuonSeeder") <<
"\n ==== Tot layers " << forwLayers.size() <<
" ====" << std::endl;
186 for (
auto it = forwLayers.rbegin(), ed = forwLayers.rend(); it != ed; ++it, --iLayer) {
187 if (
debug_)
LogDebug(
"OutsideInMuonSeeder") <<
"\n ==== Trying Forward Layer +" << +iLayer <<
" ====" << std::endl;
189 *(pmuon_cloned.get()),
190 *(ptracker_cloned.get()),
191 *measurementTracker)) {
198 measurementTracker->geometricSearchTracker()->negTidLayers() : measurementTracker->geometricSearchTracker()->negTecLayers();
200 LogDebug(
"OutsideInMuonSeeder") <<
"\n We are using the Phase2 Outer Tracker (defined as a TID-). ";
202 LogTrace(
"OutsideInMuonSeeder") <<
"\n ==== TEC- tot layers " << forwLayers.size() <<
" ====" << std::endl;
204 int iLayer = forwLayers.size();
205 if(iLayer==0)
LogError(
"OutsideInMuonSeeder") <<
"TEC- has no layers." ;
207 if (
debug_)
LogDebug(
"OutsideInMuonSeeder") <<
"\n ==== Tot layers " << forwLayers.size() <<
" ====" << std::endl;
208 for (
auto it = forwLayers.rbegin(), ed = forwLayers.rend(); it != ed; ++it, --iLayer) {
209 if (
debug_)
LogDebug(
"OutsideInMuonSeeder") <<
"\n ==== Trying Forward Layer -" << -iLayer <<
" ====" << std::endl;
211 *(pmuon_cloned.get()),
212 *(ptracker_cloned.get()),
213 *measurementTracker)) {
218 if (
debug_)
LogDebug(
"OutsideInMuonSeeder") <<
"Outcome of seeding for muon of pt " <<
mu.pt() <<
", eta " <<
mu.eta() <<
", phi " <<
mu.phi() <<
": found " << (
out->size() - sizeBefore) <<
" seeds."<< std::endl;
228 std::vector<TrajectorySeed> &
out,
234 std::vector< GeometricSearchDet::DetWithState > dets;
240 " returned " << dets.size() <<
" compatible detectors" << std::endl;
243 std::vector<TrajectoryMeasurement> meas;
244 for (std::vector<GeometricSearchDet::DetWithState>::const_iterator it = dets.begin(), ed = dets.end(); it != ed; ++it) {
246 if (det.
isNull()) {
std::cerr <<
"BOGUS detid " << it->first->geographicalId().rawId() << std::endl;
continue; }
247 if (!it->second.isValid())
continue;
249 if (
debug_)
LogDebug(
"OutsideInMuonSeeder") <<
"Query on detector " << it->first->geographicalId().rawId() <<
" returned " << mymeas.size() <<
" measurements." << std::endl;
250 for (std::vector<TrajectoryMeasurement>::const_iterator it2 = mymeas.begin(), ed2 = mymeas.end(); it2 != ed2; ++it2) {
251 if (it2->recHit()->isValid()) meas.push_back(*it2);
256 for (std::vector<TrajectoryMeasurement>::const_iterator it2 = meas.begin(), ed2 = meas.end(); it2 != ed2; ++it2) {
258 LogDebug(
"OutsideInMuonSeeder") <<
" inspecting Hit with chi2 = " << it2->estimate() << std::endl;
259 LogDebug(
"OutsideInMuonSeeder") <<
" track state " << it2->forwardPredictedState().globalPosition() << std::endl;
260 LogDebug(
"OutsideInMuonSeeder") <<
" rechit position " << it2->recHit()->globalPosition() << std::endl;
266 seedHits.
push_back(*it2->recHit()->hit());
283 if (det ==
nullptr)
continue;
284 if (
i != 0) tsos = pmuon_cloned->propagate(tsos, det->
surface());
void rescaleError(double factor)
MeasurementDetWithData idToDet(const DetId &id) const
Previous MeasurementDetSystem interface.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const std::string estimatorName_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
edm::ESHandle< Chi2MeasurementEstimatorBase > estimator_
edm::ESHandle< MagneticField > magfield_
edm::ESHandle< GlobalTrackingGeometry > geometry_
float const maxEtaForTOB_
GlobalPoint globalPosition() const
edm::ESHandle< Propagator > trackerPropagator_
const bool fromVertex_
Do inside-out.
edm::ESHandle< TrajectoryStateUpdator > updator_
const Plane & surface() const
The nominal surface of the GeomDet.
LocalError positionError() const
int doLayer(const GeometricSearchDet &layer, const TrajectoryStateOnSurface &state, std::vector< TrajectorySeed > &out, const Propagator &muon_propagator, const Propagator &tracker_propagator, const MeasurementTrackerEvent &mte) const
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
bool isThere(GeomDetEnumerators::SubDetector subdet) const
uint32_t rawId() const
get the raw id
std::unique_ptr< Propagator > SetPropagationDirection(Propagator const &iprop, PropagationDirection dir)
const bool debug_
Dump deug information.
double eta() const
pseudorapidity of momentum vector
const double errorRescaling_
How much to rescale errors from STA.
std::vector< TrajectoryMeasurement > fastMeasurements(const TrajectoryStateOnSurface &stateOnThisDet, const TrajectoryStateOnSurface &tsos2, const Propagator &prop, const MeasurementEstimator &est) const
Abs< T >::type abs(const T &t)
const std::string trackerPropagatorName_
const std::string updatorName_
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
const LocalTrajectoryError & localError() const
edm::ESHandle< Propagator > muonPropagator_
StringCutObjectSelector< reco::Muon > selector_
Muon selection.
edm::EDGetTokenT< edm::View< reco::Muon > > src_
Labels for input collections.
void doDebug(const reco::Track &tk) const
const int layersToTry_
How many layers to try.
GlobalVector globalMomentum() const
TrackingRecHitRef recHit(size_t i) const
Get i-th hit on the track.
const GeomDet * idToDet(DetId) const override
const std::string measurementTrackerName_
const int hitsToTry_
How many hits to try on same layer.
edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrackerTag_
DetId geographicalId() const
float const minEtaForTEC_
T const * product() const
const std::string muonPropagatorName_
virtual void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
OutsideInMuonSeeder(const edm::ParameterSet &iConfig)
~OutsideInMuonSeeder() override