CMS 3D CMS Logo

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

#include <CosmicMuonSeedGenerator.h>

Inheritance diagram for CosmicMuonSeedGenerator:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Classes

struct  DecreasingGlobalY
 
struct  MuonRecHitPair
 

Public Member Functions

 CosmicMuonSeedGenerator (const edm::ParameterSet &)
 Constructor. More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 reconstruct muon's seeds More...
 
virtual ~CosmicMuonSeedGenerator ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Types

typedef std::vector
< MuonRecHitPair
MuonRecHitPairVector
 

Private Member Functions

bool areCorrelated (const MuonTransientTrackingRecHit::MuonRecHitPointer &, const MuonTransientTrackingRecHit::MuonRecHitPointer &) const
 check if two rechits are correlated More...
 
bool checkQuality (const MuonTransientTrackingRecHit::MuonRecHitPointer &) const
 determine if a MuonTransientTrackingRecHit is qualified to build seed More...
 
std::vector< TrajectorySeedcreateSeed (const MuonTransientTrackingRecHit::MuonRecHitPointer &, const edm::EventSetup &) const
 create TrajectorySeed from MuonTransientTrackingRecHit More...
 
std::vector< TrajectorySeedcreateSeed (const MuonRecHitPair &, const edm::EventSetup &) const
 create TrajectorySeed from MuonRecHitPair More...
 
void createSeeds (TrajectorySeedCollection &results, const MuonTransientTrackingRecHit::MuonRecHitContainer &hits, const edm::EventSetup &eSetup) const
 generate TrajectorySeeds and put them into results More...
 
void createSeeds (TrajectorySeedCollection &results, const CosmicMuonSeedGenerator::MuonRecHitPairVector &hits, const edm::EventSetup &eSetup) const
 
bool leftIsBetter (const MuonTransientTrackingRecHit::MuonRecHitPointer &, const MuonTransientTrackingRecHit::MuonRecHitPointer &) const
 compare quality of two rechits More...
 
std::vector< MuonRecHitPairmakeSegPairs (const MuonTransientTrackingRecHit::MuonRecHitContainer &, const MuonTransientTrackingRecHit::MuonRecHitContainer &, std::string) const
 
MuonTransientTrackingRecHit::MuonRecHitContainer selectSegments (const MuonTransientTrackingRecHit::MuonRecHitContainer &) const
 select seed candidates from Segments in Event More...
 
TrajectorySeed tsosToSeed (const TrajectoryStateOnSurface &, uint32_t) const
 

Private Attributes

edm::InputTag theCSCRecSegmentLabel
 the name of the CSC rec hits collection More...
 
edm::InputTag theDTRecSegmentLabel
 the name of the DT rec hits collection More...
 
bool theEnableCSCFlag
 enable CSCSegment Flag More...
 
bool theEnableDTFlag
 enable DT Segment Flag More...
 
edm::ESHandle< MagneticFieldtheField
 
double theMaxCSCChi2
 
double theMaxDTChi2
 the maximum chi2 required for dt and csc rechits More...
 
unsigned int theMaxSeeds
 the maximum number of Seeds More...
 
edm::ESHandle
< MuonDetLayerGeometry
theMuonLayers
 
std::map< std::string, float > theParameters
 
TrajectoryStateTransformtheTSTransform
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

SeedGenerator for Cosmic Muon

Date:
2010/02/16 17:08:39
Revision:
1.3
Author
Chang Liu - Purdue University

Definition at line 27 of file CosmicMuonSeedGenerator.h.

Member Typedef Documentation

Definition at line 51 of file CosmicMuonSeedGenerator.h.

Constructor & Destructor Documentation

CosmicMuonSeedGenerator::CosmicMuonSeedGenerator ( const edm::ParameterSet pset)

Constructor.

Definition at line 47 of file CosmicMuonSeedGenerator.cc.

References edm::ParameterSet::getParameter().

