CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
EgammaHadTower Class Reference

#include <EgammaHadTower.h>

Public Types

enum  HoeMode { SingleTower =0, TowersBehindCluster =1 }
 

Public Member Functions

 EgammaHadTower (const edm::EventSetup &es, HoeMode mode=SingleTower)
 
double getDepth1HcalESum (const reco::SuperCluster &sc) const
 
double getDepth1HcalESum (const std::vector< CaloTowerDetId > &towers) 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 10 of file EgammaHadTower.cc.

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

10  :mode_(mode) {
12  es.get<CaloGeometryRecord>().get(ctmaph);
13  towerMap_ = &(*ctmaph);
14  NMaxClusters_ = 4;
15 }
const CaloTowerConstituentsMap * towerMap_
const T & get() const
Definition: EventSetup.h:56
unsigned int NMaxClusters_
EgammaHadTower::~EgammaHadTower ( )
inline

Definition at line 21 of file EgammaHadTower.h.

21 {;}

Member Function Documentation

double EgammaHadTower::getDepth1HcalESum ( const reco::SuperCluster sc) const

Definition at line 103 of file EgammaHadTower.cc.

References towersOf().

Referenced by PhotonProducer::fillPhotonCollection(), GEDPhotonProducer::fillPhotonCollection(), and ElectronHcalHelper::hcalESumDepth1BehindClusters().

103  {
104  return getDepth1HcalESum(towersOf(sc)) ;
105 }
double getDepth1HcalESum(const reco::SuperCluster &sc) const
std::vector< CaloTowerDetId > towersOf(const reco::SuperCluster &sc) const
double EgammaHadTower::getDepth1HcalESum ( const std::vector< CaloTowerDetId > &  towers) const

Definition at line 77 of file EgammaHadTower.cc.

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

77  {
78  double esum=0.;
81  for( ; trItr != trItrEnd ; ++trItr){
82  std::vector<CaloTowerDetId>::const_iterator itcheck = find(towers.begin(), towers.end(), trItr->id());
83  if( itcheck != towers.end() ) {
84  esum += trItr->ietaAbs()<18 || trItr->ietaAbs()>29 ? trItr->hadEnergy() : trItr->hadEnergyHeInnerLayer() ;
85  }
86  }
87  return esum;
88 }
const CaloTowerCollection * towerCollection_
std::vector< CaloTower >::const_iterator const_iterator
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const_iterator end() const
const_iterator begin() const
double EgammaHadTower::getDepth2HcalESum ( const reco::SuperCluster sc) const

Definition at line 107 of file EgammaHadTower.cc.

References towersOf().

Referenced by PhotonProducer::fillPhotonCollection(), GEDPhotonProducer::fillPhotonCollection(), and ElectronHcalHelper::hcalESumDepth2BehindClusters().

107  {
108  return getDepth2HcalESum(towersOf(sc)) ;
109 }
std::vector< CaloTowerDetId > towersOf(const reco::SuperCluster &sc) const
double getDepth2HcalESum(const reco::SuperCluster &sc) const
double EgammaHadTower::getDepth2HcalESum ( const std::vector< CaloTowerDetId > &  towers) const

Definition at line 90 of file EgammaHadTower.cc.

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

90  {
91  double esum=0.;
94  for( ; trItr != trItrEnd ; ++trItr){
95  std::vector<CaloTowerDetId>::const_iterator itcheck = find(towers.begin(), towers.end(), trItr->id());
96  if( itcheck != towers.end() ) {
97  esum += trItr->hadEnergyHeOuterLayer();
98  }
99  }
100  return esum;
101 }
const CaloTowerCollection * towerCollection_
std::vector< CaloTower >::const_iterator const_iterator
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const_iterator end() const
const_iterator begin() const
void EgammaHadTower::setTowerCollection ( const CaloTowerCollection towercollection)
CaloTowerDetId EgammaHadTower::towerOf ( const reco::CaloCluster cluster) const

Definition at line 17 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().

17  {
18  DetId detid = cluster.seed();
19  if(detid.det() != DetId::Ecal) {
20  // Basic clusters of hybrid super-cluster do not have the seed set; take the first DetId instead
21  // Should be checked . The single Tower Mode should be favoured until fixed
22  detid = cluster.hitsAndFractions()[0].first;
23  if(detid.det() != DetId::Ecal) {
24  CaloTowerDetId tower;
25  return tower;
26  }
27  }
28  CaloTowerDetId id(towerMap_->towerOf(detid));
29  return id;
30 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:192
CaloTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
const CaloTowerConstituentsMap * towerMap_
Definition: DetId.h:18
DetId seed() const
return DetId of seed
Definition: CaloCluster.h:202
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
std::vector< CaloTowerDetId > EgammaHadTower::towersOf ( const reco::SuperCluster sc) const

Definition at line 32 of file EgammaHadTower.cc.

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

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

32  {
33  std::vector<CaloTowerDetId> towers;
34  std::vector<reco::CaloClusterPtr> orderedClusters;
35 
36  // in this mode, check only the tower behind the seed
37  if ( mode_ == SingleTower ) {
38  towers.push_back(towerOf(*sc.seed()));
39  }
40 
41  // in this mode check the towers behind each basic cluster
42  if ( mode_ == TowersBehindCluster ) {
43  // Loop on the basic clusters
46 
47  for ( ; it !=itend; ++it) {
48  orderedClusters.push_back(*it);
49  }
50  std::sort(orderedClusters.begin(),orderedClusters.end(),ClusterGreaterThan);
51  unsigned nclusters=orderedClusters.size();
52  for ( unsigned iclus =0 ; iclus <nclusters && iclus < NMaxClusters_; ++iclus) {
53  // Get the tower
54  CaloTowerDetId id = towerOf(*(orderedClusters[iclus]));
55  std::vector<CaloTowerDetId>::const_iterator itcheck=find(towers.begin(),towers.end(),id);
56  if( itcheck == towers.end() ) {
57  towers.push_back(id);
58  }
59  }
60  }
61 // if(towers.size() > 4) {
62 // std::cout << " NTOWERS " << towers.size() << " ";
63 // for(unsigned i=0; i<towers.size() ; ++i) {
64 // std::cout << towers[i] << " ";
65 // }
66 // std::cout << std::endl;
67 // for ( unsigned iclus=0 ; iclus < orderedClusters.size(); ++iclus) {
68 // // Get the tower
69 // CaloTowerDetId id = towerOf(*(orderedClusters[iclus]));
70 // std::cout << " Pos " << orderedClusters[iclus]->position() << " " << orderedClusters[iclus]->energy() << " " << id ;
71 // }
72 // std::cout << std::endl;
73 // }
74  return towers;
75 }
CaloTowerDetId towerOf(const reco::CaloCluster &cluster) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
bool ClusterGreaterThan(const reco::CaloClusterPtr &c1, const reco::CaloClusterPtr &c2)
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:75
unsigned int NMaxClusters_
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:66
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:78

Member Data Documentation

HoeMode EgammaHadTower::mode_
private

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().

const CaloTowerCollection* EgammaHadTower::towerCollection_
private

Definition at line 33 of file EgammaHadTower.h.

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

const CaloTowerConstituentsMap* EgammaHadTower::towerMap_
private

Definition at line 31 of file EgammaHadTower.h.

Referenced by EgammaHadTower(), and towerOf().