46 theL1GMTReadoutCollection(iConfig.getParameter<
InputTag>(
"GMTReadoutCollection")),
48 theL1MinPt(iConfig.getParameter<double>(
"L1MinPt")),
49 theL1MaxEta(iConfig.getParameter<double>(
"L1MaxEta")),
50 theL1MinQuality(iConfig.getParameter<unsigned
int>(
"L1MinQuality")),
51 useOfflineSeed(iConfig.getUntrackedParameter<
bool>(
"UseOfflineSeed",
false)),
52 useUnassociatedL1(iConfig.existsAs<
bool>(
"UseUnassociatedL1") ? iConfig.getParameter<
bool>(
"UseUnassociatedL1")
71 produces<L2MuonTrajectorySeedCollection>();
86 auto output = std::make_unique<L2MuonTrajectorySeedCollection>();
98 vector<int> offlineSeedMap;
101 LogTrace(
metname) <<
"Number of offline seeds " << offlineSeedHandle->size() << endl;
102 offlineSeedMap = vector<int>(offlineSeedHandle->size(), 0);
105 L1MuonParticleCollection::const_iterator it;
108 for (it = muColl->begin(); it != muColl->end(); ++it, ++l1ParticleIndex) {
111 bool valid_charge =
false;
114 if (muonCand.
empty()) {
116 LogWarning(
metname) <<
"L2MuonSeedGenerator: this should make sense only within MC tests" << endl;
125 float pt = (*it).pt();
126 float eta = (*it).eta();
128 float phi = (*it).phi();
129 int charge = (*it).charge();
133 bool barrel = !(*it).isForward();
137 if (!(muonCand.
empty())) {
139 vector<L1MuRegionalCand> rmc;
140 if (!muonCand.
isRPC()) {
142 if (muonCand.
isFwd())
148 if (muonCand.
isFwd())
154 eta = rmc[
idx].etaValue();
183 CLHEP::Hep3Vector vec(0., 1., 0.);
193 detLayer =
theService->detLayerGeometry()->idToLayer(
id);
197 const BoundCylinder* bc = dynamic_cast<const BoundCylinder*>(sur);
215 detLayer =
theService->detLayerGeometry()->idToLayer(
id);
233 mat[0][0] = (0.25 /
pt) * (0.25 /
pt);
235 mat[0][0] = (0.4 /
pt) * (0.4 /
pt);
239 mat[0][0] = (1. /
pt) * (1. /
pt);
241 mat[1][1] = 0.05 * 0.05;
242 mat[2][2] = 0.2 * 0.2;
243 mat[3][3] = 20. * 20.;
244 mat[4][4] = 20. * 20.;
262 std::vector<pair<const GeomDet*, TrajectoryStateOnSurface> > detsWithStates =
264 if (!detsWithStates.empty()) {
266 const GeomDet* newTSOSDet = detsWithStates.front().first;
293 if (assoOffseed !=
nullptr) {
295 for (
auto const& tsci : assoOffseed->
recHits()) {
326 std::vector<int>& offseedMap,
328 const std::string metlabel =
"Muon|RecoMuon|L2MuonSeedGenerator";
333 double bestDr = 99999.;
334 unsigned int nOffseed(0);
337 for (offseed = offseeds->
begin(); offseed != endOffseed; ++offseed, ++nOffseed) {
338 if (offseedMap[nOffseed] != 0)
341 ->idToDet(offseed->startingState().detId())
343 .toGlobal(offseed->startingState().parameters().position());
345 ->idToDet(offseed->startingState().detId())
347 .toGlobal(offseed->startingState().parameters().momentum());
355 glbPos, glbMom, offseed->startingState().parameters().charge(), &*
theService->magneticField());
358 LogDebug(metlabel) <<
"Offline seed info: Det and State" << std::endl;
359 LogDebug(metlabel) << debugtmp.
dumpMuonId(offseed->startingState().detId()) << std::endl;
362 LogDebug(metlabel) <<
"pos: (r=" << offseedFTS.position().mag() <<
", phi=" << offseedFTS.position().phi()
363 <<
", eta=" << offseedFTS.position().eta() <<
")" << std::endl;
364 LogDebug(metlabel) <<
"mom: (q*pt=" << offseedFTS.charge() * offseedFTS.momentum().perp()
365 <<
", phi=" << offseedFTS.momentum().phi() <<
", eta=" << offseedFTS.momentum().eta() <<
")"
370 if (offseedTsos.isValid()) {
371 LogDebug(metlabel) <<
"Offline seed info after propagation to L1 layer:" << std::endl;
374 LogDebug(metlabel) <<
"pos: (r=" << offseedTsos.globalPosition().mag()
375 <<
", phi=" << offseedTsos.globalPosition().phi()
376 <<
", eta=" << offseedTsos.globalPosition().eta() <<
")" << std::endl;
377 LogDebug(metlabel) <<
"mom: (q*pt=" << offseedTsos.charge() * offseedTsos.globalMomentum().perp()
378 <<
", phi=" << offseedTsos.globalMomentum().phi()
379 <<
", eta=" << offseedTsos.globalMomentum().eta() <<
")" << std::endl
384 offseedTsos.globalPosition().eta(),
385 offseedTsos.globalPosition().
phi());
386 LogDebug(metlabel) <<
" -- DR = " << newDr << std::endl;
387 if (newDr < 0.3 && newDr < bestDr) {
388 LogDebug(metlabel) <<
" --> OK! " << newDr << std::endl << std::endl;
389 selOffseed = &*offseed;
391 offseedMap[nOffseed] = 1;
392 if (lastOffseed > -1)
393 offseedMap[lastOffseed] = 0;
394 lastOffseed = nOffseed;
396 LogDebug(metlabel) <<
" --> Rejected. " << newDr << std::endl << std::endl;
399 LogDebug(metlabel) <<
"Invalid offline seed TSOS after propagation!" << std::endl << std::endl;