CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

CastorTopology Class Reference

#include <CastorTopology.h>

Inheritance diagram for CastorTopology:
CaloSubdetectorTopology

List of all members.

Public Member Functions

 CastorTopology ()
virtual std::vector< DetIddown (const DetId &id) const
virtual std::vector< DetIdeast (const DetId &id) const
void exclude (int zside, HcalCastorDetId::Section section)
void exclude (const HcalCastorDetId &id)
int exclude (int zside, HcalCastorDetId::Section section1, int isec1, int imod1, HcalCastorDetId::Section section2, int isec2, int imod2)
void exclude (int zside)
int firstCell (HcalCastorDetId::Section section) const
virtual std::vector< DetIdincModule (const DetId &id) const
virtual std::vector< DetIdincSector (const DetId &id) const
int lastCell (HcalCastorDetId::Section section) const
int ncells (HcalCastorDetId::Section section) const
virtual std::vector< DetIdnorth (const DetId &id) const
virtual std::vector< DetIdsouth (const DetId &id) const
virtual std::vector< DetIdup (const DetId &id) const
virtual bool valid (const HcalCastorDetId &id) const
virtual bool validRaw (const HcalCastorDetId &id) const
virtual std::vector< DetIdwest (const DetId &id) const

Private Member Functions

int firstEMModule () const
int firstHADModule () const
bool isExcluded (const HcalCastorDetId &id) const
int lastEMModule () const
int lastHADModule () const

Private Attributes

bool excludeEM_
bool excludeHAD_
bool excludeZN_
bool excludeZP_
std::vector< HcalCastorDetIdexclusionList_
int firstEMModule_
int firstHADModule_
int lastEMModule_
int lastHADModule_

Detailed Description

Author:
P. Katsas - UoA

Definition at line 13 of file CastorTopology.h.


Constructor & Destructor Documentation

CastorTopology::CastorTopology ( )

Definition at line 9 of file CastorTopology.cc.


Member Function Documentation

std::vector< DetId > CastorTopology::down ( const DetId id) const [virtual]

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

Implements CaloSubdetectorTopology.

Definition at line 226 of file CastorTopology.cc.

References gather_cfg::cout.

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

Get the neighbors of the given cell in east direction

Implements CaloSubdetectorTopology.

Definition at line 194 of file CastorTopology.cc.

References gather_cfg::cout.

{
  std::cout << "CastorTopology::east() not yet implemented" << std::endl;
  std::vector<DetId> vNeighborsDetId;
  return  vNeighborsDetId;
}
void CastorTopology::exclude ( const HcalCastorDetId id)

Exlucde a cell

Definition at line 54 of file CastorTopology.cc.

References exclusionList_, and i.

Referenced by exclude().

                                                      {
  std::vector<HcalCastorDetId>::iterator 
    i=std::lower_bound(exclusionList_.begin(),exclusionList_.end(),id);
  if (i==exclusionList_.end() || *i!=id) {
    exclusionList_.insert(i,id);
  }
}
void CastorTopology::exclude ( int  zside)

Exclude a side

Definition at line 62 of file CastorTopology.cc.

References excludeZN_, and excludeZP_.

                                      {
 switch(zside){
  case( 1): excludeZP_ = true; break;
  case(-1): excludeZN_ = true; break;
  default: break;
  }
}
int CastorTopology::exclude ( int  zside,
HcalCastorDetId::Section  section1,
int  isec1,
int  imod1,
HcalCastorDetId::Section  section2,
int  isec2,
int  imod2 
)

Exclude a range of channels (deph) for a given subdetector

Definition at line 83 of file CastorTopology.cc.

References HcalCastorDetId::EM, exclude(), excludeEM_, excludeHAD_, excludeZN_, excludeZP_, HcalCastorDetId::HAD, n, and validRaw().

                                                       {
  bool exed = false;
  switch(zside){
  case( 1): exed = excludeZP_; break;
  case(-1): exed = excludeZN_; break;
  default: exed = false;
  }
  if (exed) return 0;


/* NOTE not so sure about the exclusion */
  if (section1 == HcalCastorDetId::EM && section2 == HcalCastorDetId::EM) {
        exed = excludeEM_; }
  else if (section1 == HcalCastorDetId::HAD && section2 == HcalCastorDetId::HAD) {
        exed = excludeHAD_; }
  else { exed = false; };

  if (exed) return 0;

  bool isPositive = false;
  if(zside == 1)isPositive = true;

  int n = 0;
  for (int isec = isec1; isec < isec2; isec++){
     for (int imod = imod1; imod < imod2; imod++) {
    HcalCastorDetId id(section1, isPositive, isec, imod);  
    if(validRaw(id))exclude(id);
    n++;
   }
  }
  return n;
}
void CastorTopology::exclude ( int  zside,
HcalCastorDetId::Section  section 
)

Exclude a section, in either side (+1 positive, -1 negative)

Definition at line 70 of file CastorTopology.cc.

