CMS 3D CMS Logo

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

#include <CalibCalorimetry/HcalTPGAlgos/interface/HcalEmap.h>

Classes

class  HcalEmapRow
 

Public Member Functions

std::vector
< HcalEmap::HcalEmapRow > & 
get_map (void)
 
 HcalEmap ()
 
 HcalEmap (std::string filename)
 
int read_map (std::string filename)
 
 ~HcalEmap ()
 

Protected Attributes

std::vector< HcalEmapRowmap
 

Detailed Description

Description: container for the HCAL electronics map

Usage:

Definition at line 32 of file HcalEmap.h.

Constructor & Destructor Documentation

HcalEmap::HcalEmap ( )
inline

Definition at line 34 of file HcalEmap.h.

34 {}
HcalEmap::HcalEmap ( std::string  filename)
inline

Definition at line 35 of file HcalEmap.h.

References read_map().

35 { read_map(filename); }
tuple filename
Definition: lut2db_cfg.py:20
int read_map(std::string filename)
Definition: HcalEmap.cc:25
HcalEmap::~HcalEmap ( )
inline

Definition at line 36 of file HcalEmap.h.

36 {}

Member Function Documentation

std::vector< HcalEmap::HcalEmapRow > & HcalEmap::get_map ( void  )

Definition at line 71 of file HcalEmap.cc.

Referenced by LutXml::test_access().

71 { return map; }
std::vector< HcalEmapRow > map
Definition: HcalEmap.h:68
int HcalEmap::read_map ( std::string  filename)

Definition at line 25 of file HcalEmap.cc.

References gather_cfg::cout, HcalEmap::HcalEmapRow::crate, HcalEmap::HcalEmapRow::dcc, HcalEmap::HcalEmapRow::fiber, HcalEmap::HcalEmapRow::fiberchan, HcalEmap::HcalEmapRow::idepth, HcalEmap::HcalEmapRow::ieta, recoMuon::in, HcalEmap::HcalEmapRow::iphi, groupFilesInBlocks::lines, HcalEmap::HcalEmapRow::rawId, HcalEmap::HcalEmapRow::slot, HcalEmap::HcalEmapRow::spigot, AlCaHLTBitMon_QueryRunRegistry::string, HcalEmap::HcalEmapRow::subdet, and HcalEmap::HcalEmapRow::topbottom.

Referenced by HcalEmap().

25  {
26  int lines = 0;
27 
28  std::string _row;
29  ifstream inFile(filename.c_str(), std::ios::in);
30  if (!inFile) {
31  std::cout << "Unable to open file with the electronic map: " << filename << std::endl;
32  } else {
33  std::cout << "File with the electronic map opened successfully: " << filename << std::endl;
34  }
35  while (getline(inFile, _row)) {
36  HcalEmapRow aRow;
37  char fpga[32];
38  char subdet[32];
39 
40  int _read;
41  const char* _format = "%d %d %d %s %d %d %d %d %s %d %d %d";
42  _read = sscanf(_row.c_str(),
43  _format,
44  &(aRow.rawId),
45  &(aRow.crate),
46  &(aRow.slot),
47  fpga,
48  &(aRow.dcc),
49  &(aRow.spigot),
50  &(aRow.fiber),
51  &(aRow.fiberchan),
52  subdet,
53  &(aRow.ieta),
54  &(aRow.iphi),
55  &(aRow.idepth));
56  if (_read >= 12) {
57  lines++;
58 
59  aRow.subdet.append(subdet);
60  aRow.topbottom.append(fpga);
61 
62  map.push_back(aRow);
63  }
64  }
65  inFile.close();
66  std::cout << "HcalEmap: " << lines << " lines read" << std::endl;
67 
68  return 0;
69 }
std::vector< HcalEmapRow > map
Definition: HcalEmap.h:68
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:144

Member Data Documentation

std::vector<HcalEmapRow> HcalEmap::map
protected