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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 ( const edm::ParameterSet par)

constructor with config

Definition at line 36 of file L2MuonIsolationProducer.cc.

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

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

destructor

Definition at line 68 of file L2MuonIsolationProducer.cc.

References LogDebug.

68  {
69  LogDebug("Muon|RecoMuon|L2MuonIsolationProducer")<<" L2MuonIsolationProducer destructor called";
70 }
#define LogDebug(id)

Member Function Documentation

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

ParameterSet descriptions.

Definition at line 73 of file L2MuonIsolationProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), AlCaHLTBitMon_QueryRunRegistry::string, and groupFilesInBlocks::temp.

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

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

121  {
122  std::string metname = "Muon|RecoMuon|L2MuonIsolationProducer";
123 
124  LogDebug(metname)<<" L2 Muon Isolation producing...";
125 
126  // Take the SA container
127  LogDebug(metname)<<" Taking the StandAlone muons: "<<theSACollectionLabel;
129  event.getByToken(theSACollectionToken,muons);
130 
131  // Find deposits and load into event
132  LogDebug(metname)<<" Get energy around";
133  auto depMap = std::make_unique<reco::IsoDepositMap>();
134  auto isoMap = std::make_unique<edm::ValueMap<bool>>();
135  auto isoFloatMap = std::make_unique<edm::ValueMap<float>>();
136 
137  unsigned int nMuons = muons->size();
138  std::vector<IsoDeposit> deps(nMuons);
139  std::vector<bool> isos(nMuons, false);
140  std::vector<float> isoFloats(nMuons, 0);
141 
142  // fill track collection to use for vetos calculation
143  TrackCollection muonTracks;
144  for (unsigned int i=0; i<nMuons; i++) {
145  TrackRef tk = (*muons)[i].track();
146  muonTracks.push_back(*tk);
147  }
148 
149  theExtractor->fillVetos(event,eventSetup,muonTracks);
150 
151  for (unsigned int i=0; i<nMuons; i++) {
152  TrackRef tk = (*muons)[i].track();
153 
154  deps[i] = theExtractor->deposit(event, eventSetup, *tk);
155 
156  if (optOutputDecision){
158  muonisolation::MuIsoBaseIsolator::Result isoResult = theDepositIsolator->result( isoContainer, *tk, &event );
159  isos[i] = isoResult.valBool;
160  isoFloats[i] = isoResult.valFloat;
161  }
162  }
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 }
#define LogDebug(id)
std::unique_ptr< muonisolation::MuIsoBaseIsolator > theDepositIsolator
const std::string metname
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:15
std::unique_ptr< reco::isodeposit::IsoDepositExtractor > theExtractor
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > theSACollectionToken
std::vector< DepositAndVetos > DepositContainer
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

bool L2MuonIsolationProducer::optOutputDecision
private

Definition at line 46 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

bool L2MuonIsolationProducer::optOutputIsolatorFloat
private

Definition at line 49 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

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

Definition at line 55 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

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

Definition at line 52 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

edm::InputTag L2MuonIsolationProducer::theSACollectionLabel
private

Definition at line 42 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

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

Definition at line 43 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().