CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
pat::PATMuonProducer Class Reference

class definition More...

#include "PhysicsTools/PatAlgos/interface/PATMuonProducer.h"

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

Public Member Functions

 PATMuonProducer (const edm::ParameterSet &iConfig)
 default constructir More...
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 everything that needs to be done during the event loop More...
 
 ~PATMuonProducer ()
 default destructur More...
 
- 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 ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 description of config file parameters More...
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Types

typedef std::vector
< edm::Handle
< edm::Association
< reco::GenParticleCollection > > > 
GenAssociations
 
typedef std::vector
< edm::Handle< edm::ValueMap
< IsoDeposit > > > 
IsoDepositMaps
 
typedef std::pair
< pat::IsolationKeys,
edm::InputTag
IsolationLabel
 
typedef std::vector
< IsolationLabel
IsolationLabels
 
typedef std::vector
< edm::Handle< edm::ValueMap
< double > > > 
IsolationValueMaps
 
typedef edm::RefToBase
< reco::Muon
MuonBaseRef
 typedefs for convenience More...
 

Private Member Functions

void embedHighLevel (pat::Muon &aMuon, reco::TrackRef track, reco::TransientTrack &tt, reco::Vertex &primaryVertex, bool primaryVertexIsValid, reco::BeamSpot &beamspot, bool beamspotIsValid)
 
void fillMuon (Muon &aMuon, const MuonBaseRef &muonRef, const reco::CandidateBaseRef &baseRef, const GenAssociations &genMatches, const IsoDepositMaps &deposits, const IsolationValueMaps &isolationValues) const
 common muon filling, for both the standard and PF2PAT case More...
 
void readIsolationLabels (const edm::ParameterSet &iConfig, const char *psetName, IsolationLabels &labels)
 

Private Attributes

bool addEfficiencies_
 add efficiencies to the muon (this will be data members of th muon even w/o embedding) More...
 
bool addGenMatch_
 add generator match information More...
 
bool addResolutions_
 add resolutions to the muon (this will be data members of th muon even w/o embedding) More...
 
edm::InputTag beamLineSrc_
 input source of the primary vertex/beamspot More...
 
edm::InputTag caloMETMuonCorrs_
 source of caloMET muon corrections More...
 
pat::helper::EfficiencyLoader efficiencyLoader_
 helper class to add efficiencies to the muon More...
 
bool embedBestTrack_
 embed the track from best muon measurement More...
 
bool embedCaloMETMuonCorrs_
 embed muon MET correction info for caloMET into the muon More...
 
bool embedCombinedMuon_
 embed track of the combined fit into the muon More...
 
bool embedDytMuon_
 embed track from DYT muon fit into the muon More...
 
bool embedGenMatch_
 embed the gen match information into the muon More...
 
bool embedHighLevelSelection_
 embed high level selection variables More...
 
bool embedPFCandidate_
 embed pfCandidates into the muon More...
 
bool embedPickyMuon_
 embed track from picky muon fit into the muon More...
 
bool embedStandAloneMuon_
 embed track from muon system into the muon More...
 
bool embedTcMETMuonCorrs_
 embed muon MET correction info for tcMET into the muon More...
 
bool embedTpfmsMuon_
 embed track from tpfms muon fit into the muon More...
 
bool embedTrack_
 embed the track from inner tracker into the muon More...
 
std::vector< edm::InputTaggenMatchSrc_
 input tags for generator match information More...
 
IsolationLabels isoDepositLabels_
 input source for isoDeposits More...
 
IsolationLabels isolationValueLabels_
 input source isolation value maps More...
 
pat::helper::MultiIsolator isolator_
 helper class to add userdefined isolation values to the muon More...
 
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
 isolation value pair for temporary storage before being folded into the muon More...
 
edm::InputTag muonSrc_
 input source More...
 
edm::InputTag pfMuonSrc_
 input source pfCandidates that will be to be transformed into pat::Muons, when using PF2PAT More...
 
GreaterByPt< MuonpTComparator_
 
edm::InputTag pvSrc_
 input source of the primary vertex More...
 
pat::helper::KinResolutionsLoader resolutionLoader_
 helper class to add resolutions to the muon More...
 
edm::InputTag tcMETMuonCorrs_
 source of tcMET muon corrections More...
 
bool useParticleFlow_
 switch to use particle flow (PF2PAT) or not More...
 
bool usePV_
 use the primary vertex or the beamspot More...
 
pat::PATUserDataHelper< pat::MuonuserDataHelper_
 helper class to add userData to the muon More...
 
bool useUserData_
 add user data to the muon (this will be data members of th muon even w/o embedding) 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
 
- 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

class definition

Produces pat::Muon's.

The PATMuonProducer produces analysis-level pat::Muon's starting from a collection of objects of reco::Muon.

Author
Steven Lowette, Roger Wolf
Version
Id:
PATMuonProducer.h,v 1.30 2013/02/27 23:26:56 wmtan Exp

Definition at line 43 of file PATMuonProducer.h.

Member Typedef Documentation

Definition at line 58 of file PATMuonProducer.h.

Definition at line 59 of file PATMuonProducer.h.

Definition at line 61 of file PATMuonProducer.h.

Definition at line 62 of file PATMuonProducer.h.

typedef std::vector< edm::Handle< edm::ValueMap<double> > > pat::PATMuonProducer::IsolationValueMaps
private

Definition at line 60 of file PATMuonProducer.h.

typedefs for convenience

Definition at line 57 of file PATMuonProducer.h.

Constructor & Destructor Documentation

PATMuonProducer::PATMuonProducer ( const edm::ParameterSet iConfig)
explicit

default constructir

Definition at line 47 of file PATMuonProducer.cc.

References addEfficiencies_, addGenMatch_, addResolutions_, beamLineSrc_, caloMETMuonCorrs_, efficiencyLoader_, embedBestTrack_, embedCaloMETMuonCorrs_, embedCombinedMuon_, embedDytMuon_, embedGenMatch_, embedHighLevelSelection_, embedPFCandidate_, embedPickyMuon_, embedStandAloneMuon_, embedTcMETMuonCorrs_, embedTpfmsMuon_, embedTrack_, edm::ParameterSet::existsAs(), genMatchSrc_, edm::ParameterSet::getParameter(), isoDepositLabels_, isolationValueLabels_, muonSrc_, pfMuonSrc_, pvSrc_, readIsolationLabels(), resolutionLoader_, tcMETMuonCorrs_, useParticleFlow_, usePV_, userDataHelper_, and useUserData_.

