CMS 3D CMS Logo

Classes | Public Member Functions | Private Attributes

CaloTowerConstituentsMap Class Reference

#include <CaloTowerConstituentsMap.h>

List of all members.

Classes

struct  MapItem

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_

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.

                                                   :
  standardHB_(false),
  standardHE_(false),
  standardHF_(false),
  standardHO_(false),
  standardEB_(false)
{
}

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::SortedCollection< T, SORT >::end(), Exception, edm::SortedCollection< T, SORT >::find(), m_items, edm::SortedCollection< T, SORT >::push_back(), and DetId::rawId().

Referenced by CaloTowerConstituentsMapBuilder::parseTextMap().

                                                                                    {
  if (m_items.find(cell)!=m_items.end()) {
    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;
  }
  m_items.push_back(MapItem(cell,tower));
}
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 edm::SortedCollection< T, SORT >::begin(), HcalDetId::crystal_ieta_high(), HcalDetId::crystal_ieta_low(), HcalDetId::crystal_iphi_high(), HcalDetId::crystal_iphi_low(), HcalTopology::depthBinInformation(), edm::SortedCollection< T, SORT >::empty(), edm::SortedCollection< T, SORT >::end(), 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().

                                                                                        {
  std::vector<DetId> items;

  // build reverse map if needed
  if (!m_items.empty() && m_reverseItems.empty()) {
    for (edm::SortedCollection<MapItem>::const_iterator i=m_items.begin(); i!=m_items.end(); i++)
      m_reverseItems.insert(std::pair<CaloTowerDetId,DetId>(i->tower,i->cell));
  }

  std::multimap<CaloTowerDetId,DetId>::const_iterator j;
  std::pair<std::multimap<CaloTowerDetId,DetId>::const_iterator,std::multimap<CaloTowerDetId,DetId>::const_iterator> range=m_reverseItems.equal_range(id);
  for (j=range.first; j!=range.second; j++)
    items.push_back(j->second);

  // dealing with topo dependency...
  static HcalTopology htopo;
  int nd, sd;

  if (standardHB_) {
    if (id.ietaAbs()<=htopo.lastHBRing()) {
      htopo.depthBinInformation(HcalBarrel,id.ietaAbs(),nd,sd);
      for (int i=0; i<nd; i++)
        items.push_back(HcalDetId(HcalBarrel,id.ieta(),id.iphi(),i+sd));
    }
  }
  if (standardHO_) {
    if (id.ietaAbs()<=htopo.lastHORing()) {
      htopo.depthBinInformation(HcalOuter,id.ietaAbs(),nd,sd);
      for (int i=0; i<nd; i++)
        items.push_back(HcalDetId(HcalOuter,id.ieta(),id.iphi(),i+sd));
    }
  }
  if (standardHE_) {
    if (id.ietaAbs()>=htopo.firstHERing() && id.ietaAbs()<=htopo.lastHERing()) {
      htopo.depthBinInformation(HcalEndcap,id.ietaAbs(),nd,sd);
      for (int i=0; i<nd; i++)
        items.push_back(HcalDetId(HcalEndcap,id.ieta(),id.iphi(),i+sd));
    }
  }
  if (standardHF_) {
    if (id.ietaAbs()>htopo.firstHFRing() && id.ietaAbs()<=htopo.lastHFRing()) { 
      int ieta=id.ieta();
      htopo.depthBinInformation(HcalForward,id.ietaAbs(),nd,sd);
      for (int i=0; i<nd; i++)
        items.push_back(HcalDetId(HcalForward,ieta,id.iphi(),i+sd));
       if (id.ietaAbs() == 30) {
       ieta = 29*id.zside();
       htopo.depthBinInformation(HcalForward,ieta,nd,sd);
       for (int i=0; i<nd; i++)
         items.push_back(HcalDetId(HcalForward,ieta,id.iphi(),i+sd));
       }
    }
  }
  if (standardEB_ && id.ietaAbs()<=EBDetId::MAX_IETA/5) {
    HcalDetId hid(HcalBarrel,id.ieta(),id.iphi(),1); // for the limits
    int etaMin, etaMax;
    if (hid.zside() == -1) {
      etaMin = hid.crystal_ieta_high();
      etaMax = hid.crystal_ieta_low();
    } else {
      etaMin = hid.crystal_ieta_low();
      etaMax = hid.crystal_ieta_high();
    }
    for (int ie=etaMin; ie<=etaMax; ie++)
      for (int ip=hid.crystal_iphi_low(); ip<=hid.crystal_iphi_high(); ip++)
        items.push_back(EBDetId(ie,ip));
  }

  return items;
}
void CaloTowerConstituentsMap::sort ( )

done adding to the association

Definition at line 53 of file CaloTowerConstituentsMap.cc.

References m_items, and edm::SortedCollection< T, SORT >::sort().

                                    {
  m_items.sort();
}
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, edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), 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().

                                                                      {
  CaloTowerDetId tid; // null to start with

  edm::SortedCollection<MapItem>::const_iterator i=m_items.find(id);
  if (i!=m_items.end()) tid=i->tower;

  if (tid.null()) {
    if (id.det()==DetId::Hcal) { 
      HcalDetId hid(id);
      if ( (hid.subdet()==HcalBarrel && standardHB_ )  ||
           (hid.subdet()==HcalEndcap && standardHE_ )  ||
           (hid.subdet()==HcalOuter  && standardHO_ )  ||
           (hid.subdet()==HcalForward && standardHF_) ) {
        if ((hid.subdet()==HcalForward) && hid.ietaAbs()==29)  // special handling for tower 29
          tid=CaloTowerDetId(30*hid.zside(),hid.iphi());
        else 
          tid=CaloTowerDetId(hid.ieta(),hid.iphi());
      }      
    } else if (id.det()==DetId::Ecal) {
      EcalSubdetector esd=(EcalSubdetector)id.subdetId();
      if (esd==EcalBarrel && standardEB_) {
        EBDetId ebid(id);
        tid=CaloTowerDetId(ebid.tower_ieta(),ebid.tower_iphi());
      }
    }
  }

  return tid;
}
void CaloTowerConstituentsMap::useStandardEB ( bool  use = true)

add standard (hardcoded) EB items?

Definition at line 141 of file CaloTowerConstituentsMap.cc.

References standardEB_.

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

add standard (hardcoded) HB items?

Definition at line 129 of file CaloTowerConstituentsMap.cc.

References standardHB_.

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

add standard (hardcoded) HE items?

Definition at line 132 of file CaloTowerConstituentsMap.cc.

References standardHE_.

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

add standard (hardcoded) HF items?

Definition at line 138 of file CaloTowerConstituentsMap.cc.

References standardHF_.

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

add standard (hardcoded) HO items?

Definition at line 135 of file CaloTowerConstituentsMap.cc.

References standardHO_.

                                                     {
  standardHO_=use;
}

Member Data Documentation

Definition at line 58 of file CaloTowerConstituentsMap.h.

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

Definition at line 59 of file CaloTowerConstituentsMap.h.

Referenced by constituentsOf().

Definition at line 48 of file CaloTowerConstituentsMap.h.

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

Definition at line 44 of file CaloTowerConstituentsMap.h.

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

Definition at line 45 of file CaloTowerConstituentsMap.h.

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

Definition at line 46 of file CaloTowerConstituentsMap.h.

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

Definition at line 47 of file CaloTowerConstituentsMap.h.

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