CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ZdcTopology Class Reference

#include <ZdcTopology.h>

Inheritance diagram for ZdcTopology:
CaloSubdetectorTopology

List of all members.

Public Member Functions

virtual std::vector< DetIddown (const DetId &id) const
virtual std::vector< DetIdeast (const DetId &id) const
void exclude (const HcalZDCDetId &id)
void exclude (int zside, HcalZDCDetId::Section section)
int exclude (int zside, HcalZDCDetId::Section section, int ich1, int ich2)
void exclude (int zside)
int firstCell (HcalZDCDetId::Section section) const
int lastCell (HcalZDCDetId::Section section) const
virtual std::vector< DetIdlongitudinal (const DetId &id) const
int ncells (HcalZDCDetId::Section section) const
virtual std::vector< DetIdnorth (const DetId &id) const
virtual std::vector< DetIdsouth (const DetId &id) const
virtual std::vector< DetIdtransverse (const DetId &id) const
virtual std::vector< DetIdup (const DetId &id) const
virtual bool valid (const HcalZDCDetId &id) const
virtual std::vector< DetIdwest (const DetId &id) const
 ZdcTopology ()

Private Member Functions

int firstEMModule () const
int firstHADModule () const
int firstLUMModule () const
bool isExcluded (const HcalZDCDetId &id) const
int lastEMModule () const
int lastHADModule () const
int lastLUMModule () const
bool validRaw (const HcalZDCDetId &id) const

Private Attributes

bool excludeEM_
bool excludeHAD_
bool excludeLUM_
bool excludeZN_
bool excludeZP_
std::vector< HcalZDCDetIdexclusionList_
int firstEMModule_
int firstHADModule_
int firstLUMModule_
int lastEMModule_
int lastHADModule_
int lastLUMModule_

Detailed Description

Definition at line 15 of file ZdcTopology.h.


Constructor & Destructor Documentation

ZdcTopology::ZdcTopology ( )

Definition at line 10 of file ZdcTopology.cc.


Member Function Documentation

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

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

Implements CaloSubdetectorTopology.

Definition at line 230 of file ZdcTopology.cc.

References gather_cfg::cout.

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

Get the neighbors of the given cell in east direction

Implements CaloSubdetectorTopology.

Definition at line 198 of file ZdcTopology.cc.

References gather_cfg::cout.

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

Exlucde a cell

Definition at line 59 of file ZdcTopology.cc.

References exclusionList_, and i.

Referenced by exclude().

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

Exclude a side

Definition at line 67 of file ZdcTopology.cc.

References excludeZN_, and excludeZP_.

                                   {
 switch(zside){
  case( 1): excludeZP_ = true; break;
  case(-1): excludeZN_ = true; break;
  default: break;
  }
}
int ZdcTopology::exclude ( int  zside,
HcalZDCDetId::Section  section,
int  ich1,
int  ich2 
)

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

Definition at line 89 of file ZdcTopology.cc.

References HcalZDCDetId::EM, exclude(), excludeEM_, excludeHAD_, excludeLUM_, excludeZN_, excludeZP_, HcalZDCDetId::HAD, HcalZDCDetId::LUM, 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;

  switch (section) {
  case(HcalZDCDetId::EM)  : exed = excludeEM_; break; 
  case(HcalZDCDetId::HAD) : exed = excludeHAD_; break; 
  case(HcalZDCDetId::LUM) : exed = excludeLUM_; break;
  default: exed = false;
  }
  if (exed) return 0;

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

  int n = 0;
  for (int ich = ich1; ich < ich2; ich++){
    HcalZDCDetId id(section, isPositive, ich);  
    if(validRaw(id))exclude(id);
    n++;
  }
  return n;
}
void ZdcTopology::exclude ( int  zside,
HcalZDCDetId::Section  section 
)

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

Definition at line 75 of file ZdcTopology.cc.

References HcalZDCDetId::EM, excludeEM_, excludeHAD_, excludeLUM_, excludeZN_, excludeZP_, HcalZDCDetId::HAD, and HcalZDCDetId::LUM.

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

Definition at line 248 of file ZdcTopology.cc.

References HcalZDCDetId::EM, firstEMModule_, firstHADModule_, firstLUMModule_, HcalZDCDetId::HAD, HcalZDCDetId::LUM, and HcalZDCDetId::Unknown.

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

Definition at line 66 of file ZdcTopology.h.

References firstEMModule_.

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

Definition at line 67 of file ZdcTopology.h.

References firstHADModule_.

{return firstHADModule_;}  
int ZdcTopology::firstLUMModule ( ) const [inline, private]

Definition at line 68 of file ZdcTopology.h.

References firstLUMModule_.

{return firstLUMModule_;}
bool ZdcTopology::isExcluded ( const HcalZDCDetId id) const [private]

Definition at line 32 of file ZdcTopology.cc.

