56 propagator = theService.propagator(
"SmartPropagatorAny");
57 propagatorPF = theService.propagator(
"SmartPropagatorAny");
59 theG = theService.trackingGeometry();
64 magfield = theService.magneticField();
65 navigation = std::make_unique<DirectMuonNavigation>(theService.detLayerGeometry());
66 getSegs = std::make_unique<ChamberSegmentUtility>();
72 thrManager = std::make_unique<ThrParameters>(dytThresholdsH, dtAlignmentErrorsExtended, cscAlignmentErrorsExtended);
93 vector<const TrackingRecHit *> DTrh = bestDTSeg.
recHits();
94 for (vector<const TrackingRecHit *>::iterator it = DTrh.begin(); it != DTrh.end(); it++) {
98 for (ConstRecHitContainer::const_iterator it = tmprecHits.begin(); it != tmprecHits.end(); ++it) {
99 DTLayerId layid((*it)->det()->geographicalId());
101 if (
temp.isValid()) {
112 for (vector<CSCRecHit2D>::iterator it = CSCrh.begin(); it != CSCrh.end(); ++it) {
116 for (ConstRecHitContainer::const_iterator it = tmprecHits.begin(); it != tmprecHits.end(); ++it) {
119 if (
temp.isValid()) {
131 if (selector < 0 || selector > 2)
132 throw cms::Exception(
"NotAvailable") <<
"DYT selector: wrong option!" << endl;
144 if (thr.size() == 2) {
145 for (
unsigned int i = 0;
i < thr.size();
i++)
147 Thrs.push_back(thr[
i]);
153 <<
"WARNING: wrong size for the threshold vector!\nExpected size: 2\n Found size: " << thr.size();
175 vector<TrajectoryMeasurement> muonMeasurements = traj.
measurements();
177 for (vector<TrajectoryMeasurement>::const_iterator imT = muonMeasurements.begin(); imT != muonMeasurements.end();
179 if (!(*imT).recHit()->isValid())
183 result.push_back((*imT).recHit());
184 if (!(*imT).forwardPredictedState().isValid())
186 if ((*imT).forwardPredictedState().globalPosition().mag() >
206 map<int, vector<DetId> > compatibleIds;
207 map<int, vector<DTRecSegment4D> > dtSegMap;
208 map<int, vector<CSCSegment> > cscSegMap;
209 int incompConLay = 0;
223 for (
map<
int, vector<DetId> >::iterator it = compatibleIds.begin(); it != compatibleIds.end(); ++it) {
227 double bestDTEstimator =
MAX_THR;
228 double bestCSCEstimator =
MAX_THR;
229 vector<DTRecSegment4D> dtSegs = dtSegMap[it->first];
230 vector<CSCSegment> cscSegs = cscSegMap[it->first];
242 chooseLayers(incompConLay, bestDTEstimator, bestDTSeg, tsosDTlayer, bestCSCEstimator, bestCSCSeg, tsosCSClayer);
243 fillDYTInfos(stLayer, chosenLayer, incompConLay, bestDTEstimator, bestCSCEstimator, bestDTSeg, bestCSCSeg);
263 bool const &chosenLayer,
265 double const &bestDTEstimator,
266 double const &bestCSCEstimator,
272 if (bestDTEstimator <= bestCSCEstimator) {
293 vector<const DetLayer *> navLayers;
295 unsigned int ilayerCorrected = 0;
296 for (
unsigned int ilayer = 0; ilayer < navLayers.size(); ilayer++) {
302 vector<DetLayer::DetWithState> comps =
306 if (!comps.empty()) {
307 for (
unsigned int icomp = 0; icomp < comps.size(); icomp++) {
309 detMap[ilayerCorrected].push_back(
id);
319 map<
int, vector<DTRecSegment4D> > &dtSegMap,
320 map<
int, vector<CSCSegment> > &cscSegMap) {
321 for (
map<
int, vector<DetId> >::iterator it = compatibleIds.begin(); it != compatibleIds.end(); ++it) {
322 vector<DetId> ids = compatibleIds[it->first];
323 for (
unsigned j = 0;
j < ids.size();
j++) {
326 vector<CSCSegment>
tmp =
getSegs->getCSCSegmentsInChamber(ch);
327 for (
unsigned int k = 0;
k <
tmp.size();
k++)
328 cscSegMap[it->first].push_back(
tmp[
k]);
332 vector<DTRecSegment4D>
tmp =
getSegs->getDTSegmentsInChamber(ch);
333 for (
unsigned int k = 0;
k <
tmp.size();
k++)
334 dtSegMap[it->first].push_back(
tmp[
k]);
342 vector<DTRecSegment4D>
const &segments,
343 double &bestEstimator,
346 if (segments.empty())
348 for (
unsigned int iSeg = 0; iSeg < segments.size(); iSeg++) {
363 bestSeg = segments[iSeg];
369 vector<CSCSegment>
const &segments,
370 double &bestEstimator,
373 if (segments.empty())
375 for (
unsigned int iSeg = 0; iSeg < segments.size(); iSeg++) {
390 bestSeg = segments[iSeg];
414 map<
int, vector<DTRecSegment4D> > dtSegMap,
415 map<
int, vector<CSCSegment> > cscSegMap) {
416 for (
map<
int, vector<DetId> >::iterator it = compatibleIds.begin(); it != compatibleIds.end(); ++it) {
419 double bestDTEstimator =
MAX_THR;
420 double bestCSCEstimator =
MAX_THR;
422 vector<DTRecSegment4D> dtSegs = dtSegMap[it->first];
423 vector<CSCSegment> cscSegs = cscSegMap[it->first];
436 if (bestDTEstimator <= bestCSCEstimator) {
438 if (bestDTEstimator >= initThr)
443 if (uRes.isValid()) {
450 if (bestCSCEstimator >= initThr)
455 if (uRes.isValid()) {
465 DetId id = (*imrh)->geographicalId();
476 double const &bestDTEstimator,
479 double const &bestCSCEstimator,
485 if (bestDTEstimator <= bestCSCEstimator) {
492 (
DYTselector == 2 && incompLayers < 2 && bestDTEstimator < initThr)) {
503 (
DYTselector == 2 && incompLayers < 2 && bestCSCEstimator < initThr)) {
514 for (vector<DYTThrObject::DytThrStruct>::const_iterator it = thrvector.begin(); it != thrvector.end(); it++) {
527 auto parametricThreshold = [
this] {
534 std::set<dyt_utils::etaRegion> regionsToExclude = {
537 if (!regionsToExclude.count(this->region))
538 thr = parametricThreshold();
548 else if (absEta <= 1.2)
550 else if (absEta <= 2.0)
552 else if (absEta <= 2.2)
554 else if (absEta <= 2.4)
576 for (
i = 1;
i <
n; ++
i)
577 for (
j =
n - 1;
j >=
i; --
j)
int station() const
Return the station number.
dyt_utils::etaRegion region
DynamicTruncation(Config const &, const edm::EventSetup &, const MuonServiceProxy &)
T getParameter(std::string const &) const
edm::ESHandle< Propagator > propagatorPF
Config(edm::ConsumesCollector)
void sort(ConstRecHitContainer &)
TrajectoryStateOnSurface currentState
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
edm::ESHandle< Propagator > propagatorCompatibleDet
virtual DTChamberId chamberId() const
The (specific) DetId of the chamber on which the segment resides.
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
void useSegment(DTRecSegment4D const &, TrajectoryStateOnSurface const &)
void getThresholdFromDB(double &, DetId const &)
void updateWithCSChits(TrajectoryStateOnSurface &, CSCSegment const &)
void testDTstation(TrajectoryStateOnSurface &, std::vector< DTRecSegment4D > const &, double &, DTRecSegment4D &, TrajectoryStateOnSurface &)
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
const GeomDet * idToDet(DetId) const override
std::map< int, bool > usedStationMap
std::unique_ptr< ChamberSegmentUtility > getSegs
void swap(Association< C > &lhs, Association< C > &rhs)
DataContainer const & measurements() const
void preliminaryFit(std::map< int, std::vector< DetId >>, std::map< int, std::vector< DTRecSegment4D >>, std::map< int, std::vector< CSCSegment >>)
TrajectoryStateOnSurface prelFitState
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
GlobalPoint globalPosition() const
edm::ESHandle< MuonDetLayerGeometry > navMuon
ConstRecHitContainer result
std::map< int, DetId > idChamberMap
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
void compatibleDets(TrajectoryStateOnSurface &, std::map< int, std::vector< DetId >> &)
Abs< T >::type abs(const T &t)
std::unique_ptr< ThrParameters > thrManager
void correctThrByPAndEta(double &)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::vector< DytThrStruct > thrsVec
void testCSCstation(TrajectoryStateOnSurface &, std::vector< CSCSegment > const &, double &, CSCSegment &, TrajectoryStateOnSurface &)
edm::ESHandle< TrajectoryStateUpdator > updatorHandle
ConstRecHitContainer prelFitMeas
TransientTrackingRecHit::ConstRecHitContainer filter(const Trajectory &)
void fillSegmentMaps(std::map< int, std::vector< DetId >> &, std::map< int, std::vector< DTRecSegment4D >> &, std::map< int, std::vector< CSCSegment >> &)
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
std::map< dyt_utils::etaRegion, std::vector< double > > parameters
std::unique_ptr< DirectMuonNavigation > navigation
std::vector< ConstRecHitPointer > ConstRecHitContainer
void setThrsMap(const edm::ParameterSet &)
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
const Plane & surface() const
The nominal surface of the GeomDet.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
std::map< DTChamberId, GlobalError > dtApeMap
void update(TrajectoryStateOnSurface &, ConstRecHitPointer)
CSCDetId cscDetId() const
GlobalVector globalMomentum() const
const DYTThrObject * dytThresholds
void fillDYTInfos(int const &, bool const &, int &, double const &, double const &, DTRecSegment4D const &, CSCSegment const &)
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
edm::ESHandle< Propagator > propagator
FreeTrajectoryState const * freeState(bool withErrors=true) const
const std::vector< CSCRecHit2D > & specificRecHits() const
std::map< int, double > estimatorMap
bool chooseLayers(int &, double const &, DTRecSegment4D const &, TrajectoryStateOnSurface const &, double const &, CSCSegment const &, TrajectoryStateOnSurface const &)
int stationfromDet(DetId const &)
static const std::map< etaRegion, std::string > etaRegionStr
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
void updateWithDThits(TrajectoryStateOnSurface &, DTRecSegment4D const &)
edm::ESHandle< MagneticField > magfield
void setThr(const std::vector< int > &)
std::map< CSCDetId, GlobalError > cscApeMap
edm::ESHandle< GlobalTrackingGeometry > theG
edm::ESHandle< CSCGeometry > cscGeom
void setUpdateState(bool)
ConstRecHitPointer const & recHit() const
void getThresholdFromCFG(double &, DetId const &)