CMS 3D CMS Logo

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

#include <MuonIdProducer.h>

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

Public Types

typedef reco::Muon::MuonTrackType TrackType
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

virtual void beginRun (edm::Run &, const edm::EventSetup &)
 
 MuonIdProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
virtual ~MuonIdProducer ()
 
- 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 ()
 

Static Public Member Functions

static double sectorPhi (const DetId &id)
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

unsigned int chamberId (const DetId &)
 
bool checkLinks (const reco::MuonTrackLinks *) const
 
void fillArbitrationInfo (reco::MuonCollection *)
 
void fillGlbQuality (edm::Event &, const edm::EventSetup &, reco::Muon &aMuon)
 
void fillMuonId (edm::Event &, const edm::EventSetup &, reco::Muon &, TrackDetectorAssociator::Direction direction=TrackDetectorAssociator::InsideOut)
 
void fillMuonIsolation (edm::Event &, const edm::EventSetup &, reco::Muon &aMuon, reco::IsoDeposit &trackDep, reco::IsoDeposit &ecalDep, reco::IsoDeposit &hcalDep, reco::IsoDeposit &hoDep, reco::IsoDeposit &jetDep)
 
void fillTrackerKink (reco::Muon &aMuon)
 
void init (edm::Event &, const edm::EventSetup &)
 
bool isGoodTrack (const reco::Track &track)
 
bool isGoodTrackerMuon (const reco::Muon &muon)
 
reco::CaloMuon makeCaloMuon (const reco::Muon &)
 
reco::Muon makeMuon (edm::Event &iEvent, const edm::EventSetup &iSetup, const reco::TrackRef &track, TrackType type)
 
reco::Muon makeMuon (const reco::MuonTrackLinks &links)
 
reco::Muon makeMuon (const reco::Track &track)
 
int overlap (const reco::Muon &muon, const reco::Track &track)
 
double phiOfMuonIneteractionRegion (const reco::Muon &muon) const
 

Private Attributes

bool addExtraSoftMuons_
 
bool arbClean_
 
double caloCut_
 
bool debugWithTruthMatching_
 
edm::Handle
< reco::TrackToTrackMap
dytCollectionHandle_
 
std::string ecalDepositName_
 
bool fillCaloCompatibility_
 
bool fillEnergy_
 
bool fillGlobalTrackQuality_
 
bool fillGlobalTrackRefits_
 
bool fillIsolation_
 
bool fillMatching_
 
bool fillTrackerKink_
 
edm::InputTag globalTrackQualityInputTag_
 
std::string hcalDepositName_
 
std::string hoDepositName_
 
edm::Handle
< reco::TrackCollection
innerTrackCollectionHandle_
 
std::vector< edm::InputTaginputCollectionLabels_
 
std::vector< std::string > inputCollectionTypes_
 
std::string jetDepositName_
 
edm::Handle
< reco::MuonTrackLinksCollection
linkCollectionHandle_
 
double maxAbsDx_
 
double maxAbsDy_
 
double maxAbsEta_
 
double maxAbsPullX_
 
double maxAbsPullY_
 
MuonMeshmeshAlgo_
 
int minNumberOfMatches_
 
double minP_
 
double minPCaloMuon_
 
double minPt_
 
reco::isodeposit::IsoDepositExtractormuIsoExtractorCalo_
 
reco::isodeposit::IsoDepositExtractormuIsoExtractorJet_
 
reco::isodeposit::IsoDepositExtractormuIsoExtractorTrack_
 
MuonCaloCompatibility muonCaloCompatibility_
 
edm::Handle< reco::MuonCollectionmuonCollectionHandle_
 
edm::Handle
< reco::TrackCollection
outerTrackCollectionHandle_
 
TrackAssociatorParameters parameters_
 
edm::Handle
< reco::TrackToTrackMap
pickyCollectionHandle_
 
double ptThresholdToFillCandidateP4WithGlobalFit_
 
double sigmaThresholdToFillCandidateP4WithGlobalFit_
 
MuonTimingFillertheTimingFiller_
 
edm::Handle
< reco::TrackToTrackMap
tpfmsCollectionHandle_
 
TrackDetectorAssociator trackAssociator_
 
std::string trackDepositName_
 
std::auto_ptr< MuonKinkFindertrackerKinkFinder_
 
bool writeIsoDeposits_
 

Additional Inherited Members

- 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

Definition at line 55 of file MuonIdProducer.h.

Member Typedef Documentation

Definition at line 57 of file MuonIdProducer.h.

Constructor & Destructor Documentation

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

Definition at line 59 of file MuonIdProducer.cc.

References addExtraSoftMuons_, arbClean_, caloCut_, MuonCaloCompatibility::configure(), debugWithTruthMatching_, ecalDepositName_, fillCaloCompatibility_, fillEnergy_, fillGlobalTrackQuality_, fillGlobalTrackRefits_, fillIsolation_, fillMatching_, fillTrackerKink_, reco::get(), edm::ParameterSet::getParameter(), globalTrackQualityInputTag_, hcalDepositName_, hoDepositName_, inputCollectionLabels_, inputCollectionTypes_, jetDepositName_, TrackAssociatorParameters::loadParameters(), maxAbsDx_, maxAbsDy_, maxAbsEta_, maxAbsPullX_, maxAbsPullY_, meshAlgo_, minNumberOfMatches_, minP_, minPCaloMuon_, minPt_, muIsoExtractorCalo_, muIsoExtractorJet_, muIsoExtractorTrack_, muonCaloCompatibility_, Parameters::parameters, parameters_, ptThresholdToFillCandidateP4WithGlobalFit_, sigmaThresholdToFillCandidateP4WithGlobalFit_, theTimingFiller_, trackDepositName_, trackerKinkFinder_, and writeIsoDeposits_.

59  :
61 {
62  produces<reco::MuonCollection>();
63  produces<reco::CaloMuonCollection>();
64  produces<reco::MuonTimeExtraMap>("combined");
65  produces<reco::MuonTimeExtraMap>("dt");
66  produces<reco::MuonTimeExtraMap>("csc");
67 
68  minPt_ = iConfig.getParameter<double>("minPt");
69  minP_ = iConfig.getParameter<double>("minP");
70  minPCaloMuon_ = iConfig.getParameter<double>("minPCaloMuon");
71  minNumberOfMatches_ = iConfig.getParameter<int>("minNumberOfMatches");
72  addExtraSoftMuons_ = iConfig.getParameter<bool>("addExtraSoftMuons");
73  maxAbsEta_ = iConfig.getParameter<double>("maxAbsEta");
74  maxAbsDx_ = iConfig.getParameter<double>("maxAbsDx");
75  maxAbsPullX_ = iConfig.getParameter<double>("maxAbsPullX");
76  maxAbsDy_ = iConfig.getParameter<double>("maxAbsDy");
77  maxAbsPullY_ = iConfig.getParameter<double>("maxAbsPullY");
78  fillCaloCompatibility_ = iConfig.getParameter<bool>("fillCaloCompatibility");
79  fillEnergy_ = iConfig.getParameter<bool>("fillEnergy");
80  fillMatching_ = iConfig.getParameter<bool>("fillMatching");
81  fillIsolation_ = iConfig.getParameter<bool>("fillIsolation");
82  writeIsoDeposits_ = iConfig.getParameter<bool>("writeIsoDeposits");
83  fillGlobalTrackQuality_ = iConfig.getParameter<bool>("fillGlobalTrackQuality");
84  fillGlobalTrackRefits_ = iConfig.getParameter<bool>("fillGlobalTrackRefits");
85  //SK: (maybe temporary) run it only if the global is also run
86  fillTrackerKink_ = false;
87  if (fillGlobalTrackQuality_) fillTrackerKink_ = iConfig.getParameter<bool>("fillTrackerKink");
88 
89  ptThresholdToFillCandidateP4WithGlobalFit_ = iConfig.getParameter<double>("ptThresholdToFillCandidateP4WithGlobalFit");
90  sigmaThresholdToFillCandidateP4WithGlobalFit_ = iConfig.getParameter<double>("sigmaThresholdToFillCandidateP4WithGlobalFit");
91  caloCut_ = iConfig.getParameter<double>("minCaloCompatibility"); //CaloMuons
92  arbClean_ = iConfig.getParameter<bool>("runArbitrationCleaner"); // muon mesh
93 
94  // Load TrackDetectorAssociator parameters
95  edm::ParameterSet parameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
96  parameters_.loadParameters( parameters );
97 
98  // Load parameters for the TimingFiller
99  edm::ParameterSet timingParameters = iConfig.getParameter<edm::ParameterSet>("TimingFillerParameters");
100  theTimingFiller_ = new MuonTimingFiller(timingParameters);
101 
102  if (fillCaloCompatibility_){
103  // Load MuonCaloCompatibility parameters
104  parameters = iConfig.getParameter<edm::ParameterSet>("MuonCaloCompatibility");
105  muonCaloCompatibility_.configure( parameters );
106  }
107 
108  if (fillIsolation_){
109  // Load MuIsoExtractor parameters
110  edm::ParameterSet caloExtractorPSet = iConfig.getParameter<edm::ParameterSet>("CaloExtractorPSet");
111  std::string caloExtractorName = caloExtractorPSet.getParameter<std::string>("ComponentName");
112  muIsoExtractorCalo_ = IsoDepositExtractorFactory::get()->create( caloExtractorName, caloExtractorPSet);
113 
114  edm::ParameterSet trackExtractorPSet = iConfig.getParameter<edm::ParameterSet>("TrackExtractorPSet");
115  std::string trackExtractorName = trackExtractorPSet.getParameter<std::string>("ComponentName");
116  muIsoExtractorTrack_ = IsoDepositExtractorFactory::get()->create( trackExtractorName, trackExtractorPSet);
117 
118  edm::ParameterSet jetExtractorPSet = iConfig.getParameter<edm::ParameterSet>("JetExtractorPSet");
119  std::string jetExtractorName = jetExtractorPSet.getParameter<std::string>("ComponentName");
120  muIsoExtractorJet_ = IsoDepositExtractorFactory::get()->create( jetExtractorName, jetExtractorPSet);
121  }
122  if (fillIsolation_ && writeIsoDeposits_){
123  trackDepositName_ = iConfig.getParameter<std::string>("trackDepositName");
124  produces<reco::IsoDepositMap>(trackDepositName_);
125  ecalDepositName_ = iConfig.getParameter<std::string>("ecalDepositName");
126  produces<reco::IsoDepositMap>(ecalDepositName_);
127  hcalDepositName_ = iConfig.getParameter<std::string>("hcalDepositName");
128  produces<reco::IsoDepositMap>(hcalDepositName_);
129  hoDepositName_ = iConfig.getParameter<std::string>("hoDepositName");
130  produces<reco::IsoDepositMap>(hoDepositName_);
131  jetDepositName_ = iConfig.getParameter<std::string>("jetDepositName");
132  produces<reco::IsoDepositMap>(jetDepositName_);
133  }
134 
135  inputCollectionLabels_ = iConfig.getParameter<std::vector<edm::InputTag> >("inputCollectionLabels");
136  inputCollectionTypes_ = iConfig.getParameter<std::vector<std::string> >("inputCollectionTypes");
137  if (inputCollectionLabels_.size() != inputCollectionTypes_.size())
138  throw cms::Exception("ConfigurationError") << "Number of input collection labels is different from number of types. " <<
139  "For each collection label there should be exactly one collection type specified.";
140  if (inputCollectionLabels_.size()>7 ||inputCollectionLabels_.empty())
141  throw cms::Exception("ConfigurationError") << "Number of input collections should be from 1 to 7.";
142 
143  debugWithTruthMatching_ = iConfig.getParameter<bool>("debugWithTruthMatching");
144  if (debugWithTruthMatching_) edm::LogWarning("MuonIdentification")
145  << "========================================================================\n"
146  << "Debugging mode with truth matching is turned on!!! Make sure you understand what you are doing!\n"
147  << "========================================================================\n";
148  if (fillGlobalTrackQuality_){
149  globalTrackQualityInputTag_ = iConfig.getParameter<edm::InputTag>("globalTrackQualityInputTag");
150  }
151 
152  if (fillTrackerKink_) {
153  trackerKinkFinder_.reset(new MuonKinkFinder(iConfig.getParameter<edm::ParameterSet>("TrackerKinkFinderParameters")));
154  }
155 
156  //create mesh holder
157  meshAlgo_ = new MuonMesh(iConfig.getParameter<edm::ParameterSet>("arbitrationCleanerOptions"));
158 }
std::string hoDepositName_
T getParameter(std::string const &) const
std::string jetDepositName_
dictionary parameters
Definition: Parameters.py:2
reco::isodeposit::IsoDepositExtractor * muIsoExtractorCalo_
bool fillCaloCompatibility_
std::string trackDepositName_
std::vector< std::string > inputCollectionTypes_
MuonCaloCompatibility muonCaloCompatibility_
std::auto_ptr< MuonKinkFinder > trackerKinkFinder_
MuonMesh * meshAlgo_
double ptThresholdToFillCandidateP4WithGlobalFit_
TrackAssociatorParameters parameters_
std::string ecalDepositName_
bool fillGlobalTrackRefits_
reco::isodeposit::IsoDepositExtractor * muIsoExtractorTrack_
void configure(const edm::ParameterSet &)
reco::isodeposit::IsoDepositExtractor * muIsoExtractorJet_
MuonTimingFiller * theTimingFiller_
std::vector< edm::InputTag > inputCollectionLabels_
bool fillGlobalTrackQuality_
std::string hcalDepositName_
double sigmaThresholdToFillCandidateP4WithGlobalFit_
bool debugWithTruthMatching_
T get(const Candidate &c)
Definition: component.h:56
edm::InputTag globalTrackQualityInputTag_
void loadParameters(const edm::ParameterSet &)
MuonIdProducer::~MuonIdProducer ( )
virtual

