CMS 3D CMS Logo

HybridClusterAlgo Class Reference

#include <RecoEcal/EgammaClusterAlgos/interface/HybridClusterAlgo.h>

List of all members.

Public Types

enum  DebugLevel { pDEBUG = 0, pINFO = 1, pERROR = 2 }

Public Member Functions

 HybridClusterAlgo (double eb_str, int step, double eseed, double ewing, double ethres, const PositionCalc &posCalculator, bool dynamicEThres=false, double eThresA=0, double eThresB=0.1, DebugLevel debugLevel=pINFO)
 HybridClusterAlgo ()
void mainSearch (const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry)
void makeClusters (const EcalRecHitCollection *, const CaloSubdetectorGeometry *geometry, reco::BasicClusterCollection &basicClusters, bool regional=false, const std::vector< EcalEtaPhiRegion > &regions=std::vector< EcalEtaPhiRegion >())
double makeDomino (EcalBarrelNavigator &navigator, std::vector< EcalRecHit > &cells)
reco::SuperClusterCollection makeSuperClusters (const reco::BasicClusterRefVector &)
void setDynamicPhiRoad (const edm::ParameterSet &bremRecoveryPset)
 ~HybridClusterAlgo ()

Private Types

typedef math::XYZPoint Point

Private Member Functions

double et25 (EcalBarrelNavigator &navigator, const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry)

Private Attributes

std::map< int, std::vector
< reco::BasicCluster > > 
clustered_
int debugLevel_
bool dynamicEThres_
bool dynamicPhiRoad_
double eb_st
double Eseed
double eThres_
double eThresA_
double eThresB_
double Ewing
const CaloSubdetectorGeometrygeometry
BremRecoveryPhiRoadAlgophiRoadAlgo_
int phiSteps_
PositionCalc posCalculator_
const EcalRecHitCollectionrecHits_
std::vector< reco::BasicClusterseedClus_
std::vector< EcalRecHitseeds
std::set< DetIduseddetids


Detailed Description

Definition at line 29 of file HybridClusterAlgo.h.


Member Typedef Documentation

typedef math::XYZPoint HybridClusterAlgo::Point [private]

Definition at line 33 of file HybridClusterAlgo.h.


Member Enumeration Documentation

enum HybridClusterAlgo::DebugLevel

Enumerator:
pDEBUG 
pINFO 
pERROR 

Definition at line 100 of file HybridClusterAlgo.h.

00100 { pDEBUG = 0, pINFO = 1, pERROR = 2 }; 


Constructor & Destructor Documentation

HybridClusterAlgo::HybridClusterAlgo (  )  [inline]

Definition at line 103 of file HybridClusterAlgo.h.

00103 { }

HybridClusterAlgo::HybridClusterAlgo ( double  eb_str,
int  step,
double  eseed,
double  ewing,
double  ethres,
const PositionCalc posCalculator,
bool  dynamicEThres = false,
double  eThresA = 0,
double  eThresB = 0.1,
DebugLevel  debugLevel = pINFO 
)

Definition at line 12 of file HybridClusterAlgo.cc.

References debugLevel_, dynamicPhiRoad_, pDEBUG, and posCalculator_.

00023                                                             :
00024    eb_st(eb_str), phiSteps_(step), 
00025    eThres_(ethres), eThresA_(eThresA), eThresB_(eThresB),
00026    Eseed(eseed),  Ewing(ewing), 
00027    dynamicEThres_(dynamicEThres), debugLevel_(debugLevel)
00028 {
00029 
00030   dynamicPhiRoad_ = false;
00031   if ( debugLevel_ == pDEBUG ) {
00032     //std::cout << "dynamicEThres: " << dynamicEThres_ 
00033     //          << " : A,B " << eThresA_ << ", " << eThresB_ << std::endl;
00034   }
00035 
00036    //if (dynamicPhiRoad_) phiRoadAlgo_ = new BremRecoveryPhiRoadAlgo(bremRecoveryPset);
00037    posCalculator_ = posCalculator;
00038 }

HybridClusterAlgo::~HybridClusterAlgo (  )  [inline]

Definition at line 120 of file HybridClusterAlgo.h.

References dynamicPhiRoad_, and phiRoadAlgo_.

00121   {
00122      if (dynamicPhiRoad_) delete phiRoadAlgo_;
00123      //     delete SCShape_;
00124   } 


Member Function Documentation

double HybridClusterAlgo::et25 ( EcalBarrelNavigator navigator,
const EcalRecHitCollection hits,
const CaloSubdetectorGeometry geometry 
) [private]

