CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
L2MuonSeedGeneratorFromL1T Class Reference

#include <L2MuonSeedGeneratorFromL1T.h>

Inheritance diagram for L2MuonSeedGeneratorFromL1T:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L2MuonSeedGeneratorFromL1T (const edm::ParameterSet &)
 Constructor. More...
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 ~L2MuonSeedGeneratorFromL1T ()
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

const TrajectorySeedassociateOfflineSeedToL1 (edm::Handle< edm::View< TrajectorySeed > > &, std::vector< int > &, TrajectoryStateOnSurface &)
 

Private Attributes

bool centralBxOnly_
 use central bx only muons More...
 
edm::EDGetTokenT
< l1t::MuonBxCollection
muCollToken_
 
edm::EDGetTokenT< edm::View
< TrajectorySeed > > 
offlineSeedToken_
 
MeasurementEstimatortheEstimator
 
edm::InputTag theL1GMTReadoutCollection
 
const double theL1MaxEta
 
const double theL1MinPt
 
const unsigned theL1MinQuality
 
edm::InputTag theOfflineSeedLabel
 
std::string thePropagatorName
 
MuonServiceProxytheService
 the event setup proxy, it takes care the services update More...
 
edm::InputTag theSource
 
const bool useOfflineSeed
 
const bool useUnassociatedL1
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

L2 muon seed generator: Transform the L1 informations in seeds for the L2 muon reconstruction

Author
A.Everett, R.Bellan, J. Alcaraz

ORCA's author: N. Neumeister

L2 muon seed generator: Transform the L1 informations in seeds for the L2 muon reconstruction

Author
A.Everett, R.Bellan

ORCA's author: N. Neumeister

Definition at line 46 of file L2MuonSeedGeneratorFromL1T.h.

Constructor & Destructor Documentation

L2MuonSeedGeneratorFromL1T::L2MuonSeedGeneratorFromL1T ( const edm::ParameterSet iConfig)
explicit

Constructor.

Definition at line 45 of file L2MuonSeedGeneratorFromL1T.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), muCollToken_, MuonServiceProxy_cff::MuonServiceProxy, offlineSeedToken_, theEstimator, theOfflineSeedLabel, theService, theSource, and useOfflineSeed.

45  :
46  theSource(iConfig.getParameter<InputTag>("InputObjects")),
47  theL1GMTReadoutCollection(iConfig.getParameter<InputTag>("GMTReadoutCollection")), // to be removed
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") )
56  {
57 
58  muCollToken_ = consumes<MuonBxCollection>(theSource);
59 
60  if(useOfflineSeed) {
61  theOfflineSeedLabel = iConfig.getUntrackedParameter<InputTag>("OfflineSeedLabel");
62  offlineSeedToken_ = consumes<edm::View<TrajectorySeed> >(theOfflineSeedLabel);
63  }
64 
65  // service parameters
66  ParameterSet serviceParameters = iConfig.getParameter<ParameterSet>("ServiceParameters");
67 
68  // the services
69  theService = new MuonServiceProxy(serviceParameters);
70 
71  // the estimator
73 
74 
75  produces<L2MuonTrajectorySeedCollection>();
76 }
edm::EDGetTokenT< edm::View< TrajectorySeed > > offlineSeedToken_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
bool centralBxOnly_
use central bx only muons
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
edm::EDGetTokenT< l1t::MuonBxCollection > muCollToken_
L2MuonSeedGeneratorFromL1T::~L2MuonSeedGeneratorFromL1T ( )

Destructor.

Definition at line 79 of file L2MuonSeedGeneratorFromL1T.cc.

References theEstimator, and theService.

79  {
80  if (theService) delete theService;
81  if (theEstimator) delete theEstimator;
82 }
MuonServiceProxy * theService
the event setup proxy, it takes care the services update

Member Function Documentation

const TrajectorySeed * L2MuonSeedGeneratorFromL1T::associateOfflineSeedToL1 ( edm::Handle< edm::View< TrajectorySeed > > &  offseeds,
std::vector< int > &  offseedMap,
TrajectoryStateOnSurface newTsos 
)
private