47  : useUserData_(iConfig.exists("userData")),
48  isolator_(iConfig.exists("userIsolation") ? iConfig.getParameter<edm::ParameterSet>("userIsolation") : edm::ParameterSet(), false)
49 {
50  // input source
51  muonSrc_ = iConfig.getParameter<edm::InputTag>( "muonSource" );
52  // embedding of tracks
53  embedBestTrack_ = iConfig.getParameter<bool>( "embedMuonBestTrack" );
54  embedTrack_ = iConfig.getParameter<bool>( "embedTrack" );
55  embedCombinedMuon_ = iConfig.getParameter<bool>( "embedCombinedMuon" );
56  embedStandAloneMuon_ = iConfig.getParameter<bool>( "embedStandAloneMuon" );
57  // embedding of muon MET correction information
58  embedCaloMETMuonCorrs_ = iConfig.getParameter<bool>("embedCaloMETMuonCorrs" );
59  embedTcMETMuonCorrs_ = iConfig.getParameter<bool>("embedTcMETMuonCorrs" );
60  caloMETMuonCorrs_ = iConfig.getParameter<edm::InputTag>("caloMETMuonCorrs" );
61  tcMETMuonCorrs_ = iConfig.getParameter<edm::InputTag>("tcMETMuonCorrs" );
62  // pflow specific configurables
63  useParticleFlow_ = iConfig.getParameter<bool>( "useParticleFlow" );
64  embedPFCandidate_ = iConfig.getParameter<bool>( "embedPFCandidate" );
65  pfMuonSrc_ = iConfig.getParameter<edm::InputTag>( "pfMuonSource" );
66  // embedding of tracks from TeV refit
67  embedPickyMuon_ = iConfig.getParameter<bool>( "embedPickyMuon" );
68  embedTpfmsMuon_ = iConfig.getParameter<bool>( "embedTpfmsMuon" );
69  embedDytMuon_ = iConfig.getParameter<bool>( "embedDytMuon" );
70  // Monte Carlo matching
71  addGenMatch_ = iConfig.getParameter<bool>( "addGenMatch" );
72  if(addGenMatch_){
73  embedGenMatch_ = iConfig.getParameter<bool>( "embedGenMatch" );
74  if(iConfig.existsAs<edm::InputTag>("genParticleMatch")){
75  genMatchSrc_.push_back(iConfig.getParameter<edm::InputTag>( "genParticleMatch" ));
76  } else {
77  genMatchSrc_ = iConfig.getParameter<std::vector<edm::InputTag> >( "genParticleMatch" );
78  }
79  }
80  // efficiencies
81  addEfficiencies_ = iConfig.getParameter<bool>("addEfficiencies");
82  if(addEfficiencies_){
84  }
85  // resolutions
86  addResolutions_ = iConfig.getParameter<bool>("addResolutions");
87  if (addResolutions_) {
89  }
90  // read isoDeposit labels, for direct embedding
91  readIsolationLabels(iConfig, "isoDeposits", isoDepositLabels_);
92  // read isolation value labels, for direct embedding
93  readIsolationLabels(iConfig, "isolationValues", isolationValueLabels_);
94  // check to see if the user wants to add user data
95  if( useUserData_ ){
97  }
98  // embed high level selection variables
99  usePV_ = true;
100  embedHighLevelSelection_ = iConfig.getParameter<bool>("embedHighLevelSelection");
101  if ( embedHighLevelSelection_ ) {
102  beamLineSrc_ = iConfig.getParameter<edm::InputTag>("beamLineSrc");
103  usePV_ = iConfig.getParameter<bool>("usePV");
104  pvSrc_ = iConfig.getParameter<edm::InputTag>("pvSrc");
105  }
106  // produces vector of muons
107  produces<std::vector<Muon> >();
108 }
bool embedTpfmsMuon_
embed track from tpfms muon fit into the muon
bool useUserData_
add user data to the muon (this will be data members of th muon even w/o embedding) ...
T getParameter(std::string const &) const
Assists in assimilating all pat::UserData into pat objects.
bool usePV_
use the primary vertex or the beamspot
bool embedTcMETMuonCorrs_
embed muon MET correction info for tcMET into the muon
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:187
bool addEfficiencies_
add efficiencies to the muon (this will be data members of th muon even w/o embedding) ...
bool embedCaloMETMuonCorrs_
embed muon MET correction info for caloMET into the muon
edm::InputTag pvSrc_
input source of the primary vertex
bool exists(std::string const &parameterName) const
checks if a parameter exists
bool embedBestTrack_
embed the track from best muon measurement
edm::InputTag tcMETMuonCorrs_
source of tcMET muon corrections
edm::InputTag pfMuonSrc_
input source pfCandidates that will be to be transformed into pat::Muons, when using PF2PAT ...
bool addResolutions_
add resolutions to the muon (this will be data members of th muon even w/o embedding) ...
pat::helper::MultiIsolator isolator_
helper class to add userdefined isolation values to the muon
bool useParticleFlow_
switch to use particle flow (PF2PAT) or not
pat::PATUserDataHelper< pat::Muon > userDataHelper_
helper class to add userData to the muon
bool embedStandAloneMuon_
embed track from muon system into the muon
bool embedTrack_
embed the track from inner tracker into the muon
bool addGenMatch_
add generator match information
edm::InputTag beamLineSrc_
input source of the primary vertex/beamspot
std::vector< edm::InputTag > genMatchSrc_
input tags for generator match information
edm::InputTag muonSrc_
input source
void readIsolationLabels(const edm::ParameterSet &iConfig, const char *psetName, IsolationLabels &labels)
edm::InputTag caloMETMuonCorrs_
source of caloMET muon corrections
pat::helper::EfficiencyLoader efficiencyLoader_
helper class to add efficiencies to the muon
bool embedPickyMuon_
embed track from picky muon fit into the muon
bool embedDytMuon_
embed track from DYT muon fit into the muon
bool embedGenMatch_
embed the gen match information into the muon
IsolationLabels isoDepositLabels_
input source for isoDeposits
IsolationLabels isolationValueLabels_
input source isolation value maps
bool embedPFCandidate_
embed pfCandidates into the muon
bool embedCombinedMuon_
embed track of the combined fit into the muon
pat::helper::KinResolutionsLoader resolutionLoader_
helper class to add resolutions to the muon
bool embedHighLevelSelection_
embed high level selection variables
PATMuonProducer::~PATMuonProducer ( )

default destructur

Definition at line 111 of file PATMuonProducer.cc.

112 {
113 }

Member Function Documentation

void PATMuonProducer::embedHighLevel ( pat::Muon aMuon,
reco::TrackRef  track,
reco::TransientTrack tt,
reco::Vertex primaryVertex,
bool  primaryVertexIsValid,
reco::BeamSpot beamspot,
bool  beamspotIsValid 
)
private

Definition at line 579 of file PATMuonProducer.cc.

References pat::Muon::BS2D, pat::Muon::BS3D, reco::BeamSpot::position(), pat::Muon::PV2D, pat::Muon::PV3D, query::result, reco::BeamSpot::rotatedCovariance3D(), pat::Muon::setDB(), IPTools::signedImpactParameter3D(), and IPTools::signedTransverseImpactParameter().

Referenced by produce().

