CMS 3D CMS Logo

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

#include <L3MuonIsolationProducer.h>

Inheritance diagram for L3MuonIsolationProducer:
edm::stream::EDProducer<>

Public Member Functions

 L3MuonIsolationProducer (const edm::ParameterSet &)
 constructor with config More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 Produce isolation maps. More...
 
 ~L3MuonIsolationProducer () override
 destructor More...
 
- 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 optOutputIsoDeposits
 
bool theApplyCutsORmaxNTracks
 apply or not the maxN cut on top of the sumPt (or nominall eff) < cuts More...
 
edm::ParameterSet theConfig
 
muonisolation::Cuts theCuts
 
std::unique_ptr< reco::isodeposit::IsoDepositExtractortheExtractor
 
int theMaxNTracks
 
edm::InputTag theMuonCollectionLabel
 
edm::EDGetTokenT< reco::RecoChargedCandidateCollectiontheMuonCollectionToken
 
double theTrackPt_Min
 

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 24 of file L3MuonIsolationProducer.h.

Constructor & Destructor Documentation

◆ L3MuonIsolationProducer()

L3MuonIsolationProducer::L3MuonIsolationProducer ( const edm::ParameterSet par)

constructor with config

get min pt for the track to go into sumPt

test cutsName only. The depositType is informational only (has not been used so far) [VK]

Definition at line 36 of file L3MuonIsolationProducer.cc.

References L3NominalEfficiencyConfigurator::cuts(), get, edm::ParameterSet::getParameter(), LogDebug, LogTrace, optOutputIsoDeposits, muonisolation::Cuts::print(), AlCaHLTBitMon_QueryRunRegistry::string, theApplyCutsORmaxNTracks, theConfig, theCuts, theExtractor, theMaxNTracks, theMuonCollectionLabel, theMuonCollectionToken, and theTrackPt_Min.

