CMS 3D CMS Logo

Classes | Public Member Functions | Protected Attributes

EMap Class Reference

#include <LMap.h>

List of all members.

Classes

class  EMapRow

Public Member Functions

 EMap ()
 EMap (std::string filename)
 EMap (const HcalElectronicsMap *map)
std::vector< EMap::EMapRow > & get_map (void)
int read_map (std::string filename)
 ~EMap ()

Protected Attributes

std::vector< EMapRowmap

Detailed Description

Definition at line 95 of file LMap.h.


Constructor & Destructor Documentation

EMap::EMap ( ) [inline]

Definition at line 98 of file LMap.h.

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

Definition at line 99 of file LMap.h.

References read_map().

EMap::EMap ( const HcalElectronicsMap map)

Definition at line 171 of file LMap.cc.

References HcalElectronicsMap::allElectronicsIdPrecision(), HcalElectronicsMap::allElectronicsIdTrigger(), benchmark_cfg::cerr, EMap::EMapRow::crate, EMap::EMapRow::dcc, EMap::EMapRow::fiber, EMap::EMapRow::fiberchan, HcalAssistant::getSubdetectorString(), HcalAssistant::getZDCSectionString(), HcalGenericDetId::HcalGenBarrel, HcalGenericDetId::HcalGenEndcap, HcalGenericDetId::HcalGenForward, HcalGenericDetId::HcalGenOuter, HcalGenericDetId::HcalGenZDC, EMap::EMapRow::idepth, EMap::EMapRow::ieta, EMap::EMapRow::iphi, HcalElectronicsMap::lookup(), HcalElectronicsMap::lookupTrigger(), EMap::EMapRow::rawId, EMap::EMapRow::slot, EMap::EMapRow::spigot, EMap::EMapRow::subdet, EMap::EMapRow::topbottom, EMap::EMapRow::zdc_channel, EMap::EMapRow::zdc_section, and EMap::EMapRow::zdc_zside.

                                           {
  if (emap){
    HcalAssistant _ass;
    //
    //_____ precision channels __________________________________________
    //
    std::vector <HcalElectronicsId> v_eId = emap->allElectronicsIdPrecision();
    for (std::vector <HcalElectronicsId>::const_iterator eId=v_eId.begin();
         eId!=v_eId.end();
         eId++){
      EMapRow row;
      //row.rawId     = eId->rawId();
      row.crate     = eId->readoutVMECrateId();
      row.slot      = eId->htrSlot();
      row.dcc       = eId->dccid();
      row.spigot    = eId->spigot();
      row.fiber     = eId->fiberIndex();
      row.fiberchan = eId->fiberChanId();
      if (eId->htrTopBottom()==1) row.topbottom = "t";
      else row.topbottom = "b";
      //
      HcalGenericDetId _gid( emap->lookup(*eId) );
      if ( !(_gid.null()) &&
           (_gid.genericSubdet()==HcalGenericDetId::HcalGenBarrel ||
            _gid.genericSubdet()==HcalGenericDetId::HcalGenEndcap ||
            _gid.genericSubdet()==HcalGenericDetId::HcalGenForward ||
            _gid.genericSubdet()==HcalGenericDetId::HcalGenOuter
            )
           ){
        HcalDetId _id( emap->lookup(*eId) );
        row.rawId     = _id.rawId();
        row.ieta      = _id.ieta();
        row.iphi      = _id.iphi();
        row.idepth    = _id.depth();
        row.subdet    = _ass.getSubdetectorString(_id.subdet());
        // fill the map
        map.push_back(row);
      }
      // ZDC channels
      else if ( !(_gid.null()) &&
           _gid.genericSubdet()==HcalGenericDetId::HcalGenZDC
           ){
        HcalZDCDetId _id( emap->lookup(*eId) );
        row.zdc_channel      = _id.channel();
        row.zdc_section      = _ass.getZDCSectionString(_id.section());
        row.idepth           = _id.depth();
        row.zdc_zside        = _id.zside();
        // fill the map
        map.push_back(row);
      }
    }
    //
    //_____ trigger channels __________________________________________
    //
    v_eId = emap->allElectronicsIdTrigger();
    for (std::vector <HcalElectronicsId>::const_iterator eId=v_eId.begin();
         eId!=v_eId.end();
         eId++){
      EMapRow row;
      //row.rawId     = eId->rawId();
      row.crate     = eId->readoutVMECrateId();
      row.slot      = eId->htrSlot();
      row.dcc       = eId->dccid();
      row.spigot    = eId->spigot();
      row.fiber     = eId->slbSiteNumber();
      row.fiberchan = eId->slbChannelIndex();
      if (eId->htrTopBottom()==1) row.topbottom = "t";
      else row.topbottom = "b";
      //
      HcalTrigTowerDetId _id( emap->lookupTrigger(*eId) );
      if ( !(_id.null()) ){
        row.rawId     = _id.rawId();
        row.ieta      = _id.ieta();
        row.iphi      = _id.iphi();
        row.idepth    = _id.depth();
        row.subdet    = _ass.getSubdetectorString(_id.subdet());
        // fill the map
        map.push_back(row);
      }
    }
  }
  else{
    std::cerr << "Pointer to HcalElectronicsMap is 0!!!" << std::endl;
  }
}
EMap::~EMap ( ) [inline]

Definition at line 101 of file LMap.h.

{}

Member Function Documentation

std::vector< EMap::EMapRow > & EMap::get_map ( void  )
int EMap::read_map ( std::string  filename)

Definition at line 258 of file LMap.cc.

References prof2calltree::count, gather_cfg::cout, EMap::EMapRow::crate, EMap::EMapRow::dcc, EMap::EMapRow::fiber, EMap::EMapRow::fiberchan, EMap::EMapRow::idepth, EMap::EMapRow::ieta, recoMuon::in, EMap::EMapRow::iphi, beamvalidation::lines, EMap::EMapRow::rawId, EMap::EMapRow::slot, and EMap::EMapRow::spigot.

Referenced by EMap().

{
  RooGKCounter lines;

  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 ){
    EMapRow 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 . count();
      
      aRow . subdet .append( subdet );
      aRow . topbottom .append( fpga );
      
      map . push_back( aRow );
      //std::cout << "DEBUG: " << _row << std::endl;
      //std::cout << "DEBUG: " << aRow.ieta << std::endl;
    }  
  }
  inFile.close();
  std::cout << "EMap: " << lines . getCount() << " lines read" << std::endl;

  return 0;
}

Member Data Documentation

std::vector<EMapRow> EMap::map [protected]

Definition at line 141 of file LMap.h.