CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
51 
52 // RPC-Muon stuffs
56 
59 
63 
64 
65 class MuonMesh;
66 class MuonKinkFinder;
67 
69  public:
71 
72  explicit MuonIdProducer(const edm::ParameterSet&);
73 
74  ~MuonIdProducer() override;
75 
76  void produce(edm::Event&, const edm::EventSetup&) override;
77  void beginRun(const edm::Run&, const edm::EventSetup&) override;
78 
79  static double sectorPhi( const DetId& id );
80 
81  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
82 
83  private:
86  void fillArbitrationInfo( reco::MuonCollection*, unsigned int muonType = reco::Muon::TrackerMuon );
89  reco::IsoDeposit& trackDep, reco::IsoDeposit& ecalDep, reco::IsoDeposit& hcalDep, reco::IsoDeposit& hoDep,
90  reco::IsoDeposit& jetDep);
91  void fillGlbQuality( edm::Event&, const edm::EventSetup&, reco::Muon& aMuon );
92  void fillTrackerKink( reco::Muon& aMuon );
93  void init( edm::Event&, const edm::EventSetup& );
94 
95  // make a muon based on a track ref
97  const reco::TrackRef& track, TrackType type);
98  // make a global muon based on the links object
100 
101  // make a muon based on track (p4)
103 
105 
106  // check if a silicon track satisfies the trackerMuon requirements
107  bool isGoodTrack( const reco::Track& track );
108 
109  bool isGoodTrackerMuon( const reco::Muon& muon );
110  bool isGoodCaloMuon( const reco::CaloMuon& muon );
111  bool isGoodRPCMuon( const reco::Muon& muon );
112  bool isGoodGEMMuon( const reco::Muon& muon );
113  bool isGoodME0Muon( const reco::Muon& muon );
114 
115  // check number of common DetIds for a given trackerMuon and a stand alone
116  // muon track
117  int overlap(const reco::Muon& muon, const reco::Track& track);
118 
119  unsigned int chamberId(const DetId&);
120 
121  double phiOfMuonIneteractionRegion( const reco::Muon& muon ) const;
122 
123  bool checkLinks(const reco::MuonTrackLinks*) const ;
124  inline bool approxEqual(const double a, const double b, const double tol=1E-3) const
125  {
126  return std::abs(a-b) < tol;
127  }
128 
129 
131  std::vector<reco::MuonSegmentMatch> * getSegmentMatches(reco::MuonChamberMatch & chamber, unsigned int muonType) const {
132  if (muonType == reco::Muon::TrackerMuon) return & chamber.segmentMatches;
133  else if (muonType == reco::Muon::ME0Muon) return & chamber.me0Matches;
134  else if (muonType == reco::Muon::GEMMuon) return & chamber.gemMatches;
135  else throw cms::Exception("getSegmentMatches called with unsupported muonType");
136  }
137 
140 
141  struct ICTypes
142  {
143  enum ICTypeKey {
148  };
149 
150  static ICTypeKey toKey(const std::string& s) {
151  if ( s == "inner tracks" ) return INNER_TRACKS;
152  else if ( s == "outer tracks" ) return OUTER_TRACKS;
153  else if ( s == "links" ) return LINKS;
154  else if ( s == "muons" ) return MUONS;
155  else if ( s == "tev firstHit" ) return TEV_FIRSTHIT;
156  else if ( s == "tev picky" ) return TEV_PICKY ;
157  else if ( s == "tev dyt" ) return TEV_DYT ;
158 
159  throw cms::Exception("FatalError") << "Unknown input collection type: " << s;
160  }
161 
162  static std::string toStr(const ICTypeKey k) {
163  switch ( k ) {
164  case INNER_TRACKS: return "inner tracks";
165  case OUTER_TRACKS: return "outer tracks";
166  case LINKS : return "links" ;
167  case MUONS : return "muons" ;
168  case TEV_FIRSTHIT: return "tev firstHit";
169  case TEV_PICKY : return "tev picky" ;
170  case TEV_DYT : return "tev dyt" ;
171  default: throw cms::Exception("FatalError") << "Unknown input collection type";
172  }
173  return "";
174  }
175  };
176  std::vector<edm::InputTag> inputCollectionLabels_;
177  std::vector<ICTypes::ICTypeKey> inputCollectionTypes_;
178 
179  std::unique_ptr<MuonTimingFiller> theTimingFiller_;
180 
181  std::unique_ptr<MuonShowerDigiFiller> theShowerDigiFiller_;
182 
183  // selections
184  double minPt_;
185  double minP_;
188  double maxAbsEta_;
190 
191  // matching
192  double maxAbsDx_;
193  double maxAbsPullX_;
194  double maxAbsDy_;
195  double maxAbsPullY_;
196 
197  // what information to fill
207 
209 
211 
219 
227 
230 
233 
235  std::unique_ptr<reco::isodeposit::IsoDepositExtractor> muIsoExtractorCalo_;
236  std::unique_ptr<reco::isodeposit::IsoDepositExtractor> muIsoExtractorTrack_;
237  std::unique_ptr<reco::isodeposit::IsoDepositExtractor> muIsoExtractorJet_;
243 
247 
249  std::unique_ptr<MuonKinkFinder> trackerKinkFinder_;
250 
251  double caloCut_;
252 
253  bool arbClean_;
254  std::unique_ptr<MuonMesh> meshAlgo_;
255 
256 };
257 #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)
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::unique_ptr< reco::isodeposit::IsoDepositExtractor > muIsoExtractorTrack_
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
std::unique_ptr< MuonTimingFiller > theTimingFiller_
bool approxEqual(const double a, const double b, const double tol=1E-3) const
std::unique_ptr< reco::isodeposit::IsoDepositExtractor > muIsoExtractorCalo_
void init(edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< reco::TrackToTrackMap > tpfmsCollectionToken_
std::vector< reco::MuonSegmentMatch > me0Matches
int iEvent
Definition: GenABIO.cc:224
std::unique_ptr< MuonShowerDigiFiller > theShowerDigiFiller_
double ptThresholdToFillCandidateP4WithGlobalFit_
TrackAssociatorParameters parameters_
bool isGoodME0Muon(const reco::Muon &muon)
void fillTrackerKink(reco::Muon &aMuon)
static const unsigned int ME0Muon
Definition: Muon.h:283
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::Muon::MuonTrackType TrackType
Definition: DetId.h:18
static ICTypeKey toKey(const std::string &s)
static const unsigned int TrackerMuon
Definition: Muon.h:277
std::vector< ICTypes::ICTypeKey > inputCollectionTypes_
std::vector< edm::InputTag > inputCollectionLabels_
double b
Definition: hdecay.h:120
std::unique_ptr< reco::isodeposit::IsoDepositExtractor > muIsoExtractorJet_
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:282
double a
Definition: hdecay.h:121
edm::Handle< reco::TrackToTrackMap > tpfmsCollectionHandle_
bool storeCrossedHcalRecHits_
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:45
edm::Handle< edm::ValueMap< reco::MuonQuality > > glbQualHandle_
void beginRun(const edm::Run &, const edm::EventSetup &) override
std::unique_ptr< MuonMesh > meshAlgo_
edm::Handle< reco::TrackToTrackMap > pickyCollectionHandle_
edm::EDGetTokenT< reco::TrackToTrackMap > dytCollectionToken_