CMS 3D CMS Logo

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

#include <L2MuonSeedGenerator.h>

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

Public Member Functions

 L2MuonSeedGenerator (const edm::ParameterSet &)
 Constructor. More...
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 ~L2MuonSeedGenerator ()
 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 ()
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT
< L1MuGMTReadoutCollection
gmtToken_
 
edm::EDGetTokenT
< l1extra::L1MuonParticleCollection
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
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 50 of file L2MuonSeedGenerator.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 44 of file L2MuonSeedGenerator.cc.

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

44  :
45  theSource(iConfig.getParameter<InputTag>("InputObjects")),
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){
54 
55  gmtToken_ = consumes<L1MuGMTReadoutCollection>(theL1GMTReadoutCollection);
56  muCollToken_ = consumes<L1MuonParticleCollection>(theSource);
57 
58  if(useOfflineSeed) {
59  theOfflineSeedLabel = iConfig.getUntrackedParameter<InputTag>("OfflineSeedLabel");
60  offlineSeedToken_ = consumes<edm::View<TrajectorySeed> >(theOfflineSeedLabel);
61  }
62 
63  // service parameters
64  ParameterSet serviceParameters = iConfig.getParameter<ParameterSet>("ServiceParameters");
65 
66  // the services
67  theService = new MuonServiceProxy(serviceParameters);
68 
69  // the estimator
71 
72 
73  produces<L2MuonTrajectorySeedCollection>();
74 }
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
edm::EDGetTokenT< l1extra::L1MuonParticleCollection > muCollToken_
edm::InputTag theL1GMTReadoutCollection
edm::EDGetTokenT< edm::View< TrajectorySeed > > offlineSeedToken_
const unsigned theL1MinQuality
MeasurementEstimator * theEstimator
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
edm::EDGetTokenT< L1MuGMTReadoutCollection > gmtToken_
edm::InputTag theOfflineSeedLabel
L2MuonSeedGenerator::~L2MuonSeedGenerator ( )

Destructor.

Definition at line 77 of file L2MuonSeedGenerator.cc.

References theEstimator, and theService.

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

Member Function Documentation

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

Definition at line 323 of file L2MuonSeedGenerator.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().

325  {
326 
327  const std::string metlabel = "Muon|RecoMuon|L2MuonSeedGenerator";
328  MuonPatternRecoDumper debugtmp;
329 
330  edm::View<TrajectorySeed>::const_iterator offseed, endOffseed = offseeds->end();
331  const TrajectorySeed *selOffseed = 0;
332  double bestDr = 99999.;
333  unsigned int nOffseed(0);
334  int lastOffseed(-1);
335 
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());
340 
341  // Preliminary check
342  double preDr = deltaR( newTsos.globalPosition().eta(), newTsos.globalPosition().phi(), glbPos.eta(), glbPos.phi() );
343  if(preDr > 1.0) continue;
344 
345  const FreeTrajectoryState offseedFTS(glbPos, glbMom, offseed->startingState().parameters().charge(), &*theService->magneticField());
346  TrajectoryStateOnSurface offseedTsos = theService->propagator(thePropagatorName)->propagate(offseedFTS, newTsos.surface());
347  LogDebug(metlabel) << "Offline seed info: Det and State" << std::endl;
348  LogDebug(metlabel) << debugtmp.dumpMuonId(offseed->startingState().detId()) << std::endl;
349  //LogDebug(metlabel) << "(x, y, z) = (" << newTSOS.globalPosition().x() << ", "
350  // << newTSOS.globalPosition().y() << ", " << newTSOS.globalPosition().z() << ")" << 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;
355  //LogDebug(metlabel) << debugtmp.dumpFTS(offseedFTS) << std::endl;
356 
357  if(offseedTsos.isValid()) {
358  LogDebug(metlabel) << "Offline seed info after propagation to L1 layer:" << std::endl;
359  //LogDebug(metlabel) << "(x, y, z) = (" << offseedTsos.globalPosition().x() << ", "
360  // << offseedTsos.globalPosition().y() << ", " << offseedTsos.globalPosition().z() << ")" << 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;
365  //LogDebug(metlabel) << debugtmp.dumpTSOS(offseedTsos) << std::endl;
366  double newDr = deltaR( newTsos.globalPosition().eta(), newTsos.globalPosition().phi(),
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;
372  bestDr = newDr;
373  offseedMap[nOffseed] = 1;
374  if(lastOffseed>-1) offseedMap[lastOffseed] = 0;
375  lastOffseed = nOffseed;
376  }
377  else {
378  LogDebug(metlabel) << " --> Rejected. " << newDr << std::endl << std::endl;
379  }
380  }
381  else {
382  LogDebug(metlabel) << "Invalid offline seed TSOS after propagation!" << std::endl << std::endl;
383  }
384  }
385 
386  return selOffseed;
387 }
#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
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
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
void L2MuonSeedGenerator::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 82 of file L2MuonSeedGenerator.cc.

