CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes

EcalTrigTowerDetId Class Reference

#include <EcalTrigTowerDetId.h>

Inheritance diagram for EcalTrigTowerDetId:
DetId

List of all members.

Public Types

enum  {
  kEETowersInPhiPerEndcap = 4* kEETowersInPhiPerQuadrant, kEEOuterEta = 18, kEEInnerEta = 28, kEETowersInEta = ( kEEInnerEta - kEEOuterEta + 1 ),
  kEBHalfTowers = kEBTowersPerSM*18, kEBTotalTowers = kEBHalfTowers*2, kEETowersPerEndcap = kEETowersInEta*kEETowersInPhiPerEndcap - 72, kEETotalTowers = kEETowersPerEndcap*2,
  kSizeForDenseIndexing = kEBTotalTowers + kEETotalTowers
}

Public Member Functions

uint32_t denseIndex () const
 EcalTrigTowerDetId (uint32_t rawid)
 EcalTrigTowerDetId (const DetId &id)
 EcalTrigTowerDetId ()
 EcalTrigTowerDetId (int zside, EcalSubdetector subdet, int i, int j, int mode=SUBDETIJMODE)
 Constructor from signed ieta, iphi.
int hashedIndex () const
 get a compact index for arrays [TODO: NEEDS WORK]
int iDCC () const
 get the ECAL DCC id - in the barrrel ism == iDCC
int ieta () const
 get the tower ieta
int ietaAbs () const
 get the absolute value of the tower ieta
int iphi () const
 get the tower iphi
int iquadrant () const
int iTT () const
 sequential index within one DCC
EcalTrigTowerDetIdoperator= (const DetId &id)
EcalSubdetector subDet () const
 get the subDetector associated to the Trigger Tower
int zside () const
 get the z-side of the tower (1/-1)

Static Public Member Functions

static EcalTrigTowerDetId detIdFromDenseIndex (uint32_t di)
static bool validDenseIndex (uint32_t din)
static bool validDetId (int iz, EcalSubdetector sd, int i, int j)
 check if a valid index combination

Static Public Attributes

static const int kEBTowersInEta = 17
static const int kEBTowersInPhi = 4
static const int kEBTowersPerSM = 68
static const int kEETowersInPhiPerQuadrant = 18
static const int MAX_I = 127
static const int MAX_J = 127
static const int MIN_I = 1
static const int MIN_J = 1
static const int SUBDETDCCTTMODE = 1
static const int SUBDETIJMODE = 0

Detailed Description

DetId for an Ecal Trigger tower

Id:
EcalTrigTowerDetId.h,v 1.9 2009/01/16 23:51:34 heltsley Exp

Definition at line 17 of file EcalTrigTowerDetId.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
kEETowersInPhiPerEndcap 
kEEOuterEta 
kEEInnerEta 
kEETowersInEta 
kEBHalfTowers 
kEBTotalTowers 
kEETowersPerEndcap 
kEETotalTowers 
kSizeForDenseIndexing 

Definition at line 126 of file EcalTrigTowerDetId.h.


Constructor & Destructor Documentation

EcalTrigTowerDetId::EcalTrigTowerDetId ( )

Constructor of a null id

Definition at line 5 of file EcalTrigTowerDetId.cc.

Referenced by detIdFromDenseIndex().

                                       {
}
EcalTrigTowerDetId::EcalTrigTowerDetId ( uint32_t  rawid)

Constructor from a raw value

Definition at line 9 of file EcalTrigTowerDetId.cc.

                                                     : DetId(rawid) {
}
EcalTrigTowerDetId::EcalTrigTowerDetId ( int  zside,
EcalSubdetector  subdet,
int  i,
int  j,
int  mode = SUBDETIJMODE 
)

Constructor from signed ieta, iphi.

Definition at line 12 of file EcalTrigTowerDetId.cc.

