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::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  DecreasingGlobalY
 
struct  MuonRecHitPair
 

Public Member Functions

 CosmicMuonSeedGenerator (const edm::ParameterSet &)
 Constructor. More...
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 reconstruct muon's seeds More...
 
virtual ~CosmicMuonSeedGenerator ()
 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
 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
 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 (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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

MuonDetLayerMeasurementsmuonMeasurements
 
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::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
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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

SeedGenerator for Cosmic Muon

Author
Chang Liu - Purdue University

Definition at line 26 of file CosmicMuonSeedGenerator.h.

Member Typedef Documentation

Definition at line 50 of file CosmicMuonSeedGenerator.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 44 of file CosmicMuonSeedGenerator.cc.

References edm::ParameterSet::getParameter().

44  {
45  produces<TrajectorySeedCollection>();
46 
47  // enable the DT chamber
48  theEnableDTFlag = pset.getParameter<bool>("EnableDTMeasurement");
49  // enable the CSC chamber
50  theEnableCSCFlag = pset.getParameter<bool>("EnableCSCMeasurement");
51 
52  theDTRecSegmentLabel = pset.getParameter<InputTag>("DTRecSegmentLabel");
53 
54  theCSCRecSegmentLabel = pset.getParameter<InputTag>("CSCRecSegmentLabel");
55 
56  // the maximum number of TrajectorySeed
57  theMaxSeeds = pset.getParameter<int>("MaxSeeds");
58 
59  theMaxDTChi2 = pset.getParameter<double>("MaxDTChi2");
60  theMaxCSCChi2 = pset.getParameter<double>("MaxCSCChi2");
61 
62  // pre-determined parameters for seed pt calculation ( pt * dphi )
63  theParameters["topmb41"] = 0.87;
64  theParameters["bottommb41"] = 1.2;
65  theParameters["topmb42"] = 0.67;
66  theParameters["bottommb42"] = 0.98;
67  theParameters["topmb43"] = 0.34;
68  theParameters["bottommb43"] = 0.58;
69  theParameters["topmb31"] = 0.54;
70  theParameters["bottommb31"] = 0.77;
71  theParameters["topmb32"] = 0.35;
72  theParameters["bottommb32"] = 0.55;
73  theParameters["topmb21"] = 0.21;
74  theParameters["bottommb21"] = 0.31;
75 
76 
78  muonMeasurements = new MuonDetLayerMeasurements(theDTRecSegmentLabel,theCSCRecSegmentLabel,
79  InputTag(),iC,
80  theEnableDTFlag,theEnableCSCFlag,false);
81 
82 
83 
84 }
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
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::map< std::string, float > theParameters
MuonDetLayerMeasurements * muonMeasurements
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 87 of file CosmicMuonSeedGenerator.cc.

87  {
88  if (muonMeasurements)
89  delete muonMeasurements;
90 }
MuonDetLayerMeasurements * muonMeasurements

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 366 of file CosmicMuonSeedGenerator.cc.

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

366  {
367  bool result = false;
368 
369  GlobalVector dir1 = lhs->globalDirection();
370  GlobalPoint pos1 = lhs->globalPosition();
372  GlobalPoint pos2 = rhs->globalPosition();
373 
374  GlobalVector dis = pos2 - pos1;
375 
376  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 )
377  && dis.mag() < 5.0 )
378  result = true;
379 
380  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 ) &&
381  (deltaR<double>(dir1.eta(), dir1.phi(), dis.eta(), dis.phi()) < 0.1 || deltaR<double>(dir2.eta(), dir2.phi(), dis.eta(), dis.phi()) < 0.1 ) )
382  result = true;
383 
384  if ( fabs(dir1.eta()) > 4.0 || fabs(dir2.eta()) > 4.0 ) {
385  if ( (fabs(dir1.theta() - dir2.theta()) < 0.07 ||
386  fabs(dir1.theta() + dir2.theta()) > 3.07 ) &&
387  (fabs(dir1.theta() - dis.theta()) < 0.07 ||
388  fabs(dir1.theta() - dis.theta()) < 0.07 ||
389  fabs(dir1.theta() + dis.theta()) > 3.07 ||
390  fabs(dir1.theta() + dis.theta()) > 3.07 ) )
391 
392  result = true;
393  }
394 
395  return result;
396 }
virtual GlobalVector globalDirection() const
Direction in 3D for segments, otherwise (0,0,0)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
T mag() const
Definition: PV3DBase.h:67
tuple result
Definition: query.py:137
virtual GlobalPoint globalPosition() const GCC11_FINAL
T eta() const
Definition: PV3DBase.h:76
bool CosmicMuonSeedGenerator::checkQuality ( const MuonTransientTrackingRecHit::MuonRecHitPointer hit) const
private

