CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
cms::MuonMETValueMapProducer Class Reference

#include <MuonMETValueMapProducer.h>

Inheritance diagram for cms::MuonMETValueMapProducer:
edm::stream::EDProducer<>

Public Member Functions

 MuonMETValueMapProducer (const edm::ParameterSet &)
 
 ~MuonMETValueMapProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Member Functions

reco::MuonMETCorrectionData::Type decide_correction_type (const reco::Muon &muon, const math::XYZPoint &beamSpotPosition)
 
void determine_deltax_deltay (double &deltax, double &deltay, const reco::Muon &muon, double bfield, edm::Event &iEvent, const edm::EventSetup &iSetup)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
bool should_type_MuonCandidateValuesUsed (const reco::Muon &muon, const math::XYZPoint &beamSpotPosition)
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpotbeamSpotToken_
 
bool isAlsoTkMu_
 
double maxd0_
 
double maxEta_
 
double maxNormChi2_
 
int minnHits_
 
int minnValidStaHits_
 
double minPt_
 
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
 
double towerEtThreshold_
 
TrackDetectorAssociator trackAssociator_
 
TrackAssociatorParameters trackAssociatorParameters_
 
bool useHO_
 
bool useRecHits_
 
bool useTrackAssociatorPositions_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 37 of file MuonMETValueMapProducer.h.

Constructor & Destructor Documentation

◆ MuonMETValueMapProducer()

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

Definition at line 57 of file MuonMETValueMapProducer.cc.

58  : minPt_(iConfig.getParameter<double>("minPt")),
59  maxEta_(iConfig.getParameter<double>("maxEta")),
60  isAlsoTkMu_(iConfig.getParameter<bool>("isAlsoTkMu")),
61  maxNormChi2_(iConfig.getParameter<double>("maxNormChi2")),
62  maxd0_(iConfig.getParameter<double>("maxd0")),
63  minnHits_(iConfig.getParameter<int>("minnHits")),
64  minnValidStaHits_(iConfig.getParameter<int>("minnValidStaHits")),
65  useTrackAssociatorPositions_(iConfig.getParameter<bool>("useTrackAssociatorPositions")),
66  useHO_(iConfig.getParameter<bool>("useHO")),
67  towerEtThreshold_(iConfig.getParameter<double>("towerEtThreshold")),
68  useRecHits_(iConfig.getParameter<bool>("useRecHits")) {
69  muonToken_ = consumes<edm::View<reco::Muon>>(iConfig.getParameter<edm::InputTag>("muonInputTag"));
70  beamSpotToken_ = consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpotInputTag"));
71 
72  edm::ParameterSet trackAssociatorParams = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
73  edm::ConsumesCollector iC = consumesCollector();
74  trackAssociatorParameters_.loadParameters(trackAssociatorParams, iC);
76 
77  produces<edm::ValueMap<reco::MuonMETCorrectionData>>("muCorrData");
78  }

References beamSpotToken_, edm::ParameterSet::getParameter(), TrackAssociatorParameters::loadParameters(), muonToken_, trackAssociator_, trackAssociatorParameters_, and TrackDetectorAssociator::useDefaultPropagator().

◆ ~MuonMETValueMapProducer()

cms::MuonMETValueMapProducer::~MuonMETValueMapProducer ( )
inlineoverride

Definition at line 40 of file MuonMETValueMapProducer.h.

40 {}

Member Function Documentation

◆ decide_correction_type()

reco::MuonMETCorrectionData::Type MuonMETValueMapProducer::decide_correction_type ( const reco::Muon muon,
const math::XYZPoint beamSpotPosition 
)
private

Definition at line 140 of file MuonMETValueMapProducer.cc.

141  {
142  if (should_type_MuonCandidateValuesUsed(muon, beamSpotPosition))
143  return reco::MuonMETCorrectionData::Type::MuonCandidateValuesUsed;
144 
145  return reco::MuonMETCorrectionData::Type::NotUsed;
146  }

References should_type_MuonCandidateValuesUsed().

Referenced by produce().

◆ determine_deltax_deltay()