47  {
48  produces<TrajectorySeedCollection>();
49 
50  // enable the DT chamber
51  theEnableDTFlag = pset.getParameter<bool>("EnableDTMeasurement");
52  // enable the CSC chamber
53  theEnableCSCFlag = pset.getParameter<bool>("EnableCSCMeasurement");
54 
55  theDTRecSegmentLabel = pset.getParameter<InputTag>("DTRecSegmentLabel");
56 
57  theCSCRecSegmentLabel = pset.getParameter<InputTag>("CSCRecSegmentLabel");
58 
59  // the maximum number of TrajectorySeed
60  theMaxSeeds = pset.getParameter<int>("MaxSeeds");
61 
62  theMaxDTChi2 = pset.getParameter<double>("MaxDTChi2");
63  theMaxCSCChi2 = pset.getParameter<double>("MaxCSCChi2");
64 
65  // pre-determined parameters for seed pt calculation ( pt * dphi )
66  theParameters["topmb41"] = 0.87;
67  theParameters["bottommb41"] = 1.2;
68  theParameters["topmb42"] = 0.67;
69  theParameters["bottommb42"] = 0.98;
70  theParameters["topmb43"] = 0.34;
71  theParameters["bottommb43"] = 0.58;
72  theParameters["topmb31"] = 0.54;
73  theParameters["bottommb31"] = 0.77;
74  theParameters["topmb32"] = 0.35;
75  theParameters["bottommb32"] = 0.55;
76  theParameters["topmb21"] = 0.21;
77  theParameters["bottommb21"] = 0.31;
78 
79 }
T getParameter(std::string const &) const
unsigned int theMaxSeeds
the maximum number of Seeds
double theMaxDTChi2
the maximum chi2 required for dt and csc rechits
edm::InputTag theDTRecSegmentLabel
the name of the DT rec hits collection
std::map< std::string, float > theParameters
bool theEnableCSCFlag
enable CSCSegment Flag
bool theEnableDTFlag
enable DT Segment Flag
edm::InputTag theCSCRecSegmentLabel
the name of the CSC rec hits collection
CosmicMuonSeedGenerator::~CosmicMuonSeedGenerator ( )
virtual

Destructor.

Definition at line 82 of file CosmicMuonSeedGenerator.cc.

82  {
83 }

Member Function Documentation

bool CosmicMuonSeedGenerator::areCorrelated ( const MuonTransientTrackingRecHit::MuonRecHitPointer lhs,
const MuonTransientTrackingRecHit::MuonRecHitPointer rhs 
) const
private

check if two rechits are correlated

Definition at line 361 of file CosmicMuonSeedGenerator.cc.

References GetRecoTauVFromDQM_MC_cff::dir2, PV3DBase< T, PVType, FrameType >::eta(), PV3DBase< T, PVType, FrameType >::mag(), PV3DBase< T, PVType, FrameType >::phi(), query::result, and PV3DBase< T, PVType, FrameType >::theta().

