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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginRun (const edm::Run &iRun, const edm::EventSetup &iSetup) override
 
 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::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

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_
 
pat::PATTriggerMatchSelector< bool, PATPrimitiveselector_
 
bool writeExtraInfo_
 Write out additional info as ValueMaps. More...
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 33 of file HLTL1MuonMatcher.cc.

Member Typedef Documentation

◆ PATPrimitive

Definition at line 50 of file HLTL1MuonMatcher.cc.

◆ PATPrimitiveCollection

Definition at line 51 of file HLTL1MuonMatcher.cc.

◆ PATTriggerAssociation

Definition at line 52 of file HLTL1MuonMatcher.cc.

Constructor & Destructor Documentation

◆ HLTL1MuonMatcher()

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

Definition at line 84 of file HLTL1MuonMatcher.cc.

85  : matcher_(iConfig),
87  l1Token_(consumes<PATPrimitiveCollection>(iConfig.getParameter<edm::InputTag>("matched"))),
88  selector_(iConfig),
89  resolveAmbiguities_(iConfig.getParameter<bool>("resolveAmbiguities")),
90  labelProp_(iConfig.getParameter<std::string>("setPropLabel")),
91  writeExtraInfo_(iConfig.existsAs<bool>("writeExtraInfo") ? iConfig.getParameter<bool>("writeExtraInfo") : false) {
92  produces<PATPrimitiveCollection>("propagatedReco"); // reco to muon station 2
93  produces<PATTriggerAssociation>("propagatedReco"); // asso reco to propagated reco
94  produces<PATTriggerAssociation>(); // asso reco to l1
95  if (writeExtraInfo_) {
96  produces<edm::ValueMap<float> >("deltaR");
97  produces<edm::ValueMap<float> >("deltaPhi");
98  }
99 }

References writeExtraInfo_.

◆ ~HLTL1MuonMatcher()

pat::HLTL1MuonMatcher::~HLTL1MuonMatcher ( )
inlineoverride

Definition at line 36 of file HLTL1MuonMatcher.cc.

36 {}

Member Function Documentation

◆ beginRun()

void pat::HLTL1MuonMatcher::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 168 of file HLTL1MuonMatcher.cc.

168 { matcher_.init(iSetup); }

◆ 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 43 of file HLTL1MuonMatcher.cc.

43  {
44  if (resolveAmbiguities_ && (std::find(lockedItems_.begin(), lockedItems_.end(), &l1) != lockedItems_.end()))
45  return false;
46  return selector_(false, l1);
47  }

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

◆ produce()

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

Implements edm::EDProducer.

Definition at line 101 of file HLTL1MuonMatcher.cc.

101  {
102  using namespace edm;
103  using namespace std;
104 
107 
108  iEvent.getByToken(recoToken_, reco);
109  iEvent.getByToken(l1Token_, l1s);
110 
111  unique_ptr<PATPrimitiveCollection> propOut(new PATPrimitiveCollection());
112  vector<int> propMatches(reco->size(), -1);
113  vector<int> fullMatches(reco->size(), -1);
114  vector<float> deltaRs(reco->size(), 999), deltaPhis(reco->size(), 999);
115  lockedItems_.clear();
116  for (int i = 0, n = reco->size(); i < n; ++i) {
117  TrajectoryStateOnSurface propagated;
118  const reco::Candidate &mu = (*reco)[i];
119  int match = matcher_.matchGeneric(mu, *l1s, *this, deltaRs[i], deltaPhis[i], propagated);
120  if (propagated.isValid()) {
121  GlobalPoint pos = propagated.globalPosition();
122  propMatches[i] = propOut->size();
123  propOut->push_back(PATPrimitive(math::PtEtaPhiMLorentzVector(mu.pt(), pos.eta(), pos.phi(), mu.mass())));
124  propOut->back().addFilterLabel(labelProp_);
125  propOut->back().setCharge(mu.charge());
126  }
127  fullMatches[i] = match;
128  if (match != -1) {
129  lockedItems_.push_back(&(*l1s)[match]);
130  }
131  }
132  lockedItems_.clear();
133 
134  OrphanHandle<PATPrimitiveCollection> propDone = iEvent.put(std::move(propOut), "propagatedReco");
135 
136  unique_ptr<PATTriggerAssociation> propAss(new PATTriggerAssociation(propDone));
137  PATTriggerAssociation::Filler propFiller(*propAss);
138  propFiller.insert(reco, propMatches.begin(), propMatches.end());
139  propFiller.fill();
140  iEvent.put(std::move(propAss), "propagatedReco");
141 
142  unique_ptr<PATTriggerAssociation> fullAss(new PATTriggerAssociation(l1s));
143  PATTriggerAssociation::Filler fullFiller(*fullAss);
144  fullFiller.insert(reco, fullMatches.begin(), fullMatches.end());
145  fullFiller.fill();
146  iEvent.put(std::move(fullAss));
147 
148  if (writeExtraInfo_) {
149  storeExtraInfo(iEvent, reco, deltaRs, "deltaR");
150  storeExtraInfo(iEvent, reco, deltaPhis, "deltaPhi");
151  }
152 }

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

◆ 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 155 of file HLTL1MuonMatcher.cc.

