CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
MuIsolatorResultProducer< BT > Class Template Reference

BT == base type. More...

#include <MuIsolatorResultProducer.h>

Inheritance diagram for MuIsolatorResultProducer< BT >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  DepositConf
 
struct  VetoCuts
 

Public Member Functions

 MuIsolatorResultProducer (const edm::ParameterSet &)
 constructor with config More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~MuIsolatorResultProducer () override
 destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef muisorhelper::CandMap< BT > CandMap
 
typedef muisorhelper::DepositContainer DepositContainer
 
typedef muisorhelper::Isolator Isolator
 
typedef muisorhelper::Result Result
 
typedef muisorhelper::Results Results
 
typedef muisorhelper::ResultType ResultType
 

Private Member Functions

void callWhatProduces ()
 declare what's going to be produced More...
 
unsigned int initAssociation (edm::Event &event, CandMap &candMapT) const
 
void initVetos (std::vector< reco::IsoDeposit::Vetos *> &vetos, CandMap &candMap) const
 
void writeOut (edm::Event &event, const CandMap &candMap, const Results &results) const
 choose which result type to write here More...
 
template<typename RT >
void writeOutImpl (edm::Event &event, const CandMap &candMapT, const Results &results) const
 actually do the writing here More...
 

Private Attributes

reco::TrackBase::Point theBeam
 
std::string theBeamlineOption
 beam spot More...
 
edm::InputTag theBeamSpotLabel
 
edm::ParameterSet theConfig
 
std::vector< DepositConftheDepositConfs
 
IsolatortheIsolator
 the isolator More...
 
bool theRemoveOtherVetos
 choose which muon vetos should be removed from all deposits More...
 
ResultType theResultType
 
VetoCuts theVetoCuts
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

template<typename BT = reco::Candidate>
class MuIsolatorResultProducer< BT >

BT == base type.

Definition at line 53 of file MuIsolatorResultProducer.h.

Member Typedef Documentation

◆ CandMap

template<typename BT = reco::Candidate>
typedef muisorhelper::CandMap<BT> MuIsolatorResultProducer< BT >::CandMap
private

Definition at line 68 of file MuIsolatorResultProducer.h.

◆ DepositContainer

template<typename BT = reco::Candidate>
typedef muisorhelper::DepositContainer MuIsolatorResultProducer< BT >::DepositContainer
private

Definition at line 66 of file MuIsolatorResultProducer.h.

◆ Isolator

template<typename BT = reco::Candidate>
typedef muisorhelper::Isolator MuIsolatorResultProducer< BT >::Isolator
private

Definition at line 62 of file MuIsolatorResultProducer.h.

◆ Result

template<typename BT = reco::Candidate>
typedef muisorhelper::Result MuIsolatorResultProducer< BT >::Result
private

Definition at line 63 of file MuIsolatorResultProducer.h.

◆ Results

template<typename BT = reco::Candidate>
typedef muisorhelper::Results MuIsolatorResultProducer< BT >::Results
private

Definition at line 65 of file MuIsolatorResultProducer.h.

◆ ResultType

template<typename BT = reco::Candidate>
typedef muisorhelper::ResultType MuIsolatorResultProducer< BT >::ResultType
private

Definition at line 64 of file MuIsolatorResultProducer.h.

Constructor & Destructor Documentation

◆ MuIsolatorResultProducer()

template<typename BT >
MuIsolatorResultProducer< BT >::MuIsolatorResultProducer ( const edm::ParameterSet par)

constructor with config

read input config for deposit types and weights and thresholds to apply to them

will switch to a factory at some point

FIXME

FIXME: need to get the file name here

"other vetoes" is limited to the same collection now for non-trivial choice an external map with pre-made selection flags can be a better choice

Definition at line 186 of file MuIsolatorResultProducer.h.

