CMS 3D CMS Logo

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

#include <MuonTCMETValueMapProducer.h>

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

Public Member Functions

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

Private Member Functions

bool isGoodCaloMuon (const reco::Muon *, const unsigned int)
 
bool isGoodMuon (const reco::Muon *)
 
bool isGoodTrack (const reco::Muon *)
 
bool isValidVertex ()
 
int nLayers (const reco::TrackRef)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
class TVector3 propagateTrack (const reco::Muon *)
 

Private Attributes

edm::Handle< reco::BeamSpotbeamSpot_
 
edm::EDGetTokenT< reco::BeamSpotbeamSpotToken_
 
const class MagneticFieldbField
 
double d0cuta_
 
double d0cutb_
 
bool hasValidVertex
 
edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagFieldToken_
 
double maxchi2_
 
double maxchi2_tight_
 
double maxd0cut_
 
double maxeta_
 
double maxpt_
 
double maxpt_eta20_
 
double maxpt_eta25_
 
double maxPtErr_
 
double maxPtErr_tight_
 
double minhits_
 
double minhits_tight_
 
double minpt_
 
double muon_dptrel_
 
double muonchi2_
 
double muond0_
 
double muonDeltaR_
 
double muoneta_
 
bool muonGlobal_
 
double muonhits_
 
int muonMinValidStaHits_
 
double muonpt_
 
edm::Handle< reco::MuonCollectionmuons_
 
edm::EDGetTokenT< reco::MuonCollectionmuonToken_
 
bool muonTracker_
 
int nLayers_
 
int nLayersTight_
 
class TH2D * response_function
 
int rfType_
 
TCMETAlgotcmetAlgo_
 
std::vector< reco::TrackBase::TrackAlgorithmtrackAlgos_
 
std::vector< reco::TrackBase::TrackAlgorithmtrkAlgos_
 
std::vector< int > trkQuality_
 
bool useCaloMuons_
 
bool usePvtxd0_
 
edm::Handle< reco::VertexCollectionvertexHandle_
 
double vertexMaxDZ_
 
int vertexNdof_
 
double vertexRho_
 
edm::EDGetTokenT< reco::VertexCollectionvertexToken_
 
double vertexZ_
 
const reco::VertexCollectionvertices_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 43 of file MuonTCMETValueMapProducer.h.

Constructor & Destructor Documentation

◆ MuonTCMETValueMapProducer()

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

Definition at line 46 of file MuonTCMETValueMapProducer.cc.

References a, reco::TrackBase::algoByName(), hltPFPuppi_cfi::algos, beamSpotToken_, d0cuta_, d0cutb_, edm::ParameterSet::getParameter(), TCMETAlgo::getResponseFunction_fit(), TCMETAlgo::getResponseFunction_mode(), magFieldToken_, maxchi2_, maxchi2_tight_, maxd0cut_, maxeta_, maxpt_, maxpt_eta20_, maxpt_eta25_, maxPtErr_, maxPtErr_tight_, minhits_, minhits_tight_, minpt_, muon_dptrel_, muonchi2_, muond0_, muonDeltaR_, muoneta_, muonGlobal_, muonhits_, muonMinValidStaHits_, muonpt_, muonToken_, muonTracker_, nLayers_, nLayersTight_, response_function, rfType_, AlCaHLTBitMon_QueryRunRegistry::string, tcmetAlgo_, HcalDetIdTransform::transform(), trkAlgos_, trkQuality_, useCaloMuons_, usePvtxd0_, vertexMaxDZ_, vertexNdof_, vertexRho_, vertexToken_, and vertexZ_.

