CMS 3D CMS Logo

Public Member Functions | Private Attributes

HcalTrigTowerGeometry Class Reference

#include <HcalTrigTowerGeometry.h>

List of all members.

Public Member Functions

std::vector< HcalDetIddetIds (const HcalTrigTowerDetId &) const
int firstHFRingInTower (int ietaTower) const
 since the towers are irregular in eta in HF
int firstHFTower () const
 HcalTrigTowerGeometry (const HcalTopology *topology)
int hfTowerEtaSize (int ieta) const
int nPhiBins (int ieta) const
 an interface for CaloSubdetectorGeometry
int nTowers () const
void setUpgradeConfigurationHFTowers (bool value)
void setupHF (bool useShortFibers, bool useQuadRings)
void towerEtaBounds (int ieta, double &eta1, double &eta2) const
 where this tower begins and ends in eta
std::vector< HcalTrigTowerDetIdtowerIds (const HcalDetId &cellId) const
 the mapping to and from DetIds

Private Attributes

const HcalTopologytheTopology
bool useHFQuadPhiRings_
bool useShortFibers_
bool useUpgradeConfigurationHFTowers_

Detailed Description

Definition at line 10 of file HcalTrigTowerGeometry.h.


Constructor & Destructor Documentation

HcalTrigTowerGeometry::HcalTrigTowerGeometry ( const HcalTopology topology)

Member Function Documentation

std::vector< HcalDetId > HcalTrigTowerGeometry::detIds ( const HcalTrigTowerDetId hcalTrigTowerDetId) const

Definition at line 84 of file HcalTrigTowerGeometry.cc.

References abs, HcalTopology::depthBinInformation(), HcalTopology::firstHEDoublePhiRing(), HcalTopology::firstHERing(), HcalTopology::firstHFRing(), firstHFRingInTower(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, hfTowerEtaSize(), HcalTrigTowerDetId::ieta(), HcalTrigTowerDetId::iphi(), HcalTopology::lastHBRing(), HcalTopology::lastHERing(), HcalTopology::lastHORing(), nPhiBins(), python::entryComment::results, theTopology, and useUpgradeConfigurationHFTowers_.

                                                                                 {
  // Written, tested by E. Berry (Princeton)
  std::vector<HcalDetId> results;

  int tower_ieta = hcalTrigTowerDetId.ieta();
  int tower_iphi = hcalTrigTowerDetId.iphi();

  int cell_ieta = tower_ieta;
  int cell_iphi = tower_iphi;

  int min_depth, n_depths;

  // HB
  
  if (abs(cell_ieta) <= theTopology->lastHBRing()){
    theTopology->depthBinInformation(HcalBarrel, abs(tower_ieta), n_depths, min_depth);
    for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
      results.push_back(HcalDetId(HcalBarrel,cell_ieta,cell_iphi,cell_depth));
  }

  // HO
  
  if (abs(cell_ieta) <= theTopology->lastHORing()){ 
    theTopology->depthBinInformation(HcalOuter , abs(tower_ieta), n_depths, min_depth);  
    for (int ho_depth = min_depth; ho_depth <= min_depth + n_depths - 1; ho_depth++)
      results.push_back(HcalDetId(HcalOuter, cell_ieta,cell_iphi,ho_depth));
  }

  // HE 

  if (abs(cell_ieta) >= theTopology->firstHERing() && 
      abs(cell_ieta) <  theTopology->lastHERing()){   

    theTopology->depthBinInformation(HcalEndcap, abs(tower_ieta), n_depths, min_depth);
    
    // Special for double-phi cells
    if (abs(cell_ieta) >= theTopology->firstHEDoublePhiRing())
      if (tower_iphi%2 == 0) cell_iphi = tower_iphi - 1;
    
    for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
      results.push_back(HcalDetId(HcalEndcap, cell_ieta, cell_iphi, cell_depth));
    
    // Special for split-eta cells
    if (abs(tower_ieta) == 28){
      theTopology->depthBinInformation(HcalEndcap, abs(tower_ieta)+1, n_depths, min_depth);
      for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++){
        if (tower_ieta < 0) results.push_back(HcalDetId(HcalEndcap, tower_ieta - 1, cell_iphi, cell_depth));
        if (tower_ieta > 0) results.push_back(HcalDetId(HcalEndcap, tower_ieta + 1, cell_iphi, cell_depth));
      }
    }
    
  }
    
  // HF 

  if (abs(cell_ieta) >= theTopology->firstHFRing()){  

    int HfTowerPhiSize;
    if   ( useUpgradeConfigurationHFTowers_ ) HfTowerPhiSize = 1;
    else                                      HfTowerPhiSize = 72 / nPhiBins(tower_ieta);
    
    int HfTowerEtaSize     = hfTowerEtaSize(tower_ieta);
    int FirstHFRingInTower = firstHFRingInTower(abs(tower_ieta));

    for (int iHFTowerPhiSegment = 0; iHFTowerPhiSegment < HfTowerPhiSize; iHFTowerPhiSegment++){      
            
      cell_iphi =  (tower_iphi / HfTowerPhiSize) * HfTowerPhiSize; // Find the minimum phi segment
      if ( !useUpgradeConfigurationHFTowers_ ) cell_iphi -= 2; // The first trigger tower starts at HCAL iphi = 71, not HCAL iphi = 1
      cell_iphi += iHFTowerPhiSegment;       // Get all of the HCAL iphi values in this trigger tower
      cell_iphi += 72;                       // Don't want to take the mod of a negative number
      cell_iphi =  cell_iphi % 72;           // There are, at most, 72 cells.
      if ( !useUpgradeConfigurationHFTowers_) cell_iphi += 1;// There is no cell at iphi = 0
      
      if (cell_iphi%2 == 0) continue;        // These cells don't exist.

      for (int iHFTowerEtaSegment = 0; iHFTowerEtaSegment < HfTowerEtaSize; iHFTowerEtaSegment++){
                
        cell_ieta = FirstHFRingInTower + iHFTowerEtaSegment;

        if (cell_ieta >= 40 && cell_iphi%4 == 1) continue;  // These cells don't exist.

        theTopology->depthBinInformation(HcalForward, cell_ieta, n_depths, min_depth);  

        // Negative tower_ieta -> negative cell_ieta
        int zside = 1;
        if (tower_ieta < 0) zside = -1;

        cell_ieta *= zside;            

        for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
          results.push_back(HcalDetId(HcalForward, cell_ieta, cell_iphi, cell_depth));
        
        if ( zside * cell_ieta == 30 ) {
          theTopology->depthBinInformation(HcalForward, 29 * zside, n_depths, min_depth);  
          for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++) 
            results.push_back(HcalDetId(HcalForward, 29 * zside , cell_iphi, cell_depth));
        }
        
      }    
    }
  }

  return results;
}
int HcalTrigTowerGeometry::firstHFRingInTower ( int  ietaTower) const

