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 pT1_(iConfig.getParameter<double>(
"pT1")),
33 pT2_(iConfig.getParameter<double>(
"pT2")),
34 pT3_(iConfig.getParameter<double>(
"pT3")),
35 eta1_(iConfig.getParameter<double>(
"eta1")),
36 eta2_(iConfig.getParameter<double>(
"eta2")),
37 eta3_(iConfig.getParameter<double>(
"eta3")),
38 eta4_(iConfig.getParameter<double>(
"eta4")),
39 eta5_(iConfig.getParameter<double>(
"eta5")),
40 eta6_(iConfig.getParameter<double>(
"eta6")),
41 eta7_(iConfig.getParameter<double>(
"eta7")),
42 SF1_(iConfig.getParameter<double>(
"SF1")),
43 SF2_(iConfig.getParameter<double>(
"SF2")),
44 SF3_(iConfig.getParameter<double>(
"SF3")),
45 SF4_(iConfig.getParameter<double>(
"SF4")),
46 SF5_(iConfig.getParameter<double>(
"SF5")),
47 SF6_(iConfig.getParameter<double>(
"SF6")),
48 tsosDiff1_(iConfig.getParameter<double>(
"tsosDiff1")),
49 tsosDiff2_(iConfig.getParameter<double>(
"tsosDiff2")),
50 propagatorName_(iConfig.getParameter<
std::
string>(
"propagatorName")),
51 theCategory_(
std::
string(
"Muon|RecoMuon|TSGForOIFromL2"))
53 produces<std::vector<TrajectorySeed> >();
66 unsigned int numSeedsMade = 0;
67 unsigned int layerCount = 0;
68 unsigned int hitlessSeedsMadeIP = 0;
69 unsigned int hitlessSeedsMadeMuS = 0;
70 unsigned int hitSeedsMade = 0;
97 std::unique_ptr<std::vector<TrajectorySeed> >
result(
new std::vector<TrajectorySeed>());
118 for (
unsigned int l2TrackColIndex(0); l2TrackColIndex!=l2TrackCol->size(); ++l2TrackColIndex) {
123 std::vector<TrajectorySeed>
out;
124 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: L2 muon pT, eta, phi --> " << l2->pt() <<
" , " << l2->eta() <<
" , " << l2->phi() << std::endl;
128 dummyPlane->move(fts.
position() - dummyPlane->position());
130 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: Created TSOSatIP: " << tsosAtIP << std::endl;
134 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: Created TSOSatMuonSystem: " << tsosAtMuonSystem <<std::endl;
136 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: Check the error of the L2 parameter and use hit seeds if big errors" << std::endl;
146 double L2muonEta=l2->eta();
147 double absL2muonEta=
std::abs(L2muonEta);
148 bool useBoth =
false;
149 if (outerTkStateInside.isValid() && outerTkStateOutside.
isValid()) {
158 if (absL2muonEta >
eta1_ && absL2muonEta <
eta1_) useBoth =
true;
162 hitlessSeedsMadeIP = 0;
163 hitlessSeedsMadeMuS = 0;
173 for (
auto it=tob.rbegin(); it!=tob.rend(); ++it) {
174 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: looping in TOB layer " << layerCount << std::endl;
176 makeSeedsWithoutHits(**it, tsosAtIP, *(propagatorAlong.get()), estimatorH, errorSFHitless, hitlessSeedsMadeIP, numSeedsMade, out);
180 makeSeedsFromHits(**it, tsosAtIP, *(propagatorAlong.get()), estimatorH, measurementTrackerH, errorSFHits, hitSeedsMade, numSeedsMade, layerCount, out);
184 makeSeedsWithoutHits(**it, outerTkStateOutside, *(propagatorOpposite.get()), estimatorH, errorSFHitless, hitlessSeedsMadeMuS, numSeedsMade, out);
187 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2:::produce: NumSeedsMade = " << numSeedsMade <<
" , layerCount = " << layerCount << std::endl;
193 hitlessSeedsMadeIP = 0;
194 hitlessSeedsMadeMuS = 0;
201 for (
auto it=tecPositive.rbegin(); it!=tecPositive.rend(); ++it) {
202 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: looping in TEC+ layer " << layerCount << std::endl;
204 makeSeedsWithoutHits(**it, tsosAtIP, *(propagatorAlong.get()), estimatorH, errorSFHitless, hitlessSeedsMadeIP, numSeedsMade, out);
207 makeSeedsFromHits(**it, tsosAtIP, *(propagatorAlong.get()), estimatorH, measurementTrackerH, errorSFHits, hitSeedsMade, numSeedsMade, layerCount, out);
211 makeSeedsWithoutHits(**it, outerTkStateOutside, *(propagatorOpposite.get()), estimatorH, errorSFHitless, hitlessSeedsMadeMuS, numSeedsMade, out);
214 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2:::produce: NumSeedsMade = " << numSeedsMade <<
" , layerCount = " << layerCount << std::endl;
220 for (
auto it=tecNegative.rbegin(); it!=tecNegative.rend(); ++it) {
221 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::produce: looping in TEC- layer " << layerCount << std::endl;
223 makeSeedsWithoutHits(**it, tsosAtIP, *(propagatorAlong.get()), estimatorH, errorSFHitless, hitlessSeedsMadeIP, numSeedsMade, out);
226 makeSeedsFromHits(**it, tsosAtIP, *(propagatorAlong.get()), estimatorH, measurementTrackerH, errorSFHits, hitSeedsMade, numSeedsMade, layerCount, out);
230 makeSeedsWithoutHits(**it, outerTkStateOutside, *(propagatorOpposite.get()), estimatorH, errorSFHitless, hitlessSeedsMadeMuS, numSeedsMade, out);
233 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2:::produce: NumSeedsMade = " << numSeedsMade <<
" , layerCount = " << layerCount << std::endl;
236 for (std::vector<TrajectorySeed>::iterator it=out.begin(); it!=out.end(); ++it) {
237 result->push_back(*it);
257 unsigned int& hitlessSeedsMade,
258 unsigned int& numSeedsMade,
259 std::vector<TrajectorySeed>&
out)
const {
262 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsWithoutHits: Start hitless" << std::endl;
263 std::vector< GeometricSearchDet::DetWithState > dets;
266 auto const& detOnLayer = dets.front().first;
267 auto const& tsosOnLayer = dets.front().second;
268 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsWithoutHits: tsosOnLayer " << tsosOnLayer << std::endl;
269 if (!tsosOnLayer.isValid()) {
273 dets.front().second.rescaleError(errorSF);
277 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsWithoutHits: TSOS (Hitless) done " << std::endl;
296 unsigned int& hitSeedsMade,
297 unsigned int& numSeedsMade,
298 unsigned int& layerCount,
299 std::vector<TrajectorySeed>&
out)
const {
307 std::vector< GeometricSearchDet::DetWithState > dets;
311 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsFromHits: Find measurements on each detWithState " << dets.size() << std::endl;
312 std::vector<TrajectoryMeasurement> meas;
313 for (std::vector<GeometricSearchDet::DetWithState>::iterator it=dets.begin(); it!=dets.end(); ++it) {
315 if (det.
isNull())
continue;
316 if (!it->second.isValid())
continue;
318 std::vector <TrajectoryMeasurement> mymeas = det.
fastMeasurements(it->second, onLayer, propagatorAlong, *estimator);
319 for (std::vector<TrajectoryMeasurement>::const_iterator it2 = mymeas.begin(), ed2 = mymeas.end(); it2 != ed2; ++it2) {
320 if (it2->recHit()->isValid()) meas.push_back(*it2);
325 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsFromHits: Update TSOS using TMs after sorting, then create Trajectory Seed, number of TM = " << meas.size() << std::endl;
328 unsigned int found = 0;
329 for (std::vector<TrajectoryMeasurement>::const_iterator it=meas.begin(); it!=meas.end(); ++it) {
331 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsFromHits: TSOS for TM " << found << std::endl;
332 if (not updatedTSOS.
isValid())
continue;
335 seedHits.
push_back(*it->recHit()->hit());
338 LogTrace(
"TSGForOIFromL2") <<
"TSGForOIFromL2::makeSeedsFromHits: Number of seedHits: " << seedHits.
size() << std::endl;
347 if (found) layerCount++;
361 double abseta =
std::abs(track->eta());
362 if (track->pt() <=
pT1_) theSF =
SF1_;
363 else if (track->pt() >
pT1_ && track->pt() <=
pT2_) {
368 else if (track->pt() >
pT2_ && track->pt() <=
pT3_) {
376 else if (track->pt() >
pT3_) {
383 LogTrace(
theCategory_) <<
"TSGForOIFromL2::calculateSFFromL2: SF has been calculated as: " << theSF;
400 bool ierr = !
m.Invert();
403 edm::LogInfo(
"TSGForOIFromL2") <<
"Error inverting covariance matrix";
407 double est = ROOT::Math::Similarity(
v,
m);
421 desc.
add<
int>(
"layersToTry",2);
422 desc.
add<
double>(
"fixedErrorRescaleFactorForHitless",2.0);
423 desc.
add<
int>(
"hitsToTry",1);
424 desc.
add<
bool>(
"adjustErrorsDynamicallyForHits",
false);
425 desc.
add<
bool>(
"adjustErrorsDynamicallyForHitless",
true);
427 desc.
add<
bool>(
"UseHitLessSeeds",
true);
428 desc.
add<
std::string>(
"estimator",
"hltESPChi2MeasurementEstimator100");
429 desc.
add<
double>(
"maxEtaForTOB",1.8);
430 desc.
add<
double>(
"minEtaForTEC",0.7);
432 desc.
add<
double>(
"fixedErrorRescaleFactorForHits",1.0);
433 desc.
add<
unsigned int>(
"maxSeeds",20);
434 desc.
add<
unsigned int>(
"maxHitlessSeeds",5);
435 desc.
add<
unsigned int>(
"maxHitSeeds",1);
436 desc.
add<
unsigned int>(
"numL2ValidHitsCutAllEta",20);
437 desc.
add<
unsigned int>(
"numL2ValidHitsCutAllEndcap",30);
438 desc.
add<
double>(
"pT1",13.0);
439 desc.
add<
double>(
"pT2",30.0);
440 desc.
add<
double>(
"pT3",70.0);
441 desc.
add<
double>(
"eta1",0.2);
442 desc.
add<
double>(
"eta2",0.3);
443 desc.
add<
double>(
"eta3",1.0);
444 desc.
add<
double>(
"eta4",1.2);
445 desc.
add<
double>(
"eta5",1.6);
446 desc.
add<
double>(
"eta6",1.4);
447 desc.
add<
double>(
"eta7",2.1);
448 desc.
add<
double>(
"SF1",3.0);
449 desc.
add<
double>(
"SF2",4.0);
450 desc.
add<
double>(
"SF3",5.0);
451 desc.
add<
double>(
"SF4",7.0);
452 desc.
add<
double>(
"SF5",10.0);
453 desc.
add<
double>(
"SF6",2.0);
454 desc.
add<
double>(
"tsosDiff1",0.2);
455 desc.
add<
double>(
"tsosDiff2",0.02);
456 desc.
add<
std::string>(
"propagatorName",
"PropagatorWithMaterialParabolicMf");
457 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
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
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)
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.
ROOT::Math::SVector< double, 5 > AlgebraicVector5
std::vector< ForwardDetLayer const * > const & posTecLayers() const
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_