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::L1MuonMatcher Class Reference

Matcher of reconstructed objects to L1 Muons. More...

Inheritance diagram for pat::L1MuonMatcher:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (const edm::Run &iRun, const edm::EventSetup &iSetup) override
 
 L1MuonMatcher (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
virtual ~L1MuonMatcher ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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::EDGetTokenT< std::vector
< l1extra::L1MuonParticle > > 
l1Token_
 
std::string labelL1_
 Labels to set as filter names in the output. More...
 
std::string labelProp_
 
L1MuonMatcherAlgo matcher_
 
edm::EDGetTokenT< edm::View
< reco::Candidate > > 
recoToken_
 Tokens for input collections. More...
 
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
 
- 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)
 
- 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

Matcher of reconstructed objects to L1 Muons.

Author
Giovanni Petrucciani
Version
Id:
HLTL1MuonMatcher.cc,v 1.3 2010/07/12 20:56:11 gpetrucc Exp
Author
Giovanni Petrucciani
Version
Id:
L1MuonMatcher.cc,v 1.4 2011/03/31 09:59:33 gpetrucc Exp

Definition at line 33 of file L1MuonMatcher.cc.

Member Typedef Documentation

Definition at line 42 of file L1MuonMatcher.cc.

Definition at line 43 of file L1MuonMatcher.cc.

Definition at line 44 of file L1MuonMatcher.cc.

Constructor & Destructor Documentation

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

Definition at line 68 of file L1MuonMatcher.cc.

References writeExtraInfo_.

68  :
69  matcher_(iConfig),
71  l1Token_(consumes<std::vector<l1extra::L1MuonParticle> >(iConfig.getParameter<edm::InputTag>("matched"))),
72  labelL1_(iConfig.getParameter<std::string>( "setL1Label")),
73  labelProp_(iConfig.getParameter<std::string>("setPropLabel")),
74  writeExtraInfo_(iConfig.getParameter<bool>("writeExtraInfo"))
75 {
76  produces<PATPrimitiveCollection>("l1muons"); // l1 in PAT format
77  produces<PATPrimitiveCollection>("propagatedReco"); // reco to muon station 2
78  produces<PATTriggerAssociation>("propagatedReco"); // asso reco to propagated reco
79  produces<PATTriggerAssociation>(); // asso reco to l1
80  if (writeExtraInfo_) {
81  produces<edm::ValueMap<float> >("deltaR");
82  produces<edm::ValueMap<float> >("deltaPhi");
83  produces<edm::ValueMap<int> >("quality");
84  produces<edm::ValueMap<int> >("bx");
85  produces<edm::ValueMap<int> >("isolated");
86  produces<edm::ValueMap<reco::CandidatePtr> >();
87  produces<edm::ValueMap<reco::CandidatePtr> >("l1ToReco");
88  }
89 }
T getParameter(std::string const &) const
bool writeExtraInfo_
Write out additional info as ValueMaps.
L1MuonMatcherAlgo matcher_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< std::vector< l1extra::L1MuonParticle > > l1Token_
std::string labelL1_
Labels to set as filter names in the output.
edm::EDGetTokenT< edm::View< reco::Candidate > > recoToken_
Tokens for input collections.
std::string labelProp_
virtual pat::L1MuonMatcher::~L1MuonMatcher ( )
inlinevirtual

Definition at line 36 of file L1MuonMatcher.cc.

36 { }

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 182 of file L1MuonMatcher.cc.

182  {
183  matcher_.init(iSetup);
184 }
void init(const edm::EventSetup &iSetup)
Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators...
L1MuonMatcherAlgo matcher_
void pat::L1MuonMatcher::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 92 of file L1MuonMatcher.cc.