Definition at line 598 of file HybridClusterAlgo.cc.

References PositionCalc::Calculate_Location(), edm::SortedCollection< T, SORT >::end(), HcalDataFrameFilter_impl::energySum(), edm::SortedCollection< T, SORT >::find(), CaloNavigator< T >::home(), CaloNavigator< T >::offsetBy(), posCalculator_, and recHits_.

Referenced by mainSearch().

00601 {
00602 
00603    DetId thisDet;
00604    std::vector<DetId> dets;
00605    dets.clear();
00606    EcalRecHitCollection::const_iterator hit;
00607    double energySum = 0.0;
00608 
00609    for (int dx = -2; dx < 3; ++dx)
00610    {
00611       for (int dy = -2; dy < 3; ++ dy)
00612       {
00613           //std::cout << "dx, dy " << dx << ", " << dy << std::endl;
00614           thisDet = navigator.offsetBy(dx, dy);
00615           navigator.home();
00616 
00617           if (thisDet != DetId(0))
00618           {
00619              hit = recHits_->find(thisDet);
00620              if (hit != recHits_->end()) 
00621              {
00622                 dets.push_back(thisDet);
00623                 energySum += hit->energy();
00624              }
00625           }
00626       }
00627    }
00628 
00629    // convert it to ET
00630    //std::cout << "dets.size(), energySum: " << dets.size() << ", " << energySum << std::endl;
00631    Point pos = posCalculator_.Calculate_Location(dets, hits, geometry);
00632    double et = energySum/cosh(pos.eta());
00633    return et;
00634 
00635 }

void HybridClusterAlgo::mainSearch ( const EcalRecHitCollection hits,
const CaloSubdetectorGeometry geometry 
)

Definition at line 145 of file HybridClusterAlgo.cc.

References funct::abs(), BremRecoveryPhiRoadAlgo::barrelPhiRoad(), PositionCalc::Calculate_Location(), clustered_, GenMuonPlsPt100GeV_cfg::cout, debugLevel_, dynamicEThres_, dynamicPhiRoad_, lat::endl(), Eseed, et25(), eThres_, eThresA_, eThresB_, CaloNavigator< T >::home(), i, int, it, j, k, makeDomino(), CaloNavigator< T >::north(), DetId::null(), pDEBUG, phiRoadAlgo_, phiSteps_, posCalculator_, seedClus_, seeds, CaloNavigator< T >::south(), pyDBSRunClass::temp, and useddetids.

Referenced by makeClusters().

