44 theL1MinPt(iConfig.getParameter<double>(
"L1MinPt")),
45 theL1MaxEta(iConfig.getParameter<double>(
"L1MaxEta")),
46 theMinPtBarrel(iConfig.getParameter<double>(
"SetMinPtBarrelTo")),
47 theMinPtEndcap(iConfig.getParameter<double>(
"SetMinPtEndcapTo")),
48 theMinPL1Tk(iConfig.getParameter<double>(
"MinPL1Tk")),
49 theMinPtL1TkBarrel(iConfig.getParameter<double>(
"MinPtL1TkBarrel")),
50 useOfflineSeed(iConfig.getUntrackedParameter<
bool>(
"UseOfflineSeed",
false)),
51 useUnassociatedL1(iConfig.getParameter<
bool>(
"UseUnassociatedL1")),
52 matchingDR(iConfig.getParameter<
std::vector<double>>(
"MatchDR")),
53 etaBins(iConfig.getParameter<
std::vector<double>>(
"EtaMatchingBins")) {
63 <<
"does not match number of eta bins." << endl;
76 produces<L2MuonTrajectorySeedCollection>();
90 desc.
add<
string>(
"Propagator",
"");
91 desc.
add<
double>(
"L1MinPt", -1.);
92 desc.
add<
double>(
"L1MaxEta", 5.0);
93 desc.
add<
double>(
"SetMinPtBarrelTo", 3.5);
94 desc.
add<
double>(
"SetMinPtEndcapTo", 1.0);
95 desc.
add<
double>(
"MinPL1Tk", 3.5);
96 desc.
add<
double>(
"MinPtL1TkBarrel", 3.5);
98 desc.
add<
bool>(
"UseUnassociatedL1",
true);
99 desc.
add<std::vector<double>>(
"MatchDR", {0.3});
100 desc.
add<std::vector<double>>(
"EtaMatchingBins", {0., 2.5});
104 psd0.
addUntracked<std::vector<std::string>>(
"Propagators", {
"SteppingHelixPropagatorAny"});
105 psd0.add<
bool>(
"RPCLayers",
true);
106 psd0.addUntracked<
bool>(
"UseMuonNavigation",
true);
108 descriptions.
add(
"L2MuonSeedGeneratorFromL1TkMu", desc);
115 auto output = std::make_unique<L2MuonTrajectorySeedCollection>();
122 vector<int> offlineSeedMap;
125 offlineSeedMap = vector<int>(offlineSeedHandle->size(), 0);
128 for (
auto ittkmu = muColl->begin(); ittkmu != muColl->end(); ittkmu++) {
130 auto it = ittkmu->trkPtr();
133 auto p3 = it->momentum();
134 float tk_pt =
p3.perp();
135 float tk_p =
p3.mag();
136 float tk_eta =
p3.eta();
138 float tk_phi =
p3.phi();
139 float tk_q = it->rInv() > 0 ? 1. : -1.;
140 float tk_z = it->POCA().z();
147 float dzCorrPhi = 1.;
149 float etaProp = tk_aeta;
153 deta = tk_z / 550. / cosh(tk_aeta);
155 float delta = tk_z / 850.;
158 dzCorrPhi = 1. +
delta;
160 float zOzs = tk_z / 850.;
162 deta = zOzs / (1. - zOzs);
164 deta = zOzs / (1. + zOzs);
165 deta = deta * tanh(tk_eta);
167 float resPhi = tk_phi - 1.464 * tk_q * cosh(1.7) / cosh(etaProp) / tk_pt * dzCorrPhi -
M_PI / 144.;
171 float eta = tk_eta + deta;
174 int charge = it->rInv() > 0 ? 1 : -1;
195 CLHEP::Hep3Vector vec(0., 1., 0.);
206 detLayer =
theService->detLayerGeometry()->idToLayer(theid);
210 const BoundCylinder *bc = dynamic_cast<const BoundCylinder *>(sur);
224 detLayer =
theService->detLayerGeometry()->idToLayer(theid);
242 mat[0][0] = (0.25 /
pt) * (0.25 /
pt);
244 mat[0][0] = (0.4 /
pt) * (0.4 /
pt);
246 mat[1][1] = 0.05 * 0.05;
247 mat[2][2] = 0.2 * 0.2;
248 mat[3][3] = 20. * 20.;
249 mat[4][4] = 20. * 20.;
276 std::vector<pair<const GeomDet *, TrajectoryStateOnSurface>> detsWithStates =
279 if (detsWithStates.empty() &&
barrel) {
289 if (!detsWithStates.empty()) {
291 const GeomDet *newTSOSDet = detsWithStates.front().first;
307 if (assoOffseed !=
nullptr) {
310 for (; tsci != tscie; ++tsci) {
341 std::vector<int> &offseedMap,
344 const std::string metlabel =
"Muon|RecoMuon|L2MuonSeedGeneratorFromL1TkMu";
349 double bestDr = 99999.;
350 unsigned int nOffseed(0);
353 for (offseed = offseeds->
begin(); offseed != endOffseed; ++offseed, ++nOffseed) {
354 if (offseedMap[nOffseed] != 0)
357 ->idToDet(offseed->startingState().detId())
359 .toGlobal(offseed->startingState().parameters().position());
361 ->idToDet(offseed->startingState().detId())
363 .toGlobal(offseed->startingState().parameters().momentum());
371 glbPos, glbMom, offseed->startingState().parameters().charge(), &*
theService->magneticField());
374 LogDebug(metlabel) <<
"Offline seed info: Det and State" << std::endl;
375 LogDebug(metlabel) << debugtmp.
dumpMuonId(offseed->startingState().detId()) << std::endl;
376 LogDebug(metlabel) <<
"pos: (r=" << offseedFTS.position().mag() <<
", phi=" << offseedFTS.position().phi()
377 <<
", eta=" << offseedFTS.position().eta() <<
")" << std::endl;
378 LogDebug(metlabel) <<
"mom: (q*pt=" << offseedFTS.charge() * offseedFTS.momentum().perp()
379 <<
", phi=" << offseedFTS.momentum().phi() <<
", eta=" << offseedFTS.momentum().eta() <<
")"
383 if (offseedTsos.isValid()) {
384 LogDebug(metlabel) <<
"Offline seed info after propagation to L1 layer:" << std::endl;
385 LogDebug(metlabel) <<
"pos: (r=" << offseedTsos.globalPosition().mag()
386 <<
", phi=" << offseedTsos.globalPosition().phi()
387 <<
", eta=" << offseedTsos.globalPosition().eta() <<
")" << std::endl;
388 LogDebug(metlabel) <<
"mom: (q*pt=" << offseedTsos.charge() * offseedTsos.globalMomentum().perp()
389 <<
", phi=" << offseedTsos.globalMomentum().phi()
390 <<
", eta=" << offseedTsos.globalMomentum().eta() <<
")" << std::endl
394 offseedTsos.globalPosition().eta(),
395 offseedTsos.globalPosition().
phi());
396 LogDebug(metlabel) <<
" -- DR = " << newDr << std::endl;
397 if (newDr <
dRcone && newDr < bestDr) {
398 LogDebug(metlabel) <<
" --> OK! " << newDr << std::endl << std::endl;
399 selOffseed = &*offseed;
401 offseedMap[nOffseed] = 1;
402 if (lastOffseed > -1)
403 offseedMap[lastOffseed] = 0;
404 lastOffseed = nOffseed;
406 LogDebug(metlabel) <<
" --> Rejected. " << newDr << std::endl << std::endl;
409 LogDebug(metlabel) <<
"Invalid offline seed TSOS after propagation!" << std::endl << std::endl;