CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TrackingParticleRefMuonProducer Class Reference
Inheritance diagram for TrackingParticleRefMuonProducer:
edm::stream::EDProducer<>

Public Member Functions

void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 TrackingParticleRefMuonProducer (const edm::ParameterSet &iConfig)
 
- 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 Attributes

double pmin_
 
double ptmin_
 
std::string skim_
 
edm::EDGetTokenT< TrackingParticleCollectiontpToken_
 

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 11 of file TrackingParticleRefMuonProducer.cc.

Constructor & Destructor Documentation

◆ TrackingParticleRefMuonProducer()

TrackingParticleRefMuonProducer::TrackingParticleRefMuonProducer ( const edm::ParameterSet iConfig)

Definition at line 24 of file TrackingParticleRefMuonProducer.cc.

25  : tpToken_(consumes<TrackingParticleCollection>(iConfig.getParameter<edm::InputTag>("src"))),
26  skim_(iConfig.getParameter<std::string>("skim")),
27  ptmin_(iConfig.getParameter<double>("ptmin")),
28  pmin_(iConfig.getParameter<double>("pmin")) {
29  edm::LogVerbatim("TrackingParticleRefMuonProducer")
30  << "\n constructing TrackingParticleRefMuonProducer: skim = " << skim_;
31  if (skim_ == "mu")
32  edm::LogVerbatim("TrackingParticleRefMuonProducer") << "\t ptmin = " << ptmin_ << ", pmin = " << pmin_ << "\n";
33  else if (skim_ == "track")
34  edm::LogVerbatim("TrackingParticleRefMuonProducer") << "\t ptmin = " << ptmin_ << "\n";
35  else if (skim_ == "pf")
36  edm::LogVerbatim("TrackingParticleRefMuonProducer") << "\t ptmin = " << ptmin_ << ", pmin = " << pmin_ << "\n";
37  else
38  edm::LogError("TrackingParticleRefMuonProducer") << "\t undefined skim = " << skim_ << "\n";
39 
40  produces<TrackingParticleRefVector>();
41 }

References pmin_, ptmin_, and skim_.

Member Function Documentation

◆ produce()

void TrackingParticleRefMuonProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 43 of file TrackingParticleRefMuonProducer.cc.

43  {
45  iEvent.getByToken(tpToken_, tpH);
46 
47  auto tpskim = std::make_unique<TrackingParticleRefVector>();
48 
49  if (skim_ == "mu") {
50  for (size_t i = 0, end = tpH->size(); i < end; ++i) {
51  auto tp = TrackingParticleRef(tpH, i);
52 
53  // test if the TP is a muon with pt and p above minimum thresholds
54  bool isMu = (std::abs(tp->pdgId()) == 13);
55  bool ptpOk = (tp->pt() > ptmin_) && (tp->p() > pmin_);
56  if (isMu && ptpOk)
57  tpskim->push_back(tp);
58  else {
59  // test if the TP has muon hits
60  int n_muon_hits = tp->numberOfHits() - tp->numberOfTrackerHits();
61  if (n_muon_hits > 0)
62  tpskim->push_back(tp);
63  }
64  }
65  } else if (skim_ == "track") {
66  for (size_t i = 0, end = tpH->size(); i < end; ++i) {
67  auto tp = TrackingParticleRef(tpH, i);
68 
69  // test if the pt is above a minimum cut
70  if (tp->pt() > ptmin_)
71  tpskim->push_back(tp);
72  }
73  } else if (skim_ == "pf") {
74  for (size_t i = 0, end = tpH->size(); i < end; ++i) {
75  auto tp = TrackingParticleRef(tpH, i);
76 
77  // test if p and pt are above minimum cuts
78  if ((tp->pt() > ptmin_) && (tp->p() > pmin_))
79  tpskim->push_back(tp);
80  }
81  }
82 
83  iEvent.put(std::move(tpskim));
84 }

References funct::abs(), mps_fire::end, mps_fire::i, iEvent, jets_cff::isMu, eostools::move(), pmin_, ptmin_, skim_, cmsswSequenceInfo::tp, and tpToken_.

Member Data Documentation

◆ pmin_

double TrackingParticleRefMuonProducer::pmin_
private

Definition at line 21 of file TrackingParticleRefMuonProducer.cc.

Referenced by produce(), and TrackingParticleRefMuonProducer().

◆ ptmin_

double TrackingParticleRefMuonProducer::ptmin_
private

Definition at line 20 of file TrackingParticleRefMuonProducer.cc.

Referenced by produce(), and TrackingParticleRefMuonProducer().

◆ skim_

std::string TrackingParticleRefMuonProducer::skim_
private

Definition at line 19 of file TrackingParticleRefMuonProducer.cc.

Referenced by produce(), and TrackingParticleRefMuonProducer().

◆ tpToken_

edm::EDGetTokenT<TrackingParticleCollection> TrackingParticleRefMuonProducer::tpToken_
private

Definition at line 18 of file TrackingParticleRefMuonProducer.cc.

Referenced by produce().

TrackingParticleRefMuonProducer::ptmin_
double ptmin_
Definition: TrackingParticleRefMuonProducer.cc:20
mps_fire.i
i
Definition: mps_fire.py:428
TrackingParticleRefMuonProducer::tpToken_
edm::EDGetTokenT< TrackingParticleCollection > tpToken_
Definition: TrackingParticleRefMuonProducer.cc:18
edm::Handle< TrackingParticleCollection >
mps_fire.end
end
Definition: mps_fire.py:242
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackingParticleRefMuonProducer::pmin_
double pmin_
Definition: TrackingParticleRefMuonProducer.cc:21
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
TrackingParticleRefMuonProducer::skim_
std::string skim_
Definition: TrackingParticleRefMuonProducer.cc:19
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TrackingParticleRef
edm::Ref< TrackingParticleCollection > TrackingParticleRef
Definition: TrackingParticleFwd.h:12
jets_cff.isMu
isMu
Definition: jets_cff.py:329
edm::InputTag
Definition: InputTag.h:15