Definition at line 315 of file L2MuonSeedGeneratorFromL1T.cc.

References edm::View< T >::begin(), deltaR(), MuonPatternRecoDumper::dumpMuonId(), PV3DBase< T, PVType, FrameType >::eta(), TrajectoryStateOnSurface::globalPosition(), LogDebug, Geom::Phi< T >::phi(), PV3DBase< T, PVType, FrameType >::phi(), AlCaHLTBitMon_QueryRunRegistry::string, TrajectoryStateOnSurface::surface(), thePropagatorName, and theService.

Referenced by produce().

317  {
318 
319  const std::string metlabel = "Muon|RecoMuon|L2MuonSeedGeneratorFromL1T";
320  MuonPatternRecoDumper debugtmp;
321 
322  edm::View<TrajectorySeed>::const_iterator offseed, endOffseed = offseeds->end();
323  const TrajectorySeed *selOffseed = 0;
324  double bestDr = 99999.;
325  unsigned int nOffseed(0);
326  int lastOffseed(-1);
327 
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());
332 
333  // Preliminary check
334  double preDr = deltaR( newTsos.globalPosition().eta(), newTsos.globalPosition().phi(), glbPos.eta(), glbPos.phi() );
335  if(preDr > 1.0) continue;
336 
337  const FreeTrajectoryState offseedFTS(glbPos, glbMom, offseed->startingState().parameters().charge(), &*theService->magneticField());
338  TrajectoryStateOnSurface offseedTsos = theService->propagator(thePropagatorName)->propagate(offseedFTS, newTsos.surface());
339  LogDebug(metlabel) << "Offline seed info: Det and State" << std::endl;
340  LogDebug(metlabel) << debugtmp.dumpMuonId(offseed->startingState().detId()) << std::endl;
341  //LogDebug(metlabel) << "(x, y, z) = (" << newTSOS.globalPosition().x() << ", "
342  // << newTSOS.globalPosition().y() << ", " << newTSOS.globalPosition().z() << ")" << 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;
347  //LogDebug(metlabel) << debugtmp.dumpFTS(offseedFTS) << std::endl;
348 
349  if(offseedTsos.isValid()) {
350  LogDebug(metlabel) << "Offline seed info after propagation to L1 layer:" << std::endl;
351  //LogDebug(metlabel) << "(x, y, z) = (" << offseedTsos.globalPosition().x() << ", "
352  // << offseedTsos.globalPosition().y() << ", " << offseedTsos.globalPosition().z() << ")" << 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;
357  //LogDebug(metlabel) << debugtmp.dumpTSOS(offseedTsos) << std::endl;
358  double newDr = deltaR( newTsos.globalPosition().eta(), newTsos.globalPosition().phi(),
359  offseedTsos.globalPosition().eta(), offseedTsos.globalPosition().phi() );
360  LogDebug(metlabel) << " -- DR = " << newDr << std::endl;
361  if( newDr<0.3 && newDr<bestDr ) { // FIXME: to be updated once we have info on eta resolution from L1
362  LogDebug(metlabel) << " --> OK! " << newDr << std::endl << std::endl;
363  selOffseed = &*offseed;
364  bestDr = newDr;
365  offseedMap[nOffseed] = 1;
366  if(lastOffseed>-1) offseedMap[lastOffseed] = 0;
367  lastOffseed = nOffseed;
368  }
369  else {
370  LogDebug(metlabel) << " --> Rejected. " << newDr << std::endl << std::endl;
371  }
372  }
373  else {
374  LogDebug(metlabel) << "Invalid offline seed TSOS after propagation!" << std::endl << std::endl;
375  }
376  }
377 
378  return selOffseed;
379 }
#define LogDebug(id)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
GlobalPoint globalPosition() const
std::string dumpMuonId(const DetId &id) const
const SurfaceType & surface() const
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
T phi() const
Definition: Phi.h:41
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
T eta() const
Definition: PV3DBase.h:76
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
void L2MuonSeedGeneratorFromL1T::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 85 of file L2MuonSeedGeneratorFromL1T.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), and HLT_FULL_cff::InputTag.