Definition at line 161 of file MuonIdProducer.cc.

References meshAlgo_, muIsoExtractorCalo_, muIsoExtractorJet_, muIsoExtractorTrack_, and theTimingFiller_.

162 {
167  if (meshAlgo_) delete meshAlgo_;
168  // TimingReport::current()->dump(std::cout);
169 }
reco::isodeposit::IsoDepositExtractor * muIsoExtractorCalo_
MuonMesh * meshAlgo_
reco::isodeposit::IsoDepositExtractor * muIsoExtractorTrack_
reco::isodeposit::IsoDepositExtractor * muIsoExtractorJet_
MuonTimingFiller * theTimingFiller_

Member Function Documentation

void MuonIdProducer::beginRun ( edm::Run iRun,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from edm::EDProducer.

Definition at line 409 of file MuonIdProducer.cc.

References edm::EventSetup::get(), meshAlgo_, edm::ESHandle< class >::product(), and MuonMesh::setCSCGeometry().

410 {
411  edm::ESHandle<CSCGeometry> geomHandle;
412  iSetup.get<MuonGeometryRecord>().get(geomHandle);
413 
414  meshAlgo_->setCSCGeometry(geomHandle.product());
415 
416 }
MuonMesh * meshAlgo_
void setCSCGeometry(const CSCGeometry *pg)
Definition: MuonMesh.h:43
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
unsigned int MuonIdProducer::chamberId ( const DetId id)
private

Definition at line 349 of file MuonIdProducer.cc.

References CSCDetId::chamberId(), MuonSubdetId::CSC, MuonSubdetId::DT, DetId::Muon, and DetId::rawId().

Referenced by overlap().

350 {
351  switch ( id.det() ) {
352  case DetId::Muon:
353  switch ( id.subdetId() ) {
354  case MuonSubdetId::DT:
355  {
356  DTChamberId detId(id.rawId());
357  return detId.rawId();
358  }
359  break;
360  case MuonSubdetId::CSC:
361  {
362  CSCDetId detId(id.rawId());
363  return detId.chamberId().rawId();
364  }
365  break;
366  default:
367  return 0;
368  }
369  default:
370  return 0;
371  }
372  return 0;
373 }
static const int CSC
Definition: MuonSubdetId.h:15
static const int DT
Definition: MuonSubdetId.h:14
bool MuonIdProducer::checkLinks ( const reco::MuonTrackLinks links) const
private

Definition at line 1195 of file MuonIdProducer.cc.

References reco::MuonTrackLinks::globalTrack(), edm::Ref< C, T, F >::isNull(), reco::MuonTrackLinks::standAloneTrack(), and reco::MuonTrackLinks::trackerTrack().

Referenced by produce().

1195  {
1196  bool trackBAD = links->trackerTrack().isNull();
1197  bool staBAD = links->standAloneTrack().isNull();
1198  bool glbBAD = links->globalTrack().isNull();
1199  if (trackBAD || staBAD || glbBAD )
1200  {
1201  edm::LogWarning("muonIDbadLinks") << "Global muon links to constituent tracks are invalid: trkBad "
1202  <<trackBAD <<" standaloneBad "<<staBAD<<" globalBad "<<glbBAD
1203  <<". There should be no such object. Muon is skipped.";
1204  return false;
1205  }
1206  return true;
1207 }
bool isNull() const
Checks for null.
Definition: Ref.h:247
void MuonIdProducer::fillArbitrationInfo ( reco::MuonCollection pOutputMuons)
private

Definition at line 900 of file MuonIdProducer.cc.

References arbClean_, reco::MuonSegmentMatch::Arbitrated, reco::MuonSegmentMatch::BelongsToTrackByDR, reco::MuonSegmentMatch::BelongsToTrackByDRSlope, reco::MuonSegmentMatch::BelongsToTrackByDX, reco::MuonSegmentMatch::BelongsToTrackByDXSlope, reco::MuonSegmentMatch::BelongsToTrackByME1aClean, reco::MuonSegmentMatch::BestInChamberByDR, reco::MuonSegmentMatch::BestInChamberByDRSlope, reco::MuonSegmentMatch::BestInChamberByDX, reco::MuonSegmentMatch::BestInChamberByDXSlope, reco::MuonSegmentMatch::BestInStationByDR, reco::MuonSegmentMatch::BestInStationByDRSlope, reco::MuonSegmentMatch::BestInStationByDX, reco::MuonSegmentMatch::BestInStationByDXSlope, MuonMesh::clearMesh(), MuonSubdetId::CSC, MuonMesh::isDuplicateOf(), meshAlgo_, CSCDetId::ring(), MuonMesh::runMesh(), python.multivaluedict::sort(), and plotscripts::stationIndex().

Referenced by produce().

901 {
902  //
903  // apply segment flags
904  //
905  std::vector<std::pair<reco::MuonChamberMatch*,reco::MuonSegmentMatch*> > chamberPairs; // for chamber segment sorting
906  std::vector<std::pair<reco::MuonChamberMatch*,reco::MuonSegmentMatch*> > stationPairs; // for station segment sorting
907  std::vector<std::pair<reco::MuonChamberMatch*,reco::MuonSegmentMatch*> > arbitrationPairs; // for muon segment arbitration
908 
909  // muonIndex1
910  for( unsigned int muonIndex1 = 0; muonIndex1 < pOutputMuons->size(); ++muonIndex1 )
911  {
912  // chamberIter1
913  for( std::vector<reco::MuonChamberMatch>::iterator chamberIter1 = pOutputMuons->at(muonIndex1).matches().begin();
914  chamberIter1 != pOutputMuons->at(muonIndex1).matches().end(); ++chamberIter1 )
915  {
916  if(chamberIter1->segmentMatches.empty()) continue;
917  chamberPairs.clear();
918 
919  // segmentIter1
920  for( std::vector<reco::MuonSegmentMatch>::iterator segmentIter1 = chamberIter1->segmentMatches.begin();
921  segmentIter1 != chamberIter1->segmentMatches.end(); ++segmentIter1 )
922  {
923  chamberPairs.push_back(std::make_pair(&(*chamberIter1), &(*segmentIter1)));
924  if(!segmentIter1->isMask()) // has not yet been arbitrated
925  {
926  arbitrationPairs.clear();
927  arbitrationPairs.push_back(std::make_pair(&(*chamberIter1), &(*segmentIter1)));
928 
929 
930 
931  // find identical segments with which to arbitrate
932  // tracker muons only
933  if (pOutputMuons->at(muonIndex1).isTrackerMuon()) {
934  // muonIndex2
935  for( unsigned int muonIndex2 = muonIndex1+1; muonIndex2 < pOutputMuons->size(); ++muonIndex2 )
936  {
937  // tracker muons only
938  if (! pOutputMuons->at(muonIndex2).isTrackerMuon()) continue;
939  // chamberIter2
940  for( std::vector<reco::MuonChamberMatch>::iterator chamberIter2 = pOutputMuons->at(muonIndex2).matches().begin();
941  chamberIter2 != pOutputMuons->at(muonIndex2).matches().end(); ++chamberIter2 )
942  {
943  // segmentIter2
944  for( std::vector<reco::MuonSegmentMatch>::iterator segmentIter2 = chamberIter2->segmentMatches.begin();
945  segmentIter2 != chamberIter2->segmentMatches.end(); ++segmentIter2 )
946  {
947  if(segmentIter2->isMask()) continue; // has already been arbitrated
948  if(fabs(segmentIter2->x - segmentIter1->x ) < 1E-3 &&
949  fabs(segmentIter2->y - segmentIter1->y ) < 1E-3 &&
950  fabs(segmentIter2->dXdZ - segmentIter1->dXdZ ) < 1E-3 &&
951  fabs(segmentIter2->dYdZ - segmentIter1->dYdZ ) < 1E-3 &&
952  fabs(segmentIter2->xErr - segmentIter1->xErr ) < 1E-3 &&
953  fabs(segmentIter2->yErr - segmentIter1->yErr ) < 1E-3 &&
954  fabs(segmentIter2->dXdZErr - segmentIter1->dXdZErr) < 1E-3 &&
955  fabs(segmentIter2->dYdZErr - segmentIter1->dYdZErr) < 1E-3)
956  arbitrationPairs.push_back(std::make_pair(&(*chamberIter2), &(*segmentIter2)));
957  } // segmentIter2
958  } // chamberIter2
959  } // muonIndex2
960  }
961 
962  // arbitration segment sort
963  if(arbitrationPairs.empty()) continue; // this should never happen
964  if(arbitrationPairs.size()==1) {
965  arbitrationPairs.front().second->setMask(reco::MuonSegmentMatch::BelongsToTrackByDRSlope);
966  arbitrationPairs.front().second->setMask(reco::MuonSegmentMatch::BelongsToTrackByDXSlope);
967  arbitrationPairs.front().second->setMask(reco::MuonSegmentMatch::BelongsToTrackByDR);
968  arbitrationPairs.front().second->setMask(reco::MuonSegmentMatch::BelongsToTrackByDX);
969  arbitrationPairs.front().second->setMask(reco::MuonSegmentMatch::Arbitrated);
970  } else {
971  sort(arbitrationPairs.begin(), arbitrationPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BelongsToTrackByDRSlope));
972  arbitrationPairs.front().second->setMask(reco::MuonSegmentMatch::BelongsToTrackByDRSlope);
973  sort(arbitrationPairs.begin(), arbitrationPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BelongsToTrackByDXSlope));
974  arbitrationPairs.front().second->setMask(reco::MuonSegmentMatch::BelongsToTrackByDXSlope);
975  sort(arbitrationPairs.begin(), arbitrationPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BelongsToTrackByDR));
976  arbitrationPairs.front().second->setMask(reco::MuonSegmentMatch::BelongsToTrackByDR);
977  sort(arbitrationPairs.begin(), arbitrationPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BelongsToTrackByDX));
978  arbitrationPairs.front().second->setMask(reco::MuonSegmentMatch::BelongsToTrackByDX);
979  for( unsigned int it = 0; it < arbitrationPairs.size(); ++it )
980  arbitrationPairs.at(it).second->setMask(reco::MuonSegmentMatch::Arbitrated);
981  }
982  }
983 
984  // setup me1a cleaning for later
985  if( chamberIter1->id.subdetId() == MuonSubdetId::CSC && arbClean_ ) {
986  CSCDetId cscid(chamberIter1->id);
987  if(cscid.ring() == 4)
988  for( std::vector<reco::MuonSegmentMatch>::iterator segmentIter2 = chamberIter1->segmentMatches.begin();
989  segmentIter2 != chamberIter1->segmentMatches.end(); ++segmentIter2 ) {
990  if( segmentIter1->cscSegmentRef.isNonnull() && segmentIter2->cscSegmentRef.isNonnull() )
991  if( meshAlgo_->isDuplicateOf(segmentIter1->cscSegmentRef,segmentIter2->cscSegmentRef) &&
992  (segmentIter2->mask & 0x1e0000) &&
993  (segmentIter1->mask & 0x1e0000) )
995  //if the track has lost the segment already through normal arbitration no need to do it again.
996  }
997  }// mark all ME1/a duplicates that this track owns
998 
999  } // segmentIter1
1000 
1001  // chamber segment sort
1002  if(chamberPairs.empty()) continue; // this should never happen
1003  if(chamberPairs.size()==1) {
1004  chamberPairs.front().second->setMask(reco::MuonSegmentMatch::BestInChamberByDRSlope);
1005  chamberPairs.front().second->setMask(reco::MuonSegmentMatch::BestInChamberByDXSlope);
1006  chamberPairs.front().second->setMask(reco::MuonSegmentMatch::BestInChamberByDR);
1007  chamberPairs.front().second->setMask(reco::MuonSegmentMatch::BestInChamberByDX);
1008  } else {
1009  sort(chamberPairs.begin(), chamberPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BestInChamberByDRSlope));
1010  chamberPairs.front().second->setMask(reco::MuonSegmentMatch::BestInChamberByDRSlope);
1011  sort(chamberPairs.begin(), chamberPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BestInChamberByDXSlope));
1012  chamberPairs.front().second->setMask(reco::MuonSegmentMatch::BestInChamberByDXSlope);
1013  sort(chamberPairs.begin(), chamberPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BestInChamberByDR));
1014  chamberPairs.front().second->setMask(reco::MuonSegmentMatch::BestInChamberByDR);
1015  sort(chamberPairs.begin(), chamberPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BestInChamberByDX));
1016  chamberPairs.front().second->setMask(reco::MuonSegmentMatch::BestInChamberByDX);
1017  }
1018  } // chamberIter1
1019 
1020  // station segment sort
1021  for( int stationIndex = 1; stationIndex < 5; ++stationIndex )
1022  for( int detectorIndex = 1; detectorIndex < 4; ++detectorIndex )
1023  {
1024  stationPairs.clear();
1025 
1026  // chamberIter
1027  for( std::vector<reco::MuonChamberMatch>::iterator chamberIter = pOutputMuons->at(muonIndex1).matches().begin();
1028  chamberIter != pOutputMuons->at(muonIndex1).matches().end(); ++chamberIter )
1029  {
1030  if(!(chamberIter->station()==stationIndex && chamberIter->detector()==detectorIndex)) continue;
1031  if(chamberIter->segmentMatches.empty()) continue;
1032 
1033  for( std::vector<reco::MuonSegmentMatch>::iterator segmentIter = chamberIter->segmentMatches.begin();
1034  segmentIter != chamberIter->segmentMatches.end(); ++segmentIter )
1035  stationPairs.push_back(std::make_pair(&(*chamberIter), &(*segmentIter)));
1036  } // chamberIter
1037 
1038  if(stationPairs.empty()) continue; // this may very well happen
1039  if(stationPairs.size()==1) {
1040  stationPairs.front().second->setMask(reco::MuonSegmentMatch::BestInStationByDRSlope);
1041  stationPairs.front().second->setMask(reco::MuonSegmentMatch::BestInStationByDXSlope);
1042  stationPairs.front().second->setMask(reco::MuonSegmentMatch::BestInStationByDR);
1043  stationPairs.front().second->setMask(reco::MuonSegmentMatch::BestInStationByDX);
1044  } else {
1045  sort(stationPairs.begin(), stationPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BestInStationByDRSlope));
1046  stationPairs.front().second->setMask(reco::MuonSegmentMatch::BestInStationByDRSlope);
1047  sort(stationPairs.begin(), stationPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BestInStationByDXSlope));
1048  stationPairs.front().second->setMask(reco::MuonSegmentMatch::BestInStationByDXSlope);
1049  sort(stationPairs.begin(), stationPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BestInStationByDR));
1050  stationPairs.front().second->setMask(reco::MuonSegmentMatch::BestInStationByDR);
1051  sort(stationPairs.begin(), stationPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BestInStationByDX));
1052  stationPairs.front().second->setMask(reco::MuonSegmentMatch::BestInStationByDX);
1053  }
1054  }
1055 
1056  } // muonIndex1
1057 
1058  if(arbClean_) {
1059  // clear old mesh, create and prune new mesh!
1060  meshAlgo_->clearMesh();
1061  meshAlgo_->runMesh(pOutputMuons);
1062  }
1063 }
static const unsigned int BelongsToTrackByME1aClean
void runMesh(std::vector< reco::Muon > *p)
Definition: MuonMesh.h:39
static const unsigned int Arbitrated
segment mask flags
static const unsigned int BestInStationByDRSlope
static const unsigned int BelongsToTrackByDXSlope
static const unsigned int BestInStationByDR
void clearMesh()
Definition: MuonMesh.h:41
MuonMesh * meshAlgo_
static const int CSC
Definition: MuonSubdetId.h:15
static const unsigned int BestInChamberByDX
static const unsigned int BestInChamberByDR
static const unsigned int BestInStationByDXSlope
static const unsigned int BestInChamberByDXSlope
bool isDuplicateOf(const CSCSegmentRef &lhs, const CSCSegmentRef &rhs) const
Definition: MuonMesh.cc:342
static const unsigned int BelongsToTrackByDRSlope
static const unsigned int BelongsToTrackByDR
static const unsigned int BelongsToTrackByDX
functor predicate for standard library sort algorithm
def stationIndex
Definition: plotscripts.py:353
static const unsigned int BestInStationByDX
static const unsigned int BestInChamberByDRSlope
void MuonIdProducer::fillGlbQuality ( edm::Event iEvent,
const edm::EventSetup iSetup,
reco::Muon aMuon 
)
private

