CMS 3D CMS Logo

CaloTowerConstituentsMap Class Reference

Date
2006/09/06 21:00:11
Revision
1.3
More...

#include <Geometry/CaloTopology/interface/CaloTowerConstituentsMap.h>

List of all members.

Public Member Functions

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

Private Attributes

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

Classes

struct  MapItem


Detailed Description

Date
2006/09/06 21:00:11
Revision
1.3

Author:
J. Mans - Minnesota

Definition at line 16 of file CaloTowerConstituentsMap.h.


Constructor & Destructor Documentation

CaloTowerConstituentsMap::CaloTowerConstituentsMap (  ) 

Definition at line 7 of file CaloTowerConstituentsMap.cc.

00007                                                    :
00008   standardHB_(false),
00009   standardHE_(false),
00010   standardHF_(false),
00011   standardHO_(false),
00012   standardEB_(false)
00013 {
00014 }


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 lat::endl(), Exception, m_items, and DetId::rawId().

Referenced by CaloTowerConstituentsMapBuilder::parseTextMap().

00046                                                                                     {
00047   if (m_items.find(cell)!=m_items.end()) {
00048     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;
00049   }
00050   m_items.push_back(MapItem(cell,tower));
00051 }

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(), 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, range, standardEB_, standardHB_, standardHE_, standardHF_, and standardHO_.

00057                                                                                         {
00058   std::vector<DetId> items;
00059 
00060   // build reverse map if needed
00061   if (!m_items.empty() && m_reverseItems.empty()) {
00062     for (edm::SortedCollection<MapItem>::const_iterator i=m_items.begin(); i!=m_items.end(); i++)
00063       m_reverseItems.insert(std::pair<CaloTowerDetId,DetId>(i->tower,i->cell));
00064   }
00065 
00067   std::multimap<CaloTowerDetId,DetId>::const_iterator j;
00068   std::pair<std::multimap<CaloTowerDetId,DetId>::const_iterator,std::multimap<CaloTowerDetId,DetId>::const_iterator> range=m_reverseItems.equal_range(id);
00069   for (j=range.first; j!=range.second; j++)
00070     items.push_back(j->second);
00071 
00072   // dealing with topo dependency...
00073   static HcalTopology htopo;
00074   int nd, sd;
00075 
00076   if (standardHB_) {
00077     if (id.ietaAbs()<=htopo.lastHBRing()) {
00078       htopo.depthBinInformation(HcalBarrel,id.ietaAbs(),nd,sd);
00079       for (int i=0; i<nd; i++)
00080         items.push_back(HcalDetId(HcalBarrel,id.ieta(),id.iphi(),i+sd));
00081     }
00082   }
00083   if (standardHO_) {
00084     if (id.ietaAbs()<=htopo.lastHORing()) {
00085       htopo.depthBinInformation(HcalOuter,id.ietaAbs(),nd,sd);
00086       for (int i=0; i<nd; i++)
00087         items.push_back(HcalDetId(HcalOuter,id.ieta(),id.iphi(),i+sd));
00088     }
00089   }
00090   if (standardHE_) {
00091     if (id.ietaAbs()>=htopo.firstHERing() && id.ietaAbs()<=htopo.lastHERing()) {
00092       htopo.depthBinInformation(HcalEndcap,id.ietaAbs(),nd,sd);
00093       for (int i=0; i<nd; i++)
00094         items.push_back(HcalDetId(HcalEndcap,id.ieta(),id.iphi(),i+sd));
00095     }
00096   }
00097   if (standardHF_) {
00098     if (id.ietaAbs()>=htopo.firstHFRing() && id.ietaAbs()<=htopo.lastHFRing()) { 
00099       int ieta=id.ieta();
00100       if (id.ietaAbs()==29) ieta=id.zside()*30;
00101       htopo.depthBinInformation(HcalForward,id.ietaAbs(),nd,sd);
00102       for (int i=0; i<nd; i++)
00103         items.push_back(HcalDetId(HcalForward,ieta,id.iphi(),i+sd));
00104     }
00105   }
00106   if (standardEB_ && id.ietaAbs()<EBDetId::MAX_IETA/5) {
00107     HcalDetId hid(HcalBarrel,id.ieta(),id.iphi(),1); // for the limits
00108     for (int ie=hid.crystal_ieta_low(); ie<=hid.crystal_ieta_high(); ie++)
00109       for (int ip=hid.crystal_iphi_low(); ip<=hid.crystal_iphi_high(); ip++)
00110         items.push_back(EBDetId(ie,ip));
00111   }
00112 
00113   return items;
00114 }

void CaloTowerConstituentsMap::sort (  ) 

done adding to the association

Definition at line 53 of file CaloTowerConstituentsMap.cc.

References m_items.

00053                                     {
00054   m_items.sort();
00055 }

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(), and FastL1Region::FillEMCrystals().

00016                                                                       {
00017   CaloTowerDetId tid; // null to start with
00018 
00019   edm::SortedCollection<MapItem>::const_iterator i=m_items.find(id);
00020   if (i!=m_items.end()) tid=i->tower;
00021 
00022   if (tid.null()) {
00023     if (id.det()==DetId::Hcal) { 
00024       HcalDetId hid(id);
00025       if (hid.subdet()==HcalBarrel && standardHB_ ||
00026           hid.subdet()==HcalEndcap && standardHE_ ||
00027           hid.subdet()==HcalOuter && standardHO_ ||
00028           hid.subdet()==HcalForward && standardHF_) {
00029         if (hid.subdet()==HcalForward && hid.ietaAbs()==29)  // special handling for tower 29
00030           tid=CaloTowerDetId(30*hid.zside(),hid.iphi());
00031         else 
00032           tid=CaloTowerDetId(hid.ieta(),hid.iphi());
00033       }      
00034     } else if (id.det()==DetId::Ecal) {
00035       EcalSubdetector esd=(EcalSubdetector)id.subdetId();
00036       if (esd==EcalBarrel && standardEB_) {
00037         EBDetId ebid(id);
00038         tid=CaloTowerDetId(ebid.tower_ieta(),ebid.tower_iphi());
00039       }
00040     }
00041   }
00042 
00043   return tid;
00044 }

void CaloTowerConstituentsMap::useStandardEB ( bool  use = true  ) 

add standard (hardcoded) EB items?

Definition at line 128 of file CaloTowerConstituentsMap.cc.

References standardEB_.

00128                                                      {
00129   standardEB_=use;
00130 }

void CaloTowerConstituentsMap::useStandardHB ( bool  use = true  ) 

add standard (hardcoded) HB items?

Definition at line 116 of file CaloTowerConstituentsMap.cc.

References standardHB_.

00116                                                      {
00117   standardHB_=use;
00118 }

void CaloTowerConstituentsMap::useStandardHE ( bool  use = true  ) 

add standard (hardcoded) HE items?

Definition at line 119 of file CaloTowerConstituentsMap.cc.

References standardHE_.

00119                                                      {
00120   standardHE_=use;
00121 }

void CaloTowerConstituentsMap::useStandardHF ( bool  use = true  ) 

add standard (hardcoded) HF items?

Definition at line 125 of file CaloTowerConstituentsMap.cc.

References standardHF_.

00125                                                      {
00126   standardHF_=use;
00127 }

void CaloTowerConstituentsMap::useStandardHO ( bool  use = true  ) 

add standard (hardcoded) HO items?

Definition at line 122 of file CaloTowerConstituentsMap.cc.

References standardHO_.

00122                                                      {
00123   standardHO_=use;
00124 }


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 [mutable, private]

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:15:59 2009 for CMSSW by  doxygen 1.5.4