79 : theLayerMeasurements(nullptr),
80 theTrackTransformer(nullptr),
81 theRegionBuilder(nullptr),
83 theGlbRefitter(nullptr) {
173 if ((muonRecHits.size() > 1) &&
174 (muonRecHits.front()->globalPosition().mag() > muonRecHits.back()->globalPosition().mag())) {
178 for (
auto&& it : tkTrajs) {
180 LogTrace(
theCategory) <<
" Track p and pT " << it->trackerTrack()->p() <<
" " << it->trackerTrack()->pt();
181 if (it->trackerTrack()->p() <
thePCut || it->trackerTrack()->pt() <
thePtCut)
187 if (it->trackerTrack().isNonnull()) {
195 if (
std::abs(it->trackerTrack()->eta()) > 0.95 &&
std::abs(it->trackerTrack()->eta()) < 1.15 &&
196 it->trackerTrack()->pt() < 60) {
205 reverse(trackerRecHits.begin(), trackerRecHits.end());
211 if (it->trackerTrack()->seedRef().isAvailable())
212 tmpSeed = it->trackerTrack()->seedRef();
214 if (!innerTsos.isValid()) {
219 innerTsos.rescaleError(100.);
221 TC refitted0, refitted1;
222 std::unique_ptr<Trajectory> tkTrajectory;
225 if (!(it->trackerTrajectory() && it->trackerTrajectory()->isValid())) {
227 if (!refitted0.empty())
228 tkTrajectory = std::make_unique<Trajectory>(*(refitted0.begin()));
232 tkTrajectory = it->releaseTrackerTrajectory();
234 tkTrajectory->setSeedRef(tmpSeed);
238 allRecHits.insert(allRecHits.end(), muonRecHits.begin(), muonRecHits.end());
240 LogTrace(
theCategory) <<
" This track-sta refitted to " << refitted1.size() <<
" trajectories";
242 std::unique_ptr<Trajectory> glbTrajectory1;
243 if (!refitted1.empty())
244 glbTrajectory1 = std::make_unique<Trajectory>(*(refitted1.begin()));
248 glbTrajectory1->setSeedRef(tmpSeed);
250 if (glbTrajectory1 && tkTrajectory) {
251 refittedResult.emplace_back(std::make_unique<MuonCandidate>(
252 std::move(glbTrajectory1), it->muonTrack(), it->trackerTrack(),
std::move(tkTrajectory)));
256 if (it->trackerTrack()->seedRef().isAvailable())
257 tmpSeed = it->trackerTrack()->seedRef();
260 std::unique_ptr<Trajectory> tkTrajectory;
261 if (!(it->trackerTrajectory() && it->trackerTrajectory()->isValid())) {
263 if (!refitted0.empty()) {
264 tkTrajectory = std::make_unique<Trajectory>(*(refitted0.begin()));
268 tkTrajectory = it->releaseTrackerTrajectory();
269 std::unique_ptr<Trajectory> cpy;
271 tkTrajectory->setSeedRef(tmpSeed);
272 cpy = std::make_unique<Trajectory>(*tkTrajectory);
275 refittedResult.emplace_back(std::make_unique<MuonCandidate>(
282 std::unique_ptr<MuonCandidate> tmpCand;
285 for (
auto&& cand : refittedResult) {
287 LogTrace(
theCategory) <<
" refitted-track-sta with pT " << cand->trackerTrack()->pt() <<
" has probability "
290 if (prob < minProb
or not tmpCand) {
297 selectedResult.push_back(
std::move(tmpCand));
299 refittedResult.clear();
301 return selectedResult;
308 const TrackCand& staCand,
const std::vector<TrackCand>& tkTs) {
316 std::vector<TrackCand>
result;
318 double deltaR_max = 1.0;
320 for (
auto&& is : tkTs) {
322 static_cast<double>(regionOfInterest.
direction().
phi()),
328 if (deltaR_tmp < deltaR_max) {
330 result.push_back(tmpCand);
345 std::abs(region1->etaRange().max() - region1->etaRange().mean()));
350 region1->originRBound(),
351 region1->originZBound(),
353 region1->phiMargin(),
376 for (
auto&& ir : hits) {
377 if (!ir->isValid()) {
385 <<
" dimension = " << ir->dimension() <<
" " << ir->det()->geographicalId().det() <<
" "
386 << ir->det()->subDetector();
395 if (!recHits.empty()) {
396 ConstRecHitContainer::const_iterator frontHit = recHits.begin();
397 ConstRecHitContainer::const_iterator backHit = recHits.end() - 1;
398 while (!(*frontHit)->isValid() && frontHit != backHit) {
401 while (!(*backHit)->isValid() && backHit != frontHit) {
405 double rFirst = (*frontHit)->globalPosition().mag();
406 double rLast = (*backHit)->globalPosition().mag();
410 else if (rFirst > rLast)
430 for (
auto&&
i : all) {
451 ConstRecHitContainer::iterator lone_tec;
453 for (ConstRecHitContainer::iterator
i = all.begin();
i != all.end();
i++) {
454 if (!(*i)->isValid())
462 if ((
i + 1) != all.end() && (*(
i + 1))->isValid() &&
474 int hitDet = (*lone_tec)->hit()->geographicalId().det();
475 int hitSubDet = (*lone_tec)->hit()->geographicalId().subdetId();
479 if (strip && strip->
det()) {
481 if ((*lone_tec)->detUnit()) {
488 LocalError scaledError(rotError.
xx() * scl_x * scl_x, 0, rotError.
yy() * scl_y * scl_y);
489 error = scaledError.
rotate(-angle);
514 auto hitCloner = tkbuilder->cloner();
516 if ((*hit)->isValid()) {
517 DetId recoid = (*hit)->geographicalId();
519 if (!(*hit)->hasPositionAndError()) {
526 <<
"Could not get a tsos on the hit surface. We will miss a tracking hit.";
530 auto h = (**hit).cloneForFit(*tkbuilder->geometry()->idToDet((**hit).geographicalId()));
531 result.emplace_back(hitCloner.makeShared(
h, predTsos));
533 result.push_back((*hit)->cloneSH());
536 if ((*hit)->geographicalId().subdetId() == 3 && !
theRPCInTheFit) {
const TrackerTopology * theTopo
std::vector< Trajectory > TC
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > theTopoToken
static constexpr auto TEC
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
ConstRecHitContainer selectTrackerHits(const ConstRecHitContainer &) const
select tracker hits; exclude some tracker hits in the global trajectory
GlobalMuonRefitter * theGlbRefitter
std::pair< const Trajectory *, reco::TrackRef > TrackCand
virtual float stripAngle(float strip) const =0
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
float LnChiSquaredProbability(double chiSquared, double nrDOF)
Geom::Phi< T > phi() const
const TransientTrackingRecHitBuilder * theMuonRecHitBuilder
void setServices(const edm::EventSetup &)
set the services needed by the TrackTransformer
edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord > theMSMakerToken
std::vector< TrackCand > chooseRegionalTrackerTracks(const TrackCand &, const std::vector< TrackCand > &)
choose tracker tracks within region of interest
Log< level::Error, false > LogError
const TransientTrackingRecHitBuilder * theTrackerRecHitBuilder
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
~GlobalTrajectoryBuilderBase() override
destructor
std::unique_ptr< RectangularEtaPhiTrackingRegion > region(const reco::TrackRef &) const
Define tracking region.
virtual float strip(const LocalPoint &) const =0
std::string theTrackerPropagatorName
bool getData(T &iHolder) const
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
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theFieldToken
const GeomDet * det() const
const MagneticField * theField
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
void setEvent(const edm::Event &, const edm::EventSetup &)
Pass the Event to the algo at each event.
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator
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
void setEvent(const edm::Event &) override
pass the Event to the algo at each event
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
std::vector< ConstRecHitPointer > ConstRecHitContainer
GlobalTrajectoryBuilderBase(const edm::ParameterSet &, const MuonServiceProxy *, edm::ConsumesCollector &)
constructor with Parameter Set and MuonServiceProxy
const MultipleScatteringParametrisationMaker * theMSMaker
virtual void setEvent(const edm::Event &)
pass the Event to the algo at each event
LocalError localPositionError() const override
int ndof(bool bon=true) const
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > theMuonRecHitBuilderToken
GlobalMuonTrackMatcher * theTrackMatcher
std::vector< std::unique_ptr< MuonCandidate > > CandidateContainer
T getParameter(std::string const &) const
MuonTrajectoryBuilder::CandidateContainer build(const TrackCand &, MuonTrajectoryBuilder::CandidateContainer &) const
build combined trajectory from sta Track and tracker RecHits
RectangularEtaPhiTrackingRegion defineRegionOfInterest(const reco::TrackRef &) const
define region of interest with tracker
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
tuple GlobalMuonTrackMatcher
LocalPoint localPosition() const override
RefitDirection checkRecHitsOrdering(const ConstRecHitContainer &) const
This does nothing now.
const edm::Event * theEvent
MuonTrackingRegionBuilder * theRegionBuilder
Log< level::Warning, false > LogWarning
LocalError rotate(float x, float y) const
Return a new LocalError, rotated by an angle defined by the direction (x,y)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
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::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > theTrackerRecHitBuilderToken
constexpr Detector det() const
get the detector field from this detid
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.