CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

HcalTopology Class Reference

#include <HcalTopology.h>

Inheritance diagram for HcalTopology:
CaloSubdetectorTopology

List of all members.

Public Member Functions

int decIEta (const HcalDetId &id, HcalDetId neighbors[2]) const
bool decIPhi (const HcalDetId &id, HcalDetId &neighbor) const
virtual DetId denseId2detId (unsigned int) const
 return a linear packed id
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
virtual unsigned int detId2denseId (const DetId &id) const
 return a linear packed id
unsigned int detId2denseIdCALIB (const DetId &id) const
 return a linear packed id from CALIB
unsigned int detId2denseIdHB (const DetId &id) const
 return a linear packed id from HB
unsigned int detId2denseIdHE (const DetId &id) const
 return a linear packed id from HE
unsigned int detId2denseIdHF (const DetId &id) const
 return a linear packed id from HF
unsigned int detId2denseIdHO (const DetId &id) const
 return a linear packed id from HO
unsigned int detId2denseIdHT (const DetId &id) const
 return a linear packed id from HT
int doublePhiBins () const
virtual std::vector< DetIddown (const DetId &id) const
virtual std::vector< DetIdeast (const DetId &id) const
void exclude (const HcalDetId &id)
int exclude (HcalSubdetector subdet, int ieta1, int ieta2, int iphi1, int iphi2, int depth1=1, int depth2=4)
void excludeSubdetector (HcalSubdetector subdet)
int firstHBRing () const
int firstHEDoublePhiRing () const
int firstHERing () const
int firstHETripleDepthRing () const
int firstHFQuadPhiRing () const
int firstHFRing () const
int firstHORing () const
unsigned int getCALIBSize () const
void getDepthSegmentation (unsigned ring, std::vector< int > &readoutDepths) const
unsigned int getHBSize () const
unsigned int getHESize () const
unsigned int getHFSize () const
unsigned int getHOSize () const
unsigned int getHTSize () const
unsigned int getNumberOfShapes () const
 HcalTopology (HcalTopologyMode::Mode mode, int maxDepthHB, int maxDepthHE, HcalTopologyMode::TriggerMode tmode=HcalTopologyMode::tm_LHC_PreLS1)
int incIEta (const HcalDetId &id, HcalDetId neighbors[2]) const
bool incIPhi (const HcalDetId &id, HcalDetId &neighbor) const
bool incrementDepth (HcalDetId &id) const
int lastHBRing () const
int lastHERing () const
int lastHFRing () const
int lastHORing () const
int maxDepthHB () const
int maxDepthHE () const
HcalTopologyMode::Mode mode () const
virtual unsigned int ncells () const
 return a count of valid cells (for dense indexing use)
virtual std::vector< DetIdnorth (const DetId &id) const
int nPhiBins (int etaRing) const
 how many phi segments in this ring
std::pair< int, int > segmentBoundaries (unsigned ring, unsigned depth) const
void setDepthSegmentation (unsigned ring, const std::vector< int > &readoutDepths)
int singlePhiBins () const
virtual std::vector< DetIdsouth (const DetId &id) const
virtual int topoVersion () const
 return a version which identifies the given topology
HcalTopologyMode::TriggerMode triggerMode () const
virtual std::vector< DetIdup (const DetId &id) const
virtual bool valid (const DetId &id) const
bool validHcal (const HcalDetId &id) const
virtual std::vector< DetIdwest (const DetId &id) const

Private Types

enum  {
  kHBhalf = 1296, kHEhalf = 1296, kHOhalf = 1080, kHFhalf = 864,
  kHThalf = 2088, kZDChalf = 11, kCASTORhalf = 224, kCALIBhalf = 693,
  kHcalhalf = kHBhalf + kHEhalf + kHOhalf + kHFhalf
}
enum  { kSizeForDenseIndexingPreLS1 = 2*kHcalhalf }
enum  { kHBSizePreLS1 = 2*kHBhalf }
enum  { kHESizePreLS1 = 2*kHEhalf }
enum  { kHOSizePreLS1 = 2*kHOhalf }
enum  { kHFSizePreLS1 = 2*kHFhalf }
enum  { kHTSizePreLS1 = 2*kHThalf }
enum  { kCALIBSizePreLS1 = 2*kCALIBhalf }
typedef std::map< unsigned,
std::vector< int > > 
SegmentationMap

Private Member Functions

int decAIEta (const HcalDetId &id, HcalDetId neighbors[2]) const
unsigned int detId2denseIdPreLS1 (const DetId &id) const
int incAIEta (const HcalDetId &id, HcalDetId neighbors[2]) const
bool isExcluded (const HcalDetId &id) const
bool validDetIdPreLS1 (const HcalDetId &id) const
bool validRaw (const HcalDetId &id) const

Private Attributes

unsigned int CALIBSize_
SegmentationMap depthSegmentation_
const int doublePhiBins_
bool excludeHB_
bool excludeHE_
bool excludeHF_
bool excludeHO_
std::vector< HcalDetIdexclusionList_
const int firstHBRing_
const int firstHEDoublePhiRing_
const int firstHERing_
const int firstHETripleDepthRing_
const int firstHFQuadPhiRing_
const int firstHFRing_
const int firstHORing_
unsigned int HBSize_
unsigned int HESize_
unsigned int HFSize_
unsigned int HOSize_
unsigned int HTSize_
const int lastHBRing_
const int lastHERing_
const int lastHFRing_
const int lastHORing_
const int maxDepthHB_
const int maxDepthHE_
HcalTopologyMode::Mode mode_
const unsigned int numberOfShapes_
const int singlePhiBins_
int topoVersion_
HcalTopologyMode::TriggerMode triggerMode_

Detailed Description

The HcalTopology class contains a set of constants which represent the topology (tower relationship) of the CMS HCAL as built. These constants can be used to determine neighbor relationships and existence of cells.

For use with limited setups (testbeam, cosmic stands, etc), the topology can be limited by creating a rejection list -- a list of cells which would normally exist in the full CMS HCAL, but are not present for the specified topology.

Date:
2012/11/13 04:53:17
Revision:
1.18
Author:
J. Mans - Minnesota

Definition at line 26 of file HcalTopology.h.


Member Typedef Documentation

typedef std::map<unsigned, std::vector<int> > HcalTopology::SegmentationMap [private]

Definition at line 181 of file HcalTopology.h.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
kHBhalf 
kHEhalf 
kHOhalf 
kHFhalf 
kHThalf 
kZDChalf 
kCASTORhalf 
kCALIBhalf 
kHcalhalf 

Definition at line 184 of file HcalTopology.h.

       { kHBhalf = 1296 ,
         kHEhalf = 1296 ,
         kHOhalf = 1080 ,
         kHFhalf = 864  ,
         kHThalf = 2088,
         kZDChalf = 11,
         kCASTORhalf = 224,
         kCALIBhalf = 693,
         kHcalhalf = kHBhalf + kHEhalf + kHOhalf + kHFhalf } ;
anonymous enum [private]
Enumerator:
kSizeForDenseIndexingPreLS1 

Definition at line 193 of file HcalTopology.h.

anonymous enum [private]
Enumerator:
kHBSizePreLS1 

Definition at line 194 of file HcalTopology.h.

anonymous enum [private]
Enumerator:
kHESizePreLS1 

Definition at line 195 of file HcalTopology.h.

anonymous enum [private]
Enumerator:
kHOSizePreLS1 

Definition at line 196 of file HcalTopology.h.

anonymous enum [private]
Enumerator:
kHFSizePreLS1 

Definition at line 197 of file HcalTopology.h.

anonymous enum [private]
Enumerator:
kHTSizePreLS1 

Definition at line 198 of file HcalTopology.h.

anonymous enum [private]
Enumerator:
kCALIBSizePreLS1 

Definition at line 199 of file HcalTopology.h.


Constructor & Destructor Documentation

HcalTopology::HcalTopology ( HcalTopologyMode::Mode  mode,
int  maxDepthHB,
int  maxDepthHE,
HcalTopologyMode::TriggerMode  tmode = HcalTopologyMode::tm_LHC_PreLS1 
)

Definition at line 13 of file HcalTopology.cc.

References HBSize_, HESize_, HFSize_, HOSize_, kHBSizePreLS1, kHESizePreLS1, kHFSizePreLS1, kHOSizePreLS1, HcalTopologyMode::LHC, mode_, HcalTopologyMode::SLHC, and topoVersion_.