85  {
87  desc.add<edm::InputTag>("GMTReadoutCollection", edm::InputTag("")); // to be removed
88  desc.add<edm::InputTag>("InputObjects",edm::InputTag("hltGmtStage2Digis"));
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);
93  desc.addUntracked<bool>("UseOfflineSeed",false);
94  desc.add<bool>("UseUnassociatedL1", true);
95  desc.add<bool>("CentralBxOnly", true);
96  desc.addUntracked<edm::InputTag>("OfflineSeedLabel", edm::InputTag(""));
97 
99  psd0.addUntracked<std::vector<std::string>>("Propagators", {
100  "SteppingHelixPropagatorAny"
101  });
102  psd0.add<bool>("RPCLayers", true);
103  psd0.addUntracked<bool>("UseMuonNavigation", true);
104  desc.add<edm::ParameterSetDescription>("ServiceParameters", psd0);
105  descriptions.add("L2MuonSeedGeneratorFromL1T",desc);
106 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void L2MuonSeedGeneratorFromL1T::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 108 of file L2MuonSeedGeneratorFromL1T.cc.

References alongMomentum, associateOfflineSeedToL1(), Reference_intrackfit_cff::barrel, centralBxOnly_, RecoTauCleanerPlugins::charge, TrajectoryStateOnSurface::charge(), GeometricSearchDet::compatibleDets(), funct::cos(), CSCDetId, debug, HLT_FULL_cff::distance, DTChamberId, MuonPatternRecoDumper::dumpFTS(), MuonPatternRecoDumper::dumpLayer(), MuonPatternRecoDumper::dumpMuonId(), relativeConstraints::error, eta, PV3DBase< T, PVType, FrameType >::eta(), create_public_lumi_plots::exp, GeomDet::geographicalId(), edm::Event::getByToken(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), LogDebug, LogTrace, PV3DBase< T, PVType, FrameType >::mag(), metname, muCollToken_, offlineSeedToken_, convertSQLitetoXML_cfg::output, PV3DBase< T, PVType, FrameType >::perp(), trajectoryStateTransform::persistentState(), phi, PV3DBase< T, PVType, FrameType >::phi(), Geom::pi(), GeometricSearchDet::position(), EnergyCorrector::pt, edm::OwnVector< T, P >::push_back(), edm::Event::put(), HLT_FULL_cff::quality, CosmicsPD_Skims::radius, DetId::rawId(), TrajectorySeed::recHits(), funct::sin(), TrajectorySeed::startingState(), AlCaHLTBitMon_QueryRunRegistry::string, GeometricSearchDet::surface(), theEstimator, theL1MaxEta, theL1MinPt, theL1MinQuality, thePropagatorName, theService, theta(), useOfflineSeed, useUnassociatedL1, and PV3DBase< T, PVType, FrameType >::z().