00146 {
00147  
00148   if ( debugLevel_ ==pDEBUG ) {
00149     std::cout << "HybridClusterAlgo Algorithm - looking for clusters" << std::endl;
00150     std::cout << "Found the following clusters:" << std::endl;
00151   }
00152 
00153   // Loop over seeds:
00154   std::vector<EcalRecHit>::iterator it;
00155   int clustercounter=0;
00156 
00157   EcalBarrelHardcodedTopology *topo = new EcalBarrelHardcodedTopology();
00158   for (it = seeds.begin(); it != seeds.end(); it++){
00159     std::vector <reco::BasicCluster> thisseedClusters;
00160     DetId itID = it->id();
00161     
00162     // make sure the current seed has not been used/will not be used in the future:
00163     std::set<DetId>::iterator seed_in_rechits_it = useddetids.find(itID);
00164 
00165     if (seed_in_rechits_it != useddetids.end()) continue;
00166     //If this seed is already used, then don't use it again.
00167 
00168     // output some info on the hit:
00169     if ( debugLevel_ == pDEBUG ){
00170       std::cout << "*****************************************************" << std::endl;
00171       std::cout << "Seed of energy E = " << it->energy() << " @ " << EBDetId(itID) 
00172                 << std::endl;
00173       std::cout << "*****************************************************" << std::endl;
00174     }
00175 
00176     //Make a navigator, and set it to the seed cell.
00177     EcalBarrelNavigator navigator(itID, topo);
00178 
00179     //Now use the navigator to start building dominoes.
00180     
00181     //Walking positive in phi:
00182     std::vector <double> dominoEnergyPhiPlus;  //Here I will store the results of the domino sums
00183     std::vector <std::vector <EcalRecHit> > dominoCellsPhiPlus; //These are the actual EcalRecHit for dominos.
00184     
00185     //Walking negative in phi
00186     std::vector <double> dominoEnergyPhiMinus;  //Here I will store the results of the domino sums
00187     std::vector <std::vector <EcalRecHit> > dominoCellsPhiMinus; //These are the actual EcalRecHit for dominos.
00188     
00189     //The two sets together.
00190     std::vector <double> dominoEnergy;  //Here I will store the results of the domino sums
00191     std::vector <std::vector <EcalRecHit> > dominoCells; //These are the actual EcalRecHit for dominos.
00192 
00193     //First, the domino about the seed:
00194     std::vector <EcalRecHit> initialdomino;
00195     double e_init = makeDomino(navigator, initialdomino);
00196     if ( debugLevel_ == pDEBUG )
00197       {
00198         std::cout << "Make initial domino" << std::endl;
00199       }
00200     
00201     //
00202     // compute the phi road length
00203     double phiSteps;
00204     if (dynamicPhiRoad_ && e_init > 0)
00205     {
00206        double et5x5 = et25(navigator, hits, geometry);
00207        phiSteps = phiRoadAlgo_->barrelPhiRoad(et5x5);
00208        navigator.home();
00209     } else phiSteps = phiSteps_;
00210  
00211     //Positive phi steps.
00212     for (int i=0;i<phiSteps;++i){
00213       //remember, this always increments the current position of the navigator.
00214       DetId centerD = navigator.north();
00215       if (centerD.null())
00216         continue;
00217       if ( debugLevel_ == pDEBUG )
00218         {
00219           std::cout << "Step ++" << i << " @ " << EBDetId(centerD) << std::endl;
00220         }
00221       EcalBarrelNavigator dominoNav(centerD, topo);
00222       
00223       //Go get the new domino.
00224       std::vector <EcalRecHit> dcells;
00225       double etemp = makeDomino(dominoNav, dcells);
00226       
00227       //save this information
00228       dominoEnergyPhiPlus.push_back(etemp);
00229       dominoCellsPhiPlus.push_back(dcells);
00230     }
00231 
00232     if ( debugLevel_ == pDEBUG )
00233       std::cout << "Got positive dominos" << std::endl;
00234     //return to initial position
00235     navigator.home();
00236 
00237     //Negative phi steps.
00238     for (int i=0;i<phiSteps;++i){
00239       //remember, this always decrements the current position of the navigator.
00240       DetId centerD = navigator.south();
00241       if (centerD.null())
00242         continue;
00243 
00244       if ( debugLevel_ == pDEBUG )
00245         {
00246           std::cout << "Step --" << i << " @ " << EBDetId(centerD) << std::endl;
00247         }
00248       EcalBarrelNavigator dominoNav(centerD, topo);
00249       
00250       //Go get the new domino.
00251       std::vector <EcalRecHit> dcells;
00252       double etemp = makeDomino(dominoNav, dcells);
00253       
00254       //save this information
00255       dominoEnergyPhiMinus.push_back(etemp);
00256       dominoCellsPhiMinus.push_back(dcells);
00257     }
00258     
00259     if ( debugLevel_ == pDEBUG )
00260       std::cout << "Got negative dominos: " << std::endl;
00261 
00262     //Assemble this information:
00263     for (int i=int(dominoEnergyPhiMinus.size())-1;i >= 0;--i){
00264       dominoEnergy.push_back(dominoEnergyPhiMinus[i]);
00265       dominoCells.push_back(dominoCellsPhiMinus[i]);
00266     }
00267     dominoEnergy.push_back(e_init);
00268     dominoCells.push_back(initialdomino);
00269     for (int i=0;i<int(dominoEnergyPhiPlus.size());++i){
00270       dominoEnergy.push_back(dominoEnergyPhiPlus[i]);
00271       dominoCells.push_back(dominoCellsPhiPlus[i]);
00272     }
00273 
00274     //Ok, now I have all I need in order to go ahead and make clusters.
00275     if ( debugLevel_ == pDEBUG ){
00276       std::cout << "Dumping domino energies: " << std::endl;
00277       for (int i=0;i<int(dominoEnergy.size());++i){
00278         std::cout << "Domino: " << i << " E: " << dominoEnergy[i] << std::endl;
00279       }
00280     }
00281 
00282 
00283     //Identify the peaks in this set of dominos:
00284     //Peak==a domino whose energy is greater than the two adjacent dominos.
00285     //thus a peak in the local sense.
00286     std::vector <int> PeakIndex;
00287     for (int i=1;i<int(dominoEnergy.size())-1;++i){
00288       if (dominoEnergy[i] > dominoEnergy[i-1]
00289           && dominoEnergy[i] > dominoEnergy[i+1]
00290           && dominoEnergy[i] > Eseed){
00291         PeakIndex.push_back(i);
00292       }
00293     }
00294 
00295     if ( debugLevel_ == pDEBUG )
00296       std::cout << "Found: " << PeakIndex.size() << " peaks." << std::endl;
00297     
00298     //Order these peaks by energy:
00299     for (int i=0;i<int(PeakIndex.size());++i){
00300       for (int j=0;j<int(PeakIndex.size())-1;++j){
00301         if (dominoEnergy[PeakIndex[j]] < dominoEnergy[PeakIndex[j+1]]){
00302           int ihold = PeakIndex[j+1];
00303           PeakIndex[j+1] = PeakIndex[j];
00304           PeakIndex[j] = ihold;
00305         }
00306       }
00307     }
00308     
00309     std::vector<int> OwnerShip;
00310     std::vector<double> LumpEnergy;
00311     for (int i=0;i<int(dominoEnergy.size());++i) OwnerShip.push_back(-1);
00312     
00313     //Loop over peaks.  
00314     double eThres = eThres_;
00315     double e5x5 = 0.0;
00316     for (int i = 0; i < int(PeakIndex.size()); ++i)
00317     {
00318 
00319       int idxPeak = PeakIndex[i];
00320       OwnerShip[idxPeak] = i;
00321       double lump = dominoEnergy[idxPeak];
00322 
00323       // compute eThres for this peak
00324       // if set to dynamic (otherwise uncanged from
00325       // fixed setting
00326       if (dynamicEThres_) {
00327          // compute e5x5 for this seed crystal
00328          //std::cout << "idxPeak, phiSteps " << idxPeak << ", " << phiSteps << std::endl;
00329          e5x5 = lump;
00330          //std::cout << "lump " << e5x5 << std::endl;
00331          if (abs(idxPeak + 1) < (int)dominoEnergy.size()) e5x5 += dominoEnergy[idxPeak + 1];
00332          //std::cout << "+1 " << e5x5 << std::endl;
00333          if (abs(idxPeak + 2) < (int)dominoEnergy.size()) e5x5 += dominoEnergy[idxPeak + 2];
00334          //std::cout << "+2 " << e5x5 << std::endl;
00335          if (abs(idxPeak - 1) > 0) e5x5 += dominoEnergy[idxPeak - 1];
00336          //std::cout << "-1 " << e5x5 << std::endl;
00337          if (abs(idxPeak - 2) > 0) e5x5 += dominoEnergy[idxPeak - 2];
00338          //std::cout << "-2 " << e5x5 << std::endl;
00339          // compute eThres
00340          eThres = (eThresA_ * e5x5) + eThresB_;   
00341          //std::cout << eThres << std::endl;
00342          //std::cout << std::endl;
00343       }
00344 
00345       //Loop over adjacent dominos at higher phi
00346       for (int j=idxPeak+1;j<int(dominoEnergy.size());++j){
00347         if (OwnerShip[j]==-1 && 
00348             dominoEnergy[j] > eThres
00349             && dominoEnergy[j] < dominoEnergy[j-1]){
00350           OwnerShip[j]= i;
00351           lump+=dominoEnergy[j];
00352         }
00353         else{
00354           break;
00355         }
00356       }
00357       //loop over adjacent dominos at lower phi.  Sum up energy of lumps.
00358       for (int j=idxPeak-1;j>=0;--j){
00359         if (OwnerShip[j]==-1 && 
00360             dominoEnergy[j] > eThres
00361             && dominoEnergy[j] < dominoEnergy[j+1]){
00362           OwnerShip[j]= i;
00363           lump+=dominoEnergy[j];
00364         }
00365         else{
00366           break;
00367         }
00368       }
00369       LumpEnergy.push_back(lump);
00370     }
00371 
00372     //Make the basic clusters:
00373     for (int i=0;i<int(PeakIndex.size());++i){
00374       bool HasSeedCrystal = false;
00375       //One cluster for each peak.
00376       std::vector<EcalRecHit> recHits;
00377       std::vector<DetId> dets;
00378       int nhits=0;
00379       for (int j=0;j<int(dominoEnergy.size());++j){     
00380         if (OwnerShip[j] == i){
00381           std::vector <EcalRecHit> temp = dominoCells[j];
00382           for (int k=0;k<int(temp.size());++k){
00383             dets.push_back(temp[k].id());
00384             if (temp[k].id()==itID)
00385               HasSeedCrystal = true;
00386             recHits.push_back(temp[k]);
00387             nhits++;
00388           }
00389         }  
00390       }
00391       if ( debugLevel_ == pDEBUG ){
00392         std::cout << "Adding a cluster with: " << nhits << std::endl;
00393         std::cout << "total E: " << LumpEnergy[i] << std::endl;
00394         std::cout << "total dets: " << dets.size() << std::endl;
00395       }
00396 
00397       //Get Calorimeter position
00398       Point pos = posCalculator_.Calculate_Location(dets,hits,geometry);
00399  
00400       double totChi2=0;
00401       double totE=0;
00402       std::vector<DetId> usedHits;
00403       for (int blarg=0;blarg<int(recHits.size());++blarg){
00404         totChi2 +=0;
00405         totE+=recHits[blarg].energy();
00406         usedHits.push_back(recHits[blarg].id());
00407         useddetids.insert(recHits[blarg].id());
00408       }
00409       if (totE>0)
00410         totChi2/=totE;
00411       
00412       thisseedClusters.push_back(reco::BasicCluster(LumpEnergy[i],pos,totChi2,usedHits));
00413       if (HasSeedCrystal)
00414         seedClus_.push_back(reco::BasicCluster(LumpEnergy[i],pos,totChi2,usedHits));
00415     }
00416     // Make association so that superclusters can be made later.
00417     // but only if some BasicClusters have been found...
00418     if (thisseedClusters.size() > 0) 
00419     {
00420        clustered_.insert(std::make_pair(clustercounter, thisseedClusters));
00421        clustercounter++;
00422     }
00423 }//Seed loop
00424   delete topo;
00425 }