References MuIsolatorResultProducer< BT >::callWhatProduces(), HLT_2022v11_cff::coneSize, edm::ParameterSet::getParameter(), LogDebug, MuIsolatorResultProducer< BT >::VetoCuts::muAbsEtaMax, MuIsolatorResultProducer< BT >::VetoCuts::muAbsZMax, MuIsolatorResultProducer< BT >::VetoCuts::muD0Max, MuIsolatorResultProducer< BT >::VetoCuts::muPtMin, muonisolation::MuIsoBaseIsolator::resultType(), MuIsolatorResultProducer< BT >::VetoCuts::selectAll, AlCaHLTBitMon_QueryRunRegistry::string, MuIsolatorResultProducer< BT >::DepositConf::tag, MuIsolatorResultProducer< BT >::theBeamlineOption, MuIsolatorResultProducer< BT >::theBeamSpotLabel, MuIsolatorResultProducer< BT >::theDepositConfs, MuIsolatorResultProducer< BT >::theIsolator, MuIsolatorResultProducer< BT >::theRemoveOtherVetos, MuIsolatorResultProducer< BT >::theResultType, MuIsolatorResultProducer< BT >::theVetoCuts, MuIsolatorResultProducer< BT >::DepositConf::threshold, and MuIsolatorResultProducer< BT >::DepositConf::weight.