Referenced by HcalTopologyIdealEP::produce().

                                                                                                                       :
  excludeHB_(false),
  excludeHE_(false),
  excludeHO_(false),
  excludeHF_(false),
  mode_(mode),
  triggerMode_(tmode),
  firstHBRing_(1),
  lastHBRing_(16),
  firstHERing_(16),
  lastHERing_(29),
  firstHFRing_(29),
  lastHFRing_(41),
  firstHORing_(1),
  lastHORing_(15),
  firstHEDoublePhiRing_((mode==HcalTopologyMode::H2 || mode==HcalTopologyMode::H2HE)?(22):(21)),
  firstHFQuadPhiRing_(40),
  firstHETripleDepthRing_((mode==HcalTopologyMode::H2 || mode==HcalTopologyMode::H2HE)?(24):(27)),
  singlePhiBins_(72),
  doublePhiBins_(36),
  maxDepthHB_(maxDepthHB),
  maxDepthHE_(maxDepthHE),
  HBSize_(kHBSizePreLS1),
  HESize_(kHESizePreLS1),
  HOSize_(kHOSizePreLS1),
  HFSize_(kHFSizePreLS1),
  numberOfShapes_(( mode==HcalTopologyMode::SLHC ) ? 143 : 87 ) // not 500?
{

  if (mode_==HcalTopologyMode::LHC) {
    topoVersion_=0; //DL
    HBSize_= kHBSizePreLS1; // qie-per-fiber * fiber/rm * rm/rbx * rbx/barrel * barrel/hcal
    HESize_= kHESizePreLS1; // qie-per-fiber * fiber/rm * rm/rbx * rbx/endcap * endcap/hcal
    HOSize_= kHOSizePreLS1; // ieta * iphi * 2
    HFSize_= kHFSizePreLS1; // phi * eta * depth * pm 
  } else if (mode_==HcalTopologyMode::SLHC) { // need to know more eventually
    HBSize_= maxDepthHB*16*72*2;
    HESize_= maxDepthHE*(29-16+1)*72*2;
    HOSize_= 15*72*2; // ieta * iphi * 2
    HFSize_= 72*13*2*2; // phi * eta * depth * pm 

    topoVersion_=10;
  }
    
}

Member Function Documentation

int HcalTopology::decAIEta ( const HcalDetId id,
HcalDetId  neighbors[2] 
) const [private]

Get the neighbors of the given cell with lower absolute ieta

Decreasing in |ieta|, there are be two neighbors of 40 and 21

Definition at line 399 of file HcalTopology.cc.

References firstHEDoublePhiRing(), firstHFQuadPhiRing(), HcalBarrel, HcalEndcap, IPHI_MAX, lastHBRing(), lastHERing(), n, and valid().

Referenced by decIEta(), and incIEta().

                                                                            {
  int n=1;
  int aieta=id.ietaAbs();

  if (aieta==firstHEDoublePhiRing()) { 
    n=2;
    neighbors[0]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),id.iphi(),id.depth());
    neighbors[1]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),id.iphi()+1,id.depth());
  } else if (aieta==firstHFQuadPhiRing()) {
    n=2;
    neighbors[0]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),id.iphi(),id.depth());
    if (id.iphi()==IPHI_MAX-1) neighbors[1]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),1,id.depth());
    else neighbors[1]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),id.iphi()+2,id.depth());
  } else if (aieta==1) {
    neighbors[0]=HcalDetId(id.subdet(),-aieta*id.zside(),id.iphi(),id.depth());
  } else if (aieta==lastHBRing()+1) {
    neighbors[0]=HcalDetId(HcalBarrel,(aieta-1)*id.zside(),id.iphi(),id.depth());
  } else if (aieta==lastHERing()+1) {
    neighbors[0]=HcalDetId(HcalEndcap,(aieta-1)*id.zside(),id.iphi(),id.depth());
  } else
    neighbors[0]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),id.iphi(),id.depth());
  
  if (!valid(neighbors[0]) && n==2) {
    if (!valid(neighbors[1])) n=0;
    else {
      n=1;
      neighbors[0]=neighbors[1];
    }
  }
  if (n==2 && !valid(neighbors[1])) n=1;
  if (n==1 && !valid(neighbors[0])) n=0;

  return n;
}
int HcalTopology::decIEta ( const HcalDetId id,
HcalDetId  neighbors[2] 
) const

Get the neighbors of the given cell with lower (signed) ieta

Definition at line 373 of file HcalTopology.cc.

References decAIEta(), and incAIEta().

Referenced by east().

                                                                           {
  if (id.zside()==1) return decAIEta(id,neighbors);
  else return incAIEta(id,neighbors);
}
bool HcalTopology::decIPhi ( const HcalDetId id,
HcalDetId neighbor 
) const

Get the neighbor (if present) of the given cell with lower iphi

Definition at line 335 of file HcalTopology.cc.

References firstHEDoublePhiRing(), firstHFQuadPhiRing(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, IPHI_MAX, convertSQLiteXML::ok, and valid().

Referenced by south().

                                                                         {
  bool ok=valid(id);
  if (ok) {
    switch (id.subdet()) {
    case (HcalBarrel):
    case (HcalOuter):
      if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX,id.depth()); 
      else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-1,id.depth()); 
      break;
    case (HcalEndcap):
      if (id.ietaAbs()>=firstHEDoublePhiRing()) {
        if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX-1,id.depth()); 
        else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-2,id.depth()); 
      } else {
        if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX,id.depth()); 
        else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-1,id.depth()); 
      }
      break;
    case (HcalForward):
      if (id.ietaAbs()>=firstHFQuadPhiRing()) {
        if (id.iphi()==3) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX-1,id.depth()); 
        else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-4,id.depth()); 
      } else {
        if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX-1,id.depth()); 
        else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-2,id.depth()); 
      }
      break;
    default: ok=false;
    }
  } 
  return ok;
}
DetId HcalTopology::denseId2detId ( unsigned int  denseid) const [virtual]

return a linear packed id

Reimplemented from CaloSubdetectorTopology.

Definition at line 763 of file HcalTopology.cc.

References HBSize_, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HESize_, HOSize_, recoMuon::in, kHBhalf, kHEhalf, kHFhalf, kHOhalf, kSizeForDenseIndexingPreLS1, maxDepthHB_, maxDepthHE_, ncells(), sd, and topoVersion_.

