15 maxSeeds_(iConfig.getParameter<uint32_t>(
"maxSeeds")),
16 maxHitlessSeeds_(iConfig.getParameter<uint32_t>(
"maxHitlessSeeds")),
17 maxHitSeeds_(iConfig.getParameter<uint32_t>(
"maxHitSeeds")),
18 numOfLayersToTry_(iConfig.getParameter<int32_t>(
"layersToTry")),
19 numOfHitsToTry_(iConfig.getParameter<int32_t>(
"hitsToTry")),
20 numL2ValidHitsCutAllEta_(iConfig.getParameter<uint32_t>(
"numL2ValidHitsCutAllEta")),
21 numL2ValidHitsCutAllEndcap_(iConfig.getParameter<uint32_t>(
"numL2ValidHitsCutAllEndcap")),
22 fixedErrorRescalingForHits_(iConfig.getParameter<double>(
"fixedErrorRescaleFactorForHits")),
23 fixedErrorRescalingForHitless_(iConfig.getParameter<double>(
"fixedErrorRescaleFactorForHitless")),
24 adjustErrorsDynamicallyForHits_(iConfig.getParameter<
bool>(
"adjustErrorsDynamicallyForHits")),
25 adjustErrorsDynamicallyForHitless_(iConfig.getParameter<
bool>(
"adjustErrorsDynamicallyForHitless")),
26 estimatorName_(iConfig.getParameter<
std::
string>(
"estimator")),
27 minEtaForTEC_(iConfig.getParameter<double>(
"minEtaForTEC")),
28 maxEtaForTOB_(iConfig.getParameter<double>(
"maxEtaForTOB")),
29 useHitLessSeeds_(iConfig.getParameter<
bool>(
"UseHitLessSeeds")),
31 measurementTrackerTag_(
33 pT1_(iConfig.getParameter<double>(
"pT1")),
34 pT2_(iConfig.getParameter<double>(
"pT2")),
35 pT3_(iConfig.getParameter<double>(
"pT3")),
36 eta1_(iConfig.getParameter<double>(
"eta1")),
37 eta2_(iConfig.getParameter<double>(
"eta2")),
38 eta3_(iConfig.getParameter<double>(
"eta3")),
39 eta4_(iConfig.getParameter<double>(
"eta4")),
40 eta5_(iConfig.getParameter<double>(
"eta5")),
41 eta6_(iConfig.getParameter<double>(
"eta6")),
42 eta7_(iConfig.getParameter<double>(
"eta7")),
43 SF1_(iConfig.getParameter<double>(
"SF1")),
44 SF2_(iConfig.getParameter<double>(
"SF2")),
45 SF3_(iConfig.getParameter<double>(
"SF3")),
46 SF4_(iConfig.getParameter<double>(
"SF4")),
47 SF5_(iConfig.getParameter<double>(
"SF5")),
48 SF6_(iConfig.getParameter<double>(
"SF6")),
49 tsosDiff1_(iConfig.getParameter<double>(
"tsosDiff1")),
50 tsosDiff2_(iConfig.getParameter<double>(
"tsosDiff2")),
51 propagatorName_(iConfig.getParameter<
std::
string>(
"propagatorName")),
52 theCategory_(
std::
string(
"Muon|RecoMuon|TSGForOIFromL2")) {
53 produces<std::vector<TrajectorySeed> >();
63 unsigned int numSeedsMade = 0;
64 unsigned int layerCount = 0;
65 unsigned int hitlessSeedsMadeIP = 0;
66 unsigned int hitlessSeedsMadeMuS = 0;
67 unsigned int hitSeedsMade = 0;
94 std::unique_ptr<std::vector<TrajectorySeed> >
result(
new std::vector<TrajectorySeed>());
98 std::vector<ForwardDetLayer const*>
const& tecPositive =
102 std::vector<ForwardDetLayer const*>
const& tecNegative =
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());
420 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)
MeasurementDetWithData idToDet(const DetId &id) const
Previous MeasurementDetSystem interface.
void makeSeedsFromHits(const GeometricSearchDet &layer, const TrajectoryStateOnSurface &tsos, const Propagator &propagatorAlong, edm::ESHandle< Chi2MeasurementEstimatorBase > &estimator, 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.
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.
const double minEtaForTEC_
Minimum eta value to activate searching in the TEC.
const std::string estimatorName_
Estimator used to find dets and TrajectoryMeasurements.
std::vector< Track > TrackCollection
collection of Tracks
const unsigned int maxHitSeeds_
Maximum number of hitbased seeds for each L2.
std::vector< BarrelDetLayer const * > const & tobLayers() const
void produce(edm::StreamID sid, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
bool isThere(GeomDetEnumerators::SubDetector subdet) const
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)
#define DEFINE_FWK_MODULE(type)
std::vector< TrajectoryMeasurement > fastMeasurements(const TrajectoryStateOnSurface &stateOnThisDet, const TrajectoryStateOnSurface &tsos2, const Propagator &prop, const MeasurementEstimator &est) const
static PlanePointer build(Args &&...args)
const unsigned int numL2ValidHitsCutAllEndcap_
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_
void makeSeedsWithoutHits(const GeometricSearchDet &layer, const TrajectoryStateOnSurface &tsos, const Propagator &propagatorAlong, 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< MeasurementTrackerEvent > measurementTrackerTag_
const unsigned int numL2ValidHitsCutAllEta_
L2 valid hit cuts to decide seed creation by both states.
~TSGForOIFromL2() override
GlobalPoint position() const
double match_Chi2(const TrajectoryStateOnSurface &tsos1, const TrajectoryStateOnSurface &tsos2) const
Find compatability between two TSOSs.
std::vector< ForwardDetLayer const * > const & posTecLayers() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< ForwardDetLayer const * > const & negTidLayers() const
const edm::EDGetTokenT< reco::TrackCollection > src_
Labels for input collections.
std::vector< ForwardDetLayer const * > const & posTidLayers() const
double calculateSFFromL2(const reco::TrackRef track) const
Calculate the dynamic error SF by analysing the L2.
const bool adjustErrorsDynamicallyForHitless_
std::vector< ForwardDetLayer const * > const & negTecLayers() const
Create L3MuonTrajectorySeeds from L2 Muons updated at vertex in an outside-in manner.
T const * product() const
const unsigned int numOfLayersToTry_
How many layers to try.
const std::string propagatorName_
Counters and flags for the implementation.
const GeometricSearchTracker * geometricSearchTracker() const
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_