36 #include "CLHEP/Vector/ThreeVector.h" 87 static constexpr
float etaBoundary_{1.1};
88 static constexpr
float distMB2_{550.};
89 static constexpr
float distME2_{850.};
90 static constexpr
float phiCorr0_{1.464};
91 static constexpr
float phiCorr1_{1.7};
92 static constexpr
float phiCorr2_{144.};
106 : source_(iConfig.getParameter<
InputTag>(
"InputObjects")),
107 muCollToken_(consumes(source_)),
108 propagatorName_(iConfig.getParameter<
string>(
"Propagator")),
109 l1MinPt_(iConfig.getParameter<double>(
"L1MinPt")),
110 l1MaxEta_(iConfig.getParameter<double>(
"L1MaxEta")),
111 minPtBarrel_(iConfig.getParameter<double>(
"SetMinPtBarrelTo")),
112 minPtEndcap_(iConfig.getParameter<double>(
"SetMinPtEndcapTo")),
113 minPL1Tk_(iConfig.getParameter<double>(
"MinPL1Tk")),
114 minPtL1TkBarrel_(iConfig.getParameter<double>(
"MinPtL1TkBarrel")),
115 useOfflineSeed_(iConfig.getUntrackedParameter<
bool>(
"UseOfflineSeed",
false)),
116 useUnassociatedL1_(iConfig.getParameter<
bool>(
"UseUnassociatedL1")),
117 matchingDR_(iConfig.getParameter<
std::
vector<double>>(
"MatchDR")),
118 etaBins_(iConfig.getParameter<
std::
vector<double>>(
"EtaMatchingBins")) {
126 <<
"does not match number of eta bins." << endl;
134 service_ = std::make_unique<MuonServiceProxy>(serviceParameters, consumesCollector());
137 estimator_ = std::make_unique<Chi2MeasurementEstimator>(10000.);
139 produces<L2MuonTrajectorySeedCollection>();
145 desc.add<
string>(
"Propagator",
"");
146 desc.add<
double>(
"L1MinPt", -1.);
147 desc.add<
double>(
"L1MaxEta", 5.0);
148 desc.add<
double>(
"SetMinPtBarrelTo", 3.5);
149 desc.add<
double>(
"SetMinPtEndcapTo", 1.0);
150 desc.add<
double>(
"MinPL1Tk", 3.5);
151 desc.add<
double>(
"MinPtL1TkBarrel", 3.5);
152 desc.addUntracked<
bool>(
"UseOfflineSeed",
false);
153 desc.add<
bool>(
"UseUnassociatedL1",
true);
154 desc.add<std::vector<double>>(
"MatchDR", {0.3});
155 desc.add<std::vector<double>>(
"EtaMatchingBins", {0., 2.5});
159 psd0.
addUntracked<std::vector<std::string>>(
"Propagators", {
"SteppingHelixPropagatorAny"});
160 psd0.add<
bool>(
"RPCLayers",
true);
161 psd0.addUntracked<
bool>(
"UseMuonNavigation",
true);
163 descriptions.
add(
"L2MuonSeedGeneratorFromL1TkMu",
desc);
170 auto output = std::make_unique<L2MuonTrajectorySeedCollection>();
176 vector<int> offlineSeedMap;
179 offlineSeedMap = vector<int>(offlineSeedHandle->size(), 0);
182 for (
auto const &tkmu : *muColl) {
184 auto const &it = tkmu.trkPtr();
187 auto p3 = it->momentum();
189 float tk_p =
p3.mag();
193 float tk_pt =
p3.perp();
194 float tk_eta =
p3.eta();
201 float tk_phi =
p3.phi();
202 float tk_q = it->rInv() > 0 ? 1. : -1.;
203 float tk_z = it->POCA().z();
205 float dzCorrPhi = 1.;
207 float etaProp = tk_aeta;
211 deta = tk_z /
distMB2_ / cosh(tk_aeta);
216 dzCorrPhi = 1. +
delta;
220 deta = zOzs / (1. - zOzs);
222 deta = zOzs / (1. + zOzs);
223 deta = deta *
tanh(tk_eta);
229 float eta = tk_eta + deta;
232 int charge = it->rInv() > 0 ? 1 : -1;
251 CLHEP::Hep3Vector vec(0., 1., 0.);
262 detLayer =
service_->detLayerGeometry()->idToLayer(theid);
280 detLayer =
service_->detLayerGeometry()->idToLayer(theid);
298 mat[0][0] = (0.25 /
pt) * (0.25 /
pt);
300 mat[0][0] = (0.4 /
pt) * (0.4 /
pt);
302 mat[1][1] = 0.05 * 0.05;
303 mat[2][2] = 0.2 * 0.2;
304 mat[3][3] = 20. * 20.;
305 mat[4][4] = 20. * 20.;
332 std::vector<pair<const GeomDet *, TrajectoryStateOnSurface>> detsWithStates =
335 if (detsWithStates.empty() &&
barrel) {
339 const DetLayer *ME2DetLayer =
service_->detLayerGeometry()->idToLayer(fallback_id);
345 if (!detsWithStates.empty()) {
347 const GeomDet *newTSOSDet = detsWithStates.front().first;
363 if (assoOffseed !=
nullptr) {
396 std::vector<int> &offseedMap,
402 const std::string metlabel =
"Muon|RecoMuon|L2MuonSeedGeneratorFromL1TkMu";
407 double bestDr2 = 99999.;
408 unsigned int nOffseed(0);
411 for (offseed = offseeds->
begin(); offseed != endOffseed; ++offseed, ++nOffseed) {
412 if (offseedMap[nOffseed] != 0)
415 ->idToDet(offseed->startingState().detId())
417 .toGlobal(offseed->startingState().parameters().position());
419 ->idToDet(offseed->startingState().detId())
421 .toGlobal(offseed->startingState().parameters().momentum());
429 glbPos, glbMom, offseed->startingState().parameters().charge(), &*
service_->magneticField());
432 LogDebug(metlabel) <<
"Offline seed info: Det and State" << std::endl;
433 LogDebug(metlabel) << debugtmp.
dumpMuonId(offseed->startingState().detId()) << std::endl;
434 LogDebug(metlabel) <<
"pos: (r=" << offseedFTS.position().mag() <<
", phi=" << offseedFTS.position().phi()
435 <<
", eta=" << offseedFTS.position().eta() <<
")" << std::endl;
436 LogDebug(metlabel) <<
"mom: (q*pt=" << offseedFTS.charge() * offseedFTS.momentum().perp()
437 <<
", phi=" << offseedFTS.momentum().phi() <<
", eta=" << offseedFTS.momentum().eta() <<
")" 441 if (offseedTsos.isValid()) {
442 LogDebug(metlabel) <<
"Offline seed info after propagation to L1 layer:" << std::endl;
443 LogDebug(metlabel) <<
"pos: (r=" << offseedTsos.globalPosition().mag()
444 <<
", phi=" << offseedTsos.globalPosition().phi()
445 <<
", eta=" << offseedTsos.globalPosition().eta() <<
")" << std::endl;
446 LogDebug(metlabel) <<
"mom: (q*pt=" << offseedTsos.charge() * offseedTsos.globalMomentum().perp()
447 <<
", phi=" << offseedTsos.globalMomentum().phi()
448 <<
", eta=" << offseedTsos.globalMomentum().eta() <<
")" << std::endl
452 offseedTsos.globalPosition().eta(),
453 offseedTsos.globalPosition().
phi());
454 LogDebug(metlabel) <<
" -- DR = " << newDr2 << std::endl;
456 LogDebug(metlabel) <<
" --> OK! " << newDr2 << std::endl << std::endl;
457 selOffseed = &*offseed;
459 offseedMap[nOffseed] = 1;
460 if (lastOffseed > -1)
461 offseedMap[lastOffseed] = 0;
462 lastOffseed = nOffseed;
464 LogDebug(metlabel) <<
" --> Rejected. " << newDr2 << std::endl << std::endl;
467 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
void tanh(data_T data[CONFIG_T::n_in], res_T res[CONFIG_T::n_in])
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
constexpr T reduceRange(T x)
static constexpr float phiCorr1_
const std::string metname
RecHitRange recHits() const
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)
#define DEFINE_FWK_MODULE(type)
TrackCharge charge() const
const double minPtEndcap_
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
edm::EDGetTokenT< l1t::TrackerMuonCollection > muCollToken_
const_iterator begin() const
Geom::Theta< T > theta() const