References HcalCastorDetId::EM, excludeEM_, excludeHAD_, excludeZN_, excludeZP_, and HcalCastorDetId::HAD.

                                                                      {
  switch(zside){
  case( 1): excludeZP_ = true; break;
  case(-1): excludeZN_ = true; break;
  default: break;
  }
  switch (section) {
  case(HcalCastorDetId::EM)  : excludeEM_ = true; break; 
  case(HcalCastorDetId::HAD) : excludeHAD_ = true; break; 
  default: break;
  }
}
int CastorTopology::firstCell ( HcalCastorDetId::Section  section) const

Definition at line 243 of file CastorTopology.cc.

References HcalCastorDetId::EM, firstEMModule_, firstHADModule_, HcalCastorDetId::HAD, and HcalCastorDetId::Unknown.

Referenced by CastorHardcodeGeometryLoader::fill().

                                                                 {
  int firstCell = 0;
  switch (section) {
  case(HcalCastorDetId::EM) : firstCell = firstEMModule_ ; break;
  case(HcalCastorDetId::HAD) : firstCell = firstHADModule_; break; 
  case(HcalCastorDetId::Unknown) : firstCell  = 0; break;
  }
  return firstCell;
}
int CastorTopology::firstEMModule ( ) const [inline, private]

Definition at line 63 of file CastorTopology.h.

References firstEMModule_.

{return firstEMModule_;}
int CastorTopology::firstHADModule ( ) const [inline, private]

Definition at line 64 of file CastorTopology.h.

References firstHADModule_.

{return firstHADModule_;}  
std::vector< DetId > CastorTopology::incModule ( const DetId id) const [virtual]

Get the neigbors of the given cell with higher module

Definition at line 154 of file CastorTopology.cc.

References HcalCastorDetId::EM, HcalCastorDetId::HAD, HcalCastorDetId::module(), MODULE_EM_MAX, MODULE_HAD_MAX, DetId::rawId(), HcalCastorDetId::section(), HcalCastorDetId::sector(), validRaw(), and HcalCastorDetId::zside().

                                                               {
  std::vector<DetId> vNeighborsDetId;
  HcalCastorDetId castorId = HcalCastorDetId(id);
  HcalCastorDetId castorDetId;
  if(validRaw(castorId) && castorId.section()== HcalCastorDetId::EM){
    bool isPositive = false;
    if(castorId.zside()==1)isPositive = true;
    if(castorId.module()==1){
      castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module()+1);
      vNeighborsDetId.push_back(castorDetId.rawId());
      return vNeighborsDetId;
    }
    if(castorId.module()== MODULE_EM_MAX){
      castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module()-1);
      vNeighborsDetId.push_back(castorDetId.rawId());
      return vNeighborsDetId;
    }
    castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module()-1);
    vNeighborsDetId.push_back(castorDetId.rawId());
    castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module()+1);
    vNeighborsDetId.push_back(castorDetId.rawId());
  }
  if(validRaw(castorId) && castorId.section()== HcalCastorDetId::HAD){
    bool isPositive = false;
    if(castorId.zside()==1)isPositive = true;
    if(castorId.module()==1){
      castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module()+1);
      vNeighborsDetId.push_back(castorDetId.rawId());
      return vNeighborsDetId;
    }
    if(castorId.module()== MODULE_HAD_MAX){
      castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module()-1);
      vNeighborsDetId.push_back(castorDetId.rawId());
      return vNeighborsDetId;
    }
  }
  return vNeighborsDetId;
}
std::vector< DetId > CastorTopology::incSector ( const DetId id) const [virtual]

Get the neighbors of the given cell with higher #sector

Definition at line 125 of file CastorTopology.cc.

References HcalCastorDetId::module(), DetId::rawId(), HcalCastorDetId::section(), HcalCastorDetId::sector(), validRaw(), and HcalCastorDetId::zside().

                                                               {
  std::vector<DetId> vNeighborsDetId;
  HcalCastorDetId castorId = HcalCastorDetId(id);
  HcalCastorDetId castorDetId;
  if(validRaw(castorId)) {
    bool isPositive = false;
    if(castorId.zside()==1)isPositive = true;
    if(castorId.sector()==1) {
      castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector()+1, 
castorId.module());
      vNeighborsDetId.push_back(castorDetId.rawId());
      return vNeighborsDetId;
    }
    if(castorId.sector()== 16){
      castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector()-1, 
castorId.module());
      vNeighborsDetId.push_back(castorDetId.rawId());
      return vNeighborsDetId;
    }
    castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector()-1, 
castorId.module());
    vNeighborsDetId.push_back(castorDetId.rawId());
    castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector()+1, 
castorId.module());
    vNeighborsDetId.push_back(castorDetId.rawId());
  }
  return vNeighborsDetId;
}
bool CastorTopology::isExcluded ( const HcalCastorDetId id) const [private]

Definition at line 28 of file CastorTopology.cc.

References HcalCastorDetId::EM, excludeEM_, excludeHAD_, excludeZN_, excludeZP_, exclusionList_, HcalCastorDetId::HAD, and i.

