CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

DTHVStatus Class Reference

#include <DTHVStatus.h>

List of all members.

Public Types

typedef std::vector< std::pair
< DTHVStatusId, DTHVStatusData >
>::const_iterator 
const_iterator
 Access methods to data.

Public Member Functions

int badChannelsNumber () const
int badChannelsNumber (const DTChamberId &id) const
const_iterator begin () const
void clear ()
 reset content
 DTHVStatus (const std::string &version)
 DTHVStatus ()
const_iterator end () const
int get (int wheelId, int stationId, int sectorId, int slId, int layerId, int partId, int &fCell, int &lCell, int &flagA, int &flagC, int &flagS) const
 get content
int get (const DTLayerId &id, int partId, int &fCell, int &lCell, int &flagA, int &flagC, int &flagS) const
int get (const DTWireId &id, int &flagA, int &flagC, int &flagS) const
int offChannelsNumber (const DTChamberId &id) const
int offChannelsNumber () const
int set (int wheelId, int stationId, int sectorId, int slId, int layerId, int partId, int fCell, int lCell, int flagA, int flagC, int flagS)
int set (const DTLayerId &id, int partId, int fCell, int lCell, int flagA, int flagC, int flagS)
int setFlagA (int wheelId, int stationId, int sectorId, int slId, int layerId, int partId, int flag)
int setFlagA (const DTLayerId &id, int partId, int flag)
int setFlagC (int wheelId, int stationId, int sectorId, int slId, int layerId, int partId, int flag)
int setFlagC (const DTLayerId &id, int partId, int flag)
int setFlagS (const DTLayerId &id, int partId, int flag)
int setFlagS (int wheelId, int stationId, int sectorId, int slId, int layerId, int partId, int flag)
const std::string & version () const
 access version
std::string & version ()
 ~DTHVStatus ()

Private Member Functions

void cacheMap () const
 read and store full content
std::string mapName () const

Private Attributes

std::vector< std::pair
< DTHVStatusId, DTHVStatusData > > 
dataList
std::string dataVersion
DTBufferTree< int, int > * dBuf

Detailed Description

Description: Class to hold high voltage status ( half layer by half layer )

Date:
2010/01/20 18:20:08
Revision:
1.3
Author:
Paolo Ronchese INFN Padova

Definition at line 71 of file DTHVStatus.h.


Member Typedef Documentation

Access methods to data.

Definition at line 173 of file DTHVStatus.h.


Constructor & Destructor Documentation

DTHVStatus::DTHVStatus ( )

Constructor

Definition at line 37 of file DTHVStatus.cc.

References dataList, and dBuf.

                      :
  dataVersion( " " ) {
  dataList.reserve( 10 );
  dBuf = 0;
}
DTHVStatus::DTHVStatus ( const std::string &  version)

Definition at line 44 of file DTHVStatus.cc.

References dataList, and dBuf.

                                                :
  dataVersion( version ) {
  dataList.reserve( 10 );
  dBuf = 0;
}
DTHVStatus::~DTHVStatus ( )

Destructor

Definition at line 71 of file DTHVStatus.cc.

References dBuf.

                        {
//  DTDataBuffer<int,int>::dropBuffer( mapName() );
  delete dBuf;
}

Member Function Documentation

int DTHVStatus::badChannelsNumber ( ) const

Definition at line 229 of file DTHVStatus.cc.

References begin(), runTheMatrix::data, end(), DTHVStatusData::fCell, DTHVStatusData::flagA, DTHVStatusData::flagC, DTHVStatusData::flagS, and DTHVStatusData::lCell.

                                        {
  int offNum = 0;
  DTHVStatus::const_iterator iter = begin();
  DTHVStatus::const_iterator iend = end();
  while ( iter != iend ) {
    const std::pair<DTHVStatusId,DTHVStatusData>& entry = *iter++;
    DTHVStatusId   hvId = entry.first;
    DTHVStatusData data = entry.second;
    if ( data.flagA || data.flagC || data.flagS )
         offNum += ( 1 + data.lCell - data.fCell );
  }
  return offNum;
}
int DTHVStatus::badChannelsNumber ( const DTChamberId id) const

Definition at line 244 of file DTHVStatus.cc.

References begin(), runTheMatrix::data, end(), DTHVStatusData::fCell, DTHVStatusData::flagA, DTHVStatusData::flagC, DTHVStatusData::flagS, DTHVStatusData::lCell, and DTHVStatusId::stationId.

                                                               {
  int offNum = 0;
  DTHVStatus::const_iterator iter = begin();
  DTHVStatus::const_iterator iend = end();
  while ( iter != iend ) {
    const std::pair<DTHVStatusId,DTHVStatusData>& entry = *iter++;
    DTHVStatusId   hvId = entry.first;
    DTHVStatusData data = entry.second;
    if ( hvId.  wheelId != id.  wheel() ) continue;
    if ( hvId.stationId != id.station() ) continue;
    if ( hvId. sectorId != id. sector() ) continue;
    if ( data.flagA || data.flagC || data.flagS )
         offNum += ( 1 + data.lCell - data.fCell );
  }
  return offNum;
}
DTHVStatus::const_iterator DTHVStatus::begin ( void  ) const
void DTHVStatus::cacheMap ( ) const [private]