References alongMomentum, associateOfflineSeedToL1(), Reference_intrackfit_cff::barrel, RecoTauCleanerPlugins::charge, TrajectoryStateOnSurface::charge(), L1MuGMTCand::charge_valid(), GeometricSearchDet::compatibleDets(), funct::cos(), CSCDetId, debug, DTChamberId, MuonPatternRecoDumper::dumpFTS(), MuonPatternRecoDumper::dumpLayer(), MuonPatternRecoDumper::dumpMuonId(), L1MuGMTCand::empty(), relativeConstraints::error, eta, PV3DBase< T, PVType, FrameType >::eta(), create_public_lumi_plots::exp, GeomDet::geographicalId(), L1MuGMTReadoutRecord::getBrlRPCCands(), edm::Event::getByToken(), L1MuGMTReadoutRecord::getCSCCands(), L1MuGMTReadoutRecord::getDTBXCands(), L1MuGMTExtendedCand::getDTCSCIndex(), L1MuGMTReadoutRecord::getFwdRPCCands(), L1MuGMTExtendedCand::getRPCIndex(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), gmtToken_, customizeTrackingMonitorSeedNumber::idx, L1MuGMTExtendedCand::isFwd(), L1MuGMTExtendedCand::isRPC(), 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(), edm::Handle< T >::product(), EnergyCorrector::pt, edm::OwnVector< T, P >::push_back(), edm::Event::put(), L1MuGMTCand::quality(), 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().

