37 static const std::map<etaRegion, std::string>
etaRegionStr{{etaRegion::eta0p8,
"eta0p8"},
38 {etaRegion::eta1p2,
"eta1p2"},
39 {etaRegion::eta2p0,
"eta2p0"},
40 {etaRegion::eta2p2,
"eta2p2"},
41 {etaRegion::eta2p4,
"eta2p4"}};
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) {
117 const CSCLayer *cscLayer =
cscGeom->layer((*it)->det()->geographicalId());
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++) {
352 tsosdt =
propagator->propagate(startingState,
theG->idToDet(chamber)->surface());
360 if (estimator >= bestEstimator)
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++) {
376 CSCDetId chamber(segments[iSeg].cscDetId());
379 tsoscsc =
propagator->propagate(startingState,
theG->idToDet(chamber)->surface());
387 if (estimator >= bestEstimator)
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)
578 if (recHits[j - 1]->globalPosition().
mag() > recHits[j]->globalPosition().
mag())
579 swap(recHits[j - 1], recHits[j]);
dyt_utils::etaRegion region
DynamicTruncation(Config const &, const edm::EventSetup &, const MuonServiceProxy &)
edm::ESHandle< Propagator > propagatorPF
Config(edm::ConsumesCollector)
CSCDetId cscDetId() const
ConstRecHitPointer const & recHit() const
void sort(ConstRecHitContainer &)
TrajectoryStateOnSurface currentState
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
uint16_t *__restrict__ id
const edm::ESGetToken< TrajectoryStateUpdator, TrackingComponentsRecord > updatorToken_
edm::ESHandle< Propagator > propagatorCompatibleDet
const edm::ESGetToken< MuonDetLayerGeometry, MuonRecoGeometryRecord > navMuonToken_
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
void useSegment(DTRecSegment4D const &, TrajectoryStateOnSurface const &)
GlobalPoint globalPosition() const
void getThresholdFromDB(double &, DetId const &)
virtual DTChamberId chamberId() const
The (specific) DetId of the chamber on which the segment resides.
const edm::ESGetToken< AlignmentErrorsExtended, CSCAlignmentErrorExtendedRcd > cscAlignmentErrorsToken_
void updateWithCSChits(TrajectoryStateOnSurface &, CSCSegment const &)
void testDTstation(TrajectoryStateOnSurface &, std::vector< DTRecSegment4D > const &, double &, DTRecSegment4D &, TrajectoryStateOnSurface &)
const edm::ESGetToken< DYTThrObject, DYTThrObjectRcd > dytThresholdsToken_
const Plane & surface() const
The nominal surface of the GeomDet.
std::map< int, bool > usedStationMap
std::unique_ptr< ChamberSegmentUtility > getSegs
void swap(Association< C > &lhs, Association< C > &rhs)
void preliminaryFit(std::map< int, std::vector< DetId >>, std::map< int, std::vector< DTRecSegment4D >>, std::map< int, std::vector< CSCSegment >>)
bool getData(T &iHolder) const
TrajectoryStateOnSurface prelFitState
DataContainer const & measurements() const
const edm::ESGetToken< CSCGeometry, MuonGeometryRecord > cscGeomToken_
edm::ESHandle< MuonDetLayerGeometry > navMuon
ConstRecHitContainer result
std::map< int, DetId > idChamberMap
FreeTrajectoryState const * freeState(bool withErrors=true) const
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
void compatibleDets(TrajectoryStateOnSurface &, std::map< int, std::vector< DetId >> &)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
Abs< T >::type abs(const T &t)
std::unique_ptr< ThrParameters > thrManager
const edm::ESGetToken< AlignmentErrorsExtended, DTAlignmentErrorExtendedRcd > dtAlignmentErrorsToken_
void correctThrByPAndEta(double &)
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 >> &)
const std::vector< CSCRecHit2D > & specificRecHits() const
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
std::map< dyt_utils::etaRegion, std::vector< double > > parameters
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
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)
std::map< DTChamberId, GlobalError > dtApeMap
void update(TrajectoryStateOnSurface &, ConstRecHitPointer)
T getParameter(std::string const &) 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
tuple config
parse the configuration file
GlobalVector globalMomentum() const
std::map< int, double > estimatorMap
bool chooseLayers(int &, double const &, DTRecSegment4D const &, TrajectoryStateOnSurface const &, double const &, CSCSegment const &, TrajectoryStateOnSurface const &)
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > muonRecHitBuilderToken_
int stationfromDet(DetId const &)
DetId geographicalId() const
static const std::map< etaRegion, std::string > etaRegionStr
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
int station() const
Return the station number.
void updateWithDThits(TrajectoryStateOnSurface &, DTRecSegment4D const &)
edm::ESHandle< MagneticField > magfield
void setThr(const std::vector< int > &)
std::map< CSCDetId, GlobalError > cscApeMap
edm::ESHandle< GlobalTrackingGeometry > theG
Power< A, B >::type pow(const A &a, const B &b)
edm::ESHandle< CSCGeometry > cscGeom
void setUpdateState(bool)
void getThresholdFromCFG(double &, DetId const &)
constexpr Detector det() const
get the detector field from this detid
tuple Chi2MeasurementEstimator