16 maxSeeds_(iConfig.getParameter<uint32_t>(
"maxSeeds")),
17 maxHitlessSeeds_(iConfig.getParameter<uint32_t>(
"maxHitlessSeeds")),
18 maxHitSeeds_(iConfig.getParameter<uint32_t>(
"maxHitSeeds")),
19 numOfLayersToTry_(iConfig.getParameter<int32_t>(
"layersToTry")),
20 numOfHitsToTry_(iConfig.getParameter<int32_t>(
"hitsToTry")),
21 numL2ValidHitsCutAllEta_(iConfig.getParameter<uint32_t>(
"numL2ValidHitsCutAllEta")),
22 numL2ValidHitsCutAllEndcap_(iConfig.getParameter<uint32_t>(
"numL2ValidHitsCutAllEndcap")),
23 fixedErrorRescalingForHits_(iConfig.getParameter<double>(
"fixedErrorRescaleFactorForHits")),
24 fixedErrorRescalingForHitless_(iConfig.getParameter<double>(
"fixedErrorRescaleFactorForHitless")),
25 adjustErrorsDynamicallyForHits_(iConfig.getParameter<
bool>(
"adjustErrorsDynamicallyForHits")),
26 adjustErrorsDynamicallyForHitless_(iConfig.getParameter<
bool>(
"adjustErrorsDynamicallyForHitless")),
27 estimatorName_(iConfig.getParameter<
std::
string>(
"estimator")),
28 minEtaForTEC_(iConfig.getParameter<double>(
"minEtaForTEC")),
29 maxEtaForTOB_(iConfig.getParameter<double>(
"maxEtaForTOB")),
30 useHitLessSeeds_(iConfig.getParameter<
bool>(
"UseHitLessSeeds")),
32 measurementTrackerTag_(
34 pT1_(iConfig.getParameter<double>(
"pT1")),
35 pT2_(iConfig.getParameter<double>(
"pT2")),
36 pT3_(iConfig.getParameter<double>(
"pT3")),
37 eta1_(iConfig.getParameter<double>(
"eta1")),
38 eta2_(iConfig.getParameter<double>(
"eta2")),
39 eta3_(iConfig.getParameter<double>(
"eta3")),
40 eta4_(iConfig.getParameter<double>(
"eta4")),
41 eta5_(iConfig.getParameter<double>(
"eta5")),
42 eta6_(iConfig.getParameter<double>(
"eta6")),
43 eta7_(iConfig.getParameter<double>(
"eta7")),
44 SF1_(iConfig.getParameter<double>(
"SF1")),
45 SF2_(iConfig.getParameter<double>(
"SF2")),
46 SF3_(iConfig.getParameter<double>(
"SF3")),
47 SF4_(iConfig.getParameter<double>(
"SF4")),
48 SF5_(iConfig.getParameter<double>(
"SF5")),
49 SF6_(iConfig.getParameter<double>(
"SF6")),
50 SFHld_(iConfig.getParameter<double>(
"SFHld")),
51 SFHd_(iConfig.getParameter<double>(
"SFHd")),
52 tsosDiff1_(iConfig.getParameter<double>(
"tsosDiff1")),
53 tsosDiff2_(iConfig.getParameter<double>(
"tsosDiff2")),
54 displacedReco_(iConfig.getParameter<
bool>(
"displacedReco")),
55 propagatorName_(iConfig.getParameter<
std::
string>(
"propagatorName")),
56 theCategory_(
std::
string(
"Muon|RecoMuon|TSGForOIFromL2")),
63 produces<std::vector<TrajectorySeed> >();
73 unsigned int numSeedsMade = 0;
74 unsigned int layerCount = 0;
75 unsigned int hitlessSeedsMadeIP = 0;
76 unsigned int hitlessSeedsMadeMuS = 0;
77 unsigned int hitSeedsMade = 0;
78 unsigned int hitSeedsMadeMuS = 0;
99 std::unique_ptr<std::vector<TrajectorySeed> >
result(
new std::vector<TrajectorySeed>());
103 std::vector<ForwardDetLayer const*>
const& tecPositive =
107 std::vector<ForwardDetLayer const*>
const& tecNegative =
121 for (
unsigned int l2TrackColIndex(0); l2TrackColIndex != l2TrackCol->size(); ++l2TrackColIndex) {
125 std::vector<TrajectorySeed>
out;
126 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: L2 muon pT, eta, phi --> " << l2->pt() <<
" , " << l2->eta()
127 <<
" , " << l2->phi() << std::endl;
131 dummyPlane->move(fts.
position() - dummyPlane->position());
133 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: Created TSOSatIP: " << tsosAtIP << std::endl;
138 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: Created TSOSatMuonSystem: " << tsosAtMuonSystem
142 <<
"TSGForOIFromL2::produce: Check the error of the L2 parameter and use hit seeds if big errors" << std::endl;
152 double L2muonEta = l2->eta();
153 double absL2muonEta =
std::abs(L2muonEta);
154 bool useBoth =
false;
155 if (outerTkStateInside.isValid() && outerTkStateOutside.
isValid()) {
166 if (absL2muonEta >
eta1_ && absL2muonEta <
eta1_)
171 hitlessSeedsMadeIP = 0;
172 hitlessSeedsMadeMuS = 0;
178 double errorSFHitless =
184 for (
auto it = tob.rbegin();
it != tob.rend(); ++
it) {
185 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: looping in TOB layer " << layerCount << std::endl;
221 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2:::produce: NumSeedsMade = " << numSeedsMade
222 <<
" , layerCount = " << layerCount << std::endl;
228 hitlessSeedsMadeIP = 0;
229 hitlessSeedsMadeMuS = 0;
236 for (
auto it = tecPositive.rbegin();
it != tecPositive.rend(); ++
it) {
237 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: looping in TEC+ layer " << layerCount << std::endl;
272 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2:::produce: NumSeedsMade = " << numSeedsMade
273 <<
" , layerCount = " << layerCount << std::endl;
279 for (
auto it = tecNegative.rbegin();
it != tecNegative.rend(); ++
it) {
280 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: looping in TEC- layer " << layerCount << std::endl;
315 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2:::produce: NumSeedsMade = " << numSeedsMade
316 <<
" , layerCount = " << layerCount << std::endl;
322 for (
auto it = tob.rbegin();
it != tob.rend(); ++
it) {
323 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: looping in TOB layer " << layerCount;
345 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2:::produce: NumSeedsMade = " << numSeedsMade
346 <<
" , layerCount = " << layerCount;
347 if (L2muonEta >= 0.0) {
349 for (
auto it = tecPositive.rbegin();
it != tecPositive.rend(); ++
it) {
350 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: looping in TEC+ layer " << layerCount << std::endl;
372 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2:::produce: NumSeedsMade = " << numSeedsMade
373 <<
" , layerCount = " << layerCount;
378 for (
auto it = tecNegative.rbegin();
it != tecNegative.rend(); ++
it) {
379 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: looping in TEC- layer " << layerCount;
401 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2:::produce: NumSeedsMade = " << numSeedsMade
402 <<
" , layerCount = " << layerCount;
406 for (std::vector<TrajectorySeed>::iterator
it =
out.begin();
it !=
out.end(); ++
it) {
425 unsigned int& hitlessSeedsMade,
426 unsigned int& numSeedsMade,
427 std::vector<TrajectorySeed>&
out)
const {
429 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsWithoutHits: Start hitless" << std::endl;
430 std::vector<GeometricSearchDet::DetWithState> dets;
433 auto const& detOnLayer = dets.front().first;
434 auto const& tsosOnLayer = dets.front().second;
435 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsWithoutHits: tsosOnLayer " << tsosOnLayer << std::endl;
436 if (!tsosOnLayer.isValid()) {
439 dets.front().second.rescaleError(errorSF);
444 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsWithoutHits: TSOS (Hitless) done " << std::endl;
460 unsigned int& hitSeedsMade,
461 unsigned int& numSeedsMade,
462 unsigned int& layerCount,
463 std::vector<TrajectorySeed>&
out)
const {
471 std::vector<GeometricSearchDet::DetWithState> dets;
475 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsFromHits: Find measurements on each detWithState " 476 << dets.size() << std::endl;
477 std::vector<TrajectoryMeasurement> meas;
478 for (std::vector<GeometricSearchDet::DetWithState>::iterator
it = dets.begin();
it != dets.end(); ++
it) {
482 if (!
it->second.isValid())
485 std::vector<TrajectoryMeasurement> mymeas =
487 for (std::vector<TrajectoryMeasurement>::const_iterator it2 = mymeas.begin(), ed2 = mymeas.end(); it2 != ed2;
489 if (it2->recHit()->isValid())
490 meas.push_back(*it2);
495 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsFromHits: Update TSOS using TMs after sorting, then create " 496 "Trajectory Seed, number of TM = " 497 << meas.size() << std::endl;
500 unsigned int found = 0;
501 for (std::vector<TrajectoryMeasurement>::const_iterator
it = meas.begin();
it != meas.end(); ++
it) {
503 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsFromHits: TSOS for TM " <<
found << std::endl;
511 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsFromHits: Number of seedHits: " << seedHits.
size()
544 else if (abseta >
eta6_)
557 else if (abseta >
eta5_)
566 else if (abseta >
eta5_)
570 LogTrace(
theCategory_) <<
"TSGForOIFromL2::calculateSFFromL2: SF has been calculated as: " << theSF;
585 bool ierr = !
m.Invert();
588 edm::LogInfo(
"TSGForOIFromL2") <<
"Error inverting covariance matrix";
592 double est = ROOT::Math::Similarity(
v,
m);
603 desc.add<
int>(
"layersToTry", 2);
604 desc.add<
double>(
"fixedErrorRescaleFactorForHitless", 2.0);
605 desc.add<
int>(
"hitsToTry", 1);
606 desc.add<
bool>(
"adjustErrorsDynamicallyForHits",
false);
607 desc.add<
bool>(
"adjustErrorsDynamicallyForHitless",
true);
609 desc.add<
bool>(
"UseHitLessSeeds",
true);
610 desc.add<
std::string>(
"estimator",
"hltESPChi2MeasurementEstimator100");
611 desc.add<
double>(
"maxEtaForTOB", 1.8);
612 desc.add<
double>(
"minEtaForTEC", 0.7);
613 desc.addUntracked<
bool>(
"debug",
false);
614 desc.add<
double>(
"fixedErrorRescaleFactorForHits", 1.0);
615 desc.add<
unsigned int>(
"maxSeeds", 20);
616 desc.add<
unsigned int>(
"maxHitlessSeeds", 5);
617 desc.add<
unsigned int>(
"maxHitSeeds", 1);
618 desc.add<
unsigned int>(
"numL2ValidHitsCutAllEta", 20);
619 desc.add<
unsigned int>(
"numL2ValidHitsCutAllEndcap", 30);
620 desc.add<
double>(
"pT1", 13.0);
621 desc.add<
double>(
"pT2", 30.0);
622 desc.add<
double>(
"pT3", 70.0);
623 desc.add<
double>(
"eta1", 0.2);
624 desc.add<
double>(
"eta2", 0.3);
625 desc.add<
double>(
"eta3", 1.0);
626 desc.add<
double>(
"eta4", 1.2);
627 desc.add<
double>(
"eta5", 1.6);
628 desc.add<
double>(
"eta6", 1.4);
629 desc.add<
double>(
"eta7", 2.1);
630 desc.add<
double>(
"SF1", 3.0);
631 desc.add<
double>(
"SF2", 4.0);
632 desc.add<
double>(
"SF3", 5.0);
633 desc.add<
double>(
"SF4", 7.0);
634 desc.add<
double>(
"SF5", 10.0);
635 desc.add<
double>(
"SF6", 2.0);
636 desc.add<
double>(
"SFHld", 2.0)->setComment(
"Scale Factor used to rescale the TSOS error of the hitless seeds");
637 desc.add<
double>(
"SFHd", 4.0)->setComment(
"Scale Factor used to rescale the TSOS error of the hit based seeds");
638 desc.add<
double>(
"tsosDiff1", 0.2);
639 desc.add<
double>(
"tsosDiff2", 0.02);
640 desc.add<
bool>(
"displacedReco",
false)->setComment(
"Flag to turn on the displaced seeding");
641 desc.add<
std::string>(
"propagatorName",
"PropagatorWithMaterialParabolicMf");
642 descriptions.
add(
"TSGForOIFromL2",
desc);
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const bool useHitLessSeeds_
void rescaleError(double factor)
std::vector< ForwardDetLayer const * > const & posTecLayers() const
TSGForOIFromL2(const edm::ParameterSet &iConfig)
const LocalTrajectoryError & localError() const
std::vector< TrajectoryMeasurement > fastMeasurements(const TrajectoryStateOnSurface &stateOnThisDet, const TrajectoryStateOnSurface &tsos2, const Propagator &prop, const MeasurementEstimator &est) const
const unsigned int numOfHitsToTry_
How many hits to try per layer.
const double minEtaForTEC_
Minimum eta value to activate searching in the TEC.
std::vector< Track > TrackCollection
collection of Tracks
const unsigned int maxHitSeeds_
Maximum number of hitbased seeds for each L2.
const LocalTrajectoryParameters & localParameters() const
double calculateSFFromL2(const reco::TrackRef track) const
Calculate the dynamic error SF by analysing the L2.
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tmpTkGeometryToken_
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > geometryToken_
double match_Chi2(const TrajectoryStateOnSurface &tsos1, const TrajectoryStateOnSurface &tsos2) const
Find compatability between two TSOSs.
static PlanePointer build(Args &&... args)
GlobalPoint position() const
const edm::ESGetToken< Chi2MeasurementEstimatorBase, TrackingComponentsRecord > estimatorToken_
const unsigned int maxHitlessSeeds_
Maximum number of hitless seeds for each L2.
std::unique_ptr< Propagator > SetPropagationDirection(Propagator const &iprop, PropagationDirection dir)
T const * product() const
bool isThere(GeomDetEnumerators::SubDetector subdet) const
const edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
const unsigned int numL2ValidHitsCutAllEndcap_
AlgebraicVector5 vector() const
void produce(edm::StreamID sid, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
const unsigned int maxSeeds_
Maximum number of seeds for each L2.
Abs< T >::type abs(const T &t)
ROOT::Math::SVector< double, 5 > AlgebraicVector5
void makeSeedsWithoutHits(const GeometricSearchDet &layer, const TrajectoryStateOnSurface &tsos, const Propagator &propagatorAlong, const edm::ESHandle< Chi2MeasurementEstimatorBase > &estimator, double errorSF, unsigned int &hitlessSeedsMade, unsigned int &numSeedsMade, std::vector< TrajectorySeed > &out) const
Create seeds without hits on a given layer (TOB or TEC)
const std::unique_ptr< TrajectoryStateUpdator > updator_
KFUpdator defined in constructor.
const double fixedErrorRescalingForHits_
Rescale L2 parameter uncertainties (fixed error vs pT, eta)
const double maxEtaForTOB_
Maximum eta value to activate searching in the TOB.
#define DEFINE_FWK_MODULE(type)
const bool adjustErrorsDynamicallyForHits_
Whether or not to use an automatically calculated scale-factor value.
const std::string theCategory_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
const edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrackerTag_
const unsigned int numL2ValidHitsCutAllEta_
L2 valid hit cuts to decide seed creation by both states.
~TSGForOIFromL2() override
std::vector< ForwardDetLayer const * > const & negTidLayers() const
Log< level::Info, false > LogInfo
std::vector< ForwardDetLayer const * > const & posTidLayers() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const GeometricSearchTracker * geometricSearchTracker() const
const edm::EDGetTokenT< reco::TrackCollection > src_
Labels for input collections.
std::vector< BarrelDetLayer const * > const & tobLayers() const
const bool adjustErrorsDynamicallyForHitless_
const edm::ESGetToken< Propagator, TrackingComponentsRecord > sHPOppositeToken_
const AlgebraicSymMatrix55 & matrix() const
const bool displacedReco_
Displaced reconstruction.
std::vector< ForwardDetLayer const * > const & negTecLayers() const
Create L3MuonTrajectorySeeds from L2 Muons updated at vertex in an outside-in manner.
void makeSeedsFromHits(const GeometricSearchDet &layer, const TrajectoryStateOnSurface &tsos, const Propagator &propagatorAlong, const edm::ESHandle< Chi2MeasurementEstimatorBase > &estimator, const edm::Handle< MeasurementTrackerEvent > &measurementTracker, double errorSF, unsigned int &hitSeedsMade, unsigned int &numSeedsMade, unsigned int &layerCount, std::vector< TrajectorySeed > &out) const
Find hits on a given layer (TOB or TEC) and create seeds from updated TSOS with hit.
const unsigned int numOfLayersToTry_
How many layers to try.
const double pT1_
pT, eta ranges and scale factor values
const double fixedErrorRescalingForHitless_