Definition at line 1171 of file MuonIdProducer.cc.

References reco::Muon::combinedMuon(), reco::Muon::combinedQuality(), edm::HandleBase::failedToGet(), edm::Event::getByLabel(), globalTrackQualityInputTag_, reco::Muon::isGlobalMuon(), edm::HandleBase::isValid(), LogDebug, reco::Muon::setCombinedQuality(), and reco::MuonQuality::trkRelChi2.

Referenced by produce().

1172 {
1174  iEvent.getByLabel(globalTrackQualityInputTag_, glbQualH);
1175 
1176  if(aMuon.isGlobalMuon() && glbQualH.isValid() && !glbQualH.failedToGet()) {
1177  aMuon.setCombinedQuality((*glbQualH)[aMuon.combinedMuon()]);
1178  }
1179 
1180  LogDebug("MuonIdentification") << "tkChiVal " << aMuon.combinedQuality().trkRelChi2;
1181 
1182 }
#define LogDebug(id)
bool isGlobalMuon() const
Definition: Muon.h:211
float trkRelChi2
chi2 value for the inner track stub with respect to the global track
Definition: MuonQuality.h:15
MuonQuality combinedQuality() const
get energy deposition information
Definition: Muon.h:122
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
bool failedToGet() const
Definition: HandleBase.h:80
virtual TrackRef combinedMuon() const
reference to a stand-alone muon Track
Definition: Muon.h:56
void setCombinedQuality(const MuonQuality &combinedQuality)
set energy deposition information
Definition: Muon.h:124
edm::InputTag globalTrackQualityInputTag_
void MuonIdProducer::fillMuonId ( edm::Event iEvent,
const edm::EventSetup iSetup,
reco::Muon aMuon,
TrackDetectorAssociator::Direction  direction = TrackDetectorAssociator::InsideOut 
)
private

Definition at line 767 of file MuonIdProducer.cc.

References TrackDetectorAssociator::associate(), TrackDetMatchInfo::chambers, TrackDetMatchInfo::crossedEcalIds, TrackDetMatchInfo::crossedEnergy(), TrackDetMatchInfo::crossedHcalIds, reco::MuonSegmentMatch::cscSegmentRef, reco::MuonSegmentMatch::dtSegmentRef, reco::MuonChamberMatch::dXdZ, reco::MuonSegmentMatch::dXdZ, reco::MuonChamberMatch::dXdZErr, reco::MuonSegmentMatch::dXdZErr, reco::MuonChamberMatch::dYdZ, reco::MuonSegmentMatch::dYdZ, reco::MuonChamberMatch::dYdZErr, reco::MuonSegmentMatch::dYdZErr, reco::MuonEnergy::ecal_id, reco::MuonEnergy::ecal_position, reco::MuonEnergy::ecal_time, TrackDetMatchInfo::EcalRecHits, TrackDetMatchInfo::ecalRecHits, reco::MuonChamberMatch::edgeX, reco::MuonChamberMatch::edgeY, reco::MuonEnergy::em, reco::MuonEnergy::emMax, reco::MuonEnergy::emS25, reco::MuonEnergy::emS9, edm::hlt::Exception, fillEnergy_, fillMatching_, TrackDetMatchInfo::findMaxDeposition(), edm::Ref< C, T, F >::get(), reco::MuonEnergy::had, reco::MuonEnergy::hadMax, reco::MuonEnergy::hadS9, reco::MuonSegmentMatch::hasPhi_, reco::MuonSegmentMatch::hasZed_, reco::MuonEnergy::hcal_id, reco::MuonEnergy::hcal_position, reco::MuonEnergy::hcal_time, TrackDetMatchInfo::HcalRecHits, TrackDetMatchInfo::hcalRecHits, reco::MuonEnergy::ho, TrackDetMatchInfo::HORecHits, reco::MuonEnergy::hoS9, reco::MuonChamberMatch::id, info, edm::Ref< C, T, F >::isNull(), reco::Muon::isTrackerMuon(), LogTrace, reco::MuonSegmentMatch::mask, reco::Muon::matches(), maxAbsDx_, maxAbsDy_, maxAbsPullX_, maxAbsPullY_, reco::Muon::NoArbitration, reco::Muon::numberOfMatches(), TrackDetMatchInfo::nXnEnergy(), parameters_, funct::pow(), reco::MuonChamberMatch::segmentMatches, reco::Muon::setCalEnergy(), reco::Muon::setMatches(), mathSSE::sqrt(), reco::Muon::standAloneMuon(), reco::MuonSegmentMatch::t0, reco::MuonEnergy::tower, reco::MuonEnergy::towerS9, TrackDetMatchInfo::TowerTotal, reco::Muon::track(), trackAssociator_, TrackDetMatchInfo::trkGlobPosAtEcal, TrackDetMatchInfo::trkGlobPosAtHcal, reco::MuonChamberMatch::x, reco::MuonSegmentMatch::x, reco::MuonChamberMatch::xErr, reco::MuonSegmentMatch::xErr, LocalError::xx(), reco::MuonChamberMatch::y, reco::MuonSegmentMatch::y, reco::MuonChamberMatch::yErr, reco::MuonSegmentMatch::yErr, and LocalError::yy().

Referenced by produce().

