69 edm::LogInfo(
"subdetector geometry not available") <<
"EcalPreshower geometry is missing" << std::endl;
103 for (it = pESRecHits->
begin(); it != pESRecHits->
end(); ++it) {
105 std::vector<int> badf = {
106 EcalRecHit::ESFlags::kESDead,
107 EcalRecHit::ESFlags::kESTwoGoodRatios,
108 EcalRecHit::ESFlags::kESBadRatioFor12,
109 EcalRecHit::ESFlags::kESBadRatioFor23Upper,
110 EcalRecHit::ESFlags::kESBadRatioFor23Lower,
111 EcalRecHit::ESFlags::kESTS1Largest,
112 EcalRecHit::ESFlags::kESTS3Largest,
113 EcalRecHit::ESFlags::kESTS3Negative,
114 EcalRecHit::ESFlags::kESTS13Sigmas,
117 if (it->checkFlags(badf))
continue;
152 if ( cluster.size() == 0 ) {
153 throw cms::Exception(
"InvalidCluster") <<
"The cluster has no crystals!";
155 DetId id = (cluster.hitsAndFractions()[0]).
first;
162 throw cms::Exception(
"InvalidSubdetector") <<
"The subdetId() " <<
id.subdetId() <<
" does not correspond to EcalBarrel neither EcalEndcap";
174 DetId id = cluster.seed();
181 return (*theSeedHit).time();
189 std::vector<std::pair<DetId, float> > clusterComponents = (cluster).hitsAndFractions() ;
196 float weightedTsum = 0;
197 float sumOfWeights = 0;
199 for (std::vector<std::pair<DetId, float> >::const_iterator detitr = clusterComponents.begin(); detitr != clusterComponents.end(); detitr++ )
206 float lasercalib = 1.;
212 icalconst = (*icalit);
215 edm::LogError(
"EcalClusterLazyTools") <<
"No intercalib const found for xtal " << (detitr->first).rawId() <<
"bailing out";
223 if (icalconst>0 && lasercalib>0 && adcToGeV>0) adc= (*oneHit).energy()/(icalconst*lasercalib*adcToGeV);
226 if( (detitr ->
first).subdetId() ==
EcalBarrel && adc< (1.1*20) )
continue;
227 if( (detitr ->
first).subdetId() ==
EcalEndcap && adc< (2.2*20) )
continue;
230 if(! (*oneHit).isTimeErrorValid())
continue;
232 float timeError = (*oneHit).timeError();
235 if (timeError>0.6) timeError =
sqrt( timeError*timeError - 0.6*0.6 + 0.15*0.15);
236 else timeError =
sqrt( timeError*timeError + 0.15*0.15);
239 weightedTsum += (*oneHit).time() / (timeError*timeError);
240 sumOfWeights += 1. / (timeError*timeError);
245 if ( sumOfWeights ==0 )
return -999;
246 else return ( weightedTsum / sumOfWeights);
270 if (!(fabs(cluster.
eta()) > 1.6 && fabs(cluster.
eta()) < 3.))
return 0.;
276 float phoESShapeIXIX =
getESShape(phoESHitsIXIX);
277 float phoESShapeIYIY =
getESShape(phoESHitsIYIY);
279 return sqrt(phoESShapeIXIX*phoESShapeIXIX + phoESShapeIYIY*phoESShapeIYIY);
285 if (!(fabs(cluster.
eta()) > 1.6 && fabs(cluster.
eta()) < 3.))
return 0.;
290 float phoESShapeIXIX =
getESShape(phoESHitsIXIX);
292 return phoESShapeIXIX;
298 if (!(fabs(cluster.
eta()) > 1.6 && fabs(cluster.
eta()) < 3.))
return 0.;
303 float phoESShapeIYIY =
getESShape(phoESHitsIYIY);
305 return phoESShapeIYIY;
311 std::map<DetId, EcalRecHit> rechits_map = _rechits_map;
312 std::vector<float> esHits;
322 std::map<DetId, EcalRecHit>::iterator it;
331 if (plane==1 && strip !=
ESDetId(0)) strip = theESNav.
north();
332 if (plane==2 && strip !=
ESDetId(0)) strip = theESNav.
east();
333 }
else if (row == -1) {
334 if (plane==1 && strip !=
ESDetId(0)) strip = theESNav.
south();
335 if (plane==2 && strip !=
ESDetId(0)) strip = theESNav.
west();
340 for (
int i=0;
i<31; ++
i) esHits.push_back(0);
342 it = rechits_map.find(strip);
343 if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
344 else esHits.push_back(0);
350 for (
int i=0;
i<15; ++
i) {
351 next = theESNav.
east();
353 it = rechits_map.find(next);
354 if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
355 else esHits.push_back(0);
358 for (
int j=
i; j<15; j++) esHits.push_back(0);
367 for (
int i=0;
i<15; ++
i) {
368 next = theESNav.
west();
370 it = rechits_map.find(next);
371 if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
372 else esHits.push_back(0);
375 for (
int j=
i; j<15; j++) esHits.push_back(0);
385 for (
int i=0;
i<15; ++
i) {
386 next = theESNav.
north();
388 it = rechits_map.find(next);
389 if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
390 else esHits.push_back(0);
393 for (
int j=
i; j<15; j++) esHits.push_back(0);
402 for (
int i=0;
i<15; ++
i) {
403 next = theESNav.
south();
405 it = rechits_map.find(next);
406 if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
407 else esHits.push_back(0);
410 for (
int j=
i; j<15; j++) esHits.push_back(0);
431 for(
int ibin=0; ibin<((nBIN+1)/2); ibin++) {
433 esRH[(nBIN-1)/2] = ESHits0[ibin];
435 esRH[(nBIN-1)/2+ibin] = ESHits0[ibin];
436 esRH[(nBIN-1)/2-ibin] = ESHits0[ibin+15];
441 double EffWidthSigmaISIS = 0.;
442 double totalEnergyISIS = 0.;
443 double EffStatsISIS = 0.;
444 for (
int id_X=0; id_X<21; id_X++) {
445 totalEnergyISIS += esRH[id_X];
446 EffStatsISIS += esRH[id_X]*(id_X-10)*(id_X-10);
448 EffWidthSigmaISIS = (totalEnergyISIS>0.) ?
sqrt(fabs(EffStatsISIS / totalEnergyISIS)) : 0.;
450 return EffWidthSigmaISIS;
int adc(sample_type sample)
get the ADC sample (12 bits)
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
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
T const * product() const
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