587 {
588  // Correct to PV
589 
590  // PV2D
591  std::pair<bool,Measurement1D> result =
593  GlobalVector(track->px(),
594  track->py(),
595  track->pz()),
596  primaryVertex);
597  double d0_corr = result.second.value();
598  double d0_err = primaryVertexIsValid ? result.second.error() : -1.0;
599  aMuon.setDB( d0_corr, d0_err, pat::Muon::PV2D);
600 
601 
602  // PV3D
603  result =
605  GlobalVector(track->px(),
606  track->py(),
607  track->pz()),
608  primaryVertex);
609  d0_corr = result.second.value();
610  d0_err = primaryVertexIsValid ? result.second.error() : -1.0;
611  aMuon.setDB( d0_corr, d0_err, pat::Muon::PV3D);
612 
613 
614  // Correct to beam spot
615  // make a fake vertex out of beam spot
616  reco::Vertex vBeamspot(beamspot.position(), beamspot.rotatedCovariance3D());
617 
618  // BS2D
619  result =
621  GlobalVector(track->px(),
622  track->py(),
623  track->pz()),
624  vBeamspot);
625  d0_corr = result.second.value();
626  d0_err = beamspotIsValid ? result.second.error() : -1.0;
627  aMuon.setDB( d0_corr, d0_err, pat::Muon::BS2D);
628 
629  // BS3D
630  result =
632  GlobalVector(track->px(),
633  track->py(),
634  track->pz()),
635  vBeamspot);
636  d0_corr = result.second.value();
637  d0_err = beamspotIsValid ? result.second.error() : -1.0;
638  aMuon.setDB( d0_corr, d0_err, pat::Muon::BS3D);
639 }
std::pair< bool, Measurement1D > signedTransverseImpactParameter(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:50
std::pair< bool, Measurement1D > signedImpactParameter3D(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:71
tuple result
Definition: query.py:137
const Point & position() const
position
Definition: BeamSpot.h:63
Covariance3DMatrix rotatedCovariance3D() const
Definition: BeamSpot.cc:79
void setDB(double dB, double edB, IpType type=None)
Definition: Muon.h:204
Global3DVector GlobalVector
Definition: GlobalVector.h:10
void PATMuonProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

description of config file parameters

Definition at line 442 of file PATMuonProducer.cc.

References edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addNode(), edm::ParameterSetDescription::addOptional(), pat::helper::KinResolutionsLoader::fillDescription(), pat::PATUserDataHelper< ObjectType >::fillDescription(), edm::ParameterSetDescription::setAllowAnything(), edm::ParameterSetDescription::setComment(), and edm::ParameterDescriptionNode::setComment().

443 {
445  iDesc.setComment("PAT muon producer module");
446 
447  // input source
448  iDesc.add<edm::InputTag>("muonSource", edm::InputTag("no default"))->setComment("input collection");
449 
450  // embedding
451  iDesc.add<bool>("embedMuonBestTrack", true)->setComment("embed muon best track");
452  iDesc.add<bool>("embedTrack", true)->setComment("embed external track");
453  iDesc.add<bool>("embedStandAloneMuon", true)->setComment("embed external stand-alone muon");
454  iDesc.add<bool>("embedCombinedMuon", false)->setComment("embed external combined muon");
455  iDesc.add<bool>("embedPickyMuon", false)->setComment("embed external picky track");
456  iDesc.add<bool>("embedTpfmsMuon", false)->setComment("embed external tpfms track");
457  iDesc.add<bool>("embedDytMuon", false)->setComment("embed external dyt track ");
458 
459  // embedding of MET muon corrections
460  iDesc.add<bool>("embedCaloMETMuonCorrs", true)->setComment("whether to add MET muon correction for caloMET or not");
461  iDesc.add<edm::InputTag>("caloMETMuonCorrs", edm::InputTag("muonMETValueMapProducer" , "muCorrData"))->setComment("source of MET muon corrections for caloMET");
462  iDesc.add<bool>("embedTcMETMuonCorrs", true)->setComment("whether to add MET muon correction for tcMET or not");
463  iDesc.add<edm::InputTag>("tcMETMuonCorrs", edm::InputTag("muonTCMETValueMapProducer" , "muCorrData"))->setComment("source of MET muon corrections for tcMET");
464 
465  // pf specific parameters
466  iDesc.add<edm::InputTag>("pfMuonSource", edm::InputTag("pfMuons"))->setComment("particle flow input collection");
467  iDesc.add<bool>("useParticleFlow", false)->setComment("whether to use particle flow or not");
468  iDesc.add<bool>("embedPFCandidate", false)->setComment("embed external particle flow object");
469 
470  // MC matching configurables
471  iDesc.add<bool>("addGenMatch", true)->setComment("add MC matching");
472  iDesc.add<bool>("embedGenMatch", false)->setComment("embed MC matched MC information");
473  std::vector<edm::InputTag> emptySourceVector;
474  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("genParticleMatch", edm::InputTag(), true) xor
475  edm::ParameterDescription<std::vector<edm::InputTag> >("genParticleMatch", emptySourceVector, true)
476  )->setComment("input with MC match information");
477 
479 
480  // IsoDeposit configurables
481  edm::ParameterSetDescription isoDepositsPSet;
482  isoDepositsPSet.addOptional<edm::InputTag>("tracker");
483  isoDepositsPSet.addOptional<edm::InputTag>("ecal");
484  isoDepositsPSet.addOptional<edm::InputTag>("hcal");
485  isoDepositsPSet.addOptional<edm::InputTag>("particle");
486  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedHadrons");
487  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedAll");
488  isoDepositsPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
489  isoDepositsPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
490  isoDepositsPSet.addOptional<edm::InputTag>("pfPhotons");
491  isoDepositsPSet.addOptional<std::vector<edm::InputTag> >("user");
492  iDesc.addOptional("isoDeposits", isoDepositsPSet);
493 
494  // isolation values configurables
495  edm::ParameterSetDescription isolationValuesPSet;
496  isolationValuesPSet.addOptional<edm::InputTag>("tracker");
497  isolationValuesPSet.addOptional<edm::InputTag>("ecal");
498  isolationValuesPSet.addOptional<edm::InputTag>("hcal");
499  isolationValuesPSet.addOptional<edm::InputTag>("particle");
500  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedHadrons");
501  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedAll");
502  isolationValuesPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
503  isolationValuesPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
504  isolationValuesPSet.addOptional<edm::InputTag>("pfPhotons");
505  iDesc.addOptional("isolationValues", isolationValuesPSet);
506 
507  // Efficiency configurables
508  edm::ParameterSetDescription efficienciesPSet;
509  efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
510  iDesc.add("efficiencies", efficienciesPSet);
511  iDesc.add<bool>("addEfficiencies", false);
512 
513  // Check to see if the user wants to add user data
514  edm::ParameterSetDescription userDataPSet;
516  iDesc.addOptional("userData", userDataPSet);
517 
518  edm::ParameterSetDescription isolationPSet;
519  isolationPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
520  iDesc.add("userIsolation", isolationPSet);
521 
522  iDesc.add<bool>("embedHighLevelSelection", true)->setComment("embed high level selection");
523  edm::ParameterSetDescription highLevelPSet;
524  highLevelPSet.setAllowAnything();
525  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("beamLineSrc", edm::InputTag(), true)
526  )->setComment("input with high level selection");
528  )->setComment("input with high level selection");
529  iDesc.addNode( edm::ParameterDescription<bool>("usePV", bool(), true)
530  )->setComment("input with high level selection, use primary vertex (true) or beam line (false)");
531 
532  //descriptions.add("PATMuonProducer", iDesc);
533 }
void setComment(std::string const &value)
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
void setAllowAnything()
allow any parameter label/value pairs
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
static void fillDescription(edm::ParameterSetDescription &iDesc)
void setComment(std::string const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillDescription(edm::ParameterSetDescription &iDesc)
Method for documentation and validation of PSet.
void PATMuonProducer::fillMuon ( Muon aMuon,
const MuonBaseRef muonRef,
const reco::CandidateBaseRef baseRef,
const GenAssociations genMatches,
const IsoDepositMaps deposits,
const IsolationValueMaps isolationValues 
) const
private

common muon filling, for both the standard and PF2PAT case

Definition at line 368 of file PATMuonProducer.cc.

References addGenMatch_, pat::PATObject< ObjectType >::addGenParticleRef(), edm::contains(), reco::Muon::DYT, efficiencyLoader_, embedBestTrack_, pat::Muon::embedCombinedMuon(), embedCombinedMuon_, pat::Muon::embedDytMuon(), embedDytMuon_, embedGenMatch_, pat::PATObject< ObjectType >::embedGenParticle(), pat::Muon::embedMuonBestTrack(), pat::Muon::embedPickyMuon(), embedPickyMuon_, pat::Muon::embedStandAloneMuon(), embedStandAloneMuon_, pat::Muon::embedTpfmsMuon(), embedTpfmsMuon_, pat::Muon::embedTrack(), embedTrack_, pat::helper::EfficiencyLoader::enabled(), pat::helper::KinResolutionsLoader::enabled(), first, i, edm::RefToBase< T >::id(), reco::Muon::isAValidMuonTrack(), reco::Muon::isGlobalMuon(), isoDepositLabels_, isolationValueLabels_, j, n, pat::Muon::pfCandidateRef(), reco::Muon::Picky, resolutionLoader_, pat::helper::EfficiencyLoader::setEfficiencies(), pat::Lepton< LeptonType >::setIsoDeposit(), pat::Lepton< LeptonType >::setIsolation(), reco::LeafCandidate::setP4(), pat::helper::KinResolutionsLoader::setResolutions(), LaserTracksInput_cfi::source, reco::Muon::TPFMS, and useParticleFlow_.

Referenced by produce().

369 {
370  // in the particle flow algorithm,
371  // the muon momentum is recomputed.
372  // the new value is stored as the momentum of the
373  // resulting PFCandidate of type Muon, and choosen
374  // as the pat::Muon momentum
375  if (useParticleFlow_)
376  aMuon.setP4( aMuon.pfCandidateRef()->p4() );
377  if (embedBestTrack_) aMuon.embedMuonBestTrack();
378  if (embedTrack_) aMuon.embedTrack();
381 
382  // embed the TeV refit track refs (only available for globalMuons)
383  if (aMuon.isGlobalMuon()) {
385  aMuon.embedPickyMuon();
387  aMuon.embedTpfmsMuon();
389  aMuon.embedDytMuon();
390  }
391 
392  // store the match to the generated final state muons
393  if (addGenMatch_) {
394  for(size_t i = 0, n = genMatches.size(); i < n; ++i) {
395  reco::GenParticleRef genMuon = (*genMatches[i])[baseRef];
396  aMuon.addGenParticleRef(genMuon);
397  }
398  if (embedGenMatch_) aMuon.embedGenParticle();
399  }
400  if (efficiencyLoader_.enabled()) {
401  efficiencyLoader_.setEfficiencies( aMuon, muonRef );
402  }
403 
404  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
405  if(useParticleFlow_) {
406  if (deposits[j]->contains(baseRef.id())) {
407  aMuon.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[baseRef]);
408  } else if (deposits[j]->contains(muonRef.id())){
409  aMuon.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[muonRef]);
410  } else {
411  reco::CandidatePtr source = aMuon.pfCandidateRef()->sourceCandidatePtr(0);
412  aMuon.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[source]);
413  }
414  }
415  else{
416  aMuon.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[muonRef]);
417  }
418  }
419 
420  for (size_t j = 0; j<isolationValues.size(); ++j) {
421  if(useParticleFlow_) {
422  if (isolationValues[j]->contains(baseRef.id())) {
423  aMuon.setIsolation(isolationValueLabels_[j].first, (*isolationValues[j])[baseRef]);
424  } else if (isolationValues[j]->contains(muonRef.id())) {
425  aMuon.setIsolation(isolationValueLabels_[j].first, (*isolationValues[j])[muonRef]);
426  } else {
427  reco::CandidatePtr source = aMuon.pfCandidateRef()->sourceCandidatePtr(0);
428  aMuon.setIsolation(isolationValueLabels_[j].first, (*isolationValues[j])[source]);
429  }
430  }
431  else{
432  aMuon.setIsolation(isolationValueLabels_[j].first, (*isolationValues[j])[muonRef]);
433  }
434  }
435 
436  if (resolutionLoader_.enabled()) {
438  }
439 }
bool embedTpfmsMuon_
embed track from tpfms muon fit into the muon
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
int i
Definition: DBlmapReader.cc:9
void embedStandAloneMuon()
set reference to Track reconstructed in the muon detector only (reimplemented from reco::Muon) ...
Definition: Muon.cc:237
void setIsolation(IsolationKeys key, float value)
Definition: Lepton.h:100
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:38
bool isGlobalMuon() const
Definition: Muon.h:219
bool embedBestTrack_
embed the track from best muon measurement
ProductID id() const
Definition: RefToBase.h:220
void setResolutions(pat::PATObject< T > &obj) const
Sets the efficiencies for this object, using the reference to the original objects.
void embedPickyMuon()
embed reference to the above picky Track
Definition: Muon.cc:270
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
void setIsoDeposit(IsolationKeys key, const IsoDeposit &dep)
Sets the IsoDeposit associated with some key; if it is already existent, it is overwritten.
Definition: Lepton.h:177
void embedCombinedMuon()
set reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon...
Definition: Muon.cc:247
bool useParticleFlow_
switch to use particle flow (PF2PAT) or not
bool isAValidMuonTrack(const MuonTrackType &type) const
Definition: Muon.cc:853
bool embedStandAloneMuon_
embed track from muon system into the muon
reco::PFCandidateRef pfCandidateRef() const
reference to the source IsolatedPFCandidates
Definition: Muon.cc:198
bool embedTrack_
embed the track from inner tracker into the muon
bool addGenMatch_
add generator match information
void embedGenParticle()
Definition: PATObject.h:675
void embedTrack()
set reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
Definition: Muon.cc:227
int j
Definition: DBlmapReader.cc:9
bool first
Definition: L1TdeRCT.cc:94
void embedTpfmsMuon()
embed reference to the above tpfms Track
Definition: Muon.cc:280
void addGenParticleRef(const reco::GenParticleRef &ref)
Definition: PATObject.h:659
void embedDytMuon()
embed reference to the above dyt Track
Definition: Muon.cc:290
void embedMuonBestTrack()
set reference to Track selected to be the best measurement of the muon parameters (reimplemented from...
Definition: Muon.cc:216
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
pat::helper::EfficiencyLoader efficiencyLoader_
helper class to add efficiencies to the muon
bool embedPickyMuon_
embed track from picky muon fit into the muon
bool embedDytMuon_
embed track from DYT muon fit into the muon
virtual void setP4(const LorentzVector &p4) GCC11_FINAL
set 4-momentum
bool embedGenMatch_
embed the gen match information into the muon
IsolationLabels isoDepositLabels_
input source for isoDeposits
IsolationLabels isolationValueLabels_
input source isolation value maps
bool embedCombinedMuon_
embed track of the combined fit into the muon
pat::helper::KinResolutionsLoader resolutionLoader_
helper class to add resolutions to the muon
void PATMuonProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

everything that needs to be done during the event loop

Implements edm::EDProducer.

Definition at line 115 of file PATMuonProducer.cc.

References IPTools::absoluteTransverseImpactParameter(), addGenMatch_, beamLineSrc_, SiPixelRawToDigiRegional_cfi::beamSpot, pat::helper::MultiIsolator::beginEvent(), caloMETMuonCorrs_, efficiencyLoader_, pat::Muon::embedCaloMETMuonCorrs(), embedCaloMETMuonCorrs_, embedGenMatch_, embedHighLevel(), embedHighLevelSelection_, pat::Muon::embedPFCandidate(), embedPFCandidate_, pat::Muon::embedTcMETMuonCorrs(), embedTcMETMuonCorrs_, pat::helper::EfficiencyLoader::enabled(), pat::helper::KinResolutionsLoader::enabled(), pat::helper::MultiIsolator::enabled(), pat::helper::MultiIsolator::endEvent(), pat::helper::MultiIsolator::fill(), fillMuon(), genMatchSrc_, edm::EventSetup::get(), edm::Event::getByLabel(), i, customizeTrackingMonitorSeedNumber::idx, getHLTprescales::index, susybsm::HSCParticleType::innerTrack, edm::Ref< C, T, F >::isAvailable(), edm::Ref< C, T, F >::isNonnull(), isoDepositLabels_, isolationValueLabels_, isolator_, isolatorTmpStorage_, edm::EventBase::isRealData(), edm::HandleBase::isValid(), j, reco::PFCandidate::muonRef(), patZpeak::muons, muonSrc_, pat::helper::EfficiencyLoader::newEvent(), pat::helper::KinResolutionsLoader::newEvent(), muonProducer_cfi::patMuons, pfMuons_cff::pfMuons, pfMuonSrc_, pTComparator_, edm::Event::put(), pvSrc_, resolutionLoader_, query::result, edm::second(), pat::Muon::setDB(), pat::Lepton< LeptonType >::setIsolation(), pat::Muon::setNormChi2(), pat::Muon::setNumberOfValidHits(), pat::Muon::setPFCandidateRef(), python.multivaluedict::sort(), tcMETMuonCorrs_, groupFilesInBlocks::tt, useParticleFlow_, usePV_, userDataHelper_, useUserData_, reco::BeamSpot::x0(), reco::BeamSpot::y0(), and reco::BeamSpot::z0().

116 {
117  // switch off embedding (in unschedules mode)
118  if (iEvent.isRealData()){
119  addGenMatch_ = false;
120  embedGenMatch_ = false;
121  }
122 
124  iEvent.getByLabel(muonSrc_, muons);
125 
126  // get the ESHandle for the transient track builder,
127  // if needed for high level selection embedding
129 
130  if(isolator_.enabled()) isolator_.beginEvent(iEvent,iSetup);
132  if(resolutionLoader_.enabled()) resolutionLoader_.newEvent(iEvent, iSetup);
133 
134  IsoDepositMaps deposits(isoDepositLabels_.size());
135  for (size_t j = 0; j<isoDepositLabels_.size(); ++j) {
136  iEvent.getByLabel(isoDepositLabels_[j].second, deposits[j]);
137  }
138 
139  IsolationValueMaps isolationValues(isolationValueLabels_.size());
140  for (size_t j = 0; j<isolationValueLabels_.size(); ++j) {
141  iEvent.getByLabel(isolationValueLabels_[j].second, isolationValues[j]);
142  }
143 
144  // prepare the MC matching
145  GenAssociations genMatches(genMatchSrc_.size());
146  if (addGenMatch_) {
147  for (size_t j = 0, nd = genMatchSrc_.size(); j < nd; ++j) {
148  iEvent.getByLabel(genMatchSrc_[j], genMatches[j]);
149  }
150  }
151 
152  // prepare the high level selection: needs beamline
153  // OR primary vertex, depending on user selection
154  reco::TrackBase::Point beamPoint(0,0,0);
155  reco::Vertex primaryVertex;
157  bool beamSpotIsValid = false;
158  bool primaryVertexIsValid = false;
159  if ( embedHighLevelSelection_ ) {
160  // get the beamspot
161  edm::Handle<reco::BeamSpot> beamSpotHandle;
162  iEvent.getByLabel(beamLineSrc_, beamSpotHandle);
163 
164  // get the primary vertex
166  iEvent.getByLabel( pvSrc_, pvHandle );
167 
168  if( beamSpotHandle.isValid() ){
169  beamSpot = *beamSpotHandle;
170  beamSpotIsValid = true;
171  } else{
172  edm::LogError("DataNotAvailable")
173  << "No beam spot available from EventSetup, not adding high level selection \n";
174  }
175  beamPoint = reco::TrackBase::Point ( beamSpot.x0(), beamSpot.y0(), beamSpot.z0() );
176  if( pvHandle.isValid() && !pvHandle->empty() ) {
177  primaryVertex = pvHandle->at(0);
178  primaryVertexIsValid = true;
179  } else {
180  edm::LogError("DataNotAvailable")
181  << "No primary vertex available from EventSetup, not adding high level selection \n";
182  }
183  // this is needed by the IPTools methods from the tracking group
184  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", trackBuilder);
185  }
186 
187  // this will be the new object collection
188  std::vector<Muon> * patMuons = new std::vector<Muon>();
189 
190  if( useParticleFlow_ ){
191  // get the PFCandidates of type muons
193  iEvent.getByLabel(pfMuonSrc_, pfMuons);
194 
195  unsigned index=0;
196  for( reco::PFCandidateConstIterator i = pfMuons->begin(); i != pfMuons->end(); ++i, ++index) {
197  const reco::PFCandidate& pfmu = *i;
198  //const reco::IsolaPFCandidate& pfmu = *i;
199  const reco::MuonRef& muonRef = pfmu.muonRef();
200  assert( muonRef.isNonnull() );
201 
202  MuonBaseRef muonBaseRef(muonRef);
203  Muon aMuon(muonBaseRef);
204 
205  if ( useUserData_ ) {
206  userDataHelper_.add( aMuon, iEvent, iSetup );
207  }
208 
209  // embed high level selection
210  if ( embedHighLevelSelection_ ) {
211  // get the tracks
212  reco::TrackRef innerTrack = muonBaseRef->innerTrack();
213  reco::TrackRef globalTrack= muonBaseRef->globalTrack();
214  reco::TrackRef bestTrack = muonBaseRef->muonBestTrack();
215  reco::TrackRef chosenTrack = innerTrack;
216  // Make sure the collection it points to is there
217  if ( bestTrack.isNonnull() && bestTrack.isAvailable() )
218  chosenTrack = bestTrack;
219 
220  if ( chosenTrack.isNonnull() && chosenTrack.isAvailable() ) {
221  unsigned int nhits = chosenTrack->numberOfValidHits(); // ????
222  aMuon.setNumberOfValidHits( nhits );
223 
224  reco::TransientTrack tt = trackBuilder->build(chosenTrack);
225  embedHighLevel( aMuon,
226  chosenTrack,
227  tt,
228  primaryVertex,
229  primaryVertexIsValid,
230  beamSpot,
231  beamSpotIsValid );
232 
233  // Correct to PV, or beam spot
234  if ( !usePV_ ) {
235  double corr_d0 = -1.0 * chosenTrack->dxy( beamPoint );
236  aMuon.setDB( corr_d0, -1.0 );
237  } else {
238  std::pair<bool,Measurement1D> result = IPTools::absoluteTransverseImpactParameter(tt, primaryVertex);
239  double d0_corr = result.second.value();
240  double d0_err = result.second.error();
241  aMuon.setDB( d0_corr, d0_err );
242  }
243  }
244 
245  if ( globalTrack.isNonnull() && globalTrack.isAvailable() ) {
246  double norm_chi2 = globalTrack->chi2() / globalTrack->ndof();
247  aMuon.setNormChi2( norm_chi2 );
248  }
249  }
250  reco::PFCandidateRef pfRef(pfMuons,index);
251  //reco::PFCandidatePtr ptrToMother(pfMuons,index);
252  reco::CandidateBaseRef pfBaseRef( pfRef );
253 
254  aMuon.setPFCandidateRef( pfRef );
255  if( embedPFCandidate_ ) aMuon.embedPFCandidate();
256  fillMuon( aMuon, muonBaseRef, pfBaseRef, genMatches, deposits, isolationValues );
257  patMuons->push_back(aMuon);
258  }
259  }
260  else {
262  iEvent.getByLabel(muonSrc_, muons);
263 
264  // embedding of muon MET corrections
266  //edm::ValueMap<reco::MuonMETCorrectionData> caloMETmuCorValueMap;
268  iEvent.getByLabel(caloMETMuonCorrs_, caloMETMuonCorrs);
269  //caloMETmuCorValueMap = *caloMETmuCorValueMap_h;
270  }
272  //edm::ValueMap<reco::MuonMETCorrectionData> tcMETmuCorValueMap;
274  iEvent.getByLabel(tcMETMuonCorrs_, tcMETMuonCorrs);
275  //tcMETmuCorValueMap = *tcMETmuCorValueMap_h;
276  }
277  for (edm::View<reco::Muon>::const_iterator itMuon = muons->begin(); itMuon != muons->end(); ++itMuon) {
278  // construct the Muon from the ref -> save ref to original object
279  unsigned int idx = itMuon - muons->begin();
280  MuonBaseRef muonRef = muons->refAt(idx);
281  reco::CandidateBaseRef muonBaseRef( muonRef );
282 
283  Muon aMuon(muonRef);
284  fillMuon( aMuon, muonRef, muonBaseRef, genMatches, deposits, isolationValues);
285 
286  // Isolation
287  if (isolator_.enabled()) {
288  //reco::CandidatePtr mother = ptrToMother->sourceCandidatePtr(0);
289  isolator_.fill(*muons, idx, isolatorTmpStorage_);
290  typedef pat::helper::MultiIsolator::IsolationValuePairs IsolationValuePairs;
291  // better to loop backwards, so the vector is resized less times
292  for (IsolationValuePairs::const_reverse_iterator it = isolatorTmpStorage_.rbegin(), ed = isolatorTmpStorage_.rend(); it != ed; ++it) {
293  aMuon.setIsolation(it->first, it->second);
294  }
295  }
296 
297  // for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
298  // aMuon.setIsoDeposit(isoDepositLabels_[j].first,
299  // (*deposits[j])[muonRef]);
300  // }
301 
302  // add sel to selected
303  edm::Ptr<reco::Muon> muonsPtr = muons->ptrAt(idx);
304  if ( useUserData_ ) {
305  userDataHelper_.add( aMuon, iEvent, iSetup );
306  }
307 
308  // embed high level selection
309  if ( embedHighLevelSelection_ ) {
310  // get the tracks
311  reco::TrackRef innerTrack = itMuon->innerTrack();
312  reco::TrackRef globalTrack= itMuon->globalTrack();
313  reco::TrackRef bestTrack = itMuon->muonBestTrack();
314  reco::TrackRef chosenTrack = innerTrack;
315  // Make sure the collection it points to is there
316  if ( bestTrack.isNonnull() && bestTrack.isAvailable() )
317  chosenTrack = bestTrack;
318  if ( chosenTrack.isNonnull() && chosenTrack.isAvailable() ) {
319  unsigned int nhits = chosenTrack->numberOfValidHits(); // ????
320  aMuon.setNumberOfValidHits( nhits );
321 
322  reco::TransientTrack tt = trackBuilder->build(chosenTrack);
323  embedHighLevel( aMuon,
324  chosenTrack,
325  tt,
326  primaryVertex,
327  primaryVertexIsValid,
328  beamSpot,
329  beamSpotIsValid );
330 
331  // Correct to PV, or beam spot
332  if ( !usePV_ ) {
333  double corr_d0 = -1.0 * chosenTrack->dxy( beamPoint );
334  aMuon.setDB( corr_d0, -1.0 );
335  } else {
336  std::pair<bool,Measurement1D> result = IPTools::absoluteTransverseImpactParameter(tt, primaryVertex);
337  double d0_corr = result.second.value();
338  double d0_err = result.second.error();
339  aMuon.setDB( d0_corr, d0_err );
340  }
341  }
342 
343  if ( globalTrack.isNonnull() && globalTrack.isAvailable() ) {
344  double norm_chi2 = globalTrack->chi2() / globalTrack->ndof();
345  aMuon.setNormChi2( norm_chi2 );
346  }
347  }
348 
349  // embed MET muon corrections
350  if( embedCaloMETMuonCorrs_ ) aMuon.embedCaloMETMuonCorrs((*caloMETMuonCorrs)[muonRef]);
351  if( embedTcMETMuonCorrs_ ) aMuon.embedTcMETMuonCorrs((*tcMETMuonCorrs )[muonRef]);
352 
353  patMuons->push_back(aMuon);
354  }
355  }
356 
357  // sort muons in pt
358  std::sort(patMuons->begin(), patMuons->end(), pTComparator_);
359 
360  // put genEvt object in Event
361  std::auto_ptr<std::vector<Muon> > ptr(patMuons);
362  iEvent.put(ptr);
363 
365 }
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
bool useUserData_
add user data to the muon (this will be data members of th muon even w/o embedding) ...
double z0() const
z coordinate
Definition: BeamSpot.h:69
bool usePV_
use the primary vertex or the beamspot
int i
Definition: DBlmapReader.cc:9
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
bool embedTcMETMuonCorrs_
embed muon MET correction info for tcMET into the muon
bool embedCaloMETMuonCorrs_
embed muon MET correction info for caloMET into the muon
edm::InputTag pvSrc_
input source of the primary vertex
edm::InputTag tcMETMuonCorrs_
source of tcMET muon corrections
edm::InputTag pfMuonSrc_
input source pfCandidates that will be to be transformed into pat::Muons, when using PF2PAT ...
bool isAvailable() const
Definition: Ref.h:276
PFCandidateCollection::const_iterator PFCandidateConstIterator
iterator
bool isRealData() const
Definition: EventBase.h:60
void embedHighLevel(pat::Muon &aMuon, reco::TrackRef track, reco::TransientTrack &tt, reco::Vertex &primaryVertex, bool primaryVertexIsValid, reco::BeamSpot &beamspot, bool beamspotIsValid)
pat::helper::MultiIsolator isolator_
helper class to add userdefined isolation values to the muon
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
U second(std::pair< T, U > const &p)
bool useParticleFlow_
switch to use particle flow (PF2PAT) or not
pat::PATUserDataHelper< pat::Muon > userDataHelper_
helper class to add userData to the muon
bool enabled() const
True if it has a non null configuration.
Definition: MultiIsolator.h:50
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
void beginEvent(const edm::Event &event, const edm::EventSetup &eventSetup)
GreaterByPt< Muon > pTComparator_
bool addGenMatch_
add generator match information
edm::InputTag beamLineSrc_
input source of the primary vertex/beamspot
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
tuple result
Definition: query.py:137
int j
Definition: DBlmapReader.cc:9
math::XYZPoint Point
point in the space
Definition: TrackBase.h:76
bool isValid() const
Definition: HandleBase.h:76
std::vector< edm::InputTag > genMatchSrc_
input tags for generator match information
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
reco::MuonRef muonRef() const
Definition: PFCandidate.cc:366
edm::InputTag muonSrc_
input source
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
const T & get() const
Definition: EventSetup.h:55
edm::InputTag caloMETMuonCorrs_
source of caloMET muon corrections
std::pair< bool, Measurement1D > absoluteTransverseImpactParameter(const reco::TransientTrack &transientTrack, const reco::Vertex &vertex)
Definition: IPTools.cc:43
std::vector< edm::Handle< edm::Association< reco::GenParticleCollection > > > GenAssociations
void fillMuon(Muon &aMuon, const MuonBaseRef &muonRef, const reco::CandidateBaseRef &baseRef, const GenAssociations &genMatches, const IsoDepositMaps &deposits, const IsolationValueMaps &isolationValues) const
common muon filling, for both the standard and PF2PAT case
std::vector< std::pair< pat::IsolationKeys, float > > IsolationValuePairs
Definition: MultiIsolator.h:16
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:35
pat::helper::EfficiencyLoader efficiencyLoader_
helper class to add efficiencies to the muon
tuple muons
Definition: patZpeak.py:38
double y0() const
y coordinate
Definition: BeamSpot.h:67
std::vector< edm::Handle< edm::ValueMap< IsoDeposit > > > IsoDepositMaps
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
isolation value pair for temporary storage before being folded into the muon
bool embedGenMatch_
embed the gen match information into the muon
IsolationLabels isoDepositLabels_
input source for isoDeposits
IsolationLabels isolationValueLabels_
input source isolation value maps
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
edm::RefToBase< reco::Muon > MuonBaseRef
typedefs for convenience
bool embedPFCandidate_
embed pfCandidates into the muon
void newEvent(const edm::Event &event, const edm::EventSetup &setup) const
To be called for each new event, reads in the EventSetup object.
Analysis-level muon class.
Definition: Muon.h:51
pat::helper::KinResolutionsLoader resolutionLoader_
helper class to add resolutions to the muon
void newEvent(const edm::Event &event) const
To be called for each new event, reads in the ValueMaps for efficiencies.
void fill(const edm::View< T > &coll, int idx, IsolationValuePairs &isolations) const
Definition: MultiIsolator.h:82
tuple pfMuons
Definition: pfMuons_cff.py:8
double x0() const
x coordinate
Definition: BeamSpot.h:65
bool embedHighLevelSelection_
embed high level selection variables
void PATMuonProducer::readIsolationLabels ( const edm::ParameterSet iConfig,
const char *  psetName,
IsolationLabels labels 
)
private