83 {
84  const std::string metname = "Muon|RecoMuon|L2MuonSeedGenerator";
86 
87  auto_ptr<L2MuonTrajectorySeedCollection> output(new L2MuonTrajectorySeedCollection());
88 
89  // Muon particles and GMT readout collection
91  iEvent.getByToken(gmtToken_,gmtrc_handle);
92  L1MuGMTReadoutRecord const& gmtrr = gmtrc_handle.product()->getRecord(0);
93 
95  iEvent.getByToken(muCollToken_, muColl);
96  LogTrace(metname) << "Number of muons " << muColl->size() << endl;
97 
98  edm::Handle<edm::View<TrajectorySeed> > offlineSeedHandle;
99  vector<int> offlineSeedMap;
100  if(useOfflineSeed) {
101  iEvent.getByToken(offlineSeedToken_, offlineSeedHandle);
102  LogTrace(metname) << "Number of offline seeds " << offlineSeedHandle->size() << endl;
103  offlineSeedMap = vector<int>(offlineSeedHandle->size(), 0);
104  }
105 
106  L1MuonParticleCollection::const_iterator it;
107  L1MuonParticleRef::key_type l1ParticleIndex = 0;
108 
109  for(it = muColl->begin(); it != muColl->end(); ++it,++l1ParticleIndex) {
110 
111  const L1MuGMTExtendedCand muonCand = (*it).gmtMuonCand();
112  unsigned int quality = 0;
113  bool valid_charge = false;;
114 
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;
118  // FIXME! Temporary to handle the MC input
119  quality = 7;
120  valid_charge = true;
121  }
122  else {
123  quality = muonCand.quality();
124  valid_charge = muonCand.charge_valid();
125  }
126 
127  float pt = (*it).pt();
128  float eta = (*it).eta();
129  float theta = 2*atan(exp(-eta));
130  float phi = (*it).phi();
131  int charge = (*it).charge();
132  // Set charge=0 for the time being if the valid charge bit is zero
133  if (!valid_charge) charge = 0;
134  bool barrel = !(*it).isForward();
135 
136  // Get a better eta and charge from regional information
137  // Phi has the same resolution in GMT than regionally, is not it?
138  if ( !(muonCand.empty()) ) {
139  int idx = -1;
140  vector<L1MuRegionalCand> rmc;
141  if ( !muonCand.isRPC() ) {
142  idx = muonCand.getDTCSCIndex();
143  if (muonCand.isFwd()) rmc = gmtrr.getCSCCands();
144  else rmc = gmtrr.getDTBXCands();
145  } else {
146  idx = muonCand.getRPCIndex();
147  if (muonCand.isFwd()) rmc = gmtrr.getFwdRPCCands();
148  else rmc = gmtrr.getBrlRPCCands();
149  }
150  if (idx>=0) {
151  eta = rmc[idx].etaValue();
152  //phi = rmc[idx].phiValue();
153  // Use this charge if the valid charge bit is zero
154  if (!valid_charge) charge = rmc[idx].chargeValue();
155  }
156  }
157 
158  if ( pt < theL1MinPt || fabs(eta) > theL1MaxEta ) continue;
159 
160  LogTrace(metname) << "New L2 Muon Seed";
161  LogTrace(metname) << "Pt = " << pt << " GeV/c";
162  LogTrace(metname) << "eta = " << eta;
163  LogTrace(metname) << "theta = " << theta << " rad";
164  LogTrace(metname) << "phi = " << phi << " rad";
165  LogTrace(metname) << "charge = "<< charge;
166  LogTrace(metname) << "In Barrel? = "<< barrel;
167 
168  if ( quality <= theL1MinQuality ) continue;
169  LogTrace(metname) << "quality = "<< quality;
170 
171  // Update the services
172  theService->update(iSetup);
173 
174  const DetLayer *detLayer = 0;
175  float radius = 0.;
176 
177  CLHEP::Hep3Vector vec(0.,1.,0.);
178  vec.setTheta(theta);
179  vec.setPhi(phi);
180 
181  // Get the det layer on which the state should be put
182  if ( barrel ){
183  LogTrace(metname) << "The seed is in the barrel";
184 
185  // MB2
186  DetId id = DTChamberId(0,2,0);
187  detLayer = theService->detLayerGeometry()->idToLayer(id);
188  LogTrace(metname) << "L2 Layer: " << debug.dumpLayer(detLayer);
189 
190  const BoundSurface* sur = &(detLayer->surface());
191  const BoundCylinder* bc = dynamic_cast<const BoundCylinder*>(sur);
192 
193  radius = fabs(bc->radius()/sin(theta));
194 
195  LogTrace(metname) << "radius "<<radius;
196 
197  if ( pt < 3.5 ) pt = 3.5;
198  }
199  else {
200  LogTrace(metname) << "The seed is in the endcap";
201 
202  DetId id;
203  // ME2
204  if ( theta < Geom::pi()/2. )
205  id = CSCDetId(1,2,0,0,0);
206  else
207  id = CSCDetId(2,2,0,0,0);
208 
209  detLayer = theService->detLayerGeometry()->idToLayer(id);
210  LogTrace(metname) << "L2 Layer: " << debug.dumpLayer(detLayer);
211 
212  radius = fabs(detLayer->position().z()/cos(theta));
213 
214  if( pt < 1.0) pt = 1.0;
215  }
216 
217  vec.setMag(radius);
218 
219  GlobalPoint pos(vec.x(),vec.y(),vec.z());
220 
221  GlobalVector mom(pt*cos(phi), pt*sin(phi), pt*cos(theta)/sin(theta));
222 
223  GlobalTrajectoryParameters param(pos,mom,charge,&*theService->magneticField());
225 
226  mat[0][0] = (0.25/pt)*(0.25/pt); // sigma^2(charge/abs_momentum)
227  if ( !barrel ) mat[0][0] = (0.4/pt)*(0.4/pt);
228 
229  //Assign q/pt = 0 +- 1/pt if charge has been declared invalid
230  if (!valid_charge) mat[0][0] = (1./pt)*(1./pt);
231 
232  mat[1][1] = 0.05*0.05; // sigma^2(lambda)
233  mat[2][2] = 0.2*0.2; // sigma^2(phi)
234  mat[3][3] = 20.*20.; // sigma^2(x_transverse))
235  mat[4][4] = 20.*20.; // sigma^2(y_transverse))
236 
238 
239  const FreeTrajectoryState state(param,error);
240 
241  LogTrace(metname) << "Free trajectory State from the parameters";
242  LogTrace(metname) << debug.dumpFTS(state);
243 
244  // Propagate the state on the MB2/ME2 surface
245  TrajectoryStateOnSurface tsos = theService->propagator(thePropagatorName)->propagate(state, detLayer->surface());
246 
247  LogTrace(metname) << "State after the propagation on the layer";
248  LogTrace(metname) << debug.dumpLayer(detLayer);
249  LogTrace(metname) << debug.dumpFTS(state);
250 
251  if (tsos.isValid()) {
252  // Get the compatible dets on the layer
253  std::vector< pair<const GeomDet*,TrajectoryStateOnSurface> >
254  detsWithStates = detLayer->compatibleDets(tsos,
255  *theService->propagator(thePropagatorName),
256  *theEstimator);
257  if (detsWithStates.size()){
258 
259  TrajectoryStateOnSurface newTSOS = detsWithStates.front().second;
260  const GeomDet *newTSOSDet = detsWithStates.front().first;
261 
262  LogTrace(metname) << "Most compatible det";
263  LogTrace(metname) << debug.dumpMuonId(newTSOSDet->geographicalId());
264 
265  LogDebug(metname) << "L1 info: Det and State:";
266  LogDebug(metname) << debug.dumpMuonId(newTSOSDet->geographicalId());
267 
268  if (newTSOS.isValid()){
269 
270  //LogDebug(metname) << "(x, y, z) = (" << newTSOS.globalPosition().x() << ", "
271  // << newTSOS.globalPosition().y() << ", " << newTSOS.globalPosition().z() << ")";
272  LogDebug(metname) << "pos: (r=" << newTSOS.globalPosition().mag() << ", phi="
273  << newTSOS.globalPosition().phi() << ", eta=" << newTSOS.globalPosition().eta() << ")";
274  LogDebug(metname) << "mom: (q*pt=" << newTSOS.charge()*newTSOS.globalMomentum().perp() << ", phi="
275  << newTSOS.globalMomentum().phi() << ", eta=" << newTSOS.globalMomentum().eta() << ")";
276 
277  //LogDebug(metname) << "State on it";
278  //LogDebug(metname) << debug.dumpTSOS(newTSOS);
279 
280  //PTrajectoryStateOnDet seedTSOS;
282 
283  if(useOfflineSeed) {
284  const TrajectorySeed *assoOffseed =
285  associateOfflineSeedToL1(offlineSeedHandle, offlineSeedMap, newTSOS);
286 
287  if(assoOffseed!=0) {
288  PTrajectoryStateOnDet const & seedTSOS = assoOffseed->startingState();
290  tsci = assoOffseed->recHits().first,
291  tscie = assoOffseed->recHits().second;
292  for(; tsci!=tscie; ++tsci) {
293  container.push_back(*tsci);
294  }
295  output->push_back(L2MuonTrajectorySeed(seedTSOS,container,alongMomentum,
296  L1MuonParticleRef(muColl,l1ParticleIndex)));
297  }
298  else {
299  if(useUnassociatedL1) {
300  // convert the TSOS into a PTSOD
301  PTrajectoryStateOnDet const & seedTSOS = trajectoryStateTransform::persistentState( newTSOS,newTSOSDet->geographicalId().rawId());
302  output->push_back(L2MuonTrajectorySeed(seedTSOS,container,alongMomentum,
303  L1MuonParticleRef(muColl,l1ParticleIndex)));
304  }
305  }
306  }
307  else {
308  // convert the TSOS into a PTSOD
309  PTrajectoryStateOnDet const & seedTSOS = trajectoryStateTransform::persistentState( newTSOS,newTSOSDet->geographicalId().rawId());
310  output->push_back(L2MuonTrajectorySeed(seedTSOS,container,alongMomentum,
311  L1MuonParticleRef(muColl,l1ParticleIndex)));
312  }
313  }
314  }
315  }
316  }
317 
318  iEvent.put(output);
319 }
#define LogDebug(id)
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
T perp() const
Definition: PV3DBase.h:72
edm::EDGetTokenT< l1extra::L1MuonParticleCollection > muCollToken_
edm::EDGetTokenT< edm::View< TrajectorySeed > > offlineSeedToken_
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
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
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
Definition: DetId.h:43
const TrajectorySeed * associateOfflineSeedToL1(edm::Handle< edm::View< TrajectorySeed > > &, std::vector< int > &, TrajectoryStateOnSurface &)
const unsigned theL1MinQuality
std::vector< L1MuRegionalCand > getCSCCands() const
get CSC candidates vector
void push_back(D *&d)
Definition: OwnVector.h:290
bool empty() const
is it an empty muon candidate?
Definition: L1MuGMTCand.h:64
T mag() const
Definition: PV3DBase.h:67
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.
Definition: Event.h:121
recHitContainer::const_iterator const_iterator
std::vector< L2MuonTrajectorySeed > L2MuonTrajectorySeedCollection
bool charge_valid() const
is the charge valid ?
Definition: L1MuGMTCand.h:138
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
unsigned getRPCIndex() const
get index of contributing RPC muon
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:77
#define LogTrace(id)
unsigned int quality() const
get quality
Definition: L1MuGMTCand.h:93
Definition: DetId.h:18
PTrajectoryStateOnDet const & startingState() const
#define debug
Definition: HDRShower.cc:19
unsigned getDTCSCIndex() const
get index of contributing DT/CSC muon
MeasurementEstimator * theEstimator
T const * product() const
Definition: Handle.h:81
virtual const Surface::PositionType & position() const
Returns position of the surface.
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
std::vector< L1MuRegionalCand > getDTBXCands() const
get DT candidates vector
range recHits() const
edm::Ref< L1MuonParticleCollection > L1MuonParticleRef
T eta() const
Definition: PV3DBase.h:76
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
GlobalVector globalMomentum() const
double pi()
Definition: Pi.h:31
edm::EDGetTokenT< L1MuGMTReadoutCollection > gmtToken_
bool isFwd() const
get forward bit (true=forward, false=barrel)
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:168