read and store full content

Definition at line 534 of file DTHVStatus.cc.

References dataList, dBuf, DTBufferTree< Key, Content >::insert(), and DTHVStatusId::stationId.

Referenced by get(), and set().

                                {

//  std::string mName = mapName();
//  DTBufferTree<int,int>* dBuf =
//  DTDataBuffer<int,int>::openBuffer( mName );
  DTBufferTree<int,int>** pBuf;
  pBuf = const_cast<DTBufferTree<int,int>**>( &dBuf );
  *pBuf = new DTBufferTree<int,int>;

  int entryNum = 0;
  int entryMax = dataList.size();
  std::vector<int> chanKey;
  chanKey.reserve(6);
  while ( entryNum < entryMax ) {

    const DTHVStatusId& chan = dataList[entryNum].first;

    chanKey.clear();
    chanKey.push_back( chan.  wheelId );
    chanKey.push_back( chan.stationId );
    chanKey.push_back( chan. sectorId );
    chanKey.push_back( chan.     slId );
    chanKey.push_back( chan.  layerId );
    chanKey.push_back( chan.   partId );
    dBuf->insert( chanKey.begin(), chanKey.end(), entryNum++ );

  }

  return;

}
void DTHVStatus::clear ( void  )

reset content

Definition at line 273 of file DTHVStatus.cc.

References dataList, and dBuf.

                       {
//  DTDataBuffer<int,int>::dropBuffer( mapName() );
  delete dBuf;
  dBuf = 0;
  dataList.clear();
  dataList.reserve( 10 );
  return;
}
DTHVStatus::const_iterator DTHVStatus::end ( void  ) const
int DTHVStatus::get ( const DTLayerId id,
int  partId,
int &  fCell,
int &  lCell,
int &  flagA,
int &  flagC,
int &  flagS 
) const

Definition at line 139 of file DTHVStatus.cc.

                                           {
  return get( id.wheel(),
              id.station(),
              id.sector(),
              id.superLayer(),
              id.layer(),
              partId,
              fCell, lCell, flagA, flagC, flagS );
}
int DTHVStatus::get ( const DTWireId id,
int &  flagA,
int &  flagC,
int &  flagS 
) const

Definition at line 156 of file DTHVStatus.cc.

                                                {
  flagA = flagC = flagS = 0;
  int iCell = id.wire();
  int fCell;
  int lCell;
  int
  fCheck = get( id.wheel(),
                id.station(),
                id.sector(),
                id.superLayer(),
                id.layer(),
                0,     fCell, lCell,
                flagA, flagC, flagS );
  if ( ( fCheck == 0 ) &&
       ( fCell <= iCell ) &&
       ( lCell >= iCell ) ) return 0;
  fCheck = get( id.wheel(),
                id.station(),
                id.sector(),
                id.superLayer(),
                id.layer(),
                1,     fCell, lCell,
                flagA, flagC, flagS );
  if ( ( fCheck == 0 ) &&
       ( fCell <= iCell ) &&
       ( lCell >= iCell ) ) return 0;
  flagA = flagC = flagS = 0;
  return 1;
}
int DTHVStatus::get ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  partId,
int &  fCell,
int &  lCell,
int &  flagA,
int &  flagC,
int &  flagS 
) const

get content

Operations

Definition at line 88 of file DTHVStatus.cc.

References cacheMap(), runTheMatrix::data, dataList, dBuf, DTHVStatusData::fCell, DTBufferTree< Key, Content >::find(), DTHVStatusData::flagA, DTHVStatusData::flagC, DTHVStatusData::flagS, DTHVStatusData::lCell, and edm::second().

Referenced by DTHVHandler::get(), and DTHVStatusHandler::setChannelFlag().

                                           {
  fCell =
  lCell =
  flagA =
  flagC = 
  flagS = 0;

//  std::string mName = mapName();
//  DTBufferTree<int,int>* dBuf =
//  DTDataBuffer<int,int>::findBuffer( mName );
//  if ( dBuf == 0 ) {
//    cacheMap();
//    dBuf =
//    DTDataBuffer<int,int>::findBuffer( mName );
//  }
  if ( dBuf == 0 ) cacheMap();

  std::vector<int> chanKey;
  chanKey.reserve(6);
  chanKey.push_back(   wheelId );
  chanKey.push_back( stationId );
  chanKey.push_back(  sectorId );
  chanKey.push_back(      slId );
  chanKey.push_back(   layerId );
  chanKey.push_back(    partId );
  int ientry;
  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );
  if ( !searchStatus ) {
    const DTHVStatusData& data( dataList[ientry].second );
    fCell = data.fCell;
    lCell = data.lCell;
    flagA = data.flagA;
    flagC = data.flagC;
    flagS = data.flagS;
  }

  return searchStatus;

}
std::string DTHVStatus::mapName ( ) const [private]