Referenced by HcalGeometry::localCorners().

                                                            {

  HcalSubdetector sd ( HcalBarrel ) ;
  int ie ( 0 ) ;
  int ip ( 0 ) ;
  int dp ( 0 ) ;
  int in ( denseid ) ;
  int iz ( 1 ) ;
  if (topoVersion_==0) { //DL// pre-LS1
    if (denseid < kSizeForDenseIndexingPreLS1) {
      if ( in > 2*( kHBhalf + kHEhalf + kHOhalf ) - 1 ) { // HF
        sd  = HcalForward ;
        in -= 2*( kHBhalf + kHEhalf + kHOhalf ) ; 
        iz  = ( in<kHFhalf ? 1 : -1 ) ;
        in %= kHFhalf ; 
        ip  = 4*( in/48 ) ;
        in %= 48 ;
        ip += 1 + ( in>21 ? 2 : 0 ) ;
        if( 3 == ip%4 ) in -= 22 ;
        ie  = 29 + in/2 ;
        dp  = 1 + in%2 ;
      } else if ( in > 2*( kHBhalf + kHEhalf ) - 1 ) { // HO
        sd  = HcalOuter ;
        in -= 2*( kHBhalf + kHEhalf ) ; 
        iz  = ( in<kHOhalf ? 1 : -1 ) ;
        in %= kHOhalf ; 
        dp  = 4 ;
        ip  = 1 + in/15 ;
        ie  = 1 + ( in - 15*( ip - 1 ) ) ;
      } else if ( in > 2*kHBhalf - 1 ) { // Endcap
        sd  = HcalEndcap ;
        in -= 2*kHBhalf ;
        iz  = ( in<kHEhalf ? 1 : -1 ) ;
        in %= kHEhalf ; 
        ip  = 2*( in/36 ) ;
        in %= 36 ;
        ip += 1 + in/28 ;
        if( 0 == ip%2 ) in %= 28 ;
        ie  = 15 + ( in<2 ? 1 + in : 2 + 
                     ( in<20 ? 1 + ( in - 2 )/2 : 9 +
                       ( in<26 ? 1 + ( in - 20 )/3 : 3 ) ) ) ;
        dp  = ( in<1 ? 3 :
                ( in<2 ? 1 : 
                  ( in<20 ? 1 + ( in - 2 )%2 : 
                    ( in<26 ? 1 + ( in - 20 )%3 : 
                      ( 1 + ( in - 26 )%2 ) ) ) ) ) ;
      } else { // barrel
        iz  = ( in<kHBhalf ? 1 : -1 ) ;
        in %= kHBhalf ; 
        ip = in/18 + 1 ;
        in %= 18 ;
        if ( in < 14 ) {
          dp = 1 ;
          ie = in + 1 ;
        } else {
          in %= 14 ;
          dp =  1 + in%2 ;
          ie = 15 + in/2 ;
        }
      }
    }
  } else if (topoVersion_==10) {
    if (denseid < ncells()) {
      if (denseid > (HBSize_+HESize_+HOSize_)) {
        sd  = HcalForward ;
        in -= (HBSize_+HESize_+HOSize_);
        dp  = (in%2) + 1;
        ip  = (in - dp + 1)%144;
        ip  = (ip/2) + 1;
        ie  = (in - dp + 1 - 2*(ip -1))/144;
        if (ie > 12) {ie  = 42 -ie; iz = -1;}
        else         {ie += 29;     iz =  1;}
      } else if (denseid > (HBSize_+HESize_)) {
        sd  = HcalOuter ;
        in -= (HBSize_+HESize_);
        dp  = 4;
        ip  = (in%72) + 1;
        ie  = (in - ip + 1)/72;
        if (ie > 14) {ie  = 30 -ie; iz = -1;}
        else         {ie += 1;      iz =  1;}
      } else if (denseid > (HBSize_)) {
        sd  = HcalEndcap ;
        in -= (HBSize_);
        dp  = (in%maxDepthHE_)+1;
        ip  = (in - dp + 1)%(maxDepthHE_*72);
        ip  = (ip/maxDepthHE_) + 1;
        ie  = (in - dp + 1 - maxDepthHE_*(ip-1))/(72*maxDepthHE_);
        if (ie > 13) {ie  = 43 - ie; iz = -1;}
        else         {ie += 16;      iz =  1;}
      } else {
        sd  = HcalBarrel ;
        dp  = (in%maxDepthHB_)+1;
        ip  = (in - dp + 1)%(maxDepthHB_*72);
        ip  = (ip/maxDepthHB_) + 1;
        ie  = (in - dp + 1 - maxDepthHB_*(ip-1))/(72*maxDepthHB_);
        if (ie > 15) {ie  = 32 - ie; iz = -1;}
        else         {ie += 1;       iz =  1;}
      } 
    }
  }
  return HcalDetId( sd, iz*int(ie), ip, dp );
}
void HcalTopology::depthBinInformation ( HcalSubdetector  subdet,
int  etaRing,
int &  nDepthBins,
int &  startingBin 
) const

finds the number of depth bins and which is the number to start with

Definition at line 435 of file HcalTopology.cc.

References dtNoiseDBValidation_cfg::cerr, firstHERing(), firstHETripleDepthRing(), HcalTopologyMode::H2HE, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, lastHBRing(), lastHERing(), maxDepthHB_, maxDepthHE_, mode_, and HcalTopologyMode::SLHC.

Referenced by CaloTowerConstituentsMap::constituentsOf(), HcalTrigTowerGeometry::detIds(), HcalHardcodeGeometryLoader::fill(), and incrementDepth().

                                                                                  {

  if(subdet == HcalBarrel) {
    if (mode_==HcalTopologyMode::SLHC || mode_==HcalTopologyMode::H2HE) {
      startingBin = 1;
      if (etaRing==lastHBRing()) {
        nDepthBins = 2;
      } else {
        nDepthBins = maxDepthHB_;
      }
    } else {
      if (etaRing<=14) {
        nDepthBins = 1;
        startingBin = 1;
      } else {
        nDepthBins = 2;
        startingBin = 1;
      }
    }
  } else if(subdet == HcalEndcap) {
    if (mode_==HcalTopologyMode::SLHC || mode_==HcalTopologyMode::H2HE) {
      if (etaRing==firstHERing()) {
        nDepthBins  = maxDepthHE_ - 2;
        startingBin = 3;
      } else {
        nDepthBins  = maxDepthHE_;
        startingBin = 1;
      }
    } else {
      if (etaRing==firstHERing()) {
        nDepthBins = 1;
        startingBin = 3;
      } else if (etaRing==17) {
        nDepthBins = 1;
        startingBin = 1;
      } else if (etaRing==lastHERing()) {
        nDepthBins = 2;
        startingBin = 1;
      } else {
        nDepthBins = (etaRing >= firstHETripleDepthRing()) ? 3 : 2;
        startingBin = 1;
      }
    }
  } else if(subdet == HcalForward) {
    nDepthBins  = 2;
    startingBin = 1;
  } else if(subdet == HcalOuter) {
    nDepthBins = 1;
    startingBin = 4;
  } else {
    std::cerr << "Bad HCAL subdetector " << subdet << std::endl;
  }
}
unsigned int HcalTopology::detId2denseId ( const DetId id) const [virtual]

return a linear packed id

Reimplemented from CaloSubdetectorTopology.

Definition at line 727 of file HcalTopology.cc.

References HcalDetId::depth(), detId2denseIdPreLS1(), HBSize_, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HESize_, HOSize_, HcalDetId::ieta(), HcalDetId::iphi(), maxDepthHB_, maxDepthHE_, HcalDetId::subdet(), and topoVersion_.

Referenced by HcalRecHitsMaker::createVectorOfSubdetectorCells(), HcalGeometry::getGeometry(), HcalGeometry::indexFor(), HcalRecHitsMaker::loadPCaloHits(), HcalDDDGeometry::newCell(), and HcalGeometry::newCell().

                                                              {
  unsigned int retval(0);
  if (topoVersion_==0) { // pre-LS1
    retval = detId2denseIdPreLS1(id);
  } else if (topoVersion_==10) {
    HcalDetId hid(id);
    if (hid.subdet()==HcalBarrel) {
      retval=(hid.depth()-1)+maxDepthHB_*(hid.iphi()-1);
      if (hid.ieta()>0) {
        retval+=maxDepthHB_*72*(hid.ieta()-1);
      } else 
        retval+=maxDepthHB_*72*(32+hid.ieta());
    } else if (hid.subdet()==HcalEndcap) {
      retval=HBSize_;
      retval+=(hid.depth()-1)+maxDepthHE_*(hid.iphi()-1);
      if (hid.ieta()>0) {
        retval+=maxDepthHE_*72*(hid.ieta()-16);
      } else 
        retval+=maxDepthHE_*72*((14+29)+hid.ieta());      
    } else if (hid.subdet()==HcalOuter) {
      retval=HBSize_+HESize_;
      if (hid.ieta()>0) retval+=(hid.iphi()-1)+72*(hid.ieta()-1);
      else retval+=(hid.iphi()-1)+72*(30+hid.ieta());
    } else if (hid.subdet()==HcalForward) { 
      retval=HBSize_+HESize_+HOSize_;
      retval+=hid.depth()-1+2*(hid.iphi()-1);
      if (hid.ieta()>0) retval+=2*72*(hid.ieta()-29);
      else retval+=2*72*((29+13)+hid.ieta());
    } else {
      return 0xFFFFFFFu;
    }
  }

  return retval;
}
unsigned int HcalTopology::detId2denseIdCALIB ( const DetId id) const

return a linear packed id from CALIB

Definition at line 662 of file HcalTopology.cc.

References abs, HcalCalibDetId::calibFlavor(), HcalCalibDetId::CalibrationBox, HcalCalibDetId::cboxChannel(), gather_cfg::cout, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalCalibDetId::hcalSubdet(), HcalCalibDetId::HOCrosstalk, HcalCalibDetId::ieta(), getHLTprescales::index, HcalCalibDetId::iphi(), and HcalCalibDetId::zside().

