CMS 3D CMS Logo

Public Member Functions | 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
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
int doublePhiBins () const
virtual std::vector< DetIddown (const DetId &id) const
virtual std::vector< DetIdeast (const DetId &id) const
int exclude (HcalSubdetector subdet, int ieta1, int ieta2, int iphi1, int iphi2, int depth1=1, int depth2=4)
void exclude (const HcalDetId &id)
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
 HcalTopology (bool h2_mode=false)
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
virtual std::vector< DetIdnorth (const DetId &id) const
int nPhiBins (int etaRing) const
 how many phi segments in this ring
int singlePhiBins () const
virtual std::vector< DetIdsouth (const DetId &id) const
virtual std::vector< DetIdup (const DetId &id) const
virtual bool valid (const HcalDetId &id) const
virtual std::vector< DetIdwest (const DetId &id) const

Private Member Functions

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

Private Attributes

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_
bool h2mode_
const int lastHBRing_
const int lastHERing_
const int lastHFRing_
const int lastHORing_
const int singlePhiBins_

Detailed Description

The HcalTopology class contains a set of hardcoded 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:
2007/05/11 14:12:24
Revision:
1.8
Author:
J. Mans - Minnesota

Definition at line 24 of file HcalTopology.h.


Constructor & Destructor Documentation

HcalTopology::HcalTopology ( bool  h2_mode = false)

Definition at line 9 of file HcalTopology.cc.

Referenced by HcalTopologyIdealEP::produce().

                                       :
  excludeHB_(false),
  excludeHE_(false),
  excludeHO_(false),
  excludeHF_(false),
  h2mode_(h2_mode),
  firstHBRing_(1),
  lastHBRing_(16),
  firstHERing_(16),
  lastHERing_(29),
  firstHFRing_(29),
  lastHFRing_(41),
  firstHORing_(1),
  lastHORing_(15),
  firstHEDoublePhiRing_((h2_mode)?(22):(21)),
  firstHFQuadPhiRing_(40),
  firstHETripleDepthRing_((h2_mode)?(24):(27)),
  singlePhiBins_(72),
  doublePhiBins_(36)
{
}

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 317 of file HcalTopology.cc.

References firstHEDoublePhiRing(), firstHFQuadPhiRing(), HcalBarrel, HcalEndcap, HcalForward, 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(HcalEndcap,(aieta-1)*id.zside(),id.iphi(),id.depth());
    neighbors[1]=HcalDetId(HcalEndcap,(aieta-1)*id.zside(),id.iphi()+1,id.depth());
  } else if (aieta==firstHFQuadPhiRing()) {
    n=2;
    neighbors[0]=HcalDetId(HcalForward,(aieta-1)*id.zside(),id.iphi(),id.depth());
    if (id.iphi()==IPHI_MAX-1) neighbors[1]=HcalDetId(HcalForward,(aieta-1)*id.zside(),1,id.depth());
    else neighbors[1]=HcalDetId(HcalForward,(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 291 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 253 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;
}
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 353 of file HcalTopology.cc.

References dtNoiseDBValidation_cfg::cerr, firstHETripleDepthRing(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, and lastHERing().

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

                                                                                  {
  if(subdet == HcalBarrel) {
    if (etaRing<=14) {
      nDepthBins = 1;
      startingBin = 1;
    } else {
      nDepthBins = 2;
      startingBin = 1;
    }
  } else if(subdet == HcalEndcap) {
    if (etaRing==16) {
      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;
  }
}
int HcalTopology::doublePhiBins ( ) const [inline]

Definition at line 74 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 120 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 76 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;
}
void HcalTopology::exclude ( const HcalDetId id)

Add a cell to exclusion list

Definition at line 59 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);
  }
}
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 126 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::excludeSubdetector ( HcalSubdetector  subdet)

Exclude an entire subdetector

Definition at line 66 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 61 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]

Definition at line 72 of file HcalTopology.h.

References firstHETripleDepthRing_.

Referenced by depthBinInformation(), and validRaw().

int HcalTopology::firstHFQuadPhiRing ( ) const [inline]
int HcalTopology::firstHFRing ( ) const [inline]
int HcalTopology::firstHORing ( ) const [inline]

Definition at line 67 of file HcalTopology.h.

References firstHORing_.

Referenced by HcalHardcodeGeometryLoader::load().

