13 #include <Math/VectorUtil.h>
39 using namespace egammaisolation;
40 using namespace reco::isodeposit;
43 etMin_(par.getParameter<double>(
"etMin")),
44 energyMin_(par.getParameter<double>(
"energyMin")),
45 extRadius_(par.getParameter<double>(
"extRadius")),
46 intRadius_(par.getParameter<double>(
"intRadius")),
47 intStrip_(par.getParameter<double>(
"intStrip")),
48 barrelEcalHitsTag_(par.getParameter<edm::InputTag>(
"barrelEcalHits")),
49 endcapEcalHitsTag_(par.getParameter<edm::InputTag>(
"endcapEcalHits")),
52 fakeNegativeDeposit_(par.getParameter<bool>(
"subtractSuperClusterEnergy")),
53 tryBoth_(par.getParameter<bool>(
"tryBoth")),
54 vetoClustered_(par.getParameter<bool>(
"vetoClustered")),
62 const std::vector<std::string> flagnamesEB =
63 par.
getParameter<std::vector<std::string> >(
"RecHitFlagToBeExcludedEB");
65 const std::vector<std::string> flagnamesEE =
66 par.
getParameter<std::vector<std::string> >(
"RecHitFlagToBeExcludedEE");
69 StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
72 StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
74 const std::vector<std::string> severitynamesEB =
75 par.
getParameter<std::vector<std::string> >(
"RecHitSeverityToBeExcludedEB");
78 StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB);
80 const std::vector<std::string> severitynamesEE =
81 par.
getParameter<std::vector<std::string> >(
"RecHitSeverityToBeExcludedEE");
84 StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE);
87 throw cms::Exception(
"Configuration Error") <<
"EgammaRecHitExtractor: " <<
88 "If you use 'subtractSuperClusterEnergy', you *must* set 'intRadius' to ZERO; it does not make sense, otherwise.";
91 if (isoVariable ==
"et") {
93 }
else if (isoVariable ==
"energy") {
96 throw cms::Exception(
"Configuration Error") <<
"EgammaRecHitExtractor: isolationVariable '" << isoVariable <<
"' not known. "
97 <<
" Supported values are 'et', 'energy'. ";
102 edm::LogWarning(
"EgammaRecHitExtractor") <<
"If you have configured 'barrelRecHits' == 'endcapRecHits', so I'm switching 'tryBoth' to FALSE.";
130 std::auto_ptr<const CaloRecHitMetaCollectionV> barrelRecHits(0), endcapRecHits(0);
144 Direction candDir(caloPosition.eta(), caloPosition.phi());
147 double sinTheta =
sin(2*atan(
exp(-sc->eta())));
148 deposit.addCandEnergy(sc->energy() * (
useEt_ ? sinTheta : 1.0)) ;
151 double fakeEnergy = -sc->rawEnergy();
153 deposit.addDeposit(candDir, fakeEnergy * (
useEt_ ? sinTheta : 1.0));
157 bool inBarrel =
sameTag_ || (
abs(sc->eta()) < 1.479 );
159 collect(deposit, sc, barrelgeom, caloGeom, *barrelEcalRecHitsH, sevLevel,
true);
163 collect(deposit, sc, endcapgeom, caloGeom, *endcapEcalRecHitsH, sevLevel,
false);
177 GlobalPoint caloPosition(sc->position().x(), sc->position().y() , sc->position().z());
180 double caloeta=caloPosition.eta();
181 double calophi=caloPosition.phi();
184 std::vector< std::pair<DetId, float> >::const_iterator rhIt;
187 for (CaloSubdetectorGeometry::DetIdSet::const_iterator
i = chosen.begin(),
end = chosen.end() ;
i !=
end; ++
i) {
189 if (j != hits.
end()) {
191 double eta = position.
eta();
192 double phi = position.
phi();
193 double energy = j->energy();
194 double et = energy*position.
perp()/position.
mag();
201 bool isClustered =
false;
203 for(rhIt = (*bcIt)->hitsAndFractions().begin();rhIt != (*bcIt)->hitsAndFractions().end(); ++rhIt) {
204 if( rhIt->first == *
i ) isClustered =
true;
205 if( isClustered )
break;
207 if( isClustered )
break;
210 if(isClustered)
continue;
213 std::vector<int>::const_iterator sit;
214 int severityFlag = sevLevel->
severityLevel(j->detid(), hits);
225 std::vector<int>::const_iterator vit;
251 && (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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const std::string metname
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
std::vector< EcalRecHit >::const_iterator const_iterator
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.
Abs< T >::type abs(const T &t)
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
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
volatile std::atomic< bool > shutdown_flag false
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id, const EcalRecHitCollection &rhs) const
Evaluate status from id.