37  : theConfig(par),
38  theMuonCollectionLabel(par.getParameter<InputTag>("inputMuonCollection")),
39  optOutputIsoDeposits(par.getParameter<bool>("OutputMuIsoDeposits")),
40  theTrackPt_Min(-1) {
41  LogDebug("RecoMuon|L3MuonIsolationProducer") << " L3MuonIsolationProducer CTOR";
42 
43  theMuonCollectionToken = consumes<RecoChargedCandidateCollection>(theMuonCollectionLabel);
44 
46  produces<reco::IsoDepositMap>();
47  produces<edm::ValueMap<bool>>();
48 
49  //
50  // Extractor
51  //
52  edm::ParameterSet extractorPSet = theConfig.getParameter<edm::ParameterSet>("ExtractorPSet");
54  theTrackPt_Min = theConfig.getParameter<double>("TrackPt_Min");
55  std::string extractorName = extractorPSet.getParameter<std::string>("ComponentName");
56  theExtractor = std::unique_ptr<reco::isodeposit::IsoDepositExtractor>{
57  IsoDepositExtractorFactory::get()->create(extractorName, extractorPSet, consumesCollector())};
58  std::string depositType = extractorPSet.getUntrackedParameter<std::string>("DepositLabel");
59 
60  //
61  // Cuts
62  //
64  std::string cutsName = cutsPSet.getParameter<std::string>("ComponentName");
65  if (cutsName == "SimpleCuts") {
66  theCuts = Cuts(cutsPSet);
67  } else if (
68  // (cutsName== "L3NominalEfficiencyCuts_PXLS" && depositType=="PXLS")
69  // || (cutsName== "L3NominalEfficiencyCuts_TRKS" && depositType=="TRKS")
71  (cutsName == "L3NominalEfficiencyCuts_PXLS") || (cutsName == "L3NominalEfficiencyCuts_TRKS")) {
73  } else {
74  LogError("L3MuonIsolationProducer::beginJob") << "cutsName: " << cutsPSet << " is not recognized:"
75  << " theCuts not set!";
76  }
77  LogTrace("") << theCuts.print();
78 
79  // (kludge) additional cut on the number of tracks
80  theMaxNTracks = cutsPSet.getParameter<int>("maxNTracks");
81  theApplyCutsORmaxNTracks = cutsPSet.getParameter<bool>("applyCutsORmaxNTracks");
82 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Log< level::Error, false > LogError
#define LogTrace(id)
bool theApplyCutsORmaxNTracks
apply or not the maxN cut on top of the sumPt (or nominall eff) < cuts
std::string print() const
Definition: Cuts.cc:54
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > theMuonCollectionToken
std::unique_ptr< reco::isodeposit::IsoDepositExtractor > theExtractor
#define get
#define LogDebug(id)

◆ ~L3MuonIsolationProducer()

L3MuonIsolationProducer::~L3MuonIsolationProducer ( )
override

destructor

Definition at line 85 of file L3MuonIsolationProducer.cc.

References LogDebug.

85  {
86  LogDebug("RecoMuon|L3MuonIsolationProducer") << " L3MuonIsolationProducer DTOR";
87 }
#define LogDebug(id)

Member Function Documentation

◆ produce()

void L3MuonIsolationProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
override

Produce isolation maps.

Definition at line 89 of file L3MuonIsolationProducer.cc.

References submitPVResolutionJobs::count, DMR_cfg::cut, reco::IsoDeposit::depositAndCountWithin(), symbols::deps, options_cfi::eventSetup, edm::helper::Filler< Map >::fill(), mps_fire::i, edm::helper::Filler< Map >::insert(), LogDebug, LogTrace, metname, eostools::move(), amptDefaultParameters_cff::mu, PDWG_BPHSkim_cff::muons, custom_jme_cff::nMuons, optOutputIsoDeposits, reco::IsoDeposit::print(), mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, theApplyCutsORmaxNTracks, theCuts, theExtractor, theMaxNTracks, theMuonCollectionLabel, theMuonCollectionToken, theTrackPt_Min, and boostedElectronIsolation_cff::vetos.

89  {
90  std::string metname = "RecoMuon|L3MuonIsolationProducer";
91 
92  LogDebug(metname) << " L3 Muon Isolation producing..."
93  << " BEGINING OF EVENT "
94  << "================================";
95 
96  // Take the SA container
97  LogTrace(metname) << " Taking the muons: " << theMuonCollectionLabel;
99  event.getByToken(theMuonCollectionToken, muons);
100 
101  auto depMap = std::make_unique<reco::IsoDepositMap>();
102  auto isoMap = std::make_unique<edm::ValueMap<bool>>();
103 
104  //
105  // get Vetos and deposits
106  //
107  unsigned int nMuons = muons->size();
108 
109  IsoDeposit::Vetos vetos(nMuons);
110 
111  std::vector<IsoDeposit> deps(nMuons);
112  std::vector<bool> isos(nMuons, false);
113 
114  for (unsigned int i = 0; i < nMuons; i++) {
115  TrackRef mu(muons, i);
116  deps[i] = theExtractor->deposit(event, eventSetup, *mu);
117  vetos[i] = deps[i].veto();
118  }
119 
120  //
121  // add here additional vetos
122  //
123  //.....
124 
125  //
126  // actual cut step
127  //
128  for (unsigned int iMu = 0; iMu < nMuons; ++iMu) {
129  const reco::Track* mu = &(*muons)[iMu];
130 
131  const IsoDeposit& deposit = deps[iMu];
132  LogTrace(metname) << deposit.print();
133 
134  const Cuts::CutSpec& cut = theCuts(mu->eta());
135  std::pair<double, int> sumAndCount = deposit.depositAndCountWithin(cut.conesize, vetos, theTrackPt_Min);
136 
137  double value = sumAndCount.first;
138  int count = sumAndCount.second;
139 
140  bool result = (value < cut.threshold);
142  result |= count <= theMaxNTracks;
143  LogTrace(metname) << "deposit in cone: " << value << "with count " << count << " is isolated: " << result;
144 
145  isos[iMu] = result;
146  }
147 
148  //
149  // store
150  //
151  if (optOutputIsoDeposits) {
152  reco::IsoDepositMap::Filler depFiller(*depMap);
153  depFiller.insert(muons, deps.begin(), deps.end());
154  depFiller.fill();
155  event.put(std::move(depMap));
156  }
157  edm::ValueMap<bool>::Filler isoFiller(*isoMap);
158  isoFiller.insert(muons, isos.begin(), isos.end());
159  isoFiller.fill();
160  event.put(std::move(isoMap));
161 
162  LogTrace(metname) << " END OF EVENT "
163  << "================================";
164 }
const std::string metname
#define LogTrace(id)
bool theApplyCutsORmaxNTracks
apply or not the maxN cut on top of the sumPt (or nominall eff) < cuts
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > theMuonCollectionToken
Definition: value.py:1
std::unique_ptr< reco::isodeposit::IsoDepositExtractor > theExtractor
std::string print() const
Definition: IsoDeposit.cc:178
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1
std::pair< double, int > depositAndCountWithin(double coneSize, const Vetos &vetos=Vetos(), double threshold=-1e+36, bool skipDepositVeto=false) const
Get deposit.
Definition: IsoDeposit.cc:37
#define LogDebug(id)

Member Data Documentation

◆ optOutputIsoDeposits

double L3MuonIsolationProducer::optOutputIsoDeposits
private

Definition at line 46 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer(), and produce().

◆ theApplyCutsORmaxNTracks

bool L3MuonIsolationProducer::theApplyCutsORmaxNTracks
private

apply or not the maxN cut on top of the sumPt (or nominall eff) < cuts

Definition at line 60 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer(), and produce().

◆ theConfig

edm::ParameterSet L3MuonIsolationProducer::theConfig
private

Definition at line 36 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer().

◆ theCuts

muonisolation::Cuts L3MuonIsolationProducer::theCuts
private

Definition at line 43 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer(), and produce().

◆ theExtractor

std::unique_ptr<reco::isodeposit::IsoDepositExtractor> L3MuonIsolationProducer::theExtractor
private

Definition at line 49 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer(), and produce().

◆ theMaxNTracks

int L3MuonIsolationProducer::theMaxNTracks
private

max number of tracks to allow in the sum count <= maxN

Definition at line 57 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer(), and produce().

◆ theMuonCollectionLabel

edm::InputTag L3MuonIsolationProducer::theMuonCollectionLabel
private

Definition at line 39 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer(), and produce().

◆ theMuonCollectionToken

edm::EDGetTokenT<reco::RecoChargedCandidateCollection> L3MuonIsolationProducer::theMuonCollectionToken
private

Definition at line 40 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer(), and produce().

◆ theTrackPt_Min

double L3MuonIsolationProducer::theTrackPt_Min
private

pt cut to consider track in sumPt after extracting iso deposit better split this off into a filter

Definition at line 53 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer(), and produce().