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>
121 : caloGeometryToken_{esConsumes()} {
122 const std::vector<edm::ParameterSet> etaPhiRegions =
123 para.getParameter<std::vector<edm::ParameterSet>>(
"etaPhiRegions");
124 for (
auto&
pset : 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>
149 std::vector<std::string> outputProductNames;
150 outputProductNames.push_back(
"EcalRegionalRecHitsEB");
151 desc.add<std::vector<std::string>>(
"outputProductNames", outputProductNames);
152 std::vector<edm::InputTag> inputColls;
154 desc.add<std::vector<edm::InputTag>>(
"inputCollTags", inputColls);
155 std::vector<edm::ParameterSet> etaPhiRegions;
165 etaPhiRegions.push_back(ecalCandPSet);
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");
175 desc.addVPSet(
"etaPhiRegions", etaPhiRegionDesc, etaPhiRegions);
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_)) {