36 #include <Math/VectorUtil.h>
41 namespace egammaisolation {
54 <<
"This extractor " << (
typeid(
this).
name()) <<
" is not made for tracks";
104 using namespace egammaisolation;
105 using namespace reco::isodeposit;
108 : etMin_(par.getParameter<double>(
"etMin")),
109 energyMin_(par.getParameter<double>(
"energyMin")),
110 extRadius_(par.getParameter<double>(
"extRadius")),
111 intRadius_(par.getParameter<double>(
"intRadius")),
112 intStrip_(par.getParameter<double>(
"intStrip")),
113 barrelEcalHitsTag_(par.getParameter<edm::
InputTag>(
"barrelEcalHits")),
114 endcapEcalHitsTag_(par.getParameter<edm::
InputTag>(
"endcapEcalHits")),
119 fakeNegativeDeposit_(par.getParameter<bool>(
"subtractSuperClusterEnergy")),
120 tryBoth_(par.getParameter<bool>(
"tryBoth")),
121 vetoClustered_(par.getParameter<bool>(
"vetoClustered")),
128 const std::vector<std::string> flagnamesEB = par.
getParameter<std::vector<std::string> >(
"RecHitFlagToBeExcludedEB");
130 const std::vector<std::string> flagnamesEE = par.
getParameter<std::vector<std::string> >(
"RecHitFlagToBeExcludedEE");
132 flagsexclEB_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
134 flagsexclEE_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
136 const std::vector<std::string> severitynamesEB =
137 par.
getParameter<std::vector<std::string> >(
"RecHitSeverityToBeExcludedEB");
139 severitiesexclEB_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB);
141 const std::vector<std::string> severitynamesEE =
142 par.
getParameter<std::vector<std::string> >(
"RecHitSeverityToBeExcludedEE");
144 severitiesexclEE_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE);
147 throw cms::Exception(
"Configuration Error") <<
"EgammaRecHitExtractor: "
148 <<
"If you use 'subtractSuperClusterEnergy', you *must* set "
149 "'intRadius' to ZERO; it does not make sense, otherwise.";
152 if (isoVariable ==
"et") {
154 }
else if (isoVariable ==
"energy") {
158 <<
"EgammaRecHitExtractor: isolationVariable '" << isoVariable <<
"' not known. "
159 <<
" Supported values are 'et', 'energy'. ";
165 <<
"If you have configured 'barrelRecHits' == 'endcapRecHits', so I'm switching 'tryBoth' to FALSE.";
192 Direction candDir(caloPosition.eta(), caloPosition.phi());
195 double sinTheta =
sin(2 * atan(
exp(-sc->eta())));
196 deposit.addCandEnergy(sc->energy() * (
useEt_ ? sinTheta : 1.0));
199 double fakeEnergy = -sc->rawEnergy();
201 deposit.addDeposit(candDir, fakeEnergy * (
useEt_ ? sinTheta : 1.0));
205 bool inBarrel =
sameTag_ || (
abs(sc->eta()) < 1.479);
225 GlobalPoint caloPosition(sc->position().x(), sc->position().y(), sc->position().z());
228 double caloeta = caloPosition.eta();
229 double calophi = caloPosition.phi();
232 std::vector<std::pair<DetId, float> >::const_iterator rhIt;
234 for (CaloSubdetectorGeometry::DetIdSet::const_iterator
i = chosen.begin(),
end = chosen.end();
i !=
end; ++
i) {
236 if (j != hits.
end()) {
238 double eta = position.
eta();
239 double phi = position.
phi();
240 double energy = j->energy();
241 double et = energy * position.
perp() / position.
mag();
247 bool isClustered =
false;
248 for (
auto bcIt = sc->clustersBegin(); bcIt != sc->clustersEnd(); ++bcIt) {
249 for (rhIt = (*bcIt)->hitsAndFractions().begin(); rhIt != (*bcIt)->hitsAndFractions().end(); ++rhIt) {
250 if (rhIt->first == *
i)
263 std::vector<int>::const_iterator sit;
264 int severityFlag = sevLevel->
severityLevel(j->detid(), hits);
292 && fabs(eta - caloeta) >
intStrip_ && (eta - caloeta) * (eta - caloeta) + phiDiff * phiDiff >
r2) {
constexpr double deltaPhi(double phi1, double phi2)
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
std::set< DetId > DetIdSet
const edm::EventSetup & c
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
const std::string metname
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
std::vector< Track > TrackCollection
collection of Tracks
std::vector< EcalRecHit >::const_iterator const_iterator
auto const & tracks
cannot be loose
Exp< T >::type exp(const T &t)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void addDeposit(double dr, double deposit)
Add deposit (ie. transverse energy or pT)
bool getData(T &iHolder) const
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Abs< T >::type abs(const T &t)
bool get(ProductID const &oid, Handle< PROD > &result) const
const_iterator end() const
XYZPointD XYZPoint
point in space with cartesian internal representation
T getParameter(std::string const &) const
iterator find(key_type k)
static int position[264][3]
T get() const
get a component
#define DEFINE_EDM_PLUGIN(factory, type, name)
Log< level::Warning, false > LogWarning