47 theL1GMTReadoutCollection(iConfig.getParameter<
InputTag>(
"GMTReadoutCollection")),
48 thePropagatorName(iConfig.getParameter<
string>(
"Propagator")),
49 theL1MinPt(iConfig.getParameter<double>(
"L1MinPt")),
50 theL1MaxEta(iConfig.getParameter<double>(
"L1MaxEta")),
51 theL1MinQuality(iConfig.getParameter<unsigned int>(
"L1MinQuality")),
52 useOfflineSeed(iConfig.getUntrackedParameter<bool>(
"UseOfflineSeed",
false)),
53 useUnassociatedL1(iConfig.existsAs<bool>(
"UseUnassociatedL1") ?
54 iConfig.getParameter<bool>(
"UseUnassociatedL1") :
true),
55 centralBxOnly_( iConfig.getParameter<bool>(
"CentralBxOnly") )
75 produces<L2MuonTrajectorySeedCollection>();
89 desc.
add<
string>(
"Propagator",
"");
90 desc.
add<
double>(
"L1MinPt",-1.);
91 desc.
add<
double>(
"L1MaxEta",5.0);
92 desc.
add<
unsigned int>(
"L1MinQuality",0);
94 desc.
add<
bool>(
"UseUnassociatedL1",
true);
95 desc.
add<
bool>(
"CentralBxOnly",
true);
99 psd0.
addUntracked<std::vector<std::string>>(
"Propagators", {
100 "SteppingHelixPropagatorAny"
102 psd0.add<
bool>(
"RPCLayers",
true);
103 psd0.addUntracked<
bool>(
"UseMuonNavigation",
true);
105 descriptions.
add(
"L2MuonSeedGeneratorFromL1T",desc);
117 LogTrace(metname) <<
"Number of muons " << muColl->size() << endl;
120 vector<int> offlineSeedMap;
123 LogTrace(metname) <<
"Number of offline seeds " << offlineSeedHandle->size() << endl;
124 offlineSeedMap = vector<int>(offlineSeedHandle->size(), 0);
127 for (
int ibx = muColl->getFirstBX(); ibx <= muColl->getLastBX(); ++ibx) {
129 for (
auto it = muColl->begin(ibx); it != muColl->end(ibx); it++){
131 unsigned int quality = it->hwQual();
132 int valid_charge = it->hwChargeValid();
135 float eta = it->eta();
137 float phi = it->phi();
138 int charge = it->charge();
140 if (!valid_charge) charge = 0;
142 bool barrel = fabs(eta) < 1.04 ?
true :
false;
146 LogTrace(metname) <<
"New L2 Muon Seed" ;
147 LogTrace(metname) <<
"Pt = " << pt <<
" GeV/c";
149 LogTrace(metname) <<
"theta = " << theta <<
" rad";
150 LogTrace(metname) <<
"phi = " << phi <<
" rad";
163 CLHEP::Hep3Vector vec(0.,1.,0.);
169 LogTrace(metname) <<
"The seed is in the barrel";
173 detLayer =
theService->detLayerGeometry()->idToLayer(
id);
179 radius = fabs(bc->radius()/
sin(theta));
183 if ( pt < 3.5 ) pt = 3.5;
186 LogTrace(metname) <<
"The seed is in the endcap";
195 detLayer =
theService->detLayerGeometry()->idToLayer(
id);
200 if( pt < 1.0) pt = 1.0;
212 mat[0][0] = (0.25/
pt)*(0.25/pt);
213 if ( !barrel ) mat[0][0] = (0.4/
pt)*(0.4/pt);
216 if (!valid_charge) mat[0][0] = (1./
pt)*(1./pt);
218 mat[1][1] = 0.05*0.05;
227 LogTrace(metname) <<
"Free trajectory State from the parameters";
233 LogTrace(metname) <<
"State after the propagation on the layer";
239 std::vector< pair<const GeomDet*,TrajectoryStateOnSurface> >
243 if (detsWithStates.size()){
246 const GeomDet *newTSOSDet = detsWithStates.front().first;
248 LogTrace(metname) <<
"Most compatible det";
251 LogDebug(metname) <<
"L1 info: Det and State:";
276 tsci = assoOffseed->
recHits().first,
277 tscie = assoOffseed->
recHits().second;
278 for(; tsci!=tscie; ++tsci) {
316 std::vector<int> & offseedMap,
319 const std::string metlabel =
"Muon|RecoMuon|L2MuonSeedGeneratorFromL1T";
324 double bestDr = 99999.;
325 unsigned int nOffseed(0);
328 for(offseed=offseeds->
begin(); offseed!=endOffseed; ++offseed, ++nOffseed) {
329 if(offseedMap[nOffseed]!=0)
continue;
330 GlobalPoint glbPos =
theService->trackingGeometry()->idToDet(offseed->startingState().detId())->surface().toGlobal(offseed->startingState().parameters().position());
331 GlobalVector glbMom =
theService->trackingGeometry()->idToDet(offseed->startingState().detId())->surface().toGlobal(offseed->startingState().parameters().momentum());
335 if(preDr > 1.0)
continue;
339 LogDebug(metlabel) <<
"Offline seed info: Det and State" << std::endl;
340 LogDebug(metlabel) << debugtmp.
dumpMuonId(offseed->startingState().detId()) << std::endl;
343 LogDebug(metlabel) <<
"pos: (r=" << offseedFTS.position().mag() <<
", phi="
344 << offseedFTS.position().phi() <<
", eta=" << offseedFTS.position().eta() <<
")" << std::endl;
345 LogDebug(metlabel) <<
"mom: (q*pt=" << offseedFTS.charge()*offseedFTS.momentum().perp() <<
", phi="
346 << offseedFTS.momentum().phi() <<
", eta=" << offseedFTS.momentum().eta() <<
")" << std::endl << std::endl;
349 if(offseedTsos.isValid()) {
350 LogDebug(metlabel) <<
"Offline seed info after propagation to L1 layer:" << std::endl;
353 LogDebug(metlabel) <<
"pos: (r=" << offseedTsos.globalPosition().mag() <<
", phi="
354 << offseedTsos.globalPosition().phi() <<
", eta=" << offseedTsos.globalPosition().eta() <<
")" << std::endl;
355 LogDebug(metlabel) <<
"mom: (q*pt=" << offseedTsos.charge()*offseedTsos.globalMomentum().perp() <<
", phi="
356 << offseedTsos.globalMomentum().phi() <<
", eta=" << offseedTsos.globalMomentum().eta() <<
")" << std::endl << std::endl;
359 offseedTsos.globalPosition().eta(), offseedTsos.globalPosition().
phi() );
360 LogDebug(metlabel) <<
" -- DR = " << newDr << std::endl;
361 if( newDr<0.3 && newDr<bestDr ) {
362 LogDebug(metlabel) <<
" --> OK! " << newDr << std::endl << std::endl;
363 selOffseed = &*offseed;
365 offseedMap[nOffseed] = 1;
366 if(lastOffseed>-1) offseedMap[lastOffseed] = 0;
367 lastOffseed = nOffseed;
370 LogDebug(metlabel) <<
" --> Rejected. " << newDr << std::endl << std::endl;
374 LogDebug(metlabel) <<
"Invalid offline seed TSOS after propagation!" << std::endl << std::endl;
edm::EDGetTokenT< edm::View< TrajectorySeed > > offlineSeedToken_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
TrackCharge charge() const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
bool centralBxOnly_
use central bx only muons
std::string dumpLayer(const DetLayer *layer) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const std::string metname
const bool useOfflineSeed
~L2MuonSeedGeneratorFromL1T()
Destructor.
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
Geom::Theta< T > theta() const
GlobalPoint globalPosition() const
L2MuonSeedGeneratorFromL1T(const edm::ParameterSet &)
Constructor.
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
edm::Ref< MuonBxCollection > MuonRef
std::string dumpMuonId(const DetId &id) const
std::string dumpFTS(const FreeTrajectoryState &fts) const
uint32_t rawId() const
get the raw id
const SurfaceType & surface() const
const_iterator begin() const
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
const unsigned theL1MinQuality
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
recHitContainer::const_iterator const_iterator
std::vector< L2MuonTrajectorySeed > L2MuonTrajectorySeedCollection
Cos< T >::type cos(const T &t)
DetId geographicalId() const
The label of this GeomDet.
const TrajectorySeed * associateOfflineSeedToL1(edm::Handle< edm::View< TrajectorySeed > > &, std::vector< int > &, TrajectoryStateOnSurface &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const bool useUnassociatedL1
double deltaR(double eta1, double eta2, double phi1, double phi2)
PTrajectoryStateOnDet const & startingState() const
virtual const Surface::PositionType & position() const
Returns position of the surface.
edm::EDGetTokenT< l1t::MuonBxCollection > muCollToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
GlobalVector globalMomentum() const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
MeasurementEstimator * theEstimator
virtual void produce(edm::Event &, const edm::EventSetup &) override
std::string thePropagatorName
edm::InputTag theOfflineSeedLabel
volatile std::atomic< bool > shutdown_flag false