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 hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () 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, const MagneticField &magneticField, 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_
 
edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagFieldToken_
 
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 40 of file MuonMETValueMapProducer.h.

Constructor & Destructor Documentation

◆ MuonMETValueMapProducer()

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

Definition at line 55 of file MuonMETValueMapProducer.cc.

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

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

◆ ~MuonMETValueMapProducer()

cms::MuonMETValueMapProducer::~MuonMETValueMapProducer ( )
inlineoverride

Definition at line 43 of file MuonMETValueMapProducer.h.

43 {}

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 139 of file MuonMETValueMapProducer.cc.

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

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,
const MagneticField magneticField,
edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 115 of file MuonMETValueMapProducer.cc.

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

References TrackDetectorAssociator::associate(), TrackDetectorAssociator::getFreeTrajectoryState(), MuonMETAlgo::GetMuDepDeltas(), iEvent, info(), HLT_FULL_cff::magneticField, 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 80 of file MuonMETValueMapProducer.cc.

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

References pwdgSkimBPark_cfi::beamSpot, beamSpotToken_, decide_correction_type(), determine_deltax_deltay(), edm::EventSetup::getData(), iEvent, magFieldToken_, HLT_FULL_cff::magneticField, eostools::move(), HLT_FULL_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 148 of file MuonMETValueMapProducer.cc.

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

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 73 of file MuonMETValueMapProducer.h.

Referenced by MuonMETValueMapProducer(), and produce().

◆ isAlsoTkMu_

bool cms::MuonMETValueMapProducer::isAlsoTkMu_
private

Definition at line 61 of file MuonMETValueMapProducer.h.

Referenced by should_type_MuonCandidateValuesUsed().

◆ magFieldToken_

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> cms::MuonMETValueMapProducer::magFieldToken_
private

Definition at line 74 of file MuonMETValueMapProducer.h.

Referenced by MuonMETValueMapProducer(), and produce().

◆ maxd0_

double cms::MuonMETValueMapProducer::maxd0_
private

Definition at line 63 of file MuonMETValueMapProducer.h.

Referenced by should_type_MuonCandidateValuesUsed().

◆ maxEta_

double cms::MuonMETValueMapProducer::maxEta_
private

Definition at line 60 of file MuonMETValueMapProducer.h.

Referenced by should_type_MuonCandidateValuesUsed().

◆ maxNormChi2_

double cms::MuonMETValueMapProducer::maxNormChi2_
private

Definition at line 62 of file MuonMETValueMapProducer.h.

Referenced by should_type_MuonCandidateValuesUsed().

◆ minnHits_

int cms::MuonMETValueMapProducer::minnHits_
private

Definition at line 64 of file MuonMETValueMapProducer.h.

Referenced by should_type_MuonCandidateValuesUsed().

◆ minnValidStaHits_

int cms::MuonMETValueMapProducer::minnValidStaHits_
private

Definition at line 65 of file MuonMETValueMapProducer.h.

Referenced by should_type_MuonCandidateValuesUsed().

◆ minPt_

double cms::MuonMETValueMapProducer::minPt_
private

Definition at line 59 of file MuonMETValueMapProducer.h.

Referenced by should_type_MuonCandidateValuesUsed().

◆ muonToken_

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

Definition at line 72 of file MuonMETValueMapProducer.h.

Referenced by MuonMETValueMapProducer(), and produce().

◆ towerEtThreshold_

double cms::MuonMETValueMapProducer::towerEtThreshold_
private

Definition at line 69 of file MuonMETValueMapProducer.h.

Referenced by determine_deltax_deltay().

◆ trackAssociator_

TrackDetectorAssociator cms::MuonMETValueMapProducer::trackAssociator_
private

Definition at line 77 of file MuonMETValueMapProducer.h.

Referenced by determine_deltax_deltay(), and MuonMETValueMapProducer().

◆ trackAssociatorParameters_

TrackAssociatorParameters cms::MuonMETValueMapProducer::trackAssociatorParameters_
private

Definition at line 76 of file MuonMETValueMapProducer.h.

Referenced by determine_deltax_deltay(), and MuonMETValueMapProducer().

◆ useHO_

bool cms::MuonMETValueMapProducer::useHO_
private

Definition at line 68 of file MuonMETValueMapProducer.h.

Referenced by determine_deltax_deltay().

◆ useRecHits_

