CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< PATPrimitiveCollection
l1Token_
 
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
< PATPrimitive
selector_
 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

Definition at line 48 of file HLTL1MuonMatcher.cc.

Definition at line 49 of file HLTL1MuonMatcher.cc.

Definition at line 50 of file HLTL1MuonMatcher.cc.

Constructor & Destructor Documentation

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

Definition at line 81 of file HLTL1MuonMatcher.cc.

References edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), labelProp_, resolveAmbiguities_, AlCaHLTBitMon_QueryRunRegistry::string, and writeExtraInfo_.

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 }
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
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.
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::string labelProp_
Labels to set as filter names in the output.
edm::EDGetTokenT< PATPrimitiveCollection > l1Token_
pat::HLTL1MuonMatcher::~HLTL1MuonMatcher ( )
inlineoverride

Definition at line 36 of file HLTL1MuonMatcher.cc.

36 {}

Member Function Documentation

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.
void pat::HLTL1MuonMatcher::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 98 of file HLTL1MuonMatcher.cc.

References reco::Candidate::charge(), HLT_FULL_cff::deltaPhis, PV3DBase< T, PVType, FrameType >::eta(), edm::helper::Filler< Map >::fill(), edm::Event::getByToken(), TrajectoryStateOnSurface::globalPosition(), mps_fire::i, L1MuonMatcherAlgo::init(), edm::helper::Filler< Map >::insert(), TrajectoryStateOnSurface::isValid(), L1Scalers_cfi::l1s, l1Token_, labelProp_, lockedItems_, reco::Candidate::mass(), match(), matcher_, L1MuonMatcherAlgo::matchGeneric(), eostools::move(), RPCpg::mu, dqmiodumpmetadata::n, PV3DBase< T, PVType, FrameType >::phi(), reco::Candidate::pt(), edm::Event::put(), dt_dqm_sourceclient_common_cff::reco, recoToken_, storeExtraInfo(), and writeExtraInfo_.

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 }
void init(const edm::EventSetup &iSetup)
Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators...
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
virtual double pt() const =0
transverse momentum
virtual double mass() const =0
mass
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
GlobalPoint globalPosition() const
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
pat::TriggerObjectStandAlone PATPrimitive
def move
Definition: eostools.py:511
pat::TriggerObjectStandAloneCollection PATPrimitiveCollection
virtual int charge() const =0
electric charge
const int mu
Definition: Constants.h:22
bool writeExtraInfo_
Write out additional info as ValueMaps.
void storeExtraInfo(edm::Event &iEvent, const Hand &handle, const std::vector< T > &values, const std::string &label) const
Store extra information in a ValueMap.
helper::Filler< ValueMap< int > > Filler
Definition: ValueMap.h:168
int matchGeneric(const reco::Track &tk, const Collection &l1, const Selector &sel, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
T eta() const
Definition: PV3DBase.h:73
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
std::string labelProp_
Labels to set as filter names in the output.
edm::EDGetTokenT< PATPrimitiveCollection > l1Token_
pat::TriggerObjectStandAloneMatch PATTriggerAssociation
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 edm::helper::Filler< Map >::fill(), edm::helper::Filler< Map >::insert(), eostools::move(), and edm::Event::put().

Referenced by produce().

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 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
char const * label
def move
Definition: eostools.py:511
tuple handle
Definition: patZpeak.py:25

Member Data Documentation

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

Definition at line 56 of file HLTL1MuonMatcher.cc.

Referenced by produce().

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

Labels to set as filter names in the output.

Definition at line 63 of file HLTL1MuonMatcher.cc.

Referenced by HLTL1MuonMatcher(), and produce().

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

Definition at line 76 of file HLTL1MuonMatcher.cc.

Referenced by operator()(), and produce().

L1MuonMatcherAlgo pat::HLTL1MuonMatcher::matcher_
private

Definition at line 52 of file HLTL1MuonMatcher.cc.

Referenced by produce().

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

Tokens for input collections.

Definition at line 55 of file HLTL1MuonMatcher.cc.

Referenced by produce().

bool pat::HLTL1MuonMatcher::resolveAmbiguities_
private

Definition at line 60 of file HLTL1MuonMatcher.cc.

Referenced by HLTL1MuonMatcher(), and operator()().

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

Select HLT objects.

Definition at line 59 of file HLTL1MuonMatcher.cc.

Referenced by operator()().

bool pat::HLTL1MuonMatcher::writeExtraInfo_
private

Write out additional info as ValueMaps.

Definition at line 66 of file HLTL1MuonMatcher.cc.

Referenced by HLTL1MuonMatcher(), and produce().