void HybridClusterAlgo::makeClusters ( const EcalRecHitCollection recColl,
const CaloSubdetectorGeometry geometry,
reco::BasicClusterCollection basicClusters,
bool  regional = false,
const std::vector< EcalEtaPhiRegion > &  regions = std::vector<EcalEtaPhiRegion>() 
)

Definition at line 41 of file HybridClusterAlgo.cc.

References edm::SortedCollection< T, SORT >::begin(), clustered_, GenMuonPlsPt100GeV_cfg::cout, debugLevel_, eb_st, edm::SortedCollection< T, SORT >::end(), lat::endl(), ET, CaloCellGeometry::getPosition(), int, it, j, mainSearch(), pDEBUG, recHits_, seedClus_, seeds, funct::sin(), python::multivaluedict::sort(), PV3DBase< T, PVType, FrameType >::theta(), and useddetids.

Referenced by HybridClusterProducer::produce(), and EgammaHLTHybridClusterProducer::produce().

00046 {
00047 
00048   //clear vector of seeds
00049   seeds.clear();
00050   //clear map of supercluster/basiccluster association
00051   clustered_.clear();
00052   //clear set of used detids
00053   useddetids.clear();
00054   //clear vector of seed clusters
00055   seedClus_.clear();
00056   //Pass in a pointer to the collection.
00057   recHits_ = recColl;
00058   
00059   //
00060   //  SCShape_ = new SuperClusterShapeAlgo(recHits_, geometry);
00061 
00062   if ( debugLevel_ == pDEBUG ) {
00063   std::cout << "Cleared vectors, starting clusterization..." << std::endl;
00064   }
00065 
00066   int nregions=0;
00067   if(regional) nregions=regions.size();
00068 
00069   if(!regional || nregions) {
00070 
00071     EcalRecHitCollection::const_iterator it;
00072 
00073     for (it = recHits_->begin(); it != recHits_->end(); it++){
00074     
00075       //Make the vector of seeds that we're going to use.
00076       //One of the few places position is used, needed for ET calculation.    
00077       const CaloCellGeometry *this_cell = (*geometry).getGeometry(it->id());
00078       GlobalPoint position = this_cell->getPosition();
00079       
00080       // Require that RecHit is within clustering region in case
00081       // of regional reconstruction
00082       bool withinRegion = false;
00083       if (regional) {
00084         std::vector<EcalEtaPhiRegion>::const_iterator region;
00085         for (region=regions.begin(); region!=regions.end(); region++) {
00086           if (region->inRegion(position)) {
00087             withinRegion =  true;
00088             break;
00089           }
00090         }
00091       }
00092       
00093       if (!regional || withinRegion) {
00094         float ET = it->energy() * sin(position.theta());
00095 
00096         //Must pass seed threshold.
00097         if (ET > eb_st){
00098           seeds.push_back(*it);
00099           if ( debugLevel_ == pDEBUG ){
00100             std::cout << "Seed ET: " << ET << std::endl;
00101             std::cout << "Seed E: " << it->energy() << std::endl;
00102           }
00103         }
00104       }
00105     }
00106     
00107   }
00108   
00109 
00110   //Yay sorting.
00111   if ( debugLevel_ == pDEBUG )
00112     std::cout << "Built vector of seeds, about to sort them...";
00113   
00114   //Needs three argument sort with seed comparison operator
00115   sort(seeds.begin(), seeds.end(), less_mag());
00116   
00117   if ( debugLevel_ == pDEBUG )
00118     std::cout << "done" << std::endl;
00119 
00120   //Now to do the work.
00121   if ( debugLevel_ ==pDEBUG ) 
00122     std::cout << "About to call mainSearch...";
00123   mainSearch(recColl,geometry);
00124   if ( debugLevel_ == pDEBUG ) 
00125     std::cout << "done" << std::endl;
00126   
00127   //Hand the basicclusters back to the producer.  It has to 
00128   //put them in the event.  Then we can make superclusters.
00129   std::map<int, reco::BasicClusterCollection>::iterator bic; 
00130   for (bic= clustered_.begin();bic!=clustered_.end();bic++){
00131     reco::BasicClusterCollection bl = bic->second;
00132     for (int j=0;j<int(bl.size());++j){
00133       basicClusters.push_back(bl[j]);
00134     }
00135   }
00136 
00137   //Yay more sorting.
00138   sort(basicClusters.rbegin(), basicClusters.rend(), ClusterEtLess() );
00139   //Done!
00140   if ( debugLevel_ == pDEBUG )
00141     std::cout << "returning to producer. " << std::endl;
00142 }