void MuonMETValueMapProducer::determine_deltax_deltay ( double &  deltax,
double &  deltay,
const reco::Muon muon,
double  bfield,
edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 117 of file MuonMETValueMapProducer.cc.

122  {
123  reco::TrackRef mu_track;
124  if (muon.isGlobalMuon())
125  mu_track = muon.globalTrack();
126  else if (muon.isTrackerMuon() || muon.isRPCMuon() || muon.isGEMMuon() || muon.isME0Muon())
127  mu_track = muon.innerTrack();
128  else
129  mu_track = muon.outerTrack();
130 
133 
134  MuonMETAlgo alg;
135  alg.GetMuDepDeltas(
137  }

References TrackDetectorAssociator::associate(), TrackDetectorAssociator::getFreeTrajectoryState(), MuonMETAlgo::GetMuDepDeltas(), iEvent, info(), towerEtThreshold_, trackAssociator_, trackAssociatorParameters_, useHO_, useRecHits_, and useTrackAssociatorPositions_.

Referenced by produce().

◆ produce()

void MuonMETValueMapProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 81 of file MuonMETValueMapProducer.cc.

81  {
83  iEvent.getByToken(muonToken_, muons);
84 
86  iEvent.getByToken(beamSpotToken_, beamSpot);
87 
90 
91  double bfield = magneticField->inTesla(GlobalPoint(0., 0., 0.)).z();
92 
93  std::vector<reco::MuonMETCorrectionData> muCorrDataList;
94 
95  for (edm::View<reco::Muon>::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) {
96  double deltax = 0.0;
97  double deltay = 0.0;
98  determine_deltax_deltay(deltax, deltay, *muon, bfield, iEvent, iSetup);
99 
101 
102  reco::MuonMETCorrectionData muMETCorrData(muCorrType, deltax, deltay);
103  muCorrDataList.push_back(muMETCorrData);
104  }
105 
106  auto valueMapMuCorrData = std::make_unique<edm::ValueMap<reco::MuonMETCorrectionData>>();
107 
108  edm::ValueMap<reco::MuonMETCorrectionData>::Filler dataFiller(*valueMapMuCorrData);
109 
110  dataFiller.insert(muons, muCorrDataList.begin(), muCorrDataList.end());
111  dataFiller.fill();
112 
113  iEvent.put(std::move(valueMapMuCorrData), "muCorrData");
114  }

References pwdgSkimBPark_cfi::beamSpot, beamSpotToken_, decide_correction_type(), determine_deltax_deltay(), edm::EventSetup::get(), get, iEvent, HLT_2018_cff::magneticField, eostools::move(), HLT_2018_cff::muon, PDWG_BPHSkim_cff::muons, and muonToken_.

◆ should_type_MuonCandidateValuesUsed()

bool MuonMETValueMapProducer::should_type_MuonCandidateValuesUsed ( const reco::Muon muon,
const math::XYZPoint beamSpotPosition 
)
private

Definition at line 149 of file MuonMETValueMapProducer.cc.

150  {
151  if (!muon.isGlobalMuon())
152  return false;
153  if (!muon.isTrackerMuon() && isAlsoTkMu_)
154  return false;
155  reco::TrackRef globTk = muon.globalTrack();
156  reco::TrackRef siTk = muon.innerTrack();
157 
158  if (muon.pt() < minPt_ || fabs(muon.eta()) > maxEta_)
159  return false;
160  if (globTk->chi2() / globTk->ndof() > maxNormChi2_)
161  return false;
162  if (fabs(globTk->dxy(beamSpotPosition)) > fabs(maxd0_))
163  return false;
164  if (siTk->numberOfValidHits() < minnHits_)
165  return false;
166  if (globTk->hitPattern().numberOfValidMuonHits() < minnValidStaHits_)
167  return false;
168  return true;
169  }

References isAlsoTkMu_, maxd0_, maxEta_, maxNormChi2_, minnHits_, minnValidStaHits_, and minPt_.

Referenced by decide_correction_type().

Member Data Documentation

◆ beamSpotToken_

edm::EDGetTokenT<reco::BeamSpot> cms::MuonMETValueMapProducer::beamSpotToken_
private

Definition at line 69 of file MuonMETValueMapProducer.h.

Referenced by MuonMETValueMapProducer(), and produce().

◆ isAlsoTkMu_

bool cms::MuonMETValueMapProducer::isAlsoTkMu_
private

Definition at line 57 of file MuonMETValueMapProducer.h.

Referenced by should_type_MuonCandidateValuesUsed().

◆ maxd0_

double cms::MuonMETValueMapProducer::maxd0_
private

Definition at line 59 of file MuonMETValueMapProducer.h.

Referenced by should_type_MuonCandidateValuesUsed().

◆ maxEta_

double cms::MuonMETValueMapProducer::maxEta_
private

Definition at line 56 of file MuonMETValueMapProducer.h.

Referenced by should_type_MuonCandidateValuesUsed().

◆ maxNormChi2_

double cms::MuonMETValueMapProducer::maxNormChi2_
private

Definition at line 58 of file MuonMETValueMapProducer.h.

Referenced by should_type_MuonCandidateValuesUsed().

◆ minnHits_

int cms::MuonMETValueMapProducer::minnHits_
private

Definition at line 60 of file MuonMETValueMapProducer.h.

Referenced by should_type_MuonCandidateValuesUsed().

◆ minnValidStaHits_

int cms::MuonMETValueMapProducer::minnValidStaHits_
private

Definition at line 61 of file MuonMETValueMapProducer.h.

Referenced by should_type_MuonCandidateValuesUsed().

◆ minPt_

double cms::MuonMETValueMapProducer::minPt_
private

Definition at line 55 of file MuonMETValueMapProducer.h.

Referenced by should_type_MuonCandidateValuesUsed().

◆ muonToken_

edm::EDGetTokenT<edm::View<reco::Muon> > cms::MuonMETValueMapProducer::muonToken_
private

Definition at line 68 of file MuonMETValueMapProducer.h.

Referenced by MuonMETValueMapProducer(), and produce().

◆ towerEtThreshold_

double cms::MuonMETValueMapProducer::towerEtThreshold_
private

Definition at line 65 of file MuonMETValueMapProducer.h.

Referenced by determine_deltax_deltay().

◆ trackAssociator_

TrackDetectorAssociator cms::MuonMETValueMapProducer::trackAssociator_
private

Definition at line 72 of file MuonMETValueMapProducer.h.

Referenced by determine_deltax_deltay(), and MuonMETValueMapProducer().

◆ trackAssociatorParameters_

TrackAssociatorParameters cms::MuonMETValueMapProducer::trackAssociatorParameters_
private

Definition at line 71 of file MuonMETValueMapProducer.h.

Referenced by determine_deltax_deltay(), and MuonMETValueMapProducer().

◆ useHO_

bool cms::MuonMETValueMapProducer::useHO_
private

Definition at line 64 of file MuonMETValueMapProducer.h.

Referenced by determine_deltax_deltay().

◆ useRecHits_

bool cms::MuonMETValueMapProducer::useRecHits_
private

Definition at line 66 of file MuonMETValueMapProducer.h.

Referenced by determine_deltax_deltay().

◆ useTrackAssociatorPositions_

bool cms::MuonMETValueMapProducer::useTrackAssociatorPositions_
private

Definition at line 63 of file MuonMETValueMapProducer.h.

Referenced by determine_deltax_deltay().

cms::MuonMETValueMapProducer::decide_correction_type
reco::MuonMETCorrectionData::Type decide_correction_type(const reco::Muon &muon, const math::XYZPoint &beamSpotPosition)
Definition: MuonMETValueMapProducer.cc:140
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition: pwdgSkimBPark_cfi.py:5
muon
Definition: MuonCocktails.h:17
HLT_2018_cff.magneticField
magneticField
Definition: HLT_2018_cff.py:348
TrackDetectorAssociator::useDefaultPropagator
void useDefaultPropagator()
use the default propagator
Definition: TrackDetectorAssociator.cc:120
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:152
MuonMETAlgo::GetMuDepDeltas
void GetMuDepDeltas(const reco::Muon *inputMuon, TrackDetMatchInfo &info, bool useTrackAssociatorPositions, bool useRecHits, bool useHO, double towerEtThreshold, double &deltax, double &deltay, double Bfield)
Definition: MuonMETAlgo.cc:96
HLT_2018_cff.muon
muon
Definition: HLT_2018_cff.py:10349
edm::Handle
Definition: AssociativeIterator.h:50
cms::MuonMETValueMapProducer::minnValidStaHits_
int minnValidStaHits_
Definition: MuonMETValueMapProducer.h:61
edm::Ref< TrackCollection >
TrackDetectorAssociator::getFreeTrajectoryState
static FreeTrajectoryState getFreeTrajectoryState(const edm::EventSetup &, const reco::Track &)
get FreeTrajectoryState from different track representations
Definition: TrackDetectorAssociator.cc:600
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
cms::MuonMETValueMapProducer::muonToken_
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
Definition: MuonMETValueMapProducer.h:68
cms::MuonMETValueMapProducer::beamSpotToken_
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
Definition: MuonMETValueMapProducer.h:69
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
cms::MuonMETValueMapProducer::should_type_MuonCandidateValuesUsed
bool should_type_MuonCandidateValuesUsed(const reco::Muon &muon, const math::XYZPoint &beamSpotPosition)
Definition: MuonMETValueMapProducer.cc:149
edm::ESHandle< MagneticField >
cms::MuonMETValueMapProducer::useTrackAssociatorPositions_
bool useTrackAssociatorPositions_
Definition: MuonMETValueMapProducer.h:63
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
TrackAssociatorParameters::loadParameters
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
Definition: TrackAssociatorParameters.cc:18
cms::MuonMETValueMapProducer::useRecHits_
bool useRecHits_
Definition: MuonMETValueMapProducer.h:66
MuonMETAlgo
Definition: MuonMETAlgo.h:39
edm::ParameterSet
Definition: ParameterSet.h:36
cms::MuonMETValueMapProducer::towerEtThreshold_
double towerEtThreshold_
Definition: MuonMETValueMapProducer.h:65
cms::MuonMETValueMapProducer::isAlsoTkMu_
bool isAlsoTkMu_
Definition: MuonMETValueMapProducer.h:57
iEvent
int iEvent
Definition: GenABIO.cc:224
cms::MuonMETValueMapProducer::trackAssociator_
TrackDetectorAssociator trackAssociator_
Definition: MuonMETValueMapProducer.h:72
get
#define get
cms::MuonMETValueMapProducer::trackAssociatorParameters_
TrackAssociatorParameters trackAssociatorParameters_
Definition: MuonMETValueMapProducer.h:71
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
TrackDetMatchInfo
Definition: TrackDetMatchInfo.h:14
reco::MuonMETCorrectionData::Type
Type
Definition: MuonMETCorrectionData.h:9
cms::MuonMETValueMapProducer::determine_deltax_deltay
void determine_deltax_deltay(double &deltax, double &deltay, const reco::Muon &muon, double bfield, edm::Event &iEvent, const edm::EventSetup &iSetup)
Definition: MuonMETValueMapProducer.cc:117
eostools.move
def move(src, dest)
Definition: eostools.py:511
cms::MuonMETValueMapProducer::minnHits_
int minnHits_
Definition: MuonMETValueMapProducer.h:60
cms::MuonMETValueMapProducer::minPt_
double minPt_
Definition: MuonMETValueMapProducer.h:55
cms::MuonMETValueMapProducer::maxEta_
double maxEta_
Definition: MuonMETValueMapProducer.h:56
cms::MuonMETValueMapProducer::useHO_
bool useHO_
Definition: MuonMETValueMapProducer.h:64
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::helper::Filler
Definition: ValueMap.h:22
TrackDetectorAssociator::associate
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
Definition: TrackDetectorAssociator.cc:154
cms::MuonMETValueMapProducer::maxNormChi2_
double maxNormChi2_
Definition: MuonMETValueMapProducer.h:58
reco::MuonMETCorrectionData
Definition: MuonMETCorrectionData.h:7
cms::MuonMETValueMapProducer::maxd0_
double maxd0_
Definition: MuonMETValueMapProducer.h:59
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:39