109 {
110  const std::string metname = "Muon|RecoMuon|L2MuonSeedGeneratorFromL1T";
112 
113  auto_ptr<L2MuonTrajectorySeedCollection> output(new L2MuonTrajectorySeedCollection());
114 
116  iEvent.getByToken(muCollToken_, muColl);
117  LogTrace(metname) << "Number of muons " << muColl->size() << endl;
118 
119  edm::Handle<edm::View<TrajectorySeed> > offlineSeedHandle;
120  vector<int> offlineSeedMap;
121  if(useOfflineSeed) {
122  iEvent.getByToken(offlineSeedToken_, offlineSeedHandle);
123  LogTrace(metname) << "Number of offline seeds " << offlineSeedHandle->size() << endl;
124  offlineSeedMap = vector<int>(offlineSeedHandle->size(), 0);
125  }
126 
127  for (int ibx = muColl->getFirstBX(); ibx <= muColl->getLastBX(); ++ibx) {
128  if (centralBxOnly_ && (ibx != 0)) continue;
129  for (auto it = muColl->begin(ibx); it != muColl->end(ibx); it++){
130 
131  unsigned int quality = it->hwQual();
132  int valid_charge = it->hwChargeValid();
133 
134  float pt = it->pt();
135  float eta = it->eta();
136  float theta = 2*atan(exp(-eta));
137  float phi = it->phi();
138  int charge = it->charge();
139  // Set charge=0 for the time being if the valid charge bit is zero
140  if (!valid_charge) charge = 0;
141 
142  bool barrel = fabs(eta) < 1.04 ? true : false; // FIXME: to be updated once we have definition from L1
143 
144  if ( pt < theL1MinPt || fabs(eta) > theL1MaxEta ) continue;
145 
146  LogTrace(metname) << "New L2 Muon Seed" ;
147  LogTrace(metname) << "Pt = " << pt << " GeV/c";
148  LogTrace(metname) << "eta = " << eta;
149  LogTrace(metname) << "theta = " << theta << " rad";
150  LogTrace(metname) << "phi = " << phi << " rad";
151  LogTrace(metname) << "charge = " << charge;
152  LogTrace(metname) << "In Barrel? = " << barrel;
153 
154  if ( quality <= theL1MinQuality ) continue;
155  LogTrace(metname) << "quality = "<< quality;
156 
157  // Update the services
158  theService->update(iSetup);
159 
160  const DetLayer *detLayer = 0;
161  float radius = 0.;
162 
163  CLHEP::Hep3Vector vec(0.,1.,0.);
164  vec.setTheta(theta);
165  vec.setPhi(phi);
166 
167  // Get the det layer on which the state should be put
168  if ( barrel ){
169  LogTrace(metname) << "The seed is in the barrel";
170 
171  // MB2
172  DetId id = DTChamberId(0,2,0);
173  detLayer = theService->detLayerGeometry()->idToLayer(id);
174  LogTrace(metname) << "L2 Layer: " << debug.dumpLayer(detLayer);
175 
176  const BoundSurface* sur = &(detLayer->surface());
177  const BoundCylinder* bc = dynamic_cast<const BoundCylinder*>(sur);
178 
179  radius = fabs(bc->radius()/sin(theta));
180 
181  LogTrace(metname) << "radius "<<radius;
182 
183  if ( pt < 3.5 ) pt = 3.5;
184  }
185  else {
186  LogTrace(metname) << "The seed is in the endcap";
187 
188  DetId id;
189  // ME2
190  if ( theta < Geom::pi()/2. )
191  id = CSCDetId(1,2,0,0,0);
192  else
193  id = CSCDetId(2,2,0,0,0);
194 
195  detLayer = theService->detLayerGeometry()->idToLayer(id);
196  LogTrace(metname) << "L2 Layer: " << debug.dumpLayer(detLayer);
197 
198  radius = fabs(detLayer->position().z()/cos(theta));
199 
200  if( pt < 1.0) pt = 1.0;
201  }
202 
203  vec.setMag(radius);
204 
205  GlobalPoint pos(vec.x(),vec.y(),vec.z());
206 
207  GlobalVector mom(pt*cos(phi), pt*sin(phi), pt*cos(theta)/sin(theta));
208 
209  GlobalTrajectoryParameters param(pos,mom,charge,&*theService->magneticField());
211 
212  mat[0][0] = (0.25/pt)*(0.25/pt); // sigma^2(charge/abs_momentum)
213  if ( !barrel ) mat[0][0] = (0.4/pt)*(0.4/pt);
214 
215  //Assign q/pt = 0 +- 1/pt if charge has been declared invalid
216  if (!valid_charge) mat[0][0] = (1./pt)*(1./pt);
217 
218  mat[1][1] = 0.05*0.05; // sigma^2(lambda)
219  mat[2][2] = 0.2*0.2; // sigma^2(phi)
220  mat[3][3] = 20.*20.; // sigma^2(x_transverse))
221  mat[4][4] = 20.*20.; // sigma^2(y_transverse))
222 
224 
225  const FreeTrajectoryState state(param,error);
226 
227  LogTrace(metname) << "Free trajectory State from the parameters";
228  LogTrace(metname) << debug.dumpFTS(state);
229 
230  // Propagate the state on the MB2/ME2 surface
231  TrajectoryStateOnSurface tsos = theService->propagator(thePropagatorName)->propagate(state, detLayer->surface());
232 
233  LogTrace(metname) << "State after the propagation on the layer";
234  LogTrace(metname) << debug.dumpLayer(detLayer);
235  LogTrace(metname) << debug.dumpFTS(state);
236 
237  if (tsos.isValid()) {
238  // Get the compatible dets on the layer
239  std::vector< pair<const GeomDet*,TrajectoryStateOnSurface> >
240  detsWithStates = detLayer->compatibleDets(tsos,
241  *theService->propagator(thePropagatorName),
242  *theEstimator);
243  if (detsWithStates.size()){
244 
245  TrajectoryStateOnSurface newTSOS = detsWithStates.front().second;
246  const GeomDet *newTSOSDet = detsWithStates.front().first;
247 
248  LogTrace(metname) << "Most compatible det";
249  LogTrace(metname) << debug.dumpMuonId(newTSOSDet->geographicalId());
250 
251  LogDebug(metname) << "L1 info: Det and State:";
252  LogDebug(metname) << debug.dumpMuonId(newTSOSDet->geographicalId());
253 
254  if (newTSOS.isValid()){
255 
256  //LogDebug(metname) << "(x, y, z) = (" << newTSOS.globalPosition().x() << ", "
257  // << newTSOS.globalPosition().y() << ", " << newTSOS.globalPosition().z() << ")";
258  LogDebug(metname) << "pos: (r=" << newTSOS.globalPosition().mag() << ", phi="
259  << newTSOS.globalPosition().phi() << ", eta=" << newTSOS.globalPosition().eta() << ")";
260  LogDebug(metname) << "mom: (q*pt=" << newTSOS.charge()*newTSOS.globalMomentum().perp() << ", phi="
261  << newTSOS.globalMomentum().phi() << ", eta=" << newTSOS.globalMomentum().eta() << ")";
262 
263  //LogDebug(metname) << "State on it";
264  //LogDebug(metname) << debug.dumpTSOS(newTSOS);
265 
266  //PTrajectoryStateOnDet seedTSOS;
268 
269  if(useOfflineSeed) {
270  const TrajectorySeed *assoOffseed =
271  associateOfflineSeedToL1(offlineSeedHandle, offlineSeedMap, newTSOS);
272 
273  if(assoOffseed!=0) {
274  PTrajectoryStateOnDet const & seedTSOS = assoOffseed->startingState();
276  tsci = assoOffseed->recHits().first,
277  tscie = assoOffseed->recHits().second;
278  for(; tsci!=tscie; ++tsci) {
279  container.push_back(*tsci);
280  }
281  output->push_back(L2MuonTrajectorySeed(seedTSOS,container,alongMomentum,
282  MuonRef(muColl, distance(muColl->begin(muColl->getFirstBX()),it) )));
283 
284  }
285  else {
286  if(useUnassociatedL1) {
287  // convert the TSOS into a PTSOD
288  PTrajectoryStateOnDet const & seedTSOS = trajectoryStateTransform::persistentState( newTSOS,newTSOSDet->geographicalId().rawId());
289  output->push_back(L2MuonTrajectorySeed(seedTSOS,container,alongMomentum,
290  MuonRef(muColl, distance(muColl->begin(muColl->getFirstBX()),it) )));
291  }
292  }
293  }
294  else {
295  // convert the TSOS into a PTSOD
296  PTrajectoryStateOnDet const & seedTSOS = trajectoryStateTransform::persistentState( newTSOS,newTSOSDet->geographicalId().rawId());
297  output->push_back(L2MuonTrajectorySeed(seedTSOS,container,alongMomentum,
298  MuonRef(muColl, distance(muColl->begin(muColl->getFirstBX()),it) )));
299  }
300 
301  }
302  }
303  }
304  }
305 
306  }
307 
308 
309 
310  iEvent.put(output);
311 }
#define LogDebug(id)
edm::EDGetTokenT< edm::View< TrajectorySeed > > offlineSeedToken_
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
T perp() const
Definition: PV3DBase.h:72
bool centralBxOnly_
use central bx only muons
std::string dumpLayer(const DetLayer *layer) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
const std::string metname
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
Geom::Theta< T > theta() const
GlobalPoint globalPosition() const
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
Definition: Muon.h:12
std::string dumpMuonId(const DetId &id) const
std::string dumpFTS(const FreeTrajectoryState &fts) const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
void push_back(D *&d)
Definition: OwnVector.h:290
T mag() const
Definition: PV3DBase.h:67
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
recHitContainer::const_iterator const_iterator
std::vector< L2MuonTrajectorySeed > L2MuonTrajectorySeedCollection
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:77
const TrajectorySeed * associateOfflineSeedToL1(edm::Handle< edm::View< TrajectorySeed > > &, std::vector< int > &, TrajectoryStateOnSurface &)
#define LogTrace(id)
Definition: DetId.h:18
PTrajectoryStateOnDet const & startingState() const
#define debug
Definition: HDRShower.cc:19
virtual const Surface::PositionType & position() const
Returns position of the surface.
range recHits() const
edm::EDGetTokenT< l1t::MuonBxCollection > muCollToken_
T eta() const
Definition: PV3DBase.h:76
GlobalVector globalMomentum() const
double pi()
Definition: Pi.h:31

