CMS 3D CMS Logo

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

#include <CaloTowerConstituentsMap.h>

Classes

struct  MapItem
 

Public Member Functions

void assign (const DetId &cell, const CaloTowerDetId &tower)
 set the association between a DetId and a tower More...
 
 CaloTowerConstituentsMap (const HcalTopology *topology)
 
std::vector< DetIdconstituentsOf (const CaloTowerDetId &id) const
 Get the constituent detids for this tower id ( not yet implemented ) More...
 
void sort ()
 done adding to the association More...
 
CaloTowerDetId towerOf (const DetId &id) const
 Get the tower id for this det id (or null if not known) More...
 
void useStandardEB (bool use=true)
 add standard (hardcoded) EB items? More...
 
void useStandardHB (bool use=true)
 add standard (hardcoded) HB items? More...
 
void useStandardHE (bool use=true)
 add standard (hardcoded) HE items? More...
 
void useStandardHF (bool use=true)
 add standard (hardcoded) HF items? More...
 
void useStandardHO (bool use=true)
 add standard (hardcoded) HO items? More...
 

Private Attributes

edm::SortedCollection< MapItemm_items
 
std::multimap< CaloTowerDetId,
DetId
m_reverseItems
 
const HcalTopologym_topology
 
bool standardEB_
 
bool standardHB_
 
bool standardHE_
 
bool standardHF_
 
bool standardHO_
 

Detailed Description

Date:
2012/08/15 14:56:18
Revision:
1.4
Author
J. Mans - Minnesota

Definition at line 18 of file CaloTowerConstituentsMap.h.

Constructor & Destructor Documentation

CaloTowerConstituentsMap::CaloTowerConstituentsMap ( const HcalTopology topology)

Member Function Documentation

void CaloTowerConstituentsMap::assign ( const DetId cell,
const CaloTowerDetId tower 
)

set the association between a DetId and a tower

Definition at line 47 of file CaloTowerConstituentsMap.cc.

References edm::hlt::Exception, m_items, and DetId::rawId().

Referenced by CaloTowerConstituentsMapBuilder::parseTextMap().