Definition at line 527 of file DTHVStatus.cc.

References dataVersion, and AlCaRecoCosmics_cfg::name.

                                    {
  std::stringstream name;
  name << dataVersion << "_map_HV" << this;
  return name.str();
}
int DTHVStatus::offChannelsNumber ( const DTChamberId id) const

Definition at line 208 of file DTHVStatus.cc.

References begin(), runTheMatrix::data, end(), DTHVStatusData::fCell, DTHVStatusData::flagA, DTHVStatusData::flagC, DTHVStatusData::flagS, DTHVStatusData::lCell, and DTHVStatusId::stationId.

                                                               {
  int offNum = 0;
  DTHVStatus::const_iterator iter = begin();
  DTHVStatus::const_iterator iend = end();
  while ( iter != iend ) {
    const std::pair<DTHVStatusId,DTHVStatusData>& entry = *iter++;
    DTHVStatusId   hvId = entry.first;
    DTHVStatusData data = entry.second;
    if ( hvId.  wheelId != id.  wheel() ) continue;
    if ( hvId.stationId != id.station() ) continue;
    if ( hvId. sectorId != id. sector() ) continue;
    int offA = data.flagA & 1;
    int offC = data.flagC & 1;
    int offS = data.flagS & 1;
    if ( offA || offC || offS )
         offNum += ( 1 + data.lCell - data.fCell );
  }
  return offNum;
}
int DTHVStatus::offChannelsNumber ( ) const

Definition at line 190 of file DTHVStatus.cc.

References begin(), runTheMatrix::data, end(), DTHVStatusData::fCell, DTHVStatusData::flagA, DTHVStatusData::flagC, DTHVStatusData::flagS, and DTHVStatusData::lCell.

                                        {
  int offNum = 0;
  DTHVStatus::const_iterator iter = begin();
  DTHVStatus::const_iterator iend = end();
  while ( iter != iend ) {
    const std::pair<DTHVStatusId,DTHVStatusData>& entry = *iter++;
    DTHVStatusId   hvId = entry.first;
    DTHVStatusData data = entry.second;
    int offA = data.flagA & 1;
    int offC = data.flagC & 1;
    int offS = data.flagS & 1;
    if ( offA || offC || offS )
         offNum += ( 1 + data.lCell - data.fCell );
  }
  return offNum;
}
int DTHVStatus::set ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  partId,
int  fCell,
int  lCell,
int  flagA,
int  flagC,
int  flagS 
)

Definition at line 283 of file DTHVStatus.cc.

References cacheMap(), runTheMatrix::data, dataList, dBuf, DTHVStatusData::fCell, DTBufferTree< Key, Content >::find(), DTHVStatusData::flagA, DTHVStatusData::flagC, DTHVStatusData::flagS, DTBufferTree< Key, Content >::insert(), combine::key, DTHVStatusData::lCell, edm::second(), and DTHVStatusId::stationId.

Referenced by DTHVStatusHandler::setChannelFlag().

                                     {

//  std::string mName = mapName();
//  DTBufferTree<int,int>* dBuf =
//  DTDataBuffer<int,int>::findBuffer( mName );
//  if ( dBuf == 0 ) {
//    cacheMap();
//    dBuf =
//    DTDataBuffer<int,int>::findBuffer( mName );
//  }
  if ( dBuf == 0 ) cacheMap();
  std::vector<int> chanKey;
  chanKey.reserve(6);
  chanKey.push_back(   wheelId );
  chanKey.push_back( stationId );
  chanKey.push_back(  sectorId );
  chanKey.push_back(      slId );
  chanKey.push_back(   layerId );
  chanKey.push_back(    partId );
  int ientry;
  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );

  if ( !searchStatus ) {
    DTHVStatusData& data( dataList[ientry].second );
    data.fCell = fCell;
    data.lCell = lCell;
    data.flagA = flagA;
    data.flagC = flagC;
    data.flagS = flagS;
    return -1;
  }
  else {
    DTHVStatusId key;
    key.  wheelId =   wheelId;
    key.stationId = stationId;
    key. sectorId =  sectorId;
    key.     slId =      slId;
    key.  layerId =   layerId;
    key.   partId =    partId;
    DTHVStatusData data;
    data.fCell = fCell;
    data.lCell = lCell;
    data.flagA = flagA;
    data.flagC = flagC;
    data.flagS = flagS;
    ientry = dataList.size();
    dataList.push_back( std::pair<DTHVStatusId,
                                  DTHVStatusData>( key, data ) );
    dBuf->insert( chanKey.begin(), chanKey.end(), ientry );
    return 0;
  }

  return 99;

}
int DTHVStatus::set ( const DTLayerId id,
int  partId,
int  fCell,
int  lCell,
int  flagA,
int  flagC,
int  flagS 
)

