CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
pat::HLTL1MuonMatcher Class Reference
Inheritance diagram for pat::HLTL1MuonMatcher:
edm::stream::EDProducer<>

Public Member Functions

 HLTL1MuonMatcher (const edm::ParameterSet &iConfig)
 
bool operator() (const pat::TriggerObjectStandAlone &l1) const
 select L1s with patName_ and filterLabel_ (public, so it can be used by L1MuonMatcherAlgo) More...
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~HLTL1MuonMatcher () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Types

typedef pat::TriggerObjectStandAlone PATPrimitive
 
typedef pat::TriggerObjectStandAloneCollection PATPrimitiveCollection
 
typedef pat::TriggerObjectStandAloneMatch PATTriggerAssociation
 

Private Member Functions

template<typename Hand , typename T >
void storeExtraInfo (edm::Event &iEvent, const Hand &handle, const std::vector< T > &values, const std::string &label) const
 Store extra information in a ValueMap. More...
 

Private Attributes

edm::EDGetTokenT< PATPrimitiveCollectionl1Token_
 
std::string labelProp_
 Labels to set as filter names in the output. More...
 
std::vector< const pat::TriggerObjectStandAlone * > lockedItems_
 
L1MuonMatcherAlgo matcher_
 
edm::EDGetTokenT< edm::View< reco::Candidate > > recoToken_
 Tokens for input collections. More...
 
bool resolveAmbiguities_
 
StringCutObjectSelector< PATPrimitiveselector_
 Select HLT objects. More...
 
bool writeExtraInfo_
 Write out additional info as ValueMaps. More...
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 33 of file HLTL1MuonMatcher.cc.

Member Typedef Documentation

◆ PATPrimitive

Definition at line 48 of file HLTL1MuonMatcher.cc.

◆ PATPrimitiveCollection

Definition at line 49 of file HLTL1MuonMatcher.cc.

◆ PATTriggerAssociation

Definition at line 50 of file HLTL1MuonMatcher.cc.

Constructor & Destructor Documentation

◆ HLTL1MuonMatcher()

pat::HLTL1MuonMatcher::HLTL1MuonMatcher ( const edm::ParameterSet iConfig)
explicit

Definition at line 81 of file HLTL1MuonMatcher.cc.

References edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

