CMS 3D CMS Logo

Classes | Public Member Functions | Protected Attributes

HcalEmap Class Reference

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

List of all members.

Classes

class  HcalEmapRow

Public Member Functions

std::vector
< HcalEmap::HcalEmapRow > & 
get_map (void)
 HcalEmap (std::string filename)
 HcalEmap ()
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 35 of file HcalEmap.h.


Constructor & Destructor Documentation

HcalEmap::HcalEmap ( ) [inline]

Definition at line 38 of file HcalEmap.h.

{}
HcalEmap::HcalEmap ( std::string  filename) [inline]

Definition at line 39 of file HcalEmap.h.

References read_map().

HcalEmap::~HcalEmap ( ) [inline]

Definition at line 40 of file HcalEmap.h.

{}

Member Function Documentation

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

Definition at line 73 of file HcalEmap.cc.

References Association::map.

Referenced by LutXml::test_access().

{
  return map;
}
int HcalEmap::read_map ( std::string  filename)

Definition at line 29 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, beamvalidation::lines, HcalEmap::HcalEmapRow::rawId, HcalEmap::HcalEmapRow::slot, and HcalEmap::HcalEmapRow::spigot.

Referenced by HcalEmap().

{
  int lines=0;

  std::string _row;
  ifstream inFile( filename . c_str(), std::ios::in );
  if (!inFile){
    std::cout << "Unable to open file with the electronic map: " << filename << std::endl;
  }
  else{
    std::cout << "File with the electronic map opened successfully: " << filename << std::endl;
  }
  while ( getline( inFile, _row ) > 0 ){
    HcalEmapRow aRow;
    char fpga[32];
    char subdet[32];
    
    int _read;
    const char * _format = "%d %d %d %s %d %d %d %d %s %d %d %d";
    _read = sscanf( _row . c_str(), _format,
                    &(aRow.rawId),
                    &(aRow.crate), &(aRow.slot),
                      fpga,
                    &(aRow.dcc),
                    &(aRow.spigot),&(aRow.fiber),&(aRow.fiberchan),
                    subdet,
                    &(aRow.ieta), &(aRow.iphi), &(aRow.idepth) );
    if ( _read >= 12 ){
      lines++;
      
      aRow . subdet .append( subdet );
      aRow . topbottom .append( fpga );
      
      map . push_back( aRow );
    }  
  }
  inFile.close();
  std::cout << "HcalEmap: " << lines << " lines read" << std::endl;

  return 0;
}

Member Data Documentation

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

Definition at line 73 of file HcalEmap.h.