CMS 3D CMS Logo

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

DTLVStatus Class Reference

#include <DTLVStatus.h>

List of all members.

Public Types

typedef std::vector< std::pair
< DTLVStatusId, DTLVStatusData >
>::const_iterator 
const_iterator
 Access methods to data.

Public Member Functions

const_iterator begin () const
void clear ()
 reset content
 DTLVStatus ()
 DTLVStatus (const std::string &version)
const_iterator end () const
int get (int wheelId, int stationId, int sectorId, int &flagCFE, int &flagDFE, int &flagCMC, int &flagDMC) const
 get content
int get (const DTChamberId &id, int &flagCFE, int &flagDFE, int &flagCMC, int &flagDMC) const
int set (int wheelId, int stationId, int sectorId, int flagCFE, int flagDFE, int flagCMC, int flagDMC)
int set (const DTChamberId &id, int flagCFE, int flagDFE, int flagCMC, int flagDMC)
int setFlagCFE (int wheelId, int stationId, int sectorId, int flag)
int setFlagCFE (const DTChamberId &id, int flag)
int setFlagCMC (const DTChamberId &id, int flag)
int setFlagCMC (int wheelId, int stationId, int sectorId, int flag)
int setFlagDFE (const DTChamberId &id, int flag)
int setFlagDFE (int wheelId, int stationId, int sectorId, int flag)
int setFlagDMC (const DTChamberId &id, int flag)
int setFlagDMC (int wheelId, int stationId, int sectorId, int flag)
const std::string & version () const
 access version
std::string & version ()
 ~DTLVStatus ()

Private Member Functions

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

Private Attributes

std::vector< std::pair
< DTLVStatusId, DTLVStatusData > > 
dataList
std::string dataVersion
DTBufferTree< int, int > * dBuf

Detailed Description

Description: Class to hold CCB status

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

Definition at line 64 of file DTLVStatus.h.


Member Typedef Documentation

Access methods to data.

Definition at line 140 of file DTLVStatus.h.


Constructor & Destructor Documentation

DTLVStatus::DTLVStatus ( )

Constructor

Definition at line 35 of file DTLVStatus.cc.

References dataList, and dBuf.

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

Definition at line 42 of file DTLVStatus.cc.

References dataList, and dBuf.

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

Destructor

Definition at line 67 of file DTLVStatus.cc.

References dBuf.

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

Member Function Documentation

DTLVStatus::const_iterator DTLVStatus::begin ( void  ) const

Definition at line 367 of file DTLVStatus.cc.

References dataList.

                                                 {
  return dataList.begin();
}
void DTLVStatus::cacheMap ( ) const [private]

read and store full content

Definition at line 384 of file DTLVStatus.cc.

References dataList, dBuf, DTBufferTree< Key, Content >::insert(), and DTLVStatusId::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(3);
  while ( entryNum < entryMax ) {

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

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

  }

  return;

}
void DTLVStatus::clear ( void  )

reset content

Definition at line 152 of file DTLVStatus.cc.

References dataList, and dBuf.

                       {
//  DTDataBuffer<int,int>::dropBuffer( mapName() );
  delete dBuf;
  dBuf = 0;
  dataList.clear();
  return;
}
DTLVStatus::const_iterator DTLVStatus::end ( void  ) const

Definition at line 372 of file DTLVStatus.cc.

References dataList.

                                               {
  return dataList.end();
}
int DTLVStatus::get ( int  wheelId,
int  stationId,
int  sectorId,
int &  flagCFE,
int &  flagDFE,
int &  flagCMC,
int &  flagDMC 
) const

get content

Operations

Definition at line 84 of file DTLVStatus.cc.

References cacheMap(), data, dataList, dBuf, DTBufferTree< Key, Content >::find(), DTLVStatusData::flagCFE, DTLVStatusData::flagCMC, DTLVStatusData::flagDFE, DTLVStatusData::flagDMC, and edm::second().

                                           {
  flagCFE = 0;
  flagDFE = 0;
  flagCMC = 0;
  flagDMC = 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(3);
  chanKey.push_back(   wheelId );
  chanKey.push_back( stationId );
  chanKey.push_back(  sectorId );
  int ientry;
  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );
  if ( !searchStatus ) {
    const DTLVStatusData& data( dataList[ientry].second );
    flagCFE = data.flagCFE;
    flagDFE = data.flagDFE;
    flagCMC = data.flagCMC;
    flagDMC = data.flagDMC;
  }

  return searchStatus;

}
int DTLVStatus::get ( const DTChamberId id,
int &  flagCFE,
int &  flagDFE,
int &  flagCMC,
int &  flagDMC 
) const

Definition at line 126 of file DTLVStatus.cc.

                                           {
  return get( id.wheel(),
              id.station(),
              id.sector(),
              flagCFE,
              flagDFE,
              flagCMC,
              flagDMC );
}
std::string DTLVStatus::mapName ( ) const [private]

Definition at line 377 of file DTLVStatus.cc.

References dataVersion, and mergeVDriftHistosByStation::name.

                                    {
  std::stringstream name;
  name << dataVersion << "_map_Mtime" << this;
  return name.str();
}
int DTLVStatus::set ( int  wheelId,
int  stationId,
int  sectorId,
int  flagCFE,
int  flagDFE,
int  flagCMC,
int  flagDMC 
)

Definition at line 161 of file DTLVStatus.cc.

