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 9 of file EgammaHadTower.cc.

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

9  :mode_(mode) {
11  es.get<IdealGeometryRecord>().get(ctmaph);
12  towerMap_ = &(*ctmaph);
13  NMaxClusters_ = 4;
14 }
const CaloTowerConstituentsMap * towerMap_
const T & get() const
Definition: EventSetup.h:55
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 102 of file EgammaHadTower.cc.

References towersOf().

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

102  {
103  return getDepth1HcalESum(towersOf(sc)) ;
104 }
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 76 of file EgammaHadTower.cc.

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

76  {
77  double esum=0.;
80  for( ; trItr != trItrEnd ; ++trItr){
81  std::vector<CaloTowerDetId>::const_iterator itcheck = find(towers.begin(), towers.end(), trItr->id());
82  if( itcheck != towers.end() ) {
83  esum += trItr->ietaAbs()<18 || trItr->ietaAbs()>29 ? trItr->hadEnergy() : trItr->hadEnergyHeInnerLayer() ;
84  }
85  }
86  return esum;
87 }
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 106 of file EgammaHadTower.cc.

References towersOf().

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

106  {
107  return getDepth2HcalESum(towersOf(sc)) ;
108 }
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 89 of file EgammaHadTower.cc.

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

89  {
90  double esum=0.;
93  for( ; trItr != trItrEnd ; ++trItr){
94  std::vector<CaloTowerDetId>::const_iterator itcheck = find(towers.begin(), towers.end(), trItr->id());
95  if( itcheck != towers.end() ) {
96  esum += trItr->hadEnergyHeOuterLayer();
97  }
98  }
99  return esum;
100 }
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 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().

16  {
17  DetId detid = cluster.seed();
18  if(detid.det() != DetId::Ecal) {
19  // Basic clusters of hybrid super-cluster do not have the seed set; take the first DetId instead
20  // Should be checked . The single Tower Mode should be favoured until fixed
21  detid = cluster.hitsAndFractions()[0].first;
22  if(detid.det() != DetId::Ecal) {
23  CaloTowerDetId tower;
24  return tower;
25  }
26  }
27  CaloTowerDetId id(towerMap_->towerOf(detid));
28  return id;
29 }
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 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(), HLT_25ns14e33_v1_cff::towers, and TowersBehindCluster.

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

31  {
32  std::vector<CaloTowerDetId> towers;
33  std::vector<reco::CaloClusterPtr> orderedClusters;
34 
35  // in this mode, check only the tower behind the seed
36  if ( mode_ == SingleTower ) {
37  towers.push_back(towerOf(*sc.seed()));
38  }
39 
40  // in this mode check the towers behind each basic cluster
41  if ( mode_ == TowersBehindCluster ) {
42  // Loop on the basic clusters
45 
46  for ( ; it !=itend; ++it) {
47  orderedClusters.push_back(*it);
48  }
49  std::sort(orderedClusters.begin(),orderedClusters.end(),ClusterGreaterThan);
50  unsigned nclusters=orderedClusters.size();
51  for ( unsigned iclus =0 ; iclus <nclusters && iclus < NMaxClusters_; ++iclus) {
52  // Get the tower
53  CaloTowerDetId id = towerOf(*(orderedClusters[iclus]));
54  std::vector<CaloTowerDetId>::const_iterator itcheck=find(towers.begin(),towers.end(),id);
55  if( itcheck == towers.end() ) {
56  towers.push_back(id);
57  }
58  }
59  }
60 // if(towers.size() > 4) {
61 // std::cout << " NTOWERS " << towers.size() << " ";
62 // for(unsigned i=0; i<towers.size() ; ++i) {
63 // std::cout << towers[i] << " ";
64 // }
65 // std::cout << std::endl;
66 // for ( unsigned iclus=0 ; iclus < orderedClusters.size(); ++iclus) {
67 // // Get the tower
68 // CaloTowerDetId id = towerOf(*(orderedClusters[iclus]));
69 // std::cout << " Pos " << orderedClusters[iclus]->position() << " " << orderedClusters[iclus]->energy() << " " << id ;
70 // }
71 // std::cout << std::endl;
72 // }
73  return towers;
74 }
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().