double HybridClusterAlgo::makeDomino ( EcalBarrelNavigator navigator,
std::vector< EcalRecHit > &  cells 
)

Definition at line 514 of file HybridClusterAlgo.cc.

References CaloNavigator< T >::east(), edm::SortedCollection< T, SORT >::end(), CaloRecHit::energy(), Ewing, edm::SortedCollection< T, SORT >::find(), CaloNavigator< T >::home(), CaloNavigator< T >::pos(), recHits_, useddetids, and CaloNavigator< T >::west().

Referenced by mainSearch().

00515 {
00516   //At the beginning of this function, the navigator starts at the middle of the domino,
00517   //and that's where EcalBarrelNavigator::home() should send it.
00518   //Walk one crystal in eta to either side of the initial point.  Sum the three cell energies.
00519   //If the resultant energy is larger than Ewing, then go an additional cell to either side.
00520   //Returns:  Total domino energy.  Also, stores the cells used to create domino in the vector.
00521   cells.clear();
00522   double Etot = 0;
00523 
00524   //Ready?  Get the starting cell.
00525   DetId center = navigator.pos();
00526   EcalRecHitCollection::const_iterator center_it = recHits_->find(center);
00527   
00528   if (center_it!=recHits_->end()){
00529     EcalRecHit SeedHit = *center_it;
00530     if (useddetids.find(center) == useddetids.end()){ 
00531       Etot += SeedHit.energy();
00532       cells.push_back(SeedHit);
00533     }
00534   }
00535   //One step upwards in Ieta:
00536   DetId ieta1 = navigator.west();
00537   EcalRecHitCollection::const_iterator eta1_it = recHits_->find(ieta1);
00538   if (eta1_it !=recHits_->end()){
00539     EcalRecHit UpEta = *eta1_it;
00540     if (useddetids.find(ieta1) == useddetids.end()){
00541       Etot+=UpEta.energy();
00542       cells.push_back(UpEta);
00543     }
00544   }
00545   
00546   //Go back to the middle.
00547   navigator.home();
00548   
00549   //One step downwards in Ieta:
00550   DetId ieta2 = navigator.east();
00551   EcalRecHitCollection::const_iterator eta2_it = recHits_->find(ieta2);
00552   if (eta2_it !=recHits_->end()){
00553     EcalRecHit DownEta = *eta2_it;
00554     if (useddetids.find(ieta2)==useddetids.end()){
00555       Etot+=DownEta.energy();
00556       cells.push_back(DownEta);
00557     }
00558   }
00559   
00560   //Now check the energy.  If smaller than Ewing, then we're done.  If greater than Ewing, we have to
00561   //add two additional cells, the 'wings'
00562   if (Etot < Ewing) {
00563     navigator.home(); //Needed even here!!
00564     return Etot;  //Done!  Not adding 'wings'.
00565   }
00566   
00567   //Add the extra 'wing' cells.  Remember, we haven't sent the navigator home,
00568   //we're still on the DownEta cell.
00569   if (ieta2 != DetId(0)){
00570     DetId ieta3 = navigator.east(); //Take another step downward.
00571     EcalRecHitCollection::const_iterator eta3_it = recHits_->find(ieta3);
00572     if (eta3_it != recHits_->end()){
00573       EcalRecHit DownEta2 = *eta3_it;
00574       if (useddetids.find(ieta3)==useddetids.end()){
00575         Etot+=DownEta2.energy();
00576         cells.push_back(DownEta2);
00577       }
00578     }
00579   }
00580   //Now send the navigator home.
00581   navigator.home();
00582   navigator.west(); //Now you're on eta1_it
00583   if (ieta1 != DetId(0)){
00584     DetId ieta4 = navigator.west(); //Take another step upward.
00585     EcalRecHitCollection::const_iterator eta4_it = recHits_->find(ieta4);
00586     if (eta4_it != recHits_->end()){
00587       EcalRecHit UpEta2 = *eta4_it;
00588       if (useddetids.find(ieta4) == useddetids.end()){
00589         Etot+=UpEta2.energy();
00590         cells.push_back(UpEta2);
00591       }
00592     }
00593   }
00594   navigator.home();
00595   return Etot;
00596 }

