18 numOfMaxSeedsParam_(iConfig.getParameter<uint32_t>(
"maxSeeds")),
19 numOfLayersToTry_(iConfig.getParameter<int32_t>(
"layersToTry")),
20 numOfHitsToTry_(iConfig.getParameter<int32_t>(
"hitsToTry")),
21 fixedErrorRescalingForHits_(iConfig.getParameter<double>(
"fixedErrorRescaleFactorForHits")),
22 fixedErrorRescalingForHitless_(iConfig.getParameter<double>(
"fixedErrorRescaleFactorForHitless")),
23 adjustErrorsDynamicallyForHits_(iConfig.getParameter<bool>(
"adjustErrorsDynamicallyForHits")),
24 adjustErrorsDynamicallyForHitless_(iConfig.getParameter<bool>(
"adjustErrorsDynamicallyForHitless")),
25 estimatorName_(iConfig.getParameter<std::
string>(
"estimator")),
26 minEtaForTEC_(iConfig.getParameter<double>(
"minEtaForTEC")),
27 maxEtaForTOB_(iConfig.getParameter<double>(
"maxEtaForTOB")),
28 useHitLessSeeds_(iConfig.getParameter<bool>(
"UseHitLessSeeds")),
29 useStereoLayersInTEC_(iConfig.getParameter<bool>(
"UseStereoLayersInTEC")),
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 SF1_(iConfig.getParameter<double>(
"SF1")),
39 SF2_(iConfig.getParameter<double>(
"SF2")),
40 SF3_(iConfig.getParameter<double>(
"SF3")),
41 SF4_(iConfig.getParameter<double>(
"SF4")),
42 SF5_(iConfig.getParameter<double>(
"SF5")),
43 tsosDiff_(iConfig.getParameter<double>(
"tsosDiff")),
44 propagatorName_(iConfig.getParameter<std::
string>(
"propagatorName")),
45 theCategory(
string(
"Muon|RecoMuon|TSGForOI")) {
46 produces<std::vector<TrajectorySeed> >();
54 unsigned int numSeedsMade = 0;
55 bool analysedL2 =
false;
56 unsigned int layerCount = 0;
83 std::unique_ptr<std::vector<TrajectorySeed> >
result(
new std::vector<TrajectorySeed>());
86 std::vector<BarrelDetLayer const*>
const& tob = measurementTrackerH->geometricSearchTracker()->tobLayers();
87 std::vector<ForwardDetLayer const*>
const& tecPositive =
89 ? measurementTrackerH->geometricSearchTracker()->posTidLayers()
90 : measurementTrackerH->geometricSearchTracker()->posTecLayers();
91 std::vector<ForwardDetLayer const*>
const& tecNegative =
93 ? measurementTrackerH->geometricSearchTracker()->negTidLayers()
94 : measurementTrackerH->geometricSearchTracker()->negTecLayers();
110 for (
unsigned int l2TrackColIndex(0); l2TrackColIndex != l2TrackCol->size(); ++l2TrackColIndex) {
112 std::unique_ptr<std::vector<TrajectorySeed> >
out(
new std::vector<TrajectorySeed>());
113 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: L2 muon pT, eta, phi --> " << l2->pt() <<
" , " << l2->eta() <<
" , "
114 << l2->phi() << endl;
117 dummyPlane->move(fts.
position() - dummyPlane->position());
119 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: Created TSOSatIP: " << tsosAtIP << std::endl;
124 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: Created TSOSatMuonSystem: " << tsosAtMuonSystem << endl;
126 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: Check the error of the L2 parameter and use hit seeds if big errors"
137 bool useBoth =
false;
138 if (outerTkStateInside.isValid() && outerTkStateOutside.
isValid()) {
139 dist =
match_Chi2(outerTkStateInside, outerTkStateOutside);
153 for (
auto it = tob.rbegin(); it != tob.rend(); ++it) {
154 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: looping in TOB layer " << layerCount << endl;
158 *(propagatorAlong.get()),
159 *(propagatorOpposite.get()),
171 for (
auto it = tob.rbegin(); it != tob.rend(); ++it) {
172 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: looping in TOB layer " << layerCount << endl;
176 *(propagatorOpposite.get()),
177 *(propagatorOpposite.get()),
198 for (
auto it = tecPositive.rbegin(); it != tecPositive.rend(); ++it) {
199 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: looping in TEC+ layer " << layerCount << endl;
203 *(propagatorAlong.get()),
204 *(propagatorOpposite.get()),
216 for (
auto it = tecPositive.rbegin(); it != tecPositive.rend(); ++it) {
217 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: looping in TEC+ layer " << layerCount << endl;
221 *(propagatorOpposite.get()),
222 *(propagatorOpposite.get()),
238 for (
auto it = tecNegative.rbegin(); it != tecNegative.rend(); ++it) {
239 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: looping in TEC- layer " << layerCount << endl;
243 *(propagatorAlong.get()),
244 *(propagatorOpposite.get()),
256 for (
auto it = tecNegative.rbegin(); it != tecNegative.rend(); ++it) {
257 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: looping in TEC- layer " << layerCount << endl;
261 *(propagatorOpposite.get()),
262 *(propagatorOpposite.get()),
275 for (std::vector<TrajectorySeed>::iterator it = out->begin(); it != out->end(); ++it) {
276 result->push_back(*it);
292 unsigned int& numSeedsMade,
293 unsigned int& numOfMaxSeeds,
294 unsigned int& layerCount,
297 if (numSeedsMade > numOfMaxSeeds)
299 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: numSeedsMade = " << numSeedsMade
300 <<
" , layerCount = " << layerCount << endl;
302 double errorSFHits = 1.0;
303 double errorSFHitless = 1.0;
313 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: Start hitless" << endl;
314 std::vector<GeometricSearchDet::DetWithState> dets;
317 auto const& detOnLayer = dets.front().first;
318 auto const& tsosOnLayer = dets.front().second;
319 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: tsosOnLayer " << tsosOnLayer << endl;
320 if (!tsosOnLayer.isValid()) {
329 dets.front().second.rescaleError(errorSFHitless);
334 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: TSOD (Hitless) done " << endl;
343 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: Start Hits" << endl;
349 *measurementTrackerH,
362 double abseta =
std::abs(track->eta());
363 if (track->pt() <=
pT1_)
365 if (track->pt() >
pT1_ && track->pt() <=
pT2_) {
373 if (track->pt() >
pT2_ && track->pt() <=
pT3_) {
381 if (track->pt() >
pT3_)
384 LogTrace(
theCategory) <<
"TSGForOI::calculateSFFromL2: SF has been calculated as: " << theSF;
391 std::vector<TrajectorySeed>&
out,
395 unsigned int& numSeedsMade,
396 const double errorSF,
397 const double l2Eta)
const {
402 std::vector<GeometricSearchDet::DetWithState> dets;
406 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: find measurements on each detWithState " << dets.size() << endl;
407 std::vector<TrajectoryMeasurement> meas;
408 for (std::vector<GeometricSearchDet::DetWithState>::iterator it = dets.begin(); it != dets.end(); ++it) {
413 if (!it->second.isValid())
416 std::vector<TrajectoryMeasurement> mymeas =
418 for (std::vector<TrajectoryMeasurement>::const_iterator it2 = mymeas.begin(), ed2 = mymeas.end(); it2 != ed2;
420 if (it2->recHit()->isValid())
421 meas.push_back(*it2);
427 <<
"TSGForOI::findSeedsOnLayer: Update TSOS using TMs after sorting, then create Trajectory Seed, number of TM = "
428 << meas.size() << endl;
429 unsigned int found = 0;
431 for (std::vector<TrajectoryMeasurement>::const_iterator it = meas.begin(); it != meas.end(); ++it) {
433 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: TSOS for TM " << found << endl;
439 DetId detid = ((*it).recHit()->hit())->geographicalId();
447 seedHits.
push_back(*it->recHit()->hit());
450 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: number of seedHits: " << seedHits.
size() << endl;
471 bool ierr = !
m.Invert();
474 edm::LogInfo(
"TSGForOI") <<
"Error inverting covariance matrix";
478 double est = ROOT::Math::Similarity(
v,
m);
486 desc.
add<
int>(
"layersToTry", 1);
487 desc.
add<
double>(
"fixedErrorRescaleFactorForHitless", 2.0);
488 desc.
add<
int>(
"hitsToTry", 1);
489 desc.
add<
bool>(
"adjustErrorsDynamicallyForHits",
false);
490 desc.
add<
bool>(
"adjustErrorsDynamicallyForHitless",
false);
492 desc.
add<
bool>(
"UseHitLessSeeds",
true);
493 desc.
add<
bool>(
"UseStereoLayersInTEC",
false);
494 desc.
add<
std::string>(
"estimator",
"hltESPChi2MeasurementEstimator100");
495 desc.
add<
double>(
"maxEtaForTOB", 1.2);
496 desc.
add<
double>(
"minEtaForTEC", 0.8);
498 desc.
add<
double>(
"fixedErrorRescaleFactorForHits", 2.0);
499 desc.
add<
unsigned int>(
"maxSeeds", 1);
500 desc.
add<
double>(
"pT1", 13.0);
501 desc.
add<
double>(
"pT2", 30.0);
502 desc.
add<
double>(
"pT3", 70.0);
503 desc.
add<
double>(
"eta1", 1.0);
504 desc.
add<
double>(
"eta2", 1.4);
505 desc.
add<
double>(
"SF1", 3.0);
506 desc.
add<
double>(
"SF2", 4.0);
507 desc.
add<
double>(
"SF3", 5.0);
508 desc.
add<
double>(
"SF4", 7.0);
509 desc.
add<
double>(
"SF5", 10.0);
510 desc.
add<
double>(
"tsosDiff", 0.03);
511 desc.
add<
std::string>(
"propagatorName",
"PropagatorWithMaterial");
512 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)
const LocalTrajectoryParameters & localParameters() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
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.
void produce(edm::StreamID sid, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
const double maxEtaForTOB_
Maximum eta value to activate searching in the TOB.
constexpr std::array< uint8_t, layerIndexSize > layer
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.
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
Log< level::Info, false > LogInfo
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.
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)
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)
tuple MeasurementTrackerEvent
const edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrackerTag_
const unsigned int numOfMaxSeedsParam_
Maximum number of seeds for each L2.
const std::string theCategory
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_