References HcalZDCDetId::EM, excludeEM_, excludeHAD_, excludeLUM_, excludeZN_, excludeZP_, exclusionList_, HcalZDCDetId::HAD, i, and HcalZDCDetId::LUM.

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(HcalZDCDetId::EM)  : exed = excludeEM_; break; 
  case(HcalZDCDetId::HAD) : exed = excludeHAD_; break; 
  case(HcalZDCDetId::LUM) : exed = excludeLUM_; break;
  default: exed = false;
  }

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

Definition at line 259 of file ZdcTopology.cc.

References HcalZDCDetId::EM, HcalZDCDetId::HAD, lastEMModule_, lastHADModule_, lastLUMModule_, HcalZDCDetId::LUM, and HcalZDCDetId::Unknown.

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

Definition at line 69 of file ZdcTopology.h.

References lastEMModule_.

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

Definition at line 70 of file ZdcTopology.h.

References lastHADModule_.

{return lastHADModule_;}  
int ZdcTopology::lastLUMModule ( ) const [inline, private]

Definition at line 71 of file ZdcTopology.h.

References lastLUMModule_.

{return lastLUMModule_;}
std::vector< DetId > ZdcTopology::longitudinal ( const DetId id) const [virtual]

Get the longitudinal neighbors (Z) of the given cell

Definition at line 159 of file ZdcTopology.cc.

References HcalZDCDetId::channel(), HcalZDCDetId::HAD, ICH_HAD_MAX, ICH_LUM_MAX, HcalZDCDetId::LUM, DetId::rawId(), HcalZDCDetId::section(), validRaw(), and HcalZDCDetId::zside().

                                                               {
  std::vector<DetId> vNeighborsDetId;
  HcalZDCDetId zdcId = HcalZDCDetId(id);
  HcalZDCDetId zdcDetId;
  if(validRaw(zdcId) && zdcId.section()== HcalZDCDetId::HAD){
    bool isPositive = false;
    if(zdcId.zside()==1)isPositive = true;
    if(zdcId.channel()==1){
      zdcDetId = HcalZDCDetId(zdcId.section(), isPositive, zdcId.channel()+1);
      vNeighborsDetId.push_back(zdcDetId.rawId());
      return vNeighborsDetId;
    }
    if(zdcId.channel()== ICH_HAD_MAX){
      zdcDetId = HcalZDCDetId(zdcId.section(), isPositive, zdcId.channel()-1);
      vNeighborsDetId.push_back(zdcDetId.rawId());
      return vNeighborsDetId;
    }
    zdcDetId = HcalZDCDetId(zdcId.section(), isPositive, zdcId.channel()-1);
    vNeighborsDetId.push_back(zdcDetId.rawId());
    zdcDetId = HcalZDCDetId(zdcId.section(), isPositive, zdcId.channel()+1);
    vNeighborsDetId.push_back(zdcDetId.rawId());
  }
  if(validRaw(zdcId) && zdcId.section()== HcalZDCDetId::LUM){
    bool isPositive = false;
    if(zdcId.zside()==1)isPositive = true;
    if(zdcId.channel()==1){
      zdcDetId = HcalZDCDetId(zdcId.section(), isPositive, zdcId.channel()+1);
      vNeighborsDetId.push_back(zdcDetId.rawId());
      return vNeighborsDetId;
    }
    if(zdcId.channel()== ICH_LUM_MAX){
      zdcDetId = HcalZDCDetId(zdcId.section(), isPositive, zdcId.channel()-1);
      vNeighborsDetId.push_back(zdcDetId.rawId());
      return vNeighborsDetId;
    }
  }
  return vNeighborsDetId;
}
int ZdcTopology::ncells ( HcalZDCDetId::Section  section) const

Definition at line 237 of file ZdcTopology.cc.

References HcalZDCDetId::EM, HcalZDCDetId::HAD, ICH_EM_MAX, ICH_HAD_MAX, ICH_LUM_MAX, HcalZDCDetId::LUM, CaloSubdetectorTopology::ncells(), and HcalZDCDetId::Unknown.

                                                        {
  int ncells = 0;
  switch (section) {
  case(HcalZDCDetId::EM)  : ncells = ICH_EM_MAX; break;
  case(HcalZDCDetId::HAD) : ncells = ICH_HAD_MAX; break; 
  case(HcalZDCDetId::LUM) : ncells = ICH_LUM_MAX; break;
  case(HcalZDCDetId::Unknown) : ncells =0; break;
  }
  return ncells;
}
std::vector< DetId > ZdcTopology::north ( const DetId id) const [virtual]

Get the neighbors of the given cell in north direction

Implements CaloSubdetectorTopology.

Definition at line 212 of file ZdcTopology.cc.

References gather_cfg::cout.

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

Get the neighbors of the given cell in south direction

Implements CaloSubdetectorTopology.

Definition at line 218 of file ZdcTopology.cc.

References gather_cfg::cout.

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

Get the transverse (X) neighbors of the given cell

Definition at line 134 of file ZdcTopology.cc.

