23 : geometry_(&esData.caloGeometry),
24 topology_(&esData.caloTopology),
31 edm::LogInfo(
"subdetector geometry not available") <<
"EcalPreshower geometry is missing" << std::endl;
48 auto pESRecHits =
ev.getHandle(esRecHitsToken);
52 if (pESRecHits.isValid()) {
53 for (
auto it = pESRecHits->begin(); it != pESRecHits->end(); ++it) {
55 std::vector<int> badf = {
56 EcalRecHit::ESFlags::kESDead,
57 EcalRecHit::ESFlags::kESTwoGoodRatios,
58 EcalRecHit::ESFlags::kESBadRatioFor12,
59 EcalRecHit::ESFlags::kESBadRatioFor23Upper,
60 EcalRecHit::ESFlags::kESBadRatioFor23Lower,
61 EcalRecHit::ESFlags::kESTS1Largest,
62 EcalRecHit::ESFlags::kESTS3Largest,
63 EcalRecHit::ESFlags::kESTS3Negative,
64 EcalRecHit::ESFlags::kESTS13Sigmas,
67 if (it->checkFlags(badf))
77 if (cluster.
size() == 0) {
78 throw cms::Exception(
"InvalidCluster") <<
"The cluster has no crystals!";
88 <<
"The subdetId() " <<
id.subdetId() <<
" does not correspond to EcalBarrel neither EcalEndcap";
98 auto theSeedHit =
recHits->find(
id);
104 return (*theSeedHit).time();
109 auto clusterComponents = (cluster).hitsAndFractions();
115 float weightedTsum = 0;
116 float sumOfWeights = 0;
118 for (
auto detitr = clusterComponents.begin(); detitr != clusterComponents.end(); detitr++) {
120 auto oneHit =
recHits->find((detitr->first));
124 float lasercalib = 1.;
130 icalconst = (*icalit);
134 <<
"No intercalib const found for xtal " << (detitr->first).
rawId() <<
"bailing out";
141 else if ((detitr->first).subdetId() ==
EcalEndcap)
144 if (icalconst > 0 && lasercalib > 0 && adcToGeV > 0)
145 adc = (*oneHit).energy() / (icalconst * lasercalib * adcToGeV);
148 if ((detitr->first).subdetId() ==
EcalBarrel &&
adc < (1.1 * 20))
150 if ((detitr->first).subdetId() ==
EcalEndcap &&
adc < (2.2 * 20))
154 if (!(*oneHit).isTimeErrorValid())
157 float timeError = (*oneHit).timeError();
161 timeError =
sqrt(timeError * timeError - 0.6 * 0.6 + 0.15 * 0.15);
163 timeError =
sqrt(timeError * timeError + 0.15 * 0.15);
166 weightedTsum += (*oneHit).time() / (timeError * timeError);
167 sumOfWeights += 1. / (timeError * timeError);
171 if (sumOfWeights == 0)
174 return (weightedTsum / sumOfWeights);
184 if (!(fabs(cluster.
eta()) > 1.6 && fabs(cluster.
eta()) < 3.))
190 std::vector<float> phoESHitsIXIX =
192 std::vector<float> phoESHitsIYIY =
194 float phoESShapeIXIX =
getESShape(phoESHitsIXIX);
195 float phoESShapeIYIY =
getESShape(phoESHitsIYIY);
197 return sqrt(phoESShapeIXIX * phoESShapeIXIX + phoESShapeIYIY * phoESShapeIYIY);
202 if (!(fabs(cluster.
eta()) > 1.6 && fabs(cluster.
eta()) < 3.))
208 std::vector<float> phoESHitsIXIX =
210 float phoESShapeIXIX =
getESShape(phoESHitsIXIX);
212 return phoESShapeIXIX;
217 if (!(fabs(cluster.
eta()) > 1.6 && fabs(cluster.
eta()) < 3.))
223 std::vector<float> phoESHitsIYIY =
225 float phoESShapeIYIY =
getESShape(phoESHitsIYIY);
227 return phoESShapeIYIY;
234 const std::map<DetId, EcalRecHit> &_rechits_map,
239 std::map<DetId, EcalRecHit> rechits_map = _rechits_map;
240 std::vector<float> esHits;
249 std::map<DetId, EcalRecHit>::iterator it;
262 }
else if (row == -1) {
270 for (
int i = 0;
i < 31; ++
i)
273 it = rechits_map.find(
strip);
274 if (it != rechits_map.end() && it->second.energy() > 1.0e-10)
275 esHits.push_back(it->second.energy());
283 for (
int i = 0;
i < 15; ++
i) {
286 it = rechits_map.find(
next);
287 if (it != rechits_map.end() && it->second.energy() > 1.0e-10)
288 esHits.push_back(it->second.energy());
293 for (
int j =
i;
j < 15;
j++)
303 for (
int i = 0;
i < 15; ++
i) {
306 it = rechits_map.find(
next);
307 if (it != rechits_map.end() && it->second.energy() > 1.0e-10)
308 esHits.push_back(it->second.energy());
313 for (
int j =
i;
j < 15;
j++)
324 for (
int i = 0;
i < 15; ++
i) {
327 it = rechits_map.find(
next);
328 if (it != rechits_map.end() && it->second.energy() > 1.0e-10)
329 esHits.push_back(it->second.energy());
334 for (
int j =
i;
j < 15;
j++)
344 for (
int i = 0;
i < 15; ++
i) {
347 it = rechits_map.find(
next);
348 if (it != rechits_map.end() && it->second.energy() > 1.0e-10)
349 esHits.push_back(it->second.energy());
354 for (
int j =
i;
j < 15;
j++)
374 for (
int ibin = 0; ibin < ((nBIN + 1) / 2); ibin++) {
376 esRH[(nBIN - 1) / 2] = ESHits0[ibin];
378 esRH[(nBIN - 1) / 2 + ibin] = ESHits0[ibin];
379 esRH[(nBIN - 1) / 2 - ibin] = ESHits0[ibin + 15];
384 double EffWidthSigmaISIS = 0.;
385 double totalEnergyISIS = 0.;
386 double EffStatsISIS = 0.;
387 for (
int id_X = 0; id_X < 21; id_X++) {
388 totalEnergyISIS += esRH[id_X];
389 EffStatsISIS += esRH[id_X] * (id_X - 10) * (id_X - 10);
391 EffWidthSigmaISIS = (totalEnergyISIS > 0.) ?
sqrt(fabs(EffStatsISIS / totalEnergyISIS)) : 0.;
393 return EffWidthSigmaISIS;
void home() const
move the navigator back to the starting point
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
T north() const
move the navigator north
DetId seed() const
return DetId of seed
T south() const
move the navigator south
Log< level::Error, false > LogError
double x() const
x coordinate of cluster centroid
void setHome(const T &startingPoint)
set the starting position
double z() const
z coordinate of cluster centroid
double y() const
y coordinate of cluster centroid
size_t size() const
size in number of hits (e.g. in crystals for ECAL)
float getLaserCorrection(DetId const &xid, edm::Timestamp const &iTime) const
const_iterator find(uint32_t rawId) const
Log< level::Info, false > LogInfo
T east() const
move the navigator east
const CaloClusterPtr & seed() const
seed BasicCluster
const self & getMap() const
const_iterator end() const
T west() const
move the navigator west
double eta() const
pseudorapidity of cluster centroid
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
*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
uint16_t *__restrict__ uint16_t const *__restrict__ adc
float EcalIntercalibConstant