Referenced by HcalLogicalMapGenerator::buildCALIBMap(), HcalLogicalMapGenerator::buildHOXMap(), HcalLogicalMap::checkHashIds(), HcalLogicalMap::getHcalFrontEndId(), and HcalCondObjectContainerBase::indexFor().

                                                                   {
  HcalCalibDetId tid(id);
  int    channel = tid.cboxChannel();
  int ieta = tid.ieta();
  int iphi = tid.iphi();
  int zside = tid.zside();
  unsigned int index=0xFFFFFFFFu;
      
  if (tid.calibFlavor()==HcalCalibDetId::CalibrationBox) {
        
    HcalSubdetector subDet = tid.hcalSubdet();
        
    if (subDet==HcalBarrel) {
      //std::cout<<"CALIB_HB:  ";
      //dphi = 4 (18 phi values), 3 channel types (0,1,2), eta = -1 or 1
      //total of 18*3*2=108 channels
      index = ((iphi+1)/4-1) + 18*channel + 27*(ieta+1);
    }
    else if (subDet==HcalEndcap) {
      //std::cout<<"CALIB_HE:  ";
      //dphi = 4 (18 phi values), 6 channel types (0,1,3,4,5,6), eta = -1 or 1
      //total of 18*6*2=216 channels
      if (channel>2) channel-=1;
      index = ((iphi+1)/4-1) + 18*channel + 54*(ieta+1) + 108;
    } 
    else if (subDet==HcalForward) {
      //std::cout<<"CALIB_HF:  ";
      //dphi = 18 (4 phi values), 3 channel types (0,1,8), eta = -1 or 1
      if (channel==8) channel = 2;
      //total channels 4*3*2=24
      index = (iphi-1)/18 + 4*channel + 6*(ieta+1) + 324;
    }
    else if (subDet==HcalOuter) {
      //std::cout<<"CALIB_HO:  ";
      //there are 5 special calib crosstalk channels, one in each ring
      if (channel==7) {
        channel = 2;
        index = (ieta+2) + 420;
      }
 //for HOM/HOP dphi = 6 (12 phi values),  2 channel types (0,1), eta = -2,-1 or 1,2
          //for HO0/YB0 dphi = 12 (6 phi values),  2 channel types (0,1), eta = 0
          else{
            if (ieta<0) index      = ((iphi+1)/12-1) + 36*channel + 6*(ieta+2) + 348;
            else if (ieta>0) index = ((iphi+1)/12-1) + 36*channel + 6*(ieta+2) + 6 + 348;
            else index             = ((iphi+1)/6-1)  + 36*channel + 6*(ieta+2) + 348;
          }
        } 
        else {
          std::cout << "HCAL Det Id not valid!" << std::endl;
          index = 0;
        }
        
      }
      else if (tid.calibFlavor()==HcalCalibDetId::HOCrosstalk) {
        //std::cout<<"HX:  ";
        //for YB0/HO0 phi is grouped in 6 groups of 6 with dphi=2 but the transitions are 1 or 3
        // in such a way that the %36 operation yeilds unique values for every iphi
        if (abs(ieta)==4)  index = ((iphi-1)%36) + (((zside+1)*36)/2) + 72 + 425;   //ieta = 1 YB0/HO0;
        else               index = (iphi-1) + (36*(zside+1)*2) + 425;  //ieta = 0 for HO2M/HO1M ieta=2 for HO1P/HO2P;
      }
      //std::cout << "  " << ieta << "  " << zside << "  " << iphi << "  " << depth << "  " << index << std::endl;
  return index;
}
unsigned int HcalTopology::detId2denseIdHB ( const DetId id) const

return a linear packed id from HB

Definition at line 593 of file HcalTopology.cc.

References HcalDetId::depth(), HcalDetId::ieta(), HcalDetId::ietaAbs(), HcalDetId::iphi(), kHBhalf, maxDepthHB_, topoVersion_, and HcalDetId::zside().

Referenced by HcalLogicalMapGenerator::buildHBEFTMap(), HcalLogicalMap::checkHashIds(), HcalLogicalMap::getHcalFrontEndId(), and HcalCondObjectContainerBase::indexFor().

                                                                {
  HcalDetId hid(id);
  const int             ip (hid.iphi()    ) ;
  const int             ie (hid.ietaAbs() ) ;
  const int             dp (hid.depth()   ) ;
  const int             zn (hid.zside() < 0 ? 1 : 0 ) ;
  unsigned int  retval = 0xFFFFFFFFu;
  if (topoVersion_==0) retval=( ip - 1 )*18 + dp - 1 + ie - ( ie<16 ? 1 : 0 ) + zn*kHBhalf;
  else if (topoVersion_==10) retval=dp-1 + maxDepthHB_*(ip-1)+maxDepthHB_*72*(hid.ieta()-1+33*zn);
  return retval;
}
unsigned int HcalTopology::detId2denseIdHE ( const DetId id) const

return a linear packed id from HE

Definition at line 605 of file HcalTopology.cc.

References HcalDetId::depth(), HcalDetId::ieta(), HcalDetId::ietaAbs(), HcalDetId::iphi(), kHEhalf, maxDepthHE_, topoVersion_, and HcalDetId::zside().

Referenced by HcalLogicalMapGenerator::buildHBEFTMap(), HcalLogicalMap::checkHashIds(), HcalLogicalMap::getHcalFrontEndId(), and HcalCondObjectContainerBase::indexFor().

                                                                {
  HcalDetId hid(id);
  const int             ip (hid.iphi()    ) ;
  const int             ie (hid.ietaAbs() ) ;
  const int             dp (hid.depth()   ) ;
  const int             zn (hid.zside() < 0 ? 1 : 0 ) ;
  unsigned int  retval =  0xFFFFFFFFu;
  if (topoVersion_==0) retval=( ip - 1 )*8 + ( ip/2 )*20 +
                         ( ( ie==16 || ie==17 ) ? ie - 16 :
                           ( ( ie>=18 && ie<=20 ) ? 2 + 2*( ie - 18 ) + dp - 1 :
                             ( ( ie>=21 && ie<=26 ) ? 8 + 2*( ie - 21 ) + dp - 1 :
                               ( ( ie>=27 && ie<=28 ) ? 20 + 3*( ie - 27 ) + dp - 1 :
                                 26 + 2*( ie - 29 ) + dp - 1 ) ) ) ) + zn*kHEhalf;
  if (topoVersion_==10) retval=(dp-1)+maxDepthHE_*(ip-1)+maxDepthHE_*72*(hid.ieta()-16+zn*(14+29+16));
  return retval;
}
unsigned int HcalTopology::detId2denseIdHF ( const DetId id) const

return a linear packed id from HF

Definition at line 633 of file HcalTopology.cc.

References HcalDetId::depth(), HcalDetId::ietaAbs(), HcalDetId::iphi(), kHFhalf, topoVersion_, and HcalDetId::zside().

Referenced by HcalLogicalMapGenerator::buildHBEFTMap(), HcalLogicalMap::checkHashIds(), HcalLogicalMap::getHcalFrontEndId(), and HcalCondObjectContainerBase::indexFor().

                                                                {
  HcalDetId hid(id);
  const int             ip (hid.iphi()    ) ;
  const int             ie (hid.ietaAbs() ) ;
  const int             dp (hid.depth()   ) ;
  const int             zn (hid.zside() < 0 ? 1 : 0 ) ;

  unsigned int  retval = 0xFFFFFFFFu;
  if (topoVersion_==0 || topoVersion_==10) retval=
                                             ( ( ip - 1 )/4 )*4 + ( ( ip - 1 )/2 )*22 + 
                                             2*( ie - 29 ) + ( dp - 1 ) + zn*kHFhalf;
  return retval;
}
unsigned int HcalTopology::detId2denseIdHO ( const DetId id) const

return a linear packed id from HO

Definition at line 622 of file HcalTopology.cc.

References HcalDetId::ietaAbs(), HcalDetId::iphi(), kHOhalf, topoVersion_, and HcalDetId::zside().

Referenced by HcalLogicalMapGenerator::buildHOXMap(), HcalLogicalMap::checkHashIds(), HcalLogicalMap::getHcalFrontEndId(), PFRecHitProducerHO::hoNeighbArray(), HcalCondObjectContainerBase::indexFor(), and PFRecHitProducerHO::move().

                                                                {
  HcalDetId hid(id);
  const int             ip (hid.iphi()    ) ;
  const int             ie (hid.ietaAbs() ) ;
  const int             zn (hid.zside() < 0 ? 1 : 0 ) ;

  unsigned int  retval = 0xFFFFFFFFu;
  if (topoVersion_==0 || topoVersion_==10) retval=( ip - 1 )*15 + ( ie - 1 ) + zn*kHOhalf;
  return retval;
}
unsigned int HcalTopology::detId2denseIdHT ( const DetId id) const

