41 using namespace l1extra;
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>();
95 LogTrace(metname) <<
"Number of muons " << muColl->size() << endl;
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()) {
115 LogWarning(metname) <<
"L2MuonSeedGenerator: WARNING, no L1MuGMTCand! " << endl;
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();
158 charge = rmc[idx].chargeValue();
165 LogTrace(metname) <<
"New L2 Muon Seed";
166 LogTrace(metname) <<
"Pt = " << pt <<
" GeV/c";
168 LogTrace(metname) <<
"theta = " << theta <<
" rad";
169 LogTrace(metname) <<
"phi = " << phi <<
" rad";
183 CLHEP::Hep3Vector vec(0., 1., 0.);
189 LogTrace(metname) <<
"The seed is in the barrel";
193 detLayer =
theService->detLayerGeometry()->idToLayer(
id);
199 radius = fabs(bc->radius() /
sin(theta));
206 LogTrace(metname) <<
"The seed is in the endcap";
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.;
250 LogTrace(metname) <<
"Free trajectory State from the parameters";
256 LogTrace(metname) <<
"State after the propagation on the layer";
262 std::vector<pair<const GeomDet*, TrajectoryStateOnSurface> > detsWithStates =
264 if (!detsWithStates.empty()) {
266 const GeomDet* newTSOSDet = detsWithStates.front().first;
268 LogTrace(metname) <<
"Most compatible det";
271 LogDebug(metname) <<
"L1 info: Det and State:";
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;
T getUntrackedParameter(std::string const &, T const &) const
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< l1extra::L1MuonParticleCollection > muCollToken_
TrackCharge charge() const
edm::InputTag theL1GMTReadoutCollection
edm::EDGetTokenT< edm::View< TrajectorySeed > > offlineSeedToken_
uint16_t *__restrict__ id
std::string dumpLayer(const DetLayer *layer) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const std::string metname
uint32_t const *__restrict__ Quality * quality
void produce(edm::Event &, const edm::EventSetup &) override
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
constexpr uint32_t rawId() const
get the raw id
Geom::Theta< T > theta() const
GlobalPoint globalPosition() const
Exp< T >::type exp(const T &t)
std::vector< L1MuRegionalCand > getBrlRPCCands() const
get barrel RPC candidates vector
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
std::string dumpMuonId(const DetId &id) const
std::string dumpFTS(const FreeTrajectoryState &fts) const
std::vector< L1MuRegionalCand > getFwdRPCCands() const
get forward RPC candidates vector
const TrajectorySeed * associateOfflineSeedToL1(edm::Handle< edm::View< TrajectorySeed > > &, std::vector< int > &, TrajectoryStateOnSurface &)
const unsigned theL1MinQuality
std::vector< L1MuRegionalCand > getCSCCands() const
get CSC candidates vector
bool empty() const
is it an empty muon candidate?
const SurfaceType & surface() const
const_iterator begin() const
bool isRPC() const
get RPC bit (true=RPC, false = DT/CSC or matched)
bool charge_valid() const
is the charge valid ?
Cos< T >::type cos(const T &t)
unsigned getRPCIndex() const
get index of contributing RPC muon
DetId geographicalId() const
The label of this GeomDet.
RecHitRange recHits() const
unsigned int quality() const
get quality
PTrajectoryStateOnDet const & startingState() const
unsigned getDTCSCIndex() const
get index of contributing DT/CSC muon
const bool useOfflineSeed
MeasurementEstimator * theEstimator
virtual const Surface::PositionType & position() const
Returns position of the surface.
std::vector< L1MuRegionalCand > getDTBXCands() const
get DT candidates vector
T getParameter(std::string const &) const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
thePropagatorName(iConfig.getParameter< std::string >("Propagator"))
~L2MuonSeedGenerator() override
Destructor.
const bool useUnassociatedL1
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
GlobalVector globalMomentum() const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
std::string thePropagatorName
edm::EDGetTokenT< L1MuGMTReadoutCollection > gmtToken_
Log< level::Warning, false > LogWarning
L2MuonSeedGenerator(const edm::ParameterSet &)
Constructor.
bool isFwd() const
get forward bit (true=forward, false=barrel)
tuple Chi2MeasurementEstimator
edm::InputTag theOfflineSeedLabel