28 , ebRecHits_(&
edm::
get(ev, token1))
29 , eeRecHits_(&
edm::
get(ev, token2))
46 edm::LogInfo(
"subdetector geometry not available") <<
"EcalPreshower geometry is missing" << std::endl;
65 for (it = pESRecHits->
begin(); it != pESRecHits->
end(); ++it) {
67 std::vector<int> badf = {
68 EcalRecHit::ESFlags::kESDead,
69 EcalRecHit::ESFlags::kESTwoGoodRatios,
70 EcalRecHit::ESFlags::kESBadRatioFor12,
71 EcalRecHit::ESFlags::kESBadRatioFor23Upper,
72 EcalRecHit::ESFlags::kESBadRatioFor23Lower,
73 EcalRecHit::ESFlags::kESTS1Largest,
74 EcalRecHit::ESFlags::kESTS3Largest,
75 EcalRecHit::ESFlags::kESTS3Negative,
76 EcalRecHit::ESFlags::kESTS13Sigmas,
79 if (it->checkFlags(badf))
continue;
114 if ( cluster.size() == 0 ) {
115 throw cms::Exception(
"InvalidCluster") <<
"The cluster has no crystals!";
117 DetId id = (cluster.hitsAndFractions()[0]).
first;
124 throw cms::Exception(
"InvalidSubdetector") <<
"The subdetId() " <<
id.subdetId() <<
" does not correspond to EcalBarrel neither EcalEndcap";
136 DetId id = cluster.seed();
143 return (*theSeedHit).time();
151 std::vector<std::pair<DetId, float> > clusterComponents = (cluster).hitsAndFractions() ;
158 float weightedTsum = 0;
159 float sumOfWeights = 0;
161 for (std::vector<std::pair<DetId, float> >::const_iterator detitr = clusterComponents.begin(); detitr != clusterComponents.end(); detitr++ )
168 float lasercalib = 1.;
174 icalconst = (*icalit);
177 edm::LogError(
"EcalClusterLazyTools") <<
"No intercalib const found for xtal " << (detitr->first).rawId() <<
"bailing out";
185 if (icalconst>0 && lasercalib>0 && adcToGeV>0) adc= (*oneHit).energy()/(icalconst*lasercalib*adcToGeV);
188 if( (detitr ->
first).subdetId() ==
EcalBarrel && adc< (1.1*20) )
continue;
189 if( (detitr ->
first).subdetId() ==
EcalEndcap && adc< (2.2*20) )
continue;
192 if(! (*oneHit).isTimeErrorValid())
continue;
194 float timeError = (*oneHit).timeError();
197 if (timeError>0.6) timeError =
sqrt( timeError*timeError - 0.6*0.6 + 0.15*0.15);
198 else timeError =
sqrt( timeError*timeError + 0.15*0.15);
201 weightedTsum += (*oneHit).time() / (timeError*timeError);
202 sumOfWeights += 1. / (timeError*timeError);
207 if ( sumOfWeights ==0 )
return -999;
208 else return ( weightedTsum / sumOfWeights);
232 if (!(fabs(cluster.
eta()) > 1.6 && fabs(cluster.
eta()) < 3.))
return 0.;
238 float phoESShapeIXIX =
getESShape(phoESHitsIXIX);
239 float phoESShapeIYIY =
getESShape(phoESHitsIYIY);
241 return sqrt(phoESShapeIXIX*phoESShapeIXIX + phoESShapeIYIY*phoESShapeIYIY);
247 if (!(fabs(cluster.
eta()) > 1.6 && fabs(cluster.
eta()) < 3.))
return 0.;
252 float phoESShapeIXIX =
getESShape(phoESHitsIXIX);
254 return phoESShapeIXIX;
260 if (!(fabs(cluster.
eta()) > 1.6 && fabs(cluster.
eta()) < 3.))
return 0.;
265 float phoESShapeIYIY =
getESShape(phoESHitsIYIY);
267 return phoESShapeIYIY;
273 std::map<DetId, EcalRecHit> rechits_map = _rechits_map;
274 std::vector<float> esHits;
283 std::map<DetId, EcalRecHit>::iterator it;
292 if (plane==1 && strip !=
ESDetId(0)) strip = theESNav.
north();
293 if (plane==2 && strip !=
ESDetId(0)) strip = theESNav.
east();
294 }
else if (row == -1) {
295 if (plane==1 && strip !=
ESDetId(0)) strip = theESNav.
south();
296 if (plane==2 && strip !=
ESDetId(0)) strip = theESNav.
west();
301 for (
int i=0;
i<31; ++
i) esHits.push_back(0);
303 it = rechits_map.find(strip);
304 if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
305 else esHits.push_back(0);
311 for (
int i=0;
i<15; ++
i) {
312 next = theESNav.
east();
314 it = rechits_map.find(next);
315 if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
316 else esHits.push_back(0);
319 for (
int j=
i; j<15; j++) esHits.push_back(0);
328 for (
int i=0;
i<15; ++
i) {
329 next = theESNav.
west();
331 it = rechits_map.find(next);
332 if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
333 else esHits.push_back(0);
336 for (
int j=
i; j<15; j++) esHits.push_back(0);
346 for (
int i=0;
i<15; ++
i) {
347 next = theESNav.
north();
349 it = rechits_map.find(next);
350 if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
351 else esHits.push_back(0);
354 for (
int j=
i; j<15; j++) esHits.push_back(0);
363 for (
int i=0;
i<15; ++
i) {
364 next = theESNav.
south();
366 it = rechits_map.find(next);
367 if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
368 else esHits.push_back(0);
371 for (
int j=
i; j<15; j++) esHits.push_back(0);
392 for(
int ibin=0; ibin<((nBIN+1)/2); ibin++) {
394 esRH[(nBIN-1)/2] = ESHits0[ibin];
396 esRH[(nBIN-1)/2+ibin] = ESHits0[ibin];
397 esRH[(nBIN-1)/2-ibin] = ESHits0[ibin+15];
402 double EffWidthSigmaISIS = 0.;
403 double totalEnergyISIS = 0.;
404 double EffStatsISIS = 0.;
405 for (
int id_X=0; id_X<21; id_X++) {
406 totalEnergyISIS += esRH[id_X];
407 EffStatsISIS += esRH[id_X]*(id_X-10)*(id_X-10);
409 EffWidthSigmaISIS = (totalEnergyISIS>0.) ?
sqrt(fabs(EffStatsISIS / totalEnergyISIS)) : 0.;
411 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
T get(const Candidate &c)
*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