187  : theConfig(par),
188  theRemoveOtherVetos(par.getParameter<bool>("RemoveOtherVetos")),
189  theIsolator(nullptr),
190  theBeam(0, 0, 0) {
191  LogDebug("RecoMuon|MuonIsolation") << " MuIsolatorResultProducer CTOR";
192 
194  std::vector<edm::ParameterSet> depositInputs = par.getParameter<std::vector<edm::ParameterSet>>("InputMuIsoDeposits");
195 
196  std::vector<double> dWeights(depositInputs.size());
197  std::vector<double> dThresholds(depositInputs.size());
198 
199  for (unsigned int iDep = 0; iDep < depositInputs.size(); ++iDep) {
200  DepositConf dConf;
201  dConf.tag = depositInputs[iDep].getParameter<edm::InputTag>("DepositTag");
202  dConf.weight = depositInputs[iDep].getParameter<double>("DepositWeight");
203  dConf.threshold = depositInputs[iDep].getParameter<double>("DepositThreshold");
204 
205  dWeights[iDep] = dConf.weight;
206  dThresholds[iDep] = dConf.threshold;
207 
208  theDepositConfs.push_back(dConf);
209  }
210 
211  edm::ParameterSet isoPset = par.getParameter<edm::ParameterSet>("IsolatorPSet");
213  std::string isolatorType = isoPset.getParameter<std::string>("ComponentName");
214  if (isolatorType == "IsolatorByDeposit") {
215  std::string coneSizeType = isoPset.getParameter<std::string>("ConeSizeType");
216  if (coneSizeType == "FixedConeSize") {
217  float coneSize(isoPset.getParameter<double>("coneSize"));
218 
219  theIsolator = new muonisolation::IsolatorByDeposit(coneSize, dWeights, dThresholds);
220 
221  // theIsolator = new IsolatorByDeposit(isoPset);
222  } else if (coneSizeType == "CutsConeSize") {
224  // Cuts cuts(isoPset.getParameter<edm::ParameterSet>("CutsPSet"));
225 
226  // theIsolator = new IsolatorByDeposit(coneSize, dWeights, dThresholds);
227  }
228  } else if (isolatorType == "IsolatorByNominalEfficiency") {
230  theIsolator =
231  new muonisolation::IsolatorByNominalEfficiency("noname", std::vector<std::string>(1, "8:0.97"), dWeights);
232  } else if (isolatorType == "IsolatorByDepositCount") {
233  std::string coneSizeType = isoPset.getParameter<std::string>("ConeSizeType");
234  if (coneSizeType == "FixedConeSize") {
235  float coneSize(isoPset.getParameter<double>("coneSize"));
236 
238 
239  // theIsolator = new IsolatorByDeposit(isoPset);
240  } else if (coneSizeType == "CutsConeSize") {
241  // Cuts cuts(isoPset.getParameter<edm::ParameterSet>("CutsPSet"));
242 
243  // theIsolator = new IsolatorByDeposit(coneSize, dWeights, dThresholds);
244  }
245  }
246 
247  if (theIsolator == nullptr) {
248  edm::LogError("MuonIsolationProducers") << "Failed to initialize an isolator";
249  }
251 
253 
254  if (theRemoveOtherVetos) {
255  edm::ParameterSet vetoPSet = par.getParameter<edm::ParameterSet>("VetoPSet");
256  theVetoCuts.selectAll = vetoPSet.getParameter<bool>("SelectAll");
257 
261  if (!theVetoCuts.selectAll) {
262  theVetoCuts.muAbsEtaMax = vetoPSet.getParameter<double>("MuAbsEtaMax");
263  theVetoCuts.muPtMin = vetoPSet.getParameter<double>("MuPtMin");
264  theVetoCuts.muAbsZMax = vetoPSet.getParameter<double>("MuAbsZMax");
265  theVetoCuts.muD0Max = vetoPSet.getParameter<double>("MuD0Max");
266  theBeamlineOption = par.getParameter<std::string>("BeamlineOption");
267  theBeamSpotLabel = par.getParameter<edm::InputTag>("BeamSpotLabel");
268  }
269  }
270 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< DepositConf > theDepositConfs
bool theRemoveOtherVetos
choose which muon vetos should be removed from all deposits
void callWhatProduces()
declare what&#39;s going to be produced
Log< level::Error, false > LogError
Isolator * theIsolator
the isolator
std::string theBeamlineOption
beam spot
virtual ResultType resultType() const =0
reco::TrackBase::Point theBeam
#define LogDebug(id)

◆ ~MuIsolatorResultProducer()

template<typename BT >
MuIsolatorResultProducer< BT >::~MuIsolatorResultProducer ( )
override

destructor

Definition at line 274 of file MuIsolatorResultProducer.h.

References LogDebug.

274  {
275  if (theIsolator)
276  delete theIsolator;
277  LogDebug("RecoMuon|MuIsolatorResultProducer") << " MuIsolatorResultProducer DTOR";
278 }
Isolator * theIsolator
the isolator
#define LogDebug(id)

Member Function Documentation

◆ callWhatProduces()

template<typename BT >
void MuIsolatorResultProducer< BT >::callWhatProduces ( )
inlineprivate

declare what's going to be produced

Definition at line 152 of file MuIsolatorResultProducer.h.

Referenced by MuIsolatorResultProducer< BT >::MuIsolatorResultProducer().

◆ initAssociation()

template<typename BT >
unsigned int MuIsolatorResultProducer< BT >::initAssociation ( edm::Event event,
CandMap candMapT 
) const
private

WARNING: the input ValueMaps are better be for a single key product ID no effort is done (FIXME) for more complex cases
init {muon, {[deposit,veto]_type}} container

Definition at line 348 of file MuIsolatorResultProducer.h.

References edm::ValueMap< T >::const_iterator::begin(), edm::ValueMap< T >::begin(), edm::ValueMap< T >::empty(), edm::ValueMap< T >::const_iterator::end(), muisorhelper::CandMap< BT >::get(), edm::ValueMap< T >::const_iterator::id(), LogDebug, metname, muisorhelper::CandMap< BT >::setHandle(), edm::ValueMap< T >::size(), AlCaHLTBitMon_QueryRunRegistry::string, and makeGlobalPositionRcd_cfg::tag.

348  {
349  std::string metname = "RecoMuon|MuonIsolationProducers";
350 
352 
353  for (unsigned int iMap = 0; iMap < theDepositConfs.size(); ++iMap) {
355  event.getByLabel(theDepositConfs[iMap].tag, depH);
356  LogDebug(metname) << "Got Deposits of size " << depH->size();
357  if (depH->empty())
358  continue;
359 
362  typename CandMap::handle_type keyH;
363  event.get(depH->begin().id(), keyH);
364  candMapT.setHandle(keyH);
365  typename CT::const_iterator depHCI = depH->begin().begin();
366  typename CT::const_iterator depEnd = depH->begin().end();
367  unsigned int keyI = 0;
368  for (; depHCI != depEnd; ++depHCI, ++keyI) {
369  typename CandMap::key_type muPtr(keyH->refAt(keyI));
371  if (iMap == 0)
372  candMapT.get().push_back(typename CandMap::pair_type(muPtr, DepositContainer(theDepositConfs.size())));
373  typename CandMap::iterator muI = candMapT.get().begin();
374  for (; muI != candMapT.get().end(); ++muI) {
375  if (muI->first == muPtr)
376  break;
377  }
378  if (muI->first != muPtr) {
379  edm::LogError("MuonIsolationProducers") << "Failed to align muon map";
380  }
381  muI->second[iMap].dep = &*depHCI;
382  }
383  }
384 
385  LogDebug(metname) << "Picked and aligned nDeps = " << candMapT.get().size();
386  return candMapT.get().size();
387 }
std::pair< key_type, value_type > pair_type
const std::string metname
std::vector< DepositConf > theDepositConfs
Log< level::Error, false > LogError
edm::RefToBase< BT > key_type
edm::Handle< edm::View< BT > > handle_type
ProductID id() const
Definition: ValueMap.h:173
container::const_iterator end() const
Definition: ValueMap.h:175
const_iterator begin() const
Definition: ValueMap.h:229
container::const_iterator begin() const
Definition: ValueMap.h:174
muisorhelper::DepositContainer DepositContainer
size_t size() const
Definition: ValueMap.h:156
std::vector< value_type > container
Definition: ValueMap.h:110
bool empty() const
Definition: ValueMap.h:158
#define LogDebug(id)

◆ initVetos()

template<typename BT >
void MuIsolatorResultProducer< BT >::initVetos ( std::vector< reco::IsoDeposit::Vetos *> &  vetos,
CandMap candMap 
) const
private

Definition at line 390 of file MuIsolatorResultProducer.h.

References d0, muisorhelper::CandMap< BT >::get(), LogDebug, metname, amptDefaultParameters_cff::mu, AlCaHLTBitMon_QueryRunRegistry::string, and boostedElectronIsolation_cff::vetos.

390  {
391  std::string metname = "RecoMuon|MuonIsolationProducers";
392 
393  if (theRemoveOtherVetos) {
394  LogDebug(metname) << "Start checking for vetos based on input/expected vetos.size of " << vetos.size()
395  << " passed at " << &vetos << " and an input map.size of " << candMapT.get().size();
396 
397  unsigned int muI = 0;
398  for (; muI < candMapT.get().size(); ++muI) {
399  typename CandMap::key_type mu = candMapT.get()[muI].first;
400  double d0 = ((mu->vx() - theBeam.x()) * mu->py() - (mu->vy() - theBeam.y()) * mu->px()) / mu->pt();
401  LogDebug(metname) << "Muon at index " << muI;
402  if (theVetoCuts.selectAll || (fabs(mu->eta()) < theVetoCuts.muAbsEtaMax && mu->pt() > theVetoCuts.muPtMin &&
403  fabs(mu->vz()) < theVetoCuts.muAbsZMax && fabs(d0) < theVetoCuts.muD0Max)) {
404  LogDebug(metname) << "muon passes the cuts";
405  for (unsigned int iDep = 0; iDep < candMapT.get()[muI].second.size(); ++iDep) {
406  if (vetos[iDep] == nullptr)
407  vetos[iDep] = new reco::IsoDeposit::Vetos();
408 
409  vetos[iDep]->push_back(candMapT.get()[muI].second[iDep].dep->veto());
410  }
411  }
412  }
413 
414  LogDebug(metname) << "Assigning vetos";
415  muI = 0;
416  for (; muI < candMapT.get().size(); ++muI) {
417  for (unsigned int iDep = 0; iDep < candMapT.get()[muI].second.size(); ++iDep) {
418  candMapT.get()[muI].second[iDep].vetos = vetos[iDep];
419  }
420  }
421  LogDebug(metname) << "Done with vetos";
422  }
423 }
const std::string metname
bool theRemoveOtherVetos
choose which muon vetos should be removed from all deposits
edm::RefToBase< BT > key_type
static constexpr float d0
std::vector< Veto > Vetos
Definition: IsoDeposit.h:65
reco::TrackBase::Point theBeam
#define LogDebug(id)

◆ produce()

template<typename BT >
void MuIsolatorResultProducer< BT >::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
overridevirtual

do it only if needed

"smart" container used to repackage deposits_type_candIndex into deposits_candIndex_type have to have it for veto removal (could do away without it otherwise) IMPORTANT: ALL THE REFERENCING BUSINESS IS DONE THROUGH POINTERS Access to the mapped values as reference type HAS TO BE AVAILABLE



isolator results will be here

extra vetos will be filled here

call the isolator result, passing {[deposit,vetos]_type} set and the candidate

do cleanup

Implements edm::EDProducer.

Definition at line 281 of file MuIsolatorResultProducer.h.

References pwdgSkimBPark_cfi::beamSpot, muisorhelper::CandMap< BT >::get(), edm::HandleBase::isValid(), LogDebug, LogTrace, metname, reco::BeamSpot::position(), bookConverter::results, and AlCaHLTBitMon_QueryRunRegistry::string.

281  {
282  std::string metname = "RecoMuon|MuonIsolationProducers";
283  LogDebug(metname) << " Muon Deposit producing..."
284  << " BEGINING OF EVENT "
285  << "================================";
286 
287  theBeam = reco::TrackBase::Point(0, 0, 0);
288 
291  if (theBeamlineOption == "BeamSpotFromEvent") {
292  //pick beamSpot
294  edm::Handle<reco::BeamSpot> beamSpotH;
295 
296  event.getByLabel(theBeamSpotLabel, beamSpotH);
297 
298  if (beamSpotH.isValid()) {
299  theBeam = beamSpotH->position();
300  LogTrace(metname) << "Extracted beam point at " << theBeam << std::endl;
301  }
302  }
303  }
304 
310  CandMap candMapT;
311 
312  unsigned int colSize = initAssociation(event, candMapT);
313 
315  Results results(colSize);
316 
318  std::vector<reco::IsoDeposit::Vetos*> vetoDeps(theDepositConfs.size(), nullptr);
319 
320  if (colSize != 0) {
321  if (theRemoveOtherVetos) {
322  initVetos(vetoDeps, candMapT);
323  }
324 
326  for (unsigned int muI = 0; muI < colSize; ++muI) {
327  results[muI] = theIsolator->result(candMapT.get()[muI].second, *(candMapT.get()[muI].first));
328 
329  if (results[muI].typeF() != theIsolator->resultType()) {
330  edm::LogError("MuonIsolationProducers") << "Failed to get result from the isolator";
331  }
332  }
333  }
334 
335  LogDebug(metname) << "Ready to write out results of size " << results.size();
336  writeOut(event, candMapT, results);
337 
338  for (unsigned int iDep = 0; iDep < vetoDeps.size(); ++iDep) {
340  if (vetoDeps[iDep]) {
341  delete vetoDeps[iDep];
342  vetoDeps[iDep] = nullptr;
343  }
344  }
345 }
const Point & position() const
position
Definition: BeamSpot.h:59
const std::string metname
std::vector< DepositConf > theDepositConfs
bool theRemoveOtherVetos
choose which muon vetos should be removed from all deposits
virtual Result result(const DepositContainer &deposits, const edm::Event *=nullptr) const =0
Compute and return the isolation variable.
Log< level::Error, false > LogError
#define LogTrace(id)
Isolator * theIsolator
the isolator
std::string theBeamlineOption
beam spot
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
virtual ResultType resultType() const =0
void writeOut(edm::Event &event, const CandMap &candMap, const Results &results) const
choose which result type to write here
unsigned int initAssociation(edm::Event &event, CandMap &candMapT) const
bool isValid() const
Definition: HandleBase.h:70
void initVetos(std::vector< reco::IsoDeposit::Vetos *> &vetos, CandMap &candMap) const
reco::TrackBase::Point theBeam
muisorhelper::CandMap< BT > CandMap
Definition: event.py:1
#define LogDebug(id)