reco::SuperClusterCollection HybridClusterAlgo::makeSuperClusters ( const reco::BasicClusterRefVector clustersCollection  ) 

Definition at line 427 of file HybridClusterAlgo.cc.

References clustered_, GenMuonPlsPt100GeV_cfg::cout, debugLevel_, lat::endl(), relval_parameters_module::energy, reco::CaloCluster::energy(), i, j, pDEBUG, reco::CaloCluster::position(), edm::RefVector< C, T, F >::push_back(), edm::RefVector< C, T, F >::size(), and python::multivaluedict::sort().

Referenced by HybridClusterProducer::produce(), and EgammaHLTHybridClusterProducer::produce().

00428 {
00429   //Here's what we'll return.
00430   reco::SuperClusterCollection SCcoll;
00431 
00432   //Here's our map iterator that gives us the appropriate association.
00433   std::map<int, reco::BasicClusterCollection>::iterator mapit;
00434   for (mapit = clustered_.begin();mapit!=clustered_.end();mapit++){
00435  
00436     reco::BasicClusterRefVector thissc;
00437     reco::BasicClusterRef seed;//This is not really a seed, but I need to tell SuperCluster something.
00438                                //So I choose the highest energy basiccluster in the SuperCluster.
00439     
00440     std::vector <reco::BasicCluster> thiscoll = mapit->second; //This is the set of BasicClusters in this
00441                                                                //SuperCluster
00442 
00443     double ClusterE = 0; //Sum of cluster energies for supercluster.
00444     //Holders for position of this supercluster.
00445     double posX=0;
00446     double posY=0;
00447     double posZ=0;
00448 
00449     //Loop over this set of basic clusters, find their references, and add them to the
00450     //supercluster.  This could be somehow more efficient.
00451 
00452     double seedE = 0;
00453     for (size_t i = 0; i < thiscoll.size(); ++i) 
00454     {
00455        //The BasicCluster in question.
00456        reco::BasicCluster thisclus = thiscoll[i];
00457 
00458        for (size_t j = 0; j < clustersCollection.size(); ++j)
00459        {
00460           //Find the appropriate cluster from the list of references
00461           reco::BasicCluster cluster_p = *clustersCollection[j];
00462           if (thisclus == cluster_p)
00463           {
00464              thissc.push_back(clustersCollection[j]);
00465 
00466              // the highest energy basic cluster is the seed
00467              if (clustersCollection[j]->energy() > seedE)
00468              {
00469                 seed = clustersCollection[j];
00470                 seedE = clustersCollection[j]->energy();
00471              }
00472 
00473              ClusterE += cluster_p.energy();
00474              posX += cluster_p.energy() * cluster_p.position().X();
00475              posY += cluster_p.energy() * cluster_p.position().Y();
00476              posZ += cluster_p.energy() * cluster_p.position().Z();
00477                                                                      
00478         } //End loop over 
00479 
00480       }//End loop over finding references.
00481 
00482     }//End loop over clusters.
00483 
00484     posX /= ClusterE;
00485     posY /= ClusterE;
00486     posZ /= ClusterE;
00487 
00488     /* //This part is moved to EgammaSCEnergyCorrectionAlgo
00489     double preshowerE = 0.;
00490     double phiWidth = 0.;
00491     double etaWidth = 0.;
00492     //Calculate phiWidth & etaWidth for SuperClusters
00493     reco::SuperCluster suCl(ClusterE, math::XYZPoint(posX, posY, posZ), seed, thissc, preshowerE, phiWidth, etaWidth);
00494     SCShape_->Calculate_Covariances(suCl);
00495     phiWidth = SCShape_->phiWidth();
00496     etaWidth = SCShape_->etaWidth();
00497     //Assign phiWidth & etaWidth to SuperCluster as data members
00498     suCl.setPhiWidth(phiWidth);
00499     suCl.setEtaWidth(etaWidth);
00500     */
00501 
00502     reco::SuperCluster suCl(ClusterE, math::XYZPoint(posX, posY, posZ), seed, thissc);
00503     SCcoll.push_back(suCl);
00504     
00505     if ( debugLevel_ == pDEBUG ){
00506       std::cout << "Super cluster sum: " << ClusterE << std::endl;
00507       std::cout << "Made supercluster with energy E: " << suCl.energy() << std::endl;
00508     }
00509   }//end loop over map
00510   sort(SCcoll.rbegin(), SCcoll.rend(), ClusterEtLess());
00511   return SCcoll;
00512 }