References EcalBarrel, Exception, i, DetId::id_, j, MAX_I, MAX_J, MIN_J, SUBDETDCCTTMODE, and SUBDETIJMODE.

  : DetId(Ecal,EcalTriggerTower) 
{
  int tower_i=0;
  int tower_j=0;

  if (mode == SUBDETIJMODE)
    {
      tower_i=i;
      tower_j=j;
    }
  else if (mode == SUBDETDCCTTMODE)
    {
      throw cms::Exception("InvalidDetId") << "EcalTriggerTowerDetId:  Cannot create object. SUBDETDCCTTMODE not yet implemented.";   
    }
  else
    throw cms::Exception("InvalidDetId") << "EcalTriggerTowerDetId:  Cannot create object.  Unknown mode for (int, EcalSubdetector, int, int) constructor.";
  
  if (tower_i > MAX_I || tower_i < MIN_I  || tower_j > MAX_J || tower_j < MIN_J)
    throw cms::Exception("InvalidDetId") << "EcalTriggerTowerDetId:  Cannot create object.  Indexes out of bounds.";
  
  id_|= ((zside>0)?(0x8000):(0x0)) | ((subDet == EcalBarrel)?(0x4000):(0x0)) | (tower_i<<7) | (tower_j & 0x7F);

}
EcalTrigTowerDetId::EcalTrigTowerDetId ( const DetId id)

Constructor from a generic cell id

Definition at line 37 of file EcalTrigTowerDetId.cc.

References DetId::det(), DetId::Ecal, EcalTriggerTower, Exception, DetId::id_, DetId::null(), DetId::rawId(), and DetId::subdetId().

{
  if (!gen.null() && ( gen.det()!=Ecal || gen.subdetId()!=EcalTriggerTower )) {
    throw cms::Exception("InvalidDetId");  }
  id_=gen.rawId();
}

Member Function Documentation

uint32_t EcalTrigTowerDetId::denseIndex ( ) const [inline]

Definition at line 92 of file EcalTrigTowerDetId.h.

References hashedIndex().

{ return hashedIndex() ; }
EcalTrigTowerDetId EcalTrigTowerDetId::detIdFromDenseIndex ( uint32_t  di) [static]

Definition at line 130 of file EcalTrigTowerDetId.cc.

References EcalBarrel, EcalEndcap, EcalTrigTowerDetId(), i, j, kEBHalfTowers, kEBTotalTowers, kEBTowersInPhi, kEBTowersPerSM, kEEOuterEta, kEETowersInPhiPerEndcap, kEETowersPerEndcap, and validDetId().

Referenced by EcalDCSTowerStatusXMLTranslator::dumpXML(), EcalDAQTowerStatusXMLTranslator::dumpXML(), EcalDAQTowerStatusXMLTranslator::plot(), EcalDCSTowerStatusXMLTranslator::plot(), and cond::PayLoadInspector< DataT >::plot().

{
   const EcalSubdetector sd ( di < kEBTotalTowers ? EcalBarrel : EcalEndcap ) ;
   const int iz ( di < kEBTotalTowers ? 
                  ( di < kEBHalfTowers ?  1 : -1 ) :
                  ( di - kEBTotalTowers < kEETowersPerEndcap ? -1 : 1 ) ) ;
   int i ;
   int j ;
   if( di < kEBTotalTowers ) // barrel
   {
      const unsigned int itt ( di%kEBTowersPerSM ) ;
      const unsigned int idc ( di/kEBTowersPerSM ) ;
      j = (idc%18)*kEBTowersInPhi + 
         ( (1+iz)/2 )*kEBTowersInPhi - 
         iz*(itt%kEBTowersInPhi)  + 1 - (1+iz)/2 - 2 ;
      if( j < 1 ) j += 72 ;
      i = 1 + itt/kEBTowersInPhi ;
   }
   else
   {
      const int eonly ( ( di - kEBTotalTowers )%kEETowersPerEndcap ) ;
      i = kEEOuterEta + eonly/kEETowersInPhiPerEndcap ;
      j = 1 + eonly%kEETowersInPhiPerEndcap ;
      if( 27 == i ) // last two rings have half of normal phi elementes
      {
         if( j > kEETowersInPhiPerEndcap/2 )
         {
            ++i ; 
            j -= kEETowersInPhiPerEndcap/2 ;
         }
         j = 2*j ;
         if( 0 < iz ) --j ;
      }
   }
   assert( validDetId( iz, sd, i, j ) ) ;
   return EcalTrigTowerDetId( iz, sd, i, j ) ;
}
int EcalTrigTowerDetId::hashedIndex ( ) const

