CMS 3D CMS Logo

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

#include <L2MuonIsolationProducer.h>

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

Public Member Functions

 L2MuonIsolationProducer (const edm::ParameterSet &)
 constructor with config More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 Produce isolation maps. More...
 
 ~L2MuonIsolationProducer () override
 destructor More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 ParameterSet descriptions. More...
 

Private Attributes

bool optOutputDecision
 
bool optOutputIsolatorFloat
 
std::unique_ptr< muonisolation::MuIsoBaseIsolatortheDepositIsolator
 
std::unique_ptr< reco::isodeposit::IsoDepositExtractortheExtractor
 
edm::InputTag theSACollectionLabel
 
edm::EDGetTokenT< reco::RecoChargedCandidateCollectiontheSACollectionToken
 

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

Author
J. Alcaraz

L2 HLT muon isolation producer

Author
J.Alcaraz

Definition at line 22 of file L2MuonIsolationProducer.h.

Constructor & Destructor Documentation

◆ L2MuonIsolationProducer()

L2MuonIsolationProducer::L2MuonIsolationProducer ( const edm::ParameterSet par)

constructor with config

Definition at line 36 of file L2MuonIsolationProducer.cc.

37  : theSACollectionLabel(par.getParameter<edm::InputTag>("StandAloneCollectionLabel")) {
38  LogDebug("Muon|RecoMuon|L2MuonIsolationProducer") << " L2MuonIsolationProducer constructor called";
39 
40  theSACollectionToken = consumes<RecoChargedCandidateCollection>(theSACollectionLabel);
41 
42  //
43  // Extractor
44  //
45  edm::ParameterSet extractorPSet = par.getParameter<edm::ParameterSet>("ExtractorPSet");
46  std::string extractorName = extractorPSet.getParameter<std::string>("ComponentName");
47  theExtractor = std::unique_ptr<reco::isodeposit::IsoDepositExtractor>{
48  IsoDepositExtractorFactory::get()->create(extractorName, extractorPSet, consumesCollector())};
49 
50  edm::ParameterSet isolatorPSet = par.getParameter<edm::ParameterSet>("IsolatorPSet");
51  bool haveIsolator = !isolatorPSet.empty();
52  optOutputDecision = haveIsolator;
53  if (optOutputDecision) {
54  std::string type = isolatorPSet.getParameter<std::string>("ComponentName");
55  theDepositIsolator = std::unique_ptr<muonisolation::MuIsoBaseIsolator>{
56  MuonIsolatorFactory::get()->create(type, isolatorPSet, consumesCollector())};
57  }
59  produces<edm::ValueMap<bool>>();
60  produces<reco::IsoDepositMap>();
61 
62  optOutputIsolatorFloat = par.getParameter<bool>("WriteIsolatorFloat");
63  if (optOutputIsolatorFloat && haveIsolator) {
64  produces<edm::ValueMap<float>>();
65  }
66 }

References edm::ParameterSet::empty(), get, edm::ParameterSet::getParameter(), LogDebug, optOutputDecision, optOutputIsolatorFloat, AlCaHLTBitMon_QueryRunRegistry::string, theDepositIsolator, theExtractor, theSACollectionLabel, and theSACollectionToken.

◆ ~L2MuonIsolationProducer()

L2MuonIsolationProducer::~L2MuonIsolationProducer ( )
override

destructor

Definition at line 69 of file L2MuonIsolationProducer.cc.

69  {
70  LogDebug("Muon|RecoMuon|L2MuonIsolationProducer") << " L2MuonIsolationProducer destructor called";
71 }

References LogDebug.

Member Function Documentation

◆ fillDescriptions()

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

ParameterSet descriptions.

Definition at line 74 of file L2MuonIsolationProducer.cc.