82  : matcher_(iConfig, consumesCollector()),
84  l1Token_(consumes<PATPrimitiveCollection>(iConfig.getParameter<edm::InputTag>("matched"))),
85  selector_{iConfig.getParameter<std::string>("matchedCuts")},
86  resolveAmbiguities_(iConfig.getParameter<bool>("resolveAmbiguities")),
87  labelProp_(iConfig.getParameter<std::string>("setPropLabel")),
88  writeExtraInfo_(iConfig.existsAs<bool>("writeExtraInfo") ? iConfig.getParameter<bool>("writeExtraInfo") : false) {
89  produces<PATPrimitiveCollection>("propagatedReco"); // reco to muon station 2
90  produces<PATTriggerAssociation>("propagatedReco"); // asso reco to propagated reco
91  produces<PATTriggerAssociation>(); // asso reco to l1
92  if (writeExtraInfo_) {
93  produces<edm::ValueMap<float> >("deltaR");
94  produces<edm::ValueMap<float> >("deltaPhi");
95  }
96 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:172
L1MuonMatcherAlgo matcher_
edm::EDGetTokenT< edm::View< reco::Candidate > > recoToken_
Tokens for input collections.
bool writeExtraInfo_
Write out additional info as ValueMaps.
StringCutObjectSelector< PATPrimitive > selector_
Select HLT objects.
std::string labelProp_
Labels to set as filter names in the output.
edm::EDGetTokenT< PATPrimitiveCollection > l1Token_

◆ ~HLTL1MuonMatcher()

pat::HLTL1MuonMatcher::~HLTL1MuonMatcher ( )
inlineoverride

Definition at line 36 of file HLTL1MuonMatcher.cc.

36 {}

Member Function Documentation

◆ operator()()

bool pat::HLTL1MuonMatcher::operator() ( const pat::TriggerObjectStandAlone l1) const
inline

select L1s with patName_ and filterLabel_ (public, so it can be used by L1MuonMatcherAlgo)

Definition at line 41 of file HLTL1MuonMatcher.cc.

References spr::find(), lockedItems_, resolveAmbiguities_, and selector_.

41  {
42  if (resolveAmbiguities_ && (std::find(lockedItems_.begin(), lockedItems_.end(), &l1) != lockedItems_.end()))
43  return false;
44  return selector_(l1);
45  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< const pat::TriggerObjectStandAlone * > lockedItems_
StringCutObjectSelector< PATPrimitive > selector_
Select HLT objects.

◆ produce()

void pat::HLTL1MuonMatcher::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 98 of file HLTL1MuonMatcher.cc.

References HLT_2023v12_cff::deltaPhis, edm::helper::Filler< Map >::fill(), TrajectoryStateOnSurface::globalPosition(), mps_fire::i, iEvent, edm::helper::Filler< Map >::insert(), TrajectoryStateOnSurface::isValid(), L1Scalers_cfi::l1s, eostools::move(), amptDefaultParameters_cff::mu, dqmiodumpmetadata::n, and dt_dqm_sourceclient_common_cff::reco.

98  {
99  using namespace edm;
100  using namespace std;
101 
102  matcher_.init(iSetup);
103 
106 
107  iEvent.getByToken(recoToken_, reco);
108  iEvent.getByToken(l1Token_, l1s);
109 
110  unique_ptr<PATPrimitiveCollection> propOut(new PATPrimitiveCollection());
111  vector<int> propMatches(reco->size(), -1);
112  vector<int> fullMatches(reco->size(), -1);
113  vector<float> deltaRs(reco->size(), 999), deltaPhis(reco->size(), 999);
114  lockedItems_.clear();
115  for (int i = 0, n = reco->size(); i < n; ++i) {
116  TrajectoryStateOnSurface propagated;
117  const reco::Candidate &mu = (*reco)[i];
118  int match = matcher_.matchGeneric(mu, *l1s, *this, deltaRs[i], deltaPhis[i], propagated);
119  if (propagated.isValid()) {
120  GlobalPoint pos = propagated.globalPosition();
121  propMatches[i] = propOut->size();
122  propOut->push_back(PATPrimitive(math::PtEtaPhiMLorentzVector(mu.pt(), pos.eta(), pos.phi(), mu.mass())));
123  propOut->back().addFilterLabel(labelProp_);
124  propOut->back().setCharge(mu.charge());
125  }
126  fullMatches[i] = match;
127  if (match != -1) {
128  lockedItems_.push_back(&(*l1s)[match]);
129  }
130  }
131  lockedItems_.clear();
132 
133  OrphanHandle<PATPrimitiveCollection> propDone = iEvent.put(std::move(propOut), "propagatedReco");
134 
135  unique_ptr<PATTriggerAssociation> propAss(new PATTriggerAssociation(propDone));
136  PATTriggerAssociation::Filler propFiller(*propAss);
137  propFiller.insert(reco, propMatches.begin(), propMatches.end());
138  propFiller.fill();
139  iEvent.put(std::move(propAss), "propagatedReco");
140 
141  unique_ptr<PATTriggerAssociation> fullAss(new PATTriggerAssociation(l1s));
142  PATTriggerAssociation::Filler fullFiller(*fullAss);
143  fullFiller.insert(reco, fullMatches.begin(), fullMatches.end());
144  fullFiller.fill();
145  iEvent.put(std::move(fullAss));
146 
147  if (writeExtraInfo_) {
148  storeExtraInfo(iEvent, reco, deltaRs, "deltaR");
149  storeExtraInfo(iEvent, reco, deltaPhis, "deltaPhi");
150  }
151 }
Definition: L1Scalers.h:16
L1MuonMatcherAlgo matcher_
std::vector< const pat::TriggerObjectStandAlone * > lockedItems_
edm::EDGetTokenT< edm::View< reco::Candidate > > recoToken_
Tokens for input collections.
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
int iEvent
Definition: GenABIO.cc:224
GlobalPoint globalPosition() const
pat::TriggerObjectStandAlone PATPrimitive
pat::TriggerObjectStandAloneCollection PATPrimitiveCollection
void storeExtraInfo(edm::Event &iEvent, const Hand &handle, const std::vector< T > &values, const std::string &label) const
Store extra information in a ValueMap.
bool writeExtraInfo_
Write out additional info as ValueMaps.
helper::Filler< ValueMap< int > > Filler
Definition: ValueMap.h:162
fixed size matrix
HLT enums.
std::string labelProp_
Labels to set as filter names in the output.
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< PATPrimitiveCollection > l1Token_
pat::TriggerObjectStandAloneMatch PATTriggerAssociation

◆ storeExtraInfo()

template<typename Hand , typename T >
void pat::HLTL1MuonMatcher::storeExtraInfo ( edm::Event iEvent,
const Hand &  handle,
const std::vector< T > &  values,
const std::string &  label 
) const
private

Store extra information in a ValueMap.

Definition at line 154 of file HLTL1MuonMatcher.cc.

References trigObjTnPSource_cfi::filler, patZpeak::handle, iEvent, label, eostools::move(), and contentValuesCheck::values.

157  {
158  using namespace edm;
159  using namespace std;
160  unique_ptr<ValueMap<T> > valMap(new ValueMap<T>());
161  typename edm::ValueMap<T>::Filler filler(*valMap);
162  filler.insert(handle, values.begin(), values.end());
163  filler.fill();
164  iEvent.put(std::move(valMap), label);
165 }
char const * label
int iEvent
Definition: GenABIO.cc:224
HLT enums.
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ l1Token_

edm::EDGetTokenT<PATPrimitiveCollection> pat::HLTL1MuonMatcher::l1Token_
private

Definition at line 56 of file HLTL1MuonMatcher.cc.

◆ labelProp_

std::string pat::HLTL1MuonMatcher::labelProp_
private

Labels to set as filter names in the output.

Definition at line 63 of file HLTL1MuonMatcher.cc.

◆ lockedItems_

std::vector<const pat::TriggerObjectStandAlone *> pat::HLTL1MuonMatcher::lockedItems_
private

Definition at line 76 of file HLTL1MuonMatcher.cc.

Referenced by operator()().

◆ matcher_

L1MuonMatcherAlgo pat::HLTL1MuonMatcher::matcher_
private

Definition at line 52 of file HLTL1MuonMatcher.cc.

◆ recoToken_

edm::EDGetTokenT<edm::View<reco::Candidate> > pat::HLTL1MuonMatcher::recoToken_
private

Tokens for input collections.

Definition at line 55 of file HLTL1MuonMatcher.cc.

◆ resolveAmbiguities_

bool pat::HLTL1MuonMatcher::resolveAmbiguities_
private

Definition at line 60 of file HLTL1MuonMatcher.cc.

Referenced by operator()().

◆ selector_

StringCutObjectSelector<PATPrimitive> pat::HLTL1MuonMatcher::selector_
private

Select HLT objects.

Definition at line 59 of file HLTL1MuonMatcher.cc.

Referenced by operator()().

◆ writeExtraInfo_

bool pat::HLTL1MuonMatcher::writeExtraInfo_
private

Write out additional info as ValueMaps.

Definition at line 66 of file HLTL1MuonMatcher.cc.