1 #ifndef RECOEGAMMA_EGAMMAHLTPRODUCERS_EGAMMAHLTFILTEREDOBJPRODUCER_H 2 #define RECOEGAMMA_EGAMMAHLTPRODUCERS_EGAMMAHLTFILTEREDOBJPRODUCER_H 23 event.getByToken(token,handle);
29 template <
typename OutCollType>
52 throw cms::Exception(
"LogicError") <<
" candidate not found in collection ";
68 cut(pset.getParameter<double>(
"cut")),
69 cutOverE(pset.getParameter<double>(
"cutOverE")),
70 cutOverE2(pset.getParameter<double>(
"cutOverE2")),
71 useEt(pset.getParameter<
bool>(
"useEt")),
77 float energyInv = useEt ? 1./cand.
et() : 1./cand.
energy();
78 return compFunc(value*energyInv,cutOverE) ||
79 compFunc(value*energyInv*energyInv,cutOverE2);
100 output.push_back(cand);
108 template<
typename OutCollType>
113 const auto& cutPsets = pset.
getParameter<std::vector<edm::ParameterSet> >(
"cuts");
114 for(
auto& cutPset : cutPsets){
118 produces<OutCollType>();
122 template<
typename OutCollType>
131 regionCutsDesc.
add<
double>(
"cut",-1);
132 regionCutsDesc.
add<
double>(
"cutOverE",-1);
133 regionCutsDesc.
add<
double>(
"cutOverE2",-1);
134 regionCutsDesc.
add<
bool>(
"useEt",
false);
137 cutDefaults.addParameter<
double>(
"useEt",
false);
147 desc.
addVPSet(
"cuts",cutsDesc,std::vector<edm::ParameterSet>{defaults});
151 template<
typename OutCollType>
158 auto output = std::make_unique<OutCollType>();
160 for(
size_t candNr=0;candNr<candsHandle->size();candNr++){
162 bool passAllCuts=
true;
163 for(
const auto&
cut: cuts_){
T getParameter(std::string const &) const
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
edm::AssociationMap< edm::OneToValue< std::vector< reco::RecoEcalCandidate >, float > > RecoEcalCandidateIsolationMap
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
void getHandles(const edm::Event &event)
const_iterator end() const
last iterator over the map (read only)
EgammaHLTFilteredObjProducer(const edm::ParameterSet &pset)
edm::EDGetTokenT< reco::RecoEcalCandidateIsolationMap > varToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const_iterator find(const key_type &k) const
find element with specified reference key
void produce(edm::Event &, const edm::EventSetup &) override
def defaults(locpath, dataType, var)
double et() const final
transverse energy
void addParameter(std::string const &name, T const &value)
double energy() const final
energy
~EgammaHLTFilteredObjProducer() override=default
Abs< T >::type abs(const T &t)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::Handle< reco::RecoEcalCandidateIsolationMap > varHandle_
static void addObj(const reco::RecoEcalCandidateRef &cand, OutCollType &output)
SelectionCut(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
float getVar(const reco::RecoEcalCandidateRef &cand) const
bool operator()(const reco::RecoEcalCandidate &cand, float value) const
bool operator()(const reco::RecoEcalCandidateRef &cand) const
CutValues(const edm::ParameterSet &pset)
std::vector< RecoEcalCandidate > RecoEcalCandidateCollection
collectin of RecoEcalCandidate objects
std::vector< SelectionCut > cuts_
std::function< bool(float, float)> compFunc
edm::EDGetTokenT< reco::RecoEcalCandidateCollection > candsToken_