Member Data Documentation

edm::EDGetTokenT<L1MuGMTReadoutCollection> L2MuonSeedGenerator::gmtToken_
private

Definition at line 69 of file L2MuonSeedGenerator.h.

Referenced by L2MuonSeedGenerator(), and produce().

edm::EDGetTokenT<l1extra::L1MuonParticleCollection> L2MuonSeedGenerator::muCollToken_
private

Definition at line 70 of file L2MuonSeedGenerator.h.

Referenced by L2MuonSeedGenerator(), and produce().

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

Definition at line 71 of file L2MuonSeedGenerator.h.

Referenced by L2MuonSeedGenerator(), and produce().

MeasurementEstimator* L2MuonSeedGenerator::theEstimator
private

Definition at line 82 of file L2MuonSeedGenerator.h.

Referenced by L2MuonSeedGenerator(), produce(), and ~L2MuonSeedGenerator().

edm::InputTag L2MuonSeedGenerator::theL1GMTReadoutCollection
private

Definition at line 65 of file L2MuonSeedGenerator.h.

Referenced by L2MuonSeedGenerator().

const double L2MuonSeedGenerator::theL1MaxEta
private

Definition at line 74 of file L2MuonSeedGenerator.h.

Referenced by produce().

const double L2MuonSeedGenerator::theL1MinPt
private

