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 Attributes
pat::PATMuonSlimmer Class Reference

Slimmer of PAT Muons. More...

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

Public Member Functions

 PATMuonSlimmer (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
virtual ~PATMuonSlimmer ()
 
- 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

bool linkToPackedPF_
 
edm::EDGetTokenT
< edm::Association
< pat::PackedCandidateCollection > > 
pf2pc_
 
edm::EDGetTokenT
< reco::PFCandidateCollection
pf_
 
StringCutObjectSelector
< pat::Muon
saveTeVMuons_
 
edm::EDGetTokenT
< pat::MuonCollection
src_
 

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

Slimmer of PAT Muons.

Definition at line 24 of file PATMuonSlimmer.cc.

Constructor & Destructor Documentation

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

Definition at line 41 of file PATMuonSlimmer.cc.

References edm::ParameterSet::getParameter(), linkToPackedPF_, pf2pc_, and pf_.

41  :
42  src_(consumes<pat::MuonCollection>(iConfig.getParameter<edm::InputTag>("src"))),
43  linkToPackedPF_(iConfig.getParameter<bool>("linkToPackedPFCandidates")),
44  saveTeVMuons_(iConfig.getParameter<std::string>("saveTeVMuons"))
45 {
46  produces<std::vector<pat::Muon> >();
47  if (linkToPackedPF_) {
48  pf_ = consumes<reco::PFCandidateCollection>(iConfig.getParameter<edm::InputTag>("pfCandidates"));
49  pf2pc_ = consumes<edm::Association<pat::PackedCandidateCollection>>(iConfig.getParameter<edm::InputTag>("packedPFCandidates"));
50  }
51 }
T getParameter(std::string const &) const
edm::EDGetTokenT< pat::MuonCollection > src_
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > pf2pc_
StringCutObjectSelector< pat::Muon > saveTeVMuons_
edm::EDGetTokenT< reco::PFCandidateCollection > pf_
virtual pat::PATMuonSlimmer::~PATMuonSlimmer ( )
inlinevirtual

Definition at line 27 of file PATMuonSlimmer.cc.

27 { }

Member Function Documentation

void pat::PATMuonSlimmer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 54 of file PATMuonSlimmer.cc.

References pat::Muon::embedDytMuon(), pat::Muon::embedPickyMuon(), pat::Muon::embedTpfmsMuon(), edm::Event::getByToken(), i, edm::Ref< C, T, F >::isNonnull(), RPCpg::mu, reco::PFCandidate::muonRef(), n, dbtoconf::out, AlCaHLTBitMon_ParallelJobs::p, edm::Event::put(), pat::PATObject< ObjectType >::refToOrig_, edm::refToPtr(), and alcazmumu_cfi::src.

54  {
55  using namespace edm;
56  using namespace std;
57 
59  iEvent.getByToken(src_, src);
60 
61  auto_ptr<vector<pat::Muon> > out(new vector<pat::Muon>());
62  out->reserve(src->size());
63 
64  std::map<reco::CandidatePtr,pat::PackedCandidateRef> mu2pc;
65  if (linkToPackedPF_) {
68  iEvent.getByToken(pf_, pf);
69  iEvent.getByToken(pf2pc_, pf2pc);
70  for (unsigned int i = 0, n = pf->size(); i < n; ++i) {
71  const reco::PFCandidate &p = (*pf)[i];
72  if (p.muonRef().isNonnull()) mu2pc[refToPtr(p.muonRef())] = (*pf2pc)[reco::PFCandidateRef(pf, i)];
73  }
74  }
75 
76  for (vector<pat::Muon>::const_iterator it = src->begin(), ed = src->end(); it != ed; ++it) {
77  out->push_back(*it);
78  pat::Muon & mu = out->back();
79  if (saveTeVMuons_(mu)){mu.embedPickyMuon(); mu.embedTpfmsMuon(); mu.embedDytMuon();}
80  if (linkToPackedPF_) {
81  mu.refToOrig_ = refToPtr(mu2pc[mu.refToOrig_]);
82  }
83  }
84 
85  iEvent.put(out);
86 }
int i
Definition: DBlmapReader.cc:9
void embedDytMuon()
embed reference to the above dyt Track
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
void embedTpfmsMuon()
embed reference to the above tpfms Track
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
Definition: RefToPtr.h:18
edm::EDGetTokenT< pat::MuonCollection > src_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > pf2pc_
StringCutObjectSelector< pat::Muon > saveTeVMuons_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
const int mu
Definition: Constants.h:22
edm::Ref< PFCandidateCollection > PFCandidateRef
persistent reference to a PFCandidate
reco::MuonRef muonRef() const
Definition: PFCandidate.cc:450
tuple out
Definition: dbtoconf.py:99
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
edm::EDGetTokenT< reco::PFCandidateCollection > pf_
void embedPickyMuon()
embed reference to the above picky Track
Analysis-level muon class.
Definition: Muon.h:50
edm::Ptr< reco::Candidate > refToOrig_
Definition: PATObject.h:407

Member Data Documentation

bool pat::PATMuonSlimmer::linkToPackedPF_
private

Definition at line 35 of file PATMuonSlimmer.cc.

Referenced by PATMuonSlimmer().

edm::EDGetTokenT<edm::Association<pat::PackedCandidateCollection> > pat::PATMuonSlimmer::pf2pc_
private

Definition at line 34 of file PATMuonSlimmer.cc.

Referenced by PATMuonSlimmer().

edm::EDGetTokenT<reco::PFCandidateCollection> pat::PATMuonSlimmer::pf_
private

Definition at line 33 of file PATMuonSlimmer.cc.

Referenced by PATMuonSlimmer().

StringCutObjectSelector<pat::Muon> pat::PATMuonSlimmer::saveTeVMuons_
private

Definition at line 36 of file PATMuonSlimmer.cc.

edm::EDGetTokenT<pat::MuonCollection> pat::PATMuonSlimmer::src_
private

Definition at line 32 of file PATMuonSlimmer.cc.