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) {
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(),
364 if (
track.ndof() > 0 &&
track.chiSquared() > 0) {
376 for (
auto&& ir :
hits) {
377 if (!ir->isValid()) {
385 <<
" dimension = " << ir->dimension() <<
" " << ir->det()->geographicalId().det() <<
" " 386 << ir->det()->subDetector();
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();
481 if ((*lone_tec)->detUnit()) {
488 LocalError scaledError(rotError.
xx() * scl_x * scl_x, 0, rotError.
yy() * scl_y * scl_y);
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
MuonTrajectoryBuilder::CandidateContainer build(const TrackCand &, MuonTrajectoryBuilder::CandidateContainer &) const
build combined trajectory from sta Track and tracker RecHits
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > theTopoToken
TransientTrackingRecHit::ConstRecHitContainer getTransientRecHits(const reco::Track &) const
get transient RecHits of a Track
static constexpr auto TEC
MuonCandidate::CandidateContainer CandidateContainer
T getParameter(std::string const &) const
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
std::unique_ptr< RectangularEtaPhiTrackingRegion > region(const reco::TrackRef &) const
Define tracking region.
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
GlobalMuonRefitter * theGlbRefitter
std::pair< const Trajectory *, reco::TrackRef > TrackCand
virtual float stripAngle(float strip) const =0
ConstRecHitContainer selectTrackerHits(const ConstRecHitContainer &) const
select tracker hits; exclude some tracker hits in the global trajectory
MuonTrackingRegionBuilder
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
void fixTEC(ConstRecHitContainer &all, double scl_x, double scl_y) const
rescale errors of outermost TEC RecHit
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
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
const GeomDet * idToDet(DetId) const override
constexpr Detector det() const
get the detector field from this detid
~GlobalTrajectoryBuilderBase() override
destructor
virtual float strip(const LocalPoint &) const =0
T getUntrackedParameter(std::string const &, T const &) const
std::string theTrackerPropagatorName
TrackTransformer * theTrackTransformer
double trackProbability(const Trajectory &) const
calculate chi2 probability (-ln(P))
void printHits(const ConstRecHitContainer &) const
print all RecHits of a trajectory
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theFieldToken
const MagneticField * theField
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
void setEvent(const edm::Event &, const edm::EventSetup &)
Pass the Event to the algo at each event.
const MuonServiceProxy * theService
Abs< T >::type abs(const T &t)
void setEvent(const edm::Event &) override
pass the Event to the algo at each event
bool getData(T &iHolder) const
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
RectangularEtaPhiTrackingRegion defineRegionOfInterest(const reco::TrackRef &) const
define region of interest with tracker
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > theMuonRecHitBuilderToken
GlobalMuonTrackMatcher * theTrackMatcher
const Plane & surface() const
The nominal surface of the GeomDet.
std::vector< std::unique_ptr< MuonCandidate > > CandidateContainer
GlobalVector const & direction() const
the direction around which region is constructed
const edm::Event * theEvent
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
MuonTrackingRegionBuilder * theRegionBuilder
const edm::EventSetup & eventSetup() const
Log< level::Warning, false > LogWarning
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;.
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > theTrackerRecHitBuilderToken
RefitDirection checkRecHitsOrdering(const ConstRecHitContainer &) const
This does nothing now.
T angle(T x1, T y1, T z1, T x2, T y2, T z2)