47  {
48  if (m_items.find(cell)!=m_items.end()) {
49  throw cms::Exception("CaloTowers") << "Cell with id " << std::hex << cell.rawId() << std::dec << " is already mapped to a CaloTower " << m_items.find(cell)->tower << std::endl;
50  }
51  m_items.push_back(MapItem(cell,tower));
52 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
edm::SortedCollection< MapItem > m_items
std::vector< DetId > CaloTowerConstituentsMap::constituentsOf ( const CaloTowerDetId id) const

Get the constituent detids for this tower id ( not yet implemented )

copy from the items map

Definition at line 58 of file CaloTowerConstituentsMap.cc.

References HcalDetId::crystal_ieta_high(), HcalDetId::crystal_ieta_low(), HcalDetId::crystal_iphi_high(), HcalDetId::crystal_iphi_low(), HcalTopology::depthBinInformation(), jptDQMConfig_cff::etaMax, jptDQMConfig_cff::etaMin, HcalTopology::firstHERing(), HcalTopology::firstHFRing(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, i, j, HcalTopology::lastHBRing(), HcalTopology::lastHERing(), HcalTopology::lastHFRing(), HcalTopology::lastHORing(), m_items, m_reverseItems, m_topology, EBDetId::MAX_IETA, sd, standardEB_, standardHB_, standardHE_, standardHF_, standardHO_, and HcalDetId::zside().

Referenced by CaloTowersCreationAlgo::convert(), PFHCALDualTimeRecHitProducer::createRecHits(), and PFRecHitProducerHCAL::createRecHits().

58  {
59  std::vector<DetId> items;
60 
61  // build reverse map if needed
62  if (!m_items.empty() && m_reverseItems.empty()) {
64  m_reverseItems.insert(std::pair<CaloTowerDetId,DetId>(i->tower,i->cell));
65  }
66 
68  std::multimap<CaloTowerDetId,DetId>::const_iterator j;
69  std::pair<std::multimap<CaloTowerDetId,DetId>::const_iterator,std::multimap<CaloTowerDetId,DetId>::const_iterator> range=m_reverseItems.equal_range(id);
70  for (j=range.first; j!=range.second; j++)
71  items.push_back(j->second);
72 
73  // dealing with topo dependency...
74  int nd, sd;
75 
76  if (standardHB_) {
77  if (id.ietaAbs()<=m_topology->lastHBRing()) {
78  m_topology->depthBinInformation(HcalBarrel,id.ietaAbs(),nd,sd);
79  for (int i=0; i<nd; i++)
80  items.push_back(HcalDetId(HcalBarrel,id.ieta(),id.iphi(),i+sd));
81  }
82  }
83  if (standardHO_) {
84  if (id.ietaAbs()<=m_topology->lastHORing()) {
85  m_topology->depthBinInformation(HcalOuter,id.ietaAbs(),nd,sd);
86  for (int i=0; i<nd; i++)
87  items.push_back(HcalDetId(HcalOuter,id.ieta(),id.iphi(),i+sd));
88  }
89  }
90  if (standardHE_) {
91  if (id.ietaAbs()>=m_topology->firstHERing() && id.ietaAbs()<=m_topology->lastHERing()) {
92  m_topology->depthBinInformation(HcalEndcap,id.ietaAbs(),nd,sd);
93  for (int i=0; i<nd; i++)
94  items.push_back(HcalDetId(HcalEndcap,id.ieta(),id.iphi(),i+sd));
95  }
96  }
97  if (standardHF_) {
98  if (id.ietaAbs()>m_topology->firstHFRing() && id.ietaAbs()<=m_topology->lastHFRing()) {
99  int ieta=id.ieta();
100  m_topology->depthBinInformation(HcalForward,id.ietaAbs(),nd,sd);
101  for (int i=0; i<nd; i++)
102  items.push_back(HcalDetId(HcalForward,ieta,id.iphi(),i+sd));
103  if (id.ietaAbs() == 30) {
104  ieta = 29*id.zside();
106  for (int i=0; i<nd; i++)
107  items.push_back(HcalDetId(HcalForward,ieta,id.iphi(),i+sd));
108  }
109  }
110  }
111  if (standardEB_ && id.ietaAbs()<=EBDetId::MAX_IETA/5) {
112  HcalDetId hid(HcalBarrel,id.ieta(),id.iphi(),1); // for the limits
113  int etaMin, etaMax;
114  if (hid.zside() == -1) {
115  etaMin = hid.crystal_ieta_high();
116  etaMax = hid.crystal_ieta_low();
117  } else {
118  etaMin = hid.crystal_ieta_low();
119  etaMax = hid.crystal_ieta_high();
120  }
121  for (int ie=etaMin; ie<=etaMax; ie++)
122  for (int ip=hid.crystal_iphi_low(); ip<=hid.crystal_iphi_high(); ip++)
123  items.push_back(EBDetId(ie,ip));
124  }
125 
126  return items;
127 }
int firstHFRing() const
Definition: HcalTopology.h:82
int i
Definition: DBlmapReader.cc:9
std::multimap< CaloTowerDetId, DetId > m_reverseItems
std::vector< T >::const_iterator const_iterator
int lastHBRing() const
Definition: HcalTopology.h:79
int lastHFRing() const
Definition: HcalTopology.h:83
int j
Definition: DBlmapReader.cc:9
void depthBinInformation(HcalSubdetector subdet, int etaRing, int &nDepthBins, int &startingBin) const
finds the number of depth bins and which is the number to start with
double sd
static const int MAX_IETA
Definition: EBDetId.h:144
int firstHERing() const
Definition: HcalTopology.h:80
int lastHORing() const
Definition: HcalTopology.h:85
int lastHERing() const
Definition: HcalTopology.h:81
edm::SortedCollection< MapItem > m_items
void CaloTowerConstituentsMap::sort ( )

done adding to the association

Definition at line 54 of file CaloTowerConstituentsMap.cc.

References m_items.

54  {
55  m_items.sort();
56 }
edm::SortedCollection< MapItem > m_items
CaloTowerDetId CaloTowerConstituentsMap::towerOf ( const DetId id) const

Get the tower id for this det id (or null if not known)

Definition at line 17 of file CaloTowerConstituentsMap.cc.

References DetId::Ecal, EcalBarrel, DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, i, HcalDetId::ieta(), HcalDetId::ietaAbs(), reco::if(), HcalDetId::iphi(), m_items, DetId::null(), standardEB_, standardHB_, standardHE_, standardHF_, standardHO_, HcalDetId::subdet(), EBDetId::tower_ieta(), EBDetId::tower_iphi(), and HcalDetId::zside().

Referenced by CaloTowersCreationAlgo::assignHit(), FastL1Region::FillEMCrystals(), CaloTowersCreationAlgo::makeHcalDropChMap(), PhysicsTowerOrganizer::PhysicsTowerOrganizer(), CaloTowersCreationAlgo::rescale(), and EgammaHadTower::towerOf().

17  {
18  CaloTowerDetId tid; // null to start with
19 
21  if (i!=m_items.end()) tid=i->tower;
22 
23  if (tid.null()) {
24  if (id.det()==DetId::Hcal) {
25  HcalDetId hid(id);
26  if ( (hid.subdet()==HcalBarrel && standardHB_ ) ||
27  (hid.subdet()==HcalEndcap && standardHE_ ) ||
28  (hid.subdet()==HcalOuter && standardHO_ ) ||
29  (hid.subdet()==HcalForward && standardHF_) ) {
30  if ((hid.subdet()==HcalForward) && hid.ietaAbs()==29) // special handling for tower 29
31  tid=CaloTowerDetId(30*hid.zside(),hid.iphi());
32  else
33  tid=CaloTowerDetId(hid.ieta(),hid.iphi());
34  }
35  } else if (id.det()==DetId::Ecal) {
36  EcalSubdetector esd=(EcalSubdetector)id.subdetId();
37  if (esd==EcalBarrel && standardEB_) {
38  EBDetId ebid(id);
39  tid=CaloTowerDetId(ebid.tower_ieta(),ebid.tower_iphi());
40  }
41  }
42  }
43 
44  return tid;
45 }
int i
Definition: DBlmapReader.cc:9
std::vector< T >::const_iterator const_iterator
bool null() const
is this a null id ?
Definition: DetId.h:47
if(dp >Float(M_PI)) dp-
EcalSubdetector
edm::SortedCollection< MapItem > m_items
void CaloTowerConstituentsMap::useStandardEB ( bool  use = true)

add standard (hardcoded) EB items?

Definition at line 141 of file CaloTowerConstituentsMap.cc.

References standardEB_.

141  {
142  standardEB_=use;
143 }
void CaloTowerConstituentsMap::useStandardHB ( bool  use = true)

add standard (hardcoded) HB items?

Definition at line 129 of file CaloTowerConstituentsMap.cc.

References standardHB_.

129  {
130  standardHB_=use;
131 }
void CaloTowerConstituentsMap::useStandardHE ( bool  use = true)

add standard (hardcoded) HE items?

Definition at line 132 of file CaloTowerConstituentsMap.cc.

References standardHE_.

132  {
133  standardHE_=use;
134 }
void CaloTowerConstituentsMap::useStandardHF ( bool  use = true)

add standard (hardcoded) HF items?

Definition at line 138 of file CaloTowerConstituentsMap.cc.

References standardHF_.

138  {
139  standardHF_=use;
140 }
void CaloTowerConstituentsMap::useStandardHO ( bool  use = true)

add standard (hardcoded) HO items?

Definition at line 135 of file CaloTowerConstituentsMap.cc.

References standardHO_.

135  {
136  standardHO_=use;
137 }

Member Data Documentation

edm::SortedCollection<MapItem> CaloTowerConstituentsMap::m_items
private

Definition at line 62 of file CaloTowerConstituentsMap.h.

Referenced by assign(), constituentsOf(), sort(), and towerOf().

std::multimap<CaloTowerDetId,DetId> CaloTowerConstituentsMap::m_reverseItems
mutableprivate

Definition at line 63 of file CaloTowerConstituentsMap.h.

Referenced by constituentsOf().

const HcalTopology* CaloTowerConstituentsMap::m_topology
private

Definition at line 46 of file CaloTowerConstituentsMap.h.

Referenced by constituentsOf().

bool CaloTowerConstituentsMap::standardEB_
private

Definition at line 52 of file CaloTowerConstituentsMap.h.

Referenced by constituentsOf(), towerOf(), and useStandardEB().

bool CaloTowerConstituentsMap::standardHB_
private

Definition at line 48 of file CaloTowerConstituentsMap.h.

Referenced by constituentsOf(), towerOf(), and useStandardHB().

bool CaloTowerConstituentsMap::standardHE_
private

Definition at line 49 of file CaloTowerConstituentsMap.h.

Referenced by constituentsOf(), towerOf(), and useStandardHE().

bool CaloTowerConstituentsMap::standardHF_
private

Definition at line 50 of file CaloTowerConstituentsMap.h.

Referenced by constituentsOf(), towerOf(), and useStandardHF().

bool CaloTowerConstituentsMap::standardHO_
private

Definition at line 51 of file CaloTowerConstituentsMap.h.

Referenced by constituentsOf(), towerOf(), and useStandardHO().