bool cms::MuonMETValueMapProducer::useRecHits_
private

Definition at line 70 of file MuonMETValueMapProducer.h.

Referenced by determine_deltax_deltay().

◆ useTrackAssociatorPositions_

bool cms::MuonMETValueMapProducer::useTrackAssociatorPositions_
private

Definition at line 67 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:139
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
TrackDetectorAssociator::useDefaultPropagator
void useDefaultPropagator()
use the default propagator
Definition: TrackDetectorAssociator.cc:81
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
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_FULL_cff.magneticField
magneticField
Definition: HLT_FULL_cff.py:348
edm::Handle
Definition: AssociativeIterator.h:50
cms::MuonMETValueMapProducer::minnValidStaHits_
int minnValidStaHits_
Definition: MuonMETValueMapProducer.h:65
edm::Ref< TrackCollection >
cms::MuonMETValueMapProducer::muonToken_
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
Definition: MuonMETValueMapProducer.h:72
cms::MuonMETValueMapProducer::beamSpotToken_
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
Definition: MuonMETValueMapProducer.h:73
cms::MuonMETValueMapProducer::magFieldToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
Definition: MuonMETValueMapProducer.h:74
HLT_FULL_cff.muon
muon
Definition: HLT_FULL_cff.py:11710
cms::MuonMETValueMapProducer::should_type_MuonCandidateValuesUsed
bool should_type_MuonCandidateValuesUsed(const reco::Muon &muon, const math::XYZPoint &beamSpotPosition)
Definition: MuonMETValueMapProducer.cc:148
cms::MuonMETValueMapProducer::useTrackAssociatorPositions_
bool useTrackAssociatorPositions_
Definition: MuonMETValueMapProducer.h:67
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:70
MuonMETAlgo
Definition: MuonMETAlgo.h:39
edm::ParameterSet
Definition: ParameterSet.h:47
cms::MuonMETValueMapProducer::towerEtThreshold_
double towerEtThreshold_
Definition: MuonMETValueMapProducer.h:69
TrackDetectorAssociator::getFreeTrajectoryState
static FreeTrajectoryState getFreeTrajectoryState(const MagneticField *, const reco::Track &)
get FreeTrajectoryState from different track representations
Definition: TrackDetectorAssociator.cc:553
cms::MuonMETValueMapProducer::isAlsoTkMu_
bool isAlsoTkMu_
Definition: MuonMETValueMapProducer.h:61
iEvent
int iEvent
Definition: GenABIO.cc:224
cms::MuonMETValueMapProducer::trackAssociator_
TrackDetectorAssociator trackAssociator_
Definition: MuonMETValueMapProducer.h:77
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
cms::MuonMETValueMapProducer::trackAssociatorParameters_
TrackAssociatorParameters trackAssociatorParameters_
Definition: MuonMETValueMapProducer.h:76
TrackDetMatchInfo
Definition: TrackDetMatchInfo.h:13
reco::MuonMETCorrectionData::Type
Type
Definition: MuonMETCorrectionData.h:9
eostools.move
def move(src, dest)
Definition: eostools.py:511
cms::MuonMETValueMapProducer::minnHits_
int minnHits_
Definition: MuonMETValueMapProducer.h:64
cms::MuonMETValueMapProducer::minPt_
double minPt_
Definition: MuonMETValueMapProducer.h:59
cms::MuonMETValueMapProducer::maxEta_
double maxEta_
Definition: MuonMETValueMapProducer.h:60
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
cms::MuonMETValueMapProducer::useHO_
bool useHO_
Definition: MuonMETValueMapProducer.h:68
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:110
cms::MuonMETValueMapProducer::maxNormChi2_
double maxNormChi2_
Definition: MuonMETValueMapProducer.h:62
reco::MuonMETCorrectionData
Definition: MuonMETCorrectionData.h:7
cms::MuonMETValueMapProducer::maxd0_
double maxd0_
Definition: MuonMETValueMapProducer.h:63
cms::MuonMETValueMapProducer::determine_deltax_deltay
void determine_deltax_deltay(double &deltax, double &deltay, const reco::Muon &muon, double bfield, const MagneticField &magneticField, edm::Event &iEvent, const edm::EventSetup &iSetup)
Definition: MuonMETValueMapProducer.cc:115
MagneticField
Definition: MagneticField.h:19
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45