13 #include <Math/VectorUtil.h>
37 using namespace egammaisolation;
38 using namespace reco::isodeposit;
41 etMin_(par.getParameter<double>(
"etMin")),
42 energyMin_(par.getParameter<double>(
"energyMin")),
43 extRadius_(par.getParameter<double>(
"extRadius")),
44 intRadius_(par.getParameter<double>(
"intRadius")),
45 intStrip_(par.getParameter<double>(
"intStrip")),
46 barrelEcalHitsTag_(par.getParameter<edm::InputTag>(
"barrelEcalHits")),
47 endcapEcalHitsTag_(par.getParameter<edm::InputTag>(
"endcapEcalHits")),
48 fakeNegativeDeposit_(par.getParameter<bool>(
"subtractSuperClusterEnergy")),
49 tryBoth_(par.getParameter<bool>(
"tryBoth")),
50 vetoClustered_(par.getParameter<bool>(
"vetoClustered")),
52 severityLevelCut_(par.getParameter<int>(
"severityLevelCut")),
56 v_chstatus_(par.getParameter<std::vector<int> >(
"recHitFlagsToBeExcluded")
66 throw cms::Exception(
"Configuration Error") <<
"EgammaRecHitExtractor: " <<
67 "If you use 'subtractSuperClusterEnergy', you *must* set 'intRadius' to ZERO; it does not make sense, otherwise.";
69 std::string isoVariable = par.
getParameter<std::string>(
"isolationVariable");
70 if (isoVariable ==
"et") {
72 }
else if (isoVariable ==
"energy") {
75 throw cms::Exception(
"Configuration Error") <<
"EgammaRecHitExtractor: isolationVariable '" << isoVariable <<
"' not known. "
76 <<
" Supported values are 'et', 'energy'. ";
81 edm::LogWarning(
"EgammaRecHitExtractor") <<
"If you have configured 'barrelRecHits' == 'endcapRecHits', so I'm switching 'tryBoth' to FALSE.";
106 static std::string
metname =
"EgammaIsolationAlgos|EgammaRecHitExtractor";
108 std::auto_ptr<const CaloRecHitMetaCollectionV> barrelRecHits(0), endcapRecHits(0);
122 Direction candDir(caloPosition.eta(), caloPosition.phi());
125 double sinTheta =
sin(2*atan(
exp(-sc->eta())));
126 deposit.addCandEnergy(sc->energy() * (
useEt_ ? sinTheta : 1.0)) ;
129 double fakeEnergy = -sc->rawEnergy();
131 deposit.addDeposit(candDir, fakeEnergy * (
useEt_ ? sinTheta : 1.0));
135 bool inBarrel =
sameTag_ || (
abs(sc->eta()) < 1.479 );
137 collect(deposit, sc, barrelgeom, caloGeom, *barrelEcalRecHitsH, chStatus.
product(), sevlv.
product(),
true);
140 collect(deposit, sc, endcapgeom, caloGeom, *endcapEcalRecHitsH, chStatus.
product(), sevlv.
product(),
false);
155 GlobalPoint caloPosition(sc->position().x(), sc->position().y() , sc->position().z());
158 double caloeta=caloPosition.eta();
159 double calophi=caloPosition.phi();
162 std::vector< std::pair<DetId, float> >::const_iterator rhIt;
165 for (CaloSubdetectorGeometry::DetIdSet::const_iterator
i = chosen.begin(),
end = chosen.end() ;
i !=
end; ++
i) {
169 double eta = position.
eta();
170 double phi = position.
phi();
171 double energy = j->energy();
172 double et = energy*position.
perp()/position.
mag();
179 bool isClustered =
false;
181 for(rhIt = (*bcIt)->hitsAndFractions().begin();rhIt != (*bcIt)->hitsAndFractions().end(); ++rhIt) {
182 if( rhIt->first == *
i ) isClustered =
true;
183 if( isClustered )
break;
185 if( isClustered )
break;
188 if(isClustered)
continue;
217 && (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)
EcalSeverityLevel severityLevel(const DetId &id, const EcalRecHitCollection &rhs) const
Evaluate status from id.
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
const double par[8 *NPar][4]