CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

EgammaHadTower Class Reference

#include <EgammaHadTower.h>

List of all members.

Public Types

enum  HoeMode { SingleTower = 0, TowersBehindCluster = 1 }

Public Member Functions

 EgammaHadTower (const edm::EventSetup &es, HoeMode mode=SingleTower)
double getDepth1HcalESum (const std::vector< CaloTowerDetId > &towers) const
double getDepth1HcalESum (const reco::SuperCluster &sc) const
double getDepth2HcalESum (const reco::SuperCluster &sc) const
double getDepth2HcalESum (const std::vector< CaloTowerDetId > &towers) const
void setTowerCollection (const CaloTowerCollection *towercollection)
CaloTowerDetId towerOf (const reco::CaloCluster &cluster) const
std::vector< CaloTowerDetIdtowersOf (const reco::SuperCluster &sc) const
 ~EgammaHadTower ()

Private Attributes

HoeMode mode_
unsigned int NMaxClusters_
const CaloTowerCollectiontowerCollection_
const CaloTowerConstituentsMaptowerMap_

Detailed Description

Definition at line 15 of file EgammaHadTower.h.


Member Enumeration Documentation

Enumerator:
SingleTower 
TowersBehindCluster 

Definition at line 18 of file EgammaHadTower.h.


Constructor & Destructor Documentation

EgammaHadTower::EgammaHadTower ( const edm::EventSetup es,
HoeMode  mode = SingleTower 
)

Definition at line 9 of file EgammaHadTower.cc.

References edm::EventSetup::get(), NMaxClusters_, and towerMap_.

EgammaHadTower::~EgammaHadTower ( ) [inline]

Definition at line 21 of file EgammaHadTower.h.

{;}

Member Function Documentation

double EgammaHadTower::getDepth1HcalESum ( const reco::SuperCluster sc) const
double EgammaHadTower::getDepth1HcalESum ( const std::vector< CaloTowerDetId > &  towers) const

Definition at line 76 of file EgammaHadTower.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), spr::find(), and towerCollection_.

                                                                                       {
  double esum=0.;
  CaloTowerCollection::const_iterator trItr = towerCollection_->begin();
  CaloTowerCollection::const_iterator trItrEnd = towerCollection_->end();
  for( ;  trItr != trItrEnd ; ++trItr){
    std::vector<CaloTowerDetId>::const_iterator itcheck = find(towers.begin(), towers.end(), trItr->id());
    if( itcheck != towers.end() ) {
      esum += trItr->ietaAbs()<18 || trItr->ietaAbs()>29 ? trItr->hadEnergy() : trItr->hadEnergyHeInnerLayer() ;
    }
  }
  return esum;
}
double EgammaHadTower::getDepth2HcalESum ( const reco::SuperCluster sc) const
double EgammaHadTower::getDepth2HcalESum ( const std::vector< CaloTowerDetId > &  towers) const

Definition at line 89 of file EgammaHadTower.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), spr::find(), and towerCollection_.

                                                                                       {
  double esum=0.;
  CaloTowerCollection::const_iterator trItr = towerCollection_->begin();
  CaloTowerCollection::const_iterator trItrEnd = towerCollection_->end();
  for( ;  trItr != trItrEnd ; ++trItr){
    std::vector<CaloTowerDetId>::const_iterator itcheck = find(towers.begin(), towers.end(), trItr->id());
    if( itcheck != towers.end() ) {
      esum += trItr->hadEnergyHeOuterLayer();
    }
  }
  return esum;
}
void EgammaHadTower::setTowerCollection ( const CaloTowerCollection towercollection)

Definition at line 110 of file EgammaHadTower.cc.

References towerCollection_.

Referenced by PhotonProducer::fillPhotonCollection(), and ElectronHcalHelper::readEvent().

                                                                                  {
  towerCollection_ = towerCollection;
}
CaloTowerDetId EgammaHadTower::towerOf ( const reco::CaloCluster cluster) const