get a compact index for arrays [TODO: NEEDS WORK]

Definition at line 117 of file EcalTrigTowerDetId.cc.

References EcalBarrel, iDCC(), ietaAbs(), iphi(), iTT(), kEBTotalTowers, kEBTowersPerSM, kEEOuterEta, kEETowersInPhiPerEndcap, kEETowersPerEndcap, subDet(), and zside().

Referenced by denseIndex(), popcon::EcalDCSHandler::getNewObjects(), popcon::EcalDAQHandler::getNewObjects(), EcalBarrelRecHitsMaker::init(), EcalBarrelRecHitsMaker::loadEcalBarrelRecHits(), EcalBarrelRecHitsMaker::loadPCaloHits(), and EcalEndcapRecHitsMaker::TThashedIndexforEE().

{
   const unsigned int iea ( ietaAbs() ) ;
   const unsigned int iph ( iphi()    ) ;
   return ( subDet() == EcalBarrel  ? 
            ( iDCC() - 1 )*kEBTowersPerSM + iTT() - 1 :
            kEBTotalTowers + ( ( zside() + 1 )/2 )*kEETowersPerEndcap +
            ( ( iea < 27 ? iea : 27 ) - kEEOuterEta )*kEETowersInPhiPerEndcap + 
            ( iea < 27 ? iph : // for iphi=27,28 only half TT present, odd for EE-, even EE+
              ( iea - 27 )*kEETowersInPhiPerEndcap/2 + ( iph + 1 )/2 ) - 1 ) ;
}
int EcalTrigTowerDetId::iDCC ( ) const

get the ECAL DCC id - in the barrrel ism == iDCC

Definition at line 53 of file EcalTrigTowerDetId.cc.

References EcalBarrel, Exception, iphi(), kEBTowersInPhi, subDet(), and zside().

Referenced by hashedIndex().

{
  if ( subDet() == EcalBarrel )
    {
      //Correction since iphi is uniformized with HB convention 
      int iphi_simple = iphi() + 2 ;
      if (iphi_simple > 72 ) iphi_simple = iphi_simple % 72;
      int id = ( iphi_simple - 1 ) / kEBTowersInPhi + 1;
      if ( zside() < 0 ) id += 18;
      return id;
    }
  else
    throw cms::Exception("MethodNotImplemented") << "EcalTriggerTowerDetId: iDCC not yet implemented";
}
int EcalTrigTowerDetId::ieta ( ) const [inline]
int EcalTrigTowerDetId::ietaAbs ( ) const [inline]

get the absolute value of the tower ieta

Definition at line 40 of file EcalTrigTowerDetId.h.

References DetId::id_.

Referenced by EcalTPGParamBuilder::analyze(), TPGCheck::analyze(), EcalTrigPrimAnalyzer::analyze(), EcalTrigPrimAnalyzerMIPs::analyze(), EcalSelectiveReadoutValidation::analyzeEB(), EcalSelectiveReadoutValidation::dccId(), TCCBlockFormatter::DigiToRaw(), hashedIndex(), ieta(), iTT(), EcalTrigPrimFunctionalAlgo::run_part2(), and EcalTrigTowerConstituentsMap::wrapEcalTrigTowerDetId().

   { 
     /*       if ( subDet() == EcalBarrel) */
     return (id_>>7)&0x7f; 
     /*       else */
     /*         throw(std::runtime_error("EcalTrigTowerDetId: ietaAbs not applicable for this subDetector.")); */
   }  
int EcalTrigTowerDetId::iphi ( ) const [inline]
int EcalTrigTowerDetId::iquadrant ( ) const

Definition at line 88 of file EcalTrigTowerDetId.cc.

References EcalEndcap, Exception, iphi(), kEETowersInPhiPerQuadrant, and subDet().

Referenced by EcalTrigTowerConstituentsMap::wrapEcalTrigTowerDetId().

