Public Member Functions | |
DeltaRNearestObjectComputer (const edm::ParameterSet &iConfig) | |
virtual void | produce (edm::Event &iEvent, const edm::EventSetup &iSetup) |
virtual | ~DeltaRNearestObjectComputer () |
Private Attributes | |
StringCutObjectSelector< T, true > | objCut_ |
edm::InputTag | objects_ |
edm::InputTag | probes_ |
Definition at line 44 of file DeltaRNearestObjectComputer.cc.
DeltaRNearestObjectComputer< T >::DeltaRNearestObjectComputer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 58 of file DeltaRNearestObjectComputer.cc.
: probes_(iConfig.getParameter<edm::InputTag>("probes")), objects_(iConfig.getParameter<edm::InputTag>("objects")), objCut_(iConfig.existsAs<std::string>("objectSelection") ? iConfig.getParameter<std::string>("objectSelection") : "", true) { produces<edm::ValueMap<float> >(); }
DeltaRNearestObjectComputer< T >::~DeltaRNearestObjectComputer | ( | ) | [virtual] |
Definition at line 68 of file DeltaRNearestObjectComputer.cc.
{ }
void DeltaRNearestObjectComputer< T >::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 74 of file DeltaRNearestObjectComputer.cc.
References Geom::deltaR2(), edm::Event::getByLabel(), VarParsing::obj, edm::Event::put(), mathSSE::sqrt(), and makeHLTPrescaleTable::values.
{ using namespace edm; // read input Handle<View<reco::Candidate> > probes; iEvent.getByLabel(probes_, probes); Handle<View<T> > objects; iEvent.getByLabel(objects_, objects); // prepare vector for output std::vector<float> values; // fill View<reco::Candidate>::const_iterator probe, endprobes = probes->end(); for (probe = probes->begin(); probe != endprobes; ++probe) { double dr2min = 10000; for (unsigned int iObj=0; iObj<objects->size(); iObj++) { const T& obj = objects->at(iObj); if (!objCut_(obj)) continue; double dr2 = deltaR2(*probe, obj); if (dr2 < dr2min) { dr2min = dr2; } } values.push_back(sqrt(dr2min)); } // convert into ValueMap and store std::auto_ptr<ValueMap<float> > valMap(new ValueMap<float>()); ValueMap<float>::Filler filler(*valMap); filler.insert(probes, values.begin(), values.end()); filler.fill(); iEvent.put(valMap); }
StringCutObjectSelector<T,true> DeltaRNearestObjectComputer< T >::objCut_ [private] |
Definition at line 54 of file DeltaRNearestObjectComputer.cc.
edm::InputTag DeltaRNearestObjectComputer< T >::objects_ [private] |
Definition at line 53 of file DeltaRNearestObjectComputer.cc.
edm::InputTag DeltaRNearestObjectComputer< T >::probes_ [private] |
Definition at line 52 of file DeltaRNearestObjectComputer.cc.