fill label vector from the contents of the parameter set, for the embedding of isoDeposits or userIsolation values

Definition at line 536 of file PATMuonProducer.cc.

References pat::EcalIso, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), pat::HcalIso, combine::key, pat::PfAllParticleIso, pat::PfChargedAllIso, pat::PfChargedHadronIso, pat::PfGammaIso, pat::PfNeutralHadronIso, pat::PfPUChargedHadronIso, pat::TrackIso, and pat::UserBaseIso.

Referenced by PATMuonProducer().

537 {
538  labels.clear();
539 
540  if (iConfig.exists( psetName )) {
541  edm::ParameterSet depconf = iConfig.getParameter<edm::ParameterSet>(psetName);
542 
543  if (depconf.exists("tracker")) labels.push_back(std::make_pair(pat::TrackIso, depconf.getParameter<edm::InputTag>("tracker")));
544  if (depconf.exists("ecal")) labels.push_back(std::make_pair(pat::EcalIso, depconf.getParameter<edm::InputTag>("ecal")));
545  if (depconf.exists("hcal")) labels.push_back(std::make_pair(pat::HcalIso, depconf.getParameter<edm::InputTag>("hcal")));
546  if (depconf.exists("pfAllParticles")) {
547  labels.push_back(std::make_pair(pat::PfAllParticleIso, depconf.getParameter<edm::InputTag>("pfAllParticles")));
548  }
549  if (depconf.exists("pfChargedHadrons")) {
550  labels.push_back(std::make_pair(pat::PfChargedHadronIso, depconf.getParameter<edm::InputTag>("pfChargedHadrons")));
551  }
552  if (depconf.exists("pfChargedAll")) {
553  labels.push_back(std::make_pair(pat::PfChargedAllIso, depconf.getParameter<edm::InputTag>("pfChargedAll")));
554  }
555  if (depconf.exists("pfPUChargedHadrons")) {
556  labels.push_back(std::make_pair(pat::PfPUChargedHadronIso, depconf.getParameter<edm::InputTag>("pfPUChargedHadrons")));
557  }
558  if (depconf.exists("pfNeutralHadrons")) {
559  labels.push_back(std::make_pair(pat::PfNeutralHadronIso, depconf.getParameter<edm::InputTag>("pfNeutralHadrons")));
560  }
561  if (depconf.exists("pfPhotons")) {
562  labels.push_back(std::make_pair(pat::PfGammaIso, depconf.getParameter<edm::InputTag>("pfPhotons")));
563  }
564  if (depconf.exists("user")) {
565  std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag> >("user");
566  std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
567  int key = UserBaseIso;
568  for ( ; it != ed; ++it, ++key) {
569  labels.push_back(std::make_pair(IsolationKeys(key), *it));
570  }
571  }
572  }
573 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
IsolationKeys
Enum defining isolation keys.
Definition: Isolation.h:9
list key
Definition: combine.py:13

Member Data Documentation

bool pat::PATMuonProducer::addEfficiencies_
private

add efficiencies to the muon (this will be data members of th muon even w/o embedding)

Definition at line 138 of file PATMuonProducer.h.

Referenced by PATMuonProducer().

bool pat::PATMuonProducer::addGenMatch_
private

add generator match information

Definition at line 110 of file PATMuonProducer.h.

Referenced by fillMuon(), PATMuonProducer(), and produce().

bool pat::PATMuonProducer::addResolutions_
private

add resolutions to the muon (this will be data members of th muon even w/o embedding)

Definition at line 116 of file PATMuonProducer.h.

Referenced by PATMuonProducer().

edm::InputTag pat::PATMuonProducer::beamLineSrc_
private

input source of the primary vertex/beamspot

Definition at line 128 of file PATMuonProducer.h.

Referenced by PATMuonProducer(), and produce().

edm::InputTag pat::PATMuonProducer::caloMETMuonCorrs_
private

source of caloMET muon corrections

Definition at line 98 of file PATMuonProducer.h.

Referenced by PATMuonProducer(), and produce().

pat::helper::EfficiencyLoader pat::PATMuonProducer::efficiencyLoader_
private

helper class to add efficiencies to the muon

Definition at line 150 of file PATMuonProducer.h.

Referenced by fillMuon(), PATMuonProducer(), and produce().

bool pat::PATMuonProducer::embedBestTrack_
private

embed the track from best muon measurement

Definition at line 88 of file PATMuonProducer.h.

Referenced by fillMuon(), and PATMuonProducer().

bool pat::PATMuonProducer::embedCaloMETMuonCorrs_
private

embed muon MET correction info for caloMET into the muon

Definition at line 96 of file PATMuonProducer.h.

Referenced by PATMuonProducer(), and produce().

bool pat::PATMuonProducer::embedCombinedMuon_
private

embed track of the combined fit into the muon

Definition at line 94 of file PATMuonProducer.h.

Referenced by fillMuon(), and PATMuonProducer().

bool pat::PATMuonProducer::embedDytMuon_
private

embed track from DYT muon fit into the muon

Definition at line 108 of file PATMuonProducer.h.

Referenced by fillMuon(), and PATMuonProducer().

bool pat::PATMuonProducer::embedGenMatch_
private

embed the gen match information into the muon

Definition at line 114 of file PATMuonProducer.h.

Referenced by fillMuon(), PATMuonProducer(), and produce().

bool pat::PATMuonProducer::embedHighLevelSelection_
private

embed high level selection variables

Definition at line 126 of file PATMuonProducer.h.

Referenced by PATMuonProducer(), and produce().

bool pat::PATMuonProducer::embedPFCandidate_
private

embed pfCandidates into the muon

Definition at line 124 of file PATMuonProducer.h.

Referenced by PATMuonProducer(), and produce().

bool pat::PATMuonProducer::embedPickyMuon_
private

embed track from picky muon fit into the muon

Definition at line 104 of file PATMuonProducer.h.

Referenced by fillMuon(), and PATMuonProducer().

bool pat::PATMuonProducer::embedStandAloneMuon_
private

embed track from muon system into the muon

Definition at line 92 of file PATMuonProducer.h.

Referenced by fillMuon(), and PATMuonProducer().

bool pat::PATMuonProducer::embedTcMETMuonCorrs_
private

embed muon MET correction info for tcMET into the muon

Definition at line 100 of file PATMuonProducer.h.

Referenced by PATMuonProducer(), and produce().

bool pat::PATMuonProducer::embedTpfmsMuon_
private

embed track from tpfms muon fit into the muon

Definition at line 106 of file PATMuonProducer.h.

Referenced by fillMuon(), and PATMuonProducer().

bool pat::PATMuonProducer::embedTrack_
private

embed the track from inner tracker into the muon

Definition at line 90 of file PATMuonProducer.h.

Referenced by fillMuon(), and PATMuonProducer().

std::vector<edm::InputTag> pat::PATMuonProducer::genMatchSrc_
private

input tags for generator match information

Definition at line 112 of file PATMuonProducer.h.

Referenced by PATMuonProducer(), and produce().

IsolationLabels pat::PATMuonProducer::isoDepositLabels_
private

input source for isoDeposits

Definition at line 134 of file PATMuonProducer.h.

Referenced by fillMuon(), PATMuonProducer(), and produce().

IsolationLabels pat::PATMuonProducer::isolationValueLabels_
private

input source isolation value maps

Definition at line 136 of file PATMuonProducer.h.

Referenced by fillMuon(), PATMuonProducer(), and produce().

pat::helper::MultiIsolator pat::PATMuonProducer::isolator_
private

helper class to add userdefined isolation values to the muon

Definition at line 146 of file PATMuonProducer.h.

Referenced by produce().

pat::helper::MultiIsolator::IsolationValuePairs pat::PATMuonProducer::isolatorTmpStorage_
private

isolation value pair for temporary storage before being folded into the muon

Definition at line 148 of file PATMuonProducer.h.

Referenced by produce().

edm::InputTag pat::PATMuonProducer::muonSrc_
private

input source

Definition at line 85 of file PATMuonProducer.h.

Referenced by PATMuonProducer(), and produce().

edm::InputTag pat::PATMuonProducer::pfMuonSrc_
private

input source pfCandidates that will be to be transformed into pat::Muons, when using PF2PAT

Definition at line 122 of file PATMuonProducer.h.

Referenced by PATMuonProducer(), and produce().

GreaterByPt<Muon> pat::PATMuonProducer::pTComparator_
private

— tools — comparator for pt ordering

Definition at line 144 of file PATMuonProducer.h.

Referenced by produce().

edm::InputTag pat::PATMuonProducer::pvSrc_
private

input source of the primary vertex

Definition at line 132 of file PATMuonProducer.h.

Referenced by PATMuonProducer(), and produce().

pat::helper::KinResolutionsLoader pat::PATMuonProducer::resolutionLoader_
private

helper class to add resolutions to the muon

Definition at line 118 of file PATMuonProducer.h.

Referenced by fillMuon(), PATMuonProducer(), and produce().

edm::InputTag pat::PATMuonProducer::tcMETMuonCorrs_
private

source of tcMET muon corrections

Definition at line 102 of file PATMuonProducer.h.

Referenced by PATMuonProducer(), and produce().

bool pat::PATMuonProducer::useParticleFlow_
private

switch to use particle flow (PF2PAT) or not

Definition at line 120 of file PATMuonProducer.h.

Referenced by fillMuon(), PATMuonProducer(), and produce().

bool pat::PATMuonProducer::usePV_
private

use the primary vertex or the beamspot

Definition at line 130 of file PATMuonProducer.h.

Referenced by PATMuonProducer(), and produce().

pat::PATUserDataHelper<pat::Muon> pat::PATMuonProducer::userDataHelper_
private

helper class to add userData to the muon

Definition at line 152 of file PATMuonProducer.h.

Referenced by PATMuonProducer(), and produce().

bool pat::PATMuonProducer::useUserData_
private

add user data to the muon (this will be data members of th muon even w/o embedding)

Definition at line 140 of file PATMuonProducer.h.

Referenced by PATMuonProducer(), and produce().