CMS 3D CMS Logo

Public Member Functions | Private Attributes

LMap::impl Class Reference

List of all members.

Public Member Functions

std::map< int, LMapRow > & get_map (void)
 impl ()
int read (std::string accessor, std::string type)
 ~impl ()

Private Attributes

std::map< int, LMapRow_lmap
std::vector< LMapRow_table

Detailed Description

Definition at line 33 of file LMap.cc.


Constructor & Destructor Documentation

LMap::impl::impl ( ) [inline]

Definition at line 35 of file LMap.cc.

{ }
LMap::impl::~impl ( ) [inline]

Definition at line 36 of file LMap.cc.

{ }

Member Function Documentation

std::map<int,LMapRow>& LMap::impl::get_map ( void  ) [inline]

Definition at line 39 of file LMap.cc.

{ return _lmap; };
int LMap::impl::read ( std::string  accessor,
std::string  type 
)

Definition at line 65 of file LMap.cc.

References _lmap, _table, LMapRow::adc, prof2calltree::count, gather_cfg::cout, LMapRow::crate, LMapRow::dcc, LMapRow::dcc_sl, LMapRow::depth, LMapRow::det, LMapRow::dphi, LMapRow::eta, LMapRow::fedid, LMapRow::fi_ch, HcalBarrel, HcalEndcap, HcalForward, HcalOther, HcalOuter, LMapRow::htr, LMapRow::htr_fi, recoMuon::in, beamvalidation::lines, LMapRow::phi, LMapRow::pixel, LMapRow::qie, DetId::rawId(), LMapRow::rctcar, LMapRow::rctcon, LMapRow::rctcra, LMapRow::rm, LMapRow::rm_fi, LMapRow::side, LMapRow::slb, LMapRow::spigo, and LMapRow::wedge.

{

  RooGKCounter lines;

  std::string _row;
  ifstream inFile( map_file . c_str(), std::ios::in );
  if (!inFile)
    {
      std::cout << "Unable to open file with the logical map: " << map_file << std::endl;
    }
  else
    {
      std::cout << "File with the logical map opened successfully: " << map_file << std::endl;
      std::cout << "Type: " << type << std::endl;
    }
  while ( getline( inFile, _row ) > 0 )
    {
      LMapRow aRow;
      char det[32];
      char rbx[32];
      char fpga[32];
      char slbin[32];
      char slbin2[32];
      char slnam[32];
      char rctnam[32];

      const char * let_code = "Z";

      int _read = 0;
      if ( type == "HBEF" )
        {
          const char * _format = " %d %d %d %d %d %s %s %d %d %d %d %d %d %d %d %d %s %d %d %d %d %d %s %s %s %d %d %d %s %d";
          _read = sscanf( _row . c_str(), _format,
                          &(aRow.side),
                          &(aRow.eta), &(aRow.phi), &(aRow.dphi), &(aRow.depth),
                          det,
                          rbx,
                          &(aRow.wedge), &(aRow.rm), &(aRow.pixel), &(aRow.qie), &(aRow.adc), &(aRow.rm_fi), &(aRow.fi_ch),
                          &(aRow.crate), &(aRow.htr),
                          fpga,
                          &(aRow.htr_fi),
                          &(aRow.dcc_sl), &(aRow.spigo), &(aRow.dcc), &(aRow.slb),
                          slbin, slbin2, slnam,
                          &(aRow.rctcra), &(aRow.rctcar), &(aRow.rctcon),
                          rctnam,
                          &(aRow.fedid) );
        }
      else if ( type == "HO" )
        {
          const char * _format = " %d %d %d %d %d %s %s %d %d %d %d %d %d %d %s %d %d %s %d %d %d %d %d";
          _read = sscanf( _row . c_str(), _format,
                          &(aRow.side),
                          &(aRow.eta), &(aRow.phi), &(aRow.dphi), &(aRow.depth),
                          det,
                          rbx,
                          &(aRow.wedge), &(aRow.rm), &(aRow.pixel), &(aRow.qie), &(aRow.adc), &(aRow.rm_fi), &(aRow.fi_ch),
                          &let_code,
                          &(aRow.crate), &(aRow.htr),
                          fpga,
                          &(aRow.htr_fi),
                          &(aRow.dcc_sl), &(aRow.spigo), &(aRow.dcc), &(aRow.slb) );
          //slbin, slbin2, slnam,
          //&(aRow.rctcra), &(aRow.rctcar), &(aRow.rctcon),
          //rctnam,
          //&(aRow.fedid) );
        }
      if ( _read >= 23 )
        {
          lines . count();
          
          std::string _det(det);
          if      ( _det.find("HB") != std::string::npos ) aRow . det = HcalBarrel;
          else if ( _det.find("HE") != std::string::npos ) aRow . det = HcalEndcap;
          else if ( _det.find("HF") != std::string::npos ) aRow . det = HcalForward;
          else if ( _det.find("HO") != std::string::npos ) aRow . det = HcalOuter;
          else                    aRow . det = HcalOther;

          aRow . rbx .append( rbx );
          aRow . fpga .append( fpga );
          aRow . slbin .append( slbin );
          aRow . slbin2 .append( slbin2 );
          aRow . slnam .append( slnam );
          aRow . rctnam .append( rctnam );
          aRow . let_code .append( let_code );
          
          _table . push_back( aRow );

          HcalDetId _hdid(aRow.det, aRow.side*aRow.eta, aRow.phi, aRow.depth);

          _lmap[_hdid.rawId()] = aRow;

        }
    }
  inFile.close();
  std::cout << "LMap: " << lines . getCount() << " lines read" << std::endl;

  return 0;
}

Member Data Documentation

std::map<int,LMapRow> LMap::impl::_lmap [private]

Definition at line 43 of file LMap.cc.

Referenced by read().

std::vector<LMapRow> LMap::impl::_table [private]

Definition at line 39 of file LMap.cc.

Referenced by read().