◆ writeOut()

template<typename BT >
void MuIsolatorResultProducer< BT >::writeOut ( edm::Event event,
const CandMap candMap,
const Results results 
) const
inlineprivate

choose which result type to write here

Definition at line 136 of file MuIsolatorResultProducer.h.

References edmPickEvents::event, LogDebug, metname, bookConverter::results, and AlCaHLTBitMon_QueryRunRegistry::string.

138  {
139  std::string metname = "RecoMuon|MuonIsolationProducers";
140  LogDebug(metname) << "Before calling writeOutMap with result type " << theIsolator->resultType();
141 
143  writeOutImpl<int>(event, candMapT, results);
145  writeOutImpl<float>(event, candMapT, results);
147  writeOutImpl<bool>(event, candMapT, results);
148 }
const std::string metname
Isolator * theIsolator
the isolator
virtual ResultType resultType() const =0
#define LogDebug(id)

◆ writeOutImpl()

template<typename BT >
template<typename RT >
void MuIsolatorResultProducer< BT >::writeOutImpl ( edm::Event event,
const CandMap candMapT,
const Results results 
) const
inlineprivate

actually do the writing here

make an output vec of what's to be written with a concrete type

fill/insert of non-empty values only

Definition at line 115 of file MuIsolatorResultProducer.h.

