CMS 3D CMS Logo

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

Public Member Functions

 HLTDQMMuonSelector (const edm::ParameterSet &config)
 
void produce (edm::Event &, edm::EventSetup const &) 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
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Types

enum  MuonSelectionType {
  MuonSelectionType::Tight, MuonSelectionType::Medium, MuonSelectionType::Loose, MuonSelectionType::Soft,
  MuonSelectionType::HighPt, MuonSelectionType::None
}
 

Private Member Functions

bool passMuonSel (const reco::Muon &muon, const reco::Vertex &vertex) const
 

Static Private Member Functions

static MuonSelectionType convertToEnum (const std::string &val)
 

Private Attributes

MuonSelectionType muonSelType_
 
edm::EDGetTokenT< reco::MuonCollectionmuonToken_
 
StringCutObjectSelector< reco::Muon, true > selection_
 
edm::EDGetTokenT< reco::VertexCollectionvtxToken_
 

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 17 of file HLTDQMMuonSelector.cc.

Member Enumeration Documentation

◆ MuonSelectionType

Enumerator
Tight 
Medium 
Loose 
Soft 
HighPt 
None 

Definition at line 24 of file HLTDQMMuonSelector.cc.

24 { Tight, Medium, Loose, Soft, HighPt, None };

Constructor & Destructor Documentation

◆ HLTDQMMuonSelector()

HLTDQMMuonSelector::HLTDQMMuonSelector ( const edm::ParameterSet config)
explicit

Definition at line 36 of file HLTDQMMuonSelector.cc.

37  : muonToken_(consumes<reco::MuonCollection>(config.getParameter<edm::InputTag>("objs"))),
38  vtxToken_(consumes<reco::VertexCollection>(config.getParameter<edm::InputTag>("vertices"))),
39  selection_(config.getParameter<std::string>("selection")),
40  muonSelType_(convertToEnum(config.getParameter<std::string>("muonSelectionType"))) {
41  produces<edm::ValueMap<bool> >();
42 }

Member Function Documentation

◆ convertToEnum()

HLTDQMMuonSelector::MuonSelectionType HLTDQMMuonSelector::convertToEnum ( const std::string &  val)
staticprivate

Definition at line 78 of file HLTDQMMuonSelector.cc.

78  {
79  const std::vector<std::pair<std::string, MuonSelectionType> > strsToEnums = {{"tight", MuonSelectionType::Tight},
80  {"medium", MuonSelectionType::Medium},
81  {"loose", MuonSelectionType::Loose},
82  {"soft", MuonSelectionType::Soft},
83  {"highpt", MuonSelectionType::HighPt},
84  {"none", MuonSelectionType::None}};
85  for (const auto& strEnumPair : strsToEnums) {
86  if (val == strEnumPair.first)
87  return strEnumPair.second;
88  }
89  std::ostringstream validEnums;
90  for (const auto& strEnumPair : strsToEnums)
91  validEnums << strEnumPair.first << " ";
92  throw cms::Exception("InvalidConfig") << "invalid muonSelectionType " << val << ", allowed values are "
93  << validEnums.str();
94 }

References Exception, HighPt, Loose, Medium, None, Soft, Tight, and heppy_batch::val.

◆ fillDescriptions()

void HLTDQMMuonSelector::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 44 of file HLTDQMMuonSelector.cc.

44  {
46  desc.add<edm::InputTag>("objs", edm::InputTag("muons"));
47  desc.add<edm::InputTag>("vertices", edm::InputTag("offlinePrimaryVertices"));
48  desc.add<std::string>("selection", "et > 5");
49  desc.add<std::string>("muonSelectionType", "tight");
50  descriptions.add("hltDQMMuonSelector", desc);
51 }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), HLT_2018_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ passMuonSel()

bool HLTDQMMuonSelector::passMuonSel ( const reco::Muon muon,
const reco::Vertex vertex 
) const
private

Definition at line 96 of file HLTDQMMuonSelector.cc.

96  {
97  switch (muonSelType_) {
99  return muon::isTightMuon(muon, vertex);
101  return muon::isMediumMuon(muon);
103  return muon::isLooseMuon(muon);
105  return muon::isSoftMuon(muon, vertex);
107  return muon::isHighPtMuon(muon, vertex);
109  return true;
110  default:
111  edm::LogError("HLTDQMMuonSelector") << " inconsistent code, an option has been added to MuonSelectionType "
112  "without updating HLTDQMMuonSelector::passMuonSel";
113  return false;
114  }
115 }

References HighPt, muon::isHighPtMuon(), muon::isLooseMuon(), muon::isMediumMuon(), muon::isSoftMuon(), muon::isTightMuon(), Loose, Medium, muonSelType_, None, Soft, Tight, and bphysicsOniaDQM_cfi::vertex.

