CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DeltaRNearestObjectComputer< T > Class Template Reference
Inheritance diagram for DeltaRNearestObjectComputer< T >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 DeltaRNearestObjectComputer (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~DeltaRNearestObjectComputer () override
 
- 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
 
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)
 
 ~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
 
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::vector< ModuleDescription const * > &modules, 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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

StringCutObjectSelector< T, true > objCut_
 
edm::EDGetTokenT< edm::View< T > > objectsToken_
 
edm::EDGetTokenT< edm::View< reco::Candidate > > probesToken_
 

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 wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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<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)
 

Detailed Description

template<typename T>
class DeltaRNearestObjectComputer< T >

Definition at line 44 of file DeltaRNearestObjectComputer.cc.

Constructor & Destructor Documentation

template<typename T >
DeltaRNearestObjectComputer< T >::DeltaRNearestObjectComputer ( const edm::ParameterSet iConfig)
explicit

Definition at line 58 of file DeltaRNearestObjectComputer.cc.

61  objCut_(
62  iConfig.existsAs<std::string>("objectSelection") ? iConfig.getParameter<std::string>("objectSelection") : "",
63  true) {
64  produces<edm::ValueMap<float>>();
65 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
StringCutObjectSelector< T, true > objCut_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::View< T > > objectsToken_
edm::EDGetTokenT< edm::View< reco::Candidate > > probesToken_
template<typename T >
DeltaRNearestObjectComputer< T >::~DeltaRNearestObjectComputer ( )
override

Definition at line 68 of file DeltaRNearestObjectComputer.cc.

68 {}

Member Function Documentation

template<typename T >
void DeltaRNearestObjectComputer< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 71 of file DeltaRNearestObjectComputer.cc.

References HLTMuonOfflineAnalyzer_cfi::deltaR2, trigObjTnPSource_cfi::filler, edm::Event::getByToken(), eostools::move(), getGTfromDQMFile::obj, DeltaRNearestObjectComputer< T >::objCut_, DeltaRNearestObjectComputer< T >::objectsToken_, DeltaRNearestObjectComputer< T >::probesToken_, edm::Event::put(), mathSSE::sqrt(), and contentValuesCheck::values.

71  {
72  using namespace edm;
73 
74  // read input
76  iEvent.getByToken(probesToken_, probes);
77 
79  iEvent.getByToken(objectsToken_, objects);
80 
81  // prepare vector for output
82  std::vector<float> values;
83 
84  // fill
85  View<reco::Candidate>::const_iterator probe, endprobes = probes->end();
86  for (probe = probes->begin(); probe != endprobes; ++probe) {
87  double dr2min = 10000;
88  for (unsigned int iObj = 0; iObj < objects->size(); iObj++) {
89  const T& obj = objects->at(iObj);
90  if (!objCut_(obj))
91  continue;
92  double dr2 = deltaR2(*probe, obj);
93  if (dr2 < dr2min) {
94  dr2min = dr2;
95  }
96  }
97  values.push_back(sqrt(dr2min));
98  }
99 
100  // convert into ValueMap and store
101  auto valMap = std::make_unique<ValueMap<float>>();
103  filler.insert(probes, values.begin(), values.end());
104  filler.fill();
105  iEvent.put(std::move(valMap));
106 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
StringCutObjectSelector< T, true > objCut_
edm::EDGetTokenT< edm::View< T > > objectsToken_
T sqrt(T t)
Definition: SSEVec.h:19
HLT enums.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::EDGetTokenT< edm::View< reco::Candidate > > probesToken_
long double T
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

template<typename T >
StringCutObjectSelector<T, true> DeltaRNearestObjectComputer< T >::objCut_
private
template<typename T >
edm::EDGetTokenT<edm::View<T> > DeltaRNearestObjectComputer< T >::objectsToken_
private
template<typename T >
edm::EDGetTokenT<edm::View<reco::Candidate> > DeltaRNearestObjectComputer< T >::probesToken_
private