CMS 3D CMS Logo

MuonIdProducer.h
Go to the documentation of this file.
1 #ifndef MuonIdentification_MuonIdProducer_h
2 #define MuonIdentification_MuonIdProducer_h
3 
4 // -*- C++ -*-
5 //
6 // Package: MuonIdentification
7 // Class: MuonIdProducer
8 //
9 /*
10 
11  Description: reco::Muon producer that can fill various information:
12  - track-segment matching
13  - energy deposition
14  - muon isolation
15  - muon hypothesis compatibility (calorimeter)
16  Acceptable inputs:
17  - reco::TrackCollection
18  - reco::MuonCollection
19  - reco::MuonTrackLinksCollection
20 */
21 //
22 // Original Author: Dmytro Kovalskyi
23 //
24 //
25 
26 
27 // user include files
30 
34 
36 
43 
45 // #include "Utilities/Timing/interface/TimerStack.h"
46 
50 // RPC-Muon stuffs
51 
55 
58 
62 
63 
64 class MuonMesh;
65 class MuonKinkFinder;
66 
68  public:
70 
71  explicit MuonIdProducer(const edm::ParameterSet&);
72 
73  ~MuonIdProducer() override;
74 
75  void produce(edm::Event&, const edm::EventSetup&) override;
76  void beginRun(const edm::Run&, const edm::EventSetup&) override;
77 
78  static double sectorPhi( const DetId& id );
79 
80  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
81 
82  private:
85  void fillArbitrationInfo( reco::MuonCollection*, unsigned int muonType = reco::Muon::TrackerMuon );
88  reco::IsoDeposit& trackDep, reco::IsoDeposit& ecalDep, reco::IsoDeposit& hcalDep, reco::IsoDeposit& hoDep,
89  reco::IsoDeposit& jetDep);
90  void fillGlbQuality( edm::Event&, const edm::EventSetup&, reco::Muon& aMuon );
91  void fillTrackerKink( reco::Muon& aMuon );
92  void init( edm::Event&, const edm::EventSetup& );
93 
94  // make a muon based on a track ref
96  const reco::TrackRef& track, TrackType type);
97  // make a global muon based on the links object
99 
100  // make a muon based on track (p4)
102 
104 
105  // check if a silicon track satisfies the trackerMuon requirements
106  bool isGoodTrack( const reco::Track& track );
107 
108  bool isGoodTrackerMuon( const reco::Muon& muon );
109  bool isGoodCaloMuon( const reco::CaloMuon& muon );
110  bool isGoodRPCMuon( const reco::Muon& muon );
111  bool isGoodGEMMuon( const reco::Muon& muon );
112  bool isGoodME0Muon( const reco::Muon& muon );
113 
114  // check number of common DetIds for a given trackerMuon and a stand alone
115  // muon track
116  int overlap(const reco::Muon& muon, const reco::Track& track);
117 
118  unsigned int chamberId(const DetId&);
119 
120  double phiOfMuonIneteractionRegion( const reco::Muon& muon ) const;
121 
122  bool checkLinks(const reco::MuonTrackLinks*) const ;
123  inline bool approxEqual(const double a, const double b, const double tol=1E-3) const
124  {
125  return std::abs(a-b) < tol;
126  }
127 
128 
130  std::vector<reco::MuonSegmentMatch> * getSegmentMatches(reco::MuonChamberMatch & chamber, unsigned int muonType) const {
131  if (muonType == reco::Muon::TrackerMuon) return & chamber.segmentMatches;
132  else if (muonType == reco::Muon::ME0Muon) return & chamber.me0Matches;
133  else if (muonType == reco::Muon::GEMMuon) return & chamber.gemMatches;
134  else throw cms::Exception("getSegmentMatches called with unsupported muonType");
135  }
136 
139 
140  struct ICTypes
141  {
142  enum ICTypeKey {
147  };
148 
149  static ICTypeKey toKey(const std::string& s) {
150  if ( s == "inner tracks" ) return INNER_TRACKS;
151  else if ( s == "outer tracks" ) return OUTER_TRACKS;
152  else if ( s == "links" ) return LINKS;
153  else if ( s == "muons" ) return MUONS;
154  else if ( s == "tev firstHit" ) return TEV_FIRSTHIT;
155  else if ( s == "tev picky" ) return TEV_PICKY ;
156  else if ( s == "tev dyt" ) return TEV_DYT ;
157 
158  throw cms::Exception("FatalError") << "Unknown input collection type: " << s;
159  }
160 
161  static std::string toStr(const ICTypeKey k) {
162  switch ( k ) {
163  case INNER_TRACKS: return "inner tracks";
164  case OUTER_TRACKS: return "outer tracks";
165  case LINKS : return "links" ;
166  case MUONS : return "muons" ;
167  case TEV_FIRSTHIT: return "tev firstHit";
168  case TEV_PICKY : return "tev picky" ;
169  case TEV_DYT : return "tev dyt" ;
170  default: throw cms::Exception("FatalError") << "Unknown input collection type";
171  }
172  return "";
173  }
174  };
175  std::vector<edm::InputTag> inputCollectionLabels_;
176  std::vector<ICTypes::ICTypeKey> inputCollectionTypes_;
177 
179 
180  // selections
181  double minPt_;
182  double minP_;
185  double maxAbsEta_;
187 
188  // matching
189  double maxAbsDx_;
190  double maxAbsPullX_;
191  double maxAbsDy_;
192  double maxAbsPullY_;
193 
194  // what information to fill
202 
204 
206 
214 
222 
225 
228 
238 
242 
244  std::unique_ptr<MuonKinkFinder> trackerKinkFinder_;
245 
246  double caloCut_;
247 
248  bool arbClean_;
250 
251 };
252 #endif
std::string hoDepositName_
type
Definition: HCALResponse.h:21
std::string jetDepositName_
bool isGoodRPCMuon(const reco::Muon &muon)
edm::EDGetTokenT< reco::TrackCollection > innerTrackCollectionToken_
reco::Muon makeMuon(edm::Event &iEvent, const edm::EventSetup &iSetup, const reco::TrackRef &track, TrackType type)
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)
edm::EDGetTokenT< edm::ValueMap< reco::MuonQuality > > glbQualToken_
std::vector< reco::MuonSegmentMatch > gemMatches
TrackDetectorAssociator trackAssociator_
std::unique_ptr< MuonKinkFinder > trackerKinkFinder_
void fillMuonId(edm::Event &, const edm::EventSetup &, reco::Muon &, TrackDetectorAssociator::Direction direction=TrackDetectorAssociator::InsideOut)
reco::isodeposit::IsoDepositExtractor * muIsoExtractorCalo_
edm::Handle< reco::MuonTrackLinksCollection > linkCollectionHandle_
edm::EDGetTokenT< RPCRecHitCollection > rpcHitToken_
bool isGoodGEMMuon(const reco::Muon &muon)
int overlap(const reco::Muon &muon, const reco::Track &track)
bool fillCaloCompatibility_
std::string trackDepositName_
void fillArbitrationInfo(reco::MuonCollection *, unsigned int muonType=reco::Muon::TrackerMuon)
double phiOfMuonIneteractionRegion(const reco::Muon &muon) const
std::vector< CaloMuon > CaloMuonCollection
collection of Muon objects
Definition: MuonFwd.h:27
std::vector< reco::MuonSegmentMatch > * getSegmentMatches(reco::MuonChamberMatch &chamber, unsigned int muonType) const
get the segment matches of the appropriate type
void produce(edm::Event &, const edm::EventSetup &) override
MuonCaloCompatibility muonCaloCompatibility_
edm::EDGetTokenT< reco::TrackToTrackMap > pickyCollectionToken_
static std::string toStr(const ICTypeKey k)
bool arbitrateTrackerMuons_
void fillGlbQuality(edm::Event &, const edm::EventSetup &, reco::Muon &aMuon)
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
MuonMesh * meshAlgo_
bool approxEqual(const double a, const double b, const double tol=1E-3) const
void init(edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< reco::TrackToTrackMap > tpfmsCollectionToken_
std::vector< reco::MuonSegmentMatch > me0Matches
int iEvent
Definition: GenABIO.cc:230
double ptThresholdToFillCandidateP4WithGlobalFit_
TrackAssociatorParameters parameters_
bool isGoodME0Muon(const reco::Muon &muon)
void fillTrackerKink(reco::Muon &aMuon)
static const unsigned int ME0Muon
Definition: Muon.h:262
bool isGoodTrackerMuon(const reco::Muon &muon)
bool checkLinks(const reco::MuonTrackLinks *) const
std::string ecalDepositName_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::EDGetTokenT< reco::MuonCollection > muonCollectionToken_
edm::EDGetTokenT< reco::TrackCollection > outerTrackCollectionToken_
edm::Handle< RPCRecHitCollection > rpcHitHandle_
edm::Handle< reco::TrackToTrackMap > dytCollectionHandle_
edm::Handle< reco::TrackCollection > outerTrackCollectionHandle_
edm::EDGetTokenT< reco::MuonTrackLinksCollection > linkCollectionToken_
bool fillGlobalTrackRefits_
static double sectorPhi(const DetId &id)
reco::CaloMuon makeCaloMuon(const reco::Muon &)
int k[5][pyjets_maxn]
reco::isodeposit::IsoDepositExtractor * muIsoExtractorTrack_
reco::Muon::MuonTrackType TrackType
Definition: DetId.h:18
static ICTypeKey toKey(const std::string &s)
static const unsigned int TrackerMuon
Definition: Muon.h:256
reco::isodeposit::IsoDepositExtractor * muIsoExtractorJet_
MuonTimingFiller * theTimingFiller_
std::vector< ICTypes::ICTypeKey > inputCollectionTypes_
std::vector< edm::InputTag > inputCollectionLabels_
double b
Definition: hdecay.h:120
MuonIdProducer(const edm::ParameterSet &)
void arbitrateMuons(reco::MuonCollection *, reco::CaloMuonCollection *)
std::vector< reco::MuonSegmentMatch > segmentMatches
bool fillGlobalTrackQuality_
std::string hcalDepositName_
~MuonIdProducer() override
unsigned int chamberId(const DetId &)
static const unsigned int GEMMuon
Definition: Muon.h:261
double a
Definition: hdecay.h:121
edm::Handle< reco::TrackToTrackMap > tpfmsCollectionHandle_
edm::Handle< reco::TrackCollection > innerTrackCollectionHandle_
bool isGoodTrack(const reco::Track &track)
MuonTrackType
map for Global Muon refitters
Definition: Muon.h:38
double sigmaThresholdToFillCandidateP4WithGlobalFit_
bool debugWithTruthMatching_
bool isGoodCaloMuon(const reco::CaloMuon &muon)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::InputTag globalTrackQualityInputTag_
edm::Handle< reco::MuonCollection > muonCollectionHandle_
Definition: Run.h:43
edm::Handle< edm::ValueMap< reco::MuonQuality > > glbQualHandle_
void beginRun(const edm::Run &, const edm::EventSetup &) override
edm::Handle< reco::TrackToTrackMap > pickyCollectionHandle_
edm::EDGetTokenT< reco::TrackToTrackMap > dytCollectionToken_