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)
void makeCluster(const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry_p, const CaloSubdetectorGeometry *geometryES_p, const EcalRecHitCollection::const_iterator &seedIt, bool seedOutside)
std::set< DetId > canSeed_s
double ecalEndcapSeedThreshold
int iphi() const
get the crystal iphi
const EcalRecHitCollection * recHits_
bool reassignSeedCrysToClusterItSeeds_
std::vector< EcalRecHit >::const_iterator const_iterator
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
int ieta() const
get the crystal ieta
double ecalBarrelSeedThreshold
void mainSearch(const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry_p, const CaloSubdetectorTopology *topology_p, const CaloSubdetectorGeometry *geometryES_p)
std::vector< int > v_chstatus_
void prepareCluster(CaloNavigator< DetId > &navigator, const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry)
bool operator()(const std::pair< T1, T2 > &lhs, const T1 &rhs)
void addCrystal(const DetId &det)
const std::vector< std::pair< DetId, float > > & hits() const
Abs< T >::type abs(const T &t)
math::XYZPoint Calculate_Location(const HitsAndFractions &iDetIds, const edm::SortedCollection< HitType > *iRecHits, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorGeometry *iESGeom=nullptr)
bool operator()(const EEDetId &lhs, const EEDetId &rhs)
std::vector< std::pair< DetId, float > > current_v
bool isSeedCrysInHits_() const
bool isClusterEtLess(const reco::CaloCluster &x, const reco::CaloCluster &y)
bool operator()(const T1 &lhs, const T1 &rhs)
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
std::vector< ProtoBasicCluster > protoClusters_
const_iterator end() const
const EcalRecHit & seed() const
bool removeHit(const EcalRecHit &hitToRM)
std::vector< EcalRecHit > seeds
std::vector< std::pair< DetId, float > > hits_
std::vector< reco::BasicCluster > makeClusters(const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry, const CaloSubdetectorTopology *topology_p, const CaloSubdetectorGeometry *geometryES_p, reco::CaloID::Detectors detector, bool regional=false, const std::vector< RectangularEtaPhiRegion > ®ions=std::vector< RectangularEtaPhiRegion >())
bool operator()(const EBDetId &lhs, const EBDetId &rhs)
bool operator()(const std::pair< T1, T2 > &lhs, const std::pair< T1, T2 > &rhs)
bool checkMaxima(CaloNavigator< DetId > &navigator, const EcalRecHitCollection *hits)
bool operator()(const T1 &lhs, const std::pair< T1, T2 > &rhs)
DetId id() const
get the id
iterator find(key_type k)
Structure Point Contains parameters of Gaussian fits to DMRs.
static int position[264][3]
reco::CaloID::Detectors detector_
The ecal region used.
std::vector< reco::BasicCluster > clusters_v
PositionCalc posCalculator_
std::vector< std::pair< DetId, int > > whichClusCrysBelongsTo_