since the towers are irregular in eta in HF

Definition at line 202 of file HcalTrigTowerGeometry.cc.

References abs, HcalTopology::firstHFRing(), firstHFTower(), hfTowerEtaSize(), query::result, and theTopology.

Referenced by detIds(), towerEtaBounds(), and towerIds().

                                                                 {
  // count up to the correct HF ring
  int inputTower = abs(ietaTower);
  int result = theTopology->firstHFRing();
  for(int iTower = firstHFTower(); iTower != inputTower; ++iTower) {
    result += hfTowerEtaSize(iTower);
  }
  
  // negative in, negative out.
  if(ietaTower < 0) result *= -1;
  return result;
}
int HcalTrigTowerGeometry::firstHFTower ( ) const [inline]
int HcalTrigTowerGeometry::hfTowerEtaSize ( int  ieta) const

the number of HF eta rings in this trigger tower ieta starts at firstHFTower()

Definition at line 190 of file HcalTrigTowerGeometry.cc.

References abs, firstHFTower(), nTowers(), and useUpgradeConfigurationHFTowers_.

Referenced by detIds(), firstHFRingInTower(), and towerEtaBounds().

                                                        {
  
  if ( useUpgradeConfigurationHFTowers_ ) return 1;
  
  int ietaAbs = abs(ieta); 
  assert(ietaAbs >= firstHFTower() && ietaAbs <= nTowers());
  // the first three come from rings 29-31, 32-34, 35-37. The last has 4 rings: 38-41
  return (ietaAbs == nTowers()) ? 4 : 3;
  
}
int HcalTrigTowerGeometry::nPhiBins ( int  ieta) const [inline]

an interface for CaloSubdetectorGeometry

the number of phi bins in this eta ring

Definition at line 25 of file HcalTrigTowerGeometry.h.

References abs, firstHFTower(), and useUpgradeConfigurationHFTowers_.

Referenced by detIds().

                               {
    int nPhiBinsHF = ( useUpgradeConfigurationHFTowers_ ? 36 : 18 );   
    return (abs(ieta) < firstHFTower()) ? 72 : nPhiBinsHF;
  }
int HcalTrigTowerGeometry::nTowers ( ) const [inline]

Definition at line 31 of file HcalTrigTowerGeometry.h.

Referenced by hfTowerEtaSize().

{return 32;}
void HcalTrigTowerGeometry::setUpgradeConfigurationHFTowers ( bool  value) [inline]
void HcalTrigTowerGeometry::setupHF ( bool  useShortFibers,
bool  useQuadRings 
)

Definition at line 17 of file HcalTrigTowerGeometry.cc.

References useHFQuadPhiRings_, and useShortFibers_.

                                                                          {
  useShortFibers_=useShortFibers;
  useHFQuadPhiRings_=useQuadRings;
}
void HcalTrigTowerGeometry::towerEtaBounds ( int  ieta,
double &  eta1,
double &  eta2 
) const

