67 template <
typename Hand,
typename T>
70 const std::vector<T> &
values,
79 labelL1_(iConfig.getParameter<
std::
string>(
"setL1Label")),
80 labelProp_(iConfig.getParameter<
std::
string>(
"setPropLabel")),
81 writeExtraInfo_(iConfig.getParameter<
bool>(
"writeExtraInfo")),
82 useStage2L1_(iConfig.getParameter<
bool>(
"useStage2L1")),
83 firstBX_(iConfig.getParameter<
int>(
"firstBX")),
84 lastBX_(iConfig.getParameter<
int>(
"lastBX")) {
90 produces<PATPrimitiveCollection>(
"l1muons");
91 produces<PATPrimitiveCollection>(
"propagatedReco");
92 produces<PATTriggerAssociation>(
"propagatedReco");
93 produces<PATTriggerAssociation>();
95 produces<edm::ValueMap<float> >(
"deltaR");
96 produces<edm::ValueMap<float> >(
"deltaPhi");
97 produces<edm::ValueMap<int> >(
"quality");
98 produces<edm::ValueMap<int> >(
"bx");
100 produces<edm::ValueMap<int> >(
"iPhi");
101 produces<edm::ValueMap<int> >(
"tfIndex");
103 produces<edm::ValueMap<int> >(
"isolated");
104 produces<edm::ValueMap<reco::CandidatePtr> >();
105 produces<edm::ValueMap<reco::CandidatePtr> >(
"l1ToReco");
117 std::vector<l1t::Muon> l1ts;
118 std::vector<size_t> bxIdxs;
126 iEvent.getByToken(l1tToken_, l1tBX);
127 l1size = l1tBX->
size();
136 bxIdxs.push_back(l1tBX->
end(ibx) - l1tBX->
begin());
140 l1size =
l1s->size();
145 std::vector<edm::Ptr<reco::Candidate> > l1rawMatches(
reco->size());
146 vector<int> isSelected(l1size, -1);
147 std::vector<edm::Ptr<reco::Candidate> > whichRecoMatch(l1size);
148 vector<int> propMatches(
reco->size(), -1);
149 vector<int> fullMatches(
reco->size(), -1);
150 vector<float> deltaRs(
reco->size(), 999), deltaPhis(
reco->size(), 999);
152 vector<int> iPhi(
reco->size(), 0), tfIndex(
reco->size(), -999);
153 for (
int i = 0,
n =
reco->size();
i <
n; ++
i) {
156 int match = useStage2L1_ ? matcher_.match(
mu, l1ts, deltaRs[
i], deltaPhis[
i], propagated)
157 : matcher_.match(
mu, *
l1s, deltaRs[
i], deltaPhis[
i], propagated);
160 propMatches[
i] = propOut->size();
162 propOut->back().addFilterLabel(labelProp_);
163 propOut->back().setCharge(
mu.charge());
185 if (isSelected[
match] == -1) {
186 isSelected[
match] = l1Out->size();
188 l1Out->back().addFilterLabel(labelL1_);
189 l1Out->back().setCharge(
charge);
192 fullMatches[
i] = isSelected[
match];
200 iPhi[
i] =
l1t.hwPhi();
201 tfIndex[
i] =
l1t.tfMuonIndex();
217 propFiller.
insert(
reco, propMatches.begin(), propMatches.end());
223 fullFiller.
insert(
reco, fullMatches.begin(), fullMatches.end());
227 if (writeExtraInfo_) {
228 storeExtraInfo(
iEvent,
reco, deltaRs,
"deltaR");
229 storeExtraInfo(
iEvent,
reco, deltaPhis,
"deltaPhi");
233 storeExtraInfo(
iEvent,
reco, l1rawMatches,
"");
235 storeExtraInfo(
iEvent, l1tBX, whichRecoMatch,
"l1ToReco");
236 storeExtraInfo(
iEvent,
reco, tfIndex,
"tfIndex");
239 storeExtraInfo(
iEvent,
l1s, whichRecoMatch,
"l1ToReco");
244 template <
typename Hand,
typename T>
247 const std::vector<T> &
values,
251 unique_ptr<ValueMap<T> > valMap(
new ValueMap<T>());