46  {
47  produces<edm::ValueMap<reco::MuonMETCorrectionData>>("muCorrData");
48 
49  rfType_ = iConfig.getParameter<int>("rf_type");
50 
51  nLayers_ = iConfig.getParameter<int>("nLayers");
52  nLayersTight_ = iConfig.getParameter<int>("nLayersTight");
53  vertexNdof_ = iConfig.getParameter<int>("vertexNdof");
54  vertexZ_ = iConfig.getParameter<double>("vertexZ");
55  vertexRho_ = iConfig.getParameter<double>("vertexRho");
56  vertexMaxDZ_ = iConfig.getParameter<double>("vertexMaxDZ");
57  maxpt_eta20_ = iConfig.getParameter<double>("maxpt_eta20");
58  maxpt_eta25_ = iConfig.getParameter<double>("maxpt_eta25");
59 
60  // get configuration parameters
61  std::vector<std::string> algos = iConfig.getParameter<std::vector<std::string>>("trackAlgos");
62  std::transform(algos.begin(), algos.end(), std::back_inserter(trkAlgos_), [](const std::string& a) {
64  });
65  maxd0cut_ = iConfig.getParameter<double>("d0_max");
66  minpt_ = iConfig.getParameter<double>("pt_min");
67  maxpt_ = iConfig.getParameter<double>("pt_max");
68  maxeta_ = iConfig.getParameter<double>("eta_max");
69  maxchi2_ = iConfig.getParameter<double>("chi2_max");
70  minhits_ = iConfig.getParameter<double>("nhits_min");
71  maxPtErr_ = iConfig.getParameter<double>("ptErr_max");
72 
73  trkQuality_ = iConfig.getParameter<std::vector<int>>("track_quality");
74  algos = iConfig.getParameter<std::vector<std::string>>("track_algos");
75  std::transform(algos.begin(), algos.end(), std::back_inserter(trkAlgos_), [](const std::string& a) {
77  });
78  maxchi2_tight_ = iConfig.getParameter<double>("chi2_max_tight");
79  minhits_tight_ = iConfig.getParameter<double>("nhits_min_tight");
80  maxPtErr_tight_ = iConfig.getParameter<double>("ptErr_max_tight");
81  usePvtxd0_ = iConfig.getParameter<bool>("usePvtxd0");
82  d0cuta_ = iConfig.getParameter<double>("d0cuta");
83  d0cutb_ = iConfig.getParameter<double>("d0cutb");
84 
85  muon_dptrel_ = iConfig.getParameter<double>("muon_dptrel");
86  muond0_ = iConfig.getParameter<double>("d0_muon");
87  muonpt_ = iConfig.getParameter<double>("pt_muon");
88  muoneta_ = iConfig.getParameter<double>("eta_muon");
89  muonchi2_ = iConfig.getParameter<double>("chi2_muon");
90  muonhits_ = iConfig.getParameter<double>("nhits_muon");
91  muonGlobal_ = iConfig.getParameter<bool>("global_muon");
92  muonTracker_ = iConfig.getParameter<bool>("tracker_muon");
93  muonDeltaR_ = iConfig.getParameter<double>("deltaR_muon");
94  useCaloMuons_ = iConfig.getParameter<bool>("useCaloMuons");
95  muonMinValidStaHits_ = iConfig.getParameter<int>("muonMinValidStaHits");
96 
97  response_function = nullptr;
98  tcmetAlgo_ = new TCMETAlgo();
99 
100  if (rfType_ == 1)
102  else if (rfType_ == 2)
104 
105  muonToken_ = consumes<reco::MuonCollection>(iConfig.getParameter<edm::InputTag>("muonInputTag"));
106  beamSpotToken_ = consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpotInputTag"));
107  vertexToken_ = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexInputTag"));
108  magFieldToken_ = esConsumes<MagneticField, IdealMagneticFieldRecord>();
109  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TH2D * getResponseFunction_fit()
Definition: TCMETAlgo.cc:3523
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
std::vector< reco::TrackBase::TrackAlgorithm > trkAlgos_
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
TH2D * getResponseFunction_mode()
Definition: TCMETAlgo.cc:4995
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
double a
Definition: hdecay.h:119
static TrackAlgorithm algoByName(const std::string &name)
Definition: TrackBase.cc:137
edm::EDGetTokenT< reco::MuonCollection > muonToken_
unsigned transform(const HcalDetId &id, unsigned transformCode)

◆ ~MuonTCMETValueMapProducer()

MuonTCMETValueMapProducer::~MuonTCMETValueMapProducer ( )
override

Definition at line 112 of file MuonTCMETValueMapProducer.cc.

References tcmetAlgo_.

Member Function Documentation

◆ isGoodCaloMuon()

bool MuonTCMETValueMapProducer::isGoodCaloMuon ( const reco::Muon muon,
const unsigned int  index 
)
private

Definition at line 243 of file MuonTCMETValueMapProducer.cc.

References funct::cos(), spr::deltaEta, SiPixelRawToDigiRegional_cfi::deltaPhi, PbPb_ZMuSkimMuonDPG_cff::deltaR, edm::Ref< C, T, F >::get(), isGoodTrack(), edm::Ref< C, T, F >::isNonnull(), amptDefaultParameters_cff::mu, muonDeltaR_, muons_, and custom_jme_cff::nMuons.

Referenced by produce().

243  {
244  if (muon->pt() < 10)
245  return false;
246 
247  if (!isGoodTrack(muon))
248  return false;
249 
250  const reco::TrackRef inputSiliconTrack = muon->innerTrack();
251  if (!inputSiliconTrack.isNonnull())
252  return false;
253 
254  //check if it is in the vicinity of a global or tracker muon
255  unsigned int nMuons = muons_->size();
256  for (unsigned int iMu = 0; iMu < nMuons; iMu++) {
257  if (iMu == index)
258  continue;
259 
260  const reco::Muon* mu = &(*muons_)[iMu];
261 
262  const reco::TrackRef testSiliconTrack = mu->innerTrack();
263  if (!testSiliconTrack.isNonnull())
264  continue;
265 
266  double deltaEta = inputSiliconTrack.get()->eta() - testSiliconTrack.get()->eta();
267  double deltaPhi = acos(cos(inputSiliconTrack.get()->phi() - testSiliconTrack.get()->phi()));
268  double deltaR = TMath::Sqrt(deltaEta * deltaEta + deltaPhi * deltaPhi);
269 
270  if (deltaR < muonDeltaR_)
271  return false;
272  }
273 
274  return true;
275  }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
static const double deltaEta
Definition: CaloConstants.h:8
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
edm::Handle< reco::MuonCollection > muons_
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232

◆ isGoodMuon()

bool MuonTCMETValueMapProducer::isGoodMuon ( const reco::Muon muon)
private

Definition at line 193 of file MuonTCMETValueMapProducer.cc.

References beamSpot_, hltPixelTracks_cff::chi2, d0, cutBasedMuonId_MuonPOG_V0_cff::globalTrack, edm::Ref< C, T, F >::isNonnull(), edm::HandleBase::isValid(), muon_dptrel_, muonchi2_, muond0_, muoneta_, muonGlobal_, muonhits_, muonMinValidStaHits_, muonpt_, muonTracker_, nhits, and reco::BeamSpot::position().

Referenced by produce().

193  {
194  double d0 = -999;
195  double nhits = 0;
196  double chi2 = 999;
197 
198  // get d0 corrected for beam spot
199  bool haveBeamSpot = true;
200  if (!beamSpot_.isValid())
201  haveBeamSpot = false;
202 
203  if (muonGlobal_ && !muon->isGlobalMuon())
204  return false;
205  if (muonTracker_ && !muon->isTrackerMuon())
206  return false;
207 
208  const reco::TrackRef siTrack = muon->innerTrack();
209  const reco::TrackRef globalTrack = muon->globalTrack();
210 
211  Point bspot = haveBeamSpot ? beamSpot_->position() : Point(0, 0, 0);
212  if (siTrack.isNonnull())
213  nhits = siTrack->numberOfValidHits();
214  if (globalTrack.isNonnull()) {
215  d0 = -1 * globalTrack->dxy(bspot);
216  chi2 = globalTrack->normalizedChi2();
217  }
218 
219  if (fabs(d0) > muond0_)
220  return false;
221  if (muon->pt() < muonpt_)
222  return false;
223  if (fabs(muon->eta()) > muoneta_)
224  return false;
225  if (nhits < muonhits_)
226  return false;
227  if (chi2 > muonchi2_)
228  return false;
229  if (globalTrack->hitPattern().numberOfValidMuonHits() < muonMinValidStaHits_)
230  return false;
231 
232  //reject muons with tracker dpt/pt > X
233  if (!siTrack.isNonnull())
234  return false;
235  if (siTrack->ptError() / siTrack->pt() > muon_dptrel_)
236  return false;
237 
238  else
239  return true;
240  }
const Point & position() const
position
Definition: BeamSpot.h:59
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
math::XYZPoint Point
static constexpr float d0
edm::Handle< reco::BeamSpot > beamSpot_
bool isValid() const
Definition: HandleBase.h:70
Structure Point Contains parameters of Gaussian fits to DMRs.

◆ isGoodTrack()

bool MuonTCMETValueMapProducer::isGoodTrack ( const reco::Muon muon)
private

Definition at line 278 of file MuonTCMETValueMapProducer.cc.

References beamSpot_, DMR_cfg::cut, d0, d0cuta_, d0cutb_, PVValHelper::dz, spr::find(), hasValidVertex, mps_fire::i, edm::Ref< C, T, F >::isNonnull(), edm::HandleBase::isValid(), maxchi2_, maxchi2_tight_, maxd0cut_, maxeta_, maxpt_, maxpt_eta20_, maxpt_eta25_, maxPtErr_, maxPtErr_tight_, minhits_, minhits_tight_, nLayers(), nLayers_, nLayersTight_, reco::BeamSpot::position(), funct::pow(), mathSSE::sqrt(), trackAlgos_, trkAlgos_, trkQuality_, vertexMaxDZ_, and vertices_.

Referenced by isGoodCaloMuon(), and produce().

278  {
279  double d0;
280 
281  const reco::TrackRef siTrack = muon->innerTrack();
282  if (!siTrack.isNonnull())
283  return false;
284 
285  if (hasValidVertex) {
286  //get d0 corrected for primary vertex
287 
288  const Point pvtx = Point(vertices_->begin()->x(), vertices_->begin()->y(), vertices_->begin()->z());
289 
290  double dz = siTrack->dz(pvtx);
291 
292  if (fabs(dz) < vertexMaxDZ_) {
293  //get d0 corrected for pvtx
294  d0 = -1 * siTrack->dxy(pvtx);
295 
296  } else {
297  // get d0 corrected for beam spot
298  bool haveBeamSpot = true;
299  if (!beamSpot_.isValid())
300  haveBeamSpot = false;
301 
302  Point bspot = haveBeamSpot ? beamSpot_->position() : Point(0, 0, 0);
303  d0 = -1 * siTrack->dxy(bspot);
304  }
305  } else {
306  // get d0 corrected for beam spot
307  bool haveBeamSpot = true;
308  if (!beamSpot_.isValid())
309  haveBeamSpot = false;
310 
311  Point bspot = haveBeamSpot ? beamSpot_->position() : Point(0, 0, 0);
312  d0 = -1 * siTrack->dxy(bspot);
313  }
314 
315  if (std::find(trackAlgos_.begin(), trackAlgos_.end(), siTrack->algo()) != trackAlgos_.end()) {
316  //1st 4 tracking iterations (pT-dependent d0 cut)
317 
318  float d0cut = sqrt(std::pow(d0cuta_, 2) + std::pow(d0cutb_ / siTrack->pt(), 2));
319  if (d0cut > maxd0cut_)
320  d0cut = maxd0cut_;
321 
322  if (fabs(d0) > d0cut)
323  return false;
324  if (nLayers(siTrack) < nLayers_)
325  return false;
326  } else {
327  //last 2 tracking iterations (tighten chi2, nhits, pt error cuts)
328 
329  if (siTrack->normalizedChi2() > maxchi2_tight_)
330  return false;
331  if (siTrack->numberOfValidHits() < minhits_tight_)
332  return false;
333  if ((siTrack->ptError() / siTrack->pt()) > maxPtErr_tight_)
334  return false;
335  if (nLayers(siTrack) < nLayersTight_)
336  return false;
337  }
338 
339  if (siTrack->numberOfValidHits() < minhits_)
340  return false;
341  if (siTrack->normalizedChi2() > maxchi2_)
342  return false;
343  if (fabs(siTrack->eta()) > maxeta_)
344  return false;
345  if (siTrack->pt() > maxpt_)
346  return false;
347  if ((siTrack->ptError() / siTrack->pt()) > maxPtErr_)
348  return false;
349  if (fabs(siTrack->eta()) > 2.5 && siTrack->pt() > maxpt_eta25_)
350  return false;
351  if (fabs(siTrack->eta()) > 2.0 && siTrack->pt() > maxpt_eta20_)
352  return false;
353 
354  int cut = 0;
355  for (unsigned int i = 0; i < trkQuality_.size(); i++) {
356  cut |= (1 << trkQuality_.at(i));
357  }
358 
359  if (!((siTrack->qualityMask() & cut) == cut))
360  return false;
361 
362  bool isGoodAlgo = false;
363  if (trkAlgos_.empty())
364  isGoodAlgo = true;
365  for (unsigned int i = 0; i < trkAlgos_.size(); i++) {
366  if (siTrack->algo() == trkAlgos_.at(i))
367  isGoodAlgo = true;
368  }
369 
370  if (!isGoodAlgo)
371  return false;
372 
373  return true;
374  }
std::vector< reco::TrackBase::TrackAlgorithm > trackAlgos_
const Point & position() const
position
Definition: BeamSpot.h:59
const reco::VertexCollection * vertices_
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< reco::TrackBase::TrackAlgorithm > trkAlgos_
T sqrt(T t)
Definition: SSEVec.h:19
math::XYZPoint Point
static constexpr float d0
edm::Handle< reco::BeamSpot > beamSpot_
bool isValid() const
Definition: HandleBase.h:70
Structure Point Contains parameters of Gaussian fits to DMRs.
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ isValidVertex()

bool MuonTCMETValueMapProducer::isValidVertex ( )
private

Definition at line 434 of file MuonTCMETValueMapProducer.cc.

References funct::pow(), mathSSE::sqrt(), vertexNdof_, vertexRho_, vertexZ_, and vertices_.

Referenced by produce().

434  {
435  if (vertices_->begin()->isFake())
436  return false;
437  if (vertices_->begin()->ndof() < vertexNdof_)
438  return false;
439  if (fabs(vertices_->begin()->z()) > vertexZ_)
440  return false;
441  if (sqrt(std::pow(vertices_->begin()->x(), 2) + std::pow(vertices_->begin()->y(), 2)) > vertexRho_)
442  return false;
443 
444  return true;
445  }
const reco::VertexCollection * vertices_
T sqrt(T t)
Definition: SSEVec.h:19
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ nLayers()

int MuonTCMETValueMapProducer::nLayers ( const reco::TrackRef  track)
private

Definition at line 428 of file MuonTCMETValueMapProducer.cc.

References AlCaHLTBitMon_ParallelJobs::p, and HLT_2022v15_cff::track.

Referenced by isGoodTrack().

428  {
429  const reco::HitPattern& p = track->hitPattern();
430  return p.trackerLayersWithMeasurement();
431  }

◆ produce()

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

Definition at line 115 of file MuonTCMETValueMapProducer.cc.

References beamSpot_, beamSpotToken_, bField, funct::cos(), edm::helper::Filler< Map >::fill(), edm::EventSetup::getHandle(), hasValidVertex, iEvent, edm::helper::Filler< Map >::insert(), isGoodCaloMuon(), isGoodMuon(), isGoodTrack(), edm::HandleBase::isValid(), isValidVertex(), magFieldToken_, minpt_, eostools::move(), amptDefaultParameters_cff::mu, reco::MuonMETCorrectionData::MuonCandidateValuesUsed, muons_, muonToken_, custom_jme_cff::nMuons, reco::MuonMETCorrectionData::NotUsed, edm::Handle< T >::product(), edm::ESHandle< T >::product(), propagateTrack(), response_function, funct::sin(), reco::MuonMETCorrectionData::TreatedAsPion, useCaloMuons_, usePvtxd0_, vertexHandle_, vertexToken_, and vertices_.

115  {
116  iEvent.getByToken(muonToken_, muons_);
117  iEvent.getByToken(beamSpotToken_, beamSpot_);
118 
119  hasValidVertex = false;
120  if (usePvtxd0_) {
121  iEvent.getByToken(vertexToken_, vertexHandle_);
122 
123  if (vertexHandle_.isValid()) {
126  }
127  }
128 
130  bField = theMagField.product();
131 
132  auto vm_muCorrData = std::make_unique<edm::ValueMap<reco::MuonMETCorrectionData>>();
133 
134  std::vector<reco::MuonMETCorrectionData> v_muCorrData;
135 
136  unsigned int nMuons = muons_->size();
137 
138  for (unsigned int iMu = 0; iMu < nMuons; iMu++) {
139  const reco::Muon* mu = &(*muons_)[iMu];
140  double deltax = 0.0;
141  double deltay = 0.0;
142 
144 
145  reco::TrackRef mu_track;
146  if (mu->isGlobalMuon() || mu->isTrackerMuon() || mu->isCaloMuon())
147  mu_track = mu->innerTrack();
148  else {
149  v_muCorrData.push_back(muMETCorrData);
150  continue;
151  }
152 
153  // figure out depositions muons would make if they were treated as pions
154  if (isGoodTrack(mu)) {
155  if (mu_track->pt() < minpt_)
157 
158  else {
159  int bin_index = response_function->FindBin(mu_track->eta(), mu_track->pt());
160  double response = response_function->GetBinContent(bin_index);
161 
162  TVector3 outerTrkPosition = propagateTrack(mu);
163 
164  deltax = response * mu_track->p() * sin(outerTrkPosition.Theta()) * cos(outerTrkPosition.Phi());
165  deltay = response * mu_track->p() * sin(outerTrkPosition.Theta()) * sin(outerTrkPosition.Phi());
166 
168  }
169  }
170 
171  // figure out muon flag
172  if (isGoodMuon(mu))
173  v_muCorrData.push_back(
175 
176  else if (useCaloMuons_ && isGoodCaloMuon(mu, iMu))
177  v_muCorrData.push_back(
179 
180  else
181  v_muCorrData.push_back(muMETCorrData);
182  }
183 
184  edm::ValueMap<reco::MuonMETCorrectionData>::Filler dataFiller(*vm_muCorrData);
185 
186  dataFiller.insert(muons_, v_muCorrData.begin(), v_muCorrData.end());
187  dataFiller.fill();
188 
189  iEvent.put(std::move(vm_muCorrData), "muCorrData");
190  }
class TVector3 propagateTrack(const reco::Muon *)
edm::Handle< reco::VertexCollection > vertexHandle_
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const reco::VertexCollection * vertices_
T const * product() const
Definition: Handle.h:70
const class MagneticField * bField
bool isGoodCaloMuon(const reco::Muon *, const unsigned int)
int iEvent
Definition: GenABIO.cc:224
T const * product() const
Definition: ESHandle.h:86
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
edm::Handle< reco::MuonCollection > muons_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
edm::Handle< reco::BeamSpot > beamSpot_
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< reco::MuonCollection > muonToken_
def move(src, dest)
Definition: eostools.py:511

◆ propagateTrack()

TVector3 MuonTCMETValueMapProducer::propagateTrack ( const reco::Muon muon)
private

Definition at line 377 of file MuonTCMETValueMapProducer.cc.

References alongMomentum, Reference_intrackfit_cff::barrel, bField, Plane::build(), Cylinder::build(), TCMET_cfi::corner, TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), M_PI, Pi, AnalyticalPropagator::propagate(), CosmicsPD_Skims::radius, HLT_2022v15_cff::track, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and TCMET_cfi::zdist.

Referenced by produce().

377  {
378  TVector3 outerTrkPosition;
379 
380  outerTrkPosition.SetPtEtaPhi(999., -10., 2 * TMath::Pi());
381 
382  const reco::TrackRef track = muon->innerTrack();
383 
384  if (!track.isNonnull()) {
385  return outerTrkPosition;
386  }
387 
388  GlobalPoint tpVertex(track->vx(), track->vy(), track->vz());
389  GlobalVector tpMomentum(track.get()->px(), track.get()->py(), track.get()->pz());
390  int tpCharge(track->charge());
391 
392  FreeTrajectoryState fts(tpVertex, tpMomentum, tpCharge, bField);
393 
394  const double zdist = 314.;
395 
396  const double radius = 130.;
397 
398  const double corner = 1.479;
399 
402 
405 
407 
409 
410  if (track.get()->eta() < -corner) {
411  tsos = myAP.propagate(fts, *lendcap);
412  } else if (fabs(track.get()->eta()) < corner) {
413  tsos = myAP.propagate(fts, *barrel);
414  } else if (track.get()->eta() > corner) {
415  tsos = myAP.propagate(fts, *rendcap);
416  }
417 
418  if (tsos.isValid())
419  outerTrkPosition.SetXYZ(tsos.globalPosition().x(), tsos.globalPosition().y(), tsos.globalPosition().z());
420 
421  else
422  outerTrkPosition.SetPtEtaPhi(999., -10., 2 * TMath::Pi());
423 
424  return outerTrkPosition;
425  }
const double Pi
T z() const
Definition: PV3DBase.h:61
const class MagneticField * bField
static PlanePointer build(Args &&... args)
Definition: Plane.h:33
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
GlobalPoint globalPosition() const
#define M_PI
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=nullptr)
Definition: Cylinder.h:45

Member Data Documentation

◆ beamSpot_

edm::Handle<reco::BeamSpot> cms::MuonTCMETValueMapProducer::beamSpot_
private

Definition at line 52 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodMuon(), isGoodTrack(), and produce().

◆ beamSpotToken_

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

Definition at line 56 of file MuonTCMETValueMapProducer.h.

Referenced by MuonTCMETValueMapProducer(), and produce().

◆ bField

const class MagneticField* cms::MuonTCMETValueMapProducer::bField
private

Definition at line 60 of file MuonTCMETValueMapProducer.h.

Referenced by produce(), and propagateTrack().

◆ d0cuta_

double cms::MuonTCMETValueMapProducer::d0cuta_
private

Definition at line 91 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and MuonTCMETValueMapProducer().

◆ d0cutb_

double cms::MuonTCMETValueMapProducer::d0cutb_
private

Definition at line 92 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and MuonTCMETValueMapProducer().

◆ hasValidVertex

bool cms::MuonTCMETValueMapProducer::hasValidVertex
private

Definition at line 69 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and produce().

◆ magFieldToken_

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

Definition at line 58 of file MuonTCMETValueMapProducer.h.

Referenced by MuonTCMETValueMapProducer(), and produce().

◆ maxchi2_

double cms::MuonTCMETValueMapProducer::maxchi2_
private

Definition at line 84 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and MuonTCMETValueMapProducer().

◆ maxchi2_tight_

double cms::MuonTCMETValueMapProducer::maxchi2_tight_
private

Definition at line 88 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and MuonTCMETValueMapProducer().

◆ maxd0cut_

double cms::MuonTCMETValueMapProducer::maxd0cut_
private

Definition at line 87 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and MuonTCMETValueMapProducer().

◆ maxeta_

double cms::MuonTCMETValueMapProducer::maxeta_
private

Definition at line 83 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and MuonTCMETValueMapProducer().

◆ maxpt_

double cms::MuonTCMETValueMapProducer::maxpt_
private

Definition at line 82 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and MuonTCMETValueMapProducer().

◆ maxpt_eta20_

double cms::MuonTCMETValueMapProducer::maxpt_eta20_
private

Definition at line 79 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and MuonTCMETValueMapProducer().

◆ maxpt_eta25_

double cms::MuonTCMETValueMapProducer::maxpt_eta25_
private

Definition at line 78 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and MuonTCMETValueMapProducer().

◆ maxPtErr_

double cms::MuonTCMETValueMapProducer::maxPtErr_
private

Definition at line 86 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and MuonTCMETValueMapProducer().

◆ maxPtErr_tight_

double cms::MuonTCMETValueMapProducer::maxPtErr_tight_
private

Definition at line 90 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and MuonTCMETValueMapProducer().

◆ minhits_

double cms::MuonTCMETValueMapProducer::minhits_
private

Definition at line 85 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and MuonTCMETValueMapProducer().

◆ minhits_tight_

double cms::MuonTCMETValueMapProducer::minhits_tight_
private

Definition at line 89 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and MuonTCMETValueMapProducer().

◆ minpt_

double cms::MuonTCMETValueMapProducer::minpt_
private

Definition at line 81 of file MuonTCMETValueMapProducer.h.

Referenced by MuonTCMETValueMapProducer(), and produce().

◆ muon_dptrel_

double cms::MuonTCMETValueMapProducer::muon_dptrel_
private

Definition at line 104 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodMuon(), and MuonTCMETValueMapProducer().

◆ muonchi2_

double cms::MuonTCMETValueMapProducer::muonchi2_
private

Definition at line 100 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodMuon(), and MuonTCMETValueMapProducer().

◆ muond0_

double cms::MuonTCMETValueMapProducer::muond0_
private

Definition at line 102 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodMuon(), and MuonTCMETValueMapProducer().

◆ muonDeltaR_

double cms::MuonTCMETValueMapProducer::muonDeltaR_
private

Definition at line 103 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodCaloMuon(), and MuonTCMETValueMapProducer().

◆ muoneta_

double cms::MuonTCMETValueMapProducer::muoneta_
private

Definition at line 99 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodMuon(), and MuonTCMETValueMapProducer().

◆ muonGlobal_

bool cms::MuonTCMETValueMapProducer::muonGlobal_
private

Definition at line 66 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodMuon(), and MuonTCMETValueMapProducer().

◆ muonhits_

double cms::MuonTCMETValueMapProducer::muonhits_
private

Definition at line 101 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodMuon(), and MuonTCMETValueMapProducer().

◆ muonMinValidStaHits_

int cms::MuonTCMETValueMapProducer::muonMinValidStaHits_
private

Definition at line 97 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodMuon(), and MuonTCMETValueMapProducer().

◆ muonpt_

double cms::MuonTCMETValueMapProducer::muonpt_
private

Definition at line 98 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodMuon(), and MuonTCMETValueMapProducer().

◆ muons_

edm::Handle<reco::MuonCollection> cms::MuonTCMETValueMapProducer::muons_
private

Definition at line 51 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodCaloMuon(), and produce().

◆ muonToken_

edm::EDGetTokenT<reco::MuonCollection> cms::MuonTCMETValueMapProducer::muonToken_
private

Definition at line 55 of file MuonTCMETValueMapProducer.h.

Referenced by MuonTCMETValueMapProducer(), and produce().

◆ muonTracker_

bool cms::MuonTCMETValueMapProducer::muonTracker_
private

Definition at line 67 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodMuon(), and MuonTCMETValueMapProducer().

◆ nLayers_

int cms::MuonTCMETValueMapProducer::nLayers_
private

Definition at line 72 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and MuonTCMETValueMapProducer().

◆ nLayersTight_

int cms::MuonTCMETValueMapProducer::nLayersTight_
private

Definition at line 73 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and MuonTCMETValueMapProducer().

◆ response_function

class TH2D* cms::MuonTCMETValueMapProducer::response_function
private

Definition at line 64 of file MuonTCMETValueMapProducer.h.

Referenced by MuonTCMETValueMapProducer(), and produce().

◆ rfType_

int cms::MuonTCMETValueMapProducer::rfType_
private

Definition at line 71 of file MuonTCMETValueMapProducer.h.

Referenced by MuonTCMETValueMapProducer().

◆ tcmetAlgo_

TCMETAlgo* cms::MuonTCMETValueMapProducer::tcmetAlgo_
private

◆ trackAlgos_

std::vector<reco::TrackBase::TrackAlgorithm> cms::MuonTCMETValueMapProducer::trackAlgos_
private

Definition at line 80 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack().

◆ trkAlgos_

std::vector<reco::TrackBase::TrackAlgorithm> cms::MuonTCMETValueMapProducer::trkAlgos_
private

Definition at line 95 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and MuonTCMETValueMapProducer().

◆ trkQuality_

std::vector<int> cms::MuonTCMETValueMapProducer::trkQuality_
private

Definition at line 94 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and MuonTCMETValueMapProducer().

◆ useCaloMuons_

bool cms::MuonTCMETValueMapProducer::useCaloMuons_
private

Definition at line 68 of file MuonTCMETValueMapProducer.h.

Referenced by MuonTCMETValueMapProducer(), and produce().

◆ usePvtxd0_

bool cms::MuonTCMETValueMapProducer::usePvtxd0_
private

Definition at line 93 of file MuonTCMETValueMapProducer.h.

Referenced by MuonTCMETValueMapProducer(), and produce().

◆ vertexHandle_

edm::Handle<reco::VertexCollection> cms::MuonTCMETValueMapProducer::vertexHandle_
private

Definition at line 53 of file MuonTCMETValueMapProducer.h.

Referenced by produce().

◆ vertexMaxDZ_

double cms::MuonTCMETValueMapProducer::vertexMaxDZ_
private

Definition at line 77 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), and MuonTCMETValueMapProducer().

◆ vertexNdof_

int cms::MuonTCMETValueMapProducer::vertexNdof_
private

Definition at line 74 of file MuonTCMETValueMapProducer.h.

Referenced by isValidVertex(), and MuonTCMETValueMapProducer().

◆ vertexRho_

double cms::MuonTCMETValueMapProducer::vertexRho_
private

Definition at line 76 of file MuonTCMETValueMapProducer.h.

Referenced by isValidVertex(), and MuonTCMETValueMapProducer().

◆ vertexToken_

edm::EDGetTokenT<reco::VertexCollection> cms::MuonTCMETValueMapProducer::vertexToken_
private

Definition at line 57 of file MuonTCMETValueMapProducer.h.

Referenced by MuonTCMETValueMapProducer(), and produce().

◆ vertexZ_

double cms::MuonTCMETValueMapProducer::vertexZ_
private

Definition at line 75 of file MuonTCMETValueMapProducer.h.

Referenced by isValidVertex(), and MuonTCMETValueMapProducer().

◆ vertices_

const reco::VertexCollection* cms::MuonTCMETValueMapProducer::vertices_
private

Definition at line 62 of file MuonTCMETValueMapProducer.h.

Referenced by isGoodTrack(), isValidVertex(), and produce().