41 using namespace l1extra;
46 theL1GMTReadoutCollection(iConfig.getParameter<
InputTag>(
"GMTReadoutCollection")),
47 thePropagatorName(iConfig.getParameter<
string>(
"Propagator")),
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") ?
53 iConfig.getParameter<bool>(
"UseUnassociatedL1") :
true){
73 produces<L2MuonTrajectorySeedCollection>();
96 LogTrace(metname) <<
"Number of muons " << muColl->size() << endl;
99 vector<int> offlineSeedMap;
102 LogTrace(metname) <<
"Number of offline seeds " << offlineSeedHandle->size() << endl;
103 offlineSeedMap = vector<int>(offlineSeedHandle->size(), 0);
106 L1MuonParticleCollection::const_iterator it;
109 for(it = muColl->begin(); it != muColl->end(); ++it,++l1ParticleIndex) {
112 unsigned int quality = 0;
113 bool valid_charge =
false;;
115 if ( muonCand.
empty() ) {
116 LogWarning(metname) <<
"L2MuonSeedGenerator: WARNING, no L1MuGMTCand! " << endl;
117 LogWarning(metname) <<
"L2MuonSeedGenerator: this should make sense only within MC tests" << endl;
127 float pt = (*it).pt();
128 float eta = (*it).eta();
130 float phi = (*it).phi();
131 int charge = (*it).charge();
133 if (!valid_charge) charge = 0;
134 bool barrel = !(*it).isForward();
138 if ( !(muonCand.
empty()) ) {
140 vector<L1MuRegionalCand> rmc;
141 if ( !muonCand.
isRPC() ) {
151 eta = rmc[
idx].etaValue();
154 if (!valid_charge) charge = rmc[
idx].chargeValue();
160 LogTrace(metname) <<
"New L2 Muon Seed";
161 LogTrace(metname) <<
"Pt = " << pt <<
" GeV/c";
163 LogTrace(metname) <<
"theta = " << theta <<
" rad";
164 LogTrace(metname) <<
"phi = " << phi <<
" rad";
169 LogTrace(metname) <<
"quality = "<< quality;
177 CLHEP::Hep3Vector vec(0.,1.,0.);
183 LogTrace(metname) <<
"The seed is in the barrel";
187 detLayer =
theService->detLayerGeometry()->idToLayer(
id);
193 radius = fabs(bc->radius()/
sin(theta));
197 if ( pt < 3.5 ) pt = 3.5;
200 LogTrace(metname) <<
"The seed is in the endcap";
209 detLayer =
theService->detLayerGeometry()->idToLayer(
id);
214 if( pt < 1.0) pt = 1.0;
226 mat[0][0] = (0.25/
pt)*(0.25/pt);
227 if ( !barrel ) mat[0][0] = (0.4/
pt)*(0.4/pt);
230 if (!valid_charge) mat[0][0] = (1./
pt)*(1./pt);
232 mat[1][1] = 0.05*0.05;
241 LogTrace(metname) <<
"Free trajectory State from the parameters";
247 LogTrace(metname) <<
"State after the propagation on the layer";
253 std::vector< pair<const GeomDet*,TrajectoryStateOnSurface> >
257 if (detsWithStates.size()){
260 const GeomDet *newTSOSDet = detsWithStates.front().first;
262 LogTrace(metname) <<
"Most compatible det";
265 LogDebug(metname) <<
"L1 info: Det and State:";
290 tsci = assoOffseed->
recHits().first,
291 tscie = assoOffseed->
recHits().second;
292 for(; tsci!=tscie; ++tsci) {
324 std::vector<int> & offseedMap,
327 const std::string metlabel =
"Muon|RecoMuon|L2MuonSeedGenerator";
332 double bestDr = 99999.;
333 unsigned int nOffseed(0);
336 for(offseed=offseeds->
begin(); offseed!=endOffseed; ++offseed, ++nOffseed) {
337 if(offseedMap[nOffseed]!=0)
continue;
338 GlobalPoint glbPos =
theService->trackingGeometry()->idToDet(offseed->startingState().detId())->surface().toGlobal(offseed->startingState().parameters().position());
339 GlobalVector glbMom =
theService->trackingGeometry()->idToDet(offseed->startingState().detId())->surface().toGlobal(offseed->startingState().parameters().momentum());
343 if(preDr > 1.0)
continue;
347 LogDebug(metlabel) <<
"Offline seed info: Det and State" << std::endl;
348 LogDebug(metlabel) << debugtmp.
dumpMuonId(offseed->startingState().detId()) << std::endl;
351 LogDebug(metlabel) <<
"pos: (r=" << offseedFTS.position().mag() <<
", phi="
352 << offseedFTS.position().phi() <<
", eta=" << offseedFTS.position().eta() <<
")" << std::endl;
353 LogDebug(metlabel) <<
"mom: (q*pt=" << offseedFTS.charge()*offseedFTS.momentum().perp() <<
", phi="
354 << offseedFTS.momentum().phi() <<
", eta=" << offseedFTS.momentum().eta() <<
")" << std::endl << std::endl;
357 if(offseedTsos.isValid()) {
358 LogDebug(metlabel) <<
"Offline seed info after propagation to L1 layer:" << std::endl;
361 LogDebug(metlabel) <<
"pos: (r=" << offseedTsos.globalPosition().mag() <<
", phi="
362 << offseedTsos.globalPosition().phi() <<
", eta=" << offseedTsos.globalPosition().eta() <<
")" << std::endl;
363 LogDebug(metlabel) <<
"mom: (q*pt=" << offseedTsos.charge()*offseedTsos.globalMomentum().perp() <<
", phi="
364 << offseedTsos.globalMomentum().phi() <<
", eta=" << offseedTsos.globalMomentum().eta() <<
")" << std::endl << std::endl;
367 offseedTsos.globalPosition().eta(), offseedTsos.globalPosition().
phi() );
368 LogDebug(metlabel) <<
" -- DR = " << newDr << std::endl;
369 if( newDr<0.3 && newDr<bestDr ) {
370 LogDebug(metlabel) <<
" --> OK! " << newDr << std::endl << std::endl;
371 selOffseed = &*offseed;
373 offseedMap[nOffseed] = 1;
374 if(lastOffseed>-1) offseedMap[lastOffseed] = 0;
375 lastOffseed = nOffseed;
378 LogDebug(metlabel) <<
" --> Rejected. " << newDr << std::endl << std::endl;
382 LogDebug(metlabel) <<
"Invalid offline seed TSOS after propagation!" << std::endl << std::endl;
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.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
edm::EDGetTokenT< l1extra::L1MuonParticleCollection > muCollToken_
TrackCharge charge() const
edm::InputTag theL1GMTReadoutCollection
edm::EDGetTokenT< edm::View< TrajectorySeed > > offlineSeedToken_
std::string dumpLayer(const DetLayer *layer) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const std::string metname
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
Geom::Theta< T > theta() const
GlobalPoint globalPosition() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
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
~L2MuonSeedGenerator()
Destructor.
std::string dumpMuonId(const DetId &id) const
std::string dumpFTS(const FreeTrajectoryState &fts) const
std::vector< L1MuRegionalCand > getFwdRPCCands() const
get forward RPC candidates vector
uint32_t rawId() const
get the raw id
const TrajectorySeed * associateOfflineSeedToL1(edm::Handle< edm::View< TrajectorySeed > > &, std::vector< int > &, TrajectoryStateOnSurface &)
const unsigned theL1MinQuality
std::vector< L1MuRegionalCand > getCSCCands() const
get CSC candidates vector
virtual void produce(edm::Event &, const edm::EventSetup &)
bool empty() const
is it an empty muon candidate?
const SurfaceType & surface() const
bool isRPC() const
get RPC bit (true=RPC, false = DT/CSC or matched)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
recHitContainer::const_iterator const_iterator
std::vector< L2MuonTrajectorySeed > L2MuonTrajectorySeedCollection
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.
tuple Chi2MeasurementEstimator
double deltaR(double eta1, double eta2, double phi1, double phi2)
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.
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
std::vector< L1MuRegionalCand > getDTBXCands() const
get DT candidates vector
T const * product() const
const bool useUnassociatedL1
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
GlobalVector globalMomentum() const
std::string thePropagatorName
const_iterator begin() const
edm::EDGetTokenT< L1MuGMTReadoutCollection > gmtToken_
volatile std::atomic< bool > shutdown_flag false
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
L2MuonSeedGenerator(const edm::ParameterSet &)
Constructor.
bool isFwd() const
get forward bit (true=forward, false=barrel)
edm::InputTag theOfflineSeedLabel