74  {
76  desc.add<edm::InputTag>("StandAloneCollectionLabel", edm::InputTag("hltL2MuonCandidates"));
77  edm::ParameterSetDescription extractorPSet;
78  {
79  extractorPSet.add<double>("DR_Veto_H", 0.1);
80  extractorPSet.add<bool>("Vertex_Constraint_Z", false);
81  extractorPSet.add<double>("Threshold_H", 0.5);
82  extractorPSet.add<std::string>("ComponentName", "CaloExtractor");
83  extractorPSet.add<double>("Threshold_E", 0.2);
84  extractorPSet.add<double>("DR_Max", 1.0);
85  extractorPSet.add<double>("DR_Veto_E", 0.07);
86  extractorPSet.add<double>("Weight_E", 1.5);
87  extractorPSet.add<bool>("Vertex_Constraint_XY", false);
88  extractorPSet.addUntracked<std::string>("DepositLabel", "EcalPlusHcal");
89  extractorPSet.add<edm::InputTag>("CaloTowerCollectionLabel", edm::InputTag("towerMaker"));
90  extractorPSet.add<double>("Weight_H", 1.0);
91  }
92  desc.add<edm::ParameterSetDescription>("ExtractorPSet", extractorPSet);
93  edm::ParameterSetDescription isolatorPSet;
94  {
95  std::vector<double> temp;
96  isolatorPSet.add<std::vector<double>>("ConeSizesRel", std::vector<double>(1, 0.3));
97  isolatorPSet.add<double>("EffAreaSFEndcap", 1.0);
98  isolatorPSet.add<bool>("CutAbsoluteIso", true);
99  isolatorPSet.add<bool>("AndOrCuts", true);
100  isolatorPSet.add<edm::InputTag>("RhoSrc", edm::InputTag("hltKT6CaloJetsForMuons", "rho"));
101  isolatorPSet.add<std::vector<double>>("ConeSizes", std::vector<double>(1, 0.3));
102  isolatorPSet.add<std::string>("ComponentName", "CutsIsolatorWithCorrection");
103  isolatorPSet.add<bool>("ReturnRelativeSum", false);
104  isolatorPSet.add<double>("RhoScaleBarrel", 1.0);
105  isolatorPSet.add<double>("EffAreaSFBarrel", 1.0);
106  isolatorPSet.add<bool>("CutRelativeIso", false);
107  isolatorPSet.add<std::vector<double>>("EtaBounds", std::vector<double>(1, 2.411));
108  isolatorPSet.add<std::vector<double>>("Thresholds", std::vector<double>(1, 9.9999999E7));
109  isolatorPSet.add<bool>("ReturnAbsoluteSum", true);
110  isolatorPSet.add<std::vector<double>>("EtaBoundsRel", std::vector<double>(1, 2.411));
111  isolatorPSet.add<std::vector<double>>("ThresholdsRel", std::vector<double>(1, 9.9999999E7));
112  isolatorPSet.add<double>("RhoScaleEndcap", 1.0);
113  isolatorPSet.add<double>("RhoMax", 9.9999999E7);
114  isolatorPSet.add<bool>("UseRhoCorrection", true);
115  }
116  desc.add<edm::ParameterSetDescription>("IsolatorPSet", isolatorPSet);
117  desc.add<bool>("WriteIsolatorFloat", false);
118  descriptions.add("hltL2MuonIsolations", desc);
119 }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, HLT_FULL_cff::InputTag, AlCaHLTBitMon_QueryRunRegistry::string, and groupFilesInBlocks::temp.

◆ produce()

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

Produce isolation maps.

build deposits

do the business of filling iso map

annoying – I will forget it at some point

annoying – I will forget it at some point

Definition at line 122 of file L2MuonIsolationProducer.cc.

122  {
123  std::string metname = "Muon|RecoMuon|L2MuonIsolationProducer";
124 
125  LogDebug(metname) << " L2 Muon Isolation producing...";
126 
127  // Take the SA container
128  LogDebug(metname) << " Taking the StandAlone muons: " << theSACollectionLabel;
130  event.getByToken(theSACollectionToken, muons);
131 
132  // Find deposits and load into event
133  LogDebug(metname) << " Get energy around";
134  auto depMap = std::make_unique<reco::IsoDepositMap>();
135  auto isoMap = std::make_unique<edm::ValueMap<bool>>();
136  auto isoFloatMap = std::make_unique<edm::ValueMap<float>>();
137 
138  unsigned int nMuons = muons->size();
139  std::vector<IsoDeposit> deps(nMuons);
140  std::vector<bool> isos(nMuons, false);
141  std::vector<float> isoFloats(nMuons, 0);
142 
143  // fill track collection to use for vetos calculation
144  TrackCollection muonTracks;
145  for (unsigned int i = 0; i < nMuons; i++) {
146  TrackRef tk = (*muons)[i].track();
147  muonTracks.push_back(*tk);
148  }
149 
150  theExtractor->fillVetos(event, eventSetup, muonTracks);
151 
152  for (unsigned int i = 0; i < nMuons; i++) {
153  TrackRef tk = (*muons)[i].track();
154 
155  deps[i] = theExtractor->deposit(event, eventSetup, *tk);
156 
157  if (optOutputDecision) {
160  muonisolation::MuIsoBaseIsolator::Result isoResult = theDepositIsolator->result(isoContainer, *tk, &event);
161  isos[i] = isoResult.valBool;
162  isoFloats[i] = isoResult.valFloat;
163  }
164  }
165 
167  reco::IsoDepositMap::Filler depFiller(*depMap);
168  depFiller.insert(muons, deps.begin(), deps.end());
169  depFiller.fill();
170  event.put(std::move(depMap));
171 
172  if (optOutputDecision) {
173  edm::ValueMap<bool>::Filler isoFiller(*isoMap);
174  isoFiller.insert(muons, isos.begin(), isos.end());
175  isoFiller.fill();
176  event.put(std::move(isoMap));
177 
179  edm::ValueMap<float>::Filler isoFloatFiller(*isoFloatMap);
180  isoFloatFiller.insert(muons, isoFloats.begin(), isoFloats.end());
181  isoFloatFiller.fill();
182  event.put(std::move(isoFloatMap));
183  }
184  }
185 
186  LogDebug(metname) << " Event loaded"
187  << "================================";
188 }

