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 tsosDiff1_(iConfig.getParameter<double>(
"tsosDiff1")),
51 tsosDiff2_(iConfig.getParameter<double>(
"tsosDiff2")),
52 propagatorName_(iConfig.getParameter<std::
string>(
"propagatorName")),
53 theCategory_(std::
string(
"Muon|RecoMuon|TSGForOIFromL2")),
60 produces<std::vector<TrajectorySeed> >();
70 unsigned int numSeedsMade = 0;
71 unsigned int layerCount = 0;
72 unsigned int hitlessSeedsMadeIP = 0;
73 unsigned int hitlessSeedsMadeMuS = 0;
74 unsigned int hitSeedsMade = 0;
95 std::unique_ptr<std::vector<TrajectorySeed> >
result(
new std::vector<TrajectorySeed>());
98 std::vector<BarrelDetLayer const*>
const& tob = measurementTrackerH->geometricSearchTracker()->tobLayers();
99 std::vector<ForwardDetLayer const*>
const& tecPositive =
101 ? measurementTrackerH->geometricSearchTracker()->posTidLayers()
102 : measurementTrackerH->geometricSearchTracker()->posTecLayers();
103 std::vector<ForwardDetLayer const*>
const& tecNegative =
105 ? measurementTrackerH->geometricSearchTracker()->negTidLayers()
106 : measurementTrackerH->geometricSearchTracker()->negTecLayers();
117 for (
unsigned int l2TrackColIndex(0); l2TrackColIndex != l2TrackCol->size(); ++l2TrackColIndex) {
121 std::vector<TrajectorySeed>
out;
122 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: L2 muon pT, eta, phi --> " << l2->pt() <<
" , " << l2->eta()
123 <<
" , " << l2->phi() << std::endl;
127 dummyPlane->move(fts.
position() - dummyPlane->position());
129 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: Created TSOSatIP: " << tsosAtIP << std::endl;
134 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: Created TSOSatMuonSystem: " << tsosAtMuonSystem
138 <<
"TSGForOIFromL2::produce: Check the error of the L2 parameter and use hit seeds if big errors" << std::endl;
148 double L2muonEta = l2->eta();
149 double absL2muonEta =
std::abs(L2muonEta);
150 bool useBoth =
false;
151 if (outerTkStateInside.isValid() && outerTkStateOutside.
isValid()) {
162 if (absL2muonEta >
eta1_ && absL2muonEta <
eta1_)
167 hitlessSeedsMadeIP = 0;
168 hitlessSeedsMadeMuS = 0;
173 double errorSFHitless =
179 for (
auto it = tob.rbegin(); it != tob.rend(); ++it) {
180 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: looping in TOB layer " << layerCount << std::endl;
184 *(propagatorAlong.get()),
195 *(propagatorAlong.get()),
208 *(propagatorOpposite.get()),
216 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2:::produce: NumSeedsMade = " << numSeedsMade
217 <<
" , layerCount = " << layerCount << std::endl;
223 hitlessSeedsMadeIP = 0;
224 hitlessSeedsMadeMuS = 0;
231 for (
auto it = tecPositive.rbegin(); it != tecPositive.rend(); ++it) {
232 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: looping in TEC+ layer " << layerCount << std::endl;
236 *(propagatorAlong.get()),
246 *(propagatorAlong.get()),
259 *(propagatorOpposite.get()),
267 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2:::produce: NumSeedsMade = " << numSeedsMade
268 <<
" , layerCount = " << layerCount << std::endl;
274 for (
auto it = tecNegative.rbegin(); it != tecNegative.rend(); ++it) {
275 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: looping in TEC- layer " << layerCount << std::endl;
279 *(propagatorAlong.get()),
289 *(propagatorAlong.get()),
302 *(propagatorOpposite.get()),
310 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2:::produce: NumSeedsMade = " << numSeedsMade
311 <<
" , layerCount = " << layerCount << std::endl;
314 for (std::vector<TrajectorySeed>::iterator it = out.begin(); it != out.end(); ++it) {
315 result->push_back(*it);
333 unsigned int& hitlessSeedsMade,
334 unsigned int& numSeedsMade,
335 std::vector<TrajectorySeed>&
out)
const {
337 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsWithoutHits: Start hitless" << std::endl;
338 std::vector<GeometricSearchDet::DetWithState> dets;
341 auto const& detOnLayer = dets.front().first;
342 auto const& tsosOnLayer = dets.front().second;
343 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsWithoutHits: tsosOnLayer " << tsosOnLayer << std::endl;
344 if (!tsosOnLayer.isValid()) {
347 dets.front().second.rescaleError(errorSF);
352 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsWithoutHits: TSOS (Hitless) done " << std::endl;
368 unsigned int& hitSeedsMade,
369 unsigned int& numSeedsMade,
370 unsigned int& layerCount,
371 std::vector<TrajectorySeed>&
out)
const {
379 std::vector<GeometricSearchDet::DetWithState> dets;
383 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsFromHits: Find measurements on each detWithState "
384 << dets.size() << std::endl;
385 std::vector<TrajectoryMeasurement> meas;
386 for (std::vector<GeometricSearchDet::DetWithState>::iterator it = dets.begin(); it != dets.end(); ++it) {
390 if (!it->second.isValid())
393 std::vector<TrajectoryMeasurement> mymeas =
395 for (std::vector<TrajectoryMeasurement>::const_iterator it2 = mymeas.begin(), ed2 = mymeas.end(); it2 != ed2;
397 if (it2->recHit()->isValid())
398 meas.push_back(*it2);
403 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsFromHits: Update TSOS using TMs after sorting, then create "
404 "Trajectory Seed, number of TM = "
405 << meas.size() << std::endl;
408 unsigned int found = 0;
409 for (std::vector<TrajectoryMeasurement>::const_iterator it = meas.begin(); it != meas.end(); ++it) {
411 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsFromHits: TSOS for TM " << found << std::endl;
416 seedHits.
push_back(*it->recHit()->hit());
419 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsFromHits: Number of seedHits: " << seedHits.
size()
444 double abseta =
std::abs(track->eta());
445 if (track->pt() <=
pT1_)
447 else if (track->pt() >
pT1_ && track->pt() <=
pT2_) {
452 else if (abseta >
eta6_)
454 }
else if (track->pt() >
pT2_ && track->pt() <=
pT3_) {
465 else if (abseta >
eta5_)
467 }
else if (track->pt() >
pT3_) {
474 else if (abseta >
eta5_)
478 LogTrace(
theCategory_) <<
"TSGForOIFromL2::calculateSFFromL2: SF has been calculated as: " << theSF;
493 bool ierr = !
m.Invert();
496 edm::LogInfo(
"TSGForOIFromL2") <<
"Error inverting covariance matrix";
500 double est = ROOT::Math::Similarity(
v,
m);
511 desc.
add<
int>(
"layersToTry", 2);
512 desc.
add<
double>(
"fixedErrorRescaleFactorForHitless", 2.0);
513 desc.
add<
int>(
"hitsToTry", 1);
514 desc.
add<
bool>(
"adjustErrorsDynamicallyForHits",
false);
515 desc.
add<
bool>(
"adjustErrorsDynamicallyForHitless",
true);
517 desc.
add<
bool>(
"UseHitLessSeeds",
true);
518 desc.
add<
std::string>(
"estimator",
"hltESPChi2MeasurementEstimator100");
519 desc.
add<
double>(
"maxEtaForTOB", 1.8);
520 desc.
add<
double>(
"minEtaForTEC", 0.7);
522 desc.
add<
double>(
"fixedErrorRescaleFactorForHits", 1.0);
523 desc.
add<
unsigned int>(
"maxSeeds", 20);
524 desc.
add<
unsigned int>(
"maxHitlessSeeds", 5);
525 desc.
add<
unsigned int>(
"maxHitSeeds", 1);
526 desc.
add<
unsigned int>(
"numL2ValidHitsCutAllEta", 20);
527 desc.
add<
unsigned int>(
"numL2ValidHitsCutAllEndcap", 30);
528 desc.
add<
double>(
"pT1", 13.0);
529 desc.
add<
double>(
"pT2", 30.0);
530 desc.
add<
double>(
"pT3", 70.0);
531 desc.
add<
double>(
"eta1", 0.2);
532 desc.
add<
double>(
"eta2", 0.3);
533 desc.
add<
double>(
"eta3", 1.0);
534 desc.
add<
double>(
"eta4", 1.2);
535 desc.
add<
double>(
"eta5", 1.6);
536 desc.
add<
double>(
"eta6", 1.4);
537 desc.
add<
double>(
"eta7", 2.1);
538 desc.
add<
double>(
"SF1", 3.0);
539 desc.
add<
double>(
"SF2", 4.0);
540 desc.
add<
double>(
"SF3", 5.0);
541 desc.
add<
double>(
"SF4", 7.0);
542 desc.
add<
double>(
"SF5", 10.0);
543 desc.
add<
double>(
"SF6", 2.0);
544 desc.
add<
double>(
"tsosDiff1", 0.2);
545 desc.
add<
double>(
"tsosDiff2", 0.02);
546 desc.
add<
std::string>(
"propagatorName",
"PropagatorWithMaterialParabolicMf");
547 descriptions.
add(
"TSGForOIFromL2", desc);
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const bool useHitLessSeeds_
void rescaleError(double factor)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
TSGForOIFromL2(const edm::ParameterSet &iConfig)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
const LocalTrajectoryParameters & localParameters() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const unsigned int numOfHitsToTry_
How many hits to try per layer.
#define DEFINE_FWK_MODULE(type)
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 edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tmpTkGeometryToken_
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > geometryToken_
constexpr std::array< uint8_t, layerIndexSize > layer
const edm::ESGetToken< Chi2MeasurementEstimatorBase, TrackingComponentsRecord > estimatorToken_
const unsigned int maxHitlessSeeds_
Maximum number of hitless seeds for each L2.
AlgebraicVector5 vector() const
std::unique_ptr< Propagator > SetPropagationDirection(Propagator const &iprop, PropagationDirection dir)
std::vector< TrajectoryMeasurement > fastMeasurements(const TrajectoryStateOnSurface &stateOnThisDet, const TrajectoryStateOnSurface &tsos2, const Propagator &prop, const MeasurementEstimator &est) const
static PlanePointer build(Args &&...args)
const edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
const unsigned int numL2ValidHitsCutAllEndcap_
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
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.
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
const bool adjustErrorsDynamicallyForHits_
Whether or not to use an automatically calculated scale-factor value.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const std::string theCategory_
const edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrackerTag_
const unsigned int numL2ValidHitsCutAllEta_
L2 valid hit cuts to decide seed creation by both states.
~TSGForOIFromL2() override
Log< level::Info, false > LogInfo
GlobalPoint position() const
double match_Chi2(const TrajectoryStateOnSurface &tsos1, const TrajectoryStateOnSurface &tsos2) const
Find compatability between two TSOSs.
T const * product() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
void add(std::string const &label, ParameterSetDescription const &psetDescription)
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 edm::EDGetTokenT< reco::TrackCollection > src_
Labels for input collections.
double calculateSFFromL2(const reco::TrackRef track) const
Calculate the dynamic error SF by analysing the L2.
const bool adjustErrorsDynamicallyForHitless_
const edm::ESGetToken< Propagator, TrackingComponentsRecord > sHPOppositeToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) 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.
virtual void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
const double pT1_
pT, eta ranges and scale factor values
const double fixedErrorRescalingForHitless_