CMS 3D CMS Logo

Public Member Functions | Private Attributes

HcalChannelIterator Class Reference

#include <CaloOnlineTools/HcalOnlineDb/interface/HcalChannelIterator.h>

List of all members.

Public Member Functions

int addListFromLmapAscii (std::string filename)
int begin (void)
int clearChannelList (void)
bool end (void)
int getDepth (void)
HcalGenericDetId getHcalGenericDetId (void)
HcalSubdetector getHcalSubdetector (void)
int getIeta (void)
int getIphi (void)
 HcalChannelIterator ()
int init (std::vector< HcalGenericDetId > map)
int initHBEFListFromLmapAscii (void)
int next (void)
int size (void)
virtual ~HcalChannelIterator ()

Private Attributes

std::vector< HcalGenericDetIdchannel_list
std::vector< HcalGenericDetId >
::const_iterator 
const_iterator

Detailed Description

Description: Iterators over HCAL channels using various sources

Usage: <usage>

Definition at line 28 of file HcalChannelIterator.h.


Constructor & Destructor Documentation

HcalChannelIterator::HcalChannelIterator ( )

Definition at line 19 of file HcalChannelIterator.cc.

{
}
HcalChannelIterator::~HcalChannelIterator ( ) [virtual]

Definition at line 24 of file HcalChannelIterator.cc.

{
}

Member Function Documentation

int HcalChannelIterator::addListFromLmapAscii ( std::string  filename)

Definition at line 41 of file HcalChannelIterator.cc.

References _depth, channel_list, prof2calltree::count, gather_cfg::cout, HcalBarrel, HcalEndcap, HcalForward, HcalOther, HcalOuter, recoMuon::in, beamvalidation::lines, and size().

Referenced by initHBEFListFromLmapAscii().

                                                               {
  RooGKCounter lines;
  int _current_size = size();
  std::string _row;
  std::ifstream inFile( filename . c_str(), std::ios::in );
  if (!inFile){
    std::cout << "Unable to open file with the logical map: " << filename << std::endl;
  }
  else{
    std::cout << "File with the logical map opened successfully: " << filename << std::endl;
  }
  while ( getline( inFile, _row ) > 0 ){
    //#   side    eta    phi   dphi  depth    det
    int _num, _side, _eta, _phi, _dphi, _depth;
    char subdetbuf[32];
    
    int _read;
    const char * _format = "%d %d %d %d %d %d %s";
    _read = sscanf( _row . c_str(), _format,
                    &_num, &_side, &_eta, &_phi, &_dphi, &_depth,
                    subdetbuf );
    if ( _read == 7 ){
      lines . count();
      
      std::string subdet(subdetbuf);

      HcalSubdetector _det;
      if ( subdet.find("HB")!=std::string::npos ) _det = HcalBarrel;
      else if ( subdet.find("HE")!=std::string::npos ) _det = HcalEndcap;
      else if ( subdet.find("HO")!=std::string::npos ) _det = HcalOuter;
      else if ( subdet.find("HF")!=std::string::npos ) _det = HcalForward;
      else _det = HcalOther;

      HcalDetId _detid(_det, _side*_eta, _phi, _depth);
      
      if (_det == HcalBarrel || _det == HcalEndcap || _det == HcalOuter || _det == HcalForward){
        channel_list . push_back( _detid );
      }
    }  
  }
  inFile.close();
  std::cout << "Logical map file: " << lines . getCount() << " lines read" << std::endl;
  std::cout << "Logical map file: " << size() - _current_size << " lines added to the list" << std::endl;
  //
  return 0;
}
int HcalChannelIterator::begin ( void  )
int HcalChannelIterator::clearChannelList ( void  )

Definition at line 35 of file HcalChannelIterator.cc.

References channel_list.

Referenced by initHBEFListFromLmapAscii().

                                             {
  channel_list.clear();
  return 0;
}
bool HcalChannelIterator::end ( void  )

Definition at line 101 of file HcalChannelIterator.cc.

References channel_list, and const_iterator.

Referenced by HcalChannelQualityXml::set_all_channels_on_off(), and HcalChannelQualityXml::set_all_channels_status().

                                 {
  if (const_iterator==channel_list.end()){
    return true;
  }
  else{
    return false;
  }
}
int HcalChannelIterator::getDepth ( void  )

Definition at line 148 of file HcalChannelIterator.cc.

References channel_list, const_iterator, and HcalDetId::depth().

Referenced by HcalChannelQualityXml::set_all_channels_on_off(), and HcalChannelQualityXml::set_all_channels_status().

                                     {
  if (const_iterator!=channel_list.end()){
    HcalDetId _id(*const_iterator);
    return _id.depth();
  }
  else return -1000;
}
HcalGenericDetId HcalChannelIterator::getHcalGenericDetId ( void  )

Definition at line 111 of file HcalChannelIterator.cc.

References channel_list, and const_iterator.

                                                             {
  if (const_iterator!=channel_list.end()){
    return *const_iterator;
  }
  else{
    return 0;
  }
}
HcalSubdetector HcalChannelIterator::getHcalSubdetector ( void  )
int HcalChannelIterator::getIeta ( void  )

Definition at line 130 of file HcalChannelIterator.cc.

References channel_list, const_iterator, and HcalDetId::ieta().

Referenced by HcalChannelQualityXml::set_all_channels_on_off(), and HcalChannelQualityXml::set_all_channels_status().

                                    {
  if (const_iterator!=channel_list.end()){
    HcalDetId _id(*const_iterator);
    return _id.ieta();
  }
  else return -1000;
}
int HcalChannelIterator::getIphi ( void  )

Definition at line 139 of file HcalChannelIterator.cc.

References channel_list, const_iterator, and HcalDetId::iphi().

Referenced by HcalChannelQualityXml::set_all_channels_on_off(), and HcalChannelQualityXml::set_all_channels_status().

                                    {
  if (const_iterator!=channel_list.end()){
    HcalDetId _id(*const_iterator);
    return _id.iphi();
  }
  else return -1000;
}
int HcalChannelIterator::init ( std::vector< HcalGenericDetId map)

Definition at line 165 of file HcalChannelIterator.cc.

References channel_list, and python::multivaluedict::map().

                                                            {
  channel_list.clear();
  channel_list = map;
  return channel_list.size();
}
int HcalChannelIterator::initHBEFListFromLmapAscii ( void  )

Definition at line 157 of file HcalChannelIterator.cc.

References addListFromLmapAscii(), channel_list, and clearChannelList().

Referenced by HcalChannelQualityXml::set_all_channels_on_off(), and HcalChannelQualityXml::set_all_channels_status().

                                                      {
  clearChannelList();
  addListFromLmapAscii("HCALmapHBEF_Jan.27.2009.txt");
  addListFromLmapAscii("HCALmapHO_Jan.27.2009.txt");
  return channel_list.size();
}
int HcalChannelIterator::next ( void  )
int HcalChannelIterator::size ( void  )

Definition at line 30 of file HcalChannelIterator.cc.

References channel_list.

Referenced by addListFromLmapAscii().

                                 {
  return channel_list.size();
}

Member Data Documentation