361  {
362  bool result = false;
363 
364  GlobalVector dir1 = lhs->globalDirection();
365  GlobalPoint pos1 = lhs->globalPosition();
366  GlobalVector dir2 = rhs->globalDirection();
367  GlobalPoint pos2 = rhs->globalPosition();
368 
369  GlobalVector dis = pos2 - pos1;
370 
371  if ( (deltaR<double>(dir1.eta(), dir1.phi(), dir2.eta(), dir2.phi()) < 0.1 || deltaR<double>(dir1.eta(), dir1.phi(), -dir2.eta(), -dir2.phi()) < 0.1 )
372  && dis.mag() < 5.0 )
373  result = true;
374 
375  if ( (deltaR<double>(dir1.eta(), dir1.phi(), dir2.eta(), dir2.phi()) < 0.1 || deltaR<double>(dir1.eta(), dir1.phi(), -dir2.eta(), -dir2.phi()) < 0.1 ) &&
376  (deltaR<double>(dir1.eta(), dir1.phi(), dis.eta(), dis.phi()) < 0.1 || deltaR<double>(dir2.eta(), dir2.phi(), dis.eta(), dis.phi()) < 0.1 ) )
377  result = true;
378 
379  if ( fabs(dir1.eta()) > 4.0 || fabs(dir2.eta()) > 4.0 ) {
380  if ( (fabs(dir1.theta() - dir2.theta()) < 0.07 ||
381  fabs(dir1.theta() + dir2.theta()) > 3.07 ) &&
382  (fabs(dir1.theta() - dis.theta()) < 0.07 ||
383  fabs(dir1.theta() - dis.theta()) < 0.07 ||
384  fabs(dir1.theta() + dis.theta()) > 3.07 ||
385  fabs(dir1.theta() + dis.theta()) > 3.07 ) )
386 
387  result = true;
388  }
389 
390  return result;
391 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
Geom::Theta< T > theta() const
Definition: PV3DBase.h:74
T mag() const
Definition: PV3DBase.h:66
tuple result
Definition: query.py:137
T eta() const
Definition: PV3DBase.h:75
bool CosmicMuonSeedGenerator::checkQuality ( const MuonTransientTrackingRecHit::MuonRecHitPointer hit) const
private

determine if a MuonTransientTrackingRecHit is qualified to build seed

Definition at line 199 of file CosmicMuonSeedGenerator.cc.

References python.rootplot.argparse::category, and LogTrace.

199  {
200 
201  const std::string category = "Muon|RecoMuon|CosmicMuonSeedGenerator";
202 
203  // only use 4D segments
204  if ( !hit->isValid() ) return false;
205 
206  if (hit->dimension() < 4) {
207  LogTrace(category)<<"dim < 4";
208  return false;
209  }
210 
211  if (hit->isDT() && ( hit->chi2()> theMaxDTChi2 )) {
212  LogTrace(category)<<"DT chi2 too large";
213  return false;
214  }
215  else if (hit->isCSC() &&( hit->chi2()> theMaxCSCChi2 ) ) {
216  LogTrace(category)<<"CSC chi2 too large";
217  return false;
218  }
219  return true;
220 
221 }
double theMaxDTChi2
the maximum chi2 required for dt and csc rechits
#define LogTrace(id)
std::vector< TrajectorySeed > CosmicMuonSeedGenerator::createSeed ( const MuonTransientTrackingRecHit::MuonRecHitPointer hit,
const edm::EventSetup eSetup 
) const
private

create TrajectorySeed from MuonTransientTrackingRecHit

Definition at line 300 of file CosmicMuonSeedGenerator.cc.

References python.rootplot.argparse::category, DeDxDiscriminatorTools::charge(), MuonSubdetId::CSC, MuonSubdetId::DT, MuonPatternRecoDumper::dumpMuonId(), error, LogTrace, PV3DBase< T, PVType, FrameType >::perp(), and query::result.

300  {
301 
302  std::vector<TrajectorySeed> result;
303 
304  const std::string category = "Muon|RecoMuon|CosmicMuonSeedGenerator";
305 
306  MuonPatternRecoDumper dumper;
307 
308  // set the pt by hand
309  double pt = 10.0;
310 
311  // AlgebraicVector4 t;
312  AlgebraicSymMatrix mat(5,0);
313 
314  // Fill the LocalTrajectoryParameters
315  LocalPoint segPos=hit->localPosition();
316 
317  GlobalVector polar(GlobalVector::Spherical(hit->globalDirection().theta(),
318  hit->globalDirection().phi(),
319  1.));
320  // Force all track downward for cosmic, not beam-halo
321  if (hit->geographicalId().subdetId() == MuonSubdetId::DT && fabs(hit->globalDirection().eta()) < 4.0 && hit->globalDirection().phi() > 0 )
322  polar = - polar;
323 
324  if (hit->geographicalId().subdetId() == MuonSubdetId::CSC && fabs(hit->globalDirection().eta()) > 2.3 ) {
325  polar = - polar;
326  }
327 
328  polar *=fabs(pt)/polar.perp();
329 
330  LocalVector segDir =hit->det()->toLocal(polar);
331 
332  int charge= 1;
333  LocalTrajectoryParameters param(segPos,segDir, charge);
334 
335  charge= -1;
336  LocalTrajectoryParameters param2(segPos,segDir, charge);
337 
338  mat = hit->parametersError().similarityT( hit->projectionMatrix() );
339 
340  float p_err = 0.2;
341  mat[0][0]= p_err;
342 
343  LocalTrajectoryError error(asSMatrix<5>(mat));
344 
345  // Create the TrajectoryStateOnSurface
346  TrajectoryStateOnSurface tsos(param, error, hit->det()->surface(), &*theField);
347  TrajectoryStateOnSurface tsos2(param2, error, hit->det()->surface(), &*theField);
348 
349  LogTrace(category)<<"Trajectory State on Surface of Seed";
350  LogTrace(category)<<"mom: "<<tsos.globalMomentum()<<" phi: "<<tsos.globalMomentum().phi();
351  LogTrace(category)<<"pos: " << tsos.globalPosition();
352  LogTrace(category) << "The RecSegment relies on: ";
353  LogTrace(category) << dumper.dumpMuonId(hit->geographicalId());
354 
355  result.push_back( tsosToSeed(tsos, hit->geographicalId().rawId()) );
356  result.push_back( tsosToSeed(tsos2, hit->geographicalId().rawId()) );
357 
358  return result;
359 }
T perp() const
Definition: PV3DBase.h:71
edm::ESHandle< MagneticField > theField
double charge(const std::vector< uint8_t > &Ampls)
std::string dumpMuonId(const DetId &id) const
static const int CSC
Definition: MuonSubdetId.h:15
tuple result
Definition: query.py:137
#define LogTrace(id)
CLHEP::HepSymMatrix AlgebraicSymMatrix
static const int DT
Definition: MuonSubdetId.h:14
TrajectorySeed tsosToSeed(const TrajectoryStateOnSurface &, uint32_t) const
std::vector< TrajectorySeed > CosmicMuonSeedGenerator::createSeed ( const MuonRecHitPair hitpair,
const edm::EventSetup eSetup 
) const
private

create TrajectorySeed from MuonRecHitPair

Definition at line 436 of file CosmicMuonSeedGenerator.cc.

References python.rootplot.argparse::category, DeDxDiscriminatorTools::charge(), MuonSubdetId::CSC, SiPixelRawToDigiRegional_cfi::deltaPhi, pat::helper::ParametrizationHelper::dimension(), MuonSubdetId::DT, MuonPatternRecoDumper::dumpMuonId(), alignCSCRings::e, error, CosmicMuonSeedGenerator::MuonRecHitPair::first, LogTrace, PV3DBase< T, PVType, FrameType >::perp(), query::result, CosmicMuonSeedGenerator::MuonRecHitPair::second, lumiQTWidget::t, and CosmicMuonSeedGenerator::MuonRecHitPair::type.

437  {
438  std::vector<TrajectorySeed> result;
439 
440  const std::string category = "Muon|RecoMuon|CosmicMuonSeedGenerator";
441 
442  MuonPatternRecoDumper dumper;
443 
444  float dphi = deltaPhi((hitpair.first)->globalDirection().phi(), (hitpair.second)->globalDirection().phi());
445 
446  LogTrace(category)<<"hitpair.type "<<hitpair.type;
447 
448  map<string, float>::const_iterator iterPar = theParameters.find(hitpair.type);
449  if ( iterPar == theParameters.end() ) {
450  return result;
451  }
452 
453  // set the pt and charge by dphi
454  int charge = (dphi > 0) ? -1 : 1;
455 
456  double pt = 999.0;
457  float paraC = (iterPar->second);
458 
459  if (fabs(dphi) > 1e-5) {
460  pt = paraC/fabs(dphi);
461  }
462 
463  if (pt < 10.0 ) { return result; } //still use the old strategy for low pt
464 
465  AlgebraicVector t(4);
466  AlgebraicSymMatrix mat(5,0) ;
467 
469  if ( hit->dimension() < (hitpair.second)->dimension() ) hit = hitpair.second;
470 
471  // Fill the LocalTrajectoryParameters
472  LocalPoint segPos=hit->localPosition();
473 
474  GlobalVector polar(GlobalVector::Spherical(hit->globalDirection().theta(),
475  hit->globalDirection().phi(),
476  1.));
477  // Force all track downward for cosmic, not beam-halo
478  if (hit->geographicalId().subdetId() == MuonSubdetId::DT && fabs(hit->globalDirection().eta()) < 4.0 && hit->globalDirection().phi() > 0 )
479  polar = - polar;
480 
481  if (hit->geographicalId().subdetId() == MuonSubdetId::CSC && fabs(hit->globalDirection().eta()) > 2.3 ) {
482  polar = - polar;
483  }
484 
485  polar *=fabs(pt)/polar.perp();
486 
487  LocalVector segDir =hit->det()->toLocal(polar);
488 
489  LocalTrajectoryParameters param(segPos,segDir, charge);
490 
491  mat = hit->parametersError().similarityT( hit->projectionMatrix() );
492 
493  float p_err = 0.004/paraC;
494  if (pt < 10.01) p_err = 0.1;
495  mat[0][0]= p_err;
496 
497  LocalTrajectoryError error(asSMatrix<5>(mat));
498 
499  // Create the TrajectoryStateOnSurface
500  TrajectoryStateOnSurface tsos(param, error, hit->det()->surface(), &*theField);
501 
502  LogTrace(category)<<"Trajectory State on Surface of Seed";
503  LogTrace(category)<<"mom: "<<tsos.globalMomentum()<<" phi: "<<tsos.globalMomentum().phi();
504  LogTrace(category)<<"pos: " << tsos.globalPosition();
505  LogTrace(category) << "The RecSegment relies on: ";
506  LogTrace(category) << dumper.dumpMuonId(hit->geographicalId());
507 
508  result.push_back( tsosToSeed(tsos, hit->geographicalId().rawId()) );
509 
510  return result;
511 }
T perp() const
Definition: PV3DBase.h:71
edm::ESHandle< MagneticField > theField
double charge(const std::vector< uint8_t > &Ampls)
std::string dumpMuonId(const DetId &id) const
static const int CSC
Definition: MuonSubdetId.h:15
tuple result
Definition: query.py:137
std::map< std::string, float > theParameters
#define LogTrace(id)
CLHEP::HepVector AlgebraicVector
CLHEP::HepSymMatrix AlgebraicSymMatrix
static const int DT
Definition: MuonSubdetId.h:14
TrajectorySeed tsosToSeed(const TrajectoryStateOnSurface &, uint32_t) const
uint32_t dimension(pat::CandKinResolution::Parametrization parametrization)
Returns the number of free parameters in a parametrization (3 or 4)
void CosmicMuonSeedGenerator::createSeeds ( TrajectorySeedCollection results,
const MuonTransientTrackingRecHit::MuonRecHitContainer hits,
const edm::EventSetup eSetup 
) const
private

generate TrajectorySeeds and put them into results

Definition at line 267 of file CosmicMuonSeedGenerator.cc.

References python.rootplot.argparse::category, and LogTrace.

269  {
270 
271  const std::string category = "Muon|RecoMuon|CosmicMuonSeedGenerator";
272 
273  if (hits.size() == 0 || results.size() >= theMaxSeeds ) return;
274  for (MuonRecHitContainer::const_iterator ihit = hits.begin(); ihit != hits.end(); ihit++) {
275  const std::vector<TrajectorySeed>& sds = createSeed((*ihit),eSetup);
276  LogTrace(category)<<"created seeds from rechit "<<sds.size();
277  results.insert(results.end(),sds.begin(),sds.end());
278  if ( results.size() >= theMaxSeeds ) break;
279  }
280  return;
281 }
unsigned int theMaxSeeds
the maximum number of Seeds
std::vector< TrajectorySeed > createSeed(const MuonTransientTrackingRecHit::MuonRecHitPointer &, const edm::EventSetup &) const
create TrajectorySeed from MuonTransientTrackingRecHit
#define LogTrace(id)
void CosmicMuonSeedGenerator::createSeeds ( TrajectorySeedCollection results,
const CosmicMuonSeedGenerator::MuonRecHitPairVector hits,
const edm::EventSetup eSetup 
) const
private

Definition at line 283 of file CosmicMuonSeedGenerator.cc.

References python.rootplot.argparse::category, and LogTrace.

285  {
286 
287  const std::string category = "Muon|RecoMuon|CosmicMuonSeedGenerator";
288 
289  if (hitpairs.size() == 0 || results.size() >= theMaxSeeds ) return;
290  for (CosmicMuonSeedGenerator::MuonRecHitPairVector::const_iterator ihitpair = hitpairs.begin(); ihitpair != hitpairs.end(); ihitpair++) {
291  const std::vector<TrajectorySeed>& sds = createSeed((*ihitpair),eSetup);
292  LogTrace(category)<<"created seeds from rechit "<<sds.size();
293  results.insert(results.end(),sds.begin(),sds.end());
294  if ( results.size() >= theMaxSeeds ) break;
295  }
296  return;
297 }
unsigned int theMaxSeeds
the maximum number of Seeds
std::vector< TrajectorySeed > createSeed(const MuonTransientTrackingRecHit::MuonRecHitPointer &, const edm::EventSetup &) const
create TrajectorySeed from MuonTransientTrackingRecHit
#define LogTrace(id)
bool CosmicMuonSeedGenerator::leftIsBetter ( const MuonTransientTrackingRecHit::MuonRecHitPointer lhs,
const MuonTransientTrackingRecHit::MuonRecHitPointer rhs 
) const
private

compare quality of two rechits

Definition at line 393 of file CosmicMuonSeedGenerator.cc.

394  {
395 
396  if ( (lhs->degreesOfFreedom() > rhs->degreesOfFreedom() ) ||
397  ( (lhs->degreesOfFreedom() == rhs->degreesOfFreedom() ) &&
398  (lhs)->chi2() < (rhs)->chi2() ) ) return true;
399  else return false;
400 
401 }
CosmicMuonSeedGenerator::MuonRecHitPairVector CosmicMuonSeedGenerator::makeSegPairs ( const MuonTransientTrackingRecHit::MuonRecHitContainer hits1,
const MuonTransientTrackingRecHit::MuonRecHitContainer hits2,
std::string  tag 
) const
private

Definition at line 405 of file CosmicMuonSeedGenerator.cc.

References python.rootplot.argparse::category, SiPixelRawToDigiRegional_cfi::deltaPhi, query::result, and GlobalPosition_Frontier_DevDB_cff::tag.

405  {
406 
408  const std::string category = "Muon|RecoMuon|CosmicMuonSeedGenerator";
409 
410  if (hits1.empty() || hits2.empty() ) return result;
411 
412  for (MuonRecHitContainer::const_iterator ihit1 = hits1.begin(); ihit1 != hits1.end(); ihit1++) {
413  if ( !checkQuality(*ihit1) ) continue;
414 
415  for (MuonRecHitContainer::const_iterator ihit2 = hits2.begin(); ihit2 != hits2.end(); ihit2++) {
416  if ( !checkQuality(*ihit2) ) continue;
417 
418  float dphi = deltaPhi((*ihit1)->globalPosition().phi(), (*ihit2)->globalPosition().phi());
419  if ( dphi < 0.5 ) {
420  if ((*ihit1)->globalPosition().y() > 0.0 && ( (*ihit1)->globalPosition().y() > (*ihit2)->globalPosition().y() ) ) {
421  std::string tag2 = "top"+tag;
422 
423  result.push_back(MuonRecHitPair(*ihit1, *ihit2, tag2));
424  } else if ((*ihit1)->globalPosition().y() < 0.0 && ( (*ihit1)->globalPosition().y() < (*ihit2)->globalPosition().y() ) ) {
425  std::string tag2 = "bottom"+tag;
426  result.push_back(MuonRecHitPair(*ihit2, *ihit1, tag2));
427 
428  }
429  }
430  }
431  }
432 
433  return result;
434 }
tuple result
Definition: query.py:137
std::vector< MuonRecHitPair > MuonRecHitPairVector
bool checkQuality(const MuonTransientTrackingRecHit::MuonRecHitPointer &) const
determine if a MuonTransientTrackingRecHit is qualified to build seed
void CosmicMuonSeedGenerator::produce ( edm::Event event,
const edm::EventSetup eSetup 
)
virtual

reconstruct muon's seeds

Implements edm::EDProducer.

Definition at line 87 of file CosmicMuonSeedGenerator.cc.

References python.rootplot.argparse::category, edm::EventSetup::get(), LogTrace, convertSQLitetoXML_cfg::output, MuonDetLayerMeasurements::recHits(), and MuonDetLayerMeasurements::setEvent().

87  {
88 
89  eSetup.get<IdealMagneticFieldRecord>().get(theField);
90 
91  auto_ptr<TrajectorySeedCollection> output(new TrajectorySeedCollection());
92 
94 
95  std::string category = "Muon|RecoMuon|CosmicMuonSeedGenerator";
96 
97  // Muon Geometry - DT, CSC and RPC
99 
100  // get the DT layers
101  vector<DetLayer*> dtLayers = theMuonLayers->allDTLayers();
102 
103  // get the CSC layers
104  vector<DetLayer*> cscForwardLayers = theMuonLayers->forwardCSCLayers();
105  vector<DetLayer*> cscBackwardLayers = theMuonLayers->backwardCSCLayers();
106 
108  InputTag(),
110 
111  muonMeasurements.setEvent(event);
112 
113  MuonRecHitContainer allHits;
114 
115  vector<MuonRecHitContainer> RHMBs;
116  vector<MuonRecHitContainer> RHMEFs;
117  vector<MuonRecHitContainer> RHMEBs;
118 
119  stable_sort(allHits.begin(),allHits.end(),DecreasingGlobalY());
120 
121  for (vector<DetLayer*>::reverse_iterator icsclayer = cscForwardLayers.rbegin();
122  icsclayer != cscForwardLayers.rend() - 1; ++icsclayer) {
123 
124  MuonRecHitContainer RHMF = muonMeasurements.recHits(*icsclayer);
125  allHits.insert(allHits.end(),RHMF.begin(),RHMF.end());
126 
127  }
128 
129  for (vector<DetLayer*>::reverse_iterator icsclayer = cscBackwardLayers.rbegin();
130  icsclayer != cscBackwardLayers.rend() - 1; ++icsclayer) {
131 
132  MuonRecHitContainer RHMF = muonMeasurements.recHits(*icsclayer);
133  allHits.insert(allHits.end(),RHMF.begin(),RHMF.end());
134 
135  }
136 
137  for (vector<DetLayer*>::reverse_iterator idtlayer = dtLayers.rbegin();
138  idtlayer != dtLayers.rend(); ++idtlayer) {
139 
140  MuonRecHitContainer RHMB = muonMeasurements.recHits(*idtlayer);
141  RHMBs.push_back(RHMB);
142 
143  if ( idtlayer != dtLayers.rbegin() ) allHits.insert(allHits.end(),RHMB.begin(),RHMB.end());
144 
145  }
146 
147 // stable_sort(allHits.begin(),allHits.end(),DecreasingGlobalY());
148 
149  LogTrace(category)<<"all RecHits: "<<allHits.size();
150 
151 // CosmicMuonSeedGenerator::MuonRecHitPairVector mb41 = makeSegPairs(RHMBs[0], RHMBs[3], "mb41");
152 // createSeeds(seeds, mb41, eSetup);
153 
154 // CosmicMuonSeedGenerator::MuonRecHitPairVector mb43 = makeSegPairs(RHMBs[0],RHMBs[1], "mb43");
155 // createSeeds(seeds, mb43, eSetup);
156 
157  CosmicMuonSeedGenerator::MuonRecHitPairVector mb42 = makeSegPairs(RHMBs[0],RHMBs[2], "mb42");
158  createSeeds(seeds, mb42, eSetup);
159 
160 // CosmicMuonSeedGenerator::MuonRecHitPairVector mb32 = makeSegPairs(RHMBs[1], RHMBs[2], "mb32");
161 // createSeeds(seeds, mb32, eSetup);
162 
163  CosmicMuonSeedGenerator::MuonRecHitPairVector mb31 = makeSegPairs(RHMBs[1], RHMBs[3], "mb31");
164  createSeeds(seeds, mb31, eSetup);
165 
166 // CosmicMuonSeedGenerator::MuonRecHitPairVector mb21 = makeSegPairs(RHMBs[2], RHMBs[3], "mb21");
167 // createSeeds(seeds, mb21, eSetup);
168 
169  if ( !allHits.empty() ) {
170 
171  MuonRecHitContainer goodhits = selectSegments(allHits);
172  LogTrace(category)<<"good RecHits: "<<goodhits.size();
173 
174  if ( goodhits.empty() ) {
175  LogTrace(category)<<"No qualified Segments in Event! ";
176  LogTrace(category)<<"Use 2D RecHit";
177 
178  createSeeds(seeds,allHits,eSetup);
179 
180  }
181  else {
182  createSeeds(seeds,goodhits,eSetup);
183  }
184  }
185 
186  LogTrace(category)<<"Seeds built: "<<seeds.size();
187 
188  for(std::vector<TrajectorySeed>::iterator seed = seeds.begin();
189  seed != seeds.end(); ++seed) {
190  output->push_back(*seed);
191  }
192 
193  event.put(output);
194  seeds.clear();
195 
196 }
edm::ESHandle< MagneticField > theField
MuonTransientTrackingRecHit::MuonRecHitContainer selectSegments(const MuonTransientTrackingRecHit::MuonRecHitContainer &) const
select seed candidates from Segments in Event
edm::InputTag theDTRecSegmentLabel
the name of the DT rec hits collection
std::vector< TrajectorySeed > TrajectorySeedCollection
edm::ESHandle< MuonDetLayerGeometry > theMuonLayers
#define LogTrace(id)
std::vector< MuonRecHitPair > MuonRecHitPairVector
bool theEnableCSCFlag
enable CSCSegment Flag
const T & get() const
Definition: EventSetup.h:55
bool theEnableDTFlag
enable DT Segment Flag
edm::InputTag theCSCRecSegmentLabel
the name of the CSC rec hits collection
MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
std::vector< MuonRecHitPair > makeSegPairs(const MuonTransientTrackingRecHit::MuonRecHitContainer &, const MuonTransientTrackingRecHit::MuonRecHitContainer &, std::string) const
void createSeeds(TrajectorySeedCollection &results, const MuonTransientTrackingRecHit::MuonRecHitContainer &hits, const edm::EventSetup &eSetup) const
generate TrajectorySeeds and put them into results
MuonRecHitContainer CosmicMuonSeedGenerator::selectSegments ( const MuonTransientTrackingRecHit::MuonRecHitContainer hits) const
private

select seed candidates from Segments in Event

Definition at line 223 of file CosmicMuonSeedGenerator.cc.

References python.rootplot.argparse::category, and query::result.

223  {
224 
226  const std::string category = "Muon|RecoMuon|CosmicMuonSeedGenerator";
227 
228  //Only select good quality Segments
229  for (MuonRecHitContainer::const_iterator hit = hits.begin(); hit != hits.end(); hit++) {
230  if ( checkQuality(*hit) ) result.push_back(*hit);
231  }
232 
233  if ( result.size() < 2 ) return result;
234 
235  MuonRecHitContainer result2;
236 
237  //avoid selecting Segments with similar direction
238  for (MuonRecHitContainer::iterator hit = result.begin(); hit != result.end(); hit++) {
239  if (*hit == 0) continue;
240  if ( !(*hit)->isValid() ) continue;
241  bool good = true;
242  //UNUSED: GlobalVector dir1 = (*hit)->globalDirection();
243  //UNUSED: GlobalPoint pos1 = (*hit)->globalPosition();
244  for (MuonRecHitContainer::iterator hit2 = hit + 1; hit2 != result.end(); hit2++) {
245  if (*hit2 == 0) continue;
246  if ( !(*hit2)->isValid() ) continue;
247 
248  //compare direction and position
249  //UNUSED: GlobalVector dir2 = (*hit2)->globalDirection();
250  //UNUSED: GlobalPoint pos2 = (*hit2)->globalPosition();
251  if ( !areCorrelated((*hit),(*hit2)) ) continue;
252 
253  if ( !leftIsBetter((*hit),(*hit2)) ) {
254  good = false;
255  } else (*hit2) = 0;
256  }
257 
258  if ( good ) result2.push_back(*hit);
259  }
260 
261  result.clear();
262 
263  return result2;
264 
265 }
bool areCorrelated(const MuonTransientTrackingRecHit::MuonRecHitPointer &, const MuonTransientTrackingRecHit::MuonRecHitPointer &) const
check if two rechits are correlated
tuple result
Definition: query.py:137
bool leftIsBetter(const MuonTransientTrackingRecHit::MuonRecHitPointer &, const MuonTransientTrackingRecHit::MuonRecHitPointer &) const
compare quality of two rechits
bool checkQuality(const MuonTransientTrackingRecHit::MuonRecHitPointer &) const
determine if a MuonTransientTrackingRecHit is qualified to build seed
MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
TrajectorySeed CosmicMuonSeedGenerator::tsosToSeed ( const TrajectoryStateOnSurface tsos,
uint32_t  id 
) const
private

Definition at line 513 of file CosmicMuonSeedGenerator.cc.

References alongMomentum, and trajectoryStateTransform::persistentState().

513  {
514 
516 
518  TrajectorySeed seed(seedTSOS,container,alongMomentum);
519  return seed;
520 }
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)