Definition at line 73 of file L2MuonSeedGenerator.h.

Referenced by produce().

const unsigned L2MuonSeedGenerator::theL1MinQuality
private

Definition at line 75 of file L2MuonSeedGenerator.h.

Referenced by produce().

edm::InputTag L2MuonSeedGenerator::theOfflineSeedLabel
private

Definition at line 66 of file L2MuonSeedGenerator.h.

Referenced by L2MuonSeedGenerator().

std::string L2MuonSeedGenerator::thePropagatorName
private

Definition at line 67 of file L2MuonSeedGenerator.h.

Referenced by associateOfflineSeedToL1(), and produce().

MuonServiceProxy* L2MuonSeedGenerator::theService
private

the event setup proxy, it takes care the services update

Definition at line 80 of file L2MuonSeedGenerator.h.

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

edm::InputTag L2MuonSeedGenerator::theSource
private

Definition at line 64 of file L2MuonSeedGenerator.h.

Referenced by L2MuonSeedGenerator().

const bool L2MuonSeedGenerator::useOfflineSeed
private

Definition at line 76 of file L2MuonSeedGenerator.h.

Referenced by L2MuonSeedGenerator(), and produce().

const bool L2MuonSeedGenerator::useUnassociatedL1
private

Definition at line 77 of file L2MuonSeedGenerator.h.

Referenced by produce().