770 {
771  // perform track - detector association
772  const reco::Track* track = 0;
773  if ( ! aMuon.track().isNull() )
774  track = aMuon.track().get();
775  else
776  {
777  if ( ! aMuon.standAloneMuon().isNull() )
778  track = aMuon.standAloneMuon().get();
779  else
780  throw cms::Exception("FatalError") << "Failed to fill muon id information for a muon with undefined references to tracks";
781  }
782 
783  TrackDetMatchInfo info = trackAssociator_.associate(iEvent, iSetup, *track, parameters_, direction);
784 
785  if ( fillEnergy_ ) {
786  reco::MuonEnergy muonEnergy;
789  muonEnergy.ho = info.crossedEnergy(TrackDetMatchInfo::HORecHits);
791  muonEnergy.emS9 = info.nXnEnergy(TrackDetMatchInfo::EcalRecHits,1); // 3x3 energy
792  muonEnergy.emS25 = info.nXnEnergy(TrackDetMatchInfo::EcalRecHits,2); // 5x5 energy
793  muonEnergy.hadS9 = info.nXnEnergy(TrackDetMatchInfo::HcalRecHits,1); // 3x3 energy
794  muonEnergy.hoS9 = info.nXnEnergy(TrackDetMatchInfo::HORecHits,1); // 3x3 energy
795  muonEnergy.towerS9 = info.nXnEnergy(TrackDetMatchInfo::TowerTotal,1); // 3x3 energy
796  muonEnergy.ecal_position = info.trkGlobPosAtEcal;
797  muonEnergy.hcal_position = info.trkGlobPosAtHcal;
798  if (! info.crossedEcalIds.empty() ) muonEnergy.ecal_id = info.crossedEcalIds.front();
799  if (! info.crossedHcalIds.empty() ) muonEnergy.hcal_id = info.crossedHcalIds.front();
800  // find maximal energy depositions and their time
801  DetId emMaxId = info.findMaxDeposition(TrackDetMatchInfo::EcalRecHits,2); // max energy deposit in 5x5 shape
802  for(std::vector<const EcalRecHit*>::const_iterator hit=info.ecalRecHits.begin();
803  hit!=info.ecalRecHits.end(); ++hit) {
804  if ((*hit)->id() != emMaxId) continue;
805  muonEnergy.emMax = (*hit)->energy();
806  muonEnergy.ecal_time = (*hit)->time();
807  }
808  DetId hadMaxId = info.findMaxDeposition(TrackDetMatchInfo::HcalRecHits,1); // max energy deposit in 3x3 shape
809  for(std::vector<const HBHERecHit*>::const_iterator hit=info.hcalRecHits.begin();
810  hit!=info.hcalRecHits.end(); ++hit) {
811  if ((*hit)->id() != hadMaxId) continue;
812  muonEnergy.hadMax = (*hit)->energy();
813  muonEnergy.hcal_time = (*hit)->time();
814  }
815  aMuon.setCalEnergy( muonEnergy );
816  }
817  if ( ! fillMatching_ && ! aMuon.isTrackerMuon() ) return;
818 
819  // fill muon match info
820  std::vector<reco::MuonChamberMatch> muonChamberMatches;
821  unsigned int nubmerOfMatchesAccordingToTrackAssociator = 0;
822  for( std::vector<TAMuonChamberMatch>::const_iterator chamber=info.chambers.begin();
823  chamber!=info.chambers.end(); chamber++ )
824  {
825  reco::MuonChamberMatch matchedChamber;
826 
827  LocalError localError = chamber->tState.localError().positionError();
828  matchedChamber.x = chamber->tState.localPosition().x();
829  matchedChamber.y = chamber->tState.localPosition().y();
830  matchedChamber.xErr = sqrt( localError.xx() );
831  matchedChamber.yErr = sqrt( localError.yy() );
832 
833  matchedChamber.dXdZ = chamber->tState.localDirection().z()!=0?chamber->tState.localDirection().x()/chamber->tState.localDirection().z():9999;
834  matchedChamber.dYdZ = chamber->tState.localDirection().z()!=0?chamber->tState.localDirection().y()/chamber->tState.localDirection().z():9999;
835  // DANGEROUS - compiler cannot guaranty parameters ordering
836  AlgebraicSymMatrix55 trajectoryCovMatrix = chamber->tState.localError().matrix();
837  matchedChamber.dXdZErr = trajectoryCovMatrix(1,1)>0?sqrt(trajectoryCovMatrix(1,1)):0;
838  matchedChamber.dYdZErr = trajectoryCovMatrix(2,2)>0?sqrt(trajectoryCovMatrix(2,2)):0;
839 
840  matchedChamber.edgeX = chamber->localDistanceX;
841  matchedChamber.edgeY = chamber->localDistanceY;
842 
843  matchedChamber.id = chamber->id;
844  if ( ! chamber->segments.empty() ) ++nubmerOfMatchesAccordingToTrackAssociator;
845 
846  // fill segments
847  for( std::vector<TAMuonSegmentMatch>::const_iterator segment = chamber->segments.begin();
848  segment != chamber->segments.end(); segment++ )
849  {
850  reco::MuonSegmentMatch matchedSegment;
851  matchedSegment.x = segment->segmentLocalPosition.x();
852  matchedSegment.y = segment->segmentLocalPosition.y();
853  matchedSegment.dXdZ = segment->segmentLocalDirection.z()?segment->segmentLocalDirection.x()/segment->segmentLocalDirection.z():0;
854  matchedSegment.dYdZ = segment->segmentLocalDirection.z()?segment->segmentLocalDirection.y()/segment->segmentLocalDirection.z():0;
855  matchedSegment.xErr = segment->segmentLocalErrorXX>0?sqrt(segment->segmentLocalErrorXX):0;
856  matchedSegment.yErr = segment->segmentLocalErrorYY>0?sqrt(segment->segmentLocalErrorYY):0;
857  matchedSegment.dXdZErr = segment->segmentLocalErrorDxDz>0?sqrt(segment->segmentLocalErrorDxDz):0;
858  matchedSegment.dYdZErr = segment->segmentLocalErrorDyDz>0?sqrt(segment->segmentLocalErrorDyDz):0;
859  matchedSegment.t0 = segment->t0;
860  matchedSegment.mask = 0;
861  matchedSegment.dtSegmentRef = segment->dtSegmentRef;
862  matchedSegment.cscSegmentRef = segment->cscSegmentRef;
863  matchedSegment.hasZed_ = segment->hasZed;
864  matchedSegment.hasPhi_ = segment->hasPhi;
865  // test segment
866  bool matchedX = false;
867  bool matchedY = false;
868  LogTrace("MuonIdentification") << " matching local x, segment x: " << matchedSegment.x <<
869  ", chamber x: " << matchedChamber.x << ", max: " << maxAbsDx_;
870  LogTrace("MuonIdentification") << " matching local y, segment y: " << matchedSegment.y <<
871  ", chamber y: " << matchedChamber.y << ", max: " << maxAbsDy_;
872  if (matchedSegment.xErr>0 && matchedChamber.xErr>0 )
873  LogTrace("MuonIdentification") << " xpull: " <<
874  fabs(matchedSegment.x - matchedChamber.x)/sqrt(pow(matchedSegment.xErr,2) + pow(matchedChamber.xErr,2));
875  if (matchedSegment.yErr>0 && matchedChamber.yErr>0 )
876  LogTrace("MuonIdentification") << " ypull: " <<
877  fabs(matchedSegment.y - matchedChamber.y)/sqrt(pow(matchedSegment.yErr,2) + pow(matchedChamber.yErr,2));
878 
879  if (fabs(matchedSegment.x - matchedChamber.x) < maxAbsDx_) matchedX = true;
880  if (fabs(matchedSegment.y - matchedChamber.y) < maxAbsDy_) matchedY = true;
881  if (matchedSegment.xErr>0 && matchedChamber.xErr>0 &&
882  fabs(matchedSegment.x - matchedChamber.x)/sqrt(pow(matchedSegment.xErr,2) + pow(matchedChamber.xErr,2)) < maxAbsPullX_) matchedX = true;
883  if (matchedSegment.yErr>0 && matchedChamber.yErr>0 &&
884  fabs(matchedSegment.y - matchedChamber.y)/sqrt(pow(matchedSegment.yErr,2) + pow(matchedChamber.yErr,2)) < maxAbsPullY_) matchedY = true;
885  if (matchedX && matchedY) matchedChamber.segmentMatches.push_back(matchedSegment);
886  }
887  muonChamberMatches.push_back(matchedChamber);
888  }
889  aMuon.setMatches(muonChamberMatches);
890 
891  LogTrace("MuonIdentification") << "number of muon chambers: " << aMuon.matches().size() << "\n"
892  << "number of chambers with segments according to the associator requirements: " <<
893  nubmerOfMatchesAccordingToTrackAssociator;
894  LogTrace("MuonIdentification") << "number of segment matches with the producer requirements: " <<
896 
897  // fillTime( iEvent, iSetup, aMuon );
898 }
float xx() const
Definition: LocalError.h:24
DTRecSegment4DRef dtSegmentRef
TrackDetectorAssociator trackAssociator_
CSCSegmentRef cscSegmentRef
bool isTrackerMuon() const
Definition: Muon.h:212
std::vector< const EcalRecHit * > ecalRecHits
hits in the cone
std::vector< DetId > crossedEcalIds
DetId findMaxDeposition(EnergyType)
Find detector elements with highest energy deposition.
virtual TrackRef track() const
reference to a Track
Definition: Muon.h:50
float emS9
energy deposited in 3x3 ECAL crystal shape around central crystal
Definition: MuonEnergy.h:18
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
void setCalEnergy(const MuonEnergy &calEnergy)
set energy deposition information
Definition: Muon.h:114
std::vector< DetId > crossedHcalIds
double nXnEnergy(const DetId &, EnergyType, int gridSize=1)
get energy of the NxN shape (N = 2*gridSize + 1) around given detector element
float towerS9
total energy in 3x3 tower shape
Definition: MuonEnergy.h:12
math::XYZPoint trkGlobPosAtHcal
float ecal_time
Calorimeter timing.
Definition: MuonEnergy.h:37
float ho
energy deposited in crossed HO towers
Definition: MuonEnergy.h:32
DetId hcal_id
DetId of the central HCAL tower with smallest depth.
Definition: MuonEnergy.h:50
bool isNull() const
Checks for null.
Definition: Ref.h:247
TrackAssociatorParameters parameters_
float yy() const
Definition: LocalError.h:26
float emS25
energy deposited in 5x5 ECAL crystal shape around central crystal
Definition: MuonEnergy.h:20
T sqrt(T t)
Definition: SSEVec.h:46
std::vector< TAMuonChamberMatch > chambers
std::vector< const HBHERecHit * > hcalRecHits
float hoS9
energy deposited in 3x3 HO tower shape around central tower
Definition: MuonEnergy.h:34
double crossedEnergy(EnergyType)
energy in detector elements crossed by the track by types
#define LogTrace(id)
math::XYZPointF hcal_position
Definition: MuonEnergy.h:44
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
Definition: Muon.cc:56
float emMax
maximal energy of ECAL crystal in the 5x5 shape
Definition: MuonEnergy.h:22
Definition: DetId.h:20
float hadMax
maximal energy of HCAL tower in the 3x3 shape
Definition: MuonEnergy.h:30
std::vector< MuonChamberMatch > & matches()
get muon matching information
Definition: Muon.h:141
std::vector< reco::MuonSegmentMatch > segmentMatches
DetId ecal_id
DetId of the central ECAL crystal.
Definition: MuonEnergy.h:47
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
math::XYZPoint trkGlobPosAtEcal
Track position at different parts of the calorimeter.
void setMatches(const std::vector< MuonChamberMatch > &matches)
set muon matching information
Definition: Muon.h:144
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
math::XYZPointF ecal_position
Trajectory position at the calorimeter.
Definition: MuonEnergy.h:43
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
float hadS9
energy deposited in 3x3 HCAL tower shape around central tower
Definition: MuonEnergy.h:28
virtual TrackRef standAloneMuon() const
reference to a stand-alone muon Track
Definition: Muon.h:53
void MuonIdProducer::fillMuonIsolation ( edm::Event iEvent,
const edm::EventSetup iSetup,
reco::Muon aMuon,
reco::IsoDeposit trackDep,
reco::IsoDeposit ecalDep,
reco::IsoDeposit hcalDep,
reco::IsoDeposit hoDep,
reco::IsoDeposit jetDep 
)
private

Definition at line 1065 of file MuonIdProducer.cc.

References reco::IsoDeposit::candEnergy(), reco::isodeposit::IsoDepositExtractor::deposit(), reco::IsoDeposit::depositAndCountWithin(), reco::isodeposit::IsoDepositExtractor::deposits(), reco::IsoDeposit::depositWithin(), reco::MuonIsolation::emEt, reco::MuonIsolation::emVetoEt, edm::hlt::Exception, edm::Ref< C, T, F >::get(), reco::MuonIsolation::hadEt, reco::MuonIsolation::hadVetoEt, reco::MuonIsolation::hoEt, reco::MuonIsolation::hoVetoEt, edm::Ref< C, T, F >::isNull(), LogTrace, muIsoExtractorCalo_, muIsoExtractorJet_, muIsoExtractorTrack_, reco::MuonIsolation::nJets, reco::MuonIsolation::nTracks, reco::Muon::setIsolation(), reco::Muon::standAloneMuon(), reco::MuonIsolation::sumPt, reco::Muon::track(), and reco::MuonIsolation::trackerVetoPt.

Referenced by produce().

