37 #include "CLHEP/Vector/ThreeVector.h" 88 static constexpr
float etaBoundary_{1.1};
89 static constexpr
float distMB2_{550.};
90 static constexpr
float distME2_{850.};
91 static constexpr
float phiCorr0_{1.464};
92 static constexpr
float phiCorr1_{1.7};
93 static constexpr
float phiCorr2_{144.};
107 : source_(iConfig.getParameter<
InputTag>(
"InputObjects")),
109 propagatorName_(iConfig.getParameter<
string>(
"Propagator")),
110 l1MinPt_(iConfig.getParameter<double>(
"L1MinPt")),
111 l1MaxEta_(iConfig.getParameter<double>(
"L1MaxEta")),
112 minPtBarrel_(iConfig.getParameter<double>(
"SetMinPtBarrelTo")),
113 minPtEndcap_(iConfig.getParameter<double>(
"SetMinPtEndcapTo")),
114 minPL1Tk_(iConfig.getParameter<double>(
"MinPL1Tk")),
115 minPtL1TkBarrel_(iConfig.getParameter<double>(
"MinPtL1TkBarrel")),
116 useOfflineSeed_(iConfig.getUntrackedParameter<
bool>(
"UseOfflineSeed",
false)),
117 useUnassociatedL1_(iConfig.getParameter<
bool>(
"UseUnassociatedL1")),
118 matchingDR_(iConfig.getParameter<
std::
vector<double>>(
"MatchDR")),
119 etaBins_(iConfig.getParameter<
std::
vector<double>>(
"EtaMatchingBins")) {
127 <<
"does not match number of eta bins." << endl;
135 service_ = std::make_unique<MuonServiceProxy>(serviceParameters, consumesCollector());
138 estimator_ = std::make_unique<Chi2MeasurementEstimator>(10000.);
140 produces<L2MuonTrajectorySeedCollection>();
146 desc.add<
string>(
"Propagator",
"");
147 desc.add<
double>(
"L1MinPt", -1.);
148 desc.add<
double>(
"L1MaxEta", 5.0);
149 desc.add<
double>(
"SetMinPtBarrelTo", 3.5);
150 desc.add<
double>(
"SetMinPtEndcapTo", 1.0);
151 desc.add<
double>(
"MinPL1Tk", 3.5);
152 desc.add<
double>(
"MinPtL1TkBarrel", 3.5);
153 desc.addUntracked<
bool>(
"UseOfflineSeed",
false);
154 desc.add<
bool>(
"UseUnassociatedL1",
true);
155 desc.add<std::vector<double>>(
"MatchDR", {0.3});
156 desc.add<std::vector<double>>(
"EtaMatchingBins", {0., 2.5});
160 psd0.
addUntracked<std::vector<std::string>>(
"Propagators", {
"SteppingHelixPropagatorAny"});
161 psd0.add<
bool>(
"RPCLayers",
true);
162 psd0.addUntracked<
bool>(
"UseMuonNavigation",
true);
164 descriptions.
add(
"L2MuonSeedGeneratorFromL1TkMu",
desc);
171 auto output = std::make_unique<L2MuonTrajectorySeedCollection>();
178 vector<int> offlineSeedMap;
181 offlineSeedMap = vector<int>(offlineSeedHandle->size(), 0);
184 for (
auto const &tkmu : *muColl) {
186 auto const &it = tkmu.trkPtr();
189 auto p3 = it->momentum();
191 float tk_p =
p3.mag();
195 float tk_pt =
p3.perp();
196 float tk_eta =
p3.eta();
203 float tk_phi =
p3.phi();
204 float tk_q = it->rInv() > 0 ? 1. : -1.;
205 float tk_z = it->POCA().z();
207 float dzCorrPhi = 1.;
209 float etaProp = tk_aeta;
213 deta = tk_z /
distMB2_ / cosh(tk_aeta);
218 dzCorrPhi = 1. +
delta;
222 deta = zOzs / (1. - zOzs);
224 deta = zOzs / (1. + zOzs);
225 deta = deta * tanh(tk_eta);
231 float eta = tk_eta + deta;
234 int charge = it->rInv() > 0 ? 1 : -1;
253 CLHEP::Hep3Vector vec(0., 1., 0.);
264 detLayer =
service_->detLayerGeometry()->idToLayer(theid);
282 detLayer =
service_->detLayerGeometry()->idToLayer(theid);
300 mat[0][0] = (0.25 /
pt) * (0.25 /
pt);
302 mat[0][0] = (0.4 /
pt) * (0.4 /
pt);
304 mat[1][1] = 0.05 * 0.05;
305 mat[2][2] = 0.2 * 0.2;
306 mat[3][3] = 20. * 20.;
307 mat[4][4] = 20. * 20.;
334 std::vector<pair<const GeomDet *, TrajectoryStateOnSurface>> detsWithStates =
337 if (detsWithStates.empty() &&
barrel) {
341 const DetLayer *ME2DetLayer =
service_->detLayerGeometry()->idToLayer(fallback_id);
347 if (!detsWithStates.empty()) {
349 const GeomDet *newTSOSDet = detsWithStates.front().first;
365 if (assoOffseed !=
nullptr) {
398 std::vector<int> &offseedMap,
404 const std::string metlabel =
"Muon|RecoMuon|L2MuonSeedGeneratorFromL1TkMu";
409 double bestDr2 = 99999.;
410 unsigned int nOffseed(0);
413 for (offseed = offseeds->
begin(); offseed != endOffseed; ++offseed, ++nOffseed) {
414 if (offseedMap[nOffseed] != 0)
417 ->idToDet(offseed->startingState().detId())
419 .toGlobal(offseed->startingState().parameters().position());
421 ->idToDet(offseed->startingState().detId())
423 .toGlobal(offseed->startingState().parameters().momentum());
431 glbPos, glbMom, offseed->startingState().parameters().charge(), &*
service_->magneticField());
434 LogDebug(metlabel) <<
"Offline seed info: Det and State" << std::endl;
435 LogDebug(metlabel) << debugtmp.
dumpMuonId(offseed->startingState().detId()) << std::endl;
436 LogDebug(metlabel) <<
"pos: (r=" << offseedFTS.position().mag() <<
", phi=" << offseedFTS.position().phi()
437 <<
", eta=" << offseedFTS.position().eta() <<
")" << std::endl;
438 LogDebug(metlabel) <<
"mom: (q*pt=" << offseedFTS.charge() * offseedFTS.momentum().perp()
439 <<
", phi=" << offseedFTS.momentum().phi() <<
", eta=" << offseedFTS.momentum().eta() <<
")" 443 if (offseedTsos.isValid()) {
444 LogDebug(metlabel) <<
"Offline seed info after propagation to L1 layer:" << std::endl;
445 LogDebug(metlabel) <<
"pos: (r=" << offseedTsos.globalPosition().mag()
446 <<
", phi=" << offseedTsos.globalPosition().phi()
447 <<
", eta=" << offseedTsos.globalPosition().eta() <<
")" << std::endl;
448 LogDebug(metlabel) <<
"mom: (q*pt=" << offseedTsos.charge() * offseedTsos.globalMomentum().perp()
449 <<
", phi=" << offseedTsos.globalMomentum().phi()
450 <<
", eta=" << offseedTsos.globalMomentum().eta() <<
")" << std::endl
454 offseedTsos.globalPosition().eta(),
455 offseedTsos.globalPosition().
phi());
456 LogDebug(metlabel) <<
" -- DR = " << newDr2 << std::endl;
458 LogDebug(metlabel) <<
" --> OK! " << newDr2 << std::endl << std::endl;
459 selOffseed = &*offseed;
461 offseedMap[nOffseed] = 1;
462 if (lastOffseed > -1)
463 offseedMap[lastOffseed] = 0;
464 lastOffseed = nOffseed;
466 LogDebug(metlabel) <<
" --> Rejected. " << newDr2 << std::endl << std::endl;
469 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.
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
constexpr T reduceRange(T x)
static constexpr float phiCorr1_
const std::string metname
RecHitRange recHits() const
#define DEFINE_FWK_MODULE(type)
static constexpr float distMB2_
static constexpr float phiCorr0_
Geom::Phi< T > phi() const
Sin< T >::type sin(const T &t)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< edm::View< TrajectorySeed > > offlineSeedToken_
std::string propagatorName_
const SurfaceType & surface() const
edm::InputTag offlineSeedLabel_
const TrajectorySeed * associateOfflineSeedToL1(edm::Handle< edm::View< TrajectorySeed >> &, std::vector< int > &, TrajectoryStateOnSurface &, double)
T getUntrackedParameter(std::string const &, T const &) const
const bool useUnassociatedL1_
void produce(edm::Event &, const edm::EventSetup &) override
GlobalPoint globalPosition() const
std::vector< double > etaBins_
std::unique_ptr< MuonServiceProxy > service_
the event setup proxy, it takes care the services update
Cos< T >::type cos(const T &t)
std::unique_ptr< MeasurementEstimator > estimator_
Abs< T >::type abs(const T &t)
TrackCharge charge() const
const double minPtEndcap_
std::vector< TkMuon > TkMuonCollection
const bool useOfflineSeed_
DetId geographicalId() const
The label of this GeomDet.
PTrajectoryStateOnDet const & startingState() const
std::vector< double > matchingDR_
static constexpr float distME2_
static constexpr float etaBoundary_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
constexpr uint32_t rawId() const
get the raw id
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
void add(std::string const &label, ParameterSetDescription const &psetDescription)
GlobalVector globalMomentum() const
const double minPtBarrel_
L2MuonSeedGeneratorFromL1TkMu(const edm::ParameterSet &)
Constructor.
const double minPtL1TkBarrel_
static constexpr float phiCorr2_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
const_iterator begin() const
edm::EDGetTokenT< l1t::TkMuonCollection > muCollToken_
Geom::Theta< T > theta() const