Referenced by valid().

                                                               {
  bool exed=false;

  //check the for side exclusions
  switch(id.zside()){
  case( 1): exed = excludeZP_; break;
  case(-1): exed = excludeZN_; break;
  default: exed = false;
  }

  // check for section exclutions
  switch (id.section()) {
  case(HcalCastorDetId::EM)  : exed = excludeEM_; break; 
  case(HcalCastorDetId::HAD) : exed = excludeHAD_; break; 
  default: exed = false;
  }

  // check the entire list
  if (!exed && !exclusionList_.empty()) {
    std::vector<HcalCastorDetId>::const_iterator 
      i=std::lower_bound(exclusionList_.begin(),exclusionList_.end(),id);
    if (i!=exclusionList_.end() && *i==id) exed=true;
  }
  return exed;
}
int CastorTopology::lastCell ( HcalCastorDetId::Section  section) const

Definition at line 253 of file CastorTopology.cc.

References HcalCastorDetId::EM, HcalCastorDetId::HAD, lastEMModule_, lastHADModule_, and HcalCastorDetId::Unknown.

Referenced by CastorHardcodeGeometryLoader::fill().

                                                                 {
  int lastCell = 0;
  switch (section) {
  case(HcalCastorDetId::EM) : lastCell = lastEMModule_; break;
  case(HcalCastorDetId::HAD) : lastCell = lastHADModule_; break; 
  case(HcalCastorDetId::Unknown) : lastCell  = 0; break;
  }
  return lastCell;
}
int CastorTopology::lastEMModule ( ) const [inline, private]

Definition at line 65 of file CastorTopology.h.

References lastEMModule_.

{return lastEMModule_;}
int CastorTopology::lastHADModule ( ) const [inline, private]

Definition at line 66 of file CastorTopology.h.

References lastHADModule_.

{return lastHADModule_;}  
int CastorTopology::ncells ( HcalCastorDetId::Section  section) const

Definition at line 233 of file CastorTopology.cc.

References HcalCastorDetId::EM, HcalCastorDetId::HAD, MODULE_EM_MAX, MODULE_HAD_MAX, CaloSubdetectorTopology::ncells(), and HcalCastorDetId::Unknown.

                                                              {
  int ncells = 0;
  switch (section) {
  case(HcalCastorDetId::EM)  : ncells = MODULE_EM_MAX*16; break;
  case(HcalCastorDetId::HAD) : ncells = MODULE_HAD_MAX*16; break; 
  case(HcalCastorDetId::Unknown) : ncells =0; break;
  }
  return ncells;
}
std::vector< DetId > CastorTopology::north ( const DetId id) const [virtual]

Get the neighbors of the given cell in north direction

Implements CaloSubdetectorTopology.

Definition at line 208 of file CastorTopology.cc.

References gather_cfg::cout.

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

Get the neighbors of the given cell in south direction

Implements CaloSubdetectorTopology.

Definition at line 214 of file CastorTopology.cc.

References gather_cfg::cout.

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

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

Implements CaloSubdetectorTopology.

Definition at line 220 of file CastorTopology.cc.

References gather_cfg::cout.

{
  std::cout << "CastorTopology::up() not yet implemented" << std::endl;
  std::vector<DetId> vNeighborsDetId;
  return  vNeighborsDetId;
}
bool CastorTopology::valid ( const HcalCastorDetId id) const [virtual]

Is this a valid cell id?

Definition at line 22 of file CastorTopology.cc.

References isExcluded(), and validRaw().

Referenced by CastorHardcodeGeometryLoader::fill().

{
   return ( validRaw( id )  &&
            !isExcluded( id )  ) ;
}
bool CastorTopology::validRaw ( const HcalCastorDetId id) const [virtual]

Is this a valid cell id?

Definition at line 117 of file CastorTopology.cc.

References python::rootplot::argparse::module, and validDetId().

Referenced by exclude(), incModule(), incSector(), and valid().

{
   return HcalCastorDetId::validDetId( id.section(),
                                       id.zside()>0,
                                       id.sector(),
                                       id.module()  )  ;
}
std::vector< DetId > CastorTopology::west ( const DetId id) const [virtual]

Get the neighbors of the given cell in west direction

Implements CaloSubdetectorTopology.

Definition at line 201 of file CastorTopology.cc.

References gather_cfg::cout.

{
  std::cout << "CastorTopology::west() not yet implemented" << std::endl;
  std::vector<DetId> vNeighborsDetId;
  return  vNeighborsDetId;
}

Member Data Documentation

Definition at line 57 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

Definition at line 57 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

Definition at line 57 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

Definition at line 57 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

Definition at line 55 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

Definition at line 59 of file CastorTopology.h.

Referenced by firstCell(), and firstEMModule().

Definition at line 59 of file CastorTopology.h.

Referenced by firstCell(), and firstHADModule().

Definition at line 59 of file CastorTopology.h.

Referenced by lastCell(), and lastEMModule().

Definition at line 59 of file CastorTopology.h.

Referenced by lastCell(), and lastHADModule().