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 ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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.4 2013/02/27 20:42:45 wmtan Exp
Author
Giovanni Petrucciani
Version
Id:
L1MuonMatcher.cc,v 1.5 2013/02/27 20:42:45 wmtan Exp

Definition at line 34 of file L1MuonMatcher.cc.

Member Typedef Documentation

Definition at line 43 of file L1MuonMatcher.cc.

Definition at line 44 of file L1MuonMatcher.cc.

Definition at line 45 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),
70  reco_(iConfig.getParameter<edm::InputTag>("src")),
71  l1_(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_
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 37 of file L1MuonMatcher.cc.

37 { }

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::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(), pos, reco::Candidate::pt(), edm::Event::put(), L1MuGMTCand::quality(), and L1Trigger_dataformats::reco.

92  {
93  using namespace edm;
94  using namespace std;
95 
98 
99  iEvent.getByLabel(reco_, reco);
100  iEvent.getByLabel(l1_, 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
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:116
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:26
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:122
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
pat::TriggerObjectStandAloneMatch PATTriggerAssociation
virtual int charge() const =0
electric charge
const int mu
Definition: Constants.h:23
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
unsigned int quality() const
get quality
Definition: L1MuGMTCand.h:95
helper::Filler< ValueMap< int > > Filler
Definition: ValueMap.h:157
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 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:94
tuple handle
Definition: patZpeak.py:22

Member Data Documentation

edm::InputTag pat::L1MuonMatcher::l1_
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 47 of file L1MuonMatcher.cc.

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

Labels for input collections.

Definition at line 50 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().