17 numOfMaxSeedsParam_(iConfig.getParameter<uint32_t>(
"maxSeeds")),
18 numOfLayersToTry_(iConfig.getParameter<int32_t>(
"layersToTry")),
19 numOfHitsToTry_(iConfig.getParameter<int32_t>(
"hitsToTry")),
20 fixedErrorRescalingForHits_(iConfig.getParameter<double>(
"fixedErrorRescaleFactorForHits")),
21 fixedErrorRescalingForHitless_(iConfig.getParameter<double>(
"fixedErrorRescaleFactorForHitless")),
22 adjustErrorsDynamicallyForHits_(iConfig.getParameter<
bool>(
"adjustErrorsDynamicallyForHits")),
23 adjustErrorsDynamicallyForHitless_(iConfig.getParameter<
bool>(
"adjustErrorsDynamicallyForHitless")),
24 estimatorName_(iConfig.getParameter<
std::
string>(
"estimator")),
25 minEtaForTEC_(iConfig.getParameter<double>(
"minEtaForTEC")),
26 maxEtaForTOB_(iConfig.getParameter<double>(
"maxEtaForTOB")),
27 useHitLessSeeds_(iConfig.getParameter<
bool>(
"UseHitLessSeeds")),
28 useStereoLayersInTEC_(iConfig.getParameter<
bool>(
"UseStereoLayersInTEC")),
30 measurementTrackerTag_(
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 SF1_(iConfig.getParameter<double>(
"SF1")),
38 SF2_(iConfig.getParameter<double>(
"SF2")),
39 SF3_(iConfig.getParameter<double>(
"SF3")),
40 SF4_(iConfig.getParameter<double>(
"SF4")),
41 SF5_(iConfig.getParameter<double>(
"SF5")),
42 tsosDiff_(iConfig.getParameter<double>(
"tsosDiff")),
43 propagatorName_(iConfig.getParameter<
std::
string>(
"propagatorName")),
44 theCategory(
string(
"Muon|RecoMuon|TSGForOI")) {
45 produces<std::vector<TrajectorySeed> >();
53 unsigned int numSeedsMade = 0;
54 bool analysedL2 =
false;
55 unsigned int layerCount = 0;
82 std::unique_ptr<std::vector<TrajectorySeed> >
result(
new std::vector<TrajectorySeed>());
85 std::vector<BarrelDetLayer const*>
const& tob = measurementTrackerH->geometricSearchTracker()->tobLayers();
86 std::vector<ForwardDetLayer const*>
const& tecPositive =
88 ? measurementTrackerH->geometricSearchTracker()->posTidLayers()
89 : measurementTrackerH->geometricSearchTracker()->posTecLayers();
90 std::vector<ForwardDetLayer const*>
const& tecNegative =
92 ? measurementTrackerH->geometricSearchTracker()->negTidLayers()
93 : measurementTrackerH->geometricSearchTracker()->negTecLayers();
109 for (
unsigned int l2TrackColIndex(0); l2TrackColIndex != l2TrackCol->size(); ++l2TrackColIndex) {
111 std::unique_ptr<std::vector<TrajectorySeed> >
out(
new std::vector<TrajectorySeed>());
112 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: L2 muon pT, eta, phi --> " << l2->pt() <<
" , " << l2->eta() <<
" , " 113 << l2->phi() << endl;
116 dummyPlane->move(fts.
position() - dummyPlane->position());
118 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: Created TSOSatIP: " << tsosAtIP << std::endl;
123 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: Created TSOSatMuonSystem: " << tsosAtMuonSystem << endl;
125 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: Check the error of the L2 parameter and use hit seeds if big errors" 136 bool useBoth =
false;
137 if (outerTkStateInside.isValid() && outerTkStateOutside.
isValid()) {
138 dist =
match_Chi2(outerTkStateInside, outerTkStateOutside);
152 for (
auto it = tob.rbegin(); it != tob.rend(); ++it) {
153 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: looping in TOB layer " << layerCount << endl;
157 *(propagatorAlong.get()),
158 *(propagatorOpposite.get()),
170 for (
auto it = tob.rbegin(); it != tob.rend(); ++it) {
171 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: looping in TOB layer " << layerCount << endl;
175 *(propagatorOpposite.get()),
176 *(propagatorOpposite.get()),
197 for (
auto it = tecPositive.rbegin(); it != tecPositive.rend(); ++it) {
198 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: looping in TEC+ layer " << layerCount << endl;
202 *(propagatorAlong.get()),
203 *(propagatorOpposite.get()),
215 for (
auto it = tecPositive.rbegin(); it != tecPositive.rend(); ++it) {
216 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: looping in TEC+ layer " << layerCount << endl;
220 *(propagatorOpposite.get()),
221 *(propagatorOpposite.get()),
237 for (
auto it = tecNegative.rbegin(); it != tecNegative.rend(); ++it) {
238 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: looping in TEC- layer " << layerCount << endl;
242 *(propagatorAlong.get()),
243 *(propagatorOpposite.get()),
255 for (
auto it = tecNegative.rbegin(); it != tecNegative.rend(); ++it) {
256 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: looping in TEC- layer " << layerCount << endl;
260 *(propagatorOpposite.get()),
261 *(propagatorOpposite.get()),
274 for (std::vector<TrajectorySeed>::iterator it = out->begin(); it != out->end(); ++it) {
275 result->push_back(*it);
291 unsigned int& numSeedsMade,
292 unsigned int& numOfMaxSeeds,
293 unsigned int& layerCount,
295 std::unique_ptr<std::vector<TrajectorySeed> >&
out)
const {
296 if (numSeedsMade > numOfMaxSeeds)
298 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: numSeedsMade = " << numSeedsMade
299 <<
" , layerCount = " << layerCount << endl;
301 double errorSFHits = 1.0;
302 double errorSFHitless = 1.0;
312 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: Start hitless" << endl;
313 std::vector<GeometricSearchDet::DetWithState> dets;
316 auto const& detOnLayer = dets.front().first;
317 auto const& tsosOnLayer = dets.front().second;
318 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: tsosOnLayer " << tsosOnLayer << endl;
319 if (!tsosOnLayer.isValid()) {
328 dets.front().second.rescaleError(errorSFHitless);
333 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: TSOD (Hitless) done " << endl;
342 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: Start Hits" << endl;
348 *measurementTrackerH,
361 double abseta =
std::abs(track->eta());
362 if (track->pt() <=
pT1_)
364 if (track->pt() >
pT1_ && track->pt() <=
pT2_) {
372 if (track->pt() >
pT2_ && track->pt() <=
pT3_) {
380 if (track->pt() >
pT3_)
383 LogTrace(
theCategory) <<
"TSGForOI::calculateSFFromL2: SF has been calculated as: " << theSF;
390 std::vector<TrajectorySeed>&
out,
394 unsigned int& numSeedsMade,
395 const double errorSF,
396 const double l2Eta)
const {
401 std::vector<GeometricSearchDet::DetWithState> dets;
405 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: find measurements on each detWithState " << dets.size() << endl;
406 std::vector<TrajectoryMeasurement> meas;
407 for (std::vector<GeometricSearchDet::DetWithState>::iterator it = dets.begin(); it != dets.end(); ++it) {
412 if (!it->second.isValid())
415 std::vector<TrajectoryMeasurement> mymeas =
417 for (std::vector<TrajectoryMeasurement>::const_iterator it2 = mymeas.begin(), ed2 = mymeas.end(); it2 != ed2;
419 if (it2->recHit()->isValid())
420 meas.push_back(*it2);
426 <<
"TSGForOI::findSeedsOnLayer: Update TSOS using TMs after sorting, then create Trajectory Seed, number of TM = " 427 << meas.size() << endl;
428 unsigned int found = 0;
430 for (std::vector<TrajectoryMeasurement>::const_iterator it = meas.begin(); it != meas.end(); ++it) {
432 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: TSOS for TM " << found << endl;
438 DetId detid = ((*it).recHit()->hit())->geographicalId();
446 seedHits.
push_back(*it->recHit()->hit());
450 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: number of seedHits: " << seedHits.
size() << endl;
470 bool ierr = !
m.Invert();
473 edm::LogInfo(
"TSGForOI") <<
"Error inverting covariance matrix";
477 double est = ROOT::Math::Similarity(
v,
m);
485 desc.
add<
int>(
"layersToTry", 1);
486 desc.
add<
double>(
"fixedErrorRescaleFactorForHitless", 2.0);
487 desc.
add<
int>(
"hitsToTry", 1);
488 desc.
add<
bool>(
"adjustErrorsDynamicallyForHits",
false);
489 desc.
add<
bool>(
"adjustErrorsDynamicallyForHitless",
false);
491 desc.
add<
bool>(
"UseHitLessSeeds",
true);
492 desc.
add<
bool>(
"UseStereoLayersInTEC",
false);
493 desc.
add<
std::string>(
"estimator",
"hltESPChi2MeasurementEstimator100");
494 desc.
add<
double>(
"maxEtaForTOB", 1.2);
495 desc.
add<
double>(
"minEtaForTEC", 0.8);
497 desc.
add<
double>(
"fixedErrorRescaleFactorForHits", 2.0);
498 desc.
add<
unsigned int>(
"maxSeeds", 1);
499 desc.
add<
double>(
"pT1", 13.0);
500 desc.
add<
double>(
"pT2", 30.0);
501 desc.
add<
double>(
"pT3", 70.0);
502 desc.
add<
double>(
"eta1", 1.0);
503 desc.
add<
double>(
"eta2", 1.4);
504 desc.
add<
double>(
"SF1", 3.0);
505 desc.
add<
double>(
"SF2", 4.0);
506 desc.
add<
double>(
"SF3", 5.0);
507 desc.
add<
double>(
"SF4", 7.0);
508 desc.
add<
double>(
"SF5", 10.0);
509 desc.
add<
double>(
"tsosDiff", 0.03);
510 desc.
add<
std::string>(
"propagatorName",
"PropagatorWithMaterial");
511 descriptions.
add(
"TSGForOI", desc);
const std::string estimatorName_
Estimator used to find dets and TrajectoryMeasurements.
void rescaleError(double factor)
static constexpr auto TEC
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void produce(edm::StreamID sid, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
const LocalTrajectoryParameters & localParameters() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const double tsosDiff_
Distance of TSOSs to trigger using hits or not.
void findSeedsOnLayer(const TrackerTopology *tTopo, const GeometricSearchDet &layer, const TrajectoryStateOnSurface &tsosAtIP, const Propagator &propagatorAlong, const Propagator &propagatorOpposite, const reco::TrackRef l2, edm::ESHandle< Chi2MeasurementEstimatorBase > &estimator_, edm::Handle< MeasurementTrackerEvent > &measurementTrackerH, unsigned int &numSeedsMade, unsigned int &numOfMaxSeeds, unsigned int &layerCount, bool &analysedL2, std::unique_ptr< std::vector< TrajectorySeed > > &out) const
Function to find seeds on a given layer.
constexpr uint32_t rawId() const
get the raw id
std::vector< Track > TrackCollection
collection of Tracks
const std::string propagatorName_
Counters and flags for the implementation.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const double maxEtaForTOB_
Maximum eta value to activate searching in the TOB.
bool isThere(GeomDetEnumerators::SubDetector subdet) const
AlgebraicVector5 vector() const
bool tecIsStereo(const DetId &id) const
std::unique_ptr< Propagator > SetPropagationDirection(Propagator const &iprop, PropagationDirection dir)
const double minEtaForTEC_
Minimum eta value to activate searching in the TEC.
#define DEFINE_FWK_MODULE(type)
double match_Chi2(const TrajectoryStateOnSurface &tsos1, const TrajectoryStateOnSurface &tsos2) const
const double fixedErrorRescalingForHits_
How much to rescale errors from the L2 (fixed error vs pT, eta)
const std::unique_ptr< TrajectoryStateUpdator > updator_
KFUpdator defined in constructor.
std::vector< TrajectoryMeasurement > fastMeasurements(const TrajectoryStateOnSurface &stateOnThisDet, const TrajectoryStateOnSurface &tsos2, const Propagator &prop, const MeasurementEstimator &est) const
static PlanePointer build(Args &&...args)
const bool useHitLessSeeds_
const unsigned int numOfLayersToTry_
How many layers to try.
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)
ROOT::Math::SVector< double, 5 > AlgebraicVector5
double calculateSFFromL2(const reco::TrackRef track) const
Function used to calculate the dynamic error SF by analysing the L2.
const bool useStereoLayersInTEC_
Switch ON to use Stereo layers instead of using every layer in TEC.
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Create L3MuonTrajectorySeeds from L2 Muons updated at vertex in an outside in manner.
const bool adjustErrorsDynamicallyForHitless_
const double pT1_
pT, eta ranges and scale factor values
GlobalPoint position() const
int makeSeedsFromHits(const TrackerTopology *tTopo, const GeometricSearchDet &layer, const TrajectoryStateOnSurface &tsosAtIP, std::vector< TrajectorySeed > &out, const Propagator &propagatorAlong, const MeasurementTrackerEvent &measurementTracker, edm::ESHandle< Chi2MeasurementEstimatorBase > &estimator_, unsigned int &numSeedsMade, const double errorSF, const double l2Eta) const
Function to find hits on layers and create seeds from updated TSOS.
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< reco::TrackCollection > src_
Labels for input collections.
const bool adjustErrorsDynamicallyForHits_
Whether or not to use an automatically calculated scale-factor value.
TSGForOI(const edm::ParameterSet &iConfig)
const edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrackerTag_
const unsigned int numOfMaxSeedsParam_
Maximum number of seeds for each L2.
const std::string theCategory
T const * product() const
virtual void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
const unsigned int numOfHitsToTry_
How many hits to try per layer.
const double fixedErrorRescalingForHitless_