1068 {
1069  reco::MuonIsolation isoR03, isoR05;
1070  const reco::Track* track = 0;
1071  if ( ! aMuon.track().isNull() )
1072  track = aMuon.track().get();
1073  else
1074  {
1075  if ( ! aMuon.standAloneMuon().isNull() )
1076  track = aMuon.standAloneMuon().get();
1077  else
1078  throw cms::Exception("FatalError") << "Failed to compute muon isolation information for a muon with undefined references to tracks";
1079  }
1080 
1081  // get deposits
1082  reco::IsoDeposit depTrk = muIsoExtractorTrack_->deposit(iEvent, iSetup, *track );
1083  std::vector<reco::IsoDeposit> caloDeps = muIsoExtractorCalo_->deposits(iEvent, iSetup, *track);
1084  reco::IsoDeposit depJet = muIsoExtractorJet_->deposit(iEvent, iSetup, *track );
1085 
1086  if(caloDeps.size()!=3) {
1087  LogTrace("MuonIdentification") << "Failed to fill vector of calorimeter isolation deposits!";
1088  return;
1089  }
1090 
1091  reco::IsoDeposit depEcal = caloDeps.at(0);
1092  reco::IsoDeposit depHcal = caloDeps.at(1);
1093  reco::IsoDeposit depHo = caloDeps.at(2);
1094 
1095  trackDep = depTrk;
1096  ecalDep = depEcal;
1097  hcalDep = depHcal;
1098  hoDep = depHo;
1099  jetDep = depJet;
1100 
1101  isoR03.sumPt = depTrk.depositWithin(0.3);
1102  isoR03.emEt = depEcal.depositWithin(0.3);
1103  isoR03.hadEt = depHcal.depositWithin(0.3);
1104  isoR03.hoEt = depHo.depositWithin(0.3);
1105  isoR03.nTracks = depTrk.depositAndCountWithin(0.3).second;
1106  isoR03.nJets = depJet.depositAndCountWithin(0.3).second;
1107  isoR03.trackerVetoPt = depTrk.candEnergy();
1108  isoR03.emVetoEt = depEcal.candEnergy();
1109  isoR03.hadVetoEt = depHcal.candEnergy();
1110  isoR03.hoVetoEt = depHo.candEnergy();
1111 
1112  isoR05.sumPt = depTrk.depositWithin(0.5);
1113  isoR05.emEt = depEcal.depositWithin(0.5);
1114  isoR05.hadEt = depHcal.depositWithin(0.5);
1115  isoR05.hoEt = depHo.depositWithin(0.5);
1116  isoR05.nTracks = depTrk.depositAndCountWithin(0.5).second;
1117  isoR05.nJets = depJet.depositAndCountWithin(0.5).second;
1118  isoR05.trackerVetoPt = depTrk.candEnergy();
1119  isoR05.emVetoEt = depEcal.candEnergy();
1120  isoR05.hadVetoEt = depHcal.candEnergy();
1121  isoR05.hoVetoEt = depHo.candEnergy();
1122 
1123 
1124  aMuon.setIsolation(isoR03, isoR05);
1125 
1126 }
float hadEt
hcal sum-Et
Definition: MuonIsolation.h:9
double candEnergy() const
Get energy or pT attached to cand trajectory.
Definition: IsoDeposit.h:131
float sumPt
sum-pt of tracks
Definition: MuonIsolation.h:7
reco::isodeposit::IsoDepositExtractor * muIsoExtractorCalo_
float hadVetoEt
hcal sum-et in the veto region in r-phi
Definition: MuonIsolation.h:15
virtual TrackRef track() const
reference to a Track
Definition: Muon.h:50
void setIsolation(const MuonIsolation &isoR03, const MuonIsolation &isoR05)
Definition: Muon.cc:728
double depositWithin(double coneSize, const Vetos &vetos=Vetos(), bool skipDepositVeto=false) const
Get deposit.
Definition: IsoDeposit.cc:34
bool isNull() const
Checks for null.
Definition: Ref.h:247
float emEt
ecal sum-Et
Definition: MuonIsolation.h:8
int nJets
number of jets in the cone
Definition: MuonIsolation.h:12
float hoEt
ho sum-Et
Definition: MuonIsolation.h:10
#define LogTrace(id)
float hoVetoEt
ho sum-et in the veto region in r-phi
Definition: MuonIsolation.h:16
int nTracks
number of tracks in the cone (excluding veto region)
Definition: MuonIsolation.h:11
reco::isodeposit::IsoDepositExtractor * muIsoExtractorTrack_
float emVetoEt
ecal sum-et in the veto region in r-phi
Definition: MuonIsolation.h:14
reco::isodeposit::IsoDepositExtractor * muIsoExtractorJet_
virtual std::vector< reco::IsoDeposit > deposits(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const
std::pair< double, int > depositAndCountWithin(double coneSize, const Vetos &vetos=Vetos(), double threshold=-1e+36, bool skipDepositVeto=false) const
Get deposit.
Definition: IsoDeposit.cc:44
virtual reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const =0
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
float trackerVetoPt
(sum-)pt inside the veto region in r-phi
Definition: MuonIsolation.h:13
virtual TrackRef standAloneMuon() const
reference to a stand-alone muon Track
Definition: Muon.h:53
void MuonIdProducer::fillTrackerKink ( reco::Muon aMuon)
private

Definition at line 1184 of file MuonIdProducer.cc.

References reco::Muon::combinedQuality(), reco::Muon::innerTrack(), edm::Ref< C, T, F >::isNull(), reco::Muon::isQualityValid(), reco::Muon::setCombinedQuality(), and trackerKinkFinder_.

Referenced by produce().

1184  {
1185  // skip muons with no tracks
1186  if (aMuon.innerTrack().isNull()) return;
1187  // get quality from muon if already there, otherwise make empty one
1188  reco::MuonQuality quality = (aMuon.isQualityValid() ? aMuon.combinedQuality() : reco::MuonQuality());
1189  // fill it
1190  bool filled = trackerKinkFinder_->fillTrkKink(quality, *aMuon.innerTrack());
1191  // if quality was there, or if we filled it, commit to the muon
1192  if (filled || aMuon.isQualityValid()) aMuon.setCombinedQuality(quality);
1193 }
virtual TrackRef innerTrack() const
Definition: Muon.h:49
std::auto_ptr< MuonKinkFinder > trackerKinkFinder_
bool isNull() const
Checks for null.
Definition: Ref.h:247
MuonQuality combinedQuality() const
get energy deposition information
Definition: Muon.h:122
bool isQualityValid() const
Definition: Muon.h:120
void setCombinedQuality(const MuonQuality &combinedQuality)
set energy deposition information
Definition: Muon.h:124
void MuonIdProducer::init ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 171 of file MuonIdProducer.cc.

References edm::HandleBase::clear(), dytCollectionHandle_, edm::hlt::Exception, fillGlobalTrackRefits_, fillTrackerKink_, edm::EventSetup::get(), edm::Event::getByLabel(), i, innerTrackCollectionHandle_, inputCollectionLabels_, inputCollectionTypes_, edm::HandleBase::isValid(), linkCollectionHandle_, LogTrace, muonCollectionHandle_, outerTrackCollectionHandle_, pickyCollectionHandle_, edm::ESHandle< class >::product(), LargeD0_PixelPairStep_cff::propagator, TrackDetectorAssociator::setPropagator(), tpfmsCollectionHandle_, trackAssociator_, and trackerKinkFinder_.

Referenced by produce().

172 {
173  // TimerStack timers;
174  // timers.push("MuonIdProducer::produce::init");
175 
180 
184 
185 
186  // timers.push("MuonIdProducer::produce::init::getPropagator");
188  iSetup.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorAny", propagator);
189  trackAssociator_.setPropagator(propagator.product());
190 
191  if (fillTrackerKink_) trackerKinkFinder_->init(iSetup);
192 
193  // timers.pop_and_push("MuonIdProducer::produce::init::getInputCollections");
194  for ( unsigned int i = 0; i < inputCollectionLabels_.size(); ++i ) {
195  if ( inputCollectionTypes_[i] == "inner tracks" ) {
198  throw cms::Exception("FatalError") << "Failed to get input track collection with label: " << inputCollectionLabels_[i];
199  LogTrace("MuonIdentification") << "Number of input inner tracks: " << innerTrackCollectionHandle_->size();
200  continue;
201  }
202  if ( inputCollectionTypes_[i] == "outer tracks" ) {
205  throw cms::Exception("FatalError") << "Failed to get input track collection with label: " << inputCollectionLabels_[i];
206  LogTrace("MuonIdentification") << "Number of input outer tracks: " << outerTrackCollectionHandle_->size();
207  continue;
208  }
209  if ( inputCollectionTypes_[i] == "links" ) {
212  throw cms::Exception("FatalError") << "Failed to get input link collection with label: " << inputCollectionLabels_[i];
213  LogTrace("MuonIdentification") << "Number of input links: " << linkCollectionHandle_->size();
214  continue;
215  }
216  if ( inputCollectionTypes_[i] == "muons" ) {
219  throw cms::Exception("FatalError") << "Failed to get input muon collection with label: " << inputCollectionLabels_[i];
220  LogTrace("MuonIdentification") << "Number of input muons: " << muonCollectionHandle_->size();
221  continue;
222  }
223  if ( fillGlobalTrackRefits_ && inputCollectionTypes_[i] == "tev firstHit" ) {
226  throw cms::Exception("FatalError") << "Failed to get input muon collection with label: " << inputCollectionLabels_[i];
227  LogTrace("MuonIdentification") << "Number of input muons: " << tpfmsCollectionHandle_->size();
228  continue;
229  }
230 
231  if ( fillGlobalTrackRefits_ && inputCollectionTypes_[i] == "tev picky" ) {
234  throw cms::Exception("FatalError") << "Failed to get input muon collection with label: " << inputCollectionLabels_[i];
235  LogTrace("MuonIdentification") << "Number of input muons: " << pickyCollectionHandle_->size();
236  continue;
237  }
238 
239  if ( fillGlobalTrackRefits_ && inputCollectionTypes_[i] == "tev dyt" ) {
241  if (! dytCollectionHandle_.isValid())
242  throw cms::Exception("FatalError") << "Failed to get input muon collection with label: " << inputCollectionLabels_[i];
243  LogTrace("MuonIdentification") << "Number of input muons: " << dytCollectionHandle_->size();
244  continue;
245  }
246  throw cms::Exception("FatalError") << "Unknown input collection type: " << inputCollectionTypes_[i];
247  }
248 }
int i
Definition: DBlmapReader.cc:9
TrackDetectorAssociator trackAssociator_
edm::Handle< reco::MuonTrackLinksCollection > linkCollectionHandle_
std::vector< std::string > inputCollectionTypes_
std::auto_ptr< MuonKinkFinder > trackerKinkFinder_
void setPropagator(const Propagator *)
use a user configured propagator
edm::Handle< reco::TrackToTrackMap > dytCollectionHandle_
bool isValid() const
Definition: HandleBase.h:76
edm::Handle< reco::TrackCollection > outerTrackCollectionHandle_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
#define LogTrace(id)
bool fillGlobalTrackRefits_
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
std::vector< edm::InputTag > inputCollectionLabels_
edm::Handle< reco::TrackToTrackMap > tpfmsCollectionHandle_
edm::Handle< reco::TrackCollection > innerTrackCollectionHandle_
edm::Handle< reco::MuonCollection > muonCollectionHandle_
edm::Handle< reco::TrackToTrackMap > pickyCollectionHandle_
bool MuonIdProducer::isGoodTrack ( const reco::Track track)
private

Definition at line 332 of file MuonIdProducer.cc.

References reco::TrackBase::eta(), LogTrace, maxAbsEta_, minP_, minPCaloMuon_, minPt_, reco::TrackBase::p(), and reco::TrackBase::pt().

Referenced by produce().

333 {
334  // Pt and absolute momentum requirement
335  if (track.pt() < minPt_ || (track.p() < minP_ && track.p() < minPCaloMuon_)){
336  LogTrace("MuonIdentification") << "Skipped low momentum track (Pt,P): " << track.pt() <<
337  ", " << track.p() << " GeV";
338  return false;
339  }
340 
341  // Eta requirement
342  if ( fabs(track.eta()) > maxAbsEta_ ){
343  LogTrace("MuonIdentification") << "Skipped track with large pseudo rapidity (Eta: " << track.eta() << " )";
344  return false;
345  }
346  return true;
347 }
double p() const
momentum vector magnitude
Definition: TrackBase.h:129
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:141
double pt() const
track transverse momentum
Definition: TrackBase.h:131
#define LogTrace(id)
bool MuonIdProducer::isGoodTrackerMuon ( const reco::Muon muon)
private

Definition at line 758 of file MuonIdProducer.cc.

References addExtraSoftMuons_, reco::LeafCandidate::eta(), minNumberOfMatches_, minP_, minPt_, reco::Muon::NoArbitration, reco::Muon::numberOfMatches(), reco::LeafCandidate::pt(), and reco::Muon::track().

Referenced by produce().

759 {
760  if(muon.track()->pt() < minPt_ || muon.track()->p() < minP_) return false;
761  if ( addExtraSoftMuons_ &&
762  muon.pt()<5 && fabs(muon.eta())<1.5 &&
763  muon.numberOfMatches( reco::Muon::NoArbitration ) >= 1 ) return true;
765 }
virtual TrackRef track() const
reference to a Track
Definition: Muon.h:50
virtual double eta() const
momentum pseudorapidity
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
Definition: Muon.cc:56
virtual double pt() const
transverse momentum
reco::CaloMuon MuonIdProducer::makeCaloMuon ( const reco::Muon muon)
private

Definition at line 263 of file MuonIdProducer.cc.

References reco::Muon::calEnergy(), MuonCaloCompatibility::evaluate(), fillCaloCompatibility_, reco::Muon::innerTrack(), reco::Muon::isEnergyValid(), muonCaloCompatibility_, reco::CaloMuon::setCalEnergy(), reco::CaloMuon::setCaloCompatibility(), and reco::CaloMuon::setInnerTrack().

Referenced by produce().

264 {
265  reco::CaloMuon aMuon;
266  aMuon.setInnerTrack( muon.innerTrack() );
267 
268  if (muon.isEnergyValid()) aMuon.setCalEnergy( muon.calEnergy() );
269  // get calo compatibility
271  return aMuon;
272 }
virtual TrackRef innerTrack() const
Definition: Muon.h:49
bool fillCaloCompatibility_
double evaluate(const reco::Muon &)
MuonCaloCompatibility muonCaloCompatibility_
bool isEnergyValid() const
Definition: Muon.h:110
MuonEnergy calEnergy() const
get energy deposition information
Definition: Muon.h:112
void setCaloCompatibility(float input)
Definition: CaloMuon.h:44
virtual void setInnerTrack(const TrackRef &t)
set reference to Track
Definition: CaloMuon.h:31
void setCalEnergy(const MuonEnergy &calEnergy)
set energy deposition information
Definition: CaloMuon.h:38
reco::Muon MuonIdProducer::makeMuon ( edm::Event iEvent,
const edm::EventSetup iSetup,
const reco::TrackRef track,
MuonIdProducer::TrackType  type 
)
private

Definition at line 250 of file MuonIdProducer.cc.

References edm::Ref< C, T, F >::get(), LogTrace, and reco::Muon::setMuonTrack().

Referenced by makeMuon(), and produce().

252 {
253  LogTrace("MuonIdentification") << "Creating a muon from a track " << track.get()->pt() <<
254  " Pt (GeV), eta: " << track.get()->eta();
255  reco::Muon aMuon( makeMuon( *(track.get()) ) );
256 
257  aMuon.setMuonTrack(type,track);
258  aMuon.setBestTrack(type);
259  return aMuon;
260 }
type
Definition: HCALResponse.h:22
reco::Muon makeMuon(edm::Event &iEvent, const edm::EventSetup &iSetup, const reco::TrackRef &track, TrackType type)
void setMuonTrack(const MuonTrackType &, const TrackRef &)
Definition: Muon.cc:776
#define LogTrace(id)
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
reco::Muon MuonIdProducer::makeMuon ( const reco::MuonTrackLinks links)
private

Definition at line 275 of file MuonIdProducer.cc.

References reco::Muon::DYT, dytCollectionHandle_, edm::HandleBase::failedToGet(), fillGlobalTrackRefits_, muon::getTevRefitTrack(), reco::MuonTrackLinks::globalTrack(), edm::Ref< C, T, F >::isNull(), edm::HandleBase::isValid(), LogTrace, makeMuon(), reco::Muon::Picky, pickyCollectionHandle_, ptThresholdToFillCandidateP4WithGlobalFit_, reco::Muon::setBestTrack(), reco::Muon::setGlobalTrack(), reco::Muon::setInnerTrack(), reco::Muon::setMuonTrack(), reco::Muon::setOuterTrack(), muon::sigmaSwitch(), sigmaThresholdToFillCandidateP4WithGlobalFit_, reco::MuonTrackLinks::standAloneTrack(), muon::tevOptimized(), reco::Muon::TPFMS, tpfmsCollectionHandle_, reco::MuonTrackLinks::trackerTrack(), and edm::helpers::KeyVal< K, V >::val.

276 {
277  LogTrace("MuonIdentification") << "Creating a muon from a link to tracks object";
278 
279  reco::Muon aMuon;
280  reco::Muon::MuonTrackTypePair chosenTrack;
281  reco::TrackRef tpfmsRef;
282  reco::TrackRef pickyRef;
283  bool useSigmaSwitch = false;
284 
287 
290 
291  if (tpfmsRef.isNull() && pickyRef.isNull()){
292  edm::LogWarning("MakeMuonWithTEV")<<"Failed to get TEV refits, fall back to sigma switch.";
293  useSigmaSwitch = true;
294  }
295  } else {
296  useSigmaSwitch = true;
297  }
298 
299  if (useSigmaSwitch){
300  chosenTrack = muon::sigmaSwitch( links.globalTrack(), links.trackerTrack(),
303  } else {
304  chosenTrack = muon::tevOptimized( links.globalTrack(), links.trackerTrack(),
305  tpfmsRef, pickyRef,
307  }
308  aMuon = makeMuon(*chosenTrack.first);
309  aMuon.setInnerTrack( links.trackerTrack() );
310  aMuon.setOuterTrack( links.standAloneTrack() );
311  aMuon.setGlobalTrack( links.globalTrack() );
312  aMuon.setBestTrack(chosenTrack.second);
313 
317  if (it != tpfmsCollectionHandle_->end()) aMuon.setMuonTrack(reco::Muon::TPFMS, (it->val));
318  }
321  if (it != pickyCollectionHandle_->end()) aMuon.setMuonTrack(reco::Muon::Picky, (it->val));
322  }
325  if (it != dytCollectionHandle_->end()) aMuon.setMuonTrack(reco::Muon::DYT, (it->val));
326  }
327  }
328  return aMuon;
329 }
reco::Muon makeMuon(edm::Event &iEvent, const edm::EventSetup &iSetup, const reco::TrackRef &track, TrackType type)
virtual void setOuterTrack(const TrackRef &t)
set reference to Track
Definition: Muon.cc:752
virtual void setInnerTrack(const TrackRef &t)
set reference to Track
Definition: Muon.cc:753
bool isNull() const
Checks for null.
Definition: Ref.h:247
double ptThresholdToFillCandidateP4WithGlobalFit_
reco::Muon::MuonTrackTypePair sigmaSwitch(const reco::TrackRef &combinedTrack, const reco::TrackRef &trackerTrack, const double nSigma=2., const double ptThreshold=200.)
edm::Handle< reco::TrackToTrackMap > dytCollectionHandle_
bool isValid() const
Definition: HandleBase.h:76
void setMuonTrack(const MuonTrackType &, const TrackRef &)
Definition: Muon.cc:776
#define LogTrace(id)
bool fillGlobalTrackRefits_
bool failedToGet() const
Definition: HandleBase.h:80
reco::TrackRef getTevRefitTrack(const reco::TrackRef &combinedTrack, const reco::TrackToTrackMap &map)
virtual void setBestTrack(MuonTrackType muonType)
Definition: Muon.h:94
edm::Handle< reco::TrackToTrackMap > tpfmsCollectionHandle_
reco::Muon::MuonTrackTypePair tevOptimized(const reco::TrackRef &combinedTrack, const reco::TrackRef &trackerTrack, const reco::TrackRef &tpfmsTrack, const reco::TrackRef &pickyTrack, const double ptThreshold=200., const double tune1=4., const double tune2=6., const double dptcut=-1.)
Definition: MuonCocktails.cc:9
double sigmaThresholdToFillCandidateP4WithGlobalFit_
std::pair< TrackRef, Muon::MuonTrackType > MuonTrackTypePair
Definition: Muon.h:41
virtual void setGlobalTrack(const TrackRef &t)
set reference to Track
Definition: Muon.cc:756
edm::Handle< reco::TrackToTrackMap > pickyCollectionHandle_
reco::Muon MuonIdProducer::makeMuon ( const reco::Track track)
private