determine if a MuonTransientTrackingRecHit is qualified to build seed

Definition at line 204 of file CosmicMuonSeedGenerator.cc.

References python.rootplot.argparse::category, MuonTransientTrackingRecHit::chi2(), GenericTransientTrackingRecHit::dimension(), MuonTransientTrackingRecHit::isCSC(), MuonTransientTrackingRecHit::isDT(), TrackingRecHit::isValid(), LogTrace, and AlCaHLTBitMon_QueryRunRegistry::string.

204  {
205 
206  const std::string category = "Muon|RecoMuon|CosmicMuonSeedGenerator";
207 
208  // only use 4D segments
209  if ( !hit->isValid() ) return false;
210 
211  if (hit->dimension() < 4) {
212  LogTrace(category)<<"dim < 4";
213  return false;
214  }
215 
216  if (hit->isDT() && ( hit->chi2()> theMaxDTChi2 )) {
217  LogTrace(category)<<"DT chi2 too large";
218  return false;
219  }
220  else if (hit->isCSC() &&( hit->chi2()> theMaxCSCChi2 ) ) {
221  LogTrace(category)<<"CSC chi2 too large";
222  return false;
223  }
224  return true;
225 
226 }
bool isCSC() const
if this rec hit is a CSC rec hit
virtual double chi2() const
Chi square of the fit for segments, else 0.
double theMaxDTChi2
the maximum chi2 required for dt and csc rechits
bool isDT() const
if this rec hit is a DT rec hit
#define LogTrace(id)
bool isValid() const
std::vector< TrajectorySeed > CosmicMuonSeedGenerator::createSeed ( const MuonTransientTrackingRecHit::MuonRecHitPointer hit,
const edm::EventSetup eSetup 
) const
private

create TrajectorySeed from MuonTransientTrackingRecHit

Definition at line 305 of file CosmicMuonSeedGenerator.cc.

References python.rootplot.argparse::category, DeDxDiscriminatorTools::charge(), MuonSubdetId::CSC, TrackingRecHit::det(), MuonSubdetId::DT, MuonPatternRecoDumper::dumpMuonId(), relativeConstraints::error, PV3DBase< T, PVType, FrameType >::eta(), TrackingRecHit::geographicalId(), MuonTransientTrackingRecHit::globalDirection(), GenericTransientTrackingRecHit::localPosition(), LogTrace, MuonTransientTrackingRecHit::parametersError(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), GenericTransientTrackingRecHit::projectionMatrix(), RecoTauCleanerPlugins::pt, DetId::rawId(), query::result, AlCaHLTBitMon_QueryRunRegistry::string, DetId::subdetId(), GeomDet::surface(), PV3DBase< T, PVType, FrameType >::theta(), and GeomDet::toLocal().

305  {
306 
307  std::vector<TrajectorySeed> result;
308 
309  const std::string category = "Muon|RecoMuon|CosmicMuonSeedGenerator";
310 
311  MuonPatternRecoDumper dumper;
312 
313  // set the pt by hand
314  double pt = 10.0;
315 
316  // AlgebraicVector4 t;
317  AlgebraicSymMatrix mat(5,0);
318 
319  // Fill the LocalTrajectoryParameters
320  LocalPoint segPos=hit->localPosition();
321 
323  hit->globalDirection().phi(),
324  1.));
325  // Force all track downward for cosmic, not beam-halo
326  if (hit->geographicalId().subdetId() == MuonSubdetId::DT && fabs(hit->globalDirection().eta()) < 4.0 && hit->globalDirection().phi() > 0 )
327  polar = - polar;
328 
329  if (hit->geographicalId().subdetId() == MuonSubdetId::CSC && fabs(hit->globalDirection().eta()) > 2.3 ) {
330  polar = - polar;
331  }
332 
333  polar *=fabs(pt)/polar.perp();
334 
335  LocalVector segDir =hit->det()->toLocal(polar);
336 
337  int charge= 1;
338  LocalTrajectoryParameters param(segPos,segDir, charge);
339 
340  charge= -1;
341  LocalTrajectoryParameters param2(segPos,segDir, charge);
342 
343  mat = hit->parametersError().similarityT( hit->projectionMatrix() );
344 
345  float p_err = 0.2;
346  mat[0][0]= p_err;
347 
348  LocalTrajectoryError error(asSMatrix<5>(mat));
349 
350  // Create the TrajectoryStateOnSurface
351  TrajectoryStateOnSurface tsos(param, error, hit->det()->surface(), &*theField);
352  TrajectoryStateOnSurface tsos2(param2, error, hit->det()->surface(), &*theField);
353 
354  LogTrace(category)<<"Trajectory State on Surface of Seed";
355  LogTrace(category)<<"mom: "<<tsos.globalMomentum()<<" phi: "<<tsos.globalMomentum().phi();
356  LogTrace(category)<<"pos: " << tsos.globalPosition();
357  LogTrace(category) << "The RecSegment relies on: ";
358  LogTrace(category) << dumper.dumpMuonId(hit->geographicalId());
359 
360  result.push_back( tsosToSeed(tsos, hit->geographicalId().rawId()) );
361  result.push_back( tsosToSeed(tsos2, hit->geographicalId().rawId()) );
362 
363  return result;
364 }
T perp() const
Definition: PV3DBase.h:72
edm::ESHandle< MagneticField > theField
virtual GlobalVector globalDirection() const
Direction in 3D for segments, otherwise (0,0,0)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
virtual LocalPoint localPosition() const override
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
virtual AlgebraicMatrix projectionMatrix() const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
double charge(const std::vector< uint8_t > &Ampls)
std::string dumpMuonId(const DetId &id) const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
static const int CSC
Definition: MuonSubdetId.h:13
const GeomDet * det() const
tuple result
Definition: query.py:137
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
#define LogTrace(id)
T eta() const
Definition: PV3DBase.h:76
virtual AlgebraicSymMatrix parametersError() const override
CLHEP::HepSymMatrix AlgebraicSymMatrix
static const int DT
Definition: MuonSubdetId.h:12
DetId geographicalId() const
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 441 of file CosmicMuonSeedGenerator.cc.

References python.rootplot.argparse::category, DeDxDiscriminatorTools::charge(), MuonSubdetId::CSC, SiPixelRawToDigiRegional_cfi::deltaPhi, TrackingRecHit::det(), pat::helper::ParametrizationHelper::dimension(), GenericTransientTrackingRecHit::dimension(), MuonSubdetId::DT, MuonPatternRecoDumper::dumpMuonId(), alignCSCRings::e, relativeConstraints::error, PV3DBase< T, PVType, FrameType >::eta(), CosmicMuonSeedGenerator::MuonRecHitPair::first, TrackingRecHit::geographicalId(), MuonTransientTrackingRecHit::globalDirection(), GenericTransientTrackingRecHit::localPosition(), LogTrace, MuonTransientTrackingRecHit::parametersError(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), GenericTransientTrackingRecHit::projectionMatrix(), RecoTauCleanerPlugins::pt, DetId::rawId(), query::result, CosmicMuonSeedGenerator::MuonRecHitPair::second, AlCaHLTBitMon_QueryRunRegistry::string, DetId::subdetId(), GeomDet::surface(), edmStreamStallGrapher::t, PV3DBase< T, PVType, FrameType >::theta(), GeomDet::toLocal(), and CosmicMuonSeedGenerator::MuonRecHitPair::type.

442  {
443  std::vector<TrajectorySeed> result;
444 
445  const std::string category = "Muon|RecoMuon|CosmicMuonSeedGenerator";
446 
447  MuonPatternRecoDumper dumper;
448 
449  float dphi = deltaPhi((hitpair.first)->globalDirection().phi(), (hitpair.second)->globalDirection().phi());
450 
451  LogTrace(category)<<"hitpair.type "<<hitpair.type;
452 
453  map<string, float>::const_iterator iterPar = theParameters.find(hitpair.type);
454  if ( iterPar == theParameters.end() ) {
455  return result;
456  }
457 
458  // set the pt and charge by dphi
459  int charge = (dphi > 0) ? -1 : 1;
460 
461  double pt = 999.0;
462  float paraC = (iterPar->second);
463 
464  if (fabs(dphi) > 1e-5) {
465  pt = paraC/fabs(dphi);
466  }
467 
468  if (pt < 10.0 ) { return result; } //still use the old strategy for low pt
469 
470  AlgebraicVector t(4);
471  AlgebraicSymMatrix mat(5,0) ;
472 
474  if ( hit->dimension() < (hitpair.second)->dimension() ) hit = hitpair.second;
475 
476  // Fill the LocalTrajectoryParameters
477  LocalPoint segPos=hit->localPosition();
478 
480  hit->globalDirection().phi(),
481  1.));
482  // Force all track downward for cosmic, not beam-halo
483  if (hit->geographicalId().subdetId() == MuonSubdetId::DT && fabs(hit->globalDirection().eta()) < 4.0 && hit->globalDirection().phi() > 0 )
484  polar = - polar;
485 
486  if (hit->geographicalId().subdetId() == MuonSubdetId::CSC && fabs(hit->globalDirection().eta()) > 2.3 ) {
487  polar = - polar;
488  }
489 
490  polar *=fabs(pt)/polar.perp();
491 
492  LocalVector segDir =hit->det()->toLocal(polar);
493 
494  LocalTrajectoryParameters param(segPos,segDir, charge);
495 
496  mat = hit->parametersError().similarityT( hit->projectionMatrix() );
497 
498  float p_err = 0.004/paraC;
499  if (pt < 10.01) p_err = 0.1;
500  mat[0][0]= p_err;
501 
502  LocalTrajectoryError error(asSMatrix<5>(mat));
503 
504  // Create the TrajectoryStateOnSurface
505  TrajectoryStateOnSurface tsos(param, error, hit->det()->surface(), &*theField);
506 
507  LogTrace(category)<<"Trajectory State on Surface of Seed";
508  LogTrace(category)<<"mom: "<<tsos.globalMomentum()<<" phi: "<<tsos.globalMomentum().phi();
509  LogTrace(category)<<"pos: " << tsos.globalPosition();
510  LogTrace(category) << "The RecSegment relies on: ";
511  LogTrace(category) << dumper.dumpMuonId(hit->geographicalId());
512 
513  result.push_back( tsosToSeed(tsos, hit->geographicalId().rawId()) );
514 
515  return result;
516 }
T perp() const
Definition: PV3DBase.h:72
edm::ESHandle< MagneticField > theField
virtual GlobalVector globalDirection() const
Direction in 3D for segments, otherwise (0,0,0)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
virtual LocalPoint localPosition() const override
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
virtual AlgebraicMatrix projectionMatrix() const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
double charge(const std::vector< uint8_t > &Ampls)
std::string dumpMuonId(const DetId &id) const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
static const int CSC
Definition: MuonSubdetId.h:13
const GeomDet * det() const
tuple result
Definition: query.py:137
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
std::map< std::string, float > theParameters
#define LogTrace(id)
CLHEP::HepVector AlgebraicVector
T eta() const
Definition: PV3DBase.h:76
virtual AlgebraicSymMatrix parametersError() const override
CLHEP::HepSymMatrix AlgebraicSymMatrix
static const int DT
Definition: MuonSubdetId.h:12
DetId geographicalId() const
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 272 of file CosmicMuonSeedGenerator.cc.

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

274  {
275 
276  const std::string category = "Muon|RecoMuon|CosmicMuonSeedGenerator";
277 
278  if (hits.size() == 0 || results.size() >= theMaxSeeds ) return;
279  for (MuonRecHitContainer::const_iterator ihit = hits.begin(); ihit != hits.end(); ihit++) {
280  const std::vector<TrajectorySeed>& sds = createSeed((*ihit),eSetup);
281  LogTrace(category)<<"created seeds from rechit "<<sds.size();
282  results.insert(results.end(),sds.begin(),sds.end());
283  if ( results.size() >= theMaxSeeds ) break;
284  }
285  return;
286 }
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 288 of file CosmicMuonSeedGenerator.cc.

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

290  {
291 
292  const std::string category = "Muon|RecoMuon|CosmicMuonSeedGenerator";
293 
294  if (hitpairs.size() == 0 || results.size() >= theMaxSeeds ) return;
295  for (CosmicMuonSeedGenerator::MuonRecHitPairVector::const_iterator ihitpair = hitpairs.begin(); ihitpair != hitpairs.end(); ihitpair++) {
296  const std::vector<TrajectorySeed>& sds = createSeed((*ihitpair),eSetup);
297  LogTrace(category)<<"created seeds from rechit "<<sds.size();
298  results.insert(results.end(),sds.begin(),sds.end());
299  if ( results.size() >= theMaxSeeds ) break;
300  }
301  return;
302 }
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 398 of file CosmicMuonSeedGenerator.cc.

References MuonTransientTrackingRecHit::degreesOfFreedom().

399  {
400 
401  if ( (lhs->degreesOfFreedom() > rhs->degreesOfFreedom() ) ||
402  ( (lhs->degreesOfFreedom() == rhs->degreesOfFreedom() ) &&
403  (lhs)->chi2() < (rhs)->chi2() ) ) return true;
404  else return false;
405 
406 }
virtual int degreesOfFreedom() const
Degrees of freedom for segments, else 0.
CosmicMuonSeedGenerator::MuonRecHitPairVector CosmicMuonSeedGenerator::makeSegPairs ( const MuonTransientTrackingRecHit::MuonRecHitContainer hits1,
const MuonTransientTrackingRecHit::MuonRecHitContainer hits2,
std::string  tag 
) const
private

Definition at line 410 of file CosmicMuonSeedGenerator.cc.

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

410  {
411 
413  const std::string category = "Muon|RecoMuon|CosmicMuonSeedGenerator";
414 
415  if (hits1.empty() || hits2.empty() ) return result;
416 
417  for (MuonRecHitContainer::const_iterator ihit1 = hits1.begin(); ihit1 != hits1.end(); ihit1++) {
418  if ( !checkQuality(*ihit1) ) continue;
419 
420  for (MuonRecHitContainer::const_iterator ihit2 = hits2.begin(); ihit2 != hits2.end(); ihit2++) {
421  if ( !checkQuality(*ihit2) ) continue;
422 
423  float dphi = deltaPhi((*ihit1)->globalPosition().phi(), (*ihit2)->globalPosition().phi());
424  if ( dphi < 0.5 ) {
425  if ((*ihit1)->globalPosition().y() > 0.0 && ( (*ihit1)->globalPosition().y() > (*ihit2)->globalPosition().y() ) ) {
426  std::string tag2 = "top"+tag;
427 
428  result.push_back(MuonRecHitPair(*ihit1, *ihit2, tag2));
429  } else if ((*ihit1)->globalPosition().y() < 0.0 && ( (*ihit1)->globalPosition().y() < (*ihit2)->globalPosition().y() ) ) {
430  std::string tag2 = "bottom"+tag;
431  result.push_back(MuonRecHitPair(*ihit2, *ihit1, tag2));
432 
433  }
434  }
435  }
436  }
437 
438  return result;
439 }
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 
)
overridevirtual

reconstruct muon's seeds

Implements edm::stream::EDProducerBase.

Definition at line 94 of file CosmicMuonSeedGenerator.cc.

References python.rootplot.argparse::category, edm::EventSetup::get(), LogTrace, convertSQLitetoXML_cfg::output, fileCollector::seed, and AlCaHLTBitMon_QueryRunRegistry::string.

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

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

228  {
229 
231  const std::string category = "Muon|RecoMuon|CosmicMuonSeedGenerator";
232 
233  //Only select good quality Segments
234  for (MuonRecHitContainer::const_iterator hit = hits.begin(); hit != hits.end(); hit++) {
235  if ( checkQuality(*hit) ) result.push_back(*hit);
236  }
237 
238  if ( result.size() < 2 ) return result;
239 
240  MuonRecHitContainer result2;
241 
242  //avoid selecting Segments with similar direction
243  for (MuonRecHitContainer::iterator hit = result.begin(); hit != result.end(); hit++) {
244  if (*hit == 0) continue;
245  if ( !(*hit)->isValid() ) continue;
246  bool good = true;
247  //UNUSED: GlobalVector dir1 = (*hit)->globalDirection();
248  //UNUSED: GlobalPoint pos1 = (*hit)->globalPosition();
249  for (MuonRecHitContainer::iterator hit2 = hit + 1; hit2 != result.end(); hit2++) {
250  if (*hit2 == 0) continue;
251  if ( !(*hit2)->isValid() ) continue;
252 
253  //compare direction and position
254  //UNUSED: GlobalVector dir2 = (*hit2)->globalDirection();
255  //UNUSED: GlobalPoint pos2 = (*hit2)->globalPosition();
256  if ( !areCorrelated((*hit),(*hit2)) ) continue;
257 
258  if ( !leftIsBetter((*hit),(*hit2)) ) {
259  good = false;
260  } else (*hit2) = 0;
261  }
262 
263  if ( good ) result2.push_back(*hit);
264  }
265 
266  result.clear();
267 
268  return result2;
269 
270 }
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 518 of file CosmicMuonSeedGenerator.cc.

References alongMomentum, trajectoryStateTransform::persistentState(), and fileCollector::seed.

518  {
519 
521 
523  TrajectorySeed seed(seedTSOS,container,alongMomentum);
524  return seed;
525 }
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)

Member Data Documentation

MuonDetLayerMeasurements* CosmicMuonSeedGenerator::muonMeasurements
private

Definition at line 122 of file CosmicMuonSeedGenerator.h.

edm::InputTag CosmicMuonSeedGenerator::theCSCRecSegmentLabel
private

the name of the CSC rec hits collection

Definition at line 107 of file CosmicMuonSeedGenerator.h.

edm::InputTag CosmicMuonSeedGenerator::theDTRecSegmentLabel
private

the name of the DT rec hits collection

Definition at line 104 of file CosmicMuonSeedGenerator.h.

bool CosmicMuonSeedGenerator::theEnableCSCFlag
private

enable CSCSegment Flag

Definition at line 101 of file CosmicMuonSeedGenerator.h.

bool CosmicMuonSeedGenerator::theEnableDTFlag
private

enable DT Segment Flag

Definition at line 98 of file CosmicMuonSeedGenerator.h.

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

Definition at line 116 of file CosmicMuonSeedGenerator.h.

double CosmicMuonSeedGenerator::theMaxCSCChi2
private

Definition at line 114 of file CosmicMuonSeedGenerator.h.

double CosmicMuonSeedGenerator::theMaxDTChi2
private

the maximum chi2 required for dt and csc rechits

Definition at line 113 of file CosmicMuonSeedGenerator.h.

unsigned int CosmicMuonSeedGenerator::theMaxSeeds
private

the maximum number of Seeds

Definition at line 110 of file CosmicMuonSeedGenerator.h.

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

Definition at line 115 of file CosmicMuonSeedGenerator.h.

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

Definition at line 120 of file CosmicMuonSeedGenerator.h.

TrajectoryStateTransform* CosmicMuonSeedGenerator::theTSTransform
private

Definition at line 118 of file CosmicMuonSeedGenerator.h.