References HcalZDCDetId::channel(), HcalZDCDetId::EM, ICH_EM_MAX, DetId::rawId(), HcalZDCDetId::section(), validRaw(), and HcalZDCDetId::zside().

                                                             {
  std::vector<DetId> vNeighborsDetId;
  HcalZDCDetId zdcId = HcalZDCDetId(id);
  HcalZDCDetId zdcDetId;
  if(validRaw(zdcId) && zdcId.section()== HcalZDCDetId::EM){
    bool isPositive = false;
    if(zdcId.zside()==1)isPositive = true;
    if(zdcId.channel()==1){
      zdcDetId = HcalZDCDetId(zdcId.section(), isPositive, zdcId.channel()+1);
      vNeighborsDetId.push_back(zdcDetId.rawId());
      return vNeighborsDetId;
    }
    if(zdcId.channel()== ICH_EM_MAX){
      zdcDetId = HcalZDCDetId(zdcId.section(), isPositive, zdcId.channel()-1);
      vNeighborsDetId.push_back(zdcDetId.rawId());
      return vNeighborsDetId;
    }
    zdcDetId = HcalZDCDetId(zdcId.section(), isPositive, zdcId.channel()-1);
    vNeighborsDetId.push_back(zdcDetId.rawId());
    zdcDetId = HcalZDCDetId(zdcId.section(), isPositive, zdcId.channel()+1);
    vNeighborsDetId.push_back(zdcDetId.rawId());
  }
  return vNeighborsDetId;
}
std::vector< DetId > ZdcTopology::up ( const DetId id) const [virtual]

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

Implements CaloSubdetectorTopology.

Definition at line 224 of file ZdcTopology.cc.

References gather_cfg::cout.

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

Is this a valid cell id?

Definition at line 25 of file ZdcTopology.cc.

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

                                                    {
  // check the raw rules
  bool ok=validRaw(id);
  ok=ok && !isExcluded(id);
  return ok;
}
bool ZdcTopology::validRaw ( const HcalZDCDetId id) const [private]

Definition at line 118 of file ZdcTopology.cc.

References abs, HcalZDCDetId::EM, HcalZDCDetId::HAD, ICH_EM_MAX, ICH_HAD_MAX, ICH_LUM_MAX, HcalZDCDetId::LUM, and convertSQLiteXML::ok.

Referenced by exclude(), longitudinal(), transverse(), and valid().

                                                      {
  bool ok = true;
  if(abs(id.zside())!=1)return false;
  if(id.channel() <= 0)return false;
  if(!(id.section()== HcalZDCDetId::EM || 
       id.section()== HcalZDCDetId::HAD ||
       id.section()== HcalZDCDetId::LUM)) return false;
  if(id.section()== HcalZDCDetId::EM && id.channel() > ICH_EM_MAX)
    return false;
  if(id.section()== HcalZDCDetId::HAD && id.channel() > ICH_HAD_MAX)
    return false;
  if(id.section()== HcalZDCDetId::LUM && id.channel() > ICH_LUM_MAX)
    return false;
  return ok;
}
std::vector< DetId > ZdcTopology::west ( const DetId id) const [virtual]

Get the neighbors of the given cell in west direction

Implements CaloSubdetectorTopology.

Definition at line 205 of file ZdcTopology.cc.

References gather_cfg::cout.

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

Member Data Documentation

bool ZdcTopology::excludeEM_ [private]

Definition at line 59 of file ZdcTopology.h.

Referenced by exclude(), and isExcluded().

bool ZdcTopology::excludeHAD_ [private]

Definition at line 59 of file ZdcTopology.h.

Referenced by exclude(), and isExcluded().

bool ZdcTopology::excludeLUM_ [private]

Definition at line 59 of file ZdcTopology.h.

Referenced by exclude(), and isExcluded().

bool ZdcTopology::excludeZN_ [private]

Definition at line 59 of file ZdcTopology.h.

Referenced by exclude(), and isExcluded().

bool ZdcTopology::excludeZP_ [private]

Definition at line 59 of file ZdcTopology.h.

Referenced by exclude(), and isExcluded().

std::vector<HcalZDCDetId> ZdcTopology::exclusionList_ [private]

Definition at line 57 of file ZdcTopology.h.

Referenced by exclude(), and isExcluded().

Definition at line 61 of file ZdcTopology.h.

Referenced by firstCell(), and firstEMModule().

Definition at line 61 of file ZdcTopology.h.

Referenced by firstCell(), and firstHADModule().

Definition at line 61 of file ZdcTopology.h.

Referenced by firstCell(), and firstLUMModule().

Definition at line 61 of file ZdcTopology.h.

Referenced by lastCell(), and lastEMModule().

Definition at line 61 of file ZdcTopology.h.

Referenced by lastCell(), and lastHADModule().

Definition at line 61 of file ZdcTopology.h.

Referenced by lastCell(), and lastLUMModule().