Definition at line 1128 of file MuonIdProducer.cc.

References reco::TrackBase::charge(), relval_parameters_module::energy, reco::TrackBase::p(), p4, reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), mathSSE::sqrt(), and reco::TrackBase::vertex().

1129 {
1130  //FIXME: E = sqrt(p^2 + m^2), where m == 0.105658369(9)GeV
1131  double energy = sqrt(track.p() * track.p() + 0.011163691);
1132  math::XYZTLorentzVector p4(track.px(),
1133  track.py(),
1134  track.pz(),
1135  energy);
1136  return reco::Muon( track.charge(), p4, track.vertex() );
1137 }
double p() const
momentum vector magnitude
Definition: TrackBase.h:129
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:133
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
T sqrt(T t)
Definition: SSEVec.h:46
double p4[4]
Definition: TauolaWrapper.h:92
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:137
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
Definition: TrackBase.h:156
int charge() const
track electric charge
Definition: TrackBase.h:113
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:135
int MuonIdProducer::overlap ( const reco::Muon muon,
const reco::Track track 
)
private

Definition at line 376 of file MuonIdProducer.cc.

References chamberId(), reco::Track::extra(), reco::Muon::isMatchesValid(), edm::Ref< C, T, F >::isNull(), match(), and reco::Muon::matches().

Referenced by produce().

377 {
378  int numberOfCommonDetIds = 0;
379  if ( ! muon.isMatchesValid() ||
380  track.extra().isNull() ||
381  track.extra()->recHits().isNull() ) return numberOfCommonDetIds;
382  const std::vector<reco::MuonChamberMatch>& matches( muon.matches() );
383  for ( std::vector<reco::MuonChamberMatch>::const_iterator match = matches.begin();
384  match != matches.end(); ++match )
385  {
386  if ( match->segmentMatches.empty() ) continue;
387  bool foundCommonDetId = false;
388 
389  for ( TrackingRecHitRefVector::const_iterator hit = track.extra()->recHitsBegin();
390  hit != track.extra()->recHitsEnd(); ++hit )
391  {
392  // LogTrace("MuonIdentification") << "hit DetId: " << std::hex << hit->get()->geographicalId().rawId() <<
393  // "\t hit chamber DetId: " << getChamberId(hit->get()->geographicalId()) <<
394  // "\t segment DetId: " << match->id.rawId() << std::dec;
395 
396  if ( chamberId(hit->get()->geographicalId()) == match->id.rawId() ) {
397  foundCommonDetId = true;
398  break;
399  }
400  }
401  if ( foundCommonDetId ) {
402  numberOfCommonDetIds++;
403  break;
404  }
405  }
406  return numberOfCommonDetIds;
407 }
const TrackExtraRef & extra() const
reference to &quot;extra&quot; object
Definition: Track.h:97
bool isMatchesValid() const
Definition: Muon.h:139
bool isNull() const
Checks for null.
Definition: Ref.h:247
std::vector< MuonChamberMatch > & matches()
get muon matching information
Definition: Muon.h:141
unsigned int chamberId(const DetId &)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
double MuonIdProducer::phiOfMuonIneteractionRegion ( const reco::Muon muon) const
private

Definition at line 1157 of file MuonIdProducer.cc.

References reco::Muon::innerTrack(), edm::Ref< C, T, F >::isAvailable(), reco::Muon::isStandAloneMuon(), reco::Muon::matches(), reco::LeafCandidate::phi(), sectorPhi(), and reco::Muon::standAloneMuon().

Referenced by produce().

1158 {
1159  if ( muon.isStandAloneMuon() ) return muon.standAloneMuon()->innerPosition().phi();
1160  // the rest is tracker muon only
1161  if ( muon.matches().empty() ){
1162  if ( muon.innerTrack().isAvailable() &&
1163  muon.innerTrack()->extra().isAvailable() )
1164  return muon.innerTrack()->outerPosition().phi();
1165  else
1166  return muon.phi(); // makes little sense, but what else can I use
1167  }
1168  return sectorPhi(muon.matches().at(0).id);
1169 }
virtual TrackRef innerTrack() const
Definition: Muon.h:49
bool isAvailable() const
Definition: Ref.h:276
bool isStandAloneMuon() const
Definition: Muon.h:213
static double sectorPhi(const DetId &id)
std::vector< MuonChamberMatch > & matches()
get muon matching information
Definition: Muon.h:141
virtual double phi() const
momentum azimuthal angle
virtual TrackRef standAloneMuon() const
reference to a stand-alone muon Track
Definition: Muon.h:53
void MuonIdProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 434 of file MuonIdProducer.cc.

References TrackDetectorAssociator::Any, reco::Muon::calEnergy(), reco::CaloMuon::caloCompatibility(), caloCut_, checkLinks(), funct::cos(), TrackDetectorAssociator::crossedIP(), debugWithTruthMatching_, ecalDepositName_, MuonCaloCompatibility::evaluate(), reco::Track::extra(), edm::helper::Filler< Map >::fill(), fillArbitrationInfo(), fillCaloCompatibility_, fillEnergy_, fillGlbQuality(), fillGlobalTrackQuality_, fillIsolation_, fillMatching_, fillMuonId(), fillMuonIsolation(), MuonTimingFiller::fillTiming(), fillTrackerKink(), fillTrackerKink_, edm::Ref< C, T, F >::get(), reco::Muon::GlobalMuon, reco::MuonTrackLinks::globalTrack(), hcalDepositName_, hoDepositName_, i, init(), reco::Muon::InnerTrack, reco::Muon::innerTrack(), innerTrackCollectionHandle_, edm::helper::Filler< Map >::insert(), TrackDetectorAssociator::InsideOut, edm::Ref< C, T, F >::isAvailable(), reco::CaloMuon::isCaloCompatibilityValid(), reco::Muon::isEnergyValid(), isGoodTrack(), isGoodTrackerMuon(), reco::Muon::isTimeValid(), edm::HandleBase::isValid(), j, jetDepositName_, linkCollectionHandle_, LogDebug, LogTrace, makeCaloMuon(), makeMuon(), reco::Muon::matches(), minPCaloMuon_, metsig::muon, muonCaloCompatibility_, muonCollectionHandle_, reco::MuonTime::nDof, reco::MuonTimeExtra::nDof(), reco::Muon::OuterTrack, outerTrackCollectionHandle_, TrackDetectorAssociator::OutsideIn, overlap(), reco::CaloMuon::p(), phiOfMuonIneteractionRegion(), edm::Event::put(), reco::Muon::setType(), reco::Muon::StandAloneMuon, reco::MuonTrackLinks::standAloneTrack(), theTimingFiller_, reco::Muon::time(), reco::MuonTime::timeAtIpInOut, reco::MuonTimeExtra::timeAtIpInOut(), reco::MuonTime::timeAtIpInOutErr, reco::MuonTimeExtra::timeAtIpInOutErr(), reco::MuonTime::timeAtIpOutIn, reco::MuonTimeExtra::timeAtIpOutIn(), reco::MuonTime::timeAtIpOutInErr, reco::MuonTimeExtra::timeAtIpOutInErr(), trackDepositName_, susybsm::HSCParticleType::trackerMuon, reco::Muon::TrackerMuon, reco::MuonTrackLinks::trackerTrack(), MuonIdTruthInfo::truthMatchMuon(), validateGlobalMuonPair(), and writeIsoDeposits_.

