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 ()
 
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
 
bool standardEB_
 
bool standardHB_
 
bool standardHE_
 
bool standardHF_
 
bool standardHO_
 

Detailed Description

Date:
2006/07/14 18:06:25
Revision:
1.2
Author
J. Mans - Minnesota

Definition at line 16 of file CaloTowerConstituentsMap.h.

Constructor & Destructor Documentation

CaloTowerConstituentsMap::CaloTowerConstituentsMap ( )

Member Function Documentation

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

set the association between a DetId and a tower

Definition at line 46 of file CaloTowerConstituentsMap.cc.

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

Referenced by CaloTowerConstituentsMapBuilder::parseTextMap().

46  {
47  if (m_items.find(cell)!=m_items.end()) {
48  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;
49  }
50  m_items.push_back(MapItem(cell,tower));
51 }
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 57 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, EBDetId::MAX_IETA, standardEB_, standardHB_, standardHE_, standardHF_, standardHO_, and HcalDetId::zside().

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

57  {
58  std::vector<DetId> items;
59 
60  // build reverse map if needed
61  if (!m_items.empty() && m_reverseItems.empty()) {
63  m_reverseItems.insert(std::pair<CaloTowerDetId,DetId>(i->tower,i->cell));
64  }
65 
67  std::multimap<CaloTowerDetId,DetId>::const_iterator j;
68  std::pair<std::multimap<CaloTowerDetId,DetId>::const_iterator,std::multimap<CaloTowerDetId,DetId>::const_iterator> range=m_reverseItems.equal_range(id);
69  for (j=range.first; j!=range.second; j++)
70  items.push_back(j->second);
71 
72  // dealing with topo dependency...
73  static HcalTopology htopo;
74  int nd, sd;
75 
76  if (standardHB_) {
77  if (id.ietaAbs()<=htopo.lastHBRing()) {
78  htopo.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()<=htopo.lastHORing()) {
85  htopo.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()>=htopo.firstHERing() && id.ietaAbs()<=htopo.lastHERing()) {
92  htopo.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()>htopo.firstHFRing() && id.ietaAbs()<=htopo.lastHFRing()) {
99  int ieta=id.ieta();
100  htopo.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();
105  htopo.depthBinInformation(HcalForward,ieta,nd,sd);
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:65
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:62
int lastHFRing() const
Definition: HcalTopology.h:66
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
static const int MAX_IETA
Definition: EBDetId.h:122
int firstHERing() const
Definition: HcalTopology.h:63
int lastHORing() const
Definition: HcalTopology.h:68
int lastHERing() const
Definition: HcalTopology.h:64
edm::SortedCollection< MapItem > m_items
void CaloTowerConstituentsMap::sort ( )

done adding to the association

Definition at line 53 of file CaloTowerConstituentsMap.cc.

References m_items.

Referenced by hltFindDuplicates.ModuleList::group().

53  {
54  m_items.sort();
55 }
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 16 of file CaloTowerConstituentsMap.cc.

References DetId::Ecal, EcalBarrel, DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, i, HcalDetId::ieta(), HcalDetId::ietaAbs(), 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(), and CaloTowersCreationAlgo::rescale().

16  {
17  CaloTowerDetId tid; // null to start with
18 
20  if (i!=m_items.end()) tid=i->tower;
21 
22  if (tid.null()) {
23  if (id.det()==DetId::Hcal) {
24  HcalDetId hid(id);
25  if ( (hid.subdet()==HcalBarrel && standardHB_ ) ||
26  (hid.subdet()==HcalEndcap && standardHE_ ) ||
27  (hid.subdet()==HcalOuter && standardHO_ ) ||
28  (hid.subdet()==HcalForward && standardHF_) ) {
29  if ((hid.subdet()==HcalForward) && hid.ietaAbs()==29) // special handling for tower 29
30  tid=CaloTowerDetId(30*hid.zside(),hid.iphi());
31  else
32  tid=CaloTowerDetId(hid.ieta(),hid.iphi());
33  }
34  } else if (id.det()==DetId::Ecal) {
35  EcalSubdetector esd=(EcalSubdetector)id.subdetId();
36  if (esd==EcalBarrel && standardEB_) {
37  EBDetId ebid(id);
38  tid=CaloTowerDetId(ebid.tower_ieta(),ebid.tower_iphi());
39  }
40  }
41  }
42 
43  return tid;
44 }
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
perl if(1 lt scalar(@::datatypes))
Definition: edlooper.cc:31
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 58 of file CaloTowerConstituentsMap.h.

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

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

Definition at line 59 of file CaloTowerConstituentsMap.h.

Referenced by constituentsOf().

bool CaloTowerConstituentsMap::standardEB_
private

Definition at line 48 of file CaloTowerConstituentsMap.h.

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

bool CaloTowerConstituentsMap::standardHB_
private

Definition at line 44 of file CaloTowerConstituentsMap.h.

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

bool CaloTowerConstituentsMap::standardHE_
private

Definition at line 45 of file CaloTowerConstituentsMap.h.

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

bool CaloTowerConstituentsMap::standardHF_
private

Definition at line 46 of file CaloTowerConstituentsMap.h.

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

bool CaloTowerConstituentsMap::standardHO_
private

Definition at line 47 of file CaloTowerConstituentsMap.h.

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