CMS 3D CMS Logo

HLT2L1TkMuonL1TkMuonMuRefDR.cc
Go to the documentation of this file.
1 #include <cmath>
2 
14 
16 
17 //
18 // constructors and destructor
19 //
21  : HLTFilter(iConfig),
22  originTag1_(iConfig.getParameter<std::vector<edm::InputTag>>("originTag1")),
23  originTag2_(iConfig.getParameter<std::vector<edm::InputTag>>("originTag2")),
24  inputTag1_(iConfig.getParameter<edm::InputTag>("inputTag1")),
25  inputTag2_(iConfig.getParameter<edm::InputTag>("inputTag2")),
26  inputToken1_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag1_)),
27  inputToken2_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag2_)),
28  minDR_(iConfig.getParameter<double>("MinDR")),
29  min_N_(iConfig.getParameter<int>("MinN")),
30  same_(inputTag1_.encode() == inputTag2_.encode()) {} // same collections to be compared?
31 
33 
37  std::vector<edm::InputTag> originTag1(1, edm::InputTag("hltOriginal1"));
38  std::vector<edm::InputTag> originTag2(1, edm::InputTag("hltOriginal2"));
39  desc.add<std::vector<edm::InputTag>>("originTag1", originTag1);
40  desc.add<std::vector<edm::InputTag>>("originTag2", originTag2);
41  desc.add<edm::InputTag>("inputTag1", edm::InputTag("hltFiltered1"));
42  desc.add<edm::InputTag>("inputTag2", edm::InputTag("hltFiltered2"));
43  desc.add<double>("MinDR", -1.0);
44  desc.add<int>("MinN", 1);
45 
46  descriptions.add("hlt2L1TkMuonL1TkMuonMuRefDR", desc);
47 }
48 
50  std::vector<l1t::TkMuonRef>& coll1,
51  std::vector<l1t::TkMuonRef>& coll2,
52  trigger::TriggerFilterObjectWithRefs& filterproduct) const {
54  if (iEvent.getByToken(inputToken1_, handle1) and iEvent.getByToken(inputToken2_, handle2)) {
55  // get hold of pre-filtered object collections
58  const trigger::size_type n1(coll1.size());
59  const trigger::size_type n2(coll2.size());
60 
61  if (saveTags()) {
62  edm::InputTag tagOld;
63  for (unsigned int i = 0; i < originTag1_.size(); ++i) {
64  filterproduct.addCollectionTag(originTag1_[i]);
65  }
66  tagOld = edm::InputTag();
67  for (trigger::size_type i1 = 0; i1 != n1; ++i1) {
68  const edm::ProductID pid(coll1[i1].id());
69  const std::string& label(iEvent.getProvenance(pid).moduleLabel());
70  const std::string& instance(iEvent.getProvenance(pid).productInstanceName());
71  const std::string& process(iEvent.getProvenance(pid).processName());
73  if (tagOld.encode() != tagNew.encode()) {
74  filterproduct.addCollectionTag(tagNew);
75  tagOld = tagNew;
76  }
77  }
78  for (unsigned int i = 0; i < originTag2_.size(); ++i) {
79  filterproduct.addCollectionTag(originTag2_[i]);
80  }
81  tagOld = edm::InputTag();
82  for (trigger::size_type i2 = 0; i2 != n2; ++i2) {
83  const edm::ProductID pid(coll2[i2].id());
84  const std::string& label(iEvent.getProvenance(pid).moduleLabel());
85  const std::string& instance(iEvent.getProvenance(pid).productInstanceName());
86  const std::string& process(iEvent.getProvenance(pid).processName());
88  if (tagOld.encode() != tagNew.encode()) {
89  filterproduct.addCollectionTag(tagNew);
90  tagOld = tagNew;
91  }
92  }
93  }
94 
95  return true;
96  } else
97  return false;
98 }
99 
100 std::pair<float, float> HLT2L1TkMuonL1TkMuonMuRefDR::convertEtaPhi(l1t::TkMuonRef& tkmu) const {
101  float muRefEta = 0.;
102  float muRefPhi = 0.;
103 
104  if (tkmu->muonDetector() != emtfRegion_) {
105  if (tkmu->muRef().isNull())
106  return std::make_pair(muRefEta, muRefPhi);
107 
108  muRefEta = tkmu->muRef()->hwEta() * etaScale_;
109  muRefPhi = static_cast<float>(l1t::MicroGMTConfiguration::calcGlobalPhi(
110  tkmu->muRef()->hwPhi(), tkmu->muRef()->trackFinderType(), tkmu->muRef()->processor()));
111  muRefPhi = muRefPhi * phiScale_;
112  } else {
113  if (tkmu->emtfTrk().isNull())
114  return std::make_pair(muRefEta, muRefPhi);
115 
116  muRefEta = tkmu->emtfTrk()->Eta();
117  muRefPhi = angle_units::operators::convertDegToRad(tkmu->emtfTrk()->Phi_glob());
118  }
119  muRefPhi = reco::reduceRange(muRefPhi);
120 
121  return std::make_pair(muRefEta, muRefPhi);
122 }
123 
125  if (minDR_ < 0.)
126  return true;
127 
128  auto [eta1, phi1] = convertEtaPhi(r1);
129  auto [eta2, phi2] = convertEtaPhi(r2);
130  return (reco::deltaR2(eta1, phi1, eta2, phi2) > minDR_ * minDR_);
131 }
132 
133 // ------------ method called to produce the data ------------
135  const edm::EventSetup& iSetup,
136  trigger::TriggerFilterObjectWithRefs& filterproduct) const {
137  // All HLT filters must create and fill an HLT filter object,
138  // recording any reconstructed physics objects satisfying (or not)
139  // this HLT filter, and place it in the Event.
140  bool accept(false);
141 
142  std::vector<l1t::TkMuonRef> coll1;
143  std::vector<l1t::TkMuonRef> coll2;
144 
145  if (getCollections(iEvent, coll1, coll2, filterproduct)) {
146  int n(0);
149 
150  for (unsigned int i1 = 0; i1 != coll1.size(); i1++) {
151  r1 = coll1[i1];
152  unsigned int I(0);
153  if (same_) {
154  I = i1 + 1;
155  }
156  for (unsigned int i2 = I; i2 != coll2.size(); i2++) {
157  r2 = coll2[i2];
158 
159  if (!computeDR(iEvent, r1, r2))
160  continue;
161 
162  n++;
165  }
166  }
167 
168  accept = accept || (n >= min_N_);
169  }
170 
171  return accept;
172 }
173 
defaultModuleLabel.h
trigger::TriggerRefsCollections::addObject
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref<C>)
Definition: TriggerRefsCollections.h:299
trigger::TriggerFilterObjectWithRefs
Definition: TriggerFilterObjectWithRefs.h:35
testProducerWithPsetDescEmpty_cfi.i2
i2
Definition: testProducerWithPsetDescEmpty_cfi.py:46
Handle.h
HLT2L1TkMuonL1TkMuonMuRefDR
Definition: HLT2L1TkMuonL1TkMuonMuRefDR.h:23
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
edm::Ref::isNull
bool isNull() const
Checks for null.
Definition: Ref.h:235
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT2L1TkMuonL1TkMuonMuRefDR::etaScale_
static constexpr float etaScale_
Definition: HLT2L1TkMuonL1TkMuonMuRefDR.h:52
testProducerWithPsetDescEmpty_cfi.i1
i1
Definition: testProducerWithPsetDescEmpty_cfi.py:45
HLT2L1TkMuonL1TkMuonMuRefDR::minDR_
const double minDR_
Definition: HLT2L1TkMuonL1TkMuonMuRefDR.h:46
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
trigger::TriggerFilterObjectWithRefs::addCollectionTag
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
Definition: TriggerFilterObjectWithRefs.h:55
angle_units::operators::convertDegToRad
constexpr long double convertDegToRad(NumType degrees)
Definition: angle_units.h:27
HLT2L1TkMuonL1TkMuonMuRefDR::originTag1_
const std::vector< edm::InputTag > originTag1_
Definition: HLT2L1TkMuonL1TkMuonMuRefDR.h:40
TriggerFilterObjectWithRefs.h
edm::Handle< trigger::TriggerFilterObjectWithRefs >
trigger::TriggerRefsCollections::getObjects
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
Definition: TriggerRefsCollections.h:590
HLTFilter
Definition: HLTFilter.h:28
edm::Ref
Definition: AssociativeIterator.h:58
l1t::MicroGMTConfiguration::calcGlobalPhi
static int calcGlobalPhi(int locPhi, tftype t, int proc)
Definition: MicroGMTConfiguration.cc:11
TkMuon.h
HLT2L1TkMuonL1TkMuonMuRefDR::originTag2_
const std::vector< edm::InputTag > originTag2_
Definition: HLT2L1TkMuonL1TkMuonMuRefDR.h:41
HLT2L1TkMuonL1TkMuonMuRefDR::HLT2L1TkMuonL1TkMuonMuRefDR
HLT2L1TkMuonL1TkMuonMuRefDR(const edm::ParameterSet &)
Definition: HLT2L1TkMuonL1TkMuonMuRefDR.cc:20
accept
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
MakerMacros.h
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Exhume::I
const std::complex< double > I
Definition: I.h:8
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
MicroGMTConfiguration.h
HLT2L1TkMuonL1TkMuonMuRefDR::phiScale_
static constexpr float phiScale_
Definition: HLT2L1TkMuonL1TkMuonMuRefDR.h:53
HLT_FULL_cff.eta2
eta2
Definition: HLT_FULL_cff.py:9542
HLT2L1TkMuonL1TkMuonMuRefDR::min_N_
const int min_N_
Definition: HLT2L1TkMuonL1TkMuonMuRefDR.h:47
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLT_FULL_cff.eta1
eta1
Definition: HLT_FULL_cff.py:9541
HLT2L1TkMuonL1TkMuonMuRefDR::inputToken2_
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > inputToken2_
Definition: HLT2L1TkMuonL1TkMuonMuRefDR.h:45
edm::ParameterSet
Definition: ParameterSet.h:47
HLTFilter::saveTags
bool saveTags() const
Definition: HLTFilter.h:46
HLT2L1TkMuonL1TkMuonMuRefDR::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HLT2L1TkMuonL1TkMuonMuRefDR.cc:34
HLT2L1TkMuonL1TkMuonMuRefDR::hltFilter
bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
Definition: HLT2L1TkMuonL1TkMuonMuRefDR.cc:134
deltaR.h
HLT2L1TkMuonL1TkMuonMuRefDR::computeDR
bool computeDR(edm::Event &iEvent, l1t::TkMuonRef &c1, l1t::TkMuonRef &c2) const
Definition: HLT2L1TkMuonL1TkMuonMuRefDR.cc:124
LaserDQM_cfg.process
process
Definition: LaserDQM_cfg.py:3
reco::deltaR2
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
HLT2L1TkMuonL1TkMuonMuRefDR::convertEtaPhi
std::pair< float, float > convertEtaPhi(l1t::TkMuonRef &tkmu) const
Definition: HLT2L1TkMuonL1TkMuonMuRefDR.cc:100
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
HLT2L1TkMuonL1TkMuonMuRefDR::inputToken1_
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > inputToken1_
Definition: HLT2L1TkMuonL1TkMuonMuRefDR.h:44
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
HLT2L1TkMuonL1TkMuonMuRefDR::getCollections
bool getCollections(edm::Event &iEvent, std::vector< l1t::TkMuonRef > &coll1, std::vector< l1t::TkMuonRef > &coll2, trigger::TriggerFilterObjectWithRefs &filterproduct) const
Definition: HLT2L1TkMuonL1TkMuonMuRefDR.cc:49
edm::InputTag::encode
std::string encode() const
Definition: InputTag.cc:159
edm::EventSetup
Definition: EventSetup.h:58
instance
static PFTauRenderPlugin instance
Definition: PFTauRenderPlugin.cc:70
HLT2L1TkMuonL1TkMuonMuRefDR::emtfRegion_
static constexpr unsigned int emtfRegion_
Definition: HLT2L1TkMuonL1TkMuonMuRefDR.h:51
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
std
Definition: JetResolutionObject.h:76
Ref.h
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
alcaDQMUpload.encode
def encode(args, files)
Definition: alcaDQMUpload.py:32
HLT_FULL_cff.originTag2
originTag2
Definition: HLT_FULL_cff.py:19401
HLT2L1TkMuonL1TkMuonMuRefDR::same_
const bool same_
Definition: HLT2L1TkMuonL1TkMuonMuRefDR.h:48
HLT2L1TkMuonL1TkMuonMuRefDR::~HLT2L1TkMuonL1TkMuonMuRefDR
~HLT2L1TkMuonL1TkMuonMuRefDR() override
Definition: HLT2L1TkMuonL1TkMuonMuRefDR.cc:32
HLTFilter::makeHLTFilterDescription
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
Definition: HLTFilter.cc:25
trigger::TriggerL1TkMu
This has all to be decided for Phase-2. Here is Thiago's proposal.
Definition: TriggerTypeDefs.h:64
trigger
Definition: HLTPrescaleTableCond.h:8
HLT_FULL_cff.originTag1
originTag1
Definition: HLT_FULL_cff.py:19404
ParameterSet.h
HLT2L1TkMuonL1TkMuonMuRefDR.h
edm::Event
Definition: Event.h:73
TkMuonFwd.h
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
edm::ProductID
Definition: ProductID.h:27
reco::reduceRange
constexpr T reduceRange(T x)
Definition: deltaPhi.h:18