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
 
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)
 
 ~ProducerBase () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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 wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 34 of file HLTL1MuonMatcher.cc.

Member Typedef Documentation

Definition at line 50 of file HLTL1MuonMatcher.cc.

Definition at line 51 of file HLTL1MuonMatcher.cc.

Definition at line 52 of file HLTL1MuonMatcher.cc.

Constructor & Destructor Documentation

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

Definition at line 84 of file HLTL1MuonMatcher.cc.

References writeExtraInfo_.

84  :
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 {
93  produces<PATPrimitiveCollection>("propagatedReco"); // reco to muon station 2
94  produces<PATTriggerAssociation>("propagatedReco"); // asso reco to propagated reco
95  produces<PATTriggerAssociation>(); // asso reco to l1
96  if (writeExtraInfo_) {
97  produces<edm::ValueMap<float> >("deltaR");
98  produces<edm::ValueMap<float> >("deltaPhi");
99  }
100 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
L1MuonMatcherAlgo matcher_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::View< reco::Candidate > > recoToken_
Tokens for input collections.
bool writeExtraInfo_
Write out additional info as ValueMaps.
pat::PATTriggerMatchSelector< bool, PATPrimitive > selector_
std::string labelProp_
Labels to set as filter names in the output.
edm::EDGetTokenT< PATPrimitiveCollection > l1Token_
pat::HLTL1MuonMatcher::~HLTL1MuonMatcher ( )
inlineoverride

Definition at line 37 of file HLTL1MuonMatcher.cc.

References beginRun(), iEvent, and produce().

37 { }

Member Function Documentation

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

Definition at line 172 of file HLTL1MuonMatcher.cc.

References DEFINE_FWK_MODULE, L1MuonMatcherAlgo::init(), and matcher_.

Referenced by ~HLTL1MuonMatcher().

172  {
173  matcher_.init(iSetup);
174 }
void init(const edm::EventSetup &iSetup)
Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators...
L1MuonMatcherAlgo matcher_
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 45 of file HLTL1MuonMatcher.cc.

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

45  {
46  if (resolveAmbiguities_ && (std::find(lockedItems_.begin(), lockedItems_.end(), &l1) != lockedItems_.end())) return false;
47  return selector_(false,l1);
48  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::vector< const pat::TriggerObjectStandAlone * > lockedItems_
pat::PATTriggerMatchSelector< bool, PATPrimitive > selector_
void pat::HLTL1MuonMatcher::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 103 of file HLTL1MuonMatcher.cc.

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

Referenced by ~HLTL1MuonMatcher().

103  {
104  using namespace edm;
105  using namespace std;
106 
109 
110  iEvent.getByToken(recoToken_, reco);
111  iEvent.getByToken(l1Token_, l1s);
112 
113  unique_ptr<PATPrimitiveCollection> propOut(new PATPrimitiveCollection());
114  vector<int> propMatches(reco->size(), -1);
115  vector<int> fullMatches(reco->size(), -1);
116  vector<float> deltaRs(reco->size(), 999), deltaPhis(reco->size(), 999);
117  lockedItems_.clear();
118  for (int i = 0, n = reco->size(); i < n; ++i) {
119  TrajectoryStateOnSurface propagated;
120  const reco::Candidate &mu = (*reco)[i];
121  int match = matcher_.matchGeneric(mu, *l1s, *this, deltaRs[i], deltaPhis[i], propagated);
122  if (propagated.isValid()) {
123  GlobalPoint pos = propagated.globalPosition();
124  propMatches[i] = propOut->size();
125  propOut->push_back(PATPrimitive(math::PtEtaPhiMLorentzVector(mu.pt(), pos.eta(), pos.phi(), mu.mass())));
126  propOut->back().addFilterLabel(labelProp_);
127  propOut->back().setCharge(mu.charge());
128  }
129  fullMatches[i] = match;
130  if (match != -1) {
131  lockedItems_.push_back(&(*l1s)[match]);
132  }
133  }
134  lockedItems_.clear();
135 
136  OrphanHandle<PATPrimitiveCollection> propDone = iEvent.put(std::move(propOut), "propagatedReco");
137 
138  unique_ptr<PATTriggerAssociation> propAss(new PATTriggerAssociation(propDone));
139  PATTriggerAssociation::Filler propFiller(*propAss);
140  propFiller.insert(reco, propMatches.begin(), propMatches.end());
141  propFiller.fill();
142  iEvent.put(std::move(propAss), "propagatedReco");
143 
144  unique_ptr<PATTriggerAssociation> fullAss(new PATTriggerAssociation(l1s));
145  PATTriggerAssociation::Filler fullFiller(*fullAss);
146  fullFiller.insert(reco, fullMatches.begin(), fullMatches.end());
147  fullFiller.fill();
148  iEvent.put(std::move(fullAss));
149 
150  if (writeExtraInfo_) {
151  storeExtraInfo(iEvent, reco, deltaRs, "deltaR");
152  storeExtraInfo(iEvent, reco, deltaPhis, "deltaPhi");
153  }
154 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
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
pat::TriggerObjectStandAloneCollection PATPrimitiveCollection
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:169
virtual double pt() const =0
transverse momentum
virtual double mass() const =0
mass
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:76
virtual int charge() const =0
electric charge
HLT enums.
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.
def move(src, dest)
Definition: eostools.py:510
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 158 of file HLTL1MuonMatcher.cc.

References edm::helper::Filler< Map >::fill(), objects.autophobj::filler, edm::helper::Filler< Map >::insert(), eostools::move(), and edm::Event::put().

Referenced by produce().

161  {
162  using namespace edm; using namespace std;
163  unique_ptr<ValueMap<T> > valMap(new ValueMap<T>());
164  typename edm::ValueMap<T>::Filler filler(*valMap);
165  filler.insert(handle, values.begin(), values.end());
166  filler.fill();
167  iEvent.put(std::move(valMap), label);
168 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
HLT enums.
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

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

Definition at line 58 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 66 of file HLTL1MuonMatcher.cc.

Referenced by produce().

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

Definition at line 79 of file HLTL1MuonMatcher.cc.

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

L1MuonMatcherAlgo pat::HLTL1MuonMatcher::matcher_
private

Definition at line 54 of file HLTL1MuonMatcher.cc.

Referenced by beginRun(), and produce().

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

Tokens for input collections.

Definition at line 57 of file HLTL1MuonMatcher.cc.

Referenced by produce().

bool pat::HLTL1MuonMatcher::resolveAmbiguities_
private

Definition at line 63 of file HLTL1MuonMatcher.cc.

Referenced by operator()().

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()().

bool pat::HLTL1MuonMatcher::writeExtraInfo_
private

Write out additional info as ValueMaps.

Definition at line 69 of file HLTL1MuonMatcher.cc.

Referenced by HLTL1MuonMatcher(), and produce().