17 std::vector<int> v_chstatus,
23 std::vector<int> severityToExclude,
27 bool excludeFromCluster
30 eb_st(eb_str), phiSteps_(step),
31 eThres_(ethres), eThresA_(eThresA), eThresB_(eThresB),
32 Eseed(eseed), Ewing(ewing),
33 dynamicEThres_(dynamicEThres), debugLevel_(debugLevel),
34 v_chstatus_(v_chstatus), v_severitylevel_(severityToExclude),severityRecHitThreshold_(severityRecHitThreshold), severitySpikeThreshold_(severitySpikeThreshold), excludeFromCluster_(excludeFromCluster)
59 const std::vector<EcalEtaPhiRegion>& regions,
80 std::cout <<
"Cleared vectors, starting clusterization..." << std::endl;
81 std::cout <<
"Purple monkey aardvark." << std::endl;
85 if(regional) nregions=regions.size();
87 if(!regional || nregions) {
101 bool withinRegion =
false;
103 std::vector<EcalEtaPhiRegion>::const_iterator region;
104 for (region=regions.begin(); region!=regions.end(); region++) {
105 if (region->inRegion(position)) {
112 if (!regional || withinRegion) {
115 float ET = it->energy() *
sin(position.
theta());
120 uint32_t rhFlag = (*it).recoFlag();
136 std::cout <<
"found flag: " << severityFlag << std::endl;
145 seeds.push_back(*it);
147 std::cout <<
"Seed ET: " << ET << std::endl;
148 std::cout <<
"Seed E: " << it->energy() << std::endl;
159 std::cout <<
"Built vector of seeds, about to sort them...";
169 std::cout <<
"About to call mainSearch...";
176 std::map<int, reco::BasicClusterCollection>::iterator bic;
179 for (
int j=0;
j<int(bl.size());++
j){
180 basicClusters.push_back(bl[
j]);
188 std::cout <<
"returning to producer. " << std::endl;
196 std::cout <<
"HybridClusterAlgo Algorithm - looking for clusters" << std::endl;
197 std::cout <<
"Found the following clusters:" << std::endl;
201 std::vector<EcalRecHit>::iterator it;
202 int clustercounter=0;
204 for (it =
seeds.begin(); it !=
seeds.end(); it++){
205 std::vector <reco::BasicCluster> thisseedClusters;
206 DetId itID = it->id();
209 std::set<DetId>::iterator seed_in_rechits_it =
useddetids.find(itID);
211 if (seed_in_rechits_it !=
useddetids.end())
continue;
216 std::cout <<
"*****************************************************" << std::endl;
217 std::cout <<
"Seed of energy E = " << it->energy() <<
" @ " <<
EBDetId(itID)
219 std::cout <<
"*****************************************************" << std::endl;
228 std::vector <double> dominoEnergyPhiPlus;
229 std::vector <std::vector <EcalRecHit> > dominoCellsPhiPlus;
232 std::vector <double> dominoEnergyPhiMinus;
233 std::vector <std::vector <EcalRecHit> > dominoCellsPhiMinus;
236 std::vector <double> dominoEnergy;
237 std::vector <std::vector <EcalRecHit> > dominoCells;
240 std::vector <EcalRecHit> initialdomino;
241 double e_init =
makeDomino(navigator, initialdomino);
242 if (e_init <
Eseed)
continue;
246 std::cout <<
"Made initial domino" << std::endl;
254 double et5x5 =
et25(navigator, hits, geometry);
260 for (
int i=0;
i<phiSteps;++
i){
272 std::vector <EcalRecHit> dcells;
276 dominoEnergyPhiPlus.push_back(etemp);
277 dominoCellsPhiPlus.push_back(dcells);
281 std::cout <<
"Got positive dominos" << std::endl;
286 for (
int i=0;
i<phiSteps;++
i){
299 std::vector <EcalRecHit> dcells;
303 dominoEnergyPhiMinus.push_back(etemp);
304 dominoCellsPhiMinus.push_back(dcells);
308 std::cout <<
"Got negative dominos: " << std::endl;
311 for (
int i=
int(dominoEnergyPhiMinus.size())-1;
i >= 0;--
i){
312 dominoEnergy.push_back(dominoEnergyPhiMinus[
i]);
313 dominoCells.push_back(dominoCellsPhiMinus[i]);
315 dominoEnergy.push_back(e_init);
316 dominoCells.push_back(initialdomino);
317 for (
int i=0;
i<int(dominoEnergyPhiPlus.size());++
i){
318 dominoEnergy.push_back(dominoEnergyPhiPlus[
i]);
319 dominoCells.push_back(dominoCellsPhiPlus[i]);
324 std::cout <<
"Dumping domino energies: " << std::endl;
325 for (
int i=0;
i<int(dominoEnergy.size());++
i){
326 std::cout <<
"Domino: " <<
i <<
" E: " << dominoEnergy[
i] << std::endl;
334 std::vector <int> PeakIndex;
335 for (
int i=1;
i<int(dominoEnergy.size())-1;++
i){
336 if (dominoEnergy[
i] > dominoEnergy[
i-1]
337 && dominoEnergy[
i] >= dominoEnergy[
i+1]
338 && dominoEnergy[
i] >
Eseed){
339 PeakIndex.push_back(
i);
344 std::cout <<
"Found: " << PeakIndex.size() <<
" peaks." << std::endl;
347 for (
int i=0;
i<int(PeakIndex.size());++
i){
348 for (
int j=0;
j<int(PeakIndex.size())-1;++
j){
349 if (dominoEnergy[PeakIndex[
j]] < dominoEnergy[PeakIndex[
j+1]]){
350 int ihold = PeakIndex[
j+1];
351 PeakIndex[
j+1] = PeakIndex[
j];
352 PeakIndex[
j] = ihold;
357 std::vector<int> OwnerShip;
358 std::vector<double> LumpEnergy;
359 for (
int i=0;
i<int(dominoEnergy.size());++
i) OwnerShip.push_back(-1);
364 for (
int i = 0;
i < int(PeakIndex.size()); ++
i)
367 int idxPeak = PeakIndex[
i];
368 OwnerShip[idxPeak] =
i;
369 double lump = dominoEnergy[idxPeak];
382 if ((idxPeak + 1) < (int)dominoEnergy.size()) e5x5 += dominoEnergy[idxPeak + 1];
384 if ((idxPeak + 2) < (int)dominoEnergy.size()) e5x5 += dominoEnergy[idxPeak + 2];
386 if ((idxPeak - 1) > 0) e5x5 += dominoEnergy[idxPeak - 1];
388 if ((idxPeak - 2) > 0) e5x5 += dominoEnergy[idxPeak - 2];
397 for (
int j=idxPeak+1;
j<int(dominoEnergy.size());++
j){
398 if (OwnerShip[
j]==-1 &&
399 dominoEnergy[
j] > eThres
400 && dominoEnergy[
j] <= dominoEnergy[
j-1]){
402 lump+=dominoEnergy[
j];
409 for (
int j=idxPeak-1;
j>=0;--
j){
410 if (OwnerShip[
j]==-1 &&
411 dominoEnergy[
j] > eThres
412 && dominoEnergy[
j] <= dominoEnergy[
j+1]){
414 lump+=dominoEnergy[
j];
420 LumpEnergy.push_back(lump);
424 for (
int i=0;
i<int(PeakIndex.size());++
i){
425 bool HasSeedCrystal =
false;
427 std::vector<EcalRecHit> recHits;
428 std::vector< std::pair<DetId, float> > dets;
430 for (
int j=0;
j<int(dominoEnergy.size());++
j){
431 if (OwnerShip[
j] ==
i){
432 std::vector <EcalRecHit>
temp = dominoCells[
j];
433 for (
int k=0;
k<int(temp.size());++
k){
434 dets.push_back( std::pair<DetId, float>(temp[
k].
id(), 1.) );
435 if (temp[
k].
id()==itID)
436 HasSeedCrystal =
true;
437 recHits.push_back(temp[
k]);
443 std::cout <<
"Adding a cluster with: " << nhits << std::endl;
444 std::cout <<
"total E: " << LumpEnergy[
i] << std::endl;
445 std::cout <<
"total dets: " << dets.size() << std::endl;
453 std::vector<std::pair<DetId, float> > usedHits;
454 for (
int blarg=0;blarg<int(recHits.size());++blarg){
457 usedHits.push_back(std::make_pair<DetId, float>(recHits[blarg].
id(), 1.0));
464 if (HasSeedCrystal) {
486 if (thisseedClusters.size() > 0)
488 clustered_.insert(std::make_pair(clustercounter, thisseedClusters));
501 std::map<int, reco::BasicClusterCollection>::iterator mapit;
508 std::vector <reco::BasicCluster> thiscoll = mapit->second;
520 for (
int i=0;
i<int(thiscoll.size());++
i){
522 for (
int j=0;
j<int(clustersCollection.
size());++
j){
525 if (thisclus== cluster_p){
528 for (
int qu=0;qu<int(
seedClus_.size());++qu){
532 if (isSeed) seed = clustersCollection[
j];
534 ClusterE += cluster_p.energy();
535 posX += cluster_p.energy() * cluster_p.position().X();
536 posY += cluster_p.energy() * cluster_p.position().Y();
537 posZ += cluster_p.energy() * cluster_p.position().Z();
562 SCcoll.push_back(suCl);
565 std::cout <<
"Super cluster sum: " << ClusterE << std::endl;
566 std::cout <<
"Made supercluster with energy E: " << suCl.
energy() << std::endl;
591 cells.push_back(SeedHit);
601 cells.push_back(UpEta);
615 cells.push_back(DownEta);
628 if (ieta2 !=
DetId(0)){
635 cells.push_back(DownEta2);
642 if (ieta1 !=
DetId(0)){
649 cells.push_back(UpEta2);
663 std::vector< std::pair<DetId, float> > dets;
668 for (
int dx = -2; dx < 3; ++dx)
670 for (
int dy = -2; dy < 3; ++ dy)
673 thisDet = navigator.
offsetBy(dx, dy);
676 if (thisDet !=
DetId(0))
681 dets.push_back( std::pair<DetId, float>(thisDet, 1.) );
682 energySum += hit->energy();
691 double et = energySum/cosh(pos.eta());
size_type size() const
Size of the RefVector.
int barrelPhiRoad(double et)
void home() const
move the navigator back to the starting point
void push_back(Ptr< T > const &iPtr)
double et25(EcalBarrelNavigator &navigator, const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry)
Sin< T >::type sin(const T &t)
EcalBarrelHardcodedTopology * topo_
void mainSearch(const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry)
std::map< int, std::vector< reco::BasicCluster > > clustered_
virtual T west() const
move the navigator west
std::vector< T >::const_iterator const_iterator
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
virtual T north() const
move the navigator north
T pos() const
get the current position
static int position[TOTALCHAMBERS][3]
double makeDomino(EcalBarrelNavigator &navigator, std::vector< EcalRecHit > &cells)
Geom::Theta< T > theta() const
PositionCalc posCalculator_
tuple severitySpikeThreshold
virtual T east() const
move the navigator east
std::vector< EcalRecHit > seeds
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
EcalSeverityLevelAlgo::SpikeId spId_
virtual T offsetBy(int deltaX, int deltaY) const
Free movement of arbitray steps.
reco::SuperClusterCollection makeSuperClusters(const reco::CaloClusterPtrVector &)
BremRecoveryPhiRoadAlgo * phiRoadAlgo_
double energy() const
cluster energy
std::vector< int > v_chstatus_
std::set< DetId > useddetids
std::set< DetId > excludedCrys_
void makeClusters(const EcalRecHitCollection *, const CaloSubdetectorGeometry *geometry, reco::BasicClusterCollection &basicClusters, bool regional=false, const std::vector< EcalEtaPhiRegion > ®ions=std::vector< EcalEtaPhiRegion >(), const EcalChannelStatus *chStatus=new EcalChannelStatus())
const_iterator end() const
std::vector< int > v_severitylevel_
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
ESHandle< TrackerGeometry > geometry
math::XYZPoint Calculate_Location(const std::vector< std::pair< DetId, float > > &iDetIds, const EcalRecHitCollection *iRecHits, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorGeometry *iESGeom=0)
iterator find(key_type k)
tuple severityRecHitThreshold
const EcalRecHitCollection * recHits_
static int severityLevel(const DetId, const EcalRecHitCollection &, const EcalChannelStatus &, float recHitEtThreshold=5., SpikeId spId=kSwissCross, float spIdThreshold=0.95, float recHitEnergyThresholdForTiming=2., float recHitEnergyThresholdForEE=15, float spIdThresholdIEta85=0.999)
double energySum(const DataFrame &df, int fs, int ls)
virtual T south() const
move the navigator south
const GlobalPoint & getPosition() const
std::vector< reco::BasicCluster > seedClus_
const_iterator begin() const
float severityRecHitThreshold_
float severitySpikeThreshold_