CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
HcalChannelIterator Class Reference

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

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 (const 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 27 of file HcalChannelIterator.h.

Constructor & Destructor Documentation

HcalChannelIterator::HcalChannelIterator ( )

Definition at line 18 of file HcalChannelIterator.cc.

19 {
20 }
HcalChannelIterator::~HcalChannelIterator ( )
virtual

Definition at line 23 of file HcalChannelIterator.cc.

24 {
25 }

Member Function Documentation

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

Definition at line 40 of file HcalChannelIterator.cc.

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

Referenced by initHBEFListFromLmapAscii().

40  {
42  int _current_size = size();
43  std::string _row;
44  std::ifstream inFile( filename . c_str(), std::ios::in );
45  if (!inFile){
46  std::cout << "Unable to open file with the logical map: " << filename << std::endl;
47  }
48  else{
49  std::cout << "File with the logical map opened successfully: " << filename << std::endl;
50  }
51  while ( getline( inFile, _row ) > 0 ){
52  //# side eta phi dphi depth det
53  int _num, _side, _eta, _phi, _dphi, _depth;
54  char subdetbuf[32];
55 
56  int _read;
57  const char * _format = "%d %d %d %d %d %d %s";
58  _read = sscanf( _row . c_str(), _format,
59  &_num, &_side, &_eta, &_phi, &_dphi, &_depth,
60  subdetbuf );
61  if ( _read == 7 ){
62  lines . count();
63 
64  std::string subdet(subdetbuf);
65 
66  HcalSubdetector _det;
67  if ( subdet.find("HB")!=std::string::npos ) _det = HcalBarrel;
68  else if ( subdet.find("HE")!=std::string::npos ) _det = HcalEndcap;
69  else if ( subdet.find("HO")!=std::string::npos ) _det = HcalOuter;
70  else if ( subdet.find("HF")!=std::string::npos ) _det = HcalForward;
71  else _det = HcalOther;
72 
73  HcalDetId _detid(_det, _side*_eta, _phi, _depth);
74 
75  if (_det == HcalBarrel || _det == HcalEndcap || _det == HcalOuter || _det == HcalForward){
76  channel_list . push_back( _detid );
77  }
78  }
79  }
80  inFile.close();
81  std::cout << "Logical map file: " << lines . getCount() << " lines read" << std::endl;
82  std::cout << "Logical map file: " << size() - _current_size << " lines added to the list" << std::endl;
83  //
84  return 0;
85 }
std::vector< HcalGenericDetId > channel_list
HcalSubdetector
Definition: HcalAssistant.h:31
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
int HcalChannelIterator::begin ( void  )

Definition at line 88 of file HcalChannelIterator.cc.

References channel_list, and const_iterator.

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

88  {
89  const_iterator = channel_list.begin();
90  return 0;
91 }
std::vector< HcalGenericDetId > channel_list
std::vector< HcalGenericDetId >::const_iterator const_iterator
int HcalChannelIterator::clearChannelList ( void  )

Definition at line 34 of file HcalChannelIterator.cc.

References channel_list.

Referenced by initHBEFListFromLmapAscii().

34  {
35  channel_list.clear();
36  return 0;
37 }
std::vector< HcalGenericDetId > channel_list
bool HcalChannelIterator::end ( void  )

Definition at line 100 of file HcalChannelIterator.cc.

References channel_list, and const_iterator.

Referenced by Types.LuminosityBlockRange::cppID(), Types.EventRange::cppID(), HcalChannelQualityXml::set_all_channels_on_off(), and HcalChannelQualityXml::set_all_channels_status().

100  {
101  if (const_iterator==channel_list.end()){
102  return true;
103  }
104  else{
105  return false;
106  }
107 }
std::vector< HcalGenericDetId > channel_list
std::vector< HcalGenericDetId >::const_iterator const_iterator
int HcalChannelIterator::getDepth ( void  )

Definition at line 147 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().

147  {
148  if (const_iterator!=channel_list.end()){
150  return _id.depth();
151  }
152  else return -1000;
153 }
std::vector< HcalGenericDetId > channel_list
std::vector< HcalGenericDetId >::const_iterator const_iterator
HcalGenericDetId HcalChannelIterator::getHcalGenericDetId ( void  )

Definition at line 110 of file HcalChannelIterator.cc.

References channel_list, and const_iterator.

110  {
111  if (const_iterator!=channel_list.end()){
112  return *const_iterator;
113  }
114  else{
115  return 0;
116  }
117 }
std::vector< HcalGenericDetId > channel_list
std::vector< HcalGenericDetId >::const_iterator const_iterator
HcalSubdetector HcalChannelIterator::getHcalSubdetector ( void  )

Definition at line 120 of file HcalChannelIterator.cc.

References channel_list, const_iterator, HcalOther, and HcalDetId::subdet().

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

120  {
121  if (const_iterator!=channel_list.end()){
123  return _id.subdet();
124  }
125  else return HcalOther;
126 }
std::vector< HcalGenericDetId > channel_list
std::vector< HcalGenericDetId >::const_iterator const_iterator
int HcalChannelIterator::getIeta ( void  )

Definition at line 129 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().

129  {
130  if (const_iterator!=channel_list.end()){
132  return _id.ieta();
133  }
134  else return -1000;
135 }
std::vector< HcalGenericDetId > channel_list
std::vector< HcalGenericDetId >::const_iterator const_iterator
int HcalChannelIterator::getIphi ( void  )

Definition at line 138 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().

138  {
139  if (const_iterator!=channel_list.end()){
141  return _id.iphi();
142  }
143  else return -1000;
144 }
std::vector< HcalGenericDetId > channel_list
std::vector< HcalGenericDetId >::const_iterator const_iterator
int HcalChannelIterator::init ( const std::vector< HcalGenericDetId > &  map)

Definition at line 164 of file HcalChannelIterator.cc.

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

164  {
165  channel_list.clear();
166  channel_list = map;
167  return channel_list.size();
168 }
std::vector< HcalGenericDetId > channel_list
int HcalChannelIterator::initHBEFListFromLmapAscii ( void  )

Definition at line 156 of file HcalChannelIterator.cc.

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

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

156  {
158  addListFromLmapAscii("HCALmapHBEF_Jan.27.2009.txt");
159  addListFromLmapAscii("HCALmapHO_Jan.27.2009.txt");
160  return channel_list.size();
161 }
std::vector< HcalGenericDetId > channel_list
int addListFromLmapAscii(std::string filename)
int HcalChannelIterator::next ( void  )

Definition at line 94 of file HcalChannelIterator.cc.

References const_iterator.

Referenced by BeautifulSoup.PageElement::_invert(), HcalChannelQualityXml::set_all_channels_on_off(), and HcalChannelQualityXml::set_all_channels_status().

94  {
96  return 0;
97 }
std::vector< HcalGenericDetId >::const_iterator const_iterator
int HcalChannelIterator::size ( void  )

Definition at line 29 of file HcalChannelIterator.cc.

References channel_list.

Referenced by addListFromLmapAscii().

29  {
30  return channel_list.size();
31 }
std::vector< HcalGenericDetId > channel_list

Member Data Documentation

std::vector<HcalGenericDetId> HcalChannelIterator::channel_list
private
std::vector<HcalGenericDetId>::const_iterator HcalChannelIterator::const_iterator
private