72 energyCut_(
iConfig.getParameter<
double>(
"energyCut")),
73 etCut_(
iConfig.getParameter<
double>(
"etCut")),
74 etCandCut_(
iConfig.getParameter<
double>(
"etCandCut")),
75 outerRadius_(
iConfig.getParameter<
double>(
"outerRadius")),
76 innerRadius_(
iConfig.getParameter<
double>(
"innerRadius")),
77 interestingDetIdCollection_(
iConfig.getParameter<
std::string>(
"interestingDetIdCollection")) {
78 auto const& flagnamesEB =
iConfig.getParameter<std::vector<std::string>>(
"RecHitFlagToBeExcludedEB");
79 auto const& flagnamesEE =
iConfig.getParameter<std::vector<std::string>>(
"RecHitFlagToBeExcludedEE");
81 flagsexclEB_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
82 flagsexclEE_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
84 auto const& severitynamesEB =
iConfig.getParameter<std::vector<std::string>>(
"RecHitSeverityToBeExcludedEB");
86 severitiesexclEB_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB);
88 auto const& severitynamesEE =
iConfig.getParameter<std::vector<std::string>>(
"RecHitSeverityToBeExcludedEE");
90 severitiesexclEE_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE);
93 produces<DetIdCollection>(interestingDetIdCollection_);
104 auto const& emObjects = iEvent.
get(emObjectToken_);
105 auto const& ecalRecHits = iEvent.
get(recHitsToken_);
113 std::unique_ptr<CaloDualConeSelector<EcalRecHit>> doubleConeSel_ =
nullptr;
114 if (recHitsLabel_.instance() ==
"EcalRecHitsEB") {
116 std::make_unique<CaloDualConeSelector<EcalRecHit>>(innerRadius_, outerRadius_, &*pG,
DetId::Ecal,
EcalBarrel);
117 }
else if (recHitsLabel_.instance() ==
"EcalRecHitsEE") {
119 std::make_unique<CaloDualConeSelector<EcalRecHit>>(innerRadius_, outerRadius_, &*pG,
DetId::Ecal,
EcalEndcap);
123 auto detIdCollection = std::make_unique<DetIdCollection>();
125 if (doubleConeSel_) {
126 for (
auto const& emObj : emObjects) {
128 if (emObj.et() < etCandCut_)
131 GlobalPoint pclu(emObj.caloPosition().x(), emObj.caloPosition().y(), emObj.caloPosition().z());
132 doubleConeSel_->selectCallback(pclu, ecalRecHits, [&](
const EcalRecHit& recIt) {
133 if (recIt.
energy() < energyCut_)
143 if (fabs(caloGeom->getPosition(recIt.
detid()).
eta() < 1.479))
146 int severityFlag = sevLevel->severityLevel(recIt.
detid(), ecalRecHits);
148 auto sit =
std::find(severitiesexclEB_.begin(), severitiesexclEB_.end(), severityFlag);
149 if (sit != severitiesexclEB_.end())
152 auto sit =
std::find(severitiesexclEE_.begin(), severitiesexclEE_.end(), severityFlag);
153 if (sit != severitiesexclEE_.end())
173 if (
std::find(detIdCollection->begin(), detIdCollection->end(), recIt.
detid()) == detIdCollection->end())
174 detIdCollection->push_back(recIt.
detid());
181 iEvent.
put(
std::move(detIdCollection), interestingDetIdCollection_);
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool checkFlags(const std::vector< int > &flagsvec) const
check if one of the flags in a set is true
edm::EDGetTokenT< EcalRecHitCollection > recHitsToken_
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
#define DEFINE_FWK_MODULE(type)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
producer
std::vector< int > flagsexclEB_
const DetId & detid() const
edm::InputTag recHitsLabel_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > sevLvToken_
std::string interestingDetIdCollection_
bool checkFlag(int flag) const
check if the flag is true
EgammaIsoDetIdCollectionProducer(const edm::ParameterSet &)
ctor
bool get(ProductID const &oid, Handle< PROD > &result) const
std::vector< int > flagsexclEE_
std::vector< T1 > T1Collection
std::vector< int > severitiesexclEE_
T getParameter(std::string const &) const
std::vector< int > severitiesexclEB_
edm::InputTag emObjectLabel_
T perp() const
Magnitude of transverse component.
edm::EDGetTokenT< T1Collection > emObjectToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const