Definition at line 16 of file EgammaHadTower.cc.

References DetId::det(), cond::rpcobgas::detid, DetId::Ecal, reco::CaloCluster::hitsAndFractions(), reco::CaloCluster::seed(), towerMap_, and CaloTowerConstituentsMap::towerOf().

Referenced by towersOf().

                                                                            {
  DetId detid = cluster.seed();
  if(detid.det() != DetId::Ecal) {
    // Basic clusters of hybrid super-cluster do not have the seed set; take the first DetId instead 
    // Should be checked . The single Tower Mode should be favoured until fixed
    detid = cluster.hitsAndFractions()[0].first;
    if(detid.det() != DetId::Ecal) {
      CaloTowerDetId tower;
      return tower;
    }
  }
  CaloTowerDetId id(towerMap_->towerOf(detid));
  return id;
}
std::vector< CaloTowerDetId > EgammaHadTower::towersOf ( const reco::SuperCluster sc) const

Definition at line 31 of file EgammaHadTower.cc.

References ClusterGreaterThan(), reco::SuperCluster::clustersBegin(), reco::SuperCluster::clustersEnd(), spr::find(), mode_, NMaxClusters_, reco::SuperCluster::seed(), SingleTower, python::multivaluedict::sort(), towerOf(), and TowersBehindCluster.

Referenced by PhotonProducer::fillPhotonCollection(), getDepth1HcalESum(), getDepth2HcalESum(), and ElectronHcalHelper::hcalTowersBehindClusters().

                                                                                    {
  std::vector<CaloTowerDetId> towers;
  std::vector<reco::CaloClusterPtr>  orderedClusters;

  // in this mode, check only the tower behind the seed
  if ( mode_ == SingleTower ) {
    towers.push_back(towerOf(*sc.seed()));
  }

  // in this mode check the towers behind each basic cluster
  if ( mode_ == TowersBehindCluster ) {
    // Loop on the basic clusters
    reco::CaloCluster_iterator it = sc.clustersBegin();
    reco::CaloCluster_iterator itend = sc.clustersEnd();

    for ( ; it !=itend; ++it) {
      orderedClusters.push_back(*it);
    }
    std::sort(orderedClusters.begin(),orderedClusters.end(),ClusterGreaterThan);
    unsigned nclusters=orderedClusters.size();
    for ( unsigned iclus =0 ; iclus <nclusters && iclus < NMaxClusters_; ++iclus) {
      // Get the tower
      CaloTowerDetId id = towerOf(*(orderedClusters[iclus]));
      std::vector<CaloTowerDetId>::const_iterator itcheck=find(towers.begin(),towers.end(),id);
      if( itcheck == towers.end() ) {
        towers.push_back(id);
      }
    }
  }
//  if(towers.size() > 4) {
//    std::cout << " NTOWERS " << towers.size() << " ";
//    for(unsigned i=0; i<towers.size() ; ++i) {
//      std::cout << towers[i] << " ";
//    }
//    std::cout <<  std::endl;
//    for ( unsigned iclus=0 ; iclus < orderedClusters.size(); ++iclus) {
//      // Get the tower
//      CaloTowerDetId id = towerOf(*(orderedClusters[iclus]));
//      std::cout << " Pos " << orderedClusters[iclus]->position() << " " << orderedClusters[iclus]->energy() << " " << id ;
//    }
//    std::cout << std::endl;
//  }
  return towers;
}

Member Data Documentation

Definition at line 32 of file EgammaHadTower.h.

Referenced by towersOf().

unsigned int EgammaHadTower::NMaxClusters_ [private]

Definition at line 34 of file EgammaHadTower.h.

Referenced by EgammaHadTower(), and towersOf().

Definition at line 33 of file EgammaHadTower.h.

Referenced by getDepth1HcalESum(), getDepth2HcalESum(), and setTowerCollection().

Definition at line 31 of file EgammaHadTower.h.

Referenced by EgammaHadTower(), and towerOf().