158  {
159  using namespace edm;
160  using namespace std;
161  unique_ptr<ValueMap<T> > valMap(new ValueMap<T>());
162  typename edm::ValueMap<T>::Filler filler(*valMap);
163  filler.insert(handle, values.begin(), values.end());
164  filler.fill();
165  iEvent.put(std::move(valMap), label);
166 }

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

Member Data Documentation

◆ l1Token_

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

Definition at line 58 of file HLTL1MuonMatcher.cc.

◆ labelProp_

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

Labels to set as filter names in the output.

Definition at line 66 of file HLTL1MuonMatcher.cc.

◆ lockedItems_

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

Definition at line 79 of file HLTL1MuonMatcher.cc.

Referenced by operator()().

◆ matcher_

L1MuonMatcherAlgo pat::HLTL1MuonMatcher::matcher_
private

Definition at line 54 of file HLTL1MuonMatcher.cc.

◆ recoToken_

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

Tokens for input collections.

Definition at line 57 of file HLTL1MuonMatcher.cc.

◆ resolveAmbiguities_

bool pat::HLTL1MuonMatcher::resolveAmbiguities_
private

Definition at line 63 of file HLTL1MuonMatcher.cc.

Referenced by operator()().

◆ selector_

pat::PATTriggerMatchSelector<bool, PATPrimitive> pat::HLTL1MuonMatcher::selector_
private

Select HLT objects. First template argument is dummy and useless,

Definition at line 62 of file HLTL1MuonMatcher.cc.

Referenced by operator()().

◆ writeExtraInfo_

bool pat::HLTL1MuonMatcher::writeExtraInfo_
private

Write out additional info as ValueMaps.

Definition at line 69 of file HLTL1MuonMatcher.cc.

Referenced by HLTL1MuonMatcher().

pat::HLTL1MuonMatcher::PATTriggerAssociation
pat::TriggerObjectStandAloneMatch PATTriggerAssociation
Definition: HLTL1MuonMatcher.cc:52
mps_fire.i
i
Definition: mps_fire.py:428
L1MuonMatcherAlgo::matchGeneric
int matchGeneric(const reco::Track &tk, const Collection &l1, const Selector &sel, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
Definition: L1MuonMatcherAlgo.h:125
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
patZpeak.handle
handle
Definition: patZpeak.py:23
edm
HLT enums.
Definition: AlignableModifier.h:19
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
pos
Definition: PixelAliasList.h:18
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
pat::HLTL1MuonMatcher::selector_
pat::PATTriggerMatchSelector< bool, PATPrimitive > selector_
Definition: HLTL1MuonMatcher.cc:62
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::Handle
Definition: AssociativeIterator.h:50
pat::HLTL1MuonMatcher::matcher_
L1MuonMatcherAlgo matcher_
Definition: HLTL1MuonMatcher.cc:54
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
L1Scalers_cfi.l1s
l1s
Definition: L1Scalers_cfi.py:5
pat::HLTL1MuonMatcher::lockedItems_
std::vector< const pat::TriggerObjectStandAlone * > lockedItems_
Definition: HLTL1MuonMatcher.cc:79
pat::HLTL1MuonMatcher::recoToken_
edm::EDGetTokenT< edm::View< reco::Candidate > > recoToken_
Tokens for input collections.
Definition: HLTL1MuonMatcher.cc:57
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
pat::HLTL1MuonMatcher::PATPrimitiveCollection
pat::TriggerObjectStandAloneCollection PATPrimitiveCollection
Definition: HLTL1MuonMatcher.cc:51
Point3DBase< float, GlobalTag >
pat::HLTL1MuonMatcher::storeExtraInfo
void storeExtraInfo(edm::Event &iEvent, const Hand &handle, const std::vector< T > &values, const std::string &label) const
Store extra information in a ValueMap.
Definition: HLTL1MuonMatcher.cc:155
pat::HLTL1MuonMatcher::PATPrimitive
pat::TriggerObjectStandAlone PATPrimitive
Definition: HLTL1MuonMatcher.cc:50
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::View
Definition: CaloClusterFwd.h:14
pat::HLTL1MuonMatcher::resolveAmbiguities_
bool resolveAmbiguities_
Definition: HLTL1MuonMatcher.cc:63
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
pat::HLTL1MuonMatcher::writeExtraInfo_
bool writeExtraInfo_
Write out additional info as ValueMaps.
Definition: HLTL1MuonMatcher.cc:69
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::ValueMap< int >::Filler
helper::Filler< ValueMap< int > > Filler
Definition: ValueMap.h:168
reco::Candidate
Definition: Candidate.h:27
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
edm::OrphanHandle
Definition: EDProductfwd.h:39
l1s
Definition: L1Scalers.h:16
edm::ValueMap
Definition: ValueMap.h:107
dt_dqm_sourceclient_common_cff.reco
reco
Definition: dt_dqm_sourceclient_common_cff.py:110
pat::HLTL1MuonMatcher::labelProp_
std::string labelProp_
Labels to set as filter names in the output.
Definition: HLTL1MuonMatcher.cc:66
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
math::PtEtaPhiMLorentzVector
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
edm::helper::Filler
Definition: ValueMap.h:22
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:153
pat::HLTL1MuonMatcher::l1Token_
edm::EDGetTokenT< PATPrimitiveCollection > l1Token_
Definition: HLTL1MuonMatcher.cc:58
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
L1MuonMatcherAlgo::init
void init(const edm::EventSetup &iSetup)
Definition: L1MuonMatcherAlgo.cc:16
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54