void HybridClusterAlgo::setDynamicPhiRoad ( const edm::ParameterSet bremRecoveryPset  )  [inline]

Definition at line 126 of file HybridClusterAlgo.h.

References dynamicPhiRoad_, and phiRoadAlgo_.

Referenced by HybridClusterProducer::HybridClusterProducer().

00127   {
00128      dynamicPhiRoad_ = true;
00129      phiRoadAlgo_ = new BremRecoveryPhiRoadAlgo(bremRecoveryPset);
00130   }


Member Data Documentation

std::map<int, std::vector<reco::BasicCluster> > HybridClusterAlgo::clustered_ [private]

Definition at line 91 of file HybridClusterAlgo.h.

Referenced by mainSearch(), makeClusters(), and makeSuperClusters().

int HybridClusterAlgo::debugLevel_ [private]

Definition at line 94 of file HybridClusterAlgo.h.

Referenced by HybridClusterAlgo(), mainSearch(), makeClusters(), and makeSuperClusters().

bool HybridClusterAlgo::dynamicEThres_ [private]

Definition at line 66 of file HybridClusterAlgo.h.

Referenced by mainSearch().

bool HybridClusterAlgo::dynamicPhiRoad_ [private]

Definition at line 63 of file HybridClusterAlgo.h.

Referenced by HybridClusterAlgo(), mainSearch(), setDynamicPhiRoad(), and ~HybridClusterAlgo().