Referenced by produce().

◆ produce()

void HLTDQMMuonSelector::produce ( edm::Event event,
edm::EventSetup const &  setup 
)
override

Definition at line 53 of file HLTDQMMuonSelector.cc.

53  {
55  event.getByToken(muonToken_, muonHandle);
56 
58  event.getByToken(vtxToken_, vtxHandle);
59 
60  if (!muonHandle.isValid())
61  return;
62 
63  std::vector<bool> selResults;
64  for (auto& muon : *muonHandle) {
65  if (vtxHandle.isValid() && !vtxHandle->empty()) {
66  selResults.push_back(passMuonSel(muon, vtxHandle->front()) && selection_(muon));
67  } else {
68  selResults.push_back(false);
69  }
70  }
71  auto valMap = std::make_unique<edm::ValueMap<bool> >();
73  filler.insert(muonHandle, selResults.begin(), selResults.end());
74  filler.fill();
75  event.put(std::move(valMap));
76 }

References trigObjTnPSource_cfi::filler, edm::HandleBase::isValid(), eostools::move(), muonToken_, passMuonSel(), selection_, and vtxToken_.

Member Data Documentation

◆ muonSelType_

MuonSelectionType HLTDQMMuonSelector::muonSelType_
private

Definition at line 33 of file HLTDQMMuonSelector.cc.

Referenced by passMuonSel().

◆ muonToken_

edm::EDGetTokenT<reco::MuonCollection> HLTDQMMuonSelector::muonToken_
private

Definition at line 29 of file HLTDQMMuonSelector.cc.

Referenced by produce().

◆ selection_

StringCutObjectSelector<reco::Muon, true> HLTDQMMuonSelector::selection_
private

Definition at line 31 of file HLTDQMMuonSelector.cc.

Referenced by produce().

◆ vtxToken_

edm::EDGetTokenT<reco::VertexCollection> HLTDQMMuonSelector::vtxToken_
private

Definition at line 30 of file HLTDQMMuonSelector.cc.

Referenced by produce().

HLTDQMMuonSelector::vtxToken_
edm::EDGetTokenT< reco::VertexCollection > vtxToken_
Definition: HLTDQMMuonSelector.cc:30
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
muon::isSoftMuon
bool isSoftMuon(const reco::Muon &, const reco::Vertex &, bool run2016_hip_mitigation=false)
Definition: MuonSelectors.cc:931
muon
Definition: MuonCocktails.h:17
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HLTDQMMuonSelector::MuonSelectionType::Medium
edm::Handle< reco::MuonCollection >
config
Definition: config.py:1
HLTDQMMuonSelector::MuonSelectionType::Soft
muon::isLooseMuon
bool isLooseMuon(const reco::Muon &)
Definition: MuonSelectors.cc:910
None
Definition: APVGainStruct.h:52
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
HLTDQMMuonSelector::passMuonSel
bool passMuonSel(const reco::Muon &muon, const reco::Vertex &vertex) const
Definition: HLTDQMMuonSelector.cc:96
HLTDQMMuonSelector::MuonSelectionType::HighPt
muon::Tight
Definition: ME0MuonSelector.h:17
HLTDQMMuonSelector::MuonSelectionType::Tight
HLTDQMMuonSelector::muonToken_
edm::EDGetTokenT< reco::MuonCollection > muonToken_
Definition: HLTDQMMuonSelector.cc:29
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
muon::isHighPtMuon
bool isHighPtMuon(const reco::Muon &, const reco::Vertex &)
Definition: MuonSelectors.cc:947
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::LogError
Definition: MessageLogger.h:183
muon::isTightMuon
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
Definition: MuonSelectors.cc:895
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
HLTDQMMuonSelector::muonSelType_
MuonSelectionType muonSelType_
Definition: HLTDQMMuonSelector.cc:33
HLTDQMMuonSelector::MuonSelectionType::Loose
muon::Loose
Definition: ME0MuonSelector.h:16
muon::isMediumMuon
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
Definition: MuonSelectors.cc:914
HLTDQMMuonSelector::MuonSelectionType::None
HLTDQMMuonSelector::convertToEnum
static MuonSelectionType convertToEnum(const std::string &val)
Definition: HLTDQMMuonSelector.cc:78
heppy_batch.val
val
Definition: heppy_batch.py:351
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception
Definition: hltDiff.cc:246
HLTDQMMuonSelector::selection_
StringCutObjectSelector< reco::Muon, true > selection_
Definition: HLTDQMMuonSelector.cc:31
edm::helper::Filler
Definition: ValueMap.h:22
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag
Definition: InputTag.h:15