22 const std::vector<int>& v_chstatus,
27 const std::vector<int>& severityToExclude,
28 bool excludeFromCluster
31 eb_st(eb_str), phiSteps_(step),
32 eThres_(ethres), eThresA_(eThresA), eThresB_(eThresB),
33 Eseed(eseed), Xi(xi), UseEtForXi(useEtForXi), Ewing(ewing),
34 dynamicEThres_(dynamicEThres),
35 v_chstatus_(v_chstatus), v_severitylevel_(severityToExclude),
38 excludeFromCluster_(excludeFromCluster)
62 const std::vector<RectangularEtaPhiRegion>&
regions 78 LogTrace(
"EcalClusters") <<
"Cleared vectors, starting clusterization..." ;
79 LogTrace(
"EcalClusters") <<
" Purple monkey aardvark." ;
83 if(regional) nregions=regions.size();
85 if(!regional || nregions) {
99 bool withinRegion =
false;
101 std::vector<RectangularEtaPhiRegion>::const_iterator region;
102 for (region=regions.begin(); region!=regions.end(); region++) {
103 if (region->inRegion(this_cell->etaPos(),this_cell->phiPos())) {
110 if (!regional || withinRegion) {
115 LogTrace(
"EcalClusters") <<
"Seed crystal: " ;
131 LogTrace(
"EcalClusters") <<
"found flag: " << severityFlag ;
139 seeds.push_back(*it);
141 LogTrace(
"EcalClusters") <<
"Seed ET: " <<
ET ;
142 LogTrace(
"EcalClsuters") <<
"Seed E: " << it->energy() ;
151 LogTrace(
"EcalClusters") <<
"Built vector of seeds, about to sort them..." ;
156 LogTrace(
"EcalClusters") <<
"done" ;
159 LogTrace(
"EcalClusters") <<
"About to call mainSearch...";
161 LogTrace(
"EcalClusters") <<
"done" ;
165 std::map<int, reco::BasicClusterCollection>::iterator bic;
168 for (
int j=0;j<
int(bl.size());++j){
169 basicClusters.push_back(bl[j]);
174 sort(basicClusters.rbegin(), basicClusters.rend(),
ClusterEtLess() );
176 LogTrace(
"EcalClusters") <<
"returning to producer. ";
183 LogTrace(
"EcalClusters") <<
"HybridClusterAlgo Algorithm - looking for clusters" ;
184 LogTrace(
"EcalClusters") <<
"Found the following clusters:" ;
187 std::vector<EcalRecHit>::iterator it;
188 int clustercounter=0;
190 for (it =
seeds.begin(); it !=
seeds.end(); it++){
191 std::vector <reco::BasicCluster> thisseedClusters;
192 DetId itID = it->id();
195 std::set<DetId>::iterator seed_in_rechits_it =
useddetids.find(itID);
197 if (seed_in_rechits_it !=
useddetids.end())
continue;
201 LogTrace(
"EcalClusters") <<
"*****************************************************" <<
"Seed of energy E = " << it->energy() <<
" @ " <<
EBDetId(itID) <<
"*****************************************************" ;
210 std::vector <double> dominoEnergyPhiPlus;
211 std::vector <std::vector <EcalRecHit> > dominoCellsPhiPlus;
214 std::vector <double> dominoEnergyPhiMinus;
215 std::vector <std::vector <EcalRecHit> > dominoCellsPhiMinus;
218 std::vector <double> dominoEnergy;
219 std::vector <std::vector <EcalRecHit> > dominoCells;
222 std::vector <EcalRecHit> initialdomino;
223 double e_init =
makeDomino(navigator, initialdomino);
224 if (e_init <
Eseed)
continue;
226 LogTrace(
"EcalClusters") <<
"Made initial domino" ;
231 double et5x5 =
et25(navigator, hits, geometry);
239 for (
int i=0;
i<phiSteps;++
i){
248 std::vector <EcalRecHit> dcells;
252 dominoEnergyPhiPlus.push_back(etemp);
253 dominoCellsPhiPlus.push_back(dcells);
255 LogTrace(
"EcalClusters") <<
"Got positive dominos" ;
260 for (
int i=0;
i<phiSteps;++
i){
270 std::vector <EcalRecHit> dcells;
274 dominoEnergyPhiMinus.push_back(etemp);
275 dominoCellsPhiMinus.push_back(dcells);
278 LogTrace(
"EcalClusters") <<
"Got negative dominos: " ;
281 for (
int i=
int(dominoEnergyPhiMinus.size())-1;
i >= 0;--
i){
282 dominoEnergy.push_back(dominoEnergyPhiMinus[
i]);
283 dominoCells.push_back(dominoCellsPhiMinus[i]);
285 dominoEnergy.push_back(e_init);
286 dominoCells.push_back(initialdomino);
287 for (
int i=0;
i<
int(dominoEnergyPhiPlus.size());++
i){
288 dominoEnergy.push_back(dominoEnergyPhiPlus[
i]);
289 dominoCells.push_back(dominoCellsPhiPlus[i]);
293 LogTrace(
"EcalClusters") <<
"Dumping domino energies: " ;
304 etToE = 1./
e2Et(navigator, hits, geometry);
306 std::vector <int> PeakIndex;
307 for (
int i=1;
i<
int(dominoEnergy.size())-1;++
i){
308 if (dominoEnergy[
i] > dominoEnergy[
i-1]
309 && dominoEnergy[
i] >= dominoEnergy[
i+1]
312 PeakIndex.push_back(
i);
316 LogTrace(
"EcalClusters") <<
"Found: " << PeakIndex.size() <<
" peaks." ;
319 for (
int i=0;
i<
int(PeakIndex.size());++
i){
320 for (
int j=0;j<
int(PeakIndex.size())-1;++j){
321 if (dominoEnergy[PeakIndex[j]] < dominoEnergy[PeakIndex[j+1]]){
322 int ihold = PeakIndex[j+1];
323 PeakIndex[j+1] = PeakIndex[j];
324 PeakIndex[j] = ihold;
329 std::vector<int> OwnerShip;
330 std::vector<double> LumpEnergy;
331 for (
int i=0;
i<
int(dominoEnergy.size());++
i) OwnerShip.push_back(-1);
336 for (
int i = 0;
i <
int(PeakIndex.size()); ++
i)
339 int idxPeak = PeakIndex[
i];
340 OwnerShip[idxPeak] =
i;
341 double lump = dominoEnergy[idxPeak];
354 if ((idxPeak + 1) < (
int)dominoEnergy.size()) e5x5 += dominoEnergy[idxPeak + 1];
356 if ((idxPeak + 2) < (
int)dominoEnergy.size()) e5x5 += dominoEnergy[idxPeak + 2];
358 if ((idxPeak - 1) > 0) e5x5 += dominoEnergy[idxPeak - 1];
360 if ((idxPeak - 2) > 0) e5x5 += dominoEnergy[idxPeak - 2];
369 for (
int j=idxPeak+1;j<
int(dominoEnergy.size());++j){
370 if (OwnerShip[j]==-1 &&
371 dominoEnergy[j] > eThres
372 && dominoEnergy[j] <= dominoEnergy[j-1]){
374 lump+=dominoEnergy[j];
381 for (
int j=idxPeak-1;j>=0;--j){
382 if (OwnerShip[j]==-1 &&
383 dominoEnergy[j] > eThres
384 && dominoEnergy[j] <= dominoEnergy[j+1]){
386 lump+=dominoEnergy[j];
392 LumpEnergy.push_back(lump);
396 for (
int i=0;
i<
int(PeakIndex.size());++
i){
397 bool HasSeedCrystal =
false;
399 std::vector<EcalRecHit> recHits;
400 std::vector< std::pair<DetId, float> > dets;
402 for (
int j=0;j<
int(dominoEnergy.size());++j){
403 if (OwnerShip[j] ==
i){
404 std::vector <EcalRecHit>
temp = dominoCells[j];
405 for (
int k=0;
k<
int(temp.size());++
k){
406 dets.push_back( std::pair<DetId, float>(temp[
k].
id(), 1.) );
407 if (temp[
k].
id()==itID)
408 HasSeedCrystal =
true;
409 recHits.push_back(temp[
k]);
414 LogTrace(
"EcalClusters") <<
"Adding a cluster with: " <<
nhits;
415 LogTrace(
"EcalClusters") <<
"total E: " << LumpEnergy[
i];
416 LogTrace(
"EcalClusters") <<
"total dets: " << dets.size() ;
423 std::vector<std::pair<DetId, float> > usedHits;
424 for (
int blarg=0;blarg<
int(recHits.size());++blarg){
427 usedHits.push_back(std::make_pair<DetId, float>(recHits[blarg].
id(), 1.0));
434 if (HasSeedCrystal) {
456 if (!thisseedClusters.empty())
458 clustered_.insert(std::make_pair(clustercounter, thisseedClusters));
471 std::map<int, reco::BasicClusterCollection>::iterator mapit;
478 std::vector <reco::BasicCluster> thiscoll = mapit->second;
490 for (
int i=0;
i<
int(thiscoll.size());++
i){
492 for (
int j=0;j<
int(clustersCollection.
size());++j){
495 if (thisclus== cluster_p){
502 if (isSeed) seed = clustersCollection[j];
504 ClusterE += cluster_p.energy();
505 posX += cluster_p.energy() * cluster_p.position().X();
506 posY += cluster_p.energy() * cluster_p.position().Y();
507 posZ += cluster_p.energy() * cluster_p.position().Z();
532 SCcoll.push_back(suCl);
534 LogTrace(
"EcalClusters") <<
"Super cluster sum: " << ClusterE ;
535 LogTrace(
"EcalClusters") <<
"Made supercluster with energy E: " << suCl.
energy() ;
560 cells.push_back(SeedHit);
570 cells.push_back(UpEta);
584 cells.push_back(DownEta);
597 if (ieta2 !=
DetId(0)){
604 cells.push_back(DownEta2);
611 if (ieta1 !=
DetId(0)){
618 cells.push_back(UpEta2);
632 std::vector< std::pair<DetId, float> > dets;
637 for (
int dx = -2;
dx < 3; ++
dx)
639 for (
int dy = -2;
dy < 3; ++
dy)
645 if (thisDet !=
DetId(0))
650 dets.push_back( std::pair<DetId, float>(thisDet, 1.) );
651 energySum += hit->energy();
660 double et = energySum/cosh(pos.eta());
672 std::vector< std::pair<DetId, float> > dets;
676 for (
int dx = -2;
dx < 3; ++
dx)
678 for (
int dy = -2;
dy < 3; ++
dy)
683 if (thisDet !=
DetId(0))
688 dets.push_back( std::pair<DetId, float>(thisDet, 1.) );
696 return 1/cosh(pos.eta());
size_type size() const
Size of the RefVector.
int barrelPhiRoad(double et)
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
void push_back(Ptr< T > const &iPtr)
EcalBarrelHardcodedTopology * topo_
void mainSearch(const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry)
Basic3DVector unit() const
std::map< int, std::vector< reco::BasicCluster > > clustered_
std::vector< EcalRecHit >::const_iterator const_iterator
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
double e2Et(EcalBarrelNavigatorHT &navigator, const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry)
PositionCalc posCalculator_
T offsetBy(int deltaX, int deltaY) const
Free movement of arbitray steps.
std::vector< EcalRecHit > seeds
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
T west() const
move the navigator west
reco::SuperClusterCollection makeSuperClusters(const reco::CaloClusterPtrVector &)
BremRecoveryPhiRoadAlgo * phiRoadAlgo_
double energy() const
cluster energy
std::vector< int > v_chstatus_
T south() const
move the navigator south
std::set< DetId > useddetids
T pos() const
get the current position
double et25(EcalBarrelNavigatorHT &navigator, const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry)
T perp() const
Magnitude of transverse component.
std::set< DetId > excludedCrys_
const_iterator end() const
std::vector< int > v_severitylevel_
T east() const
move the navigator east
void home() const
move the navigator back to the starting point
double makeDomino(EcalBarrelNavigatorHT &navigator, std::vector< EcalRecHit > &cells)
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.
XYZPointD XYZPoint
point in space with cartesian internal representation
bool null() const
is this a null id ?
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
et
define resolution functions of each parameter
iterator find(key_type k)
math::XYZPoint Calculate_Location(const HitsAndFractions &iDetIds, const edm::SortedCollection< HitType > *iRecHits, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorGeometry *iESGeom=0)
static int position[264][3]
T north() const
move the navigator north
const EcalRecHitCollection * recHits_
double energySum(const DataFrame &df, int fs, int ls)
void makeClusters(const EcalRecHitCollection *, const CaloSubdetectorGeometry *geometry, reco::BasicClusterCollection &basicClusters, const EcalSeverityLevelAlgo *sevLv, bool regional=false, const std::vector< RectangularEtaPhiRegion > ®ions=std::vector< RectangularEtaPhiRegion >())
const BasicVectorType & basicVector() const
std::vector< reco::BasicCluster > seedClus_
const_iterator begin() const