where this tower begins and ends in eta

Definition at line 216 of file HcalTrigTowerGeometry.cc.

References abs, HcalTopology::firstHFRing(), firstHFRingInTower(), firstHFTower(), hfTowerEtaSize(), HcalTopology::lastHERing(), theHBHEEtaBounds, theHFEtaBounds, theTopology, and tmp.

Referenced by L1CaloHcalScaleConfigOnlineProd::newObject().

                                                                                       {
  int ietaAbs = abs(ieta);
  if(ietaAbs < firstHFTower()) {
    eta1 = theHBHEEtaBounds[ietaAbs-1];
    eta2 = theHBHEEtaBounds[ietaAbs];
    // the last tower is split, so get tower 29, too
    if(ietaAbs == theTopology->lastHERing()-1) {
      eta2 = theHBHEEtaBounds[ietaAbs+1];
    } 
  } else {
    // count from 0
    int hfIndex = firstHFRingInTower(ietaAbs) - theTopology->firstHFRing();
    eta1 = theHFEtaBounds[hfIndex];
    eta2 = theHFEtaBounds[hfIndex + hfTowerEtaSize(ieta)];
  }

  // get the signs and order right
  if(ieta < 0) {
    double tmp = eta1;
    eta1 = -eta2;
    eta2 = -tmp;
  }
}
std::vector< HcalTrigTowerDetId > HcalTrigTowerGeometry::towerIds ( const HcalDetId cellId) const

the mapping to and from DetIds

Definition at line 23 of file HcalTrigTowerGeometry.cc.

References HcalDetId::depth(), HcalTopology::firstHEDoublePhiRing(), HcalTopology::firstHFQuadPhiRing(), firstHFRingInTower(), firstHFTower(), HcalForward, HcalDetId::ieta(), HcalDetId::ietaAbs(), createXMLFile::iphi, HcalDetId::iphi(), HcalTopology::lastHERing(), python::entryComment::results, edm::shift, HcalDetId::subdet(), theTopology, useHFQuadPhiRings_, useShortFibers_, useUpgradeConfigurationHFTowers_, and HcalDetId::zside().

Referenced by HcalTriggerPrimitiveAlgo::addSignal(), and HcalTriggerPrimitiveAlgo::runFEFormatError().

                                                              {

  std::vector<HcalTrigTowerDetId> results;

  int HfTowerPhiSize, shift;
  if ( useUpgradeConfigurationHFTowers_ ) { 
    HfTowerPhiSize = 1;
    shift = 0;
  } else {
    HfTowerPhiSize = 4;
    shift = 1;
  }
  
  if(cellId.subdet() == HcalForward) {
    // short fibers don't count
    if(cellId.depth() == 1 || useShortFibers_) {
      // first do eta
      int hfRing = cellId.ietaAbs();
      int ieta = firstHFTower(); 
      // find the tower that contains this ring
      while(hfRing >= firstHFRingInTower(ieta+1)) {
        ++ieta;
      }
      
      if ( useUpgradeConfigurationHFTowers_ && ieta == 29) {
        ieta = 30; 
      }

      ieta *= cellId.zside();

      // now for phi
      // HF towers are quad, 18 in phi.
      // go two cells per trigger tower.

      int iphi = (((cellId.iphi()+shift)/HfTowerPhiSize) * HfTowerPhiSize + shift)%72; // 71+1 --> 1, 3+5 --> 5
      if (useHFQuadPhiRings_ || cellId.ietaAbs() < theTopology->firstHFQuadPhiRing())
        results.push_back( HcalTrigTowerDetId(ieta, iphi) );
    }
      
  } else {
    // the first twenty rings are one-to-one
    if(cellId.ietaAbs() < theTopology->firstHEDoublePhiRing()) {    
      results.push_back( HcalTrigTowerDetId(cellId.ieta(), cellId.iphi()) );
    } else {
      // the remaining rings are two-to-one in phi
      int iphi1 = cellId.iphi();
      int ieta = cellId.ieta();
      // the last eta ring in HE is split.  Recombine.
      if(ieta == theTopology->lastHERing()) --ieta;
      if(ieta == -theTopology->lastHERing()) ++ieta;

      results.push_back( HcalTrigTowerDetId(ieta, iphi1) );
      results.push_back( HcalTrigTowerDetId(ieta, iphi1+1) );
    }
  }

  return results;
}

Member Data Documentation

Definition at line 48 of file HcalTrigTowerGeometry.h.

Referenced by detIds(), firstHFRingInTower(), towerEtaBounds(), and towerIds().

Definition at line 50 of file HcalTrigTowerGeometry.h.

Referenced by HcalTrigTowerGeometry(), setupHF(), and towerIds().

Definition at line 49 of file HcalTrigTowerGeometry.h.

Referenced by HcalTrigTowerGeometry(), setupHF(), and towerIds().