{
  if ( subDet() == EcalEndcap )
    return int((iphi()-1)/kEETowersInPhiPerQuadrant)+1;
  else
    throw cms::Exception("MethodNotApplicable") << "EcalTriggerTowerDetId: iquadrant not applicable";
}  
int EcalTrigTowerDetId::iTT ( ) const

sequential index within one DCC

Definition at line 68 of file EcalTrigTowerDetId.cc.

References EcalBarrel, Exception, ietaAbs(), iphi(), kEBTowersInPhi, subDet(), and zside().

Referenced by hashedIndex().

{
  if ( subDet() == EcalBarrel )
    {
      int ie = ietaAbs() -1;
      int ip;
      int iphi_simple = iphi() + 2 ;
      if (iphi_simple > 72 )  iphi_simple = iphi_simple % 72;
      if (zside() < 0) {
        ip = (( iphi_simple -1 ) % kEBTowersInPhi ) + 1;
      } else {
        ip = kEBTowersInPhi - ((iphi_simple -1 ) % kEBTowersInPhi );
      }
      
      return (ie * kEBTowersInPhi) + ip;
    }
  else
    throw cms::Exception("MethodNotImplemented") << "EcalTriggerTowerDetId: iTT not yet implemented";
}
EcalTrigTowerDetId & EcalTrigTowerDetId::operator= ( const DetId id)

Assignment from a generic cell id

Definition at line 44 of file EcalTrigTowerDetId.cc.

References DetId::det(), DetId::Ecal, EcalTriggerTower, Exception, DetId::id_, DetId::null(), DetId::rawId(), and DetId::subdetId().

                                                                  {
  if (!gen.null() && ( gen.det()!=Ecal || gen.subdetId()!=EcalTriggerTower )) {
    throw cms::Exception("InvalidDetId");
  }
  id_=gen.rawId();
  return *this;
}
EcalSubdetector EcalTrigTowerDetId::subDet ( ) const [inline]
static bool EcalTrigTowerDetId::validDenseIndex ( uint32_t  din) [inline, static]

Definition at line 94 of file EcalTrigTowerDetId.h.

References kSizeForDenseIndexing.

{ return ( din < kSizeForDenseIndexing ) ; }
bool EcalTrigTowerDetId::validDetId ( int  iz,
EcalSubdetector  sd,
int  i,
int  j 
) [static]
int EcalTrigTowerDetId::zside ( ) const [inline]

get the z-side of the tower (1/-1)

Definition at line 34 of file EcalTrigTowerDetId.h.

References DetId::id_.

Referenced by EcalTPGParamBuilder::analyze(), EcalSelectiveReadoutValidation::analyzeEB(), hashedIndex(), iDCC(), ieta(), iTT(), and EcalTrigPrimFunctionalAlgo::run_part2().

{ return (id_&0x8000)?(1):(-1); }

Member Data Documentation

const int EcalTrigTowerDetId::kEBTowersInEta = 17 [static]

Definition at line 118 of file EcalTrigTowerDetId.h.

Referenced by validDetId().

const int EcalTrigTowerDetId::kEBTowersInPhi = 4 [static]

Definition at line 116 of file EcalTrigTowerDetId.h.

Referenced by detIdFromDenseIndex(), iDCC(), and iTT().

const int EcalTrigTowerDetId::kEBTowersPerSM = 68 [static]
const int EcalTrigTowerDetId::MAX_I = 127 [static]

Definition at line 113 of file EcalTrigTowerDetId.h.

Referenced by EcalTrigTowerDetId().

const int EcalTrigTowerDetId::MAX_J = 127 [static]

Definition at line 114 of file EcalTrigTowerDetId.h.

Referenced by EcalTrigTowerDetId().

const int EcalTrigTowerDetId::MIN_I = 1 [static]

Definition at line 111 of file EcalTrigTowerDetId.h.

const int EcalTrigTowerDetId::MIN_J = 1 [static]

Definition at line 112 of file EcalTrigTowerDetId.h.

Referenced by EcalTrigTowerDetId().

const int EcalTrigTowerDetId::SUBDETDCCTTMODE = 1 [static]

Definition at line 124 of file EcalTrigTowerDetId.h.

Referenced by EcalTrigTowerDetId().

const int EcalTrigTowerDetId::SUBDETIJMODE = 0 [static]