15 template <
class T1,
class T2,
typename Comp = std::less<T1> >
18 bool operator()(
const std::pair<T1, T2>& lhs,
const std::pair<T1, T2>& rhs) {
return comp(lhs.first, rhs.first); }
19 bool operator()(
const T1& lhs,
const std::pair<T1, T2>& rhs) {
return comp(lhs, rhs.first); }
20 bool operator()(
const std::pair<T1, T2>& lhs,
const T1& rhs) {
return comp(lhs.first, rhs); }
42 if (lhs.
ix() < rhs.
ix())
44 else if (lhs.
ix() > rhs.
ix())
47 return lhs.
iy() < rhs.
iy();
60 const std::vector<RectangularEtaPhiRegion>&
regions) {
74 ecalPart_string =
"EndCap";
79 ecalPart_string =
"Barrel";
82 LogTrace(
"EcalClusters") <<
"-------------------------------------------------------------";
83 LogTrace(
"EcalClusters") <<
"Island algorithm invoked for ECAL" << ecalPart_string;
84 LogTrace(
"EcalClusters") <<
"Looking for seeds, energy threshold used = " <<
threshold <<
" GeV";
90 if (!regional || nregions) {
92 for (it =
hits->begin(); it !=
hits->end(); it++) {
93 double energy = it->energy();
100 bool withinRegion =
false;
102 std::vector<RectangularEtaPhiRegion>::const_iterator
region;
104 if (
region->inRegion(thisCell->etaPos(), thisCell->phiPos())) {
111 if (!regional || withinRegion) {
112 float ET = it->energy() * thisCell->getPosition().basicVector().unit().perp();
114 seeds.push_back(*it);
119 sort(
seeds.begin(),
seeds.end(), [](
auto const&
x,
auto const&
y) {
return (
x.energy() >
y.energy()); });
121 LogTrace(
"EcalClusters") <<
"Total number of seeds found in event = " <<
seeds.size();
126 LogTrace(
"EcalClusters") <<
"---------- end of main search. clusters have been sorted ----";
137 LogTrace(
"EcalClusters") <<
"Building clusters............";
140 std::vector<EcalRecHit>::iterator it;
141 for (it =
seeds.begin(); it !=
seeds.end(); it++) {
144 bool usedButCanSeed =
false;
146 usedButCanSeed =
true;
155 if ((
used_s.find(it->id()) !=
used_s.end()) && (usedButCanSeed ==
false)) {
156 if (it ==
seeds.begin()) {
157 LogTrace(
"EcalClusters") <<
"##############################################################";
158 LogTrace(
"EcalClusters") <<
"DEBUG ALERT: Highest energy seed already belongs to a cluster!";
159 LogTrace(
"EcalClusters") <<
"##############################################################";
197 for (
size_t clusNr = 0; clusNr <
protoClusters_.size(); clusNr++) {
200 typedef std::vector<std::pair<DetId, int> >::iterator It;
213 for (
size_t clusNr = 0; clusNr <
protoClusters_.size(); clusNr++) {
222 protoCluster.
seed().
id()));
240 std::vector<std::pair<DetId, float> >::iterator it;
254 LogTrace(
"EcalClusters") <<
"******** NEW CLUSTER ********";
259 LogTrace(
"EcalClusters") <<
"*****************************";
263 double seedEnergy = seedIt->energy();
264 if ((seedOutside &&
energy >= 0) || (!seedOutside &&
energy >= seedEnergy)) {
266 for (
size_t hitNr = 0; hitNr <
current_v.size(); hitNr++)
276 std::vector<std::pair<DetId, float> >::iterator iter;
278 used_s.erase(iter->first);
287 double seedEnergy = seedHit->energy();
289 std::vector<DetId> swissCrossVec;
290 swissCrossVec.clear();
292 swissCrossVec.push_back(
navigator.west());
294 swissCrossVec.push_back(
navigator.east());
296 swissCrossVec.push_back(
navigator.north());
298 swissCrossVec.push_back(
navigator.south());
301 for (
unsigned int i = 0;
i < swissCrossVec.size(); ++
i) {
311 uint32_t rhFlag = thisHit->recoFlag();
318 if (thisHit->energy() > seedEnergy) {
331 std::set<DetId>::iterator setItr;
338 for (
int dx = -2;
dx < 3; ++
dx) {
339 for (
int dy = -2;
dy < 3; ++
dy) {
381 current_v.push_back(std::pair<DetId, float>(det, 1.));
388 std::vector<std::pair<DetId, float> >::iterator hitPos;
389 for (hitPos =
hits_.begin(); hitPos <
hits_.end(); hitPos++) {
390 if (hitToRM.
id() == hitPos->first)
393 if (hitPos !=
hits_.end()) {
404 typedef std::vector<std::pair<DetId, float> >::iterator It;
405 std::pair<It, It> hitPos;
413 if (hitPos.first == hitPos.second) {
414 hits_.insert(hitPos.first, std::pair<DetId, float>(seed_.id(), 1.));
415 energy_ += seed_.energy();
416 containsSeed_ =
true;
424 for (
size_t hitNr = 0; hitNr < hits_.size(); hitNr++) {
425 if (seed_.id() == hits_[hitNr].first)