References trigObjTnPSource_cfi::filler, muisorhelper::CandMap< BT >::get(), muisorhelper::CandMap< BT >::handle(), mps_fire::i, eostools::move(), and bookConverter::results.

117  {
119  std::vector<RT> resV(results.size());
120  for (unsigned int i = 0; i < resV.size(); ++i)
121  resV[i] = results[i].val<RT>();
122  auto outMap = std::make_unique<edm::ValueMap<RT>>();
123  typename edm::ValueMap<RT>::Filler filler(*outMap);
124 
126  if (!candMapT.get().empty()) {
127  filler.insert(candMapT.handle(), resV.begin(), resV.end());
128  filler.fill();
129  }
130 
131  event.put(std::move(outMap));
132 }
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ theBeam

template<typename BT = reco::Candidate>
reco::TrackBase::Point MuIsolatorResultProducer< BT >::theBeam
private

Definition at line 109 of file MuIsolatorResultProducer.h.

◆ theBeamlineOption

template<typename BT = reco::Candidate>
std::string MuIsolatorResultProducer< BT >::theBeamlineOption
private

◆ theBeamSpotLabel

template<typename BT = reco::Candidate>
edm::InputTag MuIsolatorResultProducer< BT >::theBeamSpotLabel
private

◆ theConfig

