13 #include <Math/VectorUtil.h>
35 using namespace egammaisolation;
36 using namespace reco::isodeposit;
39 etMin_(par.getParameter<double>(
"etMin")),
40 energyMin_(par.getParameter<double>(
"energyMin")),
41 extRadius_(par.getParameter<double>(
"extRadius")),
42 intRadius_(par.getParameter<double>(
"intRadius")),
43 intStrip_(par.getParameter<double>(
"intStrip")),
44 barrelEcalHitsTag_(par.getParameter<edm::InputTag>(
"barrelEcalHits")),
45 endcapEcalHitsTag_(par.getParameter<edm::InputTag>(
"endcapEcalHits")),
46 fakeNegativeDeposit_(par.getParameter<bool>(
"subtractSuperClusterEnergy")),
47 tryBoth_(par.getParameter<bool>(
"tryBoth")),
48 vetoClustered_(par.getParameter<bool>(
"vetoClustered")),
50 severityLevelCut_(par.getParameter<int>(
"severityLevelCut")),
51 severityRecHitThreshold_(par.getParameter<double>(
"severityRecHitThreshold")),
52 spIdString_(par.getParameter<std::string>(
"spikeIdString")),
53 spIdThreshold_(par.getParameter<double>(
"spikeIdThreshold")),
54 v_chstatus_(par.getParameter<std::vector<int> >(
"recHitFlagsToBeExcluded"))
63 throw cms::Exception(
"Configuration Error") <<
"EgammaRecHitExtractor: " <<
64 "If you use 'subtractSuperClusterEnergy', you *must* set 'intRadius' to ZERO; it does not make sense, otherwise.";
66 std::string isoVariable = par.
getParameter<std::string>(
"isolationVariable");
67 if (isoVariable ==
"et") {
69 }
else if (isoVariable ==
"energy") {
72 throw cms::Exception(
"Configuration Error") <<
"EgammaRecHitExtractor: isolationVariable '" << isoVariable <<
"' not known. "
73 <<
" Supported values are 'et', 'energy'. ";
78 edm::LogWarning(
"EgammaRecHitExtractor") <<
"If you have configured 'barrelRecHits' == 'endcapRecHits', so I'm switching 'tryBoth' to FALSE.";
100 static std::string
metname =
"EgammaIsolationAlgos|EgammaRecHitExtractor";
102 std::auto_ptr<const CaloRecHitMetaCollectionV> barrelRecHits(0), endcapRecHits(0);
117 Direction candDir(caloPosition.eta(), caloPosition.phi());
120 double sinTheta =
sin(2*atan(
exp(-sc->eta())));
121 deposit.addCandEnergy(sc->energy() * (
useEt_ ? sinTheta : 1.0)) ;
124 double fakeEnergy = -sc->rawEnergy();
126 deposit.addDeposit(candDir, fakeEnergy * (
useEt_ ? sinTheta : 1.0));
130 bool inBarrel =
sameTag_ || (
abs(sc->eta()) < 1.479 );
132 collect(deposit, sc, barrelgeom, caloGeom, *barrelEcalRecHitsH, chStatus.
product(),
true);
135 collect(deposit, sc, endcapgeom, caloGeom, *endcapEcalRecHitsH, chStatus.
product(),
false);
149 GlobalPoint caloPosition(sc->position().x(), sc->position().y() , sc->position().z());
152 double caloeta=caloPosition.eta();
153 double calophi=caloPosition.phi();
156 std::vector< std::pair<DetId, float> >::const_iterator rhIt;
159 for (CaloSubdetectorGeometry::DetIdSet::const_iterator
i = chosen.begin(),
end = chosen.end() ;
i !=
end; ++
i) {
163 double eta = position.
eta();
164 double phi = position.
phi();
165 double energy = j->energy();
166 double et = energy*position.
perp()/position.
mag();
173 bool isClustered =
false;
175 for(rhIt = (*bcIt)->hitsAndFractions().begin();rhIt != (*bcIt)->hitsAndFractions().end(); ++rhIt) {
176 if( rhIt->first == *
i ) isClustered =
true;
177 if( isClustered )
break;
179 if( isClustered )
break;
182 if(isClustered)
continue;
206 && (eta-caloeta)*(eta-caloeta) + phiDiff*phiDiff >r2 ) {
T getParameter(std::string const &) const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
std::set< DetId > DetIdSet
const std::string metname
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
std::vector< T >::const_iterator const_iterator
Exp< T >::type exp(const T &t)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
static int position[TOTALCHAMBERS][3]
void addDeposit(double dr, double deposit)
Add deposit (ie. transverse energy or pT)
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
const_iterator end() const
double deltaPhi(double phi1, double phi2)
XYZPointD XYZPoint
point in space with cartesian internal representation
T const * product() const
iterator find(key_type k)
T get() const
get a component
static int severityLevel(const DetId, const EcalRecHitCollection &, const EcalChannelStatus &, float recHitEtThreshold=5., SpikeId spId=kSwissCross, float spIdThreshold=0.95, float recHitEnergyThresholdForTiming=2., float recHitEnergyThresholdForEE=15, float spIdThresholdIEta85=0.999)
const double par[8 *NPar][4]