CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual 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...
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
virtual ~HLTL1MuonMatcher ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::InputTag l1_
 
std::string labelProp_
 Labels to set as filter names in the output. More...
 
std::vector< const
pat::TriggerObjectStandAlone * > 
lockedItems_
 
L1MuonMatcherAlgo matcher_
 
edm::InputTag reco_
 Labels for input collections. More...
 
bool resolveAmbiguities_
 
pat::PATTriggerMatchSelector
< bool, PATPrimitive
selector_
 
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
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 83 of file HLTL1MuonMatcher.cc.

References writeExtraInfo_.

83  :
84  matcher_(iConfig),
85  reco_(iConfig.getParameter<edm::InputTag>("src")),
86  l1_(iConfig.getParameter<edm::InputTag>("matched")),
87  selector_(iConfig),
88  resolveAmbiguities_(iConfig.getParameter<bool>("resolveAmbiguities")),
89  labelProp_(iConfig.getParameter<std::string>("setPropLabel")),
90  writeExtraInfo_(iConfig.existsAs<bool>("writeExtraInfo") ? iConfig.getParameter<bool>("writeExtraInfo") : false)
91 {
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 }
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:184
L1MuonMatcherAlgo matcher_
bool writeExtraInfo_
Write out additional info as ValueMaps.
edm::InputTag reco_
Labels for input collections.
pat::PATTriggerMatchSelector< bool, PATPrimitive > selector_
std::string labelProp_
Labels to set as filter names in the output.
virtual pat::HLTL1MuonMatcher::~HLTL1MuonMatcher ( )
inlinevirtual

Definition at line 37 of file HLTL1MuonMatcher.cc.

37 { }

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 171 of file HLTL1MuonMatcher.cc.

171  {
172  matcher_.init(iSetup);
173 }
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_(0,l1);
48  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< const pat::TriggerObjectStandAlone * > lockedItems_
pat::PATTriggerMatchSelector< bool, PATPrimitive > selector_
void pat::HLTL1MuonMatcher::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 102 of file HLTL1MuonMatcher.cc.

References reco::Candidate::charge(), PV3DBase< T, PVType, FrameType >::eta(), edm::helper::Filler< Map >::fill(), edm::Event::getByLabel(), TrajectoryStateOnSurface::globalPosition(), i, edm::helper::Filler< Map >::insert(), TrajectoryStateOnSurface::isValid(), L1Scalers_cfi::l1s, reco::Candidate::mass(), match(), RPCpg::mu, n, PV3DBase< T, PVType, FrameType >::phi(), reco::Candidate::pt(), edm::Event::put(), and dt_dqm_sourceclient_common_cff::reco.

102  {
103  using namespace edm;
104  using namespace std;
105 
108 
109  iEvent.getByLabel(reco_, reco);
110  iEvent.getByLabel(l1_, l1s);
111 
112  auto_ptr<PATPrimitiveCollection> propOut(new PATPrimitiveCollection());
113  vector<int> propMatches(reco->size(), -1);
114  vector<int> fullMatches(reco->size(), -1);
115  vector<float> deltaRs(reco->size(), 999), deltaPhis(reco->size(), 999);
116  lockedItems_.clear();
117  for (int i = 0, n = reco->size(); i < n; ++i) {
118  TrajectoryStateOnSurface propagated;
119  const reco::Candidate &mu = (*reco)[i];
120  int match = matcher_.matchGeneric(mu, *l1s, *this, deltaRs[i], deltaPhis[i], propagated);
121  if (propagated.isValid()) {
122  GlobalPoint pos = propagated.globalPosition();
123  propMatches[i] = propOut->size();
124  propOut->push_back(PATPrimitive(math::PtEtaPhiMLorentzVector(mu.pt(), pos.eta(), pos.phi(), mu.mass())));
125  propOut->back().addFilterLabel(labelProp_);
126  propOut->back().setCharge(mu.charge());
127  }
128  fullMatches[i] = match;
129  if (match != -1) {
130  lockedItems_.push_back(&(*l1s)[match]);
131  }
132  }
133  lockedItems_.clear();
134 
135  OrphanHandle<PATPrimitiveCollection> propDone = iEvent.put(propOut, "propagatedReco");
136 
137  auto_ptr<PATTriggerAssociation> propAss(new PATTriggerAssociation(propDone));
138  PATTriggerAssociation::Filler propFiller(*propAss);
139  propFiller.insert(reco, propMatches.begin(), propMatches.end());
140  propFiller.fill();
141  iEvent.put(propAss, "propagatedReco");
142 
143  auto_ptr<PATTriggerAssociation> fullAss(new PATTriggerAssociation(l1s));
144  PATTriggerAssociation::Filler fullFiller(*fullAss);
145  fullFiller.insert(reco, fullMatches.begin(), fullMatches.end());
146  fullFiller.fill();
147  iEvent.put(fullAss);
148 
149  if (writeExtraInfo_) {
150  storeExtraInfo(iEvent, reco, deltaRs, "deltaR");
151  storeExtraInfo(iEvent, reco, deltaPhis, "deltaPhi");
152  }
153 }
int i
Definition: DBlmapReader.cc:9
virtual float mass() const =0
mass
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
GlobalPoint globalPosition() const
L1MuonMatcherAlgo matcher_
std::vector< const pat::TriggerObjectStandAlone * > lockedItems_
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
virtual float pt() const =0
transverse momentum
pat::TriggerObjectStandAlone PATPrimitive
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
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.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
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:156
edm::InputTag reco_
Labels for input collections.
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
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
std::string labelProp_
Labels to set as filter names in the output.
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 157 of file HLTL1MuonMatcher.cc.

References edm::helper::Filler< Map >::fill(), edm::helper::Filler< Map >::insert(), and edm::Event::put().

160  {
161  using namespace edm; using namespace std;
162  auto_ptr<ValueMap<T> > valMap(new ValueMap<T>());
163  typename edm::ValueMap<T>::Filler filler(*valMap);
164  filler.insert(handle, values.begin(), values.end());
165  filler.fill();
166  iEvent.put(valMap, label);
167 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
tuple handle
Definition: patZpeak.py:22

Member Data Documentation

edm::InputTag pat::HLTL1MuonMatcher::l1_
private

Definition at line 57 of file HLTL1MuonMatcher.cc.

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

Labels to set as filter names in the output.

Definition at line 65 of file HLTL1MuonMatcher.cc.

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

Definition at line 78 of file HLTL1MuonMatcher.cc.

Referenced by operator()().

L1MuonMatcherAlgo pat::HLTL1MuonMatcher::matcher_
private

Definition at line 54 of file HLTL1MuonMatcher.cc.

edm::InputTag pat::HLTL1MuonMatcher::reco_
private

Labels for input collections.

Definition at line 57 of file HLTL1MuonMatcher.cc.

bool pat::HLTL1MuonMatcher::resolveAmbiguities_
private

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

Referenced by operator()().

bool pat::HLTL1MuonMatcher::writeExtraInfo_
private

Write out additional info as ValueMaps.

Definition at line 68 of file HLTL1MuonMatcher.cc.

Referenced by HLTL1MuonMatcher().