template<typename BT = reco::Candidate>
edm::ParameterSet MuIsolatorResultProducer< BT >::theConfig
private

Definition at line 95 of file MuIsolatorResultProducer.h.

◆ theDepositConfs

template<typename BT = reco::Candidate>
std::vector<DepositConf> MuIsolatorResultProducer< BT >::theDepositConfs
private

◆ theIsolator

template<typename BT = reco::Candidate>
Isolator* MuIsolatorResultProducer< BT >::theIsolator
private

the isolator

Definition at line 103 of file MuIsolatorResultProducer.h.

Referenced by MuIsolatorResultProducer< BT >::MuIsolatorResultProducer().

◆ theRemoveOtherVetos

template<typename BT = reco::Candidate>
bool MuIsolatorResultProducer< BT >::theRemoveOtherVetos
private

choose which muon vetos should be removed from all deposits

Definition at line 99 of file MuIsolatorResultProducer.h.

Referenced by MuIsolatorResultProducer< BT >::MuIsolatorResultProducer().

◆ theResultType

template<typename BT = reco::Candidate>
ResultType MuIsolatorResultProducer< BT >::theResultType
private

◆ theVetoCuts

template<typename BT = reco::Candidate>
VetoCuts MuIsolatorResultProducer< BT >::theVetoCuts
private