double HybridClusterAlgo::eb_st [private]

Definition at line 36 of file HybridClusterAlgo.h.

Referenced by makeClusters().

double HybridClusterAlgo::Eseed [private]

Definition at line 57 of file HybridClusterAlgo.h.

Referenced by mainSearch().

double HybridClusterAlgo::eThres_ [private]

Definition at line 52 of file HybridClusterAlgo.h.

Referenced by mainSearch().

double HybridClusterAlgo::eThresA_ [private]

Definition at line 53 of file HybridClusterAlgo.h.

Referenced by mainSearch().

double HybridClusterAlgo::eThresB_ [private]

Definition at line 54 of file HybridClusterAlgo.h.

Referenced by mainSearch().

double HybridClusterAlgo::Ewing [private]

Definition at line 60 of file HybridClusterAlgo.h.

Referenced by makeDomino().

const CaloSubdetectorGeometry* HybridClusterAlgo::geometry [private]

Definition at line 77 of file HybridClusterAlgo.h.

BremRecoveryPhiRoadAlgo* HybridClusterAlgo::phiRoadAlgo_ [private]

Definition at line 49 of file HybridClusterAlgo.h.

Referenced by mainSearch(), setDynamicPhiRoad(), and ~HybridClusterAlgo().

int HybridClusterAlgo::phiSteps_ [private]

Definition at line 41 of file HybridClusterAlgo.h.

Referenced by mainSearch().

PositionCalc HybridClusterAlgo::posCalculator_ [private]

Definition at line 97 of file HybridClusterAlgo.h.

Referenced by et25(), HybridClusterAlgo(), and mainSearch().

const EcalRecHitCollection* HybridClusterAlgo::recHits_ [private]

Definition at line 73 of file HybridClusterAlgo.h.

Referenced by et25(), makeClusters(), and makeDomino().

std::vector<reco::BasicCluster> HybridClusterAlgo::seedClus_ [private]

Definition at line 88 of file HybridClusterAlgo.h.

Referenced by mainSearch(), and makeClusters().

std::vector<EcalRecHit> HybridClusterAlgo::seeds [private]

Definition at line 85 of file HybridClusterAlgo.h.

Referenced by mainSearch(), and makeClusters().

std::set<DetId> HybridClusterAlgo::useddetids [private]

Definition at line 82 of file HybridClusterAlgo.h.

Referenced by mainSearch(), makeClusters(), and makeDomino().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:24:49 2009 for CMSSW by  doxygen 1.5.4