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
 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 labelL1_
 Labels to set as filter names in the output. More...
 
std::string labelProp_
 
L1MuonMatcherAlgo matcher_
 
edm::InputTag reco_
 Labels 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
 
- 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

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 67 of file L1MuonMatcher.cc.

References writeExtraInfo_.

67  :
68  matcher_(iConfig),
69  reco_(iConfig.getParameter<edm::InputTag>("src")),
70  l1_(iConfig.getParameter<edm::InputTag>("matched")),
71  labelL1_(iConfig.getParameter<std::string>( "setL1Label")),
72  labelProp_(iConfig.getParameter<std::string>("setPropLabel")),
73  writeExtraInfo_(iConfig.getParameter<bool>("writeExtraInfo"))
74 {
75  produces<PATPrimitiveCollection>("l1muons"); // l1 in PAT format
76  produces<PATPrimitiveCollection>("propagatedReco"); // reco to muon station 2
77  produces<PATTriggerAssociation>("propagatedReco"); // asso reco to propagated reco
78  produces<PATTriggerAssociation>(); // asso reco to l1
79  if (writeExtraInfo_) {
80  produces<edm::ValueMap<float> >("deltaR");
81  produces<edm::ValueMap<float> >("deltaPhi");
82  produces<edm::ValueMap<int> >("quality");
83  produces<edm::ValueMap<int> >("bx");
84  produces<edm::ValueMap<int> >("isolated");
85  produces<edm::ValueMap<reco::CandidatePtr> >();
86  produces<edm::ValueMap<reco::CandidatePtr> >("l1ToReco");
87  }
88 }
T getParameter(std::string const &) const
bool writeExtraInfo_
Write out additional info as ValueMaps.
L1MuonMatcherAlgo matcher_
std::string labelL1_
Labels to set as filter names in the output.
edm::InputTag reco_
Labels for input collections.
std::string labelProp_
edm::InputTag l1_
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 181 of file L1MuonMatcher.cc.

181  {
182  matcher_.init(iSetup);
183 }
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 91 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::getByLabel(), TrajectoryStateOnSurface::globalPosition(), l1extra::L1MuonParticle::gmtMuonCand(), i, edm::helper::Filler< Map >::insert(), L1MuGMTCand::isol(), TrajectoryStateOnSurface::isValid(), L1Scalers_cfi::l1s, reco::Candidate::mass(), match(), RPCpg::mu, n, PV3DBase< T, PVType, FrameType >::phi(), reco::LeafCandidate::polarP4(), reco::Candidate::pt(), edm::Event::put(), L1MuGMTCand::quality(), and dt_dqm_sourceclient_common_cff::reco.

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

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

170  {
171  using namespace edm; using namespace std;
172  auto_ptr<ValueMap<T> > valMap(new ValueMap<T>());
173  typename edm::ValueMap<T>::Filler filler(*valMap);
174  filler.insert(handle, values.begin(), values.end());
175  filler.fill();
176  iEvent.put(valMap, label);
177 }
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::L1MuonMatcher::l1_
private

Definition at line 49 of file L1MuonMatcher.cc.

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

Labels to set as filter names in the output.

Definition at line 52 of file L1MuonMatcher.cc.

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

Definition at line 52 of file L1MuonMatcher.cc.

L1MuonMatcherAlgo pat::L1MuonMatcher::matcher_
private

Definition at line 46 of file L1MuonMatcher.cc.

edm::InputTag pat::L1MuonMatcher::reco_
private

Labels 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 55 of file L1MuonMatcher.cc.

Referenced by L1MuonMatcher().