return a linear packed id from HT

Definition at line 647 of file HcalTopology.cc.

References HcalTrigTowerDetId::ietaAbs(), getHLTprescales::index, HcalTrigTowerDetId::iphi(), kHThalf, and HcalTrigTowerDetId::zside().

Referenced by HcalLogicalMap::checkHashIds(), and HcalCondObjectContainerBase::indexFor().

                                                                {
  HcalTrigTowerDetId tid(id); 
  int zside = tid.zside();
  unsigned int ietaAbs = tid.ietaAbs();
  unsigned int iphi = tid.iphi();

  unsigned int index;
  if ((iphi-1)%4==0) index = (iphi-1)*32 + (ietaAbs-1) - (12*((iphi-1)/4));
  else               index = (iphi-1)*28 + (ietaAbs-1) + (4*(((iphi-1)/4)+1));
  
  if (zside == -1) index += kHThalf;

  return index;
}
unsigned int HcalTopology::detId2denseIdPreLS1 ( const DetId id) const [private]

Definition at line 566 of file HcalTopology.cc.

References HcalDetId::depth(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalDetId::ietaAbs(), HcalDetId::iphi(), kHBhalf, kHEhalf, kHFhalf, kHOhalf, sd, HcalDetId::subdet(), and HcalDetId::zside().

Referenced by detId2denseId().

                                                                     {

  HcalDetId hid(id);
  const HcalSubdetector sd (hid.subdet()  ) ;
  const int             ip (hid.iphi()    ) ;
  const int             ie (hid.ietaAbs() ) ;
  const int             dp (hid.depth()   ) ;
  const int             zn (hid.zside() < 0 ? 1 : 0 ) ;
  unsigned int  retval = ( ( sd == HcalBarrel ) ?
                           ( ip - 1 )*18 + dp - 1 + ie - ( ie<16 ? 1 : 0 ) + zn*kHBhalf :
                           ( ( sd == HcalEndcap ) ?
                             2*kHBhalf + ( ip - 1 )*8 + ( ip/2 )*20 +
                             ( ( ie==16 || ie==17 ) ? ie - 16 :
                               ( ( ie>=18 && ie<=20 ) ? 2 + 2*( ie - 18 ) + dp - 1 :
                                 ( ( ie>=21 && ie<=26 ) ? 8 + 2*( ie - 21 ) + dp - 1 :
                                   ( ( ie>=27 && ie<=28 ) ? 20 + 3*( ie - 27 ) + dp - 1 :
                                     26 + 2*( ie - 29 ) + dp - 1 ) ) ) ) + zn*kHEhalf :
                             ( ( sd == HcalOuter ) ?
                               2*kHBhalf + 2*kHEhalf + ( ip - 1 )*15 + ( ie - 1 ) + zn*kHOhalf :
                               ( ( sd == HcalForward ) ?
                                 2*kHBhalf + 2*kHEhalf + 2*kHOhalf + 
                                 ( ( ip - 1 )/4 )*4 + ( ( ip - 1 )/2 )*22 + 
                                 2*( ie - 29 ) + ( dp - 1 ) + zn*kHFhalf : 0xFFFFFFFFu ) ) ) ) ; 
  return retval;
}
int HcalTopology::doublePhiBins ( ) const [inline]

Definition at line 91 of file HcalTopology.h.

References doublePhiBins_.

{return doublePhiBins_;}
std::vector< DetId > HcalTopology::down ( const DetId id) const [virtual]

Get the neighbors of the given cell in down direction (inward)

Implements CaloSubdetectorTopology.

Definition at line 152 of file HcalTopology.cc.

References gather_cfg::cout.

                                                         {
  std::cout << "HcalTopology::down() not yet implemented" << std::endl; 
  std::vector<DetId> vNeighborsDetId;
  return  vNeighborsDetId;
}
std::vector< DetId > HcalTopology::east ( const DetId id) const [virtual]

Get the neighbors of the given cell in east direction

Implements CaloSubdetectorTopology.

Definition at line 108 of file HcalTopology.cc.

References decIEta(), and i.

Referenced by spr::newHCALIdEW().

                                                         {
  std::vector<DetId> vNeighborsDetId;
  HcalDetId neighbors[2];
  for (int i=0;i<decIEta(HcalDetId(id),neighbors);i++)
    vNeighborsDetId.push_back(DetId(neighbors[i].rawId()));
  return vNeighborsDetId;
}
int HcalTopology::exclude ( HcalSubdetector  subdet,
int  ieta1,
int  ieta2,
int  iphi1,
int  iphi2,
int  depth1 = 1,
int  depth2 = 4 
)

Exclude an eta/phi/depth range for a given subdetector

Definition at line 158 of file HcalTopology.cc.

References exclude(), excludeHB_, excludeHE_, excludeHF_, excludeHO_, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, max(), min, n, and validRaw().

                                                                                                                    {

  bool exed=false;
  // first, check the full detector exclusions...  (fast)
  switch (subdet) {
  case(HcalBarrel): exed=excludeHB_; break;
  case(HcalEndcap): exed=excludeHE_; break;
  case(HcalOuter): exed=excludeHO_; break;
  case(HcalForward): exed=excludeHF_; break;
  default: exed=false;
  }
  if (exed) return 0; // if the whole detector is excluded...

  int ieta_l=std::min(ieta1,ieta2);
  int ieta_h=std::max(ieta1,ieta2);
  int iphi_l=std::min(iphi1,iphi2);
  int iphi_h=std::max(iphi1,iphi2);
  int depth_l=std::min(depth1,depth2);
  int depth_h=std::max(depth1,depth2);

  int n=0;
  for (int ieta=ieta_l; ieta<=ieta_h; ieta++) 
    for (int iphi=iphi_l; iphi<=iphi_h; iphi++) 
      for (int depth=depth_l; depth<=depth_h; depth++) {
        HcalDetId id(subdet,ieta,iphi,depth);
        if (validRaw(id)) { // use 'validRaw' to include check validity in "uncut" detector
          exclude(id);  
          n++;
        }
      }
  return n;
}
void HcalTopology::exclude ( const HcalDetId id)

Add a cell to exclusion list

Definition at line 91 of file HcalTopology.cc.

References exclusionList_, and i.

Referenced by exclude(), and HcalTopologyRestrictionParser::parse().

                                              {
  std::vector<HcalDetId>::iterator i=std::lower_bound(exclusionList_.begin(),exclusionList_.end(),id);
  if (i==exclusionList_.end() || *i!=id) {
    exclusionList_.insert(i,id);
  }
}
void HcalTopology::excludeSubdetector ( HcalSubdetector  subdet)

Exclude an entire subdetector

Definition at line 98 of file HcalTopology.cc.

References excludeHB_, excludeHE_, excludeHF_, excludeHO_, HcalBarrel, HcalEndcap, HcalForward, and HcalOuter.

Referenced by HcalTopologyRestrictionParser::parse().

                                                            {
  switch (subdet) {
  case(HcalBarrel):  excludeHB_=true; break;
  case(HcalEndcap):  excludeHE_=true; break;
  case(HcalOuter):   excludeHO_=true; break;
  case(HcalForward): excludeHF_=true; break;
  default: break;
  }
}
int HcalTopology::firstHBRing ( ) const [inline]

Definition at line 78 of file HcalTopology.h.

References firstHBRing_.

Referenced by HcalHardcodeGeometryLoader::load().

{return firstHBRing_;}
int HcalTopology::firstHEDoublePhiRing ( ) const [inline]
int HcalTopology::firstHERing ( ) const [inline]
int HcalTopology::firstHETripleDepthRing ( ) const [inline]
int HcalTopology::firstHFQuadPhiRing ( ) const [inline]
int HcalTopology::firstHFRing ( ) const [inline]
int HcalTopology::firstHORing ( ) const [inline]

Definition at line 84 of file HcalTopology.h.

References firstHORing_.

Referenced by HcalHardcodeGeometryLoader::load().

{return firstHORing_;}
unsigned int HcalTopology::getCALIBSize ( ) const [inline]

Definition at line 115 of file HcalTopology.h.

References CALIBSize_.

Referenced by HcalCondObjectContainerBase::sizeFor().

{return CALIBSize_;}
void HcalTopology::getDepthSegmentation ( unsigned  ring,
std::vector< int > &  readoutDepths 
) const

for each of the ~17 depth segments, specify which readout bin they belong to if the ring is not found, the first one with a lower ring will be returned.

Definition at line 540 of file HcalTopology.cc.

References depthSegmentation_, Exception, pos, and relativeConstraints::ring.

Referenced by segmentBoundaries().

{
  // if it doesn't exist, return the first entry with a lower index.  So if we only
  // have entries for 1 and 17, any input from 1-16 should return the entry for ring 1
  SegmentationMap::const_iterator pos = depthSegmentation_.upper_bound(ring);
  if(pos == depthSegmentation_.begin()) {
    throw cms::Exception("HcalTopology") << "No depth segmentation found for ring" << ring;
  }
  --pos;
    // pos now refers to the last element with key <= ring.
  readoutDepths = pos->second;
}
unsigned int HcalTopology::getHBSize ( ) const [inline]

Definition at line 110 of file HcalTopology.h.

References HBSize_.

Referenced by HcalGeometry::init(), and HcalCondObjectContainerBase::sizeFor().

{return HBSize_;}
unsigned int HcalTopology::getHESize ( ) const [inline]

Definition at line 111 of file HcalTopology.h.

References HESize_.

Referenced by HcalGeometry::init(), and HcalCondObjectContainerBase::sizeFor().

{return HESize_;}
unsigned int HcalTopology::getHFSize ( ) const [inline]

Definition at line 113 of file HcalTopology.h.

References HFSize_.

Referenced by HcalGeometry::init(), and HcalCondObjectContainerBase::sizeFor().

{return HFSize_;}
unsigned int HcalTopology::getHOSize ( ) const [inline]
unsigned int HcalTopology::getHTSize ( ) const [inline]

Definition at line 114 of file HcalTopology.h.

References HTSize_.

Referenced by HcalCondObjectContainerBase::sizeFor().

{return HTSize_;}
unsigned int HcalTopology::getNumberOfShapes ( ) const [inline]

Definition at line 133 of file HcalTopology.h.

References numberOfShapes_.

Referenced by HcalGeometry::numberOfShapes().

{ return numberOfShapes_; }
int HcalTopology::incAIEta ( const HcalDetId id,
HcalDetId  neighbors[2] 
) const [private]

Get the neighbors of the given cell with higher absolute ieta

Increasing in |ieta|, there is always at most one neighbor

Definition at line 379 of file HcalTopology.cc.

References firstHEDoublePhiRing(), firstHFQuadPhiRing(), HcalEndcap, HcalForward, lastHBRing(), lastHERing(), n, and valid().

Referenced by decIEta(), and incIEta().

                                                                            {
  int n=1;
  int aieta=id.ietaAbs();

  if (aieta==firstHEDoublePhiRing()-1 && (id.iphi()%2)==0) 
    neighbors[0]=HcalDetId(id.subdet(),(aieta+1)*id.zside(),id.iphi()-1,id.depth());
  else if (aieta==firstHFQuadPhiRing()-1 && ((id.iphi()+1)%4)!=0) 
    neighbors[0]=HcalDetId(id.subdet(),(aieta+1)*id.zside(),((id.iphi()==1)?(71):(id.iphi()-2)),id.depth());
  else if (aieta==lastHBRing()) 
    neighbors[0]=HcalDetId(HcalEndcap,(aieta+1)*id.zside(),id.iphi(),1);
  else if (aieta==lastHERing()) 
    neighbors[0]=HcalDetId(HcalForward,(aieta+1)*id.zside(),id.iphi(),1);
  else
    neighbors[0]=HcalDetId(id.subdet(),(aieta+1)*id.zside(),id.iphi(),id.depth());
    
  if (!valid(neighbors[0])) n=0;
  return n;
}
int HcalTopology::incIEta ( const HcalDetId id,
HcalDetId  neighbors[2] 
) const

Get the neighbors of the given cell with higher (signed) ieta

Definition at line 368 of file HcalTopology.cc.

References decAIEta(), and incAIEta().

Referenced by west().

                                                                           {
  if (id.zside()==1) return incAIEta(id,neighbors);
  else return decAIEta(id,neighbors);
}
bool HcalTopology::incIPhi ( const HcalDetId id,
HcalDetId neighbor 
) const

Get the neighbor (if present) of the given cell with higher iphi

Definition at line 301 of file HcalTopology.cc.

References firstHEDoublePhiRing(), firstHFQuadPhiRing(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, IPHI_MAX, convertSQLiteXML::ok, and valid().

Referenced by north().

                                                                         {
  bool ok=valid(id);
  if (ok) {
    switch (id.subdet()) {
    case (HcalBarrel):
    case (HcalOuter):
      if (id.iphi()==IPHI_MAX) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth()); 
      else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+1,id.depth()); 
      break;
    case (HcalEndcap):
      if (id.ietaAbs()>=firstHEDoublePhiRing()) {
        if (id.iphi()==IPHI_MAX-1) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth()); 
        else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+2,id.depth()); 
      } else {
        if (id.iphi()==IPHI_MAX) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth()); 
        else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+1,id.depth()); 
      } 
      break;
    case (HcalForward):
      if (id.ietaAbs()>=firstHFQuadPhiRing()) {
        if (id.iphi()==IPHI_MAX-1) neighbor=HcalDetId(id.subdet(),id.ieta(),3,id.depth()); 
        else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+4,id.depth()); 
      } else {
        if (id.iphi()==IPHI_MAX-1) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth()); 
        else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+2,id.depth()); 
      }
      break;
    default: ok=false;
    }
  } 
  return ok;
}
bool HcalTopology::incrementDepth ( HcalDetId id) const