References symbols::deps, edm::helper::Filler< Map >::fill(), mps_fire::i, edm::helper::Filler< Map >::insert(), LogDebug, metname, eostools::move(), PDWG_BPHSkim_cff::muons, custom_jme_cff::nMuons, optOutputDecision, optOutputIsolatorFloat, AlCaHLTBitMon_QueryRunRegistry::string, theDepositIsolator, theExtractor, theSACollectionLabel, theSACollectionToken, muonisolation::MuIsoBaseIsolator::Result::valBool, and muonisolation::MuIsoBaseIsolator::Result::valFloat.

Member Data Documentation

◆ optOutputDecision

bool L2MuonIsolationProducer::optOutputDecision
private

Definition at line 43 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

◆ optOutputIsolatorFloat

bool L2MuonIsolationProducer::optOutputIsolatorFloat
private

Definition at line 46 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

◆ theDepositIsolator

std::unique_ptr<muonisolation::MuIsoBaseIsolator> L2MuonIsolationProducer::theDepositIsolator
private

Definition at line 52 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

◆ theExtractor

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

Definition at line 49 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

◆ theSACollectionLabel

edm::InputTag L2MuonIsolationProducer::theSACollectionLabel
private

Definition at line 39 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

◆ theSACollectionToken

edm::EDGetTokenT<reco::RecoChargedCandidateCollection> L2MuonIsolationProducer::theSACollectionToken
private

Definition at line 40 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
L2MuonIsolationProducer::theDepositIsolator
std::unique_ptr< muonisolation::MuIsoBaseIsolator > theDepositIsolator
Definition: L2MuonIsolationProducer.h:52
mps_fire.i
i
Definition: mps_fire.py:428
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
muonisolation::MuIsoBaseIsolator::Result::valBool
bool valBool
Definition: MuIsoBaseIsolator.h:37
custom_jme_cff.nMuons
nMuons
Definition: custom_jme_cff.py:141
muonisolation::MuIsoBaseIsolator::DepositAndVetos
Definition: MuIsoBaseIsolator.h:17
muonisolation::MuIsoBaseIsolator::Result
Definition: MuIsoBaseIsolator.h:27
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:85964
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::Handle
Definition: AssociativeIterator.h:50
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
edm::Ref< TrackCollection >
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
L2MuonIsolationProducer::theSACollectionLabel
edm::InputTag theSACollectionLabel
Definition: L2MuonIsolationProducer.h:39
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L2MuonIsolationProducer::theSACollectionToken
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > theSACollectionToken
Definition: L2MuonIsolationProducer.h:40
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
L2MuonIsolationProducer::theExtractor
std::unique_ptr< reco::isodeposit::IsoDepositExtractor > theExtractor
Definition: L2MuonIsolationProducer.h:49
edm::ParameterSet
Definition: ParameterSet.h:47
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
get
#define get
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
muonisolation::MuIsoBaseIsolator::Result::valFloat
float valFloat
Definition: MuIsoBaseIsolator.h:36
muonisolation::MuIsoBaseIsolator::DepositContainer
std::vector< DepositAndVetos > DepositContainer
Definition: MuIsoBaseIsolator.h:23
L2MuonIsolationProducer::optOutputDecision
bool optOutputDecision
Definition: L2MuonIsolationProducer.h:43
L2MuonIsolationProducer::optOutputIsolatorFloat
bool optOutputIsolatorFloat
Definition: L2MuonIsolationProducer.h:46
edm::helper::Filler
Definition: ValueMap.h:22
symbols.deps
deps
Definition: symbols.py:55
event
Definition: event.py:1
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::ParameterSet::empty
bool empty() const
Definition: ParameterSet.h:201
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:40