References L1MuGMTCand::bx(), reco::Candidate::charge(), reco::LeafCandidate::charge(), PV3DBase< T, PVType, FrameType >::eta(), edm::helper::Filler< Map >::fill(), edm::Event::getByToken(), TrajectoryStateOnSurface::globalPosition(), l1extra::L1MuonParticle::gmtMuonCand(), i, edm::helper::Filler< Map >::insert(), L1MuGMTCand::isol(), TrajectoryStateOnSurface::isValid(), L1Scalers_cfi::l1s, reco::Candidate::mass(), match(), RPCpg::mu, gen::n, PV3DBase< T, PVType, FrameType >::phi(), reco::LeafCandidate::polarP4(), reco::Candidate::pt(), edm::Event::put(), L1MuGMTCand::quality(), HLT_25ns14e33_v1_cff::quality, and dt_dqm_sourceclient_common_cff::reco.

92  {
93  using namespace edm;
94  using namespace std;
95 
98 
99  iEvent.getByToken(recoToken_, reco);
100  iEvent.getByToken(l1Token_, l1s);
101 
102  auto_ptr<PATPrimitiveCollection> propOut(new PATPrimitiveCollection());
103  auto_ptr<PATPrimitiveCollection> l1Out(new PATPrimitiveCollection());
104  std::vector<edm::Ptr<reco::Candidate> > l1rawMatches(reco->size());
105  vector<int> isSelected(l1s->size(), -1);
106  std::vector<edm::Ptr<reco::Candidate> > whichRecoMatch(l1s->size());
107  vector<int> propMatches(reco->size(), -1);
108  vector<int> fullMatches(reco->size(), -1);
109  vector<float> deltaRs(reco->size(), 999), deltaPhis(reco->size(), 999);
110  vector<int> quality(reco->size(), 0), bx(reco->size(), -999), isolated(reco->size(), -999);
111  for (int i = 0, n = reco->size(); i < n; ++i) {
112  TrajectoryStateOnSurface propagated;
113  const reco::Candidate &mu = (*reco)[i];
114  int match = matcher_.match(mu, *l1s, deltaRs[i], deltaPhis[i], propagated);
115  if (propagated.isValid()) {
116  GlobalPoint pos = propagated.globalPosition();
117  propMatches[i] = propOut->size();
118  propOut->push_back(PATPrimitive(math::PtEtaPhiMLorentzVector(mu.pt(), pos.eta(), pos.phi(), mu.mass())));
119  propOut->back().addFilterLabel(labelProp_);
120  propOut->back().setCharge(mu.charge());
121  }
122  if (match != -1) {
123  const l1extra::L1MuonParticle & l1 = (*l1s)[match];
124  whichRecoMatch[match] = reco->ptrAt(i);
125  if (isSelected[match] == -1) { // copy to output if needed
126  isSelected[match] = l1Out->size();
127  l1Out->push_back(PATPrimitive(l1.polarP4()));
128  l1Out->back().addFilterLabel(labelL1_);
129  l1Out->back().setCharge(l1.charge());
130  }
131  fullMatches[i] = isSelected[match]; // index in the output collection
132  const L1MuGMTCand & gmt = l1.gmtMuonCand();
133  quality[i] = gmt.quality();
134  bx[i] = gmt.bx();
135  isolated[i] = gmt.isol();
136  l1rawMatches[i] = edm::Ptr<reco::Candidate>(l1s, size_t(match));
137  }
138  }
139 
140  OrphanHandle<PATPrimitiveCollection> l1Done = iEvent.put(l1Out, "l1muons");
141  OrphanHandle<PATPrimitiveCollection> propDone = iEvent.put(propOut, "propagatedReco");
142 
143  auto_ptr<PATTriggerAssociation> propAss(new PATTriggerAssociation(propDone));
144  PATTriggerAssociation::Filler propFiller(*propAss);
145  propFiller.insert(reco, propMatches.begin(), propMatches.end());
146  propFiller.fill();
147  iEvent.put(propAss, "propagatedReco");
148 
149  auto_ptr<PATTriggerAssociation> fullAss(new PATTriggerAssociation( l1Done));
150  PATTriggerAssociation::Filler fullFiller(*fullAss);
151  fullFiller.insert(reco, fullMatches.begin(), fullMatches.end());
152  fullFiller.fill();
153  iEvent.put(fullAss);
154 
155  if (writeExtraInfo_) {
156  storeExtraInfo(iEvent, reco, deltaRs, "deltaR");
157  storeExtraInfo(iEvent, reco, deltaPhis, "deltaPhi");
158  storeExtraInfo(iEvent, reco, bx, "bx");
159  storeExtraInfo(iEvent, reco, isolated, "isolated");
160  storeExtraInfo(iEvent, reco, quality, "quality");
161  storeExtraInfo(iEvent, reco, l1rawMatches, "");
162  storeExtraInfo(iEvent, l1s, whichRecoMatch, "l1ToReco");
163  }
164 }
int i
Definition: DBlmapReader.cc:9
bool writeExtraInfo_
Write out additional info as ValueMaps.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
virtual double pt() const =0
transverse momentum
void storeExtraInfo(edm::Event &iEvent, const Hand &handle, const std::vector< T > &values, const std::string &label) const
Store extra information in a ValueMap.
virtual double mass() const =0
mass
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
GlobalPoint globalPosition() const
pat::TriggerObjectStandAloneCollection PATPrimitiveCollection
L1MuonMatcherAlgo matcher_
pat::TriggerObjectStandAlone PATPrimitive
bool isol() const
get isolation
Definition: L1MuGMTCand.h:114
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
edm::EDGetTokenT< std::vector< l1extra::L1MuonParticle > > l1Token_
std::string labelL1_
Labels to set as filter names in the output.
int bx() const
get bunch crossing identifier
Definition: L1MuGMTCand.h:120
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
pat::TriggerObjectStandAloneMatch PATTriggerAssociation
virtual int charge() const
electric charge
Definition: LeafCandidate.h:91
virtual int charge() const =0
electric charge
const int mu
Definition: Constants.h:22
unsigned int quality() const
get quality
Definition: L1MuGMTCand.h:93
helper::Filler< ValueMap< int > > Filler
Definition: ValueMap.h:170
bool match(const reco::Track &tk, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
edm::EDGetTokenT< edm::View< reco::Candidate > > recoToken_
Tokens for input collections.
T eta() const
Definition: PV3DBase.h:76
const L1MuGMTExtendedCand & gmtMuonCand() const
virtual const PolarLorentzVector & polarP4() const
four-momentum Lorentz vector
std::string labelProp_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
template<typename Hand , typename T >
void pat::L1MuonMatcher::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 168 of file L1MuonMatcher.cc.

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

171  {
172  using namespace edm; using namespace std;
173  auto_ptr<ValueMap<T> > valMap(new ValueMap<T>());
174  typename edm::ValueMap<T>::Filler filler(*valMap);
175  filler.insert(handle, values.begin(), values.end());
176  filler.fill();
177  iEvent.put(valMap, label);
178 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
tuple handle
Definition: patZpeak.py:22

Member Data Documentation

edm::EDGetTokenT<std::vector<l1extra::L1MuonParticle> > pat::L1MuonMatcher::l1Token_
private

Definition at line 50 of file L1MuonMatcher.cc.

std::string pat::L1MuonMatcher::labelL1_
private

Labels to set as filter names in the output.

Definition at line 53 of file L1MuonMatcher.cc.

std::string pat::L1MuonMatcher::labelProp_
private

Definition at line 53 of file L1MuonMatcher.cc.

L1MuonMatcherAlgo pat::L1MuonMatcher::matcher_
private

Definition at line 46 of file L1MuonMatcher.cc.

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

Tokens for input collections.

Definition at line 49 of file L1MuonMatcher.cc.

bool pat::L1MuonMatcher::writeExtraInfo_
private

Write out additional info as ValueMaps.

Definition at line 56 of file L1MuonMatcher.cc.

Referenced by L1MuonMatcher().