Member Data Documentation

bool L2MuonSeedGeneratorFromL1T::centralBxOnly_
private

use central bx only muons

Definition at line 76 of file L2MuonSeedGeneratorFromL1T.h.

Referenced by produce().

edm::EDGetTokenT<l1t::MuonBxCollection> L2MuonSeedGeneratorFromL1T::muCollToken_
private

Definition at line 66 of file L2MuonSeedGeneratorFromL1T.h.

Referenced by L2MuonSeedGeneratorFromL1T(), and produce().

edm::EDGetTokenT<edm::View<TrajectorySeed> > L2MuonSeedGeneratorFromL1T::offlineSeedToken_
private

Definition at line 67 of file L2MuonSeedGeneratorFromL1T.h.

Referenced by L2MuonSeedGeneratorFromL1T(), and produce().

MeasurementEstimator* L2MuonSeedGeneratorFromL1T::theEstimator
private
edm::InputTag L2MuonSeedGeneratorFromL1T::theL1GMTReadoutCollection
private

Definition at line 62 of file L2MuonSeedGeneratorFromL1T.h.

const double L2MuonSeedGeneratorFromL1T::theL1MaxEta
private

Definition at line 70 of file L2MuonSeedGeneratorFromL1T.h.

Referenced by produce().

const double L2MuonSeedGeneratorFromL1T::theL1MinPt
private

