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 (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.

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

Definition at line 24 of file HcalChannelIterator.cc.

25 {
26 }

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, groupFilesInBlocks::lines, and size().

Referenced by initHBEFListFromLmapAscii().

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

Definition at line 89 of file HcalChannelIterator.cc.

References channel_list, and const_iterator.

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

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

Definition at line 35 of file HcalChannelIterator.cc.

References channel_list.

Referenced by initHBEFListFromLmapAscii().

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

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

101  {
102  if (const_iterator==channel_list.end()){
103  return true;
104  }
105  else{
106  return false;
107  }
108 }
std::vector< HcalGenericDetId > channel_list
std::vector< HcalGenericDetId >::const_iterator const_iterator
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().

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

Definition at line 111 of file HcalChannelIterator.cc.

References channel_list, and const_iterator.

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

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

121  {
122  if (const_iterator!=channel_list.end()){
124  return _id.subdet();
125  }
126  else return HcalOther;
127 }
std::vector< HcalGenericDetId > channel_list
std::vector< HcalGenericDetId >::const_iterator const_iterator
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().

130  {
131  if (const_iterator!=channel_list.end()){
133  return _id.ieta();
134  }
135  else return -1000;
136 }
std::vector< HcalGenericDetId > channel_list
std::vector< HcalGenericDetId >::const_iterator const_iterator
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().

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

Definition at line 165 of file HcalChannelIterator.cc.

References channel_list, and Association::map.

165  {
166  channel_list.clear();
167  channel_list = map;
168  return channel_list.size();
169 }
std::vector< HcalGenericDetId > channel_list
dictionary map
Definition: Association.py:196
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().

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

Definition at line 95 of file HcalChannelIterator.cc.

References const_iterator.

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

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

Definition at line 30 of file HcalChannelIterator.cc.

References channel_list.

Referenced by addListFromLmapAscii().

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

Member Data Documentation

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