Member Data Documentation

edm::InputTag CosmicMuonSeedGenerator::theCSCRecSegmentLabel
private

the name of the CSC rec hits collection

Definition at line 108 of file CosmicMuonSeedGenerator.h.

edm::InputTag CosmicMuonSeedGenerator::theDTRecSegmentLabel
private

the name of the DT rec hits collection

Definition at line 105 of file CosmicMuonSeedGenerator.h.

bool CosmicMuonSeedGenerator::theEnableCSCFlag
private

enable CSCSegment Flag

Definition at line 102 of file CosmicMuonSeedGenerator.h.

bool CosmicMuonSeedGenerator::theEnableDTFlag
private

enable DT Segment Flag

Definition at line 99 of file CosmicMuonSeedGenerator.h.

edm::ESHandle<MagneticField> CosmicMuonSeedGenerator::theField
private

Definition at line 117 of file CosmicMuonSeedGenerator.h.

double CosmicMuonSeedGenerator::theMaxCSCChi2
private

Definition at line 115 of file CosmicMuonSeedGenerator.h.

double CosmicMuonSeedGenerator::theMaxDTChi2
private

the maximum chi2 required for dt and csc rechits

Definition at line 114 of file CosmicMuonSeedGenerator.h.

unsigned int CosmicMuonSeedGenerator::theMaxSeeds
private

the maximum number of Seeds

Definition at line 111 of file CosmicMuonSeedGenerator.h.

edm::ESHandle<MuonDetLayerGeometry> CosmicMuonSeedGenerator::theMuonLayers
private

Definition at line 116 of file CosmicMuonSeedGenerator.h.

std::map<std::string, float> CosmicMuonSeedGenerator::theParameters
private

Definition at line 121 of file CosmicMuonSeedGenerator.h.

TrajectoryStateTransform* CosmicMuonSeedGenerator::theTSTransform
private

Definition at line 119 of file CosmicMuonSeedGenerator.h.