CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes
HLTMuonPFIsoFilter Class Reference

#include <HLTMuonPFIsoFilter.h>

Inheritance diagram for HLTMuonPFIsoFilter:
HLTFilter edm::global::EDFilter<> edm::global::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

bool hltFilter (edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
 
 HLTMuonPFIsoFilter (const edm::ParameterSet &)
 
 ~HLTMuonPFIsoFilter () override
 
- Public Member Functions inherited from HLTFilter
 HLTFilter (const edm::ParameterSet &config)
 
int module (edm::Event const &) const
 
const std::string * moduleLabel () const
 
int path (edm::Event const &) const
 
const std::string * pathName (edm::Event const &) const
 
std::pair< int, int > pmid (edm::Event const &) const
 
bool saveTags () const
 
 ~HLTFilter () override
 
- Public Member Functions inherited from edm::global::EDFilter<>
 EDFilter ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilterBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from HLTFilter
static void makeHLTFilterDescription (edm::ParameterSetDescription &desc)
 
- Static Public Member Functions inherited from edm::global::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Static Private Member Functions

static bool triggerdByPreviousLevel (const reco::RecoChargedCandidateRef &, const std::vector< reco::RecoChargedCandidateRef > &)
 

Private Attributes

edm::InputTag candTag_
 
edm::EDGetTokenT< reco::RecoChargedCandidateCollectioncandToken_
 
std::vector< edm::InputTagdepTag_
 
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > depToken_
 
bool doRho_
 
double effArea_
 
double maxIso_
 
int min_N_
 
bool onlyCharged_
 
edm::InputTag previousCandTag_
 
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefspreviousCandToken_
 
edm::InputTag rhoTag_
 
edm::EDGetTokenT< double > rhoToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDFilterBase
typedef EDFilterBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

See header file for documentation

This class is an HLTFilter (-> EDFilter) implementing the isolation filtering for HLT muons

Definition at line 23 of file HLTMuonPFIsoFilter.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file HLTMuonPFIsoFilter.cc.

References candTag_, candToken_, edm::EDConsumerBase::consumes(), depTag_, depToken_, doRho_, edm::InputTag::encode(), mps_fire::i, checklumidiff::l, LogDebug, min_N_, previousCandTag_, previousCandToken_, rhoTag_, rhoToken_, protons_cff::t, and ~HLTMuonPFIsoFilter().

26  : HLTFilter(iConfig),
27  candTag_ (iConfig.getParameter< edm::InputTag > ("CandTag") ),
28  previousCandTag_ (iConfig.getParameter< edm::InputTag > ("PreviousCandTag")),
29  depTag_ (iConfig.getParameter< std::vector< edm::InputTag > >("DepTag" ) ),
30  depToken_(),
31  rhoTag_ (iConfig.getParameter< edm::InputTag >("RhoTag" ) ),
32  maxIso_ (iConfig.getParameter<double>("MaxIso" ) ),
33  min_N_ (iConfig.getParameter<int> ("MinN")),
34  onlyCharged_ (iConfig.getParameter<bool> ("onlyCharged")),
35  doRho_ (iConfig.getParameter<bool> ("applyRhoCorrection")),
36  effArea_ (iConfig.getParameter<double> ("EffectiveArea"))
37 {
38  depToken_.reserve(depTag_.size());
39  for (auto const& t: depTag_) {
41  }
42 
43  candToken_ = consumes<reco::RecoChargedCandidateCollection>(candTag_);
44  previousCandToken_ = consumes<trigger::TriggerFilterObjectWithRefs>(previousCandTag_);
45  if (doRho_) rhoToken_ = consumes<double>(rhoTag_);
46 
47  LogDebug("HLTMuonPFIsoFilter").log( [this](auto& l) {
48  l << " candTag : " << candTag_.encode()
49  << "\n" ;
50  for (unsigned int i=0;i!=depTag_.size();++i) {
51  l<<" PFIsoTag["<<i<<"] : "<<depTag_[i].encode()<<" \n";
52  }
53  l << " MinN : " << min_N_;
54  });
55  produces<edm::ValueMap<bool> >();
56 }
#define LogDebug(id)
T getParameter(std::string const &) const
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > previousCandToken_
std::vector< edm::InputTag > depTag_
edm::InputTag candTag_
std::string encode() const
Definition: InputTag.cc:159
edm::EDGetTokenT< double > rhoToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::InputTag previousCandTag_
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > candToken_
HLTFilter(const edm::ParameterSet &config)
Definition: HLTFilter.cc:20
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > depToken_
HLTMuonPFIsoFilter::~HLTMuonPFIsoFilter ( )
overridedefault

Referenced by HLTMuonPFIsoFilter().

Member Function Documentation

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

Definition at line 65 of file HLTMuonPFIsoFilter.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and HLTFilter::makeHLTFilterDescription().

65  {
68  desc.add<edm::InputTag>("CandTag",edm::InputTag("hltL3MuonCandidates"));
69  desc.add<edm::InputTag>("PreviousCandTag",edm::InputTag(""));
70  std::vector<edm::InputTag> depTag(1,edm::InputTag("hltMuPFIsoValueCharged03"));
71  desc.add<std::vector<edm::InputTag> >("DepTag",depTag);
72  desc.add<edm::InputTag>("RhoTag",edm::InputTag("hltFixedGridRhoFastjetAllCaloForMuonsPF"));
73  desc.add<double>("MaxIso",1.);
74  desc.add<int>("MinN",1);
75  desc.add<bool>("onlyCharged",false);
76  desc.add<bool>("applyRhoCorrection",true);
77  desc.add<double>("EffectiveArea",1.);
78  descriptions.add("hltMuonPFIsoFilter", desc);
79 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
Definition: HLTFilter.cc:29
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool HLTMuonPFIsoFilter::hltFilter ( edm::Event iEvent,
const edm::EventSetup iSetup,
trigger::TriggerFilterObjectWithRefs filterproduct 
) const
overridevirtual

Implements HLTFilter.

Definition at line 83 of file HLTMuonPFIsoFilter.cc.

References accept(), trigger::TriggerFilterObjectWithRefs::addCollectionTag(), trigger::TriggerRefsCollections::addObject(), candTag_, candToken_, depTag_, depToken_, doRho_, effArea_, edm::helper::Filler< Map >::fill(), edm::Ref< C, T, F >::get(), edm::Event::getByToken(), trigger::TriggerRefsCollections::getObjects(), mps_fire::i, edm::helper::Filler< Map >::insert(), edm::Ref< C, T, F >::isNonnull(), LogDebug, maxIso_, min_N_, eostools::move(), onlyCharged_, previousCandToken_, edm::Handle< T >::product(), edm::Event::put(), rhoToken_, HLTFilter::saveTags(), triggerdByPreviousLevel(), and trigger::TriggerMuon.

84  {
85  using namespace std;
86  using namespace edm;
87  using namespace trigger;
88  using namespace reco;
89 
90  // All HLT filters must create and fill an HLT filter object,
91  // recording any reconstructed physics objects satisfying (or not)
92  // this HLT filter, and place it in the Event.
93 
94  //the decision map
95  std::unique_ptr<edm::ValueMap<bool> > PFisoMap( new edm::ValueMap<bool> ());
96 
97  // get hold of trks
99  if (saveTags()) filterproduct.addCollectionTag(candTag_);
100  iEvent.getByToken (candToken_,mucands);
101  Handle<TriggerFilterObjectWithRefs> previousLevelCands;
102  iEvent.getByToken (previousCandToken_,previousLevelCands);
103  vector<RecoChargedCandidateRef> vcands;
104  previousLevelCands->getObjects(TriggerMuon,vcands);
105 
106  //get hold of energy deposition
107  unsigned int nDep=depTag_.size();
108  std::vector< Handle<edm::ValueMap<double> > > depMap(nDep);
109 
110  //get hold of rho of the event
111  double Rho = 0;
112  if (doRho_){
113  Handle <double> RhoCorr;
114  iEvent.getByToken(rhoToken_, RhoCorr);
115  Rho = *RhoCorr.product();
116  }
117 
118  for (unsigned int i=0;i!=nDep;++i) iEvent.getByToken (depToken_[i],depMap[i]);
119 
120  // look at all mucands, check cuts and add to filter object
121  int nIsolatedMu = 0;
122  unsigned int nMu=mucands->size();
123  std::vector<bool> isos(nMu, false);
124 
125  unsigned int iMu=0;
126  for (; iMu<nMu; iMu++)
127  {
128  double MuonDeposits = 0;
129  RecoChargedCandidateRef candref(mucands,iMu);
130  LogDebug("HLTMuonPFIsoFilter") << "candref isNonnull " << candref.isNonnull();
131 
132  //did this candidate triggered at previous stage.
133  if (!triggerdByPreviousLevel(candref,vcands)) continue;
134 
135  //reference to the track
136  TrackRef tk = candref->get<TrackRef>();
137  LogDebug("HLTMuonPFIsoFilter") << "tk isNonNull " << tk.isNonnull();
138 
139  //get the deposits and evaluate relIso if only the charged component is considered
140  if (onlyCharged_){
141  for(unsigned int iDep=0;iDep!=nDep;++iDep)
142  {
143  const edm::ValueMap<double> ::value_type & muonDeposit = (*(depMap[iDep]))[candref];
144  LogDebug("HLTMuonPFIsoFilter") << " Muon with q*pt= " << tk->charge()*tk->pt()
145  << " (" << candref->charge()*candref->pt() << ") "
146  << ", eta= " << tk->eta() << " (" << candref->eta() << ") "
147  << "; has deposit["<<iDep<<"]: " << muonDeposit;
148 
149  std::size_t foundCharged = depTag_[iDep].label().find("Charged");
150  if (foundCharged!=std::string::npos) MuonDeposits += muonDeposit;
151  }
152  MuonDeposits = MuonDeposits/tk->pt();
153  }
154  else {
155  //get all the deposits
156  for(unsigned int iDep=0;iDep!=nDep;++iDep)
157  {
158  const edm::ValueMap<double> ::value_type & muonDeposit = (*(depMap[iDep]))[candref];
159  LogDebug("HLTMuonPFIsoFilter") << " Muon with q*pt= " << tk->charge()*tk->pt()
160  << " (" << candref->charge()*candref->pt() << ") "
161  << ", eta= " << tk->eta() << " (" << candref->eta() << ") "
162  << "; has deposit["<<iDep<<"]: " << muonDeposit;
163  MuonDeposits += muonDeposit;
164  }
165  //apply rho correction
166  if (doRho_) MuonDeposits -= effArea_*Rho;
167  MuonDeposits = MuonDeposits/tk->pt();
168  }
169 
170  //get the selection
171  if (MuonDeposits < maxIso_) isos[iMu] = true;
172 
173  LogDebug("HLTMuonPFIsoFilter") << " Muon with q*pt= " << tk->charge()*tk->pt() << ", eta= " << tk->eta()
174  << "; "<<(isos[iMu]?"Is an isolated muon.":"Is NOT an isolated muon.");
175 
176  if (!isos[iMu]) continue;
177 
178  nIsolatedMu++;
179  filterproduct.addObject(TriggerMuon,candref);
180  }//for iMu
181 
182  // filter decision
183  const bool accept (nIsolatedMu >= min_N_);
184 
185  //put the decision map
186  if (nMu!=0)
187  {
188  edm::ValueMap<bool> ::Filler isoFiller(*PFisoMap);
189  isoFiller.insert(mucands, isos.begin(), isos.end());
190  isoFiller.fill();
191  }
192 
193  iEvent.put(std::move(PFisoMap));
194 
195  LogDebug("HLTMuonPFIsoFilter") << " >>>>> Result of HLTMuonPFIsoFilter is " << accept << ", number of muons passing isolation cuts= " << nIsolatedMu;
196  return accept;
197  }
#define LogDebug(id)
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > previousCandToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
std::vector< edm::InputTag > depTag_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
static bool triggerdByPreviousLevel(const reco::RecoChargedCandidateRef &, const std::vector< reco::RecoChargedCandidateRef > &)
edm::InputTag candTag_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
edm::EDGetTokenT< double > rhoToken_
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref<C>)
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > candToken_
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:243
T const * product() const
Definition: Handle.h:74
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
fixed size matrix
bool saveTags() const
Definition: HLTFilter.h:45
HLT enums.
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > depToken_
def move(src, dest)
Definition: eostools.py:511
bool HLTMuonPFIsoFilter::triggerdByPreviousLevel ( const reco::RecoChargedCandidateRef candref,
const std::vector< reco::RecoChargedCandidateRef > &  vcands 
)
staticprivate

Definition at line 200 of file HLTMuonPFIsoFilter.cc.

References DEFINE_FWK_MODULE, and mps_fire::i.

Referenced by hltFilter().

200  {
201  unsigned int i=0;
202  unsigned int i_max=vcands.size();
203  for (;i!=i_max;++i){
204  if (candref == vcands[i]) return true;
205  }
206 
207  return false;
208 }

Member Data Documentation

edm::InputTag HLTMuonPFIsoFilter::candTag_
private

Definition at line 34 of file HLTMuonPFIsoFilter.h.

Referenced by hltFilter(), and HLTMuonPFIsoFilter().

edm::EDGetTokenT<reco::RecoChargedCandidateCollection> HLTMuonPFIsoFilter::candToken_
private

Definition at line 35 of file HLTMuonPFIsoFilter.h.

Referenced by hltFilter(), and HLTMuonPFIsoFilter().

std::vector<edm::InputTag> HLTMuonPFIsoFilter::depTag_
private

Definition at line 38 of file HLTMuonPFIsoFilter.h.

Referenced by hltFilter(), and HLTMuonPFIsoFilter().

std::vector<edm::EDGetTokenT<edm::ValueMap<double> > > HLTMuonPFIsoFilter::depToken_
private

Definition at line 39 of file HLTMuonPFIsoFilter.h.

Referenced by hltFilter(), and HLTMuonPFIsoFilter().

bool HLTMuonPFIsoFilter::doRho_
private

Definition at line 46 of file HLTMuonPFIsoFilter.h.

Referenced by hltFilter(), and HLTMuonPFIsoFilter().

double HLTMuonPFIsoFilter::effArea_
private

Definition at line 47 of file HLTMuonPFIsoFilter.h.

Referenced by hltFilter().

double HLTMuonPFIsoFilter::maxIso_
private

Definition at line 43 of file HLTMuonPFIsoFilter.h.

Referenced by hltFilter().

int HLTMuonPFIsoFilter::min_N_
private

Definition at line 44 of file HLTMuonPFIsoFilter.h.

Referenced by hltFilter(), and HLTMuonPFIsoFilter().

bool HLTMuonPFIsoFilter::onlyCharged_
private

Definition at line 45 of file HLTMuonPFIsoFilter.h.

Referenced by hltFilter().

edm::InputTag HLTMuonPFIsoFilter::previousCandTag_
private

Definition at line 36 of file HLTMuonPFIsoFilter.h.

Referenced by HLTMuonPFIsoFilter().

edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> HLTMuonPFIsoFilter::previousCandToken_
private

Definition at line 37 of file HLTMuonPFIsoFilter.h.

Referenced by hltFilter(), and HLTMuonPFIsoFilter().

edm::InputTag HLTMuonPFIsoFilter::rhoTag_
private

Definition at line 40 of file HLTMuonPFIsoFilter.h.

Referenced by HLTMuonPFIsoFilter().

edm::EDGetTokenT<double> HLTMuonPFIsoFilter::rhoToken_
private

Definition at line 41 of file HLTMuonPFIsoFilter.h.

Referenced by hltFilter(), and HLTMuonPFIsoFilter().