{return firstHORing_;}
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 297 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(HcalEndcap,(aieta+1)*id.zside(),id.iphi()-1,id.depth());
  else if (aieta==firstHFQuadPhiRing()-1 && ((id.iphi()+1)%4)!=0) 
    neighbors[0]=(id.iphi()==1)? HcalDetId(HcalForward,(aieta+1)*id.zside(),71,id.depth()) : HcalDetId(HcalForward,(aieta+1)*id.zside(),(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 286 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 219 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 396 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 41 of file HcalTopology.cc.

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

Referenced by valid().

                                                       {
  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]
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 92 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 448 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;
}
int HcalTopology::singlePhiBins ( ) const [inline]

Definition at line 73 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 100 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;
}
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 108 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 HcalDetId id) const [virtual]
bool HcalTopology::validRaw ( 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 Is this a valid cell id?

Definition at line 186 of file HcalTopology.cc.

References firstHEDoublePhiRing(), firstHETripleDepthRing(), firstHFQuadPhiRing(), firstHFRing(), h2mode_, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, IPHI_MAX, lastHERing(), lastHFRing(), and convertSQLiteXML::ok.

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

                                                     {
  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>41) return false; // outer limits
    
  if (ok) {
    HcalSubdetector subdet=id.subdet();
    if (subdet==HcalBarrel) {
      if (aieta>16 || depth>2 || (aieta<=14 && depth>1)) ok=false;          
    } else if (subdet==HcalEndcap) {
      if (depth>3 || aieta<16 || aieta>lastHERing() ||
          (aieta==16 && depth!=3) ||
          (aieta==17 && depth!=1 && !h2mode_) || // special case at H2
          (((aieta>=17 && aieta<firstHETripleDepthRing()) || aieta==29) && depth>2) ||
          (aieta>=firstHEDoublePhiRing() && (iphi%2)==0)) ok=false;
    } else if (subdet==HcalOuter) {
      if (aieta>15 || 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 84 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

const int HcalTopology::doublePhiBins_ [private]

Definition at line 111 of file HcalTopology.h.

Referenced by doublePhiBins(), and nPhiBins().

bool HcalTopology::excludeHB_ [private]

Definition at line 93 of file HcalTopology.h.

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

bool HcalTopology::excludeHE_ [private]

Definition at line 93 of file HcalTopology.h.

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

bool HcalTopology::excludeHF_ [private]

Definition at line 93 of file HcalTopology.h.

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

bool HcalTopology::excludeHO_ [private]

Definition at line 93 of file HcalTopology.h.

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

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

Definition at line 92 of file HcalTopology.h.

Referenced by exclude(), and isExcluded().

const int HcalTopology::firstHBRing_ [private]

Definition at line 98 of file HcalTopology.h.

Referenced by firstHBRing().

Definition at line 107 of file HcalTopology.h.

Referenced by firstHEDoublePhiRing().

const int HcalTopology::firstHERing_ [private]

Definition at line 100 of file HcalTopology.h.

Referenced by firstHERing().

Definition at line 109 of file HcalTopology.h.

Referenced by firstHETripleDepthRing().

const int HcalTopology::firstHFQuadPhiRing_ [private]

Definition at line 108 of file HcalTopology.h.

Referenced by firstHFQuadPhiRing().

const int HcalTopology::firstHFRing_ [private]

Definition at line 102 of file HcalTopology.h.

Referenced by firstHFRing().

const int HcalTopology::firstHORing_ [private]

Definition at line 104 of file HcalTopology.h.

Referenced by firstHORing().

bool HcalTopology::h2mode_ [private]

Definition at line 95 of file HcalTopology.h.

Referenced by validRaw().

const int HcalTopology::lastHBRing_ [private]

Definition at line 99 of file HcalTopology.h.

Referenced by lastHBRing().

const int HcalTopology::lastHERing_ [private]

Definition at line 101 of file HcalTopology.h.

Referenced by lastHERing().

const int HcalTopology::lastHFRing_ [private]

Definition at line 103 of file HcalTopology.h.

Referenced by lastHFRing().

const int HcalTopology::lastHORing_ [private]

Definition at line 105 of file HcalTopology.h.

Referenced by lastHORing().

const int HcalTopology::singlePhiBins_ [private]

Definition at line 110 of file HcalTopology.h.

Referenced by nPhiBins(), and singlePhiBins().