Get the detector behind this one

Definition at line 491 of file HcalTopology.cc.

References HcalDetId::depth(), depthBinInformation(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalDetId::ieta(), HcalDetId::ietaAbs(), HcalDetId::iphi(), lastHBRing(), lastHERing(), lastHORing(), HcalDetId::subdet(), and validRaw().

Referenced by HcalGeometry::getClosestCell(), and up().

{
  HcalSubdetector subdet = detId.subdet();
  int ieta = detId.ieta();
  int etaRing = detId.ietaAbs();
  int depth = detId.depth();
  int nDepthBins, startingBin;
  depthBinInformation(subdet, etaRing, nDepthBins, startingBin);

  // see if the new depth bin exists
  ++depth;
  if(depth > nDepthBins) {
    // handle on a case-by-case basis
    if(subdet == HcalBarrel && etaRing < lastHORing())  {
      // HO
      subdet = HcalOuter;
      depth = 4;
    } else if(subdet == HcalBarrel && etaRing == lastHBRing()) {
      // overlap
      subdet = HcalEndcap;
    } else if(subdet == HcalEndcap && etaRing ==  lastHERing()-1) {
      // guard ring HF29 is behind HE 28
      subdet = HcalForward;
      (ieta > 0) ? ++ieta : --ieta;
      depth = 1;
    } else if(subdet == HcalEndcap && etaRing ==  lastHERing()) {
      // split cells go to bigger granularity.  Ring 29 -> 28
      (ieta > 0) ? --ieta : ++ieta;
    } else {
      // no more chances
      detId = HcalDetId();
      return false;
    }
  }
  detId = HcalDetId(subdet, ieta, detId.iphi(), depth);
  //A.N.  
  // assert(validRaw(detId));
  return validRaw(detId);
  //A.N.  return true;
}
bool HcalTopology::isExcluded ( const HcalDetId id) const [private]

Definition at line 73 of file HcalTopology.cc.

References excludeHB_, excludeHE_, excludeHF_, excludeHO_, exclusionList_, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, and i.

Referenced by validHcal().

                                                       {
  bool exed=false;
  // first, check the full detector exclusions...  (fast)
  switch (id.subdet()) {
  case(HcalBarrel): exed=excludeHB_; break;
  case(HcalEndcap): exed=excludeHE_; break;
  case(HcalOuter): exed=excludeHO_; break;
  case(HcalForward): exed=excludeHF_; break;
  default: exed=false;
  }
  // next, check the list (slower)
  if (!exed && !exclusionList_.empty()) {
    std::vector<HcalDetId>::const_iterator i=std::lower_bound(exclusionList_.begin(),exclusionList_.end(),id);
    if (i!=exclusionList_.end() && *i==id) exed=true;
  }
  return exed;
}
int HcalTopology::lastHBRing ( ) const [inline]
int HcalTopology::lastHERing ( ) const [inline]
int HcalTopology::lastHFRing ( ) const [inline]
int HcalTopology::lastHORing ( ) const [inline]
int HcalTopology::maxDepthHB ( ) const [inline]

Definition at line 117 of file HcalTopology.h.

References maxDepthHB_.

Referenced by HcalTopologyIdealEP::produce().

{ return maxDepthHB_;}
int HcalTopology::maxDepthHE ( ) const [inline]

Definition at line 118 of file HcalTopology.h.

References maxDepthHE_.

Referenced by HcalTopologyIdealEP::produce().

{ return maxDepthHE_;}
HcalTopologyMode::Mode HcalTopology::mode ( void  ) const [inline]
unsigned int HcalTopology::ncells ( ) const [virtual]

return a count of valid cells (for dense indexing use)

Reimplemented from CaloSubdetectorTopology.

Definition at line 866 of file HcalTopology.cc.

References HBSize_, HESize_, HFSize_, and HOSize_.

Referenced by denseId2detId(), HcalHardcodeGeometryLoader::load(), HcalFlexiHardcodeGeometryLoader::load(), and HcalGeometry::sizeForDenseIndex().

std::vector< DetId > HcalTopology::north ( const DetId id) const [virtual]

Get the neighbors of the given cell in north direction

Implements CaloSubdetectorTopology.

Definition at line 124 of file HcalTopology.cc.

References incIPhi(), and DetId::rawId().

Referenced by spr::newHCALIdNS().

                                                          {
  std::vector<DetId> vNeighborsDetId;
  HcalDetId neighbor;
  if (incIPhi(HcalDetId(id),neighbor))
    vNeighborsDetId.push_back(DetId(neighbor.rawId()));
  return  vNeighborsDetId;
}
int HcalTopology::nPhiBins ( int  etaRing) const

how many phi segments in this ring

Definition at line 533 of file HcalTopology.cc.

References doublePhiBins_, firstHEDoublePhiRing(), firstHFQuadPhiRing(), and singlePhiBins_.

Referenced by HcalHardcodeGeometryLoader::fill(), CaloTowerHardcodeGeometryLoader::makeCell(), and HcalGeometry::phiBin().

                                            {
  int lastPhiBin=singlePhiBins_;
  if (etaRing>= firstHFQuadPhiRing()) lastPhiBin=doublePhiBins_/2;
  else if (etaRing>= firstHEDoublePhiRing()) lastPhiBin=doublePhiBins_;
  return lastPhiBin;
}
std::pair< int, int > HcalTopology::segmentBoundaries ( unsigned  ring,
unsigned  depth 
) const

returns the boundaries of the depth segmentation, so that the first result is the first segment, and the second result is the first one of the next segment. Used for calculating physical bounds.

Definition at line 558 of file HcalTopology.cc.

References getDepthSegmentation().

                                                                                     {
  std::vector<int> readoutDepths;
  getDepthSegmentation(ring, readoutDepths);
  int d1 = std::lower_bound(readoutDepths.begin(), readoutDepths.end(), depth) - readoutDepths.begin();
  int d2 = std::upper_bound(readoutDepths.begin(), readoutDepths.end(), depth) - readoutDepths.begin();
  return std::pair<int, int>(d1, d2);
}
void HcalTopology::setDepthSegmentation ( unsigned  ring,
const std::vector< int > &  readoutDepths 
)

Definition at line 553 of file HcalTopology.cc.

References depthSegmentation_, and relativeConstraints::ring.

{
  depthSegmentation_[ring] = readoutDepths;
}
int HcalTopology::singlePhiBins ( ) const [inline]

Definition at line 90 of file HcalTopology.h.

References singlePhiBins_.

{return singlePhiBins_;}
std::vector< DetId > HcalTopology::south ( const DetId id) const [virtual]

Get the neighbors of the given cell in south direction

Implements CaloSubdetectorTopology.

Definition at line 132 of file HcalTopology.cc.

References decIPhi(), and DetId::rawId().

Referenced by spr::newHCALIdNS().

                                                          {
  std::vector<DetId> vNeighborsDetId;
  HcalDetId neighbor;
  if (decIPhi(HcalDetId(id),neighbor))
    vNeighborsDetId.push_back(DetId(neighbor.rawId()));
  return  vNeighborsDetId;
}
int HcalTopology::topoVersion ( ) const [virtual]

return a version which identifies the given topology

Reimplemented from CaloSubdetectorTopology.

Definition at line 870 of file HcalTopology.cc.

References topoVersion_.

Referenced by HcalCondObjectContainerBase::HcalCondObjectContainerBase(), and HcalCondObjectContainerBase::setTopo().

                                    {
  return topoVersion_;
}
HcalTopologyMode::TriggerMode HcalTopology::triggerMode ( ) const [inline]

Definition at line 32 of file HcalTopology.h.

References triggerMode_.

{ return triggerMode_; }
std::vector< DetId > HcalTopology::up ( const DetId id) const [virtual]

Get the neighbors of the given cell in up direction (outward)

Implements CaloSubdetectorTopology.

Definition at line 140 of file HcalTopology.cc.

References incrementDepth().

Referenced by spr::matrixHCALIdsDepth().

                                                       {
  HcalDetId neighbor = id;
  //A.N.
  //  incrementDepth(neighbor);
  std::vector<DetId> vNeighborsDetId;
  if(incrementDepth(neighbor)) 
  {
    vNeighborsDetId.push_back(neighbor);
  }
  return  vNeighborsDetId;
}
bool HcalTopology::valid ( const DetId id) const [virtual]
bool HcalTopology::validDetIdPreLS1 ( const HcalDetId id) const [private]

Is this a valid cell id, ignoring the exclusion list

Basic rules used to derive this code:

HB has 72 towers in iphi. Ieta 1-14 have depth=1, Ieta 15-16 have depth=1 or 2.

HE ieta=16-20 have 72 towers in iphi ieta=21-29 have 36 towers in iphi ieta=16 is depth 3 only ieta=17 is depth 1 only ieta=18-26 & 29 have depth 1 and 2 ieta=27-28 has depth 1-3

HF ieta=29-39 have 36 in iphi ieta=40-41 have 18 in iphi (71,3,7,11...) all have two depths

HO has 15 towers in ieta and 72 in iphi and depth = 4 (one value)

At H2:

HE ieta 17 is two depths HE ieta 22- have 36 towers in iphi (starts one higher) HE ieta 24- has three depths

Definition at line 217 of file HcalTopology.cc.

References firstHERing(), firstHFQuadPhiRing(), firstHFRing(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, IPHI_MAX, lastHFRing(), and sd.

                                                             {
  const HcalSubdetector sd (id.subdet());
  const int             ie (id.ietaAbs());
  const int             ip (id.iphi());
  const int             dp (id.depth());

  return ( ( ip >=  1         ) &&
           ( ip <= IPHI_MAX   ) &&
           ( dp >=  1         ) &&
           ( ie >=  1         ) &&
           ( ( ( sd == HcalBarrel ) &&
               ( ( ( ie <= 14         ) &&
                   ( dp ==  1         )    ) ||
                 ( ( ( ie == 15 ) || ( ie == 16 ) ) && 
                   ( dp <= 2          )                ) ) ) ||
             (  ( sd == HcalEndcap ) &&
                ( ( ( ie == firstHERing() ) &&
                    ( dp ==  3 )          ) ||
                  ( ( ie == 17 ) &&
                    ( dp ==  1 )          ) ||
                  ( ( ie >= 18 ) &&
                    ( ie <= 20 ) &&
                    ( dp <=  2 )          ) ||
                  ( ( ie >= 21 ) &&
                    ( ie <= 26 ) &&
                    ( dp <=  2 ) &&
                    ( ip%2 == 1 )         ) ||
                  ( ( ie >= 27 ) &&
                    ( ie <= 28 ) &&
                    ( dp <=  3 ) &&
                    ( ip%2 == 1 )         ) ||
                  ( ( ie == 29 ) &&
                    ( dp <=  2 ) &&
                    ( ip%2 == 1 )         )          )      ) ||
             (  ( sd == HcalOuter ) &&
                ( ie <= 15 ) &&
                ( dp ==  4 )           ) ||
             (  ( sd == HcalForward ) &&
                ( dp <=  2 )          &&
                ( ( ( ie >= firstHFRing() ) &&
                    ( ie <  firstHFQuadPhiRing() ) &&
                    ( ip%2 == 1 )    ) ||
                  ( ( ie >= firstHFQuadPhiRing() ) &&
                    ( ie <= lastHFRing() ) &&
                    ( ip%4 == 3 )         )  ) ) ) ) ;
}
bool HcalTopology::validHcal ( const HcalDetId id) const

Is this a valid cell id?

Definition at line 64 of file HcalTopology.cc.

References isExcluded(), convertSQLiteXML::ok, and validRaw().

Referenced by valid().

                                                      {
  // check the raw rules
  bool ok=validRaw(id);

  ok=ok && !isExcluded(id);

  return ok;
}
bool HcalTopology::validRaw ( const HcalDetId id) const [private]

Is this a valid cell id?

Definition at line 265 of file HcalTopology.cc.

References firstHEDoublePhiRing(), firstHERing(), firstHETripleDepthRing(), firstHFQuadPhiRing(), firstHFRing(), HcalTopologyMode::H2, HcalTopologyMode::H2HE, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, IPHI_MAX, lastHBRing(), lastHERing(), lastHFRing(), lastHORing(), maxDepthHB_, maxDepthHE_, mode_, convertSQLiteXML::ok, and HcalTopologyMode::SLHC.

Referenced by exclude(), incrementDepth(), and validHcal().

                                                     {
  bool ok=true;
  int ieta=id.ieta();
  int aieta=id.ietaAbs();
  int depth=id.depth();
  int iphi=id.iphi();

  if ((ieta==0 || iphi<=0 || iphi>IPHI_MAX) || aieta>lastHFRing()) return false; // outer limits
    
  if (ok) {
    HcalSubdetector subdet=id.subdet();
    if (subdet==HcalBarrel) {
      if (mode_==HcalTopologyMode::SLHC || mode_==HcalTopologyMode::H2HE) {
        if ((aieta>lastHBRing() || depth>maxDepthHB_ || (aieta==lastHBRing() && depth > 2))) ok=false;
      } else {
        if (aieta>lastHBRing() || depth>2 || (aieta<=14 && depth>1)) ok=false;
      }
    } else if (subdet==HcalEndcap) {
      if (mode_==HcalTopologyMode::SLHC || mode_==HcalTopologyMode::H2HE) {
        if (depth>maxDepthHE_ || aieta<firstHERing() || aieta>lastHERing() || (aieta==firstHERing() && depth<3) || (aieta>=firstHEDoublePhiRing() && (iphi%2)==0)) ok=false;
      } else {
        if (depth>3 || aieta<firstHERing() || aieta>lastHERing() || (aieta==firstHERing() && depth!=3) || (aieta==17 && depth!=1 && mode_!=HcalTopologyMode::H2) || // special case at H2
            (((aieta>=17 && aieta<firstHETripleDepthRing()) || aieta==lastHERing()) && depth>2) ||
            (aieta>=firstHEDoublePhiRing() && (iphi%2)==0)) ok=false;
      }
    } else if (subdet==HcalOuter) {
      if (aieta>lastHORing() || iphi>IPHI_MAX || depth!=4) ok=false;
    } else if (subdet==HcalForward) {
      if (aieta<firstHFRing() || aieta>lastHFRing() || ((iphi%2)==0) || (depth>2) ||  (aieta>=firstHFQuadPhiRing() && ((iphi+1)%4)!=0)) ok=false;
    } else ok=false;
  }
    
  return ok;
}
std::vector< DetId > HcalTopology::west ( const DetId id) const [virtual]

Get the neighbors of the given cell in west direction

Implements CaloSubdetectorTopology.

Definition at line 116 of file HcalTopology.cc.

References i, and incIEta().

Referenced by spr::newHCALIdEW().

                                                         {
  std::vector<DetId> vNeighborsDetId;
  HcalDetId neighbors[2];
  for (int i=0;i<incIEta(HcalDetId(id),neighbors);i++)
    vNeighborsDetId.push_back(DetId(neighbors[i].rawId()));
  return  vNeighborsDetId;
}

Member Data Documentation

unsigned int HcalTopology::CALIBSize_ [private]

Definition at line 175 of file HcalTopology.h.

Referenced by getCALIBSize().

Definition at line 182 of file HcalTopology.h.

Referenced by getDepthSegmentation(), and setDepthSegmentation().

const int HcalTopology::doublePhiBins_ [private]

Definition at line 166 of file HcalTopology.h.

Referenced by doublePhiBins(), and nPhiBins().

bool HcalTopology::excludeHB_ [private]

Definition at line 147 of file HcalTopology.h.

Referenced by exclude(), excludeSubdetector(), and isExcluded().

bool HcalTopology::excludeHE_ [private]

Definition at line 147 of file HcalTopology.h.

Referenced by exclude(), excludeSubdetector(), and isExcluded().

bool HcalTopology::excludeHF_ [private]

Definition at line 147 of file HcalTopology.h.

Referenced by exclude(), excludeSubdetector(), and isExcluded().

bool HcalTopology::excludeHO_ [private]

Definition at line 147 of file HcalTopology.h.

Referenced by exclude(), excludeSubdetector(), and isExcluded().

std::vector<HcalDetId> HcalTopology::exclusionList_ [private]

Definition at line 146 of file HcalTopology.h.

Referenced by exclude(), and isExcluded().

const int HcalTopology::firstHBRing_ [private]

Definition at line 153 of file HcalTopology.h.

Referenced by firstHBRing().

Definition at line 162 of file HcalTopology.h.

Referenced by firstHEDoublePhiRing().

const int HcalTopology::firstHERing_ [private]

Definition at line 155 of file HcalTopology.h.

Referenced by firstHERing().

Definition at line 164 of file HcalTopology.h.

Referenced by firstHETripleDepthRing().

const int HcalTopology::firstHFQuadPhiRing_ [private]

Definition at line 163 of file HcalTopology.h.

Referenced by firstHFQuadPhiRing().

const int HcalTopology::firstHFRing_ [private]

Definition at line 157 of file HcalTopology.h.

Referenced by firstHFRing().

const int HcalTopology::firstHORing_ [private]

Definition at line 159 of file HcalTopology.h.

Referenced by firstHORing().

unsigned int HcalTopology::HBSize_ [private]

Definition at line 170 of file HcalTopology.h.

Referenced by denseId2detId(), detId2denseId(), getHBSize(), HcalTopology(), and ncells().

unsigned int HcalTopology::HESize_ [private]

Definition at line 171 of file HcalTopology.h.

Referenced by denseId2detId(), detId2denseId(), getHESize(), HcalTopology(), and ncells().

unsigned int HcalTopology::HFSize_ [private]

Definition at line 173 of file HcalTopology.h.

Referenced by getHFSize(), HcalTopology(), and ncells().

unsigned int HcalTopology::HOSize_ [private]

Definition at line 172 of file HcalTopology.h.

Referenced by denseId2detId(), detId2denseId(), getHOSize(), HcalTopology(), and ncells().

unsigned int HcalTopology::HTSize_ [private]

Definition at line 174 of file HcalTopology.h.

Referenced by getHTSize().

const int HcalTopology::lastHBRing_ [private]

Definition at line 154 of file HcalTopology.h.

Referenced by lastHBRing().

const int HcalTopology::lastHERing_ [private]

Definition at line 156 of file HcalTopology.h.

Referenced by lastHERing().

const int HcalTopology::lastHFRing_ [private]

Definition at line 158 of file HcalTopology.h.

Referenced by lastHFRing().

const int HcalTopology::lastHORing_ [private]

Definition at line 160 of file HcalTopology.h.

Referenced by lastHORing().

const int HcalTopology::maxDepthHB_ [private]
const int HcalTopology::maxDepthHE_ [private]

Definition at line 149 of file HcalTopology.h.

Referenced by depthBinInformation(), HcalTopology(), mode(), and validRaw().

const unsigned int HcalTopology::numberOfShapes_ [private]

Definition at line 176 of file HcalTopology.h.

Referenced by getNumberOfShapes().

const int HcalTopology::singlePhiBins_ [private]

Definition at line 165 of file HcalTopology.h.

Referenced by nPhiBins(), and singlePhiBins().

Definition at line 150 of file HcalTopology.h.

Referenced by triggerMode().