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;
171 for (
auto it = tob.rbegin(); it != tob.rend(); ++it) {
172 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: looping in TOB layer " << layerCount << endl;
198 for (
auto it = tecPositive.rbegin(); it != tecPositive.rend(); ++it) {
199 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: looping in TEC+ layer " << layerCount << endl;
216 for (
auto it = tecPositive.rbegin(); it != tecPositive.rend(); ++it) {
217 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: looping in TEC+ layer " << layerCount << endl;
238 for (
auto it = tecNegative.rbegin(); it != tecNegative.rend(); ++it) {
239 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: looping in TEC- layer " << layerCount << endl;
256 for (
auto it = tecNegative.rbegin(); it != tecNegative.rend(); ++it) {
257 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: looping in TEC- layer " << layerCount << endl;
275 for (std::vector<TrajectorySeed>::iterator it =
out->begin(); it !=
out->end(); ++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,
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);
497 desc.addUntracked<
bool>(
"debug",
true);
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);
512 descriptions.
add(
"TSGForOI",
desc);