73 template <
typename T1>
85 :
minEt_(para.getParameter<double>(
"minEt")),
86 maxEt_(para.getParameter<double>(
"maxEt")),
87 maxDeltaR_(para.getParameter<double>(
"maxDeltaR")),
88 maxDEta_(para.getParameter<double>(
"maxDEta")),
89 maxDPhi_(para.getParameter<double>(
"maxDPhi")),
90 token_(consumesColl.consumes<T1>(para.getParameter<
edm::
InputTag>(
"inputColl"))) {}
95 template <
typename CaloObjType,
typename CaloObjCollType = edm::SortedCollection<CaloObjType>>
110 const std::vector<EtaPhiRegion>&
regions);
119 template <
typename CaloObjType,
typename CaloObjCollType>
123 para.getParameter<std::vector<edm::ParameterSet>>(
"etaPhiRegions");
126 etaPhiRegionData_.emplace_back(createEtaPhiRegionData(
129 consumesCollector()));
132 outputProductNames_ = para.getParameter<std::vector<std::string>>(
"outputProductNames");
133 inputCollTags_ = para.getParameter<std::vector<edm::InputTag>>(
"inputCollTags");
134 if (outputProductNames_.size() != inputCollTags_.size()) {
136 <<
" error outputProductNames and inputCollTags must be the same size, they are " << outputProductNames_.size()
137 <<
" vs " << inputCollTags_.size();
139 for (
unsigned int collNr = 0; collNr < inputCollTags_.size(); collNr++) {
140 inputTokens_.push_back(consumes<CaloObjCollType>(inputCollTags_[collNr]));
141 produces<CaloObjCollType>(outputProductNames_[collNr]);
145 template <
typename CaloObjType,
typename CaloObjCollType>
152 std::vector<edm::InputTag> inputColls;
154 desc.add<std::vector<edm::InputTag>>(
"inputCollTags", inputColls);
169 etaPhiRegionDesc.
add<
double>(
"minEt");
170 etaPhiRegionDesc.
add<
double>(
"maxEt");
171 etaPhiRegionDesc.
add<
double>(
"maxDeltaR");
172 etaPhiRegionDesc.
add<
double>(
"maxDEta");
173 etaPhiRegionDesc.
add<
double>(
"maxDPhi");
180 template <
typename CaloObjType,
typename CaloObjCollType>
184 auto const& caloGeom =
setup.getData(caloGeometryToken_);
186 std::vector<EtaPhiRegion>
regions;
187 std::for_each(etaPhiRegionData_.begin(),
188 etaPhiRegionData_.end(),
193 for (
size_t inputCollNr = 0; inputCollNr < inputTokens_.size(); inputCollNr++) {
195 event.getByToken(inputTokens_[inputCollNr],
inputColl);
198 edm::LogError(
"ProductNotFound") <<
"could not get a handle on the " <<
typeid(CaloObjCollType).
name()
199 <<
" named " << inputCollTags_[inputCollNr].encode() << std::endl;
207 template <
typename CaloObjType,
typename CaloObjCollType>
211 const std::vector<EtaPhiRegion>&
regions) {
212 auto outputColl = std::make_unique<CaloObjCollType>();
218 if (objGeom ==
nullptr) {
224 if (validIDForGeom(
obj.id())) {
226 <<
"for an object of type " <<
typeid(CaloObjType).
name() <<
" the geometry returned null for id " 228 <<
" in HLTCaloObjsInRegion, this shouldnt be possible and something has gone wrong, auto accepting " 234 float eta = objGeom->getPosition().eta();
235 float phi = objGeom->getPosition().phi();
253 template <
typename CaloObjType,
typename CaloObjCollType>
263 template <
typename CaloObjType,
typename CaloObjCollType>
266 if (
type ==
"L1EGamma") {
268 }
else if (
type ==
"L1Jet") {
270 }
else if (
type ==
"L1Muon") {
272 }
else if (
type ==
"L1Tau") {
274 }
else if (
type ==
"RecoEcalCandidate") {
276 }
else if (
type ==
"RecoChargedCandidate") {
278 }
else if (
type ==
"Electron") {
284 <<
" is not recognised, this means the rec-hit you think you are keeping may not be and you should fix this " 285 "error as it can lead to hard to find efficiency loses" 290 template <
typename CandCollType>
292 std::vector<EtaPhiRegion>&
regions)
const {
294 event.getByToken(token_,
cands);
297 if (
cand.et() >= minEt_ && (maxEt_ < 0 ||
cand.et() < maxEt_)) {
constexpr double deltaPhi(double phi1, double phi2)
std::vector< edm::EDGetTokenT< CaloObjCollType > > inputTokens_
std::vector< edm::InputTag > inputCollTags_
void getEtaPhiRegions(const edm::Event &, std::vector< EtaPhiRegion > &) const override
EtaPhiRegionDataBase * createEtaPhiRegionData(const std::string &, const edm::ParameterSet &, edm::ConsumesCollector &&)
constexpr SubDetector subDetGeom[21]
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
~HLTCaloObjInRegionsProducer() override
std::string defaultModuleLabel()
static bool validIDForGeom(const DetId &id)
Log< level::Error, false > LogError
virtual ~EtaPhiRegionDataBase()=default
bool operator()(float eta, float phi) const
static std::string const input
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< std::string > outputProductNames_
void addParameter(std::string const &name, T const &value)
Abs< T >::type abs(const T &t)
EtaPhiRegionData(const edm::ParameterSet ¶, edm::ConsumesCollector &consumesColl)
#define DEFINE_FWK_MODULE(type)
virtual void getEtaPhiRegions(const edm::Event &, std::vector< EtaPhiRegion > &) const =0
ParameterDescriptionBase * add(U const &iLabel, T const &value)
HLTCaloObjInRegionsProducer(const edm::ParameterSet &ps)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
edm::EDGetTokenT< T1 > token_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static std::unique_ptr< CaloObjCollType > makeFilteredColl(const edm::Handle< CaloObjCollType > &inputColl, CaloGeometry const &caloGeomHandle, const std::vector< EtaPhiRegion > ®ions)
EtaPhiRegion(float iEta, float iPhi, float iDR, float iDEta, float iDPhi)
std::vector< std::unique_ptr< EtaPhiRegionDataBase > > etaPhiRegionData_
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
void produce(edm::Event &, const edm::EventSetup &) override