Definition at line 69 of file L2MuonSeedGeneratorFromL1T.h.

Referenced by produce().

const unsigned L2MuonSeedGeneratorFromL1T::theL1MinQuality
private

Definition at line 71 of file L2MuonSeedGeneratorFromL1T.h.

Referenced by produce().

edm::InputTag L2MuonSeedGeneratorFromL1T::theOfflineSeedLabel
private

Definition at line 63 of file L2MuonSeedGeneratorFromL1T.h.

Referenced by L2MuonSeedGeneratorFromL1T().

std::string L2MuonSeedGeneratorFromL1T::thePropagatorName
private

Definition at line 64 of file L2MuonSeedGeneratorFromL1T.h.

Referenced by associateOfflineSeedToL1(), and produce().

MuonServiceProxy* L2MuonSeedGeneratorFromL1T::theService
private

the event setup proxy, it takes care the services update

Definition at line 79 of file L2MuonSeedGeneratorFromL1T.h.

Referenced by associateOfflineSeedToL1(), L2MuonSeedGeneratorFromL1T(), produce(), and ~L2MuonSeedGeneratorFromL1T().

edm::InputTag L2MuonSeedGeneratorFromL1T::theSource
private

Definition at line 61 of file L2MuonSeedGeneratorFromL1T.h.

Referenced by L2MuonSeedGeneratorFromL1T().

const bool L2MuonSeedGeneratorFromL1T::useOfflineSeed
private

Definition at line 72 of file L2MuonSeedGeneratorFromL1T.h.

Referenced by L2MuonSeedGeneratorFromL1T(), and produce().

const bool L2MuonSeedGeneratorFromL1T::useUnassociatedL1
private

Definition at line 73 of file L2MuonSeedGeneratorFromL1T.h.

Referenced by produce().