References cacheMap(), data, dataList, dBuf, DTBufferTree< Key, Content >::find(), DTLVStatusData::flagCFE, DTLVStatusData::flagCMC, DTLVStatusData::flagDFE, DTLVStatusData::flagDMC, DTBufferTree< Key, Content >::insert(), combine::key, edm::second(), and DTLVStatusId::stationId.

                                     {

//  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(3);
  chanKey.push_back(   wheelId );
  chanKey.push_back( stationId );
  chanKey.push_back(  sectorId );
  int ientry;
  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );

  if ( !searchStatus ) {
    DTLVStatusData& data( dataList[ientry].second );
    data.flagCFE = flagCFE;
    data.flagDFE = flagDFE;
    data.flagCMC = flagCMC;
    data.flagDMC = flagDMC;
    return -1;
  }
  else {
    DTLVStatusId key;
    key.  wheelId =   wheelId;
    key.stationId = stationId;
    key. sectorId =  sectorId;
    DTLVStatusData data;
    data.flagCFE = flagCFE;
    data.flagDFE = flagDFE;
    data.flagCMC = flagCMC;
    data.flagDMC = flagDMC;
    ientry = dataList.size();
    dataList.push_back( std::pair<DTLVStatusId,
                                  DTLVStatusData>( key, data ) );
    dBuf->insert( chanKey.begin(), chanKey.end(), ientry );
    return 0;
  }

  return 99;

}
int DTLVStatus::set ( const DTChamberId id,
int  flagCFE,
int  flagDFE,
int  flagCMC,
int  flagDMC 
)

Definition at line 216 of file DTLVStatus.cc.

                                      {
  return set( id.wheel(),
              id.station(),
              id.sector(),
              flagCFE,
              flagDFE,
              flagCMC,
              flagDMC );
}
int DTLVStatus::setFlagCFE ( const DTChamberId id,
int  flag 
)

Definition at line 256 of file DTLVStatus.cc.

References setFlagCFE(), and relativeConstraints::station.

                                         {
  return setFlagCFE( id.wheel(),
                     id.station(),
                     id.sector(),
                     flag );
}
int DTLVStatus::setFlagCFE ( int  wheelId,
int  stationId,
int  sectorId,
int  flag 
)

Definition at line 231 of file DTLVStatus.cc.

Referenced by setFlagCFE().

                                            {
  int   flagCFE;
  int   flagDFE;
  int   flagCMC;
  int   flagDMC;
  get(   wheelId,
       stationId,
        sectorId,
         flagCFE,
         flagDFE,
         flagCMC,
         flagDMC );
  return set(   wheelId,
              stationId,
               sectorId,
                   flag,
                flagDFE,
                flagCMC,
                flagDMC );
}
int DTLVStatus::setFlagCMC ( int  wheelId,
int  stationId,
int  sectorId,
int  flag 
)

Definition at line 299 of file DTLVStatus.cc.

Referenced by setFlagCMC().

                                            {
  int   flagCFE;
  int   flagDFE;
  int   flagCMC;
  int   flagDMC;
  get(   wheelId,
       stationId,
        sectorId,
         flagCFE,
         flagDFE,
         flagCMC,
         flagDMC );
  return set(   wheelId,
              stationId,
               sectorId,
                flagCFE,
                flagDFE,
                   flag,
                flagDMC );
}
int DTLVStatus::setFlagCMC ( const DTChamberId id,
int  flag 
)

Definition at line 324 of file DTLVStatus.cc.

References setFlagCMC(), and relativeConstraints::station.

                                         {
  return setFlagCMC( id.wheel(),
                     id.station(),
                     id.sector(),
                     flag );
}
int DTLVStatus::setFlagDFE ( const DTChamberId id,
int  flag 
)

Definition at line 290 of file DTLVStatus.cc.

References setFlagDFE(), and relativeConstraints::station.

                                         {
  return setFlagDFE( id.wheel(),
                     id.station(),
                     id.sector(),
                     flag );
}
int DTLVStatus::setFlagDFE ( int  wheelId,
int  stationId,
int  sectorId,
int  flag 
)

Definition at line 265 of file DTLVStatus.cc.

Referenced by setFlagDFE().

                                            {
  int   flagCFE;
  int   flagDFE;
  int   flagCMC;
  int   flagDMC;
  get(   wheelId,
       stationId,
        sectorId,
         flagCFE,
         flagDFE,
         flagCMC,
         flagDMC );
  return set(   wheelId,
              stationId,
               sectorId,
                flagCFE,
                   flag,
                flagCMC,
                flagDMC );
}
int DTLVStatus::setFlagDMC ( const DTChamberId id,
int  flag 
)

Definition at line 358 of file DTLVStatus.cc.

References setFlagDMC(), and relativeConstraints::station.

                                         {
  return setFlagDMC( id.wheel(),
                     id.station(),
                     id.sector(),
                     flag );
}
int DTLVStatus::setFlagDMC ( int  wheelId,
int  stationId,
int  sectorId,
int  flag 
)

Definition at line 333 of file DTLVStatus.cc.

Referenced by setFlagDMC().

                                            {
  int   flagCFE;
  int   flagDFE;
  int   flagCMC;
  int   flagDMC;
  get(   wheelId,
       stationId,
        sectorId,
         flagCFE,
         flagDFE,
         flagCMC,
         flagDMC );
  return set(   wheelId,
              stationId,
               sectorId,
                flagCFE,
                flagDFE,
                flagCMC,
                   flag );
}
const std::string & DTLVStatus::version ( ) const

access version

Definition at line 142 of file DTLVStatus.cc.

References dataVersion.

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

Definition at line 147 of file DTLVStatus.cc.

References dataVersion.

                               {
  return dataVersion;
}

Member Data Documentation

std::vector< std::pair<DTLVStatusId,DTLVStatusData> > DTLVStatus::dataList [private]

Definition at line 148 of file DTLVStatus.h.

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

std::string DTLVStatus::dataVersion [private]

Definition at line 146 of file DTLVStatus.h.

Referenced by mapName(), and version().

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

Definition at line 150 of file DTLVStatus.h.

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