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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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<>
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 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.

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 }

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.

◆ ~L3MuonIsolationProducer()

L3MuonIsolationProducer::~L3MuonIsolationProducer ( )
override

destructor

Definition at line 85 of file L3MuonIsolationProducer.cc.

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

References LogDebug.

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.

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 
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 }

References KineDebug3::count(), TkAlMuonSelectors_cfi::cut, reco::IsoDeposit::depositAndCountWithin(), symbols::deps, 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, jets_cff::nMuons, optOutputIsoDeposits, reco::IsoDeposit::print(), mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, theApplyCutsORmaxNTracks, theCuts, theExtractor, theMaxNTracks, theMuonCollectionLabel, theMuonCollectionToken, theTrackPt_Min, and boostedElectronIsolation_cff::vetos.

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().

muonisolation::Cuts::print
std::string print() const
Definition: Cuts.cc:54
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
mps_fire.i
i
Definition: mps_fire.py:355
L3MuonIsolationProducer::theMuonCollectionLabel
edm::InputTag theMuonCollectionLabel
Definition: L3MuonIsolationProducer.h:39
TkAlMuonSelectors_cfi.cut
cut
Definition: TkAlMuonSelectors_cfi.py:5
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
L3MuonIsolationProducer::theCuts
muonisolation::Cuts theCuts
Definition: L3MuonIsolationProducer.h:43
reco::IsoDeposit::depositAndCountWithin
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
L3MuonIsolationProducer::optOutputIsoDeposits
double optOutputIsoDeposits
Definition: L3MuonIsolationProducer.h:46
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref< TrackCollection >
L3MuonIsolationProducer::theApplyCutsORmaxNTracks
bool theApplyCutsORmaxNTracks
apply or not the maxN cut on top of the sumPt (or nominall eff) < cuts
Definition: L3MuonIsolationProducer.h:60
L3NominalEfficiencyConfigurator
Definition: L3NominalEfficiencyConfigurator.h:9
jets_cff.nMuons
nMuons
Definition: jets_cff.py:209
reco::Track
Definition: Track.h:27
muonisolation::Cuts
Definition: Cuts.h:14
L3MuonIsolationProducer::theMuonCollectionToken
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > theMuonCollectionToken
Definition: L3MuonIsolationProducer.h:40
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L3NominalEfficiencyConfigurator::cuts
muonisolation::Cuts cuts() const
Definition: L3NominalEfficiencyConfigurator.cc:22
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
L3MuonIsolationProducer::theTrackPt_Min
double theTrackPt_Min
Definition: L3MuonIsolationProducer.h:53
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
value
Definition: value.py:1
get
#define get
L3MuonIsolationProducer::theExtractor
std::unique_ptr< reco::isodeposit::IsoDepositExtractor > theExtractor
Definition: L3MuonIsolationProducer.h:49
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
reco::IsoDeposit
Definition: IsoDeposit.h:49
mps_fire.result
result
Definition: mps_fire.py:303
edm::helper::Filler
Definition: ValueMap.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
symbols.deps
deps
Definition: symbols.py:55
event
Definition: event.py:1
L3MuonIsolationProducer::theConfig
edm::ParameterSet theConfig
Definition: L3MuonIsolationProducer.h:36
reco::IsoDeposit::Vetos
std::vector< Veto > Vetos
Definition: IsoDeposit.h:65
boostedElectronIsolation_cff.vetos
vetos
Definition: boostedElectronIsolation_cff.py:79
edm::InputTag
Definition: InputTag.h:15
reco::IsoDeposit::print
std::string print() const
Definition: IsoDeposit.cc:178
L3MuonIsolationProducer::theMaxNTracks
int theMaxNTracks
Definition: L3MuonIsolationProducer.h:57
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:43