31 ebRecHits_(&
edm::
get(ev, token1)),
32 eeRecHits_(&
edm::
get(ev, token2)) {
51 edm::LogInfo(
"subdetector geometry not available") <<
"EcalPreshower geometry is missing" << std::endl;
70 for (it = pESRecHits->
begin(); it != pESRecHits->
end(); ++it) {
72 std::vector<int> badf = {
73 EcalRecHit::ESFlags::kESDead,
74 EcalRecHit::ESFlags::kESTwoGoodRatios,
75 EcalRecHit::ESFlags::kESBadRatioFor12,
76 EcalRecHit::ESFlags::kESBadRatioFor23Upper,
77 EcalRecHit::ESFlags::kESBadRatioFor23Lower,
78 EcalRecHit::ESFlags::kESTS1Largest,
79 EcalRecHit::ESFlags::kESTS3Largest,
80 EcalRecHit::ESFlags::kESTS3Negative,
81 EcalRecHit::ESFlags::kESTS13Sigmas,
84 if (it->checkFlags(badf))
110 if (cluster.size() == 0) {
111 throw cms::Exception(
"InvalidCluster") <<
"The cluster has no crystals!";
113 DetId id = (cluster.hitsAndFractions()[0]).
first;
121 <<
"The subdetId() " <<
id.subdetId() <<
" does not correspond to EcalBarrel neither EcalEndcap";
130 DetId id = cluster.seed();
137 return (*theSeedHit).time();
142 std::vector<std::pair<DetId, float> > clusterComponents = (cluster).hitsAndFractions();
148 float weightedTsum = 0;
149 float sumOfWeights = 0;
151 for (std::vector<std::pair<DetId, float> >::const_iterator detitr = clusterComponents.begin();
152 detitr != clusterComponents.end();
159 float lasercalib = 1.;
165 icalconst = (*icalit);
169 <<
"No intercalib const found for xtal " << (detitr->first).rawId() <<
"bailing out";
176 else if ((detitr->first).subdetId() ==
EcalEndcap)
179 if (icalconst > 0 && lasercalib > 0 && adcToGeV > 0)
180 adc = (*oneHit).energy() / (icalconst * lasercalib * adcToGeV);
183 if ((detitr->first).subdetId() ==
EcalBarrel && adc < (1.1 * 20))
185 if ((detitr->first).subdetId() ==
EcalEndcap && adc < (2.2 * 20))
189 if (!(*oneHit).isTimeErrorValid())
192 float timeError = (*oneHit).timeError();
196 timeError =
sqrt(timeError * timeError - 0.6 * 0.6 + 0.15 * 0.15);
198 timeError =
sqrt(timeError * timeError + 0.15 * 0.15);
201 weightedTsum += (*oneHit).time() / (timeError * timeError);
202 sumOfWeights += 1. / (timeError * timeError);
206 if (sumOfWeights == 0)
209 return (weightedTsum / sumOfWeights);
224 if (!(fabs(cluster.
eta()) > 1.6 && fabs(cluster.
eta()) < 3.))
230 std::vector<float> phoESHitsIXIX =
232 std::vector<float> phoESHitsIYIY =
234 float phoESShapeIXIX =
getESShape(phoESHitsIXIX);
235 float phoESShapeIYIY =
getESShape(phoESHitsIYIY);
237 return sqrt(phoESShapeIXIX * phoESShapeIXIX + phoESShapeIYIY * phoESShapeIYIY);
242 if (!(fabs(cluster.
eta()) > 1.6 && fabs(cluster.
eta()) < 3.))
248 std::vector<float> phoESHitsIXIX =
250 float phoESShapeIXIX =
getESShape(phoESHitsIXIX);
252 return phoESShapeIXIX;
257 if (!(fabs(cluster.
eta()) > 1.6 && fabs(cluster.
eta()) < 3.))
263 std::vector<float> phoESHitsIYIY =
265 float phoESShapeIYIY =
getESShape(phoESHitsIYIY);
267 return phoESShapeIYIY;
274 const std::map<DetId, EcalRecHit> &_rechits_map,
279 std::map<DetId, EcalRecHit> rechits_map = _rechits_map;
280 std::vector<float> esHits;
289 std::map<DetId, EcalRecHit>::iterator it;
298 if (plane == 1 && strip !=
ESDetId(0))
299 strip = theESNav.
north();
300 if (plane == 2 && strip !=
ESDetId(0))
301 strip = theESNav.
east();
302 }
else if (row == -1) {
303 if (plane == 1 && strip !=
ESDetId(0))
304 strip = theESNav.
south();
305 if (plane == 2 && strip !=
ESDetId(0))
306 strip = theESNav.
west();
310 for (
int i = 0;
i < 31; ++
i)
313 it = rechits_map.find(strip);
314 if (it != rechits_map.end() && it->second.energy() > 1.0e-10)
315 esHits.push_back(it->second.energy());
323 for (
int i = 0;
i < 15; ++
i) {
324 next = theESNav.
east();
326 it = rechits_map.find(next);
327 if (it != rechits_map.end() && it->second.energy() > 1.0e-10)
328 esHits.push_back(it->second.energy());
333 for (
int j =
i;
j < 15;
j++)
343 for (
int i = 0;
i < 15; ++
i) {
344 next = theESNav.
west();
346 it = rechits_map.find(next);
347 if (it != rechits_map.end() && it->second.energy() > 1.0e-10)
348 esHits.push_back(it->second.energy());
353 for (
int j =
i;
j < 15;
j++)
364 for (
int i = 0;
i < 15; ++
i) {
365 next = theESNav.
north();
367 it = rechits_map.find(next);
368 if (it != rechits_map.end() && it->second.energy() > 1.0e-10)
369 esHits.push_back(it->second.energy());
374 for (
int j =
i;
j < 15;
j++)
384 for (
int i = 0;
i < 15; ++
i) {
385 next = theESNav.
south();
387 it = rechits_map.find(next);
388 if (it != rechits_map.end() && it->second.energy() > 1.0e-10)
389 esHits.push_back(it->second.energy());
394 for (
int j =
i;
j < 15;
j++)
414 for (
int ibin = 0; ibin < ((nBIN + 1) / 2); ibin++) {
416 esRH[(nBIN - 1) / 2] = ESHits0[ibin];
418 esRH[(nBIN - 1) / 2 + ibin] = ESHits0[ibin];
419 esRH[(nBIN - 1) / 2 - ibin] = ESHits0[ibin + 15];
424 double EffWidthSigmaISIS = 0.;
425 double totalEnergyISIS = 0.;
426 double EffStatsISIS = 0.;
427 for (
int id_X = 0; id_X < 21; id_X++) {
428 totalEnergyISIS += esRH[id_X];
429 EffStatsISIS += esRH[id_X] * (id_X - 10) * (id_X - 10);
431 EffWidthSigmaISIS = (totalEnergyISIS > 0.) ?
sqrt(fabs(EffStatsISIS / totalEnergyISIS)) : 0.;
433 return EffWidthSigmaISIS;
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
bool getByToken(EDGetToken token, Handle< PROD > &result) const
float getLaserCorrection(DetId const &xid, edm::Timestamp const &iTime) const
std::vector< EcalRecHit >::const_iterator const_iterator
double z() const
z coordinate of cluster centroid
double eta() const
pseudorapidity of cluster centroid
void setHome(const T &startingPoint)
set the starting position
T west() const
move the navigator west
double x() const
x coordinate of cluster centroid
T south() const
move the navigator south
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
const_iterator end() const
T east() const
move the navigator east
void home() const
move the navigator back to the starting point
T const * product() const
std::vector< Item >::const_iterator const_iterator
iterator find(key_type k)
const_iterator find(uint32_t rawId) const
T north() const
move the navigator north
const_iterator end() const
const CaloClusterPtr & seed() const
seed BasicCluster
double y() const
y coordinate of cluster centroid
edm::Timestamp time() const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
const_iterator begin() const
float EcalIntercalibConstant