435 {
436  // TimerStack timers;
437  // timers.push("MuonIdProducer::produce");
438 
439  std::auto_ptr<reco::MuonCollection> outputMuons(new reco::MuonCollection);
440  std::auto_ptr<reco::CaloMuonCollection> caloMuons( new reco::CaloMuonCollection );
441 
442  init(iEvent, iSetup);
443 
444  std::auto_ptr<reco::MuonTimeExtraMap> muonTimeMap(new reco::MuonTimeExtraMap());
445  reco::MuonTimeExtraMap::Filler filler(*muonTimeMap);
446  std::auto_ptr<reco::MuonTimeExtraMap> muonTimeMapDT(new reco::MuonTimeExtraMap());
447  reco::MuonTimeExtraMap::Filler fillerDT(*muonTimeMapDT);
448  std::auto_ptr<reco::MuonTimeExtraMap> muonTimeMapCSC(new reco::MuonTimeExtraMap());
449  reco::MuonTimeExtraMap::Filler fillerCSC(*muonTimeMapCSC);
450 
451  std::auto_ptr<reco::IsoDepositMap> trackDepMap(new reco::IsoDepositMap());
452  reco::IsoDepositMap::Filler trackDepFiller(*trackDepMap);
453  std::auto_ptr<reco::IsoDepositMap> ecalDepMap(new reco::IsoDepositMap());
454  reco::IsoDepositMap::Filler ecalDepFiller(*ecalDepMap);
455  std::auto_ptr<reco::IsoDepositMap> hcalDepMap(new reco::IsoDepositMap());
456  reco::IsoDepositMap::Filler hcalDepFiller(*hcalDepMap);
457  std::auto_ptr<reco::IsoDepositMap> hoDepMap(new reco::IsoDepositMap());
458  reco::IsoDepositMap::Filler hoDepFiller(*hoDepMap);
459  std::auto_ptr<reco::IsoDepositMap> jetDepMap(new reco::IsoDepositMap());
460  reco::IsoDepositMap::Filler jetDepFiller(*jetDepMap);
461 
462  // loop over input collections
463 
464  // muons first - no cleaning, take as is.
466  for ( reco::MuonCollection::const_iterator muon = muonCollectionHandle_->begin();
467  muon != muonCollectionHandle_->end(); ++muon )
468  outputMuons->push_back(*muon);
469 
470  // links second ( assume global muon type )
472  std::vector<bool> goodmuons(linkCollectionHandle_->size(),true);
473  if ( goodmuons.size()>1 ){
474  // check for shared tracker tracks
475  for ( unsigned int i=0; i<linkCollectionHandle_->size()-1; ++i ){
476  if (!checkLinks(&linkCollectionHandle_->at(i))) continue;
477  for ( unsigned int j=i+1; j<linkCollectionHandle_->size(); ++j ){
478  if (!checkLinks(&linkCollectionHandle_->at(j))) continue;
479  if ( linkCollectionHandle_->at(i).trackerTrack().isNonnull() &&
480  linkCollectionHandle_->at(i).trackerTrack() ==
481  linkCollectionHandle_->at(j).trackerTrack() )
482  {
483  // Tracker track is the essential part that dominates muon resolution
484  // so taking either muon is fine. All that is important is to preserve
485  // the muon identification information. If number of hits is small,
486  // keep the one with large number of hits, otherwise take the smalest chi2/ndof
488  goodmuons[j] = false;
489  else
490  goodmuons[i] = false;
491  }
492  }
493  }
494  // check for shared stand-alone muons.
495  for ( unsigned int i=0; i<linkCollectionHandle_->size()-1; ++i ){
496  if ( !goodmuons[i] ) continue;
497  if (!checkLinks(&linkCollectionHandle_->at(i))) continue;
498  for ( unsigned int j=i+1; j<linkCollectionHandle_->size(); ++j ){
499  if ( !goodmuons[j] ) continue;
500  if (!checkLinks(&linkCollectionHandle_->at(j))) continue;
501  if ( linkCollectionHandle_->at(i).standAloneTrack().isNonnull() &&
502  linkCollectionHandle_->at(i).standAloneTrack() ==
503  linkCollectionHandle_->at(j).standAloneTrack() )
504  {
506  goodmuons[j] = false;
507  else
508  goodmuons[i] = false;
509  }
510  }
511  }
512  }
513  for ( unsigned int i=0; i<linkCollectionHandle_->size(); ++i ){
514  if ( !goodmuons[i] ) continue;
515  const reco::MuonTrackLinks* links = &linkCollectionHandle_->at(i);
516  if ( ! checkLinks(links)) continue;
517  // check if this muon is already in the list
518  bool newMuon = true;
519  for ( reco::MuonCollection::const_iterator muon = outputMuons->begin();
520  muon != outputMuons->end(); ++muon )
521  if ( muon->track() == links->trackerTrack() &&
522  muon->standAloneMuon() == links->standAloneTrack() &&
523  muon->combinedMuon() == links->globalTrack() )
524  newMuon = false;
525  if ( newMuon ) {
526  outputMuons->push_back( makeMuon( *links ) );
527  outputMuons->back().setType(reco::Muon::GlobalMuon | reco::Muon::StandAloneMuon);
528  }
529  }
530  }
531 
532  // tracker and calo muons are next
534  LogTrace("MuonIdentification") << "Creating tracker muons";
535  for ( unsigned int i = 0; i < innerTrackCollectionHandle_->size(); ++i )
536  {
537  const reco::Track& track = innerTrackCollectionHandle_->at(i);
538  if ( ! isGoodTrack( track ) ) continue;
539  bool splitTrack = false;
540  if ( track.extra().isAvailable() &&
541  TrackDetectorAssociator::crossedIP( track ) ) splitTrack = true;
542  std::vector<TrackDetectorAssociator::Direction> directions;
543  if ( splitTrack ) {
544  directions.push_back(TrackDetectorAssociator::InsideOut);
545  directions.push_back(TrackDetectorAssociator::OutsideIn);
546  } else {
547  directions.push_back(TrackDetectorAssociator::Any);
548  }
549  for ( std::vector<TrackDetectorAssociator::Direction>::const_iterator direction = directions.begin();
550  direction != directions.end(); ++direction )
551  {
552  // make muon
553  // timers.push("MuonIdProducer::produce::fillMuonId");
556  fillMuonId(iEvent, iSetup, trackerMuon, *direction);
557  // timers.pop();
558 
559  if ( debugWithTruthMatching_ ) {
560  // add MC hits to a list of matched segments.
561  // Since it's debugging mode - code is slow
563  }
564 
565  // check if this muon is already in the list
566  // have to check where muon hits are really located
567  // to match properly
568  bool newMuon = true;
569  bool goodTrackerMuon = isGoodTrackerMuon( trackerMuon );
570  for ( reco::MuonCollection::iterator muon = outputMuons->begin();
571  muon != outputMuons->end(); ++muon )
572  {
573  if ( muon->innerTrack().get() == trackerMuon.innerTrack().get() &&
576  {
577  newMuon = false;
578  muon->setMatches( trackerMuon.matches() );
579  if (trackerMuon.isTimeValid()) muon->setTime( trackerMuon.time() );
580  if (trackerMuon.isEnergyValid()) muon->setCalEnergy( trackerMuon.calEnergy() );
581  if (goodTrackerMuon) muon->setType( muon->type() | reco::Muon::TrackerMuon );
582  LogTrace("MuonIdentification") << "Found a corresponding global muon. Set energy, matches and move on";
583  break;
584  }
585  }
586  if ( newMuon ) {
587  if ( goodTrackerMuon ){
588  outputMuons->push_back( trackerMuon );
589  } else {
590  LogTrace("MuonIdentification") << "track failed minimal number of muon matches requirement";
591  const reco::CaloMuon& caloMuon = makeCaloMuon(trackerMuon);
592  if ( ! caloMuon.isCaloCompatibilityValid() || caloMuon.caloCompatibility() < caloCut_ || caloMuon.p() < minPCaloMuon_) continue;
593  caloMuons->push_back( caloMuon );
594  }
595  }
596  }
597  }
598  }
599 
600  // and at last the stand alone muons
602  LogTrace("MuonIdentification") << "Looking for new muons among stand alone muon tracks";
603  for ( unsigned int i = 0; i < outerTrackCollectionHandle_->size(); ++i )
604  {
605  // check if this muon is already in the list of global muons
606  bool newMuon = true;
607  for ( reco::MuonCollection::iterator muon = outputMuons->begin();
608  muon != outputMuons->end(); ++muon )
609  {
610  if ( ! muon->standAloneMuon().isNull() ) {
611  // global muon
612  if ( muon->standAloneMuon().get() == &(outerTrackCollectionHandle_->at(i)) ) {
613  newMuon = false;
614  break;
615  }
616  } else {
617  // tracker muon - no direct links to the standalone muon
618  // since we have only a few real muons in an event, matching
619  // the stand alone muon to the tracker muon by DetIds should
620  // be good enough for association. At the end it's up to a
621  // user to redefine the association and what it means. Here
622  // we would like to avoid obvious double counting and we
623  // tolerate a potential miss association
624  if ( overlap(*muon,outerTrackCollectionHandle_->at(i))>0 ) {
625  LogTrace("MuonIdentification") << "Found associated tracker muon. Set a reference and move on";
626  newMuon = false;
627  muon->setOuterTrack( reco::TrackRef( outerTrackCollectionHandle_, i ) );
628  muon->setType( muon->type() | reco::Muon::StandAloneMuon );
629  break;
630  }
631  }
632  }
633  if ( newMuon ) {
634  LogTrace("MuonIdentification") << "No associated stand alone track is found. Making a muon";
635  outputMuons->push_back( makeMuon(iEvent, iSetup,
637  outputMuons->back().setType( reco::Muon::StandAloneMuon );
638  }
639  }
640  }
641 
642  LogTrace("MuonIdentification") << "Dress up muons if it's necessary";
643 
644  int nMuons=outputMuons->size();
645 
646  std::vector<reco::MuonTimeExtra> dtTimeColl(nMuons);
647  std::vector<reco::MuonTimeExtra> cscTimeColl(nMuons);
648  std::vector<reco::MuonTimeExtra> combinedTimeColl(nMuons);
649  std::vector<reco::IsoDeposit> trackDepColl(nMuons);
650  std::vector<reco::IsoDeposit> ecalDepColl(nMuons);
651  std::vector<reco::IsoDeposit> hcalDepColl(nMuons);
652  std::vector<reco::IsoDeposit> hoDepColl(nMuons);
653  std::vector<reco::IsoDeposit> jetDepColl(nMuons);
654 
655  // Fill various information
656  unsigned int i=0;
657  for ( reco::MuonCollection::iterator muon = outputMuons->begin(); muon != outputMuons->end(); ++muon )
658  {
659  // Fill muonID
660  // timers.push("MuonIdProducer::produce::fillMuonId");
661  if ( ( fillMatching_ && ! muon->isMatchesValid() ) ||
662  ( fillEnergy_ && !muon->isEnergyValid() ) )
663  {
664  // predict direction based on the muon interaction region location
665  // if it's available
666  if ( muon->isStandAloneMuon() ) {
667  if ( cos(phiOfMuonIneteractionRegion(*muon) - muon->phi()) > 0 )
669  else
671  } else {
672  LogTrace("MuonIdentification") << "THIS SHOULD NEVER HAPPEN";
673  fillMuonId(iEvent, iSetup, *muon);
674  }
675  }
676 
678  // Fill global quality information
679  fillGlbQuality(iEvent, iSetup, *muon);
680  }
681  LogDebug("MuonIdentification");
682 
683  if (fillTrackerKink_) {
685  }
686 
687  // timers.push("MuonIdProducer::produce::fillCaloCompatibility");
688  if ( fillCaloCompatibility_ ) muon->setCaloCompatibility( muonCaloCompatibility_.evaluate(*muon) );
689  // timers.pop();
690 
691  // timers.push("MuonIdProducer::produce::fillIsolation");
692  if ( fillIsolation_ ) fillMuonIsolation(iEvent, iSetup, *muon,
693  trackDepColl[i], ecalDepColl[i], hcalDepColl[i], hoDepColl[i], jetDepColl[i]);
694  // timers.pop();
695 
696  // fill timing information
697  reco::MuonTime muonTime;
698  reco::MuonTimeExtra dtTime;
699  reco::MuonTimeExtra cscTime;
700  reco::MuonTimeExtra combinedTime;
701 
702  theTimingFiller_->fillTiming(*muon, dtTime, cscTime, combinedTime, iEvent, iSetup);
703 
704  muonTime.nDof=combinedTime.nDof();
705  muonTime.timeAtIpInOut=combinedTime.timeAtIpInOut();
706  muonTime.timeAtIpInOutErr=combinedTime.timeAtIpInOutErr();
707  muonTime.timeAtIpOutIn=combinedTime.timeAtIpOutIn();
708  muonTime.timeAtIpOutInErr=combinedTime.timeAtIpOutInErr();
709 
710  muon->setTime( muonTime);
711  dtTimeColl[i] = dtTime;
712  cscTimeColl[i] = cscTime;
713  combinedTimeColl[i] = combinedTime;
714 
715  i++;
716 
717  }
718 
719  LogTrace("MuonIdentification") << "number of muons produced: " << outputMuons->size();
720  // timers.push("MuonIdProducer::produce::fillArbitration");
721  if ( fillMatching_ ) fillArbitrationInfo( outputMuons.get() );
722  // timers.pop();
723  edm::OrphanHandle<reco::MuonCollection> muonHandle = iEvent.put(outputMuons);
724 
725  filler.insert(muonHandle, combinedTimeColl.begin(), combinedTimeColl.end());
726  filler.fill();
727  fillerDT.insert(muonHandle, dtTimeColl.begin(), dtTimeColl.end());
728  fillerDT.fill();
729  fillerCSC.insert(muonHandle, cscTimeColl.begin(), cscTimeColl.end());
730  fillerCSC.fill();
731 
732  iEvent.put(muonTimeMap,"combined");
733  iEvent.put(muonTimeMapDT,"dt");
734  iEvent.put(muonTimeMapCSC,"csc");
735 
737  trackDepFiller.insert(muonHandle, trackDepColl.begin(), trackDepColl.end());
738  trackDepFiller.fill();
739  iEvent.put(trackDepMap, trackDepositName_);
740  ecalDepFiller.insert(muonHandle, ecalDepColl.begin(), ecalDepColl.end());
741  ecalDepFiller.fill();
742  iEvent.put(ecalDepMap, ecalDepositName_);
743  hcalDepFiller.insert(muonHandle, hcalDepColl.begin(), hcalDepColl.end());
744  hcalDepFiller.fill();
745  iEvent.put(hcalDepMap, hcalDepositName_);
746  hoDepFiller.insert(muonHandle, hoDepColl.begin(), hoDepColl.end());
747  hoDepFiller.fill();
748  iEvent.put(hoDepMap, hoDepositName_);
749  jetDepFiller.insert(muonHandle, jetDepColl.begin(), jetDepColl.end());
750  jetDepFiller.fill();
751  iEvent.put(jetDepMap, jetDepositName_);
752  }
753 
754  iEvent.put(caloMuons);
755 }
#define LogDebug(id)
std::string hoDepositName_
std::string jetDepositName_
int i
Definition: DBlmapReader.cc:9
reco::Muon makeMuon(edm::Event &iEvent, const edm::EventSetup &iSetup, const reco::TrackRef &track, TrackType type)
static const unsigned int GlobalMuon
Definition: Muon.h:200
void fillMuonIsolation(edm::Event &, const edm::EventSetup &, reco::Muon &aMuon, reco::IsoDeposit &trackDep, reco::IsoDeposit &ecalDep, reco::IsoDeposit &hcalDep, reco::IsoDeposit &hoDep, reco::IsoDeposit &jetDep)
static void truthMatchMuon(const edm::Event &iEvent, const edm::EventSetup &iSetup, reco::Muon &aMuon)
static bool crossedIP(const reco::Track &track)
const TrackExtraRef & extra() const
reference to &quot;extra&quot; object
Definition: Track.h:97
void fillMuonId(edm::Event &, const edm::EventSetup &, reco::Muon &, TrackDetectorAssociator::Direction direction=TrackDetectorAssociator::InsideOut)
edm::Handle< reco::MuonTrackLinksCollection > linkCollectionHandle_
int overlap(const reco::Muon &muon, const reco::Track &track)
bool fillCaloCompatibility_
std::string trackDepositName_
double phiOfMuonIneteractionRegion(const reco::Muon &muon) const
std::vector< CaloMuon > CaloMuonCollection
collection of Muon objects
Definition: MuonFwd.h:27
double evaluate(const reco::Muon &)
MuonCaloCompatibility muonCaloCompatibility_
float timeAtIpOutInErr() const
Definition: MuonTimeExtra.h:50
bool isAvailable() const
Definition: Ref.h:276
void fillGlbQuality(edm::Event &, const edm::EventSetup &, reco::Muon &aMuon)
int nDof() const
number of measurements used in timing calculation
Definition: MuonTimeExtra.h:23
float timeAtIpOutInErr
Definition: MuonTime.h:18
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
void init(edm::Event &, const edm::EventSetup &)
bool isCaloCompatibilityValid() const
Definition: CaloMuon.h:45
void fillArbitrationInfo(reco::MuonCollection *)
void fillTrackerKink(reco::Muon &aMuon)
double p() const
momentum vector magnitude
Definition: CaloMuon.h:52
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool isGoodTrackerMuon(const reco::Muon &muon)
bool checkLinks(const reco::MuonTrackLinks *) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
float timeAtIpInOutErr
Definition: MuonTime.h:15
std::string ecalDepositName_
float timeAtIpOutIn
b) particle is moving from outside in
Definition: MuonTime.h:17
int nDof
number of muon stations used
Definition: MuonTime.h:10
float timeAtIpInOutErr() const
Definition: MuonTimeExtra.h:45
int j
Definition: DBlmapReader.cc:9
bool isValid() const
Definition: HandleBase.h:76
edm::Handle< reco::TrackCollection > outerTrackCollectionHandle_
#define LogTrace(id)
reco::CaloMuon makeCaloMuon(const reco::Muon &)
static const unsigned int TrackerMuon
Definition: Muon.h:201
MuonTimingFiller * theTimingFiller_
float timeAtIpInOut() const
Definition: MuonTimeExtra.h:44
bool fillGlobalTrackQuality_
std::string hcalDepositName_
edm::Handle< reco::TrackCollection > innerTrackCollectionHandle_
bool isGoodTrack(const reco::Track &track)
static const unsigned int StandAloneMuon
Definition: Muon.h:202
float timeAtIpOutIn() const
b) particle is moving from outside in
Definition: MuonTimeExtra.h:49
void fillTiming(const reco::Muon &muon, reco::MuonTimeExtra &dtTime, reco::MuonTimeExtra &cscTime, reco::MuonTimeExtra &combinedTime, edm::Event &iEvent, const edm::EventSetup &iSetup)
float caloCompatibility() const
Definition: CaloMuon.h:43
bool validateGlobalMuonPair(const reco::MuonTrackLinks &goodMuon, const reco::MuonTrackLinks &badMuon)
bool debugWithTruthMatching_
float timeAtIpInOut
Definition: MuonTime.h:14
edm::Handle< reco::MuonCollection > muonCollectionHandle_
double MuonIdProducer::sectorPhi ( const DetId id)
static

