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);
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;
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
std::string dumpMuonId(const DetId &id) const
T getParameter(std::string const &) const
virtual const Surface::PositionType & position() const
Returns position of the surface.
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
edm::EDGetTokenT< l1extra::L1MuonParticleCollection > muCollToken_
edm::InputTag theL1GMTReadoutCollection
edm::EDGetTokenT< edm::View< TrajectorySeed > > offlineSeedToken_
const std::string metname
RecHitRange recHits() const
Geom::Phi< T > phi() const
void produce(edm::Event &, const edm::EventSetup &) override
Sin< T >::type sin(const T &t)
unsigned getRPCIndex() const
get index of contributing RPC muon
const SurfaceType & surface() const
T getUntrackedParameter(std::string const &, T const &) const
unsigned int quality() const
get quality
const TrajectorySeed * associateOfflineSeedToL1(edm::Handle< edm::View< TrajectorySeed > > &, std::vector< int > &, TrajectoryStateOnSurface &)
const unsigned theL1MinQuality
bool charge_valid() const
is the charge valid ?
GlobalPoint globalPosition() const
std::vector< L1MuRegionalCand > getDTBXCands() const
get DT candidates vector
Cos< T >::type cos(const T &t)
TrackCharge charge() const
DetId geographicalId() const
The label of this GeomDet.
bool isRPC() const
get RPC bit (true=RPC, false = DT/CSC or matched)
bool empty() const
is it an empty muon candidate?
std::vector< L1MuRegionalCand > getBrlRPCCands() const
get barrel RPC candidates vector
PTrajectoryStateOnDet const & startingState() const
std::vector< L1MuRegionalCand > getCSCCands() const
get CSC candidates vector
const bool useOfflineSeed
MeasurementEstimator * theEstimator
constexpr uint32_t rawId() const
get the raw id
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
GlobalVector globalMomentum() const
~L2MuonSeedGenerator() override
Destructor.
const bool useUnassociatedL1
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
std::string thePropagatorName
edm::EDGetTokenT< L1MuGMTReadoutCollection > gmtToken_
const_iterator begin() const
std::vector< L1MuRegionalCand > getFwdRPCCands() const
get forward RPC candidates vector
Log< level::Warning, false > LogWarning
L2MuonSeedGenerator(const edm::ParameterSet &)
Constructor.
bool isFwd() const
get forward bit (true=forward, false=barrel)
Geom::Theta< T > theta() const
unsigned getDTCSCIndex() const
get index of contributing DT/CSC muon
edm::InputTag theOfflineSeedLabel