Definition at line 350 of file DTHVStatus.cc.

                                     {
  return set( id.wheel(),
              id.station(),
              id.sector(),
              id.superLayer(),
              id.layer(),
              partId,
              fCell, lCell, flagA, flagC, flagS );
}
int DTHVStatus::setFlagA ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  partId,
int  flag 
)

Definition at line 367 of file DTHVStatus.cc.

Referenced by setFlagA().

                                          {
  int fCell;
  int lCell;
  int flagA;
  int flagC;
  int flagS;
  get(   wheelId,
       stationId,
        sectorId,
            slId,
         layerId,
          partId,
           fCell,
           lCell,
           flagA,
           flagC,
           flagS );
  return set(   wheelId,
              stationId,
               sectorId,
                   slId,
                layerId,
                 partId,
                  fCell,
                  lCell,
                   flag,
                  flagC,
                  flagS );
}
int DTHVStatus::setFlagA ( const DTLayerId id,
int  partId,
int  flag 
)

Definition at line 404 of file DTHVStatus.cc.

References setFlagA(), and relativeConstraints::station.

                                          {
  return setFlagA( id.wheel(),
                   id.station(),
                   id.sector(),
                   id.superLayer(),
                   id.layer(),
                   partId,
                   flag );
}
int DTHVStatus::setFlagC ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  partId,
int  flag 
)

Definition at line 417 of file DTHVStatus.cc.

Referenced by setFlagC().

                                          {
  int fCell;
  int lCell;
  int flagA;
  int flagC;
  int flagS;
  get(   wheelId,
       stationId,
        sectorId,
            slId,
         layerId,
          partId,
           fCell,
           lCell,
           flagA,
           flagC,
           flagS );
  return set(   wheelId,
              stationId,
               sectorId,
               slId,
                layerId,
                 partId,
                  fCell,
                  lCell,
                  flagA,
                   flag,
                  flagS );
}
int DTHVStatus::setFlagC ( const DTLayerId id,
int  partId,
int  flag 
)

Definition at line 454 of file DTHVStatus.cc.

References setFlagC(), and relativeConstraints::station.

                                          {
  return setFlagC( id.wheel(),
                   id.station(),
                   id.sector(),
                   id.superLayer(),
                   id.layer(),
                   partId,
                   flag );
}
int DTHVStatus::setFlagS ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  partId,
int  flag 
)

Definition at line 467 of file DTHVStatus.cc.

Referenced by setFlagS().

                                          {
  int fCell;
  int lCell;
  int flagA;
  int flagC;
  int flagS;
  get(   wheelId,
       stationId,
        sectorId,
            slId,
         layerId,
          partId,
           fCell,
           lCell,
           flagA,
           flagC,
           flagS );
  return set(   wheelId,
              stationId,
               sectorId,
                   slId,
                layerId,
                 partId,
                  fCell,
                  lCell,
                  flagA,
                  flagC,
                   flag );
}
int DTHVStatus::setFlagS ( const DTLayerId id,
int  partId,
int  flag 
)

Definition at line 504 of file DTHVStatus.cc.

References setFlagS(), and relativeConstraints::station.

                                          {
  return setFlagS( id.wheel(),
                   id.station(),
                   id.sector(),
                   id.superLayer(),
                   id.layer(),
                   partId,
                   flag );
}
const std::string & DTHVStatus::version ( ) const

access version

Definition at line 263 of file DTHVStatus.cc.

References dataVersion.

                                     {
  return dataVersion;
}
std::string & DTHVStatus::version ( )

Definition at line 268 of file DTHVStatus.cc.

References dataVersion.

                               {
  return dataVersion;
}

Member Data Documentation

std::vector< std::pair<DTHVStatusId,DTHVStatusData> > DTHVStatus::dataList [private]

Definition at line 181 of file DTHVStatus.h.

Referenced by begin(), cacheMap(), clear(), DTHVStatus(), end(), get(), and set().

std::string DTHVStatus::dataVersion [private]

Definition at line 179 of file DTHVStatus.h.

Referenced by mapName(), and version().

DTBufferTree<int,int>* DTHVStatus::dBuf [private]

Definition at line 183 of file DTHVStatus.h.

Referenced by cacheMap(), clear(), DTHVStatus(), get(), set(), and ~DTHVStatus().