CMS 3D CMS Logo

HLTMuonL2SelectorForL3IO.cc
Go to the documentation of this file.
1 
15 
18  : l2Src_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("l2Src"))),
19  l3OISrc_(consumes<reco::RecoChargedCandidateCollection>(iConfig.getParameter<edm::InputTag>("l3OISrc"))),
20  l3linkToken_(consumes<reco::MuonTrackLinksCollection>(iConfig.getParameter<edm::InputTag>("InputLinks"))),
21  applyL3Filters_(iConfig.getParameter<bool>("applyL3Filters")),
22  max_NormalizedChi2_(iConfig.getParameter<double>("MaxNormalizedChi2")),
23  max_PtDifference_(iConfig.getParameter<double>("MaxPtDifference")),
24  min_Nhits_(iConfig.getParameter<int>("MinNhits")),
25  min_NmuonHits_(iConfig.getParameter<int>("MinNmuonHits")) {
26  LogTrace("Muon|RecoMuon|HLTMuonL2SelectorForL3IO") << "constructor called";
27  produces<reco::TrackCollection>();
28 }
29 
32 
35  const std::string metname = "Muon|RecoMuon|HLTMuonL2SelectorForL3IO";
36 
37  // IN:
39  iEvent.getByToken(l2Src_, l2muonH);
40 
42  iEvent.getByToken(l3OISrc_, l3muonH);
43 
44  // Read Links collection:
46  iEvent.getByToken(l3linkToken_, links);
47 
48  // OUT:
49  std::unique_ptr<reco::TrackCollection> result(new reco::TrackCollection());
50 
51  for (unsigned int il2 = 0; il2 != l2muonH->size(); ++il2) {
52  reco::TrackRef l2muRef(l2muonH, il2);
53  bool re_do_this_L2 = true;
54 
55  for (unsigned int il3 = 0; il3 != l3muonH->size(); ++il3) {
56  reco::RecoChargedCandidateRef cand(l3muonH, il3);
57  reco::TrackRef tk = cand->track();
58 
59  bool useThisLink = false;
60  for (unsigned int l(0); l < links->size() && !useThisLink; ++l) {
61  const reco::MuonTrackLinks* link = &links->at(l);
62 
63  // Check if the L3 link matches the L3 candidate
64  const reco::Track& globalTrack = *link->globalTrack();
65  float dR2 = deltaR2(tk->eta(), tk->phi(), globalTrack.eta(), globalTrack.phi());
66  if (dR2 < 0.02 * 0.02 and std::abs(tk->pt() - globalTrack.pt()) < 0.001 * tk->pt()) {
67  useThisLink = true;
68  }
69 
70  if (!useThisLink)
71  continue;
72 
73  // Check whether the stand-alone track matches a L2, if not, we will re-use this L2
74  const reco::TrackRef staTrack = link->standAloneTrack();
75  if (l2muRef == staTrack)
76  re_do_this_L2 = false;
77 
78  // Check the quality of the reconstructed L3, if poor quality, we will re-use this L2
79  if (staTrack == l2muRef && applyL3Filters_) {
80  re_do_this_L2 = true;
81  const reco::Track& globalTrack = *link->globalTrack();
82  if (globalTrack.numberOfValidHits() < min_Nhits_)
83  continue; // cut on number of hits
84  if (globalTrack.normalizedChi2() > max_NormalizedChi2_)
85  continue; //normalizedChi2 cut
86  if (globalTrack.hitPattern().numberOfValidMuonHits() < min_NmuonHits_)
87  continue; //min muon hits cut
88  if (std::abs(globalTrack.pt() - l2muRef->pt()) > max_PtDifference_ * globalTrack.pt())
89  continue; // pt difference
90  re_do_this_L2 = false;
91  }
92  }
93  }
94  if (re_do_this_L2)
95  result->push_back(*l2muRef); // used the L2 if no L3 if matched or if the matched L3 has poor quality cuts.
96  }
97  iEvent.put(std::move(result));
98 }
99 
102  desc.add<edm::InputTag>("l2Src", edm::InputTag("hltL2Muons", "UpdatedAtVtx"));
103  desc.add<edm::InputTag>("l3OISrc", edm::InputTag("hltNewOIL3MuonCandidates"));
104  desc.add<edm::InputTag>("InputLinks", edm::InputTag("hltNewOIL3MuonsLinksCombination"));
105  desc.add<bool>("applyL3Filters", true);
106  desc.add<int>("MinNhits", 1);
107  desc.add<double>("MaxNormalizedChi2", 20.0);
108  desc.add<int>("MinNmuonHits", 0);
109  desc.add<double>("MaxPtDifference", 999.0); //relative difference
110  descriptions.add("HLTMuonL2SelectorForL3IO", desc);
111 }
HLTMuonL2SelectorForL3IO::l3linkToken_
const edm::EDGetTokenT< reco::MuonTrackLinksCollection > l3linkToken_
Definition: HLTMuonL2SelectorForL3IO.h:44
HLTMuonL2SelectorForL3IO.h
cutBasedMuonId_MuonPOG_V0_cff.globalTrack
globalTrack
Definition: cutBasedMuonId_MuonPOG_V0_cff.py:135
HLTMuonL2SelectorForL3IO::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
default values
Definition: HLTMuonL2SelectorForL3IO.cc:100
electrons_cff.bool
bool
Definition: electrons_cff.py:366
MessageLogger.h
L3MuonTrajectorySeedCollection.h
MainPageGenerator.link
link
Definition: MainPageGenerator.py:271
HLTMuonL2SelectorForL3IO::HLTMuonL2SelectorForL3IO
HLTMuonL2SelectorForL3IO(const edm::ParameterSet &)
constructor with config
Definition: HLTMuonL2SelectorForL3IO.cc:17
HLTMuonL2SelectorForL3IO::produce
void produce(edm::Event &, const edm::EventSetup &) override
select muons
Definition: HLTMuonL2SelectorForL3IO.cc:34
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HLTMuonL2SelectorForL3IO::min_Nhits_
const int min_Nhits_
Definition: HLTMuonL2SelectorForL3IO.h:47
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
edm::Handle< reco::TrackCollection >
reco::RecoChargedCandidateCollection
std::vector< RecoChargedCandidate > RecoChargedCandidateCollection
collectin of RecoChargedCandidate objects
Definition: RecoChargedCandidateFwd.h:9
edm::Ref< TrackCollection >
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
HLTMuonL2SelectorForL3IO::min_NmuonHits_
const int min_NmuonHits_
Definition: HLTMuonL2SelectorForL3IO.h:47
reco::MuonTrackLinksCollection
std::vector< MuonTrackLinks > MuonTrackLinksCollection
collection of MuonTrackLinks
Definition: MuonFwd.h:22
reco::Track
Definition: Track.h:27
HLTMuonL2SelectorForL3IO::l2Src_
const edm::EDGetTokenT< reco::TrackCollection > l2Src_
Definition: HLTMuonL2SelectorForL3IO.h:42
L3MuonTrajectorySeed.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::ParameterSet
Definition: ParameterSet.h:47
deltaR.h
cand
Definition: decayParser.h:32
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
HLTMuonL2SelectorForL3IO::max_PtDifference_
const double max_PtDifference_
Definition: HLTMuonL2SelectorForL3IO.h:46
edm::EventSetup
Definition: EventSetup.h:58
HLTMuonL2SelectorForL3IO::max_NormalizedChi2_
const double max_NormalizedChi2_
Definition: HLTMuonL2SelectorForL3IO.h:46
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
HLTMuonOfflineAnalyzer_cfi.deltaR2
deltaR2
Definition: HLTMuonOfflineAnalyzer_cfi.py:105
electronStore.links
links
Definition: electronStore.py:149
HLTMuonL2SelectorForL3IO::~HLTMuonL2SelectorForL3IO
~HLTMuonL2SelectorForL3IO() override
destructor
Definition: HLTMuonL2SelectorForL3IO.cc:31
HLTMuonL2SelectorForL3IO::applyL3Filters_
const bool applyL3Filters_
Definition: HLTMuonL2SelectorForL3IO.h:45
mps_fire.result
result
Definition: mps_fire.py:311
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
HLTMuonL2SelectorForL3IO::l3OISrc_
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > l3OISrc_
Definition: HLTMuonL2SelectorForL3IO.h:43
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:40