CMS 3D CMS Logo

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

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::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

template<typename T>
class DeltaRNearestObjectComputer< T >

Definition at line 44 of file DeltaRNearestObjectComputer.cc.

Constructor & Destructor Documentation

◆ DeltaRNearestObjectComputer()

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

Definition at line 58 of file DeltaRNearestObjectComputer.cc.

59  : probesToken_(consumes<edm::View<reco::Candidate>>(iConfig.getParameter<edm::InputTag>("probes"))),
60  objectsToken_(consumes<edm::View<T>>(iConfig.getParameter<edm::InputTag>("objects"))),
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
Definition: ParameterSet.h:303
StringCutObjectSelector< T, true > objCut_
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
edm::EDGetTokenT< edm::View< T > > objectsToken_
edm::EDGetTokenT< edm::View< reco::Candidate > > probesToken_

◆ ~DeltaRNearestObjectComputer()

template<typename T >
DeltaRNearestObjectComputer< T >::~DeltaRNearestObjectComputer ( )
override

Definition at line 68 of file DeltaRNearestObjectComputer.cc.

68 {}

Member Function Documentation

◆ produce()

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, iEvent, eostools::move(), getGTfromDQMFile::obj, L1TPhase2Offline_cfi::objects, 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 }
StringCutObjectSelector< T, true > objCut_
edm::EDGetTokenT< edm::View< T > > objectsToken_
int iEvent
Definition: GenABIO.cc:224
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

◆ objCut_

template<typename T >
StringCutObjectSelector<T, true> DeltaRNearestObjectComputer< T >::objCut_
private

Definition at line 54 of file DeltaRNearestObjectComputer.cc.

◆ objectsToken_

template<typename T >
edm::EDGetTokenT<edm::View<T> > DeltaRNearestObjectComputer< T >::objectsToken_
private

Definition at line 53 of file DeltaRNearestObjectComputer.cc.

◆ probesToken_

template<typename T >
edm::EDGetTokenT<edm::View<reco::Candidate> > DeltaRNearestObjectComputer< T >::probesToken_
private

Definition at line 52 of file DeltaRNearestObjectComputer.cc.