Definition at line 1139 of file MuonIdProducer.cc.

References MuonSubdetId::CSC, MuonSubdetId::DT, M_PI, phi, DTChamberId::sector(), and CSCDetId::triggerSector().

Referenced by phiOfMuonIneteractionRegion().

1140 {
1141  double phi = 0;
1142  if( id.subdetId() == MuonSubdetId::DT ) { // DT
1143  DTChamberId muonId(id.rawId());
1144  if ( muonId.sector() <= 12 )
1145  phi = (muonId.sector()-1)/6.*M_PI;
1146  if ( muonId.sector() == 13 ) phi = 3/6.*M_PI;
1147  if ( muonId.sector() == 14 ) phi = 9/6.*M_PI;
1148  }
1149  if( id.subdetId() == MuonSubdetId::CSC ) { // CSC
1150  CSCDetId muonId(id.rawId());
1151  phi = M_PI/4+(muonId.triggerSector()-1)/3.*M_PI;
1152  }
1153  if ( phi > M_PI ) phi -= 2*M_PI;
1154  return phi;
1155 }
static const int CSC
Definition: MuonSubdetId.h:15
#define M_PI
Definition: BFit3D.cc:3
static const int DT
Definition: MuonSubdetId.h:14
Definition: DDAxes.h:10

Member Data Documentation

bool MuonIdProducer::addExtraSoftMuons_
private

Definition at line 119 of file MuonIdProducer.h.

Referenced by isGoodTrackerMuon(), and MuonIdProducer().

bool MuonIdProducer::arbClean_
private

Definition at line 165 of file MuonIdProducer.h.

Referenced by fillArbitrationInfo(), and MuonIdProducer().

double MuonIdProducer::caloCut_
private

Definition at line 163 of file MuonIdProducer.h.

Referenced by MuonIdProducer(), and produce().

bool MuonIdProducer::debugWithTruthMatching_
private

Definition at line 136 of file MuonIdProducer.h.

Referenced by MuonIdProducer(), and produce().

edm::Handle<reco::TrackToTrackMap> MuonIdProducer::dytCollectionHandle_
private

Definition at line 144 of file MuonIdProducer.h.

Referenced by init(), and makeMuon().

std::string MuonIdProducer::ecalDepositName_
private

Definition at line 151 of file MuonIdProducer.h.

Referenced by MuonIdProducer(), and produce().

bool MuonIdProducer::fillCaloCompatibility_
private

Definition at line 128 of file MuonIdProducer.h.

Referenced by makeCaloMuon(), MuonIdProducer(), and produce().

bool MuonIdProducer::fillEnergy_
private

Definition at line 129 of file MuonIdProducer.h.

Referenced by fillMuonId(), MuonIdProducer(), and produce().

bool MuonIdProducer::fillGlobalTrackQuality_
private

Definition at line 156 of file MuonIdProducer.h.

Referenced by MuonIdProducer(), and produce().

bool MuonIdProducer::fillGlobalTrackRefits_
private

Definition at line 157 of file MuonIdProducer.h.

Referenced by init(), makeMuon(), and MuonIdProducer().

bool MuonIdProducer::fillIsolation_
private

Definition at line 131 of file MuonIdProducer.h.

Referenced by MuonIdProducer(), and produce().

bool MuonIdProducer::fillMatching_
private

Definition at line 130 of file MuonIdProducer.h.

Referenced by fillMuonId(), MuonIdProducer(), and produce().

bool MuonIdProducer::fillTrackerKink_
private

Definition at line 160 of file MuonIdProducer.h.

Referenced by init(), MuonIdProducer(), and produce().

edm::InputTag MuonIdProducer::globalTrackQualityInputTag_
private

Definition at line 158 of file MuonIdProducer.h.

Referenced by fillGlbQuality(), and MuonIdProducer().

std::string MuonIdProducer::hcalDepositName_
private

Definition at line 152 of file MuonIdProducer.h.

Referenced by MuonIdProducer(), and produce().

std::string MuonIdProducer::hoDepositName_
private

Definition at line 153 of file MuonIdProducer.h.

Referenced by MuonIdProducer(), and produce().

edm::Handle<reco::TrackCollection> MuonIdProducer::innerTrackCollectionHandle_
private

Definition at line 138 of file MuonIdProducer.h.

Referenced by init(), and produce().

std::vector<edm::InputTag> MuonIdProducer::inputCollectionLabels_
private

Definition at line 108 of file MuonIdProducer.h.

Referenced by init(), and MuonIdProducer().

std::vector<std::string> MuonIdProducer::inputCollectionTypes_
private

Definition at line 109 of file MuonIdProducer.h.

Referenced by init(), and MuonIdProducer().

std::string MuonIdProducer::jetDepositName_
private

Definition at line 154 of file MuonIdProducer.h.

Referenced by MuonIdProducer(), and produce().

edm::Handle<reco::MuonTrackLinksCollection> MuonIdProducer::linkCollectionHandle_
private

Definition at line 141 of file MuonIdProducer.h.

Referenced by init(), and produce().

double MuonIdProducer::maxAbsDx_
private

Definition at line 122 of file MuonIdProducer.h.

Referenced by fillMuonId(), and MuonIdProducer().

double MuonIdProducer::maxAbsDy_
private

Definition at line 124 of file MuonIdProducer.h.

Referenced by fillMuonId(), and MuonIdProducer().

double MuonIdProducer::maxAbsEta_
private

Definition at line 118 of file MuonIdProducer.h.

Referenced by isGoodTrack(), and MuonIdProducer().

double MuonIdProducer::maxAbsPullX_
private

Definition at line 123 of file MuonIdProducer.h.

Referenced by fillMuonId(), and MuonIdProducer().

double MuonIdProducer::maxAbsPullY_
private

Definition at line 125 of file MuonIdProducer.h.

Referenced by fillMuonId(), and MuonIdProducer().

MuonMesh* MuonIdProducer::meshAlgo_
private

Definition at line 166 of file MuonIdProducer.h.

Referenced by beginRun(), fillArbitrationInfo(), MuonIdProducer(), and ~MuonIdProducer().

int MuonIdProducer::minNumberOfMatches_
private

Definition at line 117 of file MuonIdProducer.h.

Referenced by isGoodTrackerMuon(), and MuonIdProducer().

double MuonIdProducer::minP_
private

Definition at line 115 of file MuonIdProducer.h.

Referenced by isGoodTrack(), isGoodTrackerMuon(), and MuonIdProducer().

double MuonIdProducer::minPCaloMuon_
private

Definition at line 116 of file MuonIdProducer.h.

Referenced by isGoodTrack(), MuonIdProducer(), and produce().

double MuonIdProducer::minPt_
private

Definition at line 114 of file MuonIdProducer.h.

Referenced by isGoodTrack(), isGoodTrackerMuon(), and MuonIdProducer().

reco::isodeposit::IsoDepositExtractor* MuonIdProducer::muIsoExtractorCalo_
private

Definition at line 147 of file MuonIdProducer.h.

Referenced by fillMuonIsolation(), MuonIdProducer(), and ~MuonIdProducer().

reco::isodeposit::IsoDepositExtractor* MuonIdProducer::muIsoExtractorJet_
private

Definition at line 149 of file MuonIdProducer.h.

Referenced by fillMuonIsolation(), MuonIdProducer(), and ~MuonIdProducer().

reco::isodeposit::IsoDepositExtractor* MuonIdProducer::muIsoExtractorTrack_
private

Definition at line 148 of file MuonIdProducer.h.

Referenced by fillMuonIsolation(), MuonIdProducer(), and ~MuonIdProducer().

MuonCaloCompatibility MuonIdProducer::muonCaloCompatibility_
private

Definition at line 146 of file MuonIdProducer.h.

Referenced by makeCaloMuon(), MuonIdProducer(), and produce().

edm::Handle<reco::MuonCollection> MuonIdProducer::muonCollectionHandle_
private

Definition at line 140 of file MuonIdProducer.h.

Referenced by init(), and produce().

edm::Handle<reco::TrackCollection> MuonIdProducer::outerTrackCollectionHandle_
private

Definition at line 139 of file MuonIdProducer.h.

Referenced by init(), and produce().

TrackAssociatorParameters MuonIdProducer::parameters_
private
edm::Handle<reco::TrackToTrackMap> MuonIdProducer::pickyCollectionHandle_
private

Definition at line 143 of file MuonIdProducer.h.

Referenced by init(), and makeMuon().

double MuonIdProducer::ptThresholdToFillCandidateP4WithGlobalFit_
private

Definition at line 133 of file MuonIdProducer.h.

Referenced by makeMuon(), and MuonIdProducer().

double MuonIdProducer::sigmaThresholdToFillCandidateP4WithGlobalFit_
private

Definition at line 134 of file MuonIdProducer.h.

Referenced by makeMuon(), and MuonIdProducer().

MuonTimingFiller* MuonIdProducer::theTimingFiller_
private

Definition at line 111 of file MuonIdProducer.h.

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

edm::Handle<reco::TrackToTrackMap> MuonIdProducer::tpfmsCollectionHandle_
private

Definition at line 142 of file MuonIdProducer.h.

Referenced by init(), and makeMuon().

TrackDetectorAssociator MuonIdProducer::trackAssociator_
private

Definition at line 105 of file MuonIdProducer.h.

Referenced by fillMuonId(), and init().

std::string MuonIdProducer::trackDepositName_
private

Definition at line 150 of file MuonIdProducer.h.

Referenced by MuonIdProducer(), and produce().

std::auto_ptr<MuonKinkFinder> MuonIdProducer::trackerKinkFinder_
private

Definition at line 161 of file MuonIdProducer.h.

Referenced by fillTrackerKink(), init(), and MuonIdProducer().

bool MuonIdProducer::writeIsoDeposits_